window.NOIBUJS_CONFIG={"scriptID":"1.0.60"};(()=>{var e={327:e=>{for(var t=[],n=0;n<256;++n)t[n]=(n+256).toString(16).substr(1);e.exports=function(e,n){var r=n||0,s=t;return[s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],"-",s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]],s[e[r++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},358:(e,t,n)=>{var r=n(217),s=n(327);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;++a)t[i+a]=o[a];return t||s(o)}}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=["metroplexSocketBase","metroplexHTTPBase"],t=["authorization","from","proxy-authorization","content-md5","cookie","x-forwarded-for","x-real-ip","x-device-id","x-request-id","x-auth-token","x-user-id","x-forwarded-for","x-uidh","set-cookie","forwarded"],r=[/\b4\d{12}(?:\d{3})?\b/,/\b(?:5[1-5]\d{2}|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}\b/,/\b3[47]\d{13}\b/,/\b3(?:0[0-5]|[68]\d)\d{11}\b/,/\b6(?:011|5\d{2})\d{12}\b/,/\b(?:2131|1800|35\d{3})\d{11}\b/,/\b[a-z0-9!#$%&'*+/=?^_‘{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_‘{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\b/,/\b(?!000|666)[0-8]\d{2}[-.● ]?(?!00)\d{2}[-.● ]?(?!0000)\d{4}\b/,/\b(\d{3}[-.● ]?\d{3}[-.● ]?\d{3})\b/,/\+(?:\d●?){6,14}\d\b/,/(\b|\+)?(1[-.● ]?)?\(?(\d{3})\)?[-.● ]?(\d{3})[-.● ]?(\d{4})\b/],s=/^www\d{0,2}$/,i=["Image","EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];function o(){return window.NOIBUJS_CONFIG?window.NOIBUJS_CONFIG:{}}const a=["i.noibu","i.staging.noibu","input.staging.noibu","input.b.noibu","input.noibu","vf.staging.noibu","vf.noibu"],c=["error","warn","log"],l=["pagehide","pageshow","focus","blur","popstate","online","offline","messageerror","languagechange","hashchange","beforeprint","afterprint","load","resize"],u=["visibilitychange","resume","freeze","readystatechange","cut","copy","paste"],d=new Set(["--quantum-metric-background-image","--quantum-metric-background-position-x","--quantum-metric-background-position-y","--quantum-metric-background-size","--quantum-metric-background-attachment","--quantum-metric-background-origin","--quantum-metric-background-clip","--quantum-metric-background-color","--quantum-metric-border-image-source","--quantum-metric-border-image-slice","--quantum-metric-border-image-width","--quantum-metric-border-image-outset","--quantum-metric-border-image-repeat","--quantum-metric-border-top-style","--quantum-metric-border-right-style","--quantum-metric-border-bottom-style","--quantum-metric-border-left-style","--quantum-metric-border-top-color","--quantum-metric-border-right-color","--quantum-metric-border-bottom-color","--quantum-metric-border-left-color","--quantum-metric-border-top-width","--quantum-metric-border-right-width","--quantum-metric-border-bottom-width","--quantum-metric-border-left-width","--quantum-metric-flex-wrap","--quantum-metric-list-style-image","--quantum-metric-list-style-position","--quantum-metric-max-width","--quantum-metric-outline-color","--quantum-metric-outline-style","--quantum-metric-outline-width"]);function h(){const e=o();return e.scriptID?e.scriptID:"default"}function p(){const e=o();return!!e.njs_version&&"beta"===e.njs_version}function g(){try{const e=p()?"wss://input.b.noibu.com":"wss://input.noibu.com";return e.endsWith("/")?e.slice(0,-1):e}catch(e){return"ws://localhost:3000"}}function m(){try{const e=p()?"https://input.b.noibu.com":"https://input.noibu.com";return e.endsWith("/")?e.slice(0,-1):e}catch(e){return"http://localhost:3000"}}function f(){return m()+"/pv"}function I(){try{return"prod"}catch(e){return"test"}}const y=/("href":["']([^"]*\.css[^"]*)["'])/gi;var v=n(358),C=n.n(v);const b=(e,t,n)=>{if(!(t in e))return;const r=e[t],s=n(r);if("function"==typeof s)try{s.prototype=s.prototype||{},Object.defineProperties(s,{__noibu__:{enumerable:!1,value:!0},__noibu_original__:{enumerable:!1,value:r},__noibu_wrapped__:{enumerable:!1,value:s}})}catch(e){}e[t]=s},S=(e,t)=>{if(!e||!e.hasOwnProperty||!Object.prototype.hasOwnProperty.call(e,t))return!1;const n=Object.getOwnPropertyDescriptor(e,t);if(!n.writable){if(!n.configurable)return!1;Object.defineProperty(e,t,{writable:!0})}return!0},w=e=>{if(!e||!e[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");const t={};for(const[n,r]of e)t[n]=r;return t};function A(e){return e.split("\n").reduce((function(e,t){var n=function(e){var t=k.exec(e);if(!t)return null;var n=t[2]&&0===t[2].indexOf("native"),r=t[2]&&0===t[2].indexOf("eval"),s=E.exec(t[2]);r&&null!=s&&(t[2]=s[1],t[3]=s[2],t[4]=s[3]);return{file:n?null:t[2],methodName:t[1]||"<unknown>",arguments:n?[t[2]]:[],lineNumber:t[3]?+t[3]:null,column:t[4]?+t[4]:null}}(t)||function(e){var t=R.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||"<unknown>",arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=_.exec(e);if(!t)return null;var n=t[3]&&t[3].indexOf(" > eval")>-1,r=T.exec(t[3]);n&&null!=r&&(t[3]=r[1],t[4]=r[2],t[5]=null);return{file:t[3],methodName:t[1]||"<unknown>",arguments:t[2]?t[2].split(","):[],lineNumber:t[4]?+t[4]:null,column:t[5]?+t[5]:null}}(t)||function(e){var t=N.exec(e);if(!t)return null;return{file:t[2],methodName:t[1]||"<unknown>",arguments:[],lineNumber:+t[3],column:t[4]?+t[4]:null}}(t)||function(e){var t=M.exec(e);if(!t)return null;return{file:t[3],methodName:t[1]||"<unknown>",arguments:[],lineNumber:+t[4],column:t[5]?+t[5]:null}}(t);return n&&e.push(n),e}),[])}var k=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,E=/\((\S*)(?::(\d+))(?::(\d+))\)/;var R=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;var _=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,T=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;var M=/^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;var N=/^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;function D(e,t=1024){return e?e.length<t?e:e.substring(0,t):e}function O(){let e=window.location.href;return window.location.href.startsWith("http")?e=window.location.href:window.parent&&window.parent.location&&window.parent.location.href.startsWith("http")&&(e=window.parent.location.href),D(e)}function L(e){let t=[{line:"_",mname:"_",file:"_"}];if("object"!=typeof e||!e)return{frames:t,msg:""};e.stack?t=A(e.stack).map(e=>{const t={line:"_",mname:"_",file:"_"};return e.lineNumber&&"<unknown>"!==e.lineNumber&&(t.line=String(e.lineNumber)),e.methodName&&"<unknown>"!==e.methodName&&(t.mname=String(e.methodName)),e.file&&"<unknown>"!==e.file&&(t.file=String(e.file)),e.column&&"number"==typeof e.column&&(t.column=e.column),t}):(e.fileName&&"string"==typeof e.fileName&&(t[0].file=e.fileName),e.lineNumber&&(t[0].line=String(e.lineNumber)),e.columnNumber&&Number.isInteger(e.columnNumber)&&(t[0].column=e.columnNumber)),t.length>=50&&(t=t.slice(0,50));return{frames:t,msg:e.message?D(e.message):""}}function x(e){if(Array.prototype.toJSON){const t=Array.prototype.toJSON;delete Array.prototype.toJSON;const n=JSON.stringify(e);return Array.prototype.toJSON=t,n}return JSON.stringify(e)}function P(e,t,n,r,s,i){if(i){const e=x(n),s=new Blob([e]).size;return!window.fetch||s>59e3?new Promise(e=>{e()}):fetch(t,{method:"POST",headers:r,body:x(n),keepalive:!0})}return new Promise((i,o)=>{const a=new XMLHttpRequest;a.open(e,t),a.timeout=s,Object.keys(r).forEach(e=>{a.setRequestHeader(e,r[e])}),a.onload=()=>{a.status>=200&&a.status<300?i(a.response):o(new Error("Custom Request failed: "+a.statusText))},a.onerror=()=>{o(new Error("Custom Request failed: "+a.statusText))},n?a.send(x(n)):a.send()})}function F(){const e=o();return e.sel&&Array.isArray(e.sel)}function V(){const e=o();return function(){const e=o();return e.http_re&&Array.isArray(e.http_re)}()?e.http_re:[]}function U(){const e=o(),t=[".noibu-blocked",".creditCard"];return F()&&t.push(...e.sel),""+t.join(",")}function q(){const e="1"===window.navigator.doNotTrack,t=function(e){let t=e;return t||(t=window.navigator.userAgent),t=t.toLowerCase(),new RegExp("(bot|crawl(er)?|sp(i|y)der|search|worm|fetch|nutch|headless|baidu|teoma|yandex|woorankreview|pingdom|synthetic|dataprovider|qaautomation|morningscore|wappalyzer|foregenix|StatusCake|SpeedCurve|Outlook-iOS|bitdiscovery|testing|webflow|bingpreview|(r|R)igor|facebookexternalhit/\\d+\\.\\d+)","i").test(t)}(null);return e||t}function G(e){return e?"object"==typeof e?x(e):String(e):""}function B(e){let t=D(window.location.href);return e&&""!==e.trim()&&"undefined"!==e&&(t=G(D(e))),t}const W={"input.noibu.com":!0,"input.staging.noibu.com":!0,"vf.noibu.com":!0,"vf.staging.noibu.com":!0,"cdn.noibu.com":!0};class H{constructor(e){this._provider=e}static isAvailable(e){let t=!0,n=null;try{const t=e();t.setItem("n_key",0),t.removeItem("n_key")}catch(e){t=!1,n=e}return{result:t,error:n}}load(e){return this._provider.getItem(e)}save(e,t){this._provider.setItem(e,t)}remove(e){this._provider.removeItem(e)}calculateUsedSize(){let e=0;for(let t=0;t<this._provider.length;t++){const n=this._provider.key(t);if(n){e+=n.length;const t=this._provider.getItem(n);t&&(e+=t.length)}}return e}}class Z extends H{constructor(){super(window.localStorage)}static isAvailable(){return H.isAvailable(()=>window.localStorage)}}class z extends H{constructor(){super(window.sessionStorage)}static isAvailable(){return H.isAvailable(()=>window.sessionStorage)}}class K{constructor(){const e=Z.isAvailable(),t=z.isAvailable();this._isLocalStorageAvailable=e.result,this._isSessionStorageAvailable=t.result,this._localStorageError=e.error,this._sessionStorageError=t.error,this._provider=null,this._type="unavailable",this._isLocalStorageAvailable?(this._provider=new Z,this._type="LocalStorage"):this._isSessionStorageAvailable&&(this._provider=new z,this._type="SessionStorage")}static getInstance(){return this._instance||(this._instance=new K),this._instance}isAvailable(){return null!=this._provider}load(e){return this.isAvailable()?this._provider.load(e):null}save(e,t){this.isAvailable()&&this._provider.save(e,t)}remove(e){this.isAvailable()&&this._provider.remove(e)}calculateUsedSize(){return this.isAvailable()?this._provider.calculateUsedSize():0}getDiagnoseInfo(){return`storage provider: ${this._type} (localStorage available: ${this._isLocalStorageAvailable}, error: ${this._localStorageError}) (sessionStorage available: ${this._isSessionStorageAvailable}, error: ${this._sessionStorageError})`}}class j{constructor(e){this.pageVisitId=C()(),this.isClientDisabled=null,this.browserId=null,this.pageVisitSeq=null,this.lastActiveTime=new Date,this.noibuErrorURL=e,this._setupStorageVars(),this.cltErrorPostCounter=0,this.maxSocketInactiveTime=2100}static configureInstance(e){this.instance||(this.noibuErrorURL=e,this.instance=new j(e),this.instance.noibuErrorURL=e)}static getInstance(){if(!this.instance)throw new Error("ClientConfig was not configured");return this.instance}lockClient(e,t){const n=new Date;n.setMinutes(n.getMinutes()+e);const r=this._getClientState();r.DisabledStatus=!0,r.ClientUnlockTime=n,this._storeBrowserData(r),this.postNoibuErrorAndOptionallyDisableClient(t,!0,"warn")}lockClientUntilNextPage(e){this.postNoibuErrorAndOptionallyDisableClient(e,!0,"warn")}updateLastActiveTime(e){this.lastActiveTime=e;const t=this._getLsObject();t.LastActive=e,this._storeBrowserData(t)}getPageVisitSeq(){if(this._pageVisitSeqNeedsReset()){this.pageVisitSeq=0;const e=this._getLsObject();e.CurrentPageVisitCount=this.pageVisitSeq+1,e.LastActive=new Date,this._storeBrowserData(e)}return this.pageVisitSeq}_getLsObject(){const e=K.getInstance().load("n_browser_data");if(!e)return this._generateAndStoreData();let t={};try{t=JSON.parse(e)}catch(e){return this._generateAndStoreData()}return null==t.BrowserId||null==t.DisabledStatus||null==t.CurrentPageVisitCount||null==t.LastActive?this._generateAndStoreData():t}_pageVisitSeqNeedsReset(){const e=this._getClientState(),t=new Date;return t.setMinutes(t.getMinutes()-45),new Date(e.LastActive)<t}_setupStorageVars(){const e=K.getInstance();if(!e.isAvailable())return void this.postNoibuErrorAndOptionallyDisableClient("Storage is unavailable, disabling client. "+e.getDiagnoseInfo(),!0,"error");const t=this._getClientState();if(this._pageVisitSeqNeedsReset()&&(t.CurrentPageVisitCount=0),this.browserId=t.BrowserId,this.pageVisitSeq=t.CurrentPageVisitCount,this.isClientDisabled=t.DisabledStatus,this.isClientDisabled)return;if(t.CurrentPageVisitCount+=1,t.LastActive=new Date,I().includes("video")&&(t.pvId=this.pageVisitId),t.CurrentPageVisitCount>=300){const e=new Date;e.setMinutes(e.getMinutes()+45),t.ClientUnlockTime=e,t.DisabledStatus=!0,this.postNoibuErrorAndOptionallyDisableClient("Hit max page visits, disabling client for 45mins",!0,"error")}null===this._storeBrowserData(t).BrowserId&&(this.postNoibuErrorAndOptionallyDisableClient("Null browser in storage, disabling client",!0,"error"),this.browserId=null)}_getClientState(){const e=this._getLsObject();return e.ClientUnlockTime&&new Date(e.ClientUnlockTime)<=new Date&&(e.ClientUnlockTime=null,e.DisabledStatus=!1,this._storeBrowserData(e)),e}_generateAndStoreData(){return this._storeBrowserData(this._generateNewBrowserData())}_generateNewBrowserData(){const e={DisabledStatus:!1,BrowserId:C()(),CurrentPageVisitCount:0,ClientUnlockTime:null,LastActive:new Date};return I().includes("video")&&(e.pvId=this.pageVisitId),e}_storeBrowserData(e){const t=K.getInstance();try{return t.save("n_browser_data",x(e)),e}catch(e){this.postNoibuErrorAndOptionallyDisableClient(`Error writing browser data to storage, disabling client: ${e.message}, `+t.getDiagnoseInfo(),!0,"error");return{DisabledStatus:!0,BrowserId:null,CurrentPageVisitCount:0}}}postNoibuErrorAndOptionallyDisableClient(e,t,n,r=!1){if(this.isClientDisabled)return;if(t&&(this.isClientDisabled=!0),"warn"===n)return;let s=`Noibu Browser ID(${this.browserId?this.browserId:""}), PV ID ${this.pageVisitId}, Script ID ${h()}, and User Agent ${window.navigator.userAgent} error: ${G(e)}`;if(this.cltErrorPostCounter>=50){const e=new Date;e.setMinutes(e.getMinutes()+10);const t=this._getClientState();t.DisabledStatus=!0,t.ClientUnlockTime=e,this._storeBrowserData(t),this.isClientDisabled=!0,s="Shutting collect off, we reached the maximum limit of collect errors sent."}const i={url:window.location.href,err_msg:s,sev:n},o={"content-type":"application/json"};r?fetch(this.noibuErrorURL,{method:"POST",headers:o,body:x(i),keepalive:!0}):P("POST",this.noibuErrorURL,i,o,2e3,!1).catch(()=>{}),"error"===n&&(this.cltErrorPostCounter+=1)}isInactive(){const e=new Date;return e.setSeconds(e.getSeconds()-this.maxSocketInactiveTime),this.lastActiveTime<e}}function Y(e,t,n,r){if(!e||!t||!n)return;const s=e=>{try{n(e)}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("addEventListener callback error: "+e.message,!1,"error")}};try{e.addEventListener(t,s,r)}catch(n){if(n instanceof TypeError&&(()=>{if(!Reflect)return!1;try{Reflect.get(e,"addEventListener")(t,s,r)}catch(e){return!1}return!0})())return;j.getInstance().postNoibuErrorAndOptionallyDisableClient("addEventListener error: "+n.message,!1,"error")}}class J{constructor(){this.expectedVideoLength=0,this.expectedVfSeq=0,this.httpSequenceNumber=0,this.httpOverLimitCount=0,this.httpDroppedPayloadByTypeCount=0,this.httpDroppedPayloadByLengthCount=0,this.httpPayloadCount=0,this.expectedPvPart=0,this.videoClicks=0,this.pvClicks=0,this.errCount=0,this.httpCount=0,this.didCutPv=!1,this.didCutVideo=!1,this.writeTimeout=null,this.didStartVideo=!1,this._setupListeners()}static getInstance(){return this.instance||(this.instance=new J),this.instance}addVideoFragData(e,t){this.expectedVfSeq=e,this.expectedVideoLength=t}setPvPart(e){this.expectedPvPart=e}addVideoClick(){this.videoClicks+=1}addPvClick(){this.pvClicks+=1}addError(){this.errCount+=1}addHttpEvent(){this.httpCount+=1}addHttpData(){this.httpSequenceNumber+=1}addHttpDataOverLimit(){this.httpOverLimitCount+=1}addHttpDataDropByType(){this.httpDroppedPayloadByTypeCount+=1}addHttpDataDropByLength(){this.httpDroppedPayloadByLengthCount+=1}addHttpDataPayloadCount(){this.httpPayloadCount+=1}setDidCutVideo(){this.didCutVideo=!0}setDidStartVideo(){this.didStartVideo=!0}setDidCutPv(){this.didCutPv=!0}_setupListeners(){Y(window,"pagehide",()=>{this._postMetricsIfActive("pagehide")})}_postMetricsIfActive(e){j.getInstance().isClientDisabled||j.getInstance().isInactive()||this.postMetrics(e)}postMetrics(e){const t={br_id:j.getInstance().browserId,pv_id:j.getInstance().pageVisitId,cv:2,v:1,exp_vid_len:this.expectedVideoLength,exp_vf_seq:this.expectedVfSeq,exp_pc_seq:this.expectedPvPart,exp_http_seq:this.httpSequenceNumber,http_payloads:this.httpPayloadCount,http_drop_oversize:this.httpDroppedPayloadByLengthCount,http_drop_type:this.httpDroppedPayloadByTypeCount,http_over_limit:this.httpOverLimitCount,vid_clicks:this.videoClicks,pv_clicks:this.pvClicks,did_cut_pv:this.didCutPv,did_cut_vid:this.didCutVideo,did_start_vid:this.didStartVideo,exp_http:this.httpCount,exp_err:this.errCount,on_url:document.location.href};window.dispatchEvent(new CustomEvent("noibuPostMetrics",{detail:e})),window.fetch&&window.fetch(m()+"/metrics",{method:"POST",headers:{"content-type":"application/json"},body:x(t),keepalive:!0})}}class Q{constructor(){this.latestPageVisitFrag=null,this.writeTimeout=null,this.flushedStorage=!1;K.getInstance().isAvailable()&&this._postPreviousPageVisit()}static getInstance(){return this.instance||(this.instance=new Q),this.instance}checkAndStoreRetryQueue(e,t){const{type:n,payload:r}=e[e.length-1];if("p"!==n||!r.pvp)return;(r.pvp.events?r.pvp.events:[]).filter(e=>"userstep"===e.type||"err"===e.type||"loc"===e.type).length>0&&this.writePageVisitsFromRetryQueue(e,t)}writePageVisitsFromRetryQueue(e,t){const n=[];for(let t=0;t<e.length;t+=1){const{type:r,payload:s}=e[t];if("p"===r){const e=s.pvp;n.push(e)}}this._writePageVisitFrags(n,t)}_writePageVisitFrags(e,t){const n={pageVisitFrags:e,pageVisitInfo:t,timestamp:new Date},r=K.getInstance(),s=x(n);try{r.save("n_stored_page_visit",s)}catch(e){r.remove("n_stored_page_visit");const t=r.calculateUsedSize();j.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error writing pv to storage: ${e}, json size: ${s.length}, storage size: ${t}, `+r.getDiagnoseInfo(),!1,"error")}}_getPostData(){const e=K.getInstance(),t=e.load("n_stored_page_visit");if(!t)return null;let n={};try{n=JSON.parse(t)}catch(n){return e.remove("n_stored_page_visit"),j.getInstance().postNoibuErrorAndOptionallyDisableClient(`Error parsing page visit string '${t}': ${n}`,!1,"error"),null}if(n.timestamp){const e=new Date;if(e.setSeconds(e.getSeconds()-2100),e>=Date.parse(n.timestamp))return null}const r={pvi:n.pageVisitInfo,pvp:[],pvvf:[]};r.pvi.last=!0;for(let e=0;e<n.pageVisitFrags.length;e+=1)r.pvp.push(n.pageVisitFrags[e]);return r}_postPreviousPageVisit(){this._getPostPageVisitPromise().then(()=>{this._updateStorageFlushed()}).catch(()=>{this._updateStorageFlushed()})}_updateStorageFlushed(){this.flushedStorage=!0;K.getInstance().remove("n_stored_page_visit")}_getPostPageVisitPromise(){return new Promise((e,t)=>{const n=this._getPostData();if(!n)return void e();P("POST",f(),n,{"content-type":"application/json"},2e3,!0).then(()=>{e()}).catch(e=>{t(new Error("Page visit post request rejected due to: ",e))})})}}function $(){return!("now"in Date)||("number"!=typeof Date.now()||(!("toISOString"in new Date)||"string"!=typeof(new Date).toISOString()))}function X(e){if("number"!=typeof e&&$()){if(Date.prototype.hasOwnProperty("valueOf")&&"function"==typeof e.valueOf&&"number"==typeof e.valueOf())return e.valueOf();j.getInstance().postNoibuErrorAndOptionallyDisableClient("The date object has been overwritten and can't be processed properly.\n      Client has been disabled.",!0,"error",!0)}return e}function ee(){return window.performance&&window.performance.now?window.performance.now():X(Date.now())}class te{constructor(e){const t=g();this.forceClosed=!1,this.socket=null,this.socketInstanceId=null,this.previousMessageType="",this.currentConnectionAttempts=0,this.connectionCount=0,this.sessionStartTime=ee(),this.connectionPromise=null,this.pageVisitInfoSent=!1,this.connectionURL=t+"/pv_part",this.postURL=f(),this.messageSequenceNum=0,this.latestReceivedSeqNumber=-1,this.isRetryLoopDisabled=!1,this.retryMessageQueue=[],this.metroplexTypeLock={},this.initialURL=O(),this.initialReferingURL=window.document.referrer?D(window.document.referrer):"",this.sessionTimestamp=new Date,this.latestReceivedSeqNumStoredTime=new Date,this.instanceId=C()(),this.scriptInstanceId=e,this.sessionLength=0,this.socketCloseCodes=[],this.socketOpens=[],this.ackedOnce=!1,this.metroRetryFrequencyMS=3e4}static getInstance(e){return this.instance||(this.instance=new te(e),this.instance.start()),this.instance}start(){this.connectSocket(),this._setupOffloadEvents()}_addSeqNumToPayload(e,t){switch(e){case"p":this._setSeqNumInPayloadAndIncrementSeqNum("pvp",t);break;case"v":this._setSeqNumInPayloadAndIncrementSeqNum("pvvf",t);break;case"h":this._setSeqNumInPayloadAndIncrementSeqNum("pvh",t);break;case"m":this._setSeqNumInPayloadAndIncrementSeqNum("pvm",t)}}_setSeqNumInPayloadAndIncrementSeqNum(e,t){t[e].seq_num=this.messageSequenceNum,this.messageSequenceNum+=1}sendMessage(e,t){if(e in this.metroplexTypeLock||j.getInstance().isClientDisabled)return;const n=t;if("wr"!==e&&(this._addSeqNumToPayload(e,n),this.retryMessageQueue.push({payload:n,type:e}),Q.getInstance().checkAndStoreRetryQueue(this.retryMessageQueue,this.getPageInformation())),this.isConnected()&&this.pageVisitInfoSent&&this._sendSocketMessage(n),this.previousMessageType=e,"p"===e&&t.pvp){const e=t.pvp.events?t.pvp.events:[];this._updateLatestPvTimestamp(e)}}_updateLatestPvTimestamp(e){e.filter(e=>"userstep"===e.type).length>0&&j.getInstance().updateLastActiveTime(new Date)}isConnected(){return null!==this.socket&&1===this.socket.readyState}isConnecting(){return null!==this.socket&&0===this.socket.readyState}close(){this.forceClosed=!0,(this.isConnected()||this.isConnecting())&&this.socket.close(1e3)}handleConnect(e,t){(t||!this.isConnected()&&!this.isConnecting())&&(this.currentConnectionAttempts+=1,this.socket=new WebSocket(this.connectionURL),this.socketInstanceId=C()(),this.socket.onerror=()=>{},this.socket.onclose=t=>{this.pageVisitInfoSent=!1,this.forceClosed||(this.socketCloseCodes.push(`${$()?"":(new Date).toISOString()}:${t.code}`),this.isConnecting()||(clearInterval(this.retryMetroplexInterval),this.currentConnectionAttempts>=function(){try{return 20}catch(e){return 2}}()?j.getInstance().lockClientUntilNextPage("Too many reconnection attempts, locking until next page"):this.connectionCount>=100?j.getInstance().lockClientUntilNextPage("Too many connections, locking until next page"):setTimeout(()=>{this.handleConnect(e,!1)},this.currentConnectionAttempts**2*function(){try{return METROPLEX_CONSECUTIVE_CONNECTION_DELAY}catch(e){return 1e3}}())))},this.socket.onmessage=t=>{this._onSocketMessage(t,e)},this.socket.onopen=()=>{this.socketOpens.push(""+($()?"":(new Date).toISOString())),this._onSocketOpen()})}connectSocket(){return this.isConnected()||this.isConnecting()||(this.connectionPromise=new Promise(e=>{this.handleConnect(e,!1),Y(window,"visibilitychange",()=>{if(j.getInstance().isClientDisabled)return;const t="visible"===document.visibilityState;t&&(this.forceClosed=!1,(this.isConnected()||this.isConnecting())&&(this.socket.onclose=()=>{},this.socket.close(1e3)),this.handleConnect(e,t))})})),this.connectionPromise}addEndTimeToPayload(e,t){const n=Math.ceil(ee()-this.sessionStartTime);t&&(this.sessionLength=n);const r=new Date(this.sessionTimestamp.getTime()+n).toISOString();e.end_at=r}_onSocketOpen(){this.isConnected()&&!j.getInstance().isClientDisabled&&(this._sendSocketMessage(this.getPageInformation()),this.pageVisitInfoSent=!0,this.currentConnectionAttempts=0,this.previousMessageType="",this._sendUnconfirmedMessages(!1),this.setupRetryMechanism(),this.connectionCount+=1)}_onSocketMessage(e,t){switch(e.data){case"vid_block":this.metroplexTypeLock.v=!0,J.getInstance().setDidCutVideo();break;case"pv_block":this.metroplexTypeLock.p=!0,J.getInstance().setDidCutPv();break;case"full_block":j.getInstance().lockClient(1440,"Metroplex blocked script"),this.close();break;case"close_conn":this.close();break;case"ok":break;default:if(e.data.includes("seq_num")){const n=e.data.split("seq_num:");if(n.length<2){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Invalid message received from metroplex while clearing retry queue "+e.data,!1,"error");break}const r=parseInt(n[1],10);if(-1===r)break;r<=this.latestReceivedSeqNumber?this.isRetryLoopDisabled=!0:(this.isRetryLoopDisabled=!1,this.latestReceivedSeqNumber=r,this._clearRetryQueue(r)),!this.ackedOnce&&t&&(this.ackedOnce=!0,t())}if(this._tryProcessHelpCodeResponse(e.data))break}}_messagePayloadHasLargerSeqNum(e,t,n){return e.payload[t]&&e.payload[t].seq_num&&e.payload[t].seq_num>n}_clearRetryQueue(e){this.latestReceivedSeqNumStoredTime=new Date,this.retryMessageQueue=this.retryMessageQueue.filter(t=>this._messagePayloadHasLargerSeqNum(t,"pvp",e)||this._messagePayloadHasLargerSeqNum(t,"pvvf",e))}_sendUnconfirmedMessages(e){if(this.isConnected()&&!j.getInstance().isClientDisabled){if(e){const e=new Date;if(e.setMilliseconds(e.getMilliseconds()-this.metroRetryFrequencyMS),e<this.latestReceivedSeqNumStoredTime)return;if(this.isRetryLoopDisabled)return}this.retryMessageQueue=this.retryMessageQueue.filter(e=>!(e.type in this.metroplexTypeLock));for(let e=0;e<this.retryMessageQueue.length;e+=1){const{type:t,payload:n}=this.retryMessageQueue[e];if(!this._sendSocketMessage(n))break;this.previousMessageType=t}}}setupRetryMechanism(){this.retryMetroplexInterval=setInterval(()=>{this._sendUnconfirmedMessages(!0)},3e4)}_setupOffloadEvents(){Y(window,"pagehide",()=>{this._handleUnload()})}_handleUnload(){this.close(),j.getInstance().isClientDisabled||j.getInstance().isInactive()||this.postFullPageVisit(59e3)}postFullPageVisit(e){if(0===this.retryMessageQueue.length)return;const t=[],n={v:0,p:0};let r=0,s={pvi:this.getPageInformation(),pvp:[],pvvf:[],pvh:[],vpnum:this.connectionCount};if(s.pvi.last=!0,this.retryMessageQueue.forEach(i=>{let{type:o,payload:a}=i;const c=new Blob([x(a)]).size;if(c>e)n[o]+=1;else{if(r+=c,r>=e){this.postMessage(s);let e="Vid: "+s.pvvf.length;e+=" PV: "+s.pvp.length,e+=` HTTP: ${s.pvh.length},`,t.push(e),s={pvi:this.getPageInformation(),pvp:[],pvvf:[],pvh:[],vpnum:s.vpnum},s.pvi.last=!0,r=c}switch(o){case"v":s.pvvf.push(a.pvvf);break;case"p":s.pvp.push(a.pvp);break;case"h":s.pvh.push(a.pvh)}}}),this.postMessage(s),this.retryMessageQueue.length>100){let e="Vid: "+s.pvvf.length;e+=" PV: "+s.pvp.length,e+=` HTTP: ${s.pvh.length},`,t.push(e);let r="POST Full PV complete";r+=", POSTs count: "+t.length,r+=", POSTs info: "+x(t),r+=", Retry message queue size: "+this.retryMessageQueue.length,n.v>0&&(r+=", Video parts dropped: "+n.v),n.p>0&&(r+=", Page visit parts dropped: "+n.p),n.h>0&&(r+=", HTTP data parts dropped: "+n.h),r+=", Sequence Info: Latest "+this.messageSequenceNum,r+=` Ack'd ${this.latestReceivedSeqNumStoredTime} ${this.latestReceivedSeqNumber}`;const i=j.getInstance().isClientDisabled;j.getInstance().isClientDisabled=!1,j.getInstance().postNoibuErrorAndOptionallyDisableClient(r,i,"warn")}}postMessage(e){const t=e;t.vpnum+=1,"test"===I()?navigator.sendBeacon(this.postURL,x(t)):window.fetch&&fetch(this.postURL,{method:"POST",headers:{"content-type":"application/json"},body:x(t),keepalive:!0})}_sendSocketMessage(e){return!this.closeIfInactive()&&(this.socket.send(x(e)),!0)}closeIfInactive(){const e=j.getInstance().isInactive();return e&&!j.getInstance().isClientDisabled&&(j.getInstance().lockClientUntilNextPage("Session is inactive, locking until next page"),this.close(),J.getInstance().postMetrics("inactive"),this.postFullPageVisit(59e3)),e}getPageInformation(){const e={br_id:j.getInstance().browserId,pv_id:j.getInstance().pageVisitId,v:5,seq:j.getInstance().getPageVisitSeq(),on_url:this.initialURL,ref_url:this.initialReferingURL,start_at:this.sessionTimestamp.toISOString(),conc:this.connectionCount,cv:2,last:!1,script_id:h(),script_inst_id:this.scriptInstanceId,mp_sock_inst_id:this.instanceId,sock_inst_id:this.socketInstanceId},t=function(){const e=window.navigator.userLanguage||window.navigator.language;return""!==e&&e?e.toLowerCase():null}();return t&&(e.lang=t),e}_tryProcessHelpCodeResponse(e){if("string"!=typeof e||!e.startsWith("hc:"))return!1;const t=e.substring("hc:".length),n=/^\d{6}$/.test(t),r=new CustomEvent("noibuHelpCode",{detail:{success:n,data:t}});return window.dispatchEvent(r),!0}}class ne{constructor(){this.partCounter=0,this.pvMap={},this.partCounter=0,this.pvEventLength=0,this.visibilityChangedCounter=0,this.totalPvEventLength=0,this.inDebounceHandle=0,this.isInAcceleratedPvPostMode=!1}static configureInstance(){this.instance||(this.instance=new ne)}static getInstance(){if(!this.instance)throw new Error("Pagevisit was never configured");return this.instance}addPageVisitEvents(e,t){e.forEach(e=>{this._addPageVisitEvent(e,t)}),this._sendPageVisitMessage()}addPageVisitEvent(e,t){const n=this._addPageVisitEvent(e,t);return this._sendPageVisitMessage(),n}_addPageVisitEvent(e,t){if(!("occurredAt"in e)||!("event"in e))throw new Error("missing attributes in the eventObj");const n={type:t,occ_at:e.occurredAt,[t]:e.event};this.pvEventLength>=200&&this._sendPageVisitMessage();const r=C()();return this.pvMap[r]=n,this.pvEventLength+=1,this.totalPvEventLength+=1,r}static makePageVisitFrag(e,t){const n={};return n.events=e,n.pc=t,te.getInstance().addEndTimeToPayload(n,!0),n}_sendPageVisitMessage(){const e=Object.keys(this.pvMap).map(e=>this.pvMap[e]);if(0===e.length)return;if(this.partCounter>=1e4)return void j.getInstance().lockClientUntilNextPage(`NoibuJS will stop processing parts because we reached max parts: 10000. Variables: \n      total Pv Event Length: ${this.totalPvEventLength}\n      visibility Changed Counter: ${this.visibilityChangedCounter}\n      `);const t=ne.makePageVisitFrag(e,this.partCounter);J.getInstance().setPvPart(this.partCounter);const n={pvp:t};te.getInstance().sendMessage("p",n),this.pvMap={},this.pvEventLength=0,this.partCounter+=1}}class re{constructor(){this.eventsToDebounce={},this.registerInputType("loc",0),this.registerInputType("page",500),this.registerInputType("err",500),this.registerInputType("http",500),this.registerInputType("kbd",500,"userstep"),this._setupUnloadHandler()}static getInstance(){return this.instance||(this.instance=new re),this.instance}registerInputType(e,t,n=e){e in this.eventsToDebounce||(this.eventsToDebounce[e]={timeout:null,events:[],debouncePeriod:t,eventName:n})}addEvent(e,t){if(!(t in this.eventsToDebounce))throw new Error(`Type: ${t} is not in eventsToDebounce`);this.eventsToDebounce[t].events.push({event:e,occurredAt:new Date(X(Date.now())).toISOString()}),this._debouncePvEvents(t)}_debouncePvEvents(e){clearTimeout(this.eventsToDebounce[e].timeout),this.eventsToDebounce[e].timeout=setTimeout(()=>{this.eventsToDebounce[e].timeout=null,ne.getInstance().addPageVisitEvents(this.eventsToDebounce[e].events,this.eventsToDebounce[e].eventName),this.eventsToDebounce[e].events=[]},this.eventsToDebounce[e].debouncePeriod)}_setupUnloadHandler(){Y(window,"pagehide",()=>{Object.values(this.eventsToDebounce).forEach(e=>{ne.getInstance().addPageVisitEvents(e.events,e.eventName)})})}}function se(e){return{url:B(e.filename),type:"js",j_err:L(e.error)}}function ie(e,t,n){let r=t;t.error&&t.error.originalError&&(r=t.error.originalError);let s={};switch(e){case"XMLHttpRequest":s=function(e,t){const n={url:B(e.responseURL),type:"http",h_code:e.status};return(t||0===t)&&(n.seq=t),n}(r,n);break;case"ErrorEvent":s=se(r);break;case"Response":s=function(e,t){const n={url:B(e.url),type:"http",h_code:e.status};return(t||0===t)&&(n.seq=t),n}(r,n);break;case"WrappedException":case"FetchException":s=se(r);break;case"ErrorLogEvent":s=function(e){return{url:B(window.location.href),type:"js",j_err:L(e)}}(r);break;case"UnhandledRejectionError":case"CustomError":s=se(r);break;default:try{s=se(r),r instanceof Event&&(!function(e,t,n){let r=null;if(n.detail)try{r=x(n.detail)}catch(e){r="non-serializable"}let s=`Fire error event of type ${e}.`;null!=r&&(s+=` Detail: ${r}.`),t.j_err.msg=D(s)}(e,s,r),e="ErrorEvent")}catch(e){return null}}return s.err_src=e,s}function oe(e,t,n){if("Event"===e)return;const r=ie(e,t,n);if(!r||!r.url)return;const s=r.url;if(function(e){try{return URL(e),!0}catch(e){return!1}}(s)){const e=new URL(s);if(e.hostname in W||!e.protocol.startsWith("http"))return}(function(e){if("js"===e.type){if(e.j_err){const t=e.j_err.frames;if(t&&t.length>0){const n=t[0].file.toLowerCase(),r=t[0].mname.toLowerCase();if(n.includes("noibu")&&!r.includes("nbuwrapper"))return j.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error"),!0}}if(e.msg){const t=e.msg.toLowerCase();if(t.includes("input.noibu")||t.includes("input.b.noibu"))return j.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error"),!0}}else if("http"===e.type&&e.url){const t=e.url;if("string"==typeof t)for(let n=0;n<a.length;n+=1){const r=a[n];if(t.includes(r))return j.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error"),!0}}return!1})(r)||(J.getInstance().addError(),re.getInstance().addEvent(r,"err"))}let ae=0;function ce(e){if("function"!=typeof e)return e;try{if(e.__noibu__)return e;if(e.__noibu_wrapped__)return e.__noibu_wrapped__}catch(t){return e}const nbuWrapper=function(...t){try{const n=Array.prototype.slice.call(t).map(e=>ce(e));return e.handleEvent?e.handleEvent.apply(this,n):e.apply(this,n)}catch(e){throw oe("WrappedException",{error:e}),ae+=1,setTimeout(()=>{ae-=1}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(nbuWrapper[t]=e[t])}catch(e){}nbuWrapper.prototype=e.prototype||{},Object.defineProperty(e,"__noibu_wrapped__",{enumerable:!1,value:nbuWrapper}),Object.defineProperties(nbuWrapper,{__noibu__:{enumerable:!1,value:!0},__noibu_original__:{enumerable:!1,value:e}});try{Object.getOwnPropertyDescriptor(nbuWrapper,"name").configurable&&Object.defineProperty(nbuWrapper,"name",{get:()=>e.name})}catch(t){return e}return nbuWrapper}function le(e){if(!e)return;const{message:t,stack:n}=e;n&&t&&oe("ErrorLogEvent",{message:t,stack:n})}function ue(e){e.forEach(e=>{e&&(Array.isArray(e)?e.forEach(e=>{le(e)}):le(e))})}function de(e){e&&e.constructor&&e.constructor.name&&"undefined"!==e.constructor.name&&!(ae>0)&&oe(e.constructor.name,e)}function he(e){if(!e.reason)return;if(!e.reason.message||!e.reason.stack)return;const t=new Error;t.message=e.reason.message,t.stack=e.reason.stack;oe("UnhandledRejectionError",{error:t})}function pe(){Y(window,"error",de,!0),Y(window,"unhandledrejection",he,!0),i.forEach(e=>{const t=window[e],n=t&&t.prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(b(n,"addEventListener",(function(e){return function nbuWrapper(t,n,r){if(!n)return e.call(this,t,n,r);let s;if(n.handleEvent){const e=ce(n.handleEvent.bind(n));s=n,s.handleEvent=e}else s=ce(n);return e.call(this,t,s,r)}})),b(n,"removeEventListener",(function(e){return function nbuWrapper(t,n,r){let s=n;try{s=s&&(s.__noibu_wrapped__||s)}catch(e){}return e.call(this,t,s,r)}})))}),c.forEach(e=>{window.console&&window.console[e]&&b(window.console,e,(function(e){return function nbuWrapper(){e.call(window.console,...arguments),ue(Array.from(arguments))}}))})}class ge{constructor(e,t){const n=e;(!n.resp_time||n.resp_time<0)&&(n.resp_time=0),n.mtd=e.mtd.toUpperCase(),n.url=D(G(n.url)),this.httpEvent=n,this.httpData=t}saveHTTPEvent(){if(this.httpEvent&&this.httpEvent.url&&""!==this.httpEvent.url.trim()){if(J.getInstance().addHttpEvent(),this.httpData){const e=J.getInstance().httpSequenceNumber;if(e<100){this.httpData.seq=e,this.httpEvent.seq=e,J.getInstance().addHttpData();const t={};t.pvh=this.httpData,te.getInstance().sendMessage("h",t)}else J.getInstance().addHttpDataOverLimit()}re.getInstance().addEvent(this.httpEvent,"http")}}}class me{constructor(){this.contentTypeReadableRegex=new RegExp("text|json|xml|html|graphql|x-www-form-urlencoded|form-data","i");const e=O();if(this.initialURLPartsReversed=[],e&&e.length>0)try{const t=new URL(e).hostname;this.initialURLPartsReversed=t.split("."),s.test(this.initialURLPartsReversed[0])&&this.initialURLPartsReversed.shift(),this.initialURLPartsReversed.reverse()}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to determine hostname for initial URL: "+e,!1,"warn")}this.httpDataCollectionEnabled=!!o().http_data_collection;const t=V();this.httpDataAllowedAbsoluteRegex=me.buildAllowedRegex(t,!0),this.httpDataAllowedRelativeRegex=me.buildAllowedRegex(t,!1)}static getInstance(){return this.instance||(this.instance=new me),this.instance}static buildAllowedRegex(e,t){if(!e)return null;const n=e.filter(e=>{const n=me.isAbsoluteURL(e);return t?n:!n});if(n.length>0){const e=n.map(e=>e.trim().toLowerCase());return new RegExp(e.join("|"))}return null}static headersMapFromIterable(e){const t=new Map;for(const n of e)"string"!=typeof n[0]&&(n[0]=String(n[0])),"string"!=typeof n[1]&&(n[1]=String(n[1])),t.set(n[0].toLowerCase(),n[1]);return t}static headersMapFromString(e){const t=new Map;if(!e||"string"!=typeof e)return t;return e.split("\r\n").filter(Boolean).forEach((function(e){const n=e.split(": ");2===n.length&&n[0].length>0&&n[1].length>0&&t.set(n[0].toLowerCase(),n[1])})),t}static responseStringFromXHRResponseType(e){if(null==e)return null;if(e.response&&null===e.response)return"null";if(""===e.responseType||"text"===e.responseType)return e.responseText;if("document"===e.responseType&&e.response&&e.response.documentElement&&e.response.documentElement.innerHTML)return e.response.documentElement.innerHTML;if("json"===e.responseType)try{return JSON.stringify(e.response)}catch(e){return j.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to stringify JSON response: "+e,!1,"warn"),null}return null}isURLSameDomain(e){if("string"!=typeof e||!this.initialURLPartsReversed||this.initialURLPartsReversed.length<1)return!1;let t;try{t=new URL(e).hostname}catch(e){return j.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to determine hostname for request URL: "+e,!1,"warn"),!1}const n=t.split(".");return!(n.length<1)&&(s.test(n[0])&&n.shift(),!(n.length<this.initialURLPartsReversed.length)&&(n.reverse(),this.initialURLPartsReversed.every((e,t)=>e===n[t])))}bundleHTTPData(e,t,n,r,s,i,o){if(!this.isValidRequest(e,i,o))return null;let a="";this.shouldCollectPayloadForURL(e)&&(a=this.dropPayloadIfNecessaryFromHeaders(t)||this.stringFromRequestBody(n));const c=t||new Map,l=a||"",u=r||new Map,d=s||"";if(0===c.size&&0===l.length&&0===u.size&&0===d.length)return null;const h=this.restrictPayload(a,e),p=this.restrictPayload(s,e),g=this.removePIIHeaders(t),m=this.removePIIHeaders(r);return{rqh:g?w(g):{},rqp:h,rsh:m?w(m):{},rsp:p}}isValidRequest(e,t,n){return!!this.httpDataCollectionEnabled&&(!(!t||"string"!=typeof t)&&!!n)}shouldContinueForURL(e){return!!this.httpDataCollectionEnabled&&(!(!e||"string"!=typeof e||!this.initialURLPartsReversed)&&!(me.isAbsoluteURL(e)&&!this.isURLSameDomain(e)&&!this.shouldCollectPayloadForURL(e)))}static isAbsoluteURL(e){return!(!e||"string"!=typeof e)&&(e.indexOf("://")>0||0===e.indexOf("//"))}shouldCollectPayloadForURL(e){return!(!e||"string"!=typeof e)&&(!(!this.httpDataAllowedAbsoluteRegex||!this.httpDataAllowedAbsoluteRegex.test(e.toLowerCase()))||!(!this.httpDataAllowedRelativeRegex||me.isAbsoluteURL(e)&&!this.isURLSameDomain(e)||!this.httpDataAllowedRelativeRegex.test(e.toLowerCase())))}restrictPayload(e,t){return e&&this.shouldCollectPayloadForURL(t)?"null"===e||e.startsWith("Dropped due to length.")||e.startsWith("Dropped due to unsupported type.")?e:e.length>5e4?(J.getInstance().addHttpDataDropByLength(),"Dropped due to length. Payload length: "+e.length):(J.getInstance().addHttpDataPayloadCount(),this.removePIIBody(e)):"null"}contentLengthAcceptable(e){const t=this.contentLength(e);return t<0||(!(t>5e4)||(J.getInstance().addHttpDataDropByLength(),!1))}contentTypeAcceptable(e){if(!e||!e.get)return!0;const t=e.get("content-type");return!(t&&!this.contentTypeReadableRegex.test(t.toLowerCase()))||(J.getInstance().addHttpDataDropByType(),!1)}dropPayloadIfNecessaryFromHeaders(e){let t="";return me.getInstance().contentTypeAcceptable(e)?me.getInstance().contentLengthAcceptable(e)||(t="Dropped due to length. Payload length: "+me.getInstance().contentLength(e)):(t="Dropped due to unsupported type.",e&&e.get&&(t+=" Payload type: "+e.get("content-type"))),t}contentLength(e){if(!e||!e.get)return 0;let t=0;const n=e.get("content-length");if(!n)return-1;try{if(t=parseInt(n,10),Number.isNaN(t))return-1}catch(e){return-1}return t}stringFromRequestBody(e){if(null==e)return null;try{const t=e.toString();if(!t.includes("[object"))return t}catch(e){}try{return e.documentElement.innerHTML}catch(e){}try{return e instanceof FormData&&(e=Array.from(e.entries()).reduce((e,[t,n])=>(e[t]="string"==typeof n?n:"non-string value.",e),{})),JSON.stringify(e)}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to stringify request body: "+e,!1,"warn")}return null}removePIIHeaders(e){if(!(e instanceof Map))return null;if(e.size<1)return e;const n=new Map(e);return n.forEach((e,n,r)=>{t.includes(n.toLowerCase())?r.set(n,"******"):r.set(n,this.removePIIBody(e))}),n}removePIIBody(e){if("string"!=typeof e)return null;if(e.length<1)return e;let t=e;return r.forEach(e=>{t=t.replace(e,"******")}),t}}function fe(e){return"number"!=typeof e||(e>=400||e<=0)}function Ie(e,t,n,r,s=null){const i={mtd:t,code:e.status,url:n,r_time:r};let o=null;const a=fe(e.status);if(a&&me.getInstance().shouldContinueForURL(n)){const r=me.headersMapFromString(e.getAllResponseHeaders()),c=me.getInstance().contentLength(r);c>0&&(i.resp_len=c);let l="";if(me.getInstance().shouldCollectPayloadForURL(n)){l=me.getInstance().dropPayloadIfNecessaryFromHeaders(r)||me.responseStringFromXHRResponseType(e)}o=me.getInstance().bundleHTTPData(n,e.noibuRequestHeaders,s,r,l,t,a)}return[i,o]}async function ye(e,t,n,r,s,i,o){const a={mtd:n,code:t.status,url:r,r_time:i};let c=null;if(fe(t.status)&&me.getInstance().shouldContinueForURL(r)){if(t&&t.headers){const e=me.getInstance().contentLength(t.headers);e>0&&(a.resp_len=e)}let i="";if(me.getInstance().shouldCollectPayloadForURL(r)&&t&&t instanceof Response){i=me.getInstance().dropPayloadIfNecessaryFromHeaders(t.headers)||t.clone().text()}const l=[Promise.resolve(i),...o?[o]:[]];await Promise.all(l).then(i=>function(e,t,n,r,s,i){let o,a=new Map,c=new Map;return r[1]&&([,o]=r,e.headers&&(a=me.headersMapFromIterable(e.headers.entries()))),null==o&&n&&n.body&&(o=n.body),a.size<1&&n&&n.headers&&(a=n.headers instanceof Headers?me.headersMapFromIterable(n.headers.entries()):me.headersMapFromIterable(Object.entries(n.headers))),t&&t.headers&&(c=me.headersMapFromIterable(t.headers.entries())),me.getInstance().bundleHTTPData(s,a,o,c,r[0],i,fe(t.status))}(e,t,s,i,r,n)).then(e=>{c=e})}return[a,c]}function ve(){const e=window;S(e,"fetch")&&b(e,"fetch",(function(e){return function nbuWrapper(t,n){let r,s,i,o;try{t?(t.method?(r=t.method,s=t.url):(r=n&&n.method?n.method:"GET",s=t.toString()?t.toString():""),me.getInstance().shouldCollectPayloadForURL(s)&&t instanceof Request&&(i=t.clone(),o=i.text())):j.getInstance().postNoibuErrorAndOptionallyDisableClient(`fetch() called with undefined or missing resource parameter. Parameters passed: ${t}, ${n}`,!1,"warn")}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in fetch() wrapper: "+e,!1,"error")}const a=e.call(this,t,n),c=new Date;return a.then(async e=>{try{const t=new Date,a=Math.abs(t-c),[l,u]=await ye(i,e,r,s,n,a,o);let d=new ge(l,u);d.saveHTTPEvent(),fe(e.status)&&oe("Response",e,d.httpData&&d.httpData.seq),d=null}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in custom fetch() callback: "+e,!1,"error")}}).catch(e=>{!function(e,t){if(!e)return;if(!e.message||!e.stack)return;const n=t||"",r=new Error;r.stack=e.stack;const s=""===n.trim()?"":" on url "+n;r.message=`${e.message}${s}`,oe("FetchException",{error:r})}(e,s)}),a}}))}function Ce(){const e=window.XMLHttpRequest,t=e&&e.prototype,n=S(t,"open"),r=S(t,"send"),s=S(t,"setRequestHeader");n&&function(e,t){b(e,"open",(function(e){return function nbuWrapper(n,r,s=!0,i=null,o=null){try{try{this.noibuHttpMethod=n,this.noibuHttpUrl=r}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Unable to set custom properties on XHR object: "+e,!1,"warn")}if(t){const e=new Date;Y(this,"loadend",()=>{const t=new Date,s=Math.abs(t-e),[i,o]=Ie(this,n,r,s);let a=new ge(i,o);a.saveHTTPEvent(),fe(this.status)&&oe("XMLHttpRequest",this,a.httpData&&a.httpData.seq),a=null})}}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in XHR.open() wrapper: "+e,!1,"error")}return e.call(this,n,r,s,i,o)}}))}(t,!r),r&&function(e){b(e,"send",(function(e){return function nbuWrapper(t){try{let e;e=this.noibuHttpMethod?this.noibuHttpMethod:t?"POST":"GET";const n=new Date;Y(this,"loadend",()=>{const r=new Date,s=Math.abs(r-n),i=this.noibuHttpUrl||this.responseURL,[o,a]=Ie(this,e,i,s,t);let c=new ge(o,a);c.saveHTTPEvent(),fe(this.status)&&oe("XMLHttpRequest",this,c.httpData&&c.httpData.seq),c=null})}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in XHR.send() wrapper: "+e,!1,"error")}return e.call(this,t)}}))}(t),s&&function(e){b(e,"setRequestHeader",(function(e){return function nbuWrapper(t,n){try{this.noibuRequestHeaders&&this.noibuRequestHeaders instanceof Map||(this.noibuRequestHeaders=new Map);const e="string"==typeof n?n:String(n);this.noibuRequestHeaders.set(t.toLowerCase(),e)}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error in XHR.setRequestHeader() wrapper: "+e,!1,"error")}return e.call(this,t,n)}}))}(t)}function be(e){const t=e;return t.class=G(t.class),t}const Se=["\\b(view|add|my)\\b.*\\b(cart|bag|basket|bucket|box)\\b","\\b(buy now)\\b","^backorder$","\\b(acquista ora)\\b","\\b(buy this)\\b","\\b(ajouter|mon)\\b.*\\b(panier)\\b","\\b(aggiungi)\\b.*\\b(cart|borsa|carrello)\\b","^ajouter à la shopping bag$","^aggiungi$","^aggiungi alla shopping bag$","\\b(warenkorb)\\b","(^kaufen$)","^купить$","\\b(agregar)\\b.*\\b(carrito)\\b","\\b(adicionar)\\b.*\\b(carrinho)\\b","^carrinho$","^añadir al carrito de compras$","(^añadir al carrito$)","(add another)","(in winkelmand)","(sepete ekle)","(Lagg I Varukorgen)","(ΠΡΟΣΘΗΚΗ ΣΤΟ ΚΑΛΑΘΙ)","(Lägg i varukorgen)","(Köp)","(カートに追加)","^添加至购物袋$","^购买$","^購入する$","(أضف الى السلة)"],we=["(paypal)","(checkout|payment|check out)","(l.?achat|règlement|paiement|la commande)","(passer).*(commande)","valider mon panier","(acheter maintenant)","^caisse$","(gå vidare till kassan)","(cassa|acquisto)","^vai alla cassa$","^procedi all.?acquisto$","^procedi al checkout$","^siguiente$","(kasse)","^zur kasse gehen$","^bezahlen$","^weiter zum checkout$","(comprar ahora)","^comprar$","(prosseguir com a compra)","^pasar por la caja$","^afrekenen$","^compre$","(continue to pay)","(naar de kassa)","Перейти к оформлению заказа","^купить сейчас$","^bestellen$","(Alışverişi Tamamla)","^Till kassan$","(チェックアウトに進む)","^去结算$","^付款。$","^お支払い$","(تاكيد الطلب)"],Ae=["(checkout|continue) (with paypal)","^continue to paypal$","^weiter zu paypal$","^continue to afterpay$","^braintree_paypal$","^pay and place order$","^mit paypal bezahlen$","^continue to payment securely$","(continua su paypal)","(apple pay|applepay)","(amazon pay|amazonpay|continue with amazon)","(sezzlepay)","(place order)","(place your order)","(order confirmation)","(complete purchase)","submit.*order","(pay now)","(^pay it now$)","(make payment)","(^make payment$)","(complete order)","^complete your order$","(fazer pedido)","^encomendar$","((realizar) (pedido|pago))","^finalizar compra$","^pagar$","^jetzt kaufen$","^bestellung aufgeben$","^bestellung prüfen$","^auftragsbestätigung$","^bestelling plaatsen$","^passer la commande$","(je confirme et je paye)","(accéder au paiement)","^passer au paiement$","(Valider et continuer)","^valider la commande$","(^passez la commande$)","^invia ordine$","(effettua ordine)","^effettua l.?ordine$","(conferma acquisto)","^conferma l.?acquisto$","^confirmation de commande$","^confirma l.?ordine$","^conferma l.?ordine$","^conferma ordine$","(SİPARİŞİ TAMAMLA)","^Разместить заказ$","(Slutför köp)","(注文する)","(إنشاء الطلب)","(注文を確定)","^お支払いへ進む$","^确认下单$"];class ke{constructor(){this.textCapturedWhiteListRegex=new RegExp(Se.concat(we).concat(Ae).join("|"),"i"),this.htmlIDWhiteListRegex=new RegExp("method|finance|sagepay|cart|bag|coupon|affirm|karna|sezzle|button","i")}static getInstance(){return this.instance||(this.instance=new ke),this.instance}monitorClicks(){Y(window,"click",this._onClickHandle.bind(this),!0)}_onClickHandle(e){const t=function(){const e=o(),t=["noibu-blocked"];return F()&&e.sel.forEach(e=>{e.startsWith(".")&&e.length>0&&t.push(e.substring(1))}),t}();if(e.srcElement){const n=e.srcElement;let r="";r="IMG"===n.tagName?n.alt?n.alt:"":this._getTextualContentFromEl(n,!0,t);let s=this._trimText(r),i="";if(n.className){const e=typeof n.className;"string"===e?i=n.className:"object"===e&&"baseVal"in n.className&&(i=n.className.baseVal)}let o="";n.tagName&&(o=n.tagName.toLowerCase());let a=n.id?n.id:"";"string"!=typeof a&&(a=""),this.textCapturedWhiteListRegex.test(s)||this.htmlIDWhiteListRegex.test(a)||("input"===o?(!n.type||"button"!==n.type&&"submit"!==n.type)&&(s="*"):"textarea"===o&&(s="*")),s=function(e){return e.replace(/[0-9]/g,"*")}(s);const c={src:n.src?n.src:"",txt:s,tag:o,hid:a,type:"click",class:i};J.getInstance().addPvClick(),ne.getInstance().addPageVisitEvents([{event:be(c),occurredAt:new Date(X(Date.now())).toISOString()}],"userstep")}}_parseTextFromParentElement(e,t){let n=e;const r=[];let s=0;for(;n&&!(s>=5)&&n.parentNode;)n=n.parentNode,r.push(n),s+=1;for(let e=0;e<r.length;e+=1){const n=r[e];if(n&&"BUTTON"===n.tagName)return this._getTextualContentFromEl(n,!1,t)}return""}_getTextualContentFromEl(e,t,n){let r=this._parseInnerContent(e,"",100,{value:0,limit:100},n);if(t){const t=e.tagName?e.tagName.toLowerCase():"";if(""===r)r=this._parseTextFromParentElement(e,n);else if("select"===t){const t=r;r=this._parseTextFromParentElement(e,n),r=r.replace(t,"")}}return r}_trimText(e){let t=e.trim().replace(/\s+/g," ");if(t.length>100){const e=t.lastIndexOf(" ",97);t=e>0?t.substring(0,e)+"...":"..."}return t}_parseInnerContent(e,t,n,r,s){if(t.length>=n)return t;if(r.value>=r.limit)return t;if(r.value+=1,e.classList)for(const n of e.classList)if(s.includes(n))return t+(t?" ":"")+"*";if(e.nodeType===Node.TEXT_NODE&&(t=this._parseAndAppendText(t,[e.textContent])).length>=n)return t;let i=!0;if(e.nodeType===Node.ELEMENT_NODE){if(0===e.childNodes.length&&(t=this._parseAndAppendText(t,[e.value,e.title])).length>=n)return t;if(1===e.childNodes.length&&e.childNodes[0].nodeType===Node.TEXT_NODE&&(i=!1,(t=this._parseAndAppendText(t,[e.textContent,e.value,e.title])).length>=n))return t}if(i)for(const i of e.childNodes)t=this._parseInnerContent(i,t,n,r,s);return t}_parseAndAppendText(e,t){for(let n of t)if(n=(n||"").trim().replace(/\s+/g," "),n.length>0)return e+(e?" ":"")+n;return e}}class Ee{monitor(){Y(window,"input",this._handle)}_handle(e){const{target:t}=e;if("INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName)return;const n=t.placeholder||t.name||t.id;n&&re.getInstance().addEvent(be({src:"",txt:n,tag:t.tagName.toLowerCase(),hid:t.id,type:"kbd",class:t.className}),"kbd")}}let Re=window.location.href;class _e{static getInstance(){return this.instance||(this.instance=new _e),this.instance}monitor(){l.forEach(e=>{Y(window,e,this._onPageEventHandle.bind(this),!0)}),u.forEach(e=>{Y(document,e,this._onPageEventHandle.bind(this),!0)})}_onPageEventHandle(e){if(!e||!e.type)return;const t={type:e.type};switch(e.type){case"visibilitychange":t.data="state: "+this.getDocumentState();break;case"readystatechange":t.data="state: "+document.readyState;break;case"pagehide":case"pageshow":case"load":e.persisted&&(t.data="persisted: "+e.persisted);break;case"storage":e.key&&(t.data="key: "+e.key);break;case"message":case"messageerror":e.data&&e.origin&&(t.data=`origin: ${e.origin} size: ${this.getSizeInBytes(e.data)}`);break;case"hashchange":e.newURL&&(t.data="newURL: "+e.newURL)}re.getInstance().addEvent(t,"page")}getDocumentState(){return"hidden"===document.visibilityState?"hidden":document.hasFocus()?"active":"passive"}getSizeInBytes(e){let t=e;return"string"!=typeof e&&(t=JSON.stringify(e)),2*t.length}}var Te;function Me(e){return e.nodeType===e.ELEMENT_NODE}function Ne(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function De(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function Oe(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(Le).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function Le(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=Oe(e.styleSheet)||t}catch(e){}return t}!function(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"}(Te||(Te={}));var xe=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Pe(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,s=e.value,i=e.maskInputFn,o=s||"";return(t[n.toLowerCase()]||t[r])&&(o=i?i(o):"*".repeat(o.length)),o}var Fe,Ve,Ue=1,qe=new RegExp("[^a-z0-9-_:]");function Ge(){return Ue++}var Be=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,We=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,He=/^(data:)([^,]*),(.*)/i;function Ze(e,t){return(e||"").replace(Be,(function(e,n,r,s,i,o){var a,c=r||i||o,l=n||s||"";if(!c)return e;if(!We.test(c))return"url(".concat(l).concat(c).concat(l,")");if(He.test(c))return"url(".concat(l).concat(c).concat(l,")");if("/"===c[0])return"url(".concat(l).concat((a=t,(a.indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+c)).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var h=0,p=d;h<p.length;h++){var g=p[h];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(l).concat(u.join("/")).concat(l,")")}))}var ze=/^[^ \t\n\r\u000c]+/,Ke=/^[, \t\n\r\u000c]+/;function je(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function Ye(){var e=document.createElement("a");return e.href="",e.href}function Je(e,t,n,r){return"src"===n||"href"===n&&r&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&r&&"#"!==r[0]?je(e,r):"background"!==n||!r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n&&r?function(e,t){if(""===t.trim())return t;var n=0;function r(e){var r,s=e.exec(t.substring(n));return s?(r=s[0],n+=r.length,r):""}for(var s=[];r(Ke),!(n>=t.length);){var i=r(ze);if(","===i.slice(-1))i=je(e,i.substring(0,i.length-1)),s.push(i);else{var o="";i=je(e,i);for(var a=!1;;){var c=t.charAt(n);if(""===c){s.push((i+o).trim());break}if(a)")"===c&&(a=!1);else{if(","===c){n+=1,s.push((i+o).trim());break}"("===c&&(a=!0)}o+=c,n+=1}}}return s.join(", ")}(e,r):"style"===n&&r?Ze(r,Ye()):"object"===t&&"data"===n&&r?je(e,r):r:je(e,r)}function Qe(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Qe(e.parentNode,t,n);for(var r=e.classList.length;r--;){var s=e.classList[r];if(t.test(s))return!0}return!!n&&Qe(e.parentNode,t,n)}function $e(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(Qe(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}return!1}function Xe(e,t){var n=t.doc,r=t.mirror,s=t.blockClass,i=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=void 0===l?{}:l,d=t.maskTextFn,h=t.maskInputFn,p=t.dataURLOptions,g=void 0===p?{}:p,m=t.inlineImages,f=t.recordCanvas,I=t.keepIframeSrcFn,y=t.newlyAddedElement,v=void 0!==y&&y,C=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Te.Document,childNodes:[],compatMode:e.compatMode}:{type:Te.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Te.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,s=t.blockSelector,i=t.inlineStylesheet,o=t.maskInputOptions,a=void 0===o?{}:o,c=t.maskInputFn,l=t.dataURLOptions,u=void 0===l?{}:l,d=t.inlineImages,h=t.recordCanvas,p=t.keepIframeSrcFn,g=t.newlyAddedElement,m=void 0!==g&&g,f=t.rootId,I=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var s=e.classList[r];if(t.test(s))return!0}return!!n&&e.matches(n)}(e,r,s),y=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return qe.test(t)?"div":t}(e),v={},C=e.attributes.length,b=0;b<C;b++){var S=e.attributes[b];v[S.name]=Je(n,y,S.name,S.value)}if("link"===y&&i){var w=Array.from(n.styleSheets).find((function(t){return t.href===e.href})),A=null;w&&(A=Oe(w)),A&&(delete v.rel,delete v.href,v._cssText=Ze(A,w.href))}if("style"===y&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){(A=Oe(e.sheet))&&(v._cssText=Ze(A,Ye()))}if("input"===y||"textarea"===y||"select"===y){var k=e.value,E=e.checked;"radio"!==v.type&&"checkbox"!==v.type&&"submit"!==v.type&&"button"!==v.type&&k?v.value=Pe({type:v.type,tagName:y,value:k,maskInputOptions:a,maskInputFn:c}):E&&(v.checked=E)}"option"===y&&(e.selected&&!a.select?v.selected=!0:delete v.selected);if("canvas"===y&&h)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var n=0;n<e.width;n+=50)for(var r=0;r<e.height;r+=50){var s=t.getImageData,i="__rrweb_original__"in s?s.__rrweb_original__:s;if(new Uint32Array(i.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(e)||(v.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var R=e.toDataURL(u.type,u.quality),_=document.createElement("canvas");_.width=e.width,_.height=e.height;var T=_.toDataURL(u.type,u.quality);R!==T&&(v.rr_dataURL=R)}if("img"===y&&d){Fe||(Fe=n.createElement("canvas"),Ve=Fe.getContext("2d"));var M=e,N=M.crossOrigin;M.crossOrigin="anonymous";var D=function(){try{Fe.width=M.naturalWidth,Fe.height=M.naturalHeight,Ve.drawImage(M,0,0),v.rr_dataURL=Fe.toDataURL(u.type,u.quality)}catch(e){console.warn("Cannot inline img src=".concat(M.currentSrc,"! Error: ").concat(e))}N?v.crossOrigin=N:M.removeAttribute("crossorigin")};M.complete&&0!==M.naturalWidth?D():M.onload=D}"audio"!==y&&"video"!==y||(v.rr_mediaState=e.paused?"paused":"played",v.rr_mediaCurrentTime=e.currentTime);m||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop));if(I){var O=e.getBoundingClientRect(),L=O.width,x=O.height;v={class:v.class,rr_width:"".concat(L,"px"),rr_height:"".concat(x,"px")}}"iframe"!==y||p(v.src)||(e.contentDocument||(v.rr_src=v.src),delete v.src);return{type:Te.Element,tagName:y,attributes:v,childNodes:[],isSVG:(P=e,Boolean("svg"===P.tagName||P.ownerSVGElement)||void 0),needBlock:I,rootId:f};var P}(e,{doc:n,blockClass:s,blockSelector:i,inlineStylesheet:c,maskInputOptions:u,maskInputFn:h,dataURLOptions:g,inlineImages:m,recordCanvas:f,keepIframeSrcFn:I,newlyAddedElement:v,rootId:C});case e.TEXT_NODE:return function(e,t){var n,r=t.maskTextClass,s=t.maskTextSelector,i=t.maskTextFn,o=t.rootId,a=e.parentNode&&e.parentNode.tagName,c=e.textContent,l="STYLE"===a||void 0,u="SCRIPT"===a||void 0;if(l&&c){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(d=e.parentNode.sheet,c=d.cssRules?Array.from(d.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(t),e)}c=Ze(c,Ye())}var d;u&&(c="SCRIPT_PLACEHOLDER");!l&&!u&&c&&$e(e,r,s)&&(c=i?i(c):c.replace(/[\S]/g,"*"));return{type:Te.Text,textContent:c||"",isStyle:l,rootId:o}}(e,{maskTextClass:o,maskTextSelector:a,maskTextFn:d,rootId:C});case e.CDATA_SECTION_NODE:return{type:Te.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:Te.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function et(e){return void 0===e?"":e.toLowerCase()}function tt(e,t){var n,r=t.doc,s=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,c=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,h=void 0===d||d,p=t.maskInputOptions,g=void 0===p?{}:p,m=t.maskTextFn,f=t.maskInputFn,I=t.slimDOMOptions,y=t.dataURLOptions,v=void 0===y?{}:y,C=t.inlineImages,b=void 0!==C&&C,S=t.recordCanvas,w=void 0!==S&&S,A=t.onSerialize,k=t.onIframeLoad,E=t.iframeLoadTimeout,R=void 0===E?5e3:E,_=t.onStylesheetLoad,T=t.stylesheetLoadTimeout,M=void 0===T?5e3:T,N=t.keepIframeSrcFn,D=void 0===N?function(){return!1}:N,O=t.newlyAddedElement,L=void 0!==O&&O,x=t.preserveWhiteSpace,P=void 0===x||x,F=Xe(e,{doc:r,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,dataURLOptions:v,inlineImages:b,recordCanvas:w,keepIframeSrcFn:D,newlyAddedElement:L});if(!F)return console.warn(e,"not serialized"),null;n=s.hasNode(e)?s.getId(e):!function(e,t){if(t.comment&&e.type===Te.Comment)return!0;if(e.type===Te.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&"preload"===e.attributes.rel&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(et(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===et(e.attributes.name)||"icon"===et(e.attributes.rel)||"apple-touch-icon"===et(e.attributes.rel)||"shortcut icon"===et(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&et(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(et(e.attributes.property).match(/^(og|twitter|fb):/)||et(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===et(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===et(e.attributes.name)||"googlebot"===et(e.attributes.name)||"bingbot"===et(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===et(e.attributes.name)||"generator"===et(e.attributes.name)||"framework"===et(e.attributes.name)||"publisher"===et(e.attributes.name)||"progid"===et(e.attributes.name)||et(e.attributes.property).match(/^article:/)||et(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===et(e.attributes.name)||"yandex-verification"===et(e.attributes.name)||"csrf-token"===et(e.attributes.name)||"p:domain_verify"===et(e.attributes.name)||"verify-v1"===et(e.attributes.name)||"verification"===et(e.attributes.name)||"shopify-checkout-api-token"===et(e.attributes.name)))return!0}}return!1}(F,I)&&(P||F.type!==Te.Text||F.isStyle||F.textContent.replace(/^\s+|\s+$/gm,"").length)?Ge():-2;var V=Object.assign(F,{id:n});if(s.add(e,V),-2===n)return null;A&&A(e);var U=!u;if(V.type===Te.Element){U=U&&!V.needBlock,delete V.needBlock;var q=e.shadowRoot;q&&De(q)&&(V.isShadowHost=!0)}if((V.type===Te.Document||V.type===Te.Element)&&U){I.headWhitespace&&V.type===Te.Element&&"head"===V.tagName&&(P=!1);for(var G={doc:r,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:u,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,slimDOMOptions:I,dataURLOptions:v,inlineImages:b,recordCanvas:w,preserveWhiteSpace:P,onSerialize:A,onIframeLoad:k,iframeLoadTimeout:R,onStylesheetLoad:_,stylesheetLoadTimeout:M,keepIframeSrcFn:D},B=0,W=Array.from(e.childNodes);B<W.length;B++){(z=tt(W[B],G))&&V.childNodes.push(z)}if(Me(e)&&e.shadowRoot)for(var H=0,Z=Array.from(e.shadowRoot.childNodes);H<Z.length;H++){var z;(z=tt(Z[H],G))&&(De(e.shadowRoot)&&(z.isShadow=!0),V.childNodes.push(z))}}return e.parentNode&&Ne(e.parentNode)&&De(e.parentNode)&&(V.isShadow=!0),V.type===Te.Element&&"iframe"===V.tagName&&function(e,t,n){var r=e.contentWindow;if(r){var s,i=!1;try{s=r.document.readyState}catch(e){return}if("complete"===s){if("about:blank"!==r.location.href||"about:blank"===e.src||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var o=setTimeout((function(){i||(t(),i=!0)}),n);e.addEventListener("load",(function(){clearTimeout(o),i=!0,t()}))}}}(e,(function(){var t=e.contentDocument;if(t&&k){var n=tt(t,{doc:t,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,slimDOMOptions:I,dataURLOptions:v,inlineImages:b,recordCanvas:w,preserveWhiteSpace:P,onSerialize:A,onIframeLoad:k,iframeLoadTimeout:R,onStylesheetLoad:_,stylesheetLoadTimeout:M,keepIframeSrcFn:D});n&&k(e,n)}}),R),V.type===Te.Element&&"link"===V.tagName&&"stylesheet"===V.attributes.rel&&function(e,t,n){var r,s=!1;try{r=e.sheet}catch(e){return}if(!r){var i=setTimeout((function(){s||(t(),s=!0)}),n);e.addEventListener("load",(function(){clearTimeout(i),s=!0,t()}))}}(e,(function(){if(_){var t=tt(e,{doc:r,mirror:s,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:g,maskTextFn:m,maskInputFn:f,slimDOMOptions:I,dataURLOptions:v,inlineImages:b,recordCanvas:w,preserveWhiteSpace:P,onSerialize:A,onIframeLoad:k,iframeLoadTimeout:R,onStylesheetLoad:_,stylesheetLoadTimeout:M,keepIframeSrcFn:D});t&&_(e,t)}}),M),V}var nt=/([^\\]):hover/;new RegExp(nt.source,"g");function rt(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const st="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let it={map:{},getId:()=>(console.error(st),-1),getNode:()=>(console.error(st),null),removeNodeFromMap(){console.error(st)},has:()=>(console.error(st),!1),reset(){console.error(st)}};function ot(e,t,n={}){let r=null,s=0;return function(...i){const o=Date.now();s||!1!==n.leading||(s=o);const a=t-(o-s),c=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),s=o,e.apply(c,i)):r||!1===n.trailing||(r=setTimeout(()=>{s=!1===n.leading?0:Date.now(),r=null,e.apply(c,i)},a))}}function at(e,t,n,r,s=window){const i=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>at(e,t,i||{},!0)}function ct(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],s=n(r);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}function lt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ut(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function dt(e,t,n,r){if(!e)return!1;const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!s)return!1;if("string"==typeof t){if(s.classList.contains(t))return!0;if(r&&null!==s.closest("."+t))return!0}else if(Qe(s,t,r))return!0;if(n){if(s.matches(n))return!0;if(r&&null!==s.closest(n))return!0}return!1}function ht(e,t){return-2===t.getId(e)}function pt(e){return Boolean(e.changedTouches)}function gt(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function mt(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ft(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(it=new Proxy(it,{get:(e,t,n)=>("map"===t&&console.error(st),Reflect.get(e,t,n))}));class It{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?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++}}var yt=(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))(yt||{}),vt=(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))(vt||{}),Ct=(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))(Ct||{}),bt=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(bt||{});function St(e){return"__ln"in e}class wt{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&St(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n?n.previous=t:this.tail=t}else if(e.nextSibling&&St(e.nextSibling)&&e.nextSibling.__ln.previous){const 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:this.tail=t,t.next=this.head,this.head=t;this.length++}removeNode(e){const 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)),e.__ln&&delete e.__ln,this.length--)}}const At=(e,t)=>`${e}@${t}`;class kt{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new wt,n=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},r=r=>{var s,i,o,a;let c=null;(null===(i=null===(s=r.getRootNode)||void 0===s?void 0:s.call(r))||void 0===i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&r.getRootNode().host&&(c=r.getRootNode().host);let l=c;for(;(null===(a=null===(o=null==l?void 0:l.getRootNode)||void 0===o?void 0:o.call(l))||void 0===a?void 0:a.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&l.getRootNode().host;)l=l.getRootNode().host;const u=!(this.doc.contains(r)||l&&this.doc.contains(l));if(!r.parentNode||u)return;const d=Ne(r.parentNode)?this.mirror.getId(c):this.mirror.getId(r.parentNode),h=n(r);if(-1===d||-1===h)return t.addNode(r);const p=tt(r,{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),mt(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),ft(r)&&this.shadowDomManager.addShadowRoot(r.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});p&&e.push({parentId:d,nextId:h,node:p})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))Rt(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||r(e);for(const e of Array.from(this.addedSet.values()))_t(this.droppedSet,e)||Rt(this.removes,e,this.mirror)?_t(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let s=null;for(;t.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),r=n(s.value);-1!==t&&-1!==r&&(e=s)}if(!e){let r=t.tail;for(;r;){const t=this.mirror.getId(r.value.parentNode);if(-1!==n(r.value)){if(-1!==t){e=r;break}{const t=r.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=t.parentNode.host;if(-1!==this.mirror.getId(n)){e=r;break}}}r=r.previous}else r=r.previous}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}s=e.previous,t.removeNode(e.value),r(e.value)}const i={texts:this.texts.map(e=>({id:this.mirror.getId(e.node),value:e.value})).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>({id:this.mirror.getId(e.node),attributes:e.attributes})).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!ht(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;dt(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:$e(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(n=Pe({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),dt(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let r=this.attributes.find(t=>t.node===e.target);if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(n)){if(t.contentDocument)return;try{e.attributeName="rr_src"}catch(e){return}}if(r||(r={node:e.target,attributes:{}},this.attributes.push(r)),"style"===e.attributeName){const n=this.doc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue),void 0!==r.attributes.style&&null!==r.attributes.style||(r.attributes.style={});const s=r.attributes.style;for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),i=t.style.getPropertyPriority(e);r===n.style.getPropertyValue(e)&&i===n.style.getPropertyPriority(e)||(s[e]=""===i?r:[r,i])}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(s[e]=!1)}else r.attributes[e.attributeName]=Je(this.doc,t.tagName,e.attributeName,n);break}case"childList":if(dt(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const n=this.mirror.getId(t),r=Ne(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);dt(e.target,this.blockClass,this.blockSelector,!1)||ht(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Et(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||function e(t,n){if(Ne(t))return!1;const r=n.getId(t);return!n.has(r)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode,n))}(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[At(n,r)]?Et(this.movedSet,t):this.removes.push({parentId:r,id:n,isShadow:!(!Ne(e.target)||!De(e.target))||void 0})),this.mapRemoves.push(t))})}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(ht(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[At(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);dt(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(e=>this.genAdds(e))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].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 Et(e,t){e.delete(t),t.childNodes.forEach(t=>Et(e,t))}function Rt(e,t,n){return 0!==e.length&&function e(t,n,r){const{parentNode:s}=n;if(!s)return!1;const i=r.getId(s);if(t.some(e=>e.id===i))return!0;return e(t,s,r)}(e,t,n)}function _t(e,t){return 0!==e.size&&function e(t,n){const{parentNode:r}=n;if(!r)return!1;if(t.has(r))return!0;return e(t,r)}(e,t)}const Tt=[],Mt="undefined"!=typeof CSSGroupingRule,Nt="undefined"!=typeof CSSMediaRule,Dt="undefined"!=typeof CSSSupportsRule,Ot="undefined"!=typeof CSSConditionRule;function Lt(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function xt(e,t){var n,r;const s=new kt;Tt.push(s),s.init(e);let i=window.MutationObserver||window.__rrMutationObserver;const o=null===(r=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===r?void 0:r.call(n,"MutationObserver");o&&window[o]&&(i=window[o]);const a=new i(s.processMutations.bind(s));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Pt({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:s,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const o=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];return Object.keys(Ct).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(i=>{const o=i.toLowerCase(),c=(t=>i=>{const o=Lt(i);if(dt(o,r,s,!0))return;const a=pt(i)?i.changedTouches[0]:i;if(!a)return;const c=n.getId(o),{clientX:l,clientY:u}=a;e({type:Ct[t],id:c,x:l,y:u})})(i);a.push(rt(o,c,t))}),()=>{a.forEach(e=>e())}}function Ft({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:s,sampling:i}){return rt("scroll",ot(i=>{const o=Lt(i);if(!o||dt(o,r,s,!0))return;const a=n.getId(o);if(o===t){const n=t.scrollingElement||t.documentElement;e({id:a,x:n.scrollLeft,y:n.scrollTop})}else e({id:a,x:o.scrollLeft,y:o.scrollTop})},i.scroll||100),t)}function Vt(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Ut=["INPUT","TEXTAREA","SELECT"],qt=new WeakMap;function Gt(e){return function(e,t){if(Mt&&e.parentRule instanceof CSSGroupingRule||Nt&&e.parentRule instanceof CSSMediaRule||Dt&&e.parentRule instanceof CSSSupportsRule||Ot&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function Bt(e,t,n){let r,s;return e?(e.ownerNode?r=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:r}):{}}function Wt({mirror:e,stylesheetManager:t},n){var r,s,i;let o=null;o="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(r=n.defaultView)||void 0===r?void 0:r.Document:null===(i=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===i?void 0:i.ShadowRoot,c=Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets");return null!==o&&-1!==o&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const r=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==o&&-1!==o)try{t.adoptStyleSheets(e,o)}catch(e){}return r}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}):()=>{}}function Ht(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:s,scrollCb:i,viewportResizeCb:o,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p}=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),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),i(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...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),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)}}(e,t);const r=xt(e,e.doc),s=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,i="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const c=ot(t=>{const n=Date.now()-o;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],o=null},i),l=ot(e=>{const t=Lt(e),{clientX:n,clientY:s}=pt(e)?e.changedTouches[0]:e;o||(o=Date.now()),a.push({x:n,y:s,id:r.getId(t),timeOffset:Date.now()-o}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?vt.Drag:e instanceof MouseEvent?vt.MouseMove:vt.TouchMove)},s,{trailing:!1}),u=[rt("mousemove",l,n),rt("touchmove",l,n),rt("drag",l,n)];return()=>{u.forEach(e=>e())}}(e),i=Pt(e),o=Ft(e),a=function({viewportResizeCb:e}){let t=-1,n=-1;return rt("resize",ot(()=>{const r=lt(),s=ut();t===r&&n===s||(e({width:Number(s),height:Number(r)}),t=r,n=s)},200),window)}(e),c=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:s,ignoreClass:i,maskInputOptions:o,maskInputFn:a,sampling:c,userTriggeredOnInput:l}){function u(e){let n=Lt(e);const c=e.isTrusted;if(n&&"OPTION"===n.tagName&&(n=n.parentElement),!n||!n.tagName||Ut.indexOf(n.tagName)<0||dt(n,r,s,!0))return;const u=n.type;if(n.classList.contains(i))return;let h=n.value,p=!1;"radio"===u||"checkbox"===u?p=n.checked:(o[n.tagName.toLowerCase()]||o[u])&&(h=Pe({maskInputOptions:o,tagName:n.tagName,type:u,value:h,maskInputFn:a})),d(n,Vt({text:h,isChecked:p,userTriggered:c},l));const g=n.name;"radio"===u&&g&&p&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{e!==n&&d(e,Vt({text:e.value,isChecked:!p,userTriggered:!1},l))})}function d(t,r){const s=qt.get(t);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){qt.set(t,r);const s=n.getId(t);e(Object.assign(Object.assign({},r),{id:s}))}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>rt(e,u,t)),p=t.defaultView;if(!p)return()=>{h.forEach(e=>e())};const g=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),m=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&h.push(...m.map(e=>at(e[0],e[1],{set(){u({target:this})}},!1,p))),()=>{h.forEach(e=>e())}}(e),l=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:s}){const i=i=>ot(s=>{const o=Lt(s);if(!o||dt(o,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=o;e({type:i,id:r.getId(o),currentTime:a,volume:c,muted:l,playbackRate:u})},s.media||500),o=[rt("play",i(0)),rt("pause",i(1)),rt("seeked",i(2)),rt("volumechange",i(3)),rt("ratechange",i(4))];return()=>{o.forEach(e=>e())}}(e),u=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){const s=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=function(r,i){const{id:o,styleId:a}=Bt(this,t,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:r,index:i}]}),s.apply(this,[r,i])};const i=r.CSSStyleSheet.prototype.deleteRule;let o,a;r.CSSStyleSheet.prototype.deleteRule=function(r){const{id:s,styleId:o}=Bt(this,t,n.styleMirror);return(s&&-1!==s||o&&-1!==o)&&e({id:s,styleId:o,removes:[{index:r}]}),i.apply(this,[r])},r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=function(r){const{id:s,styleId:i}=Bt(this,t,n.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,replace:r}),o.apply(this,[r])}),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=function(r){const{id:s,styleId:i}=Bt(this,t,n.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,replaceSync:r}),a.apply(this,[r])});const c={};Mt?c.CSSGroupingRule=r.CSSGroupingRule:(Nt&&(c.CSSMediaRule=r.CSSMediaRule),Ot&&(c.CSSConditionRule=r.CSSConditionRule),Dt&&(c.CSSSupportsRule=r.CSSSupportsRule));const l={};return Object.entries(c).forEach(([r,s])=>{l[r]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=function(s,i){const{id:o,styleId:a}=Bt(this.parentStyleSheet,t,n.styleMirror);return(o&&-1!==o||a&&-1!==a)&&e({id:o,styleId:a,adds:[{rule:s,index:[...Gt(this),i||0]}]}),l[r].insertRule.apply(this,[s,i])},s.prototype.deleteRule=function(s){const{id:i,styleId:o}=Bt(this.parentStyleSheet,t,n.styleMirror);return(i&&-1!==i||o&&-1!==o)&&e({id:i,styleId:o,removes:[{index:[...Gt(this),s]}]}),l[r].deleteRule.apply(this,[s])}}),()=>{r.CSSStyleSheet.prototype.insertRule=s,r.CSSStyleSheet.prototype.deleteRule=i,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule})}}(e,{win:n}),d=Wt(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:s}){const i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=function(s,o,a){var c;if(n.has(s))return i.apply(this,[s,o,a]);const{id:l,styleId:u}=Bt(null===(c=this.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,set:{property:s,value:o,priority:a},index:Gt(this.parentRule)}),i.apply(this,[s,o,a])};const o=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=function(s){var i;if(n.has(s))return o.apply(this,[s]);const{id:a,styleId:c}=Bt(null===(i=this.parentRule)||void 0===i?void 0:i.parentStyleSheet,t,r.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,remove:{property:s},index:Gt(this.parentRule)}),o.apply(this,[s])},()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=o}}(e,{win:n}),p=e.collectFonts?function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],s=new WeakMap,i=n.FontFace;n.FontFace=function(e,t,n){const r=new i(e,t,n);return s.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const o=ct(t.fonts,"add",(function(t){return function(n){return setTimeout(()=>{const t=s.get(n);t&&(e(t),s.delete(n))},0),t.apply(this,[n])}}));return r.push(()=>{n.FontFace=i}),r.push(o),()=>{r.forEach(e=>e())}}(e):()=>{},g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:s,selectionCb:i}=e;let o=!0;const a=()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const i=e.getRangeAt(t),{startContainer:o,startOffset:c,endContainer:l,endOffset:u}=i;dt(o,r,s,!0)||dt(l,r,s,!0)||a.push({start:n.getId(o),startOffset:c,end:n.getId(l),endOffset:u})}i({ranges:a})};return a(),rt("selectionchange",a)}(e),m=[];for(const t of e.plugins)m.push(t.observer(t.callback,n,t.options));return()=>{Tt.forEach(e=>e.reset()),r.disconnect(),s(),i(),o(),a(),c(),l(),u(),d(),h(),p(),g(),m.forEach(e=>e())}}class Zt{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,r){const s=n||this.getIdToRemoteIdMap(e),i=r||this.getRemoteIdToIdMap(e);let o=s.get(t);return o||(o=this.generateIdFn(),s.set(t,o),i.set(o,t)),o}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,n,r))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=r.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,n))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);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}}class zt{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Zt(Ge),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Zt(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;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.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){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const n=this.transformCrossOriginEvent(t,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var n;switch(t.type){case yt.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:yt.IncrementalSnapshot,data:{source:vt.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case yt.Meta:case yt.Load:case yt.DomContentLoaded:return!1;case yt.Plugin:return t;case yt.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case yt.IncrementalSnapshot:switch(t.data.source){case vt.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)}),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 vt.Drag:case vt.TouchMove:case vt.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case vt.ViewportResize:return!1;case vt.MediaInteraction:case vt.MouseInteraction:case vt.Scroll:case vt.CanvasMutation:case vt.Input:return this.replaceIds(t.data,e,["id"]),t;case vt.StyleSheetRule:case vt.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case vt.Font:return t;case vt.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case vt.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}}replace(e,t,n,r){for(const s of r)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));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"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}}class Kt{constructor(e){this.shadowDoms=new WeakSet,this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.active=!0;const t=this;ct(Element.prototype,"attachShadow",(function(e){return function(n){const r=e.call(this,n);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),r}}))}addShadowRoot(e,t){this.active&&De(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),xt(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Ft(Object.assign(Object.assign({},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(e.host)),Wt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;ct(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(n){return function(r){const s=n.call(this,r);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),s}}))}}reset(){this.active=!1,this.shadowDoms=new WeakSet}}function jt(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}for(var Yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Qt=0;Qt<Yt.length;Qt++)Jt[Yt.charCodeAt(Qt)]=Qt;const $t=new Map;const Xt=(e,t,n)=>{if(!e||!nn(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=$t.get(e);return n||(n=new Map,$t.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let s=r.indexOf(e);return-1===s&&(s=r.length,r.push(e)),s};function en(e,t,n){if(e instanceof Array)return e.map(e=>en(e,t,n));if(null===e)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:function(e){var t,n=new Uint8Array(e),r=n.length,s="";for(t=0;t<r;t+=3)s+=Yt[n[t]>>2],s+=Yt[(3&n[t])<<4|n[t+1]>>4],s+=Yt[(15&n[t+1])<<2|n[t+2]>>6],s+=Yt[63&n[t+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[en(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[en(e.data,t,n),e.width,e.height]}}if(nn(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:Xt(e,t,n)}}return e}const tn=(e,t,n)=>[...e].map(e=>en(e,t,n)),nn=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(n.find(n=>e instanceof t[n]))};function rn(e,t,n){const r=[];try{const s=ct(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(r,...s){return dt(this,t,n,!0)||"__context"in this||(this.__context=r),e.apply(this,[r,...s])}}));r.push(s)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach(e=>e())}}function sn(e,t,n,r,s,i,o){const a=[],c=Object.getOwnPropertyNames(e);for(const i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if("function"!=typeof e[i])continue;const c=ct(e,i,(function(e){return function(...a){const c=e.apply(this,a);if(Xt(c,o,this),!dt(this.canvas,r,s,!0)){const e=tn([...a],o,this),r={type:t,property:i,args:e};n(this.canvas,r)}return c}}));a.push(c)}catch(r){const s=at(e,i,{set(e){n(this.canvas,{type:t,property:i,args:[e],setter:!0})}});a.push(s)}return a}var on=null;try{var an="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");on=an.Worker}catch(e){}function cn(e,t,n){var r=void 0===t?null:t,s=function(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}(e,void 0!==n&&n),i=s.indexOf("\n",10)+1,o=s.substring(i)+(r?"//# sourceMappingURL="+r:"");return function(e){return new on(o,Object.assign({},e,{eval:!0}))}}function ln(e,t,n){var r=void 0===t?null:t,s=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),s=0,i=n.length;s<i;++s)r[s]=n.charCodeAt(s);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,void 0!==n&&n),i=s.indexOf("\n",10)+1,o=s.substring(i)+(r?"//# sourceMappingURL="+r:""),a=new Blob([o],{type:"application/javascript"});return URL.createObjectURL(a)}var un="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);var dn,hn,pn,gn=(dn="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",hn=null,pn=!1,un?cn(dn,hn,pn):function(e,t,n){var r;return function(s){return r=r||ln(e,t,n),new Worker(r,s)}}(dn,hn,pn));class mn{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,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)};const{sampling:t="all",win:n,blockClass:r,blockSelector:s,recordCanvas:i,dataURLOptions:o}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(n,r,s),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,s,{dataURLOptions:o})}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,s){const i=rn(t,n,r),o=new Map,a=new gn;a.onmessage=e=>{const{id:t}=e.data;if(o.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:s,height:i}=e.data;this.mutationCb({id:t,type:bt["2D"],commands:[{property:"clearRect",args:[0,0,s,i]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{dt(t,n,r,!0)||e.push(t)}),e})().forEach(e=>jt(this,void 0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(o.get(n))return;if(o.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&(null==n||n.clear(n.COLOR_BUFFER_BIT))}const r=yield createImageBitmap(e);a.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[r])})))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{i(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=rn(e,t,n),s=function(e,t,n,r){const s=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const o of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])continue;const i=ct(t.CanvasRenderingContext2D.prototype,o,(function(s){return function(...i){return dt(this.canvas,n,r,!0)||setTimeout(()=>{const n=tn([...i],t,this);e(this.canvas,{type:bt["2D"],property:o,args:n})},0),s.apply(this,i)}}));s.push(i)}catch(n){const r=at(t.CanvasRenderingContext2D.prototype,o,{set(t){e(this.canvas,{type:bt["2D"],property:o,args:[t],setter:!0})}});s.push(r)}return()=>{s.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),i=function(e,t,n,r,s){const i=[];return i.push(...sn(t.WebGLRenderingContext.prototype,bt.WebGL,e,n,r,0,t)),void 0!==t.WebGL2RenderingContext&&i.push(...sn(t.WebGL2RenderingContext.prototype,bt.WebGL2,e,n,r,0,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{r(),s(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map(e=>function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}(e,["type"])),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:r}),this.pendingCanvasMutations.delete(e)}}class fn{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new It,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(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{e=this.styleMirror.add(t);const n=Array.from(t.rules||CSSRule);r.push({styleId:e,rules:n.map((e,t)=>({rule:Le(e),index:t}))})}n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}function In(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let yn,vn,Cn,bn=!1;const Sn=new xe;function wn(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:s="rr-block",blockSelector:i=null,ignoreClass:o="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:u,maskInputOptions:d,slimDOMOptions:h,maskInputFn:p,maskTextFn:g,hooks:m,packFn:f,sampling:I={},dataURLOptions:y={},mousemoveWait:v,recordCanvas:C=!1,recordCrossOriginIframes:b=!1,userTriggeredOnInput:S=!1,collectFonts:w=!1,inlineImages:A=!1,plugins:k,keepIframeSrcFn:E=(()=>!1),ignoreCSSAttributes:R=new Set([])}=e,_=!b||window.parent===window;let T=!1;if(!_)try{window.parent.document,T=!1}catch(e){T=!0}if(_&&!t)throw new Error("emit function is required");void 0!==v&&void 0===I.mousemove&&(I.mousemove=v),Sn.reset();const M=!0===u?{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}:void 0!==d?d:{password:!0},N=!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===h,headMetaDescKeywords:"all"===h}:h||{};let D;!function(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),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let O=0;const L=e=>{for(const t of k||[])t.eventProcessor&&(e=t.eventProcessor(e));return f&&(e=f(e)),e};yn=(e,s)=>{var i;if(!(null===(i=Tt[0])||void 0===i?void 0:i.isFrozen())||e.type===yt.FullSnapshot||e.type===yt.IncrementalSnapshot&&e.data.source===vt.Mutation||Tt.forEach(e=>e.unfreeze()),_)null==t||t(L(e),s);else if(T){const t={type:"rrweb",event:L(e),isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===yt.FullSnapshot)D=e,O=0;else if(e.type===yt.IncrementalSnapshot){if(e.data.source===vt.Mutation&&e.data.isAttachIframe)return;O++;const t=r&&O>=r,s=n&&e.timestamp-D.timestamp>n;(t||s)&&vn(!0)}};const x=e=>{yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.Mutation},e)}))},P=e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.Scroll},e)})),F=e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.CanvasMutation},e)})),V=new fn({mutationCb:x,adoptedStyleSheetCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.AdoptedStyleSheet},e)}))}),U=new zt({mirror:Sn,mutationCb:x,stylesheetManager:V,recordCrossOriginIframes:b,wrappedEmit:yn});for(const e of k||[])e.getMirror&&e.getMirror({nodeMirror:Sn,crossOriginIframeMirror:U.crossOriginIframeMirror,crossOriginIframeStyleMirror:U.crossOriginIframeStyleMirror});Cn=new mn({recordCanvas:C,mutationCb:F,win:window,blockClass:s,blockSelector:i,mirror:Sn,sampling:I.canvas,dataURLOptions:y});const q=new Kt({mutationCb:x,scrollCb:P,bypassOptions:{blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:M,dataURLOptions:y,maskTextFn:g,maskInputFn:p,recordCanvas:C,inlineImages:A,sampling:I,slimDOMOptions:N,iframeManager:U,stylesheetManager:V,canvasManager:Cn,keepIframeSrcFn:E},mirror:Sn});vn=(e=!1)=>{var t,n,r,o,u,d;yn(In({type:yt.Meta,data:{href:window.location.href,width:ut(),height:lt()}}),e),V.reset(),Tt.forEach(e=>e.lock());const h=function(e,t){var n=t||{},r=n.mirror,s=void 0===r?new xe:r,i=n.blockClass,o=void 0===i?"rr-block":i,a=n.blockSelector,c=void 0===a?null:a,l=n.maskTextClass,u=void 0===l?"rr-mask":l,d=n.maskTextSelector,h=void 0===d?null:d,p=n.inlineStylesheet,g=void 0===p||p,m=n.inlineImages,f=void 0!==m&&m,I=n.recordCanvas,y=void 0!==I&&I,v=n.maskAllInputs,C=void 0!==v&&v,b=n.maskTextFn,S=n.maskInputFn,w=n.slimDOM,A=void 0!==w&&w,k=n.dataURLOptions,E=n.preserveWhiteSpace,R=n.onSerialize,_=n.onIframeLoad,T=n.iframeLoadTimeout,M=n.onStylesheetLoad,N=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn;return tt(e,{doc:e,mirror:s,blockClass:o,blockSelector:c,maskTextClass:u,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===C?{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}:!1===C?{password:!0}:C,maskTextFn:b,maskInputFn:S,slimDOMOptions:!0===A||"all"===A?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===A,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===A?{}:A,dataURLOptions:k,inlineImages:f,recordCanvas:y,preserveWhiteSpace:E,onSerialize:R,onIframeLoad:_,iframeLoadTimeout:T,onStylesheetLoad:M,stylesheetLoadTimeout:N,keepIframeSrcFn:void 0===D?function(){return!1}:D,newlyAddedElement:!1})}(document,{mirror:Sn,blockClass:s,blockSelector:i,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:M,maskTextFn:g,slimDOM:N,dataURLOptions:y,recordCanvas:C,inlineImages:A,onSerialize:e=>{gt(e,Sn)&&U.addIframe(e),mt(e,Sn)&&V.trackLinkElement(e),ft(e)&&q.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{U.attachIframe(e,t),q.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{V.attachLinkElement(e,t)},keepIframeSrcFn:E});if(!h)return console.warn("Failed to snapshot the document");yn(In({type:yt.FullSnapshot,data:{node:h,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(u=null===(o=null===document||void 0===document?void 0:document.body)||void 0===o?void 0:o.parentElement)||void 0===u?void 0:u.scrollTop)||(null===(d=null===document||void 0===document?void 0:document.body)||void 0===d?void 0:d.scrollTop)||0}}})),Tt.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&V.adoptStyleSheets(document.adoptedStyleSheets,Sn.getId(document))};try{const e=[];e.push(rt("DOMContentLoaded",()=>{yn(In({type:yt.DomContentLoaded,data:{}}))}));const t=e=>{var t;return Ht({mutationCb:x,mousemoveCb:(e,t)=>yn(In({type:yt.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.MouseInteraction},e)})),scrollCb:P,viewportResizeCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.ViewportResize},e)})),inputCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.Input},e)})),mediaInteractionCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.MediaInteraction},e)})),styleSheetRuleCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.StyleSheetRule},e)})),styleDeclarationCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.StyleDeclaration},e)})),canvasMutationCb:F,fontCb:e=>yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.Font},e)})),selectionCb:e=>{yn(In({type:yt.IncrementalSnapshot,data:Object.assign({source:vt.Selection},e)}))},blockClass:s,ignoreClass:o,maskTextClass:a,maskTextSelector:c,maskInputOptions:M,inlineStylesheet:l,sampling:I,recordCanvas:C,inlineImages:A,userTriggeredOnInput:S,collectFonts:w,doc:e,maskInputFn:p,maskTextFn:g,keepIframeSrcFn:E,blockSelector:i,slimDOMOptions:N,dataURLOptions:y,mirror:Sn,iframeManager:U,stylesheetManager:V,shadowDomManager:q,canvasManager:Cn,ignoreCSSAttributes:R,plugins:(null===(t=null==k?void 0:k.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>yn(In({type:yt.Plugin,data:{plugin:e.name,payload:t}}))})))||[]},m)};U.addLoadListener(n=>{e.push(t(n.contentDocument))});const n=()=>{vn(),e.push(t(document)),bn=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():e.push(rt("load",()=>{yn(In({type:yt.Load,data:{}})),n()},window)),()=>{e.forEach(e=>e()),bn=!1}}catch(e){console.warn(e)}}wn.addCustomEvent=(e,t)=>{if(!bn)throw new Error("please add custom event after start recording");yn(In({type:yt.Custom,data:{tag:e,payload:t}}))},wn.freezePage=()=>{Tt.forEach(e=>e.freeze())},wn.takeFullSnapshot=e=>{if(!bn)throw new Error("please take full snapshot after start recording");vn(e)},wn.mirror=Sn;var An=Uint8Array,kn=Uint16Array,En=Uint32Array,Rn=new An([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),_n=new An([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tn=new An([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mn=function(e,t){for(var n=new kn(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var s=new En(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return[n,s]},Nn=Mn(Rn,2),Dn=Nn[0],On=Nn[1];Dn[28]=258,On[258]=28;for(var Ln=Mn(_n,0),xn=(Ln[0],Ln[1]),Pn=new kn(32768),Fn=0;Fn<32768;++Fn){var Vn=(43690&Fn)>>>1|(21845&Fn)<<1;Vn=(61680&(Vn=(52428&Vn)>>>2|(13107&Vn)<<2))>>>4|(3855&Vn)<<4,Pn[Fn]=((65280&Vn)>>>8|(255&Vn)<<8)>>>1}var Un=function(e,t,n){for(var r=e.length,s=0,i=new kn(t);s<r;++s)++i[e[s]-1];var o,a=new kn(t);for(s=0;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;if(n){o=new kn(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var l=s<<4|e[s],u=t-e[s],d=a[e[s]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)o[Pn[d]>>>c]=l}else for(o=new kn(r),s=0;s<r;++s)o[s]=Pn[a[e[s]-1]++]>>>15-e[s];return o},qn=new An(288);for(Fn=0;Fn<144;++Fn)qn[Fn]=8;for(Fn=144;Fn<256;++Fn)qn[Fn]=9;for(Fn=256;Fn<280;++Fn)qn[Fn]=7;for(Fn=280;Fn<288;++Fn)qn[Fn]=8;var Gn=new An(32);for(Fn=0;Fn<32;++Fn)Gn[Fn]=5;var Bn=Un(qn,9,0),Wn=Un(Gn,5,0),Hn=function(e){return(e/8>>0)+(7&e&&1)},Zn=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof kn?kn:e instanceof En?En:An)(n-t);return r.set(e.subarray(t,n)),r},zn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Kn=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},jn=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return[new An(0),0];if(1==s){var o=new An(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=s-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=i[0].s;for(r=1;r<s;++r)i[r].s>h&&(h=i[r].s);var p=new kn(h+1),g=Yn(n[u-1],p,0);if(g>t){r=0;var m=0,f=g-t,I=1<<f;for(i.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<s;++r){var y=i[r].s;if(!(p[y]>t))break;m+=I-(1<<g-p[y]),p[y]=t}for(m>>>=f;m>0;){var v=i[r].s;p[v]<t?m-=1<<t-p[v]++-1:++r}for(;r>=0&&m;--r){var C=i[r].s;p[C]==t&&(--p[C],++m)}g=t}return[new An(p),g]},Yn=function(e,t,n){return-1==e.s?Math.max(Yn(e.l,t,n+1),Yn(e.r,t,n+1)):t[e.s]=n},Jn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new kn(++t),r=0,s=e[0],i=1,o=function(e){n[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=e[a]}return[n.subarray(0,r),t]},Qn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},$n=function(e,t,n){var r=n.length,s=Hn(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var i=0;i<r;++i)e[s+i+4]=n[i];return 8*(s+4+r)},Xn=function(e,t,n,r,s,i,o,a,c,l,u){zn(t,u++,n),++s[256];for(var d=jn(s,15),h=d[0],p=d[1],g=jn(i,15),m=g[0],f=g[1],I=Jn(h),y=I[0],v=I[1],C=Jn(m),b=C[0],S=C[1],w=new kn(19),A=0;A<y.length;++A)w[31&y[A]]++;for(A=0;A<b.length;++A)w[31&b[A]]++;for(var k=jn(w,7),E=k[0],R=k[1],_=19;_>4&&!E[Tn[_-1]];--_);var T,M,N,D,O=l+5<<3,L=Qn(s,qn)+Qn(i,Gn)+o,x=Qn(s,h)+Qn(i,m)+o+14+3*_+Qn(w,E)+(2*w[16]+3*w[17]+7*w[18]);if(O<=L&&O<=x)return $n(t,u,e.subarray(c,c+l));if(zn(t,u,1+(x<L)),u+=2,x<L){T=Un(h,p,0),M=h,N=Un(m,f,0),D=m;var P=Un(E,R,0);zn(t,u,v-257),zn(t,u+5,S-1),zn(t,u+10,_-4),u+=14;for(A=0;A<_;++A)zn(t,u+3*A,E[Tn[A]]);u+=3*_;for(var F=[y,b],V=0;V<2;++V){var U=F[V];for(A=0;A<U.length;++A){var q=31&U[A];zn(t,u,P[q]),u+=E[q],q>15&&(zn(t,u,U[A]>>>5&127),u+=U[A]>>>12)}}}else T=Bn,M=qn,N=Wn,D=Gn;for(A=0;A<a;++A)if(r[A]>255){q=r[A]>>>18&31;Kn(t,u,T[q+257]),u+=M[q+257],q>7&&(zn(t,u,r[A]>>>23&31),u+=Rn[q]);var G=31&r[A];Kn(t,u,N[G]),u+=D[G],G>3&&(Kn(t,u,r[A]>>>5&8191),u+=_n[G])}else Kn(t,u,T[r[A]]),u+=M[r[A]];return Kn(t,u,T[256]),u+M[256]},er=new En([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tr=new An(0),nr=function(e,t,n,r,s){return function(e,t,n,r,s,i){var o=e.length,a=new An(r+o+5*(1+Math.floor(o/7e3))+s),c=a.subarray(r,a.length-s),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=$n(c,l,e.subarray(u,d)):(c[u]=i,l=$n(c,l,e.subarray(u,o)))}else{for(var h=er[t-1],p=h>>>13,g=8191&h,m=(1<<n)-1,f=new kn(32768),I=new kn(m+1),y=Math.ceil(n/3),v=2*y,C=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<v)&m},b=new En(25e3),S=new kn(288),w=new kn(32),A=0,k=0,E=(u=0,0),R=0,_=0;u<o;++u){var T=C(u),M=32767&u,N=I[T];if(f[M]=N,I[T]=M,R<=u){var D=o-u;if((A>7e3||E>24576)&&D>423){l=Xn(e,c,0,b,S,w,k,E,_,u-_,l),E=A=k=0,_=u;for(var O=0;O<286;++O)S[O]=0;for(O=0;O<30;++O)w[O]=0}var L=2,x=0,P=g,F=M-N&32767;if(D>2&&T==C(u-F))for(var V=Math.min(p,D)-1,U=Math.min(32767,u),q=Math.min(258,D);F<=U&&--P&&M!=N;){if(e[u+L]==e[u+L-F]){for(var G=0;G<q&&e[u+G]==e[u+G-F];++G);if(G>L){if(L=G,x=F,G>V)break;var B=Math.min(F,G-2),W=0;for(O=0;O<B;++O){var H=u-F+O+32768&32767,Z=H-f[H]+32768&32767;Z>W&&(W=Z,N=H)}}}F+=(M=N)-(N=f[M])+32768&32767}if(x){b[E++]=268435456|On[L]<<18|xn[x];var z=31&On[L],K=31&xn[x];k+=Rn[z]+_n[K],++S[257+z],++w[K],R=u+L,++A}else b[E++]=e[u],++S[e[u]]}}l=Xn(e,c,i,b,S,w,k,E,_,u-_,l),i||(l=$n(c,l,tr))}return Zn(a,0,r+Hn(l)+s)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!s)};function rr(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var r=e,s=t,i=n.length,o=0;o!=i;){for(var a=Math.min(o+5552,i);o<a;++o)s+=r+=n[o];r%=65521,s%=65521}e=r,t=s},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();n.p(e);var r=nr(e,t,2,4);return function(e,t){var n=t.level,r=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=r<<6|(r?32-2*r:1)}(r,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(r,r.length-4,n.d()),r}const sr=e=>{const t=Object.assign(Object.assign({},e),{v:"v1"});return function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var r=0;r<e.length;){var s=e[r++];s<128||t?n+=String.fromCharCode(s):s<224?n+=String.fromCharCode((31&s)<<6|63&e[r++]):s<240?n+=String.fromCharCode((15&s)<<12|(63&e[r++])<<6|63&e[r++]):(s=((15&s)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,n+=String.fromCharCode(55296|s>>10,56320|1023&s))}return n}(rr(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new An(e.length+(e.length>>>1)),s=0,i=function(e){r[s++]=e},o=0;o<n;++o){if(s+5>r.length){var a=new An(s+8+(n-o<<1));a.set(r),r=a}var c=e.charCodeAt(o);c<128||t?i(c):c<2048?(i(192|c>>>6),i(128|63&c)):c>55295&&c<57344?(i(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),i(128|c>>>12&63),i(128|c>>>6&63),i(128|63&c)):(i(224|c>>>12),i(128|c>>>6&63),i(128|63&c))}return Zn(r,0,s)}(JSON.stringify(t))),!0)},{addCustomEvent:ir}=wn,{freezePage:or}=wn;class ar{constructor(){this.eventBuffer=[],this.vfCounter=0,this.didSetupRecorder=!1,this.recordStopper=null,this.firstRecordedTimestamp=null,this.lastRecordedTimestamp=null,this.invalidVideoLength=!1,this.lastFragPostTimestamp=new Date,this.pauseTimeout=!1,this.freezingEvents=!1,this.cssURLs=new Map,this.pageStateHistory=[],this.lastRRWebEvent=null,this.setupUnloadHandler(),this.setupPostMetricsHandler()}static configureInstance(){this.instance||(this.instance=new ar,Y(window,"click",()=>{this.instance.handleFragPost()}))}static getInstance(){if(!this.instance)throw new Error("SessionRecorder was not configured");return this.instance}addCSSURLs(e){this.cssURLs.get(e)||this.cssURLs.set(e,{seq_sent:te.getInstance().messageSequenceNum,received:!1})}checkForCSSURLs(e){if(3===e.type||2===e.type){const t=JSON.stringify(e).match(y);t&&t.length>0&&t.forEach(e=>{if(e.length>0&&e.startsWith('"href":')){e.substring(7).split(/['"]/).forEach(e=>{e.includes(".css")&&this.addCSSURLs(e)})}})}}getCSSURLsNotReceived(){const{latestReceivedSeqNumber:e}=te.getInstance(),t=[];return this.cssURLs.forEach((n,r)=>{if(!n.received&&n.seq_sent<e){const e=n;e.received=!0,this.cssURLs.set(r,e)}else n.received||t.push(r)}),t}setupUnloadHandler(){["pagehide","visibilitychange"].forEach(e=>Y(window,e,()=>{this.pageStateHistory.push(`${$()?"":(new Date).toISOString()}: ${e}`),"pagehide"===e&&this.handleFragPost()}))}setupPostMetricsHandler(){Y(window,"noibuPostMetrics",e=>{const t=e.detail,n=null===this.lastRecordedTimestamp||null===this.firstRecordedTimestamp?0:this.lastRecordedTimestamp-this.firstRecordedTimestamp,r=te.getInstance().sessionLength?te.getInstance().sessionLength:0;if(te.getInstance().retryMessageQueue.length>100){const e=this.buildDebugMessage(t,n,r),s=j.getInstance().isClientDisabled;j.getInstance().isClientDisabled=!1,j.getInstance().postNoibuErrorAndOptionallyDisableClient(e,s,"warn")}})}recordUserSession(){if(te.getInstance().closeIfInactive()||J.getInstance().didCutVideo)return;if(this.didSetupRecorder)return;const e=this,t={emit(t){e.handleNewRRwebEvent(t,2e3)},inlineStylesheet:!1,maskAllInputs:!0,blockSelector:U(),ignoreCSSAttributes:d};J.getInstance().setDidStartVideo(),e.recordStopper=wn(t),this.didSetupRecorder=!0}handleNewRRwebEvent(e,t){if(te.getInstance().closeIfInactive()||J.getInstance().didCutVideo){if(this.recordStopper)try{this.recordStopper()}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error during handleNewRRwebEvent in recordStopper: "+e,!0,"error")}return}if(5===e.type&&"unfreeze"===e.data.tag)return;if(3===e.type&&0===e.data.source||(this.pauseTimeout&&(clearTimeout(this.pauseTimeout),this.freezingEvents=!1),this.pauseTimeout=setTimeout((function(){ar.getInstance().freezingEvents=!0,wn.freezePage()}),t)),e.timestamp=X(e.timestamp),this.firstRecordedTimestamp||(this.firstRecordedTimestamp=e.timestamp),(!this.lastRecordedTimestamp||e.timestamp>this.lastRecordedTimestamp)&&(this.lastRecordedTimestamp=e.timestamp),this.firstRecordedTimestamp&&e.timestamp<this.firstRecordedTimestamp)return void j.getInstance().postNoibuErrorAndOptionallyDisableClient("Detected time rewind. Client has been disabled.",!0,"error",!0);this.eventBuffer.push(sr(e)),this.lastRRWebEvent=e,this.checkForCSSURLs(e),3!==e.type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||J.getInstance().addVideoClick();const n=new Date;n.setMilliseconds(n.getMilliseconds()-500),(this.eventBuffer.length>=10||this.lastFragPostTimestamp<n)&&this.handleFragPost()}buildDebugMessage(e,t,n){let r="Posting metrics, logging due to large retry message queue";return r+=", URL: "+document.location.href,r+=", Session Length: "+n,r+=", Video Length: "+t,r+=", Length Delta: "+(t-n),r+=", Session Start: "+new Date(te.getInstance().sessionTimestamp),null!==this.firstRecordedTimestamp&&(r+=", Video Start: "+new Date(this.firstRecordedTimestamp),r+=", Start Delta: "+(this.firstRecordedTimestamp-te.getInstance().sessionTimestamp)),r+=", Last active time: "+j.getInstance().lastActiveTime,r+=", Visibility: "+document.visibilityState,this.pageStateHistory.length>0&&(r+=", Page States: "+this.pageStateHistory),r+=`, Socket: Connected ${te.getInstance().isConnected()} Count ${te.getInstance().connectionCount} Buffer: ${te.getInstance().socket&&te.getInstance().socket.bufferedAmount}`,te.getInstance().socketCloseCodes.length>0&&(r+=" Closure Codes: "+te.getInstance().socketCloseCodes),te.getInstance().socketOpens.length>0&&(r+=" Opens: "+te.getInstance().socketOpens),null!==this.lastRRWebEvent&&(r+=`, Last rrweb event: Type ${this.lastRRWebEvent.type} Data Source ${this.lastRRWebEvent.data&&void 0!==this.lastRRWebEvent.data.source?this.lastRRWebEvent.data.source:-1} Data Type ${this.lastRRWebEvent.data&&void 0!==this.lastRRWebEvent.data.type?this.lastRRWebEvent.data.type:-1} Time: ${new Date(this.lastRRWebEvent.timestamp)}`),te.getInstance().retryMessageQueue.length>0&&(r+=", Retry queue length: "+te.getInstance().retryMessageQueue.length),r+=`, Sequence Info: Latest ${this.lastFragPostTimestamp} ${te.getInstance().messageSequenceNum} Ack'd ${te.getInstance().latestReceivedSeqNumStoredTime} ${te.getInstance().latestReceivedSeqNumber}`,e&&(r+=", Event: "+e),r}handleFragPost(){if(!te.getInstance().closeIfInactive()&&this.didSetupRecorder&&0!==this.eventBuffer.length){try{let e=0;this.firstRecordedTimestamp&&this.lastRecordedTimestamp&&!this.invalidVideoLength&&(e=this.lastRecordedTimestamp-this.firstRecordedTimestamp),!this.invalidVideoLength&&(e<0||e>=Number.MAX_SAFE_INTEGER)&&(j.getInstance().postNoibuErrorAndOptionallyDisableClient(`video lengthMS is invalid: ${e}, start time: ${this.firstRecordedTimestamp}, end time: `+this.lastRecordedTimestamp,!1,"error"),this.invalidVideoLength=!0,e=0),this.vfCounter+=1;const t={};t.vid=x(this.eventBuffer),t.seq=this.vfCounter,t.len=e,t.css_urls=this.getCSSURLsNotReceived(),te.getInstance().addEndTimeToPayload(t,!1),J.getInstance().addVideoFragData(this.vfCounter,e);const n={};n.pvvf=t,te.getInstance().sendMessage("v",n),this.lastFragPostTimestamp=new Date}catch(e){if(j.getInstance().postNoibuErrorAndOptionallyDisableClient("video frag socket closed with err: "+e.message,!1,"error"),this.recordStopper)try{this.recordStopper()}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error during handleFragPost in recordStopper: "+e,!1,"error")}}this.eventBuffer=[]}}unfreeze(){this.freezingEvents&&ir("unfreeze",{})}}class cr{static configure(e){return this.allowUntrustedEvents=e,this.initialRequest=!1,this.instance||(this.instance=new cr),this.instance}static getInstance(){if(!this.instance)throw new Error("HelpCode was not configured");return this.instance}constructor(){Y(window,"hashchange",e=>this._handleHashChange(e)),Y(window,"noibuHelpCode",e=>this._presentHelpCodeResult(e))}requestHelpCode(){this._sendRequest()}checkInitialRequest(){window.location.href.toLowerCase().includes("#helpcode")&&!1===cr.initialRequest&&(cr.initialRequest=!0,this._sendRequest())}_handleHashChange(e){if(!e.isTrusted&&!cr.allowUntrustedEvents)return;!e.oldURL.toLowerCase().includes("#helpcode")&&e.newURL.toLowerCase().includes("#helpcode")&&(window.history.back(),this._sendRequest())}_presentHelpCodeResult(e){const{success:t,data:n}=e.detail;if(t)window.prompt("",n);else{const e="Noibu help code is not available due to "+n;window.alert(e),j.getInstance().postNoibuErrorAndOptionallyDisableClient(e,!1,"error")}}_sendRequest(){te.getInstance().sendMessage("wr",{wr:"hc"})}}class lr{constructor(){this.customIDs={},this.customErrorsCount=0,this.TOO_MANY_IDS_ADDED_MSG="TOO_MANY_IDS_ADDED",this.ID_NAME_ALREADY_ADDED_MSG="ID_NAME_ALREADY_ADDED",this.NAME_TOO_LONG_MSG="NAME_TOO_LONG",this.VALUE_TOO_LONG_MSG="VALUE_TOO_LONG",this.INVALID_NAME_TYPE_MSG="INVALID_NAME_TYPE",this.INVALID_VALUE_TYPE_MSG="INVALID_VALUE_TYPE",this.NAME_HAS_NO_LENGTH_MSG="NAME_HAS_NO_LENGTH",this.VALUE_HAS_NO_LENGTH_MSG="VALUE_HAS_NO_LENGTH",this.SUCCESS_MSG="SUCCESS",this.ERROR_HAS_NO_MSG_MSG="ERROR_HAS_NO_MSG",this.ERROR_HAS_NO_STACK_MSG="ERROR_HAS_NO_STACK",this.NULL_CUSTOM_ERR_MSG="NULL_CUSTOM_ERROR",this.ERROR_ALREADY_RECEIVED_MSG="ERROR_ALREADY_RECEIVED",this.INVALID_ERROR_SOURCE_MSG="INVALID_ERROR_SOURCE_MSG",this.TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG="TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT"}static getInstance(){return this.instance||(this.instance=new lr),this.instance}exposeFunctions(){const e=this._getSDKWindowObject();window.NOIBUJS=e}_getSDKWindowObject(){return{requestHelpCode:this._requestHelpCode.bind(this),addCustomAttribute:this._addCustomAttribute.bind(this),addError:this._addCustomError.bind(this),addJsSdkError:this._addErrorFromJSSdk.bind(this)}}_validateCustomError(e){return e?e.message?e.stack?this.SUCCESS_MSG:this.ERROR_HAS_NO_STACK_MSG:this.ERROR_HAS_NO_MSG_MSG:this.NULL_CUSTOM_ERR_MSG}_validateAndSetCustomError(e){if(this.customErrorsCount>=500)return this.TOO_MANY_ERRORS_RECEIVED_PER_PAGEVISIT_MSG;const t=this._validateCustomError(e);return t!==this.SUCCESS_MSG?t:(this.customErrorsCount+=1,this.SUCCESS_MSG)}_addErrorFromJSSdk(e,t){const n=this._validateAndSetCustomError(e);return n!==this.SUCCESS_MSG?n:"ReactError"!==t&&"VueError"!==t?this.INVALID_ERROR_SOURCE_MSG:(oe(t,{error:e}),n)}_addCustomError(e){const t=this._validateAndSetCustomError(e);return t!==this.SUCCESS_MSG||oe("CustomError",{error:e}),t}_addCustomAttribute(e,t){if(Object.keys(this.customIDs).length>=10)return this.TOO_MANY_IDS_ADDED_MSG;const n=this._validateCustomIDInput(e,t);return n!==this.SUCCESS_MSG?n:e in this.customIDs?this.ID_NAME_ALREADY_ADDED_MSG:(this.customIDs[e]=t,te.getInstance().sendMessage("m",{pvm:{id_name:e,id_val:t}}),this.SUCCESS_MSG)}_validateCustomIDInput(e,t){return"string"!=typeof e?this.INVALID_NAME_TYPE_MSG:"string"!=typeof t?this.INVALID_VALUE_TYPE_MSG:t.length>50?this.VALUE_TOO_LONG_MSG:e.length>50?this.NAME_TOO_LONG_MSG:0===t.length?this.VALUE_HAS_NO_LENGTH_MSG:0===e.length?this.NAME_HAS_NO_LENGTH_MSG:this.SUCCESS_MSG}_requestHelpCode(){cr.getInstance().requestHelpCode()}}!function(t){if(q())return;if(function(t){for(let n=0;n<e.length;n+=1){if(!t[e[n]])return!0}return!1}(t))return;if(!window.location.href.startsWith("http"))return;if(function(){const e=void 0!==window.noibuJSLoaded;return window.noibuJSLoaded=!0,e}())return;const n=t.metroplexHTTPBase+"/collect_error";j.configureInstance(n);try{const e=C()();if(j.getInstance().isClientDisabled)return;cr.configure(!1);const t=te.getInstance(e);ar.configureInstance(),ne.configureInstance();const n=ar.getInstance();Q.getInstance();const r=new Ee,s=ke.getInstance(),i=_e.getInstance();me.getInstance(),pe(),Ce(),ve(),s.monitorClicks(),setInterval((function(){if(Re!==window.location.href){Re=window.location.href;const e={url:O()};re.getInstance().addEvent(e,"loc")}}),1e3),r.monitor(),i.monitor(),Promise.all([new Promise(e=>{function t(){"complete"===document.readyState&&(window.removeEventListener("load",t),document.removeEventListener("readystatechange",t),e())}"complete"===document.readyState?e():(Y(window,"load",t),Y(document,"readystatechange",t))}),t.connectionPromise]).then(()=>{n.recordUserSession(),cr.getInstance().checkInitialRequest()}).catch(e=>{j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error during recordUserSession: "+e,!1,"error")}),lr.getInstance().exposeFunctions()}catch(e){j.getInstance().postNoibuErrorAndOptionallyDisableClient("Error during globalInit: "+e,!0,"error")}}({metroplexSocketBase:g(),metroplexHTTPBase:m()})})()})();