@adora-so/adora-js 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.d.ts +4 -14
  2. package/index.mjs +2 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,14 +1,4 @@
1
- export type AdoraSettings = {
2
- bypassSampling?: boolean;
3
- orgId: string;
4
- uid?: string | number;
5
- backendUrl?: string;
6
- userCohorts?: Record<string, string>;
7
- language?: string;
8
- };
9
- export declare let adoraIsRunning: boolean;
10
- export type StartFn = (settings: AdoraSettings) => Promise<void>;
11
- export declare const adoraStart: StartFn;
12
- export declare const adoraStop: () => Promise<void>;
13
-
14
- export {};
1
+ // Generated declarations for @adora-so/adora-js
2
+ export { adoraStart, adoraStop, adoraIsRunning } from './src/adora-start';
3
+ export { getDom0EventHandlers } from './src/event-holder';
4
+ export type { CustomDom0EventHandler } from './src/lib/custom-events';
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var uo=Object.defineProperty;var fo=(e,t,r)=>t in e?uo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var lt=(e,t,r)=>fo(e,typeof t!="symbol"?t+"":t,r);var ho=/\{[^{}]+\}/g,po=()=>typeof process=="object"&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function mo(){return Math.random().toString(36).slice(2,11)}function Lr(e){let{baseUrl:t="",Request:r=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:o,bodySerializer:s,headers:a,requestInitExt:c=void 0,...i}={...e};c=po()?c:void 0,t=Or(t);let d=[];async function l(u,h){let{baseUrl:p,fetch:m=n,Request:f=r,headers:C,params:w={},parseAs:v="json",querySerializer:g,bodySerializer:A=s??yo,body:M,middleware:S=[],...R}=h||{},I=t;p&&(I=Or(p)??t);let L=typeof o=="function"?o:Nr(o);g&&(L=typeof g=="function"?g:Nr({...typeof o=="object"?o:{},...g}));let U=M===void 0?void 0:A(M,xr(a,C,w.header)),X=xr(U===void 0||U instanceof FormData?{}:{"Content-Type":"application/json"},a,C,w.header),F=[...d,...S],q={redirect:"follow",...i,...R,body:U,headers:X},H,W,E=new f(So(u,{baseUrl:I,params:w,querySerializer:L}),q),T;for(let k in R)k in E||(E[k]=R[k]);if(F.length){H=mo(),W=Object.freeze({baseUrl:I,fetch:m,parseAs:v,querySerializer:L,bodySerializer:A});for(let k of F)if(k&&typeof k=="object"&&typeof k.onRequest=="function"){let D=await k.onRequest({request:E,schemaPath:u,params:w,options:W,id:H});if(D)if(D instanceof f)E=D;else if(D instanceof Response){T=D;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!T){try{T=await m(E,c)}catch(k){let D=k;if(F.length)for(let G=F.length-1;G>=0;G--){let K=F[G];if(K&&typeof K=="object"&&typeof K.onError=="function"){let te=await K.onError({request:E,error:D,schemaPath:u,params:w,options:W,id:H});if(te){if(te instanceof Response){D=void 0,T=te;break}if(te instanceof Error){D=te;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(D)throw D}if(F.length)for(let k=F.length-1;k>=0;k--){let D=F[k];if(D&&typeof D=="object"&&typeof D.onResponse=="function"){let G=await D.onResponse({request:E,response:T,schemaPath:u,params:w,options:W,id:H});if(G){if(!(G instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");T=G}}}}if(T.status===204||E.method==="HEAD"||T.headers.get("Content-Length")==="0")return T.ok?{data:void 0,response:T}:{error:void 0,response:T};if(T.ok)return v==="stream"?{data:T.body,response:T}:{data:await T[v](),response:T};let Z=await T.text();try{Z=JSON.parse(Z)}catch{}return{error:Z,response:T}}return{request(u,h,p){return l(h,{...p,method:u.toUpperCase()})},GET(u,h){return l(u,{...h,method:"GET"})},PUT(u,h){return l(u,{...h,method:"PUT"})},POST(u,h){return l(u,{...h,method:"POST"})},DELETE(u,h){return l(u,{...h,method:"DELETE"})},OPTIONS(u,h){return l(u,{...h,method:"OPTIONS"})},HEAD(u,h){return l(u,{...h,method:"HEAD"})},PATCH(u,h){return l(u,{...h,method:"PATCH"})},TRACE(u,h){return l(u,{...h,method:"TRACE"})},use(...u){for(let h of u)if(h){if(typeof h!="object"||!("onRequest"in h||"onResponse"in h||"onError"in h))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");d.push(h)}},eject(...u){for(let h of u){let p=d.indexOf(h);p!==-1&&d.splice(p,1)}}}}function ct(e,t,r){if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${r?.allowReserved===!0?t:encodeURIComponent(t)}`}function Dr(e,t,r){if(!t||typeof t!="object")return"";let n=[],o={simple:",",label:".",matrix:";"}[r.style]||"&";if(r.style!=="deepObject"&&r.explode===!1){for(let c in t)n.push(c,r.allowReserved===!0?t[c]:encodeURIComponent(t[c]));let a=n.join(",");switch(r.style){case"form":return`${e}=${a}`;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return a}}for(let a in t){let c=r.style==="deepObject"?`${e}[${a}]`:a;n.push(ct(c,t[a],r))}let s=n.join(o);return r.style==="label"||r.style==="matrix"?`${o}${s}`:s}function Pr(e,t,r){if(!Array.isArray(t))return"";if(r.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",a=(r.allowReserved===!0?t:t.map(c=>encodeURIComponent(c))).join(s);switch(r.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return`${e}=${a}`}}let n={simple:",",label:".",matrix:";"}[r.style]||"&",o=[];for(let s of t)r.style==="simple"||r.style==="label"?o.push(r.allowReserved===!0?s:encodeURIComponent(s)):o.push(ct(e,s,r));return r.style==="label"||r.style==="matrix"?`${n}${o.join(n)}`:o.join(n)}function Nr(e){return function(r){let n=[];if(r&&typeof r=="object")for(let o in r){let s=r[o];if(s!=null){if(Array.isArray(s)){if(s.length===0)continue;n.push(Pr(o,s,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof s=="object"){n.push(Dr(o,s,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(ct(o,s,e))}}return n.join("&")}}function go(e,t){let r=e;for(let n of e.match(ho)??[]){let o=n.substring(1,n.length-1),s=!1,a="simple";if(o.endsWith("*")&&(s=!0,o=o.substring(0,o.length-1)),o.startsWith(".")?(a="label",o=o.substring(1)):o.startsWith(";")&&(a="matrix",o=o.substring(1)),!t||t[o]===void 0||t[o]===null)continue;let c=t[o];if(Array.isArray(c)){r=r.replace(n,Pr(o,c,{style:a,explode:s}));continue}if(typeof c=="object"){r=r.replace(n,Dr(o,c,{style:a,explode:s}));continue}if(a==="matrix"){r=r.replace(n,`;${ct(o,c)}`);continue}r=r.replace(n,a==="label"?`.${encodeURIComponent(c)}`:encodeURIComponent(c))}return r}function yo(e,t){return e instanceof FormData?e:t&&(t.get instanceof Function?t.get("Content-Type")??t.get("content-type"):t["Content-Type"]??t["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(e).toString():JSON.stringify(e)}function So(e,t){let r=`${t.baseUrl}${e}`;t.params?.path&&(r=go(r,t.params.path));let n=t.querySerializer(t.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(r+=`?${n}`),r}function xr(...e){let t=new Headers;for(let r of e){if(!r||typeof r!="object")continue;let n=r instanceof Headers?r.entries():Object.entries(r);for(let[o,s]of n)if(s===null)t.delete(o);else if(Array.isArray(s))for(let a of s)t.append(o,a);else s!==void 0&&t.set(o,s)}return t}function Or(e){return e.endsWith("/")?e.substring(0,e.length-1):e}var Fr="https://c.adora-cdn.com";var ye=class{constructor(t){lt(this,"backendClient");lt(this,"eventPostBackendClient");this.backendClient=Bt({baseUrl:t??Fr})}getOrCreateEventPostClient(t){return!t.eventPostUrl||!t.eventPostToken?{path:t.sessionId,client:this.backendClient}:(this.eventPostBackendClient||(this.eventPostBackendClient=Bt({baseUrl:t.eventPostUrl})),{path:t.sessionId,client:this.eventPostBackendClient})}async sessionPreload({orgId:t}){return this.backendClient.POST("/sessions/preload",{body:{orgId:t},mode:"cors"}).catch(()=>{})}async startSession({bypassSampling:t,orgId:r,language:n,domain:o,userCohorts:s,uid:a,devicePixelRatio:c,adoraUserId:i,userAgent:d,documentReferrer:l,snippetVersion:u}){return this.backendClient.POST("/sessions/start",{body:{bypassSampling:t,orgId:r,language:n,domain:o,devicePixelRatio:c,userCohorts:s||{},userAgent:d,uid:typeof a=="number"?a.toString():a!=="null"&&a!=="undefined"?a:void 0,adoraUserId:i,documentReferrer:l,snippetVersion:u},mode:"cors"}).catch(()=>{})}async gzipWithCompressionStream(t){let r=JSON.stringify(t),o=new TextEncoder().encode(r),s=new CompressionStream("gzip"),c=new ReadableStream({start(d){d.enqueue(o),d.close()}}).pipeThrough(s);return new Response(c).arrayBuffer()}async saveSessionEvents({sessionId:t,events:r,metadata:n,eventPostUrl:o,eventPostToken:s,fastpathToken:a}){let{path:c,client:i}=this.getOrCreateEventPostClient({sessionId:t,eventPostToken:s,eventPostUrl:o}),d={events:r.slice(),metadata:n,fastpathToken:a},l={params:{path:{sessionId:c}},headers:s?{token:s}:void 0};if(typeof CompressionStream<"u"){let u=await this.gzipWithCompressionStream(d);return i.POSTGzipped("/sessions/{sessionId}/events",{...l,body:u}).catch(()=>{})}return i.POST("/sessions/{sessionId}/events",{...l,body:d}).catch(()=>{})}async refreshEventToken(t){return await this.backendClient.POST("/sessions/{sessionId}/events/token",{params:{path:{sessionId:t.sessionId}},body:{},mode:"cors"}).catch(()=>{})}async syncSession(t){return await this.backendClient.POST("/sessions/{sessionId}/sync",{params:{path:{sessionId:t.sessionId}}}).catch(()=>{})}};var re=(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))(re||{}),Ae=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Ae||{}),Ht=(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))(Ht||{});var vo="Adora.URLChange",zr="Adora.Cohort",bo="Adora.AddCohort",Co="Adora.Click";var Gt=["onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onchange","onfocus","onblur","onscroll","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onload","onunload"];function Ur({dom0EventHandlers:e,delay:t,timestamp:r}){return{type:re.Custom,data:{tag:Co,payload:{dom0EventHandlers:e}},delay:t,timestamp:r}}function Ye({payload:e,delay:t,timestamp:r}){return{type:re.Custom,data:{tag:bo,payload:e},delay:t,timestamp:r}}function Wr({href:e,delay:t,timestamp:r}){return{type:re.Custom,data:{tag:vo,payload:{href:e}},delay:t,timestamp:r}}function ke(e){throw new Error(`This code path should be unreachable: ${e}`)}import{makeRe as wo,minimatch as Io}from"minimatch";function Ro(e){return e.endsWith("$")&&(e=e.substring(0,e.length-1)),(e.endsWith("+?")||e.endsWith("*?"))&&(e=e.substring(0,e.length-1)),e}function Le(e,t){let r=t.replace||t.path;switch(t.type){case"regexp":{let n=(t.path.startsWith("^")?"":"^")+t.path+(!t.path.endsWith("$")&&!t.partial?"$":""),o=new RegExp(n);return o.test(e)?t.partial?e.replace(o,r):r:void 0}case"wildcard":case void 0:if(t.partial){let n=wo(t.path,{partial:t.partial,dot:!0});if(!n)throw new Error("unable to make regexp");let o=new RegExp(Ro(n.source));return o.test(e)?e.replace(o,r):void 0}return Io(e,t.path,{dot:!0})?r:void 0;default:ke(t.type)}}var Bt=e=>({...Lr(e),POSTGzipped:async(r,n)=>{if(!n?.body)throw new Error("Body is required for gzipped requests");let o={...n.headers,"Content-Type":"application/json","Content-Encoding":"gzip"},s=r;n.params?.path&&Object.entries(n.params.path).forEach(([i,d])=>{s=s.replace(`{${i}}`,d)});let a=await fetch(`${e.baseUrl}${s}`,{method:"POST",headers:o,body:n.body});if(!a.ok){let i=await a.text();try{i=JSON.parse(i)}catch{}return{data:void 0,error:i,response:a}}return{data:await a.json(),error:void 0,response:a}}});import{strictDeepEqual as _i}from"fast-equals";import zt from"js-cookie";import{uuidv7 as Ni}from"uuidv7";var dt=class{constructor(t,r){this.storage=r;this.eventStorageKey=t==="adoraSessionScript"?"adoraEventsScript":"adoraEventsExtension"}getEvents(){let t=this.storage.getItem(this.eventStorageKey);return t?JSON.parse(t):null}setEvents(t){this.storage.setItem(this.eventStorageKey,JSON.stringify(t))}removeEvents(){this.storage.removeItem(this.eventStorageKey)}};function Vt(e){return`${e}-rate-limit-timestamp`}var we=class{constructor(t,r){this.sessionType=t;this.storage=r}get lastRateLimitedTimestamp(){let t=this.storage.getItem(Vt(this.sessionType));if(Eo(t))return t}clearLastRateLimitedTimestamp(){this.storage.removeItem(Vt(this.sessionType))}setLastRateLimitedTimestamp(t){this.storage.setItem(Vt(this.sessionType),t.toString())}getSession(){let t=this.storage.getItem(this.sessionType);return t?JSON.parse(t):null}setSession(t){this.storage.setItem(this.sessionType,JSON.stringify(t))}removeSession(){this.storage.removeItem(this.sessionType)}};function Eo(e){return!Number.isNaN(Number(e))}function b(e,...t){(typeof window=="object"&&window.enableAdoraDebugLogs||typeof window=="object"&&window.localStorage.getItem("enableAdoraDebugLogs"))&&console.log(e,...t)}function Br(e){return{id:e.id,pathConfig:e.pathConfig,allowedQueryParams:e.allowedQueryParams,cookieDomains:e.cookieDomains,cohortsBootstrapConfig:e.cohortsBootstrapConfig||{},customQueryParamsCohorts:e.customQueryParamsCohorts,blockedCSSClasses:e.blockedCSSClasses||[],maskedCSSClasses:e.maskedCSSClasses,maskByDefault:e.maskByDefault??!1,unmaskSelectors:e.unmaskSelectors||[]}}function Ao(e){return{id:e.id,compressionType:e.compressionType||"NONE",canvasRecordingEnabled:e.canvasRecordingEnabled,limitedCanvasRecording:e.limitedCanvasRecording}}function Hr(e){return"scheduledDowntime"in e?{scheduledDowntime:!0}:{organization:Br(e.organization)}}function ut(e){return{session:Ao(e.session),organization:Br(e.organization),eventPostUrl:e.eventPostUrl,eventPostToken:e.eventPostToken}}function Gr(e,t,r,n){return{id:e.session.id,compressionType:e.session.compressionType,organization:e.organization,settings:t,canvasRecordingEnabled:e.session.canvasRecordingEnabled,limitedCanvasRecording:e.session.limitedCanvasRecording,eventPostUrl:e.eventPostUrl,eventPostToken:e.eventPostToken,adoraUserId:r,documentReferrer:n}}function Vr(e,t){return{id:t.session.id,compressionType:t.session.compressionType,organization:t.organization,settings:e.settings,canvasRecordingEnabled:t.session.canvasRecordingEnabled,limitedCanvasRecording:t.session.limitedCanvasRecording,eventPostUrl:t.eventPostUrl,eventPostToken:t.eventPostToken,adoraUserId:e.adoraUserId,documentReferrer:e.documentReferrer}}var Se=class{getItem(t){if(!jt())return null;try{return window.sessionStorage.getItem(t)}catch{return null}}setItem(t,r){if(!jt())return null;try{return window.sessionStorage.setItem(t,r)}catch{return null}}removeItem(t){if(!jt())return null;try{return window.sessionStorage.removeItem(t)}catch{return null}}};function jt(){return typeof window.sessionStorage=="object"}var ft="v0.0.6";var jr=async(e,t,r)=>{let n=new we(e,new Se),o=new ye(r.backendUrl),s=await ko(o,r,t);return s.type==="success"&&n.setSession(s.storedSession),s};async function ko(e,t,r){try{b("starting session over network",{uid:t.uid,userCohorts:t.userCohorts||{}});let n=await e.startSession({bypassSampling:t.bypassSampling,orgId:t.orgId,language:t.language||navigator.language,domain:new URL(window.location.href).hostname,userCohorts:t.userCohorts||{},uid:t.uid,devicePixelRatio:window.devicePixelRatio,adoraUserId:r,documentReferrer:document.referrer,snippetVersion:ft});if(!n)return{type:"error",code:void 0};if(n.error)return{type:"error",code:n.error.code};if(n.response.status!==201)return b("session not created, aborting"),{type:"error",code:"code"in n.data?n.data.code:void 0};if(n.data&&"scheduledDowntime"in n.data)return b("scheduled downtime, exiting"),{type:"error",code:void 0};if(!n.data||!("session"in n.data))return b("malformed session, exiting"),{type:"error",code:void 0};let o=ut(n.data);return{type:"success",storedSession:Gr(o,t,r,n.data.session.documentReferrer)}}catch{return{type:"error",code:void 0}}}import*as Ve from"web-vitals";var $r="__STATSIG__",To="statsig@@",Yr=e=>{try{if(!e[$r])return;let t=e[$r];if(!_o(t))return;let r={};return Object.values(t.instances).forEach(n=>{n._logger?._lastExposureTimeMap&&Object.keys(n._logger?._lastExposureTimeMap).forEach(o=>{let s=Mo(o);if(!s)return;let a=n.getExperiment(s);Oo(a)&&(r[To+a.name]=a.groupName)})}),r}catch{return}},Mo=e=>{let t=e.split("|");if(t.length>3)return t[3]};function _o(e){if(!e||typeof e!="object"||!("instances"in e)||typeof e.instances!="object"||!e.instances)return!1;let t=Object.values(e.instances);for(let r of t)if(!No(r))return!1;return!0}function No(e){return!e||typeof e!="object"?!1:"_logger"in e&&typeof e._logger=="object"&&xo(e._logger)&&"_sdkKey"in e&&typeof e._sdkKey=="string"&&"getExperiment"in e&&typeof e.getExperiment=="function"}function xo(e){return!e||typeof e!="object"?!1:"_lastExposureTimeMap"in e&&typeof e._lastExposureTimeMap=="object"}function Oo(e){return!e||typeof e!="object"?!1:"name"in e&&typeof e.name=="string"&&"groupName"in e&&typeof e.groupName=="string"}function ht(e,t){if(!t.windowGetters)return;let r={};if(t.windowGetters.forEach(({key:n,paths:o})=>{let s=Lo(e,o);s&&(r[n]=s)}),Object.keys(r).length!==0)return r}function Lo(e,t){if(typeof e>"u")return;let r=e;for(let o=0;o<t.length-1;o++)if(r=r[t[o]],typeof r!="object")return;let n=r[t[t.length-1]];if(typeof n=="string")return n;if(typeof n=="boolean"||typeof n=="number")return n.toString()}function $t(e){return Yr(e)}var Do=Object.defineProperty,Po=(e,t,r)=>t in e?Do(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>Po(e,typeof t!="symbol"?t+"":t,r),Zr,Fo=Object.defineProperty,zo=(e,t,r)=>t in e?Fo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Kr=(e,t,r)=>zo(e,typeof t!="symbol"?t+"":t,r),J=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(J||{}),Jr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Xr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pt={};function hr(e){if(pt[e])return pt[e];let t=globalThis[e],r=t.prototype,n=e in Jr?Jr[e]:void 0,o=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),s=e in Xr?Xr[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(o&&a)return pt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let d=i[e].prototype;return document.body.removeChild(c),d?pt[e]=d:r}catch{return r}}var Yt={};function Re(e,t,r){var n;let o=`${e}.${String(r)}`;if(Yt[o])return Yt[o].call(t);let s=hr(e),a=(n=Object.getOwnPropertyDescriptor(s,r))==null?void 0:n.get;return a?(Yt[o]=a,a.call(t)):t[r]}var Zt={};function mn(e,t,r){let n=`${e}.${String(r)}`;if(Zt[n])return Zt[n].bind(t);let s=hr(e)[r];return typeof s!="function"?t[r]:(Zt[n]=s,s.bind(t))}function Uo(e){return Re("Node",e,"childNodes")}function Wo(e){return Re("Node",e,"parentNode")}function Bo(e){return Re("Node",e,"parentElement")}function Ho(e){return Re("Node",e,"textContent")}function Go(e,t){return mn("Node",e,"contains")(t)}function Vo(e){return mn("Node",e,"getRootNode")()}function jo(e){return!e||!("host"in e)?null:Re("ShadowRoot",e,"host")}function $o(e){return e.styleSheets}function Yo(e){return!e||!("shadowRoot"in e)?null:Re("Element",e,"shadowRoot")}function Zo(e,t){return Re("Element",e,"querySelector")(t)}function Ko(e,t){return Re("Element",e,"querySelectorAll")(t)}function Jo(){return hr("MutationObserver").constructor}var ee={childNodes:Uo,parentNode:Wo,parentElement:Bo,textContent:Ho,contains:Go,getRootNode:Vo,host:jo,styleSheets:$o,shadowRoot:Yo,querySelector:Zo,querySelectorAll:Ko,mutationObserver:Jo};function gn(e){return e.nodeType===e.ELEMENT_NODE}function Ke(e){let t=e&&"host"in e&&"mode"in e&&ee.host(e)||null;return!!(t&&"shadowRoot"in t&&ee.shadowRoot(t)===e)}function Je(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xo(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function qo(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function er(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);let n=Array.from(t,o=>yn(o,r)).join("");return Xo(n)}catch{return null}}function yn(e,t){if(es(e)){let r;try{r=er(e.styleSheet)||qo(e)}catch{r=e.cssText}return e.styleSheet.href?wt(r,e.styleSheet.href):r}else{let r=e.cssText;return ts(e)&&e.selectorText.includes(":")&&(r=Qo(r)),t?wt(r,t):r}}function Qo(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function es(e){return"styleSheet"in e}function ts(e){return"selectorText"in e}var bt=class{constructor(){Kr(this,"idNodeMap",new Map),Kr(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function rs(){return new bt}function Ct({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:s}){let a=o||"",c=n&&Me(n);return(t[r.toLowerCase()]||c&&t[c])&&(s?a=s(a,e):a="*".repeat(a.length)),a}function Me(e){return e.toLowerCase()}var qr="__rrweb_original__";function ns(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let s=t.getImageData,a=qr in s?s[qr]:s;if(new Uint32Array(a.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(i=>i!==0))return!1}return!0}function pr(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Me(t):null}function Sn(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,o=r.pathname.match(n);return o?.[1]??null}function os(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ss=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,is=/^(?:[a-z+]+:)?\/\//i,as=/^www\..*/i,ls=/^(data:)([^,]*),(.*)/i;function wt(e,t){return(e||"").replace(ss,(r,n,o,s,a,c)=>{let i=o||a||c,d=n||s||"";if(!i)return r;if(is.test(i)||as.test(i))return`url(${d}${i}${d})`;if(ls.test(i))return`url(${d}${i}${d})`;if(i[0]==="/")return`url(${d}${os(t)+i}${d})`;let l=t.split("/"),u=i.split("/");l.pop();for(let h of u)h!=="."&&(h===".."?l.pop():l.push(h));return`url(${d}${l.join("/")}${d})`})}function Kt(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function cs(e,t){let r=Array.from(t.childNodes),n=[];if(r.length>1&&e&&typeof e=="string"){let o=Kt(e);for(let s=1;s<r.length;s++)if(r[s].textContent&&typeof r[s].textContent=="string"){let a=Kt(r[s].textContent);for(let c=3;c<a.length;c++){let i=a.substring(0,c);if(o.split(i).length===2){let d=o.indexOf(i);for(let l=d;l<e.length;l++)if(Kt(e.substring(0,l)).length===d){n.push(e.substring(0,l)),e=e.substring(l);break}break}}}}return n.push(e),n}function ds(e,t){return cs(e,t).join("/* rr_split */")}var us=1,fs=new RegExp("[^a-z0-9-_:]"),qe=-2;function vn(){return us++}function hs(e){if(e instanceof HTMLFormElement)return"form";let t=Me(e.tagName);return fs.test(t)?"div":t}var De,Qr,ps=/^[^ \t\n\r\u000c]+/,ms=/^[, \t\n\r\u000c]+/;function gs(e,t){if(t.trim()==="")return t;let r=0;function n(s){let a,c=s.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let o=[];for(;n(ms),!(r>=t.length);){let s=n(ps);if(s.slice(-1)===",")s=ze(e,s.substring(0,s.length-1)),o.push(s);else{let a="";s=ze(e,s);let c=!1;for(;;){let i=t.charAt(r);if(i===""){o.push((s+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,o.push((s+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return o.join(", ")}var en=new WeakMap;function ze(e,t){return!t||t.trim()===""?t:mr(e,t)}function ys(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function mr(e,t){let r=en.get(e);if(r||(r=e.createElement("a"),en.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function bn(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?ze(e,n):r==="srcset"?gs(e,n):r==="style"?wt(n,mr(e)):t==="object"&&r==="data"?ze(e,n):n)}function Cn(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function Ss(e,t,r,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let o=e.classList.length;o--;){let s=e.classList[o];if(t.test(s))return!0}if(r)return e.matches(r);if(n&&e.tagName==="IMG"){let o=e.getAttribute("src");if(o&&n.test(o))return!0}}catch{}return!1}function It(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?It(ee.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?It(ee.parentNode(e),t,r):!1}function wn(e,t,r,n){let o;if(gn(e)){if(o=e,!ee.childNodes(o).length)return!1}else{if(ee.parentElement(e)===null)return!1;o=ee.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(It(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}if(o.getAttribute("contenteditable")||o.closest('[contenteditable="true"]'))return!0}catch{}return!1}function vs(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,s;try{s=n.document.readyState}catch{return}if(s!=="complete"){let c=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),o=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function bs(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let s=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),n=!0,t()})}function Cs(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:d,maskInputFn:l,maskAnchorHrefFn:u,blockImgSrcPattern:h,blockImgSrcFillOptions:p,dataURLOptions:m={},inlineImages:f,recordCanvas:C,keepIframeSrcFn:w,newlyAddedElement:v=!1,cssCaptured:g=!1}=t,A=ws(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:J.Document,childNodes:[],compatMode:e.compatMode}:{type:J.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:J.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:A};case e.ELEMENT_NODE:return Rs(e,{doc:r,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:i,maskInputFn:l,maskAnchorHrefFn:u,blockImgSrcPattern:h,blockImgSrcFillOptions:p,dataURLOptions:m,inlineImages:f,recordCanvas:C,keepIframeSrcFn:w,newlyAddedElement:v,rootId:A});case e.TEXT_NODE:return Is(e,{doc:r,needsMask:a,maskTextFn:d,rootId:A,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:J.CDATA,textContent:"",rootId:A};case e.COMMENT_NODE:return{type:J.Comment,textContent:ee.textContent(e)||"",rootId:A};default:return!1}}function ws(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Is(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:s}=t,a=ee.parentNode(e),c=a&&a.tagName,i="",d=c==="STYLE"?!0:void 0,l=c==="SCRIPT"?!0:void 0;return l?i="SCRIPT_PLACEHOLDER":s||(i=ee.textContent(e),d&&i&&(i=wt(i,mr(t.doc)))),!d&&!l&&i&&r&&(i=n?n(i,ee.parentElement(e)):i.replace(/[\S]/g,"*")),{type:J.Text,textContent:i||"",rootId:o}}function Rs(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:c,maskAnchorHrefFn:i,blockImgSrcPattern:d,blockImgSrcFillOptions:l,dataURLOptions:u={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:f=!1,rootId:C}=t,w=Ss(e,n,o,d),v=hs(e),g={},A=e.attributes.length;for(let S=0;S<A;S++){let R=e.attributes[S];Cn(v,R.name,R.value)||(g[R.name]=bn(r,v,Me(R.name),R.value))}if(v==="a"&&i&&typeof g.href=="string"&&(g.href=i(g.href,e)),v==="link"&&s){let S=Array.from(r.styleSheets).find(I=>I.href===e.href);if(!S&&e.href.includes(".css")){let I=window.location.origin,L=e.href.replace(window.location.href,""),U=I+"/"+L;S=Array.from(r.styleSheets).find(X=>X.href===U)}let R=null;S&&(R=er(S)),R&&(delete g.rel,delete g.href,g._cssText=R)}if(v==="style"&&e.sheet){let S=er(e.sheet);S&&(e.childNodes.length>1&&(S=ds(S,e)),g._cssText=S)}if(v==="input"||v==="textarea"||v==="select"){let S=e.value,R=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&S?g.value=Ct({element:e,type:pr(e),tagName:v,value:S,maskInputOptions:a,maskInputFn:c}):R&&(g.checked=R)}if(v==="option"&&(e.selected&&!a.select?g.selected=!0:delete g.selected),v==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),v==="canvas"&&p){if(e.__context==="2d")ns(e)||(g.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){let S=e.toDataURL(u.type,u.quality),R=r.createElement("canvas");R.width=e.width,R.height=e.height;let I=R.toDataURL(u.type,u.quality);S!==I&&(g.rr_dataURL=S)}}if(v==="img"&&h){De||(De=r.createElement("canvas"),Qr=De.getContext("2d"));let S=e,R=S.currentSrc||S.getAttribute("src")||"<unknown-src>",I=S.crossOrigin,L=()=>{S.removeEventListener("load",L);try{De.width=S.naturalWidth,De.height=S.naturalHeight,Qr.drawImage(S,0,0),g.rr_dataURL=De.toDataURL(u.type,u.quality)}catch(U){if(S.crossOrigin!=="anonymous"){S.crossOrigin="anonymous",S.complete&&S.naturalWidth!==0?L():S.addEventListener("load",L);return}else console.warn(`Cannot inline img src=${R}! Error: ${U}`)}S.crossOrigin==="anonymous"&&(I?g.crossOrigin=I:S.removeAttribute("crossorigin"))};S.complete&&S.naturalWidth!==0?L():S.addEventListener("load",L)}if(v==="audio"||v==="video"){let S=g;S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime,S.rr_mediaPlaybackRate=e.playbackRate,S.rr_mediaMuted=e.muted,S.rr_mediaLoop=e.loop,S.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),w){let{width:S,height:R}=e.getBoundingClientRect();g={class:g.class,rr_width:`${S}px`,rr_height:`${R}px`}}w&&v==="img"&&(g={...g,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP89v3nfwAJuAPnyTr4jAAAAABJRU5ErkJggg==",rr_fill:l.backgroundColor,rr_stroke:l.strokeColor,rr_stroke_width:l.strokeWidth}),v==="iframe"&&!m(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let M;try{customElements.get(v)&&(M=!0)}catch{}return{type:J.Element,tagName:v,attributes:g,childNodes:[],isSVG:ys(e)||void 0,needBlock:w,rootId:C,isCustom:M}}function V(e){return e==null?"":e.toLowerCase()}function Es(e,t){if(t.comment&&e.type===J.Comment)return!0;if(e.type===J.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Sn(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(V(e.attributes.name).match(/^msapplication-tile(image|color)$/)||V(e.attributes.name)==="application-name"||V(e.attributes.rel)==="icon"||V(e.attributes.rel)==="apple-touch-icon"||V(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&V(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(V(e.attributes.property).match(/^(og|twitter|fb):/)||V(e.attributes.name).match(/^(og|twitter):/)||V(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(V(e.attributes.name)==="robots"||V(e.attributes.name)==="googlebot"||V(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(V(e.attributes.name)==="author"||V(e.attributes.name)==="generator"||V(e.attributes.name)==="framework"||V(e.attributes.name)==="publisher"||V(e.attributes.name)==="progid"||V(e.attributes.property).match(/^article:/)||V(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(V(e.attributes.name)==="google-site-verification"||V(e.attributes.name)==="yandex-verification"||V(e.attributes.name)==="csrf-token"||V(e.attributes.name)==="p:domain_verify"||V(e.attributes.name)==="verify-v1"||V(e.attributes.name)==="verification"||V(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ue(e,t){if(e.nodeName.toLowerCase().includes("grammarly"))return null;let{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:d=!0,maskInputOptions:l={},maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:f,slimDOMOptions:C,dataURLOptions:w={},inlineImages:v=!1,recordCanvas:g=!1,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:S=5e3,onStylesheetLoad:R,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:L=()=>!1,newlyAddedElement:U=!1,cssCaptured:X=!1}=t,{needsMask:F}=t,{preserveWhiteSpace:q=!0}=t;F||(F=wn(e,a,c,F===void 0));let H=Cs(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:F,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:f,dataURLOptions:w,inlineImages:v,recordCanvas:g,keepIframeSrcFn:L,newlyAddedElement:U,cssCaptured:X});if(!H)return console.warn(e,"not serialized"),null;let W;n.hasNode(e)?W=n.getId(e):Es(H,C)||!q&&H.type===J.Text&&!H.textContent.replace(/^\s+|\s+$/gm,"").length?W=qe:W=vn();let E=Object.assign(H,{id:W});if(n.add(e,E),W===qe)return null;A&&A(e);let T=!i;if(E.type===J.Element){T=T&&!E.needBlock,delete E.needBlock;let k=ee.shadowRoot(e);k&&Je(k)&&(E.isShadowHost=!0)}if((E.type===J.Document||E.type===J.Element)&&T){C.headWhitespace&&E.type===J.Element&&E.tagName==="head"&&(q=!1);let k={doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:F,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:f,slimDOMOptions:C,dataURLOptions:w,inlineImages:v,recordCanvas:g,preserveWhiteSpace:q,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:S,onStylesheetLoad:R,stylesheetLoadTimeout:I,keepIframeSrcFn:L,cssCaptured:!1};if(!(E.type===J.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===J.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(k.cssCaptured=!0);for(let G of Array.from(ee.childNodes(e))){let K=Ue(G,k);K&&E.childNodes.push(K)}}let D=null;if(gn(e)&&(D=ee.shadowRoot(e)))for(let G of Array.from(ee.childNodes(D))){let K=Ue(G,k);K&&(Je(D)&&(K.isShadow=!0),E.childNodes.push(K))}}let Z=ee.parentNode(e);return Z&&Ke(Z)&&Je(Z)&&(E.isShadow=!0),E.type===J.Element&&E.tagName==="iframe"&&vs(e,()=>{let k=e.contentDocument;if(k&&M){let D=Ue(k,{doc:k,mirror:n,blockClass:o,blockSelector:s,needsMask:F,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:f,slimDOMOptions:C,dataURLOptions:w,inlineImages:v,recordCanvas:g,preserveWhiteSpace:q,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:S,onStylesheetLoad:R,stylesheetLoadTimeout:I,keepIframeSrcFn:L});D&&M(e,D)}},S),E.type===J.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&Sn(E.attributes.href)==="css")&&bs(e,()=>{if(R){let k=Ue(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:F,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:f,slimDOMOptions:C,dataURLOptions:w,inlineImages:v,recordCanvas:g,preserveWhiteSpace:q,onSerialize:A,onIframeLoad:M,iframeLoadTimeout:S,onStylesheetLoad:R,stylesheetLoadTimeout:I,keepIframeSrcFn:L});k&&R(e,k)}},I),E}function As(e,t){let{mirror:r=new bt,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:d=!1,maskAllInputs:l=!1,maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m=null,blockImgSrcFillOptions:f={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},slimDOM:C=!1,dataURLOptions:w,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:S,stylesheetLoadTimeout:R,keepIframeSrcFn:I=()=>!1}=t||{};return Ue(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:l===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:l===!1?{password:!0}:l,maskTextFn:u,maskInputFn:h,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:f,slimDOMOptions:C===!0||C==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:C==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:C===!1?{}:C,dataURLOptions:w,inlineImages:i,recordCanvas:d,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:S,stylesheetLoadTimeout:R,keepIframeSrcFn:I,newlyAddedElement:!1})}var tr=class e{constructor(...t){__publicField2(this,"parentElement",null),__publicField2(this,"parentNode",null),__publicField2(this,"ownerDocument"),__publicField2(this,"firstChild",null),__publicField2(this,"lastChild",null),__publicField2(this,"previousSibling",null),__publicField2(this,"nextSibling",null),__publicField2(this,"ELEMENT_NODE",1),__publicField2(this,"TEXT_NODE",3),__publicField2(this,"nodeType"),__publicField2(this,"nodeName"),__publicField2(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}},tn={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},rn={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},mt={};function gr(e){if(mt[e])return mt[e];let t=globalThis[e],r=t.prototype,n=e in tn?tn[e]:void 0,o=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),s=e in rn?rn[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(o&&a)return mt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let d=i[e].prototype;return document.body.removeChild(c),d?mt[e]=d:r}catch{return r}}var Jt={};function Ee(e,t,r){var n;let o=`${e}.${String(r)}`;if(Jt[o])return Jt[o].call(t);let s=gr(e),a=(n=Object.getOwnPropertyDescriptor(s,r))==null?void 0:n.get;return a?(Jt[o]=a,a.call(t)):t[r]}var Xt={};function In(e,t,r){let n=`${e}.${String(r)}`;if(Xt[n])return Xt[n].bind(t);let s=gr(e)[r];return typeof s!="function"?t[r]:(Xt[n]=s,s.bind(t))}function ks(e){return Ee("Node",e,"childNodes")}function Ts(e){return Ee("Node",e,"parentNode")}function Ms(e){return Ee("Node",e,"parentElement")}function _s(e){return Ee("Node",e,"textContent")}function Ns(e,t){return In("Node",e,"contains")(t)}function xs(e){return In("Node",e,"getRootNode")()}function Os(e){return!e||!("host"in e)?null:Ee("ShadowRoot",e,"host")}function Ls(e){return e.styleSheets}function Ds(e){return!e||!("shadowRoot"in e)?null:Ee("Element",e,"shadowRoot")}function Ps(e,t){return Ee("Element",e,"querySelector")(t)}function Fs(e,t){return Ee("Element",e,"querySelectorAll")(t)}function Rn(){return gr("MutationObserver").constructor}var _={childNodes:ks,parentNode:Ts,parentElement:Ms,textContent:_s,contains:Ns,getRootNode:xs,host:Os,styleSheets:Ls,shadowRoot:Ds,querySelector:Ps,querySelectorAll:Fs,mutationObserver:Rn};function ne(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Pe=`Please stop import mirror directly. Instead of that,\r
1
+ var ho=Object.defineProperty;var fo=(e,t,r)=>t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var lt=(e,t,r)=>fo(e,typeof t!="symbol"?t+"":t,r);var po=/\{[^{}]+\}/g,mo=()=>typeof process=="object"&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici;function go(){return Math.random().toString(36).slice(2,11)}function Or(e){let{baseUrl:t="",Request:r=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:o,bodySerializer:s,headers:a,requestInitExt:c=void 0,...i}={...e};c=mo()?c:void 0,t=xr(t);let d=[];async function l(u,f){let{baseUrl:p,fetch:m=n,Request:h=r,headers:C,params:w={},parseAs:S="json",querySerializer:g,bodySerializer:T=s??vo,body:_,middleware:v=[],...R}=f||{},I=t;p&&(I=xr(p)??t);let L=typeof o=="function"?o:Mr(o);g&&(L=typeof g=="function"?g:Mr({...typeof o=="object"?o:{},...g}));let z=_===void 0?void 0:T(_,Nr(a,C,w.header)),J=Nr(z===void 0||z instanceof FormData?{}:{"Content-Type":"application/json"},a,C,w.header),F=[...d,...v],q={redirect:"follow",...i,...R,body:z,headers:J},H,W,E=new h(So(u,{baseUrl:I,params:w,querySerializer:L}),q),k;for(let A in R)A in E||(E[A]=R[A]);if(F.length){H=go(),W=Object.freeze({baseUrl:I,fetch:m,parseAs:S,querySerializer:L,bodySerializer:T});for(let A of F)if(A&&typeof A=="object"&&typeof A.onRequest=="function"){let D=await A.onRequest({request:E,schemaPath:u,params:w,options:W,id:H});if(D)if(D instanceof h)E=D;else if(D instanceof Response){k=D;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!k){try{k=await m(E,c)}catch(A){let D=A;if(F.length)for(let G=F.length-1;G>=0;G--){let K=F[G];if(K&&typeof K=="object"&&typeof K.onError=="function"){let te=await K.onError({request:E,error:D,schemaPath:u,params:w,options:W,id:H});if(te){if(te instanceof Response){D=void 0,k=te;break}if(te instanceof Error){D=te;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(D)throw D}if(F.length)for(let A=F.length-1;A>=0;A--){let D=F[A];if(D&&typeof D=="object"&&typeof D.onResponse=="function"){let G=await D.onResponse({request:E,response:k,schemaPath:u,params:w,options:W,id:H});if(G){if(!(G instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");k=G}}}}if(k.status===204||E.method==="HEAD"||k.headers.get("Content-Length")==="0")return k.ok?{data:void 0,response:k}:{error:void 0,response:k};if(k.ok)return S==="stream"?{data:k.body,response:k}:{data:await k[S](),response:k};let Z=await k.text();try{Z=JSON.parse(Z)}catch{}return{error:Z,response:k}}return{request(u,f,p){return l(f,{...p,method:u.toUpperCase()})},GET(u,f){return l(u,{...f,method:"GET"})},PUT(u,f){return l(u,{...f,method:"PUT"})},POST(u,f){return l(u,{...f,method:"POST"})},DELETE(u,f){return l(u,{...f,method:"DELETE"})},OPTIONS(u,f){return l(u,{...f,method:"OPTIONS"})},HEAD(u,f){return l(u,{...f,method:"HEAD"})},PATCH(u,f){return l(u,{...f,method:"PATCH"})},TRACE(u,f){return l(u,{...f,method:"TRACE"})},use(...u){for(let f of u)if(f){if(typeof f!="object"||!("onRequest"in f||"onResponse"in f||"onError"in f))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");d.push(f)}},eject(...u){for(let f of u){let p=d.indexOf(f);p!==-1&&d.splice(p,1)}}}}function ct(e,t,r){if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${r?.allowReserved===!0?t:encodeURIComponent(t)}`}function Lr(e,t,r){if(!t||typeof t!="object")return"";let n=[],o={simple:",",label:".",matrix:";"}[r.style]||"&";if(r.style!=="deepObject"&&r.explode===!1){for(let c in t)n.push(c,r.allowReserved===!0?t[c]:encodeURIComponent(t[c]));let a=n.join(",");switch(r.style){case"form":return`${e}=${a}`;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return a}}for(let a in t){let c=r.style==="deepObject"?`${e}[${a}]`:a;n.push(ct(c,t[a],r))}let s=n.join(o);return r.style==="label"||r.style==="matrix"?`${o}${s}`:s}function Dr(e,t,r){if(!Array.isArray(t))return"";if(r.explode===!1){let s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[r.style]||",",a=(r.allowReserved===!0?t:t.map(c=>encodeURIComponent(c))).join(s);switch(r.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return`${e}=${a}`}}let n={simple:",",label:".",matrix:";"}[r.style]||"&",o=[];for(let s of t)r.style==="simple"||r.style==="label"?o.push(r.allowReserved===!0?s:encodeURIComponent(s)):o.push(ct(e,s,r));return r.style==="label"||r.style==="matrix"?`${n}${o.join(n)}`:o.join(n)}function Mr(e){return function(r){let n=[];if(r&&typeof r=="object")for(let o in r){let s=r[o];if(s!=null){if(Array.isArray(s)){if(s.length===0)continue;n.push(Dr(o,s,{style:"form",explode:!0,...e?.array,allowReserved:e?.allowReserved||!1}));continue}if(typeof s=="object"){n.push(Lr(o,s,{style:"deepObject",explode:!0,...e?.object,allowReserved:e?.allowReserved||!1}));continue}n.push(ct(o,s,e))}}return n.join("&")}}function yo(e,t){let r=e;for(let n of e.match(po)??[]){let o=n.substring(1,n.length-1),s=!1,a="simple";if(o.endsWith("*")&&(s=!0,o=o.substring(0,o.length-1)),o.startsWith(".")?(a="label",o=o.substring(1)):o.startsWith(";")&&(a="matrix",o=o.substring(1)),!t||t[o]===void 0||t[o]===null)continue;let c=t[o];if(Array.isArray(c)){r=r.replace(n,Dr(o,c,{style:a,explode:s}));continue}if(typeof c=="object"){r=r.replace(n,Lr(o,c,{style:a,explode:s}));continue}if(a==="matrix"){r=r.replace(n,`;${ct(o,c)}`);continue}r=r.replace(n,a==="label"?`.${encodeURIComponent(c)}`:encodeURIComponent(c))}return r}function vo(e,t){return e instanceof FormData?e:t&&(t.get instanceof Function?t.get("Content-Type")??t.get("content-type"):t["Content-Type"]??t["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(e).toString():JSON.stringify(e)}function So(e,t){let r=`${t.baseUrl}${e}`;t.params?.path&&(r=yo(r,t.params.path));let n=t.querySerializer(t.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(r+=`?${n}`),r}function Nr(...e){let t=new Headers;for(let r of e){if(!r||typeof r!="object")continue;let n=r instanceof Headers?r.entries():Object.entries(r);for(let[o,s]of n)if(s===null)t.delete(o);else if(Array.isArray(s))for(let a of s)t.append(o,a);else s!==void 0&&t.set(o,s)}return t}function xr(e){return e.endsWith("/")?e.substring(0,e.length-1):e}var Pr="https://c.adora-cdn.com";var ye=class{constructor(t){lt(this,"backendClient");lt(this,"eventPostBackendClient");this.backendClient=Bt({baseUrl:t??Pr})}getOrCreateEventPostClient(t){return!t.eventPostUrl||!t.eventPostToken?{path:t.sessionId,client:this.backendClient}:(this.eventPostBackendClient||(this.eventPostBackendClient=Bt({baseUrl:t.eventPostUrl})),{path:t.sessionId,client:this.eventPostBackendClient})}async sessionPreload({orgId:t}){return this.backendClient.POST("/sessions/preload",{body:{orgId:t},mode:"cors"}).catch(()=>{})}async startSession({bypassSampling:t,orgId:r,language:n,domain:o,userCohorts:s,uid:a,devicePixelRatio:c,adoraUserId:i,userAgent:d,documentReferrer:l,snippetVersion:u}){return this.backendClient.POST("/sessions/start",{body:{bypassSampling:t,orgId:r,language:n,domain:o,devicePixelRatio:c,userCohorts:s||{},userAgent:d,uid:typeof a=="number"?a.toString():a!=="null"&&a!=="undefined"?a:void 0,adoraUserId:i,documentReferrer:l,snippetVersion:u},mode:"cors"}).catch(()=>{})}async gzipWithCompressionStream(t){let r=JSON.stringify(t),o=new TextEncoder().encode(r),s=new CompressionStream("gzip"),c=new ReadableStream({start(d){d.enqueue(o),d.close()}}).pipeThrough(s);return new Response(c).arrayBuffer()}async saveSessionEvents({sessionId:t,events:r,metadata:n,eventPostUrl:o,eventPostToken:s,fastpathToken:a}){let{path:c,client:i}=this.getOrCreateEventPostClient({sessionId:t,eventPostToken:s,eventPostUrl:o}),d={events:r.slice(),metadata:n,fastpathToken:a},l={params:{path:{sessionId:c}},headers:s?{token:s}:void 0};if(typeof CompressionStream<"u"){let u=await this.gzipWithCompressionStream(d);return i.POSTGzipped("/sessions/{sessionId}/events",{...l,body:u}).catch(()=>{})}return i.POST("/sessions/{sessionId}/events",{...l,body:d}).catch(()=>{})}async refreshEventToken(t){return await this.backendClient.POST("/sessions/{sessionId}/events/token",{params:{path:{sessionId:t.sessionId}},body:{},mode:"cors"}).catch(()=>{})}async syncSession(t){return await this.backendClient.POST("/sessions/{sessionId}/sync",{params:{path:{sessionId:t.sessionId}}}).catch(()=>{})}};import{makeRe as bo,minimatch as Co}from"minimatch";function Fr(e){throw new Error(`This code path should be unreachable: ${e}`)}function wo(e){return e.endsWith("$")&&(e=e.substring(0,e.length-1)),(e.endsWith("+?")||e.endsWith("*?"))&&(e=e.substring(0,e.length-1)),e}function Le(e,t){let r=t.replace||t.path;switch(t.type){case"regexp":{let n=(t.path.startsWith("^")?"":"^")+t.path+(!t.path.endsWith("$")&&!t.partial?"$":""),o=new RegExp(n);return o.test(e)?t.partial?e.replace(o,r):r:void 0}case"wildcard":case void 0:if(t.partial){let n=bo(t.path,{partial:t.partial,dot:!0});if(!n)throw new Error("unable to make regexp");let o=new RegExp(wo(n.source));return o.test(e)?e.replace(o,r):void 0}return Co(e,t.path,{dot:!0})?r:void 0;default:Fr(t.type)}}var Bt=e=>({...Or(e),POSTGzipped:async(r,n)=>{if(!n?.body)throw new Error("Body is required for gzipped requests");let o={...n.headers,"Content-Type":"application/json","Content-Encoding":"gzip"},s=r;n.params?.path&&Object.entries(n.params.path).forEach(([i,d])=>{s=s.replace(`{${i}}`,d)});let a=await fetch(`${e.baseUrl}${s}`,{method:"POST",headers:o,body:n.body});if(!a.ok){let i=await a.text();try{i=JSON.parse(i)}catch{}return{data:void 0,error:i,response:a}}return{data:await a.json(),error:void 0,response:a}}});import{strictDeepEqual as Mi}from"fast-equals";import Ut from"js-cookie";import{uuidv7 as Ni}from"uuidv7";var dt=class{constructor(t,r){this.storage=r;this.eventStorageKey=t==="adoraSessionScript"?"adoraEventsScript":"adoraEventsExtension"}getEvents(){let t=this.storage.getItem(this.eventStorageKey);return t?JSON.parse(t):null}setEvents(t){this.storage.setItem(this.eventStorageKey,JSON.stringify(t))}removeEvents(){this.storage.removeItem(this.eventStorageKey)}};function Ht(e){return`${e}-rate-limit-timestamp`}var we=class{constructor(t,r){this.sessionType=t;this.storage=r}get lastRateLimitedTimestamp(){let t=this.storage.getItem(Ht(this.sessionType));if(Io(t))return t}clearLastRateLimitedTimestamp(){this.storage.removeItem(Ht(this.sessionType))}setLastRateLimitedTimestamp(t){this.storage.setItem(Ht(this.sessionType),t.toString())}getSession(){let t=this.storage.getItem(this.sessionType);return t?JSON.parse(t):null}setSession(t){this.storage.setItem(this.sessionType,JSON.stringify(t))}removeSession(){this.storage.removeItem(this.sessionType)}};function Io(e){return!Number.isNaN(Number(e))}function b(e,...t){(typeof window=="object"&&window.enableAdoraDebugLogs||typeof window=="object"&&window.localStorage.getItem("enableAdoraDebugLogs"))&&console.log(e,...t)}function Ur(e){return{id:e.id,pathConfig:e.pathConfig,allowedQueryParams:e.allowedQueryParams,cookieDomains:e.cookieDomains,cohortsBootstrapConfig:e.cohortsBootstrapConfig||{},customQueryParamsCohorts:e.customQueryParamsCohorts,blockedCSSClasses:e.blockedCSSClasses||[],maskedCSSClasses:e.maskedCSSClasses,maskByDefault:e.maskByDefault??!1,unmaskSelectors:e.unmaskSelectors||[]}}function Ro(e){return{id:e.id,compressionType:e.compressionType||"NONE",canvasRecordingEnabled:e.canvasRecordingEnabled,limitedCanvasRecording:e.limitedCanvasRecording}}function zr(e){return"scheduledDowntime"in e?{scheduledDowntime:!0}:{organization:Ur(e.organization)}}function ut(e){return{session:Ro(e.session),organization:Ur(e.organization),eventPostUrl:e.eventPostUrl,eventPostToken:e.eventPostToken}}function Wr(e,t,r,n){return{id:e.session.id,compressionType:e.session.compressionType,organization:e.organization,settings:t,canvasRecordingEnabled:e.session.canvasRecordingEnabled,limitedCanvasRecording:e.session.limitedCanvasRecording,eventPostUrl:e.eventPostUrl,eventPostToken:e.eventPostToken,adoraUserId:r,documentReferrer:n}}function Br(e,t){return{id:t.session.id,compressionType:t.session.compressionType,organization:t.organization,settings:e.settings,canvasRecordingEnabled:t.session.canvasRecordingEnabled,limitedCanvasRecording:t.session.limitedCanvasRecording,eventPostUrl:t.eventPostUrl,eventPostToken:t.eventPostToken,adoraUserId:e.adoraUserId,documentReferrer:e.documentReferrer}}var ve=class{getItem(t){if(!Gt())return null;try{return window.sessionStorage.getItem(t)}catch{return null}}setItem(t,r){if(!Gt())return null;try{return window.sessionStorage.setItem(t,r)}catch{return null}}removeItem(t){if(!Gt())return null;try{return window.sessionStorage.removeItem(t)}catch{return null}}};function Gt(){return typeof window.sessionStorage=="object"}var ht="v0.0.7";var Hr=async(e,t,r)=>{let n=new we(e,new ve),o=new ye(r.backendUrl),s=await Eo(o,r,t);return s.type==="success"&&n.setSession(s.storedSession),s};async function Eo(e,t,r){try{b("starting session over network",{uid:t.uid,userCohorts:t.userCohorts||{}});let n=await e.startSession({bypassSampling:t.bypassSampling,orgId:t.orgId,language:t.language||navigator.language,domain:new URL(window.location.href).hostname,userCohorts:t.userCohorts||{},uid:t.uid,devicePixelRatio:window.devicePixelRatio,adoraUserId:r,documentReferrer:document.referrer,snippetVersion:ht});if(!n)return{type:"error",code:void 0};if(n.error)return{type:"error",code:n.error.code};if(n.response.status!==201)return b("session not created, aborting"),{type:"error",code:"code"in n.data?n.data.code:void 0};if(n.data&&"scheduledDowntime"in n.data)return b("scheduled downtime, exiting"),{type:"error",code:void 0};if(!n.data||!("session"in n.data))return b("malformed session, exiting"),{type:"error",code:void 0};let o=ut(n.data);return{type:"success",storedSession:Wr(o,t,r,n.data.session.documentReferrer)}}catch{return{type:"error",code:void 0}}}import*as Ve from"web-vitals";var Gr="__STATSIG__",To="statsig@@",Vr=e=>{try{if(!e[Gr])return;let t=e[Gr];if(!ko(t))return;let r={};return Object.values(t.instances).forEach(n=>{n._logger?._lastExposureTimeMap&&Object.keys(n._logger?._lastExposureTimeMap).forEach(o=>{let s=Ao(o);if(!s)return;let a=n.getExperiment(s);No(a)&&(r[To+a.name]=a.groupName)})}),r}catch{return}},Ao=e=>{let t=e.split("|");if(t.length>3)return t[3]};function ko(e){if(!e||typeof e!="object"||!("instances"in e)||typeof e.instances!="object"||!e.instances)return!1;let t=Object.values(e.instances);for(let r of t)if(!_o(r))return!1;return!0}function _o(e){return!e||typeof e!="object"?!1:"_logger"in e&&typeof e._logger=="object"&&Mo(e._logger)&&"_sdkKey"in e&&typeof e._sdkKey=="string"&&"getExperiment"in e&&typeof e.getExperiment=="function"}function Mo(e){return!e||typeof e!="object"?!1:"_lastExposureTimeMap"in e&&typeof e._lastExposureTimeMap=="object"}function No(e){return!e||typeof e!="object"?!1:"name"in e&&typeof e.name=="string"&&"groupName"in e&&typeof e.groupName=="string"}function ft(e,t){if(!t.windowGetters)return;let r={};if(t.windowGetters.forEach(({key:n,paths:o})=>{let s=xo(e,o);s&&(r[n]=s)}),Object.keys(r).length!==0)return r}function xo(e,t){if(typeof e>"u")return;let r=e;for(let o=0;o<t.length-1;o++)if(r=r[t[o]],typeof r!="object")return;let n=r[t[t.length-1]];if(typeof n=="string")return n;if(typeof n=="boolean"||typeof n=="number")return n.toString()}function Vt(e){return Vr(e)}var Oo=Object.defineProperty,Lo=(e,t,r)=>t in e?Oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>Lo(e,typeof t!="symbol"?t+"":t,r),jr,Do=Object.defineProperty,Po=(e,t,r)=>t in e?Do(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$r=(e,t,r)=>Po(e,typeof t!="symbol"?t+"":t,r),X=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(X||{}),Yr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Zr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pt={};function ur(e){if(pt[e])return pt[e];let t=globalThis[e],r=t.prototype,n=e in Yr?Yr[e]:void 0,o=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),s=e in Zr?Zr[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(o&&a)return pt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let d=i[e].prototype;return document.body.removeChild(c),d?pt[e]=d:r}catch{return r}}var jt={};function Re(e,t,r){var n;let o=`${e}.${String(r)}`;if(jt[o])return jt[o].call(t);let s=ur(e),a=(n=Object.getOwnPropertyDescriptor(s,r))==null?void 0:n.get;return a?(jt[o]=a,a.call(t)):t[r]}var $t={};function hn(e,t,r){let n=`${e}.${String(r)}`;if($t[n])return $t[n].bind(t);let s=ur(e)[r];return typeof s!="function"?t[r]:($t[n]=s,s.bind(t))}function Fo(e){return Re("Node",e,"childNodes")}function Uo(e){return Re("Node",e,"parentNode")}function zo(e){return Re("Node",e,"parentElement")}function Wo(e){return Re("Node",e,"textContent")}function Bo(e,t){return hn("Node",e,"contains")(t)}function Ho(e){return hn("Node",e,"getRootNode")()}function Go(e){return!e||!("host"in e)?null:Re("ShadowRoot",e,"host")}function Vo(e){return e.styleSheets}function jo(e){return!e||!("shadowRoot"in e)?null:Re("Element",e,"shadowRoot")}function $o(e,t){return Re("Element",e,"querySelector")(t)}function Yo(e,t){return Re("Element",e,"querySelectorAll")(t)}function Zo(){return ur("MutationObserver").constructor}var ee={childNodes:Fo,parentNode:Uo,parentElement:zo,textContent:Wo,contains:Bo,getRootNode:Ho,host:Go,styleSheets:Vo,shadowRoot:jo,querySelector:$o,querySelectorAll:Yo,mutationObserver:Zo};function fn(e){return e.nodeType===e.ELEMENT_NODE}function Ze(e){let t=e&&"host"in e&&"mode"in e&&ee.host(e)||null;return!!(t&&"shadowRoot"in t&&ee.shadowRoot(t)===e)}function Ke(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Ko(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Xo(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function qt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);let n=Array.from(t,o=>pn(o,r)).join("");return Ko(n)}catch{return null}}function pn(e,t){if(qo(e)){let r;try{r=qt(e.styleSheet)||Xo(e)}catch{r=e.cssText}return e.styleSheet.href?wt(r,e.styleSheet.href):r}else{let r=e.cssText;return Qo(e)&&e.selectorText.includes(":")&&(r=Jo(r)),t?wt(r,t):r}}function Jo(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function qo(e){return"styleSheet"in e}function Qo(e){return"selectorText"in e}var bt=class{constructor(){$r(this,"idNodeMap",new Map),$r(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function es(){return new bt}function Ct({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:s}){let a=o||"",c=n&&ke(n);return(t[r.toLowerCase()]||c&&t[c])&&(s?a=s(a,e):a="*".repeat(a.length)),a}function ke(e){return e.toLowerCase()}var Kr="__rrweb_original__";function ts(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let s=t.getImageData,a=Kr in s?s[Kr]:s;if(new Uint32Array(a.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(i=>i!==0))return!1}return!0}function hr(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ke(t):null}function mn(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,o=r.pathname.match(n);return o?.[1]??null}function rs(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ns=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,os=/^(?:[a-z+]+:)?\/\//i,ss=/^www\..*/i,is=/^(data:)([^,]*),(.*)/i;function wt(e,t){return(e||"").replace(ns,(r,n,o,s,a,c)=>{let i=o||a||c,d=n||s||"";if(!i)return r;if(os.test(i)||ss.test(i))return`url(${d}${i}${d})`;if(is.test(i))return`url(${d}${i}${d})`;if(i[0]==="/")return`url(${d}${rs(t)+i}${d})`;let l=t.split("/"),u=i.split("/");l.pop();for(let f of u)f!=="."&&(f===".."?l.pop():l.push(f));return`url(${d}${l.join("/")}${d})`})}function Yt(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function as(e,t){let r=Array.from(t.childNodes),n=[];if(r.length>1&&e&&typeof e=="string"){let o=Yt(e);for(let s=1;s<r.length;s++)if(r[s].textContent&&typeof r[s].textContent=="string"){let a=Yt(r[s].textContent);for(let c=3;c<a.length;c++){let i=a.substring(0,c);if(o.split(i).length===2){let d=o.indexOf(i);for(let l=d;l<e.length;l++)if(Yt(e.substring(0,l)).length===d){n.push(e.substring(0,l)),e=e.substring(l);break}break}}}}return n.push(e),n}function ls(e,t){return as(e,t).join("/* rr_split */")}var cs=1,ds=new RegExp("[^a-z0-9-_:]"),Je=-2;function gn(){return cs++}function us(e){if(e instanceof HTMLFormElement)return"form";let t=ke(e.tagName);return ds.test(t)?"div":t}var De,Xr,hs=/^[^ \t\n\r\u000c]+/,fs=/^[, \t\n\r\u000c]+/;function ps(e,t){if(t.trim()==="")return t;let r=0;function n(s){let a,c=s.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let o=[];for(;n(fs),!(r>=t.length);){let s=n(hs);if(s.slice(-1)===",")s=Ue(e,s.substring(0,s.length-1)),o.push(s);else{let a="";s=Ue(e,s);let c=!1;for(;;){let i=t.charAt(r);if(i===""){o.push((s+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,o.push((s+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return o.join(", ")}var Jr=new WeakMap;function Ue(e,t){return!t||t.trim()===""?t:fr(e,t)}function ms(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function fr(e,t){let r=Jr.get(e);if(r||(r=e.createElement("a"),Jr.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function yn(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?Ue(e,n):r==="srcset"?ps(e,n):r==="style"?wt(n,fr(e)):t==="object"&&r==="data"?Ue(e,n):n)}function vn(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function gs(e,t,r,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let o=e.classList.length;o--;){let s=e.classList[o];if(t.test(s))return!0}if(r)return e.matches(r);if(n&&e.tagName==="IMG"){let o=e.getAttribute("src");if(o&&n.test(o))return!0}}catch{}return!1}function It(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?It(ee.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?It(ee.parentNode(e),t,r):!1}function Sn(e,t,r,n){let o;if(fn(e)){if(o=e,!ee.childNodes(o).length)return!1}else{if(ee.parentElement(e)===null)return!1;o=ee.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(It(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}if(o.getAttribute("contenteditable")||o.closest('[contenteditable="true"]'))return!0}catch{}return!1}function ys(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,s;try{s=n.document.readyState}catch{return}if(s!=="complete"){let c=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),o=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function vs(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let s=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),n=!0,t()})}function Ss(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:d,maskInputFn:l,maskAnchorHrefFn:u,blockImgSrcPattern:f,blockImgSrcFillOptions:p,dataURLOptions:m={},inlineImages:h,recordCanvas:C,keepIframeSrcFn:w,newlyAddedElement:S=!1,cssCaptured:g=!1}=t,T=bs(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:X.Document,childNodes:[],compatMode:e.compatMode}:{type:X.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:X.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:T};case e.ELEMENT_NODE:return ws(e,{doc:r,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:i,maskInputFn:l,maskAnchorHrefFn:u,blockImgSrcPattern:f,blockImgSrcFillOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:C,keepIframeSrcFn:w,newlyAddedElement:S,rootId:T});case e.TEXT_NODE:return Cs(e,{doc:r,needsMask:a,maskTextFn:d,rootId:T,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:X.CDATA,textContent:"",rootId:T};case e.COMMENT_NODE:return{type:X.Comment,textContent:ee.textContent(e)||"",rootId:T};default:return!1}}function bs(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Cs(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:s}=t,a=ee.parentNode(e),c=a&&a.tagName,i="",d=c==="STYLE"?!0:void 0,l=c==="SCRIPT"?!0:void 0;return l?i="SCRIPT_PLACEHOLDER":s||(i=ee.textContent(e),d&&i&&(i=wt(i,fr(t.doc)))),!d&&!l&&i&&r&&(i=n?n(i,ee.parentElement(e)):i.replace(/[\S]/g,"*")),{type:X.Text,textContent:i||"",rootId:o}}function ws(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:c,maskAnchorHrefFn:i,blockImgSrcPattern:d,blockImgSrcFillOptions:l,dataURLOptions:u={},inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:h=!1,rootId:C}=t,w=gs(e,n,o,d),S=us(e),g={},T=e.attributes.length;for(let v=0;v<T;v++){let R=e.attributes[v];vn(S,R.name,R.value)||(g[R.name]=yn(r,S,ke(R.name),R.value))}if(S==="a"&&i&&typeof g.href=="string"&&(g.href=i(g.href,e)),S==="link"&&s){let v=Array.from(r.styleSheets).find(I=>I.href===e.href);if(!v&&e.href.includes(".css")){let I=window.location.origin,L=e.href.replace(window.location.href,""),z=I+"/"+L;v=Array.from(r.styleSheets).find(J=>J.href===z)}let R=null;v&&(R=qt(v)),R&&(delete g.rel,delete g.href,g._cssText=R)}if(S==="style"&&e.sheet){let v=qt(e.sheet);v&&(e.childNodes.length>1&&(v=ls(v,e)),g._cssText=v)}if(S==="input"||S==="textarea"||S==="select"){let v=e.value,R=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&v?g.value=Ct({element:e,type:hr(e),tagName:S,value:v,maskInputOptions:a,maskInputFn:c}):R&&(g.checked=R)}if(S==="option"&&(e.selected&&!a.select?g.selected=!0:delete g.selected),S==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),S==="canvas"&&p){if(e.__context==="2d")ts(e)||(g.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){let v=e.toDataURL(u.type,u.quality),R=r.createElement("canvas");R.width=e.width,R.height=e.height;let I=R.toDataURL(u.type,u.quality);v!==I&&(g.rr_dataURL=v)}}if(S==="img"&&f){De||(De=r.createElement("canvas"),Xr=De.getContext("2d"));let v=e,R=v.currentSrc||v.getAttribute("src")||"<unknown-src>",I=v.crossOrigin,L=()=>{v.removeEventListener("load",L);try{De.width=v.naturalWidth,De.height=v.naturalHeight,Xr.drawImage(v,0,0),g.rr_dataURL=De.toDataURL(u.type,u.quality)}catch(z){if(v.crossOrigin!=="anonymous"){v.crossOrigin="anonymous",v.complete&&v.naturalWidth!==0?L():v.addEventListener("load",L);return}else console.warn(`Cannot inline img src=${R}! Error: ${z}`)}v.crossOrigin==="anonymous"&&(I?g.crossOrigin=I:v.removeAttribute("crossorigin"))};v.complete&&v.naturalWidth!==0?L():v.addEventListener("load",L)}if(S==="audio"||S==="video"){let v=g;v.rr_mediaState=e.paused?"paused":"played",v.rr_mediaCurrentTime=e.currentTime,v.rr_mediaPlaybackRate=e.playbackRate,v.rr_mediaMuted=e.muted,v.rr_mediaLoop=e.loop,v.rr_mediaVolume=e.volume}if(h||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),w){let{width:v,height:R}=e.getBoundingClientRect();g={class:g.class,rr_width:`${v}px`,rr_height:`${R}px`}}w&&S==="img"&&(g={...g,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP89v3nfwAJuAPnyTr4jAAAAABJRU5ErkJggg==",rr_fill:l.backgroundColor,rr_stroke:l.strokeColor,rr_stroke_width:l.strokeWidth}),S==="iframe"&&!m(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let _;try{customElements.get(S)&&(_=!0)}catch{}return{type:X.Element,tagName:S,attributes:g,childNodes:[],isSVG:ms(e)||void 0,needBlock:w,rootId:C,isCustom:_}}function V(e){return e==null?"":e.toLowerCase()}function Is(e,t){if(t.comment&&e.type===X.Comment)return!0;if(e.type===X.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&mn(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(V(e.attributes.name).match(/^msapplication-tile(image|color)$/)||V(e.attributes.name)==="application-name"||V(e.attributes.rel)==="icon"||V(e.attributes.rel)==="apple-touch-icon"||V(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&V(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(V(e.attributes.property).match(/^(og|twitter|fb):/)||V(e.attributes.name).match(/^(og|twitter):/)||V(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(V(e.attributes.name)==="robots"||V(e.attributes.name)==="googlebot"||V(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(V(e.attributes.name)==="author"||V(e.attributes.name)==="generator"||V(e.attributes.name)==="framework"||V(e.attributes.name)==="publisher"||V(e.attributes.name)==="progid"||V(e.attributes.property).match(/^article:/)||V(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(V(e.attributes.name)==="google-site-verification"||V(e.attributes.name)==="yandex-verification"||V(e.attributes.name)==="csrf-token"||V(e.attributes.name)==="p:domain_verify"||V(e.attributes.name)==="verify-v1"||V(e.attributes.name)==="verification"||V(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function ze(e,t){if(e.nodeName.toLowerCase().includes("grammarly"))return null;let{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:d=!0,maskInputOptions:l={},maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:w={},inlineImages:S=!1,recordCanvas:g=!1,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:v=5e3,onStylesheetLoad:R,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:L=()=>!1,newlyAddedElement:z=!1,cssCaptured:J=!1}=t,{needsMask:F}=t,{preserveWhiteSpace:q=!0}=t;F||(F=Sn(e,a,c,F===void 0));let H=Ss(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:F,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:h,dataURLOptions:w,inlineImages:S,recordCanvas:g,keepIframeSrcFn:L,newlyAddedElement:z,cssCaptured:J});if(!H)return console.warn(e,"not serialized"),null;let W;n.hasNode(e)?W=n.getId(e):Is(H,C)||!q&&H.type===X.Text&&!H.textContent.replace(/^\s+|\s+$/gm,"").length?W=Je:W=gn();let E=Object.assign(H,{id:W});if(n.add(e,E),W===Je)return null;T&&T(e);let k=!i;if(E.type===X.Element){k=k&&!E.needBlock,delete E.needBlock;let A=ee.shadowRoot(e);A&&Ke(A)&&(E.isShadowHost=!0)}if((E.type===X.Document||E.type===X.Element)&&k){C.headWhitespace&&E.type===X.Element&&E.tagName==="head"&&(q=!1);let A={doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:F,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:w,inlineImages:S,recordCanvas:g,preserveWhiteSpace:q,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:R,stylesheetLoadTimeout:I,keepIframeSrcFn:L,cssCaptured:!1};if(!(E.type===X.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===X.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(A.cssCaptured=!0);for(let G of Array.from(ee.childNodes(e))){let K=ze(G,A);K&&E.childNodes.push(K)}}let D=null;if(fn(e)&&(D=ee.shadowRoot(e)))for(let G of Array.from(ee.childNodes(D))){let K=ze(G,A);K&&(Ke(D)&&(K.isShadow=!0),E.childNodes.push(K))}}let Z=ee.parentNode(e);return Z&&Ze(Z)&&Ke(Z)&&(E.isShadow=!0),E.type===X.Element&&E.tagName==="iframe"&&ys(e,()=>{let A=e.contentDocument;if(A&&_){let D=ze(A,{doc:A,mirror:n,blockClass:o,blockSelector:s,needsMask:F,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:w,inlineImages:S,recordCanvas:g,preserveWhiteSpace:q,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:R,stylesheetLoadTimeout:I,keepIframeSrcFn:L});D&&_(e,D)}},v),E.type===X.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&mn(E.attributes.href)==="css")&&vs(e,()=>{if(R){let A=ze(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:F,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:h,slimDOMOptions:C,dataURLOptions:w,inlineImages:S,recordCanvas:g,preserveWhiteSpace:q,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:v,onStylesheetLoad:R,stylesheetLoadTimeout:I,keepIframeSrcFn:L});A&&R(e,A)}},I),E}function Rs(e,t){let{mirror:r=new bt,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:d=!1,maskAllInputs:l=!1,maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m=null,blockImgSrcFillOptions:h={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},slimDOM:C=!1,dataURLOptions:w,preserveWhiteSpace:S,onSerialize:g,onIframeLoad:T,iframeLoadTimeout:_,onStylesheetLoad:v,stylesheetLoadTimeout:R,keepIframeSrcFn:I=()=>!1}=t||{};return ze(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:l===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:l===!1?{password:!0}:l,maskTextFn:u,maskInputFn:f,maskAnchorHrefFn:p,blockImgSrcPattern:m,blockImgSrcFillOptions:h,slimDOMOptions:C===!0||C==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:C==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:C===!1?{}:C,dataURLOptions:w,inlineImages:i,recordCanvas:d,preserveWhiteSpace:S,onSerialize:g,onIframeLoad:T,iframeLoadTimeout:_,onStylesheetLoad:v,stylesheetLoadTimeout:R,keepIframeSrcFn:I,newlyAddedElement:!1})}var Qt=class e{constructor(...t){__publicField2(this,"parentElement",null),__publicField2(this,"parentNode",null),__publicField2(this,"ownerDocument"),__publicField2(this,"firstChild",null),__publicField2(this,"lastChild",null),__publicField2(this,"previousSibling",null),__publicField2(this,"nextSibling",null),__publicField2(this,"ELEMENT_NODE",1),__publicField2(this,"TEXT_NODE",3),__publicField2(this,"nodeType"),__publicField2(this,"nodeName"),__publicField2(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}},qr={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Qr={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},mt={};function pr(e){if(mt[e])return mt[e];let t=globalThis[e],r=t.prototype,n=e in qr?qr[e]:void 0,o=!!(n&&n.every(c=>{var i,d;return!!((d=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&d.toString().includes("[native code]"))})),s=e in Qr?Qr[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(o&&a)return mt[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let d=i[e].prototype;return document.body.removeChild(c),d?mt[e]=d:r}catch{return r}}var Zt={};function Ee(e,t,r){var n;let o=`${e}.${String(r)}`;if(Zt[o])return Zt[o].call(t);let s=pr(e),a=(n=Object.getOwnPropertyDescriptor(s,r))==null?void 0:n.get;return a?(Zt[o]=a,a.call(t)):t[r]}var Kt={};function bn(e,t,r){let n=`${e}.${String(r)}`;if(Kt[n])return Kt[n].bind(t);let s=pr(e)[r];return typeof s!="function"?t[r]:(Kt[n]=s,s.bind(t))}function Es(e){return Ee("Node",e,"childNodes")}function Ts(e){return Ee("Node",e,"parentNode")}function As(e){return Ee("Node",e,"parentElement")}function ks(e){return Ee("Node",e,"textContent")}function _s(e,t){return bn("Node",e,"contains")(t)}function Ms(e){return bn("Node",e,"getRootNode")()}function Ns(e){return!e||!("host"in e)?null:Ee("ShadowRoot",e,"host")}function xs(e){return e.styleSheets}function Os(e){return!e||!("shadowRoot"in e)?null:Ee("Element",e,"shadowRoot")}function Ls(e,t){return Ee("Element",e,"querySelector")(t)}function Ds(e,t){return Ee("Element",e,"querySelectorAll")(t)}function Cn(){return pr("MutationObserver").constructor}var M={childNodes:Es,parentNode:Ts,parentElement:As,textContent:ks,contains:_s,getRootNode:Ms,host:Ns,styleSheets:xs,shadowRoot:Os,querySelector:Ls,querySelectorAll:Ds,mutationObserver:Cn};function re(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Pe=`Please stop import mirror directly. Instead of that,\r
2
2
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
- or you can use record.mirror to access the mirror instance during recording.`,nn={map:{},getId(){return console.error(Pe),-1},getNode(){return console.error(Pe),null},removeNodeFromMap(){console.error(Pe)},has(){return console.error(Pe),!1},reset(){console.error(Pe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(nn=new Proxy(nn,{get(e,t,r){return t==="map"&&console.error(Pe),Reflect.get(e,t,r)}}));function Qe(e,t,r={}){let n=null,o=0;return function(...s){let a=Date.now();!o&&r.leading===!1&&(o=a);let c=t-(a-o),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),o=a,e.apply(i,s)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(i,s)},c))}}function Tt(e,t,r,n,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>Tt(e,t,s||{},!0)}function He(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var Rt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Rt=()=>new Date().getTime());function En(e){var t,r,n,o;let s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=_.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((n=_.parentElement(s.body))==null?void 0:n.scrollTop)||((o=s?.body)==null?void 0:o.scrollTop)||0}}function An(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function kn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Tn(e){return e?e.nodeType===e.ELEMENT_NODE?e:_.parentElement(e):null}function oe(e,t,r,n){if(!e)return!1;let o=Tn(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(It(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function zs(e,t){return t.getId(e)!==-1}function qt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===qe}function Mn(e,t){if(Ke(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=_.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Mn(n,t):!0}function rr(e){return!!e.changedTouches}function Us(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function _n(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Nn(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function nr(e){return e?e instanceof tr&&"shadowRoot"in e?!!e.shadowRoot:!!_.shadowRoot(e):!1}var or=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function xn(e){var t;let r=null;return"getRootNode"in e&&((t=_.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&_.host(_.getRootNode(e))&&(r=_.host(_.getRootNode(e))),r}function Ws(e){let t=e,r;for(;r=xn(t);)t=r;return t}function Bs(e){let t=e.ownerDocument;if(!t)return!1;let r=Ws(e);return _.contains(t,r)}function On(e){let t=e.ownerDocument;return t?_.contains(t,e)||Bs(e):!1}var P=(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))(P||{}),N=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(N||{}),ae=(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))(ae||{}),ve=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ve||{}),Be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Be||{}),Fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Fe||{});function on(e){return"__ln"in e}var sr=class{constructor(){y(this,"length",0),y(this,"head",null),y(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&on(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&on(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},sn=(e,t)=>`${e}@${t}`,ir=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"maskAnchorHrefFn"),y(this,"blockImgSrcPattern"),y(this,"blockImgSrcFillOptions"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"canvasManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new sr,o=i=>{let d=i,l=qe;for(;l===qe;)d=d&&d.nextSibling,l=d&&this.mirror.getId(d);return l},s=i=>{let d=_.parentNode(i);if(!d||!On(i))return;let l=!1;if(i.nodeType===Node.TEXT_NODE){let m=d.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(d)&&(l=!0)}let u=Ke(d)?this.mirror.getId(xn(i)):this.mirror.getId(d),h=o(i);if(u===-1||h===-1)return n.addNode(i);let p=Ue(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAnchorHrefFn:this.maskAnchorHrefFn,blockImgSrcPattern:this.blockImgSrcPattern,blockImgSrcFillOptions:this.blockImgSrcFillOptions,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{_n(m,this.mirror)&&this.iframeManager.addIframe(m),Nn(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),nr(i)&&this.shadowDomManager.addShadowRoot(_.shadowRoot(i),this.doc)},onIframeLoad:(m,f)=>{this.iframeManager.attachIframe(m,f),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,f)=>{this.stylesheetManager.attachLinkElement(m,f)},cssCaptured:l});p&&(t.push({parentId:u,nextId:h,node:p}),r.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let i of this.movedSet)an(this.removes,i,this.mirror)&&!this.movedSet.has(_.parentNode(i))||s(i);for(let i of this.addedSet)!ln(this.droppedSet,i)&&!an(this.removes,i,this.mirror)||ln(this.movedSet,i)?s(i):this.droppedSet.add(i);let a=null;for(;n.length;){let i=null;if(a){let d=this.mirror.getId(_.parentNode(a.value)),l=o(a.value);d!==-1&&l!==-1&&(i=a)}if(!i){let d=n.tail;for(;d;){let l=d;if(d=d.previous,l){let u=this.mirror.getId(_.parentNode(l.value));if(o(l.value)===-1)continue;if(u!==-1){i=l;break}else{let p=l.value,m=_.parentNode(p);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=_.host(m);if(this.mirror.getId(f)!==-1){i=l;break}}}}}}if(!i){for(;n.head;)n.removeNode(n.head.value);break}a=i.previous,n.removeNode(i.value),s(i.value)}let c={texts:this.texts.map(i=>{let d=i.node,l=_.parentNode(d);return l&&l.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(l),{id:this.mirror.getId(d),value:i.value}}).filter(i=>!r.has(i.id)).filter(i=>this.mirror.has(i.id)),attributes:this.attributes.map(i=>{let{attributes:d}=i;if(typeof d.style=="string"){let l=JSON.stringify(i.styleDiff),u=JSON.stringify(i._unchangedStyles);l.length<d.style.length&&(l+u).split("var(").length===d.style.split("var(").length&&(d.style=i.styleDiff)}return{id:this.mirror.getId(i.node),attributes:d}}).filter(i=>!r.has(i.id)).filter(i=>this.mirror.has(i.id)),removes:this.removes,adds:t};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(c))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=r.attributes.value=Array.from(_.childNodes(t),o=>_.textContent(o)||"").join("");r.attributes.value=Ct({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:null,value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!qt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=_.textContent(t.target);!oe(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:wn(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Tn(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,o=t.target.getAttribute(n);if(n==="value"){let c=pr(r);o=Ct({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn})}let s=oe(t.target,this.blockClass,this.blockSelector,!1);if(s&&n==="style"){let c=t.target,{width:i,height:d}=c.getBoundingClientRect(),l=this.attributeMap.get(t.target);l||(l={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(l),this.attributeMap.set(t.target,l)),l.attributes.rr_width=`${i}px`,l.attributes.rr_height=`${d}px`}if(s||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Cn(r.tagName,n))if(a.attributes[n]=bn(this.doc,Me(r.tagName),Me(n),o),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let d=r.style.getPropertyValue(i),l=r.style.getPropertyPriority(i);d!==c.style.getPropertyValue(i)||l!==c.style.getPropertyPriority(i)?l===""?a.styleDiff[i]=d:a.styleDiff[i]=[d,l]:a._unchangedStyles[i]=[d,l]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(oe(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),o=Ke(t.target)?this.mirror.getId(_.host(t.target)):this.mirror.getId(t.target);oe(t.target,this.blockClass,this.blockSelector,!1)||qt(r,this.mirror,this.slimDOMOptions)||!zs(r,this.mirror)||(this.addedSet.has(r)?(ar(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Mn(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[sn(n,o)]?ar(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:Ke(t.target)&&Je(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(qt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[sn(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);oe(t,this.blockClass,this.blockSelector,!1)||(_.childNodes(t).forEach(n=>this.genAdds(n)),nr(t)&&_.childNodes(_.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAnchorHrefFn","blockImgSrcPattern","blockImgSrcFillOptions","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 ar(e,t){e.delete(t),_.childNodes(t).forEach(r=>ar(e,r))}function an(e,t,r){return e.length===0?!1:Hs(e,t,r)}function Hs(e,t,r){let n=_.parentNode(t);for(;n;){let o=r.getId(n);if(e.some(s=>s.id===o))return!0;n=_.parentNode(n)}return!1}function ln(e,t){return e.size===0?!1:Ln(e,t)}function Ln(e,t){let r=_.parentNode(t);return r?e.has(r)?!0:Ln(e,r):!1}var Xe;function Gs(e){Xe=e}function Vs(){Xe=void 0}var O=e=>Xe?(...r)=>{try{return e(...r)}catch(n){if(Xe&&Xe(n)===!0)return;throw n}}:e,Te=[];function et(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Dn(e,t){let r=new ir;Te.push(r),r.init(e);let n=new(Rn())(O(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function js({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=Qe(O(u=>{let h=Date.now()-c;e(a.map(p=>(p.timeOffset-=h,p)),u),a=[],c=null}),s),d=O(Qe(O(u=>{let h=et(u),{clientX:p,clientY:m}=rr(u)?u.changedTouches[0]:u;c||(c=Rt()),a.push({x:p,y:m,id:n.getId(h),timeOffset:Rt()-c}),i(typeof DragEvent<"u"&&u instanceof DragEvent?N.Drag:u instanceof MouseEvent?N.MouseMove:N.TouchMove)}),o,{trailing:!1})),l=[ne("mousemove",d,r),ne("touchmove",d,r),ne("drag",d,r)];return O(()=>{l.forEach(u=>u())})}function $s({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],i=null,d=l=>u=>{let h=et(u);if(oe(h,n,o,!0))return;let p=null,m=l;if("pointerType"in u){switch(u.pointerType){case"mouse":p=ve.Mouse;break;case"touch":p=ve.Touch;break;case"pen":p=ve.Pen;break}p===ve.Touch?ae[l]===ae.MouseDown?m="TouchStart":ae[l]===ae.MouseUp&&(m="TouchEnd"):ve.Pen}else rr(u)&&(p=ve.Touch);p!==null?(i=p,(m.startsWith("Touch")&&p===ve.Touch||m.startsWith("Mouse")&&p===ve.Mouse)&&(p=null)):ae[l]===ae.Click&&(p=i,i=null);let f=rr(u)?u.changedTouches[0]:u;if(!f)return;let C=r.getId(h),{clientX:w,clientY:v}=f;O(e)({type:ae[m],id:C,x:w,y:v,...p!==null&&{pointerType:p}})};return Object.keys(ae).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let u=Me(l),h=d(l);if(window.PointerEvent)switch(ae[l]){case ae.MouseDown:case ae.MouseUp:u=u.replace("mouse","pointer");break;case ae.TouchStart:case ae.TouchEnd:return}c.push(ne(u,h,t))}),O(()=>{c.forEach(l=>l())})}function Pn({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){let a=O(Qe(O(c=>{let i=et(c);if(!i||oe(i,n,o,!0))return;let d=r.getId(i);if(i===t&&t.defaultView){let l=En(t.defaultView);e({id:d,x:l.left,y:l.top})}else e({id:d,x:i.scrollLeft,y:i.scrollTop})}),s.scroll||100));return ne("scroll",a,t)}function Ys({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=O(Qe(O(()=>{let s=An(),a=kn();(r!==s||n!==a)&&(e({width:Number(a),height:Number(s)}),r=s,n=a)}),200));return ne("resize",o,t)}var Zs=["INPUT","TEXTAREA","SELECT"],cn=new WeakMap;function Ks({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:d,userTriggeredOnInput:l}){function u(v){let g=et(v),A=v.isTrusted,M=g&&g.tagName;if(g&&M==="OPTION"&&(g=_.parentElement(g)),!g||!M||Zs.indexOf(M)<0||oe(g,n,o,!0)||g.classList.contains(s)||a&&g.matches(a))return;let S=g.value,R=!1,I=pr(g)||"";I==="radio"||I==="checkbox"?R=g.checked:(c[M.toLowerCase()]||c[I])&&(S=Ct({element:g,maskInputOptions:c,tagName:M,type:I,value:S,maskInputFn:i})),h(g,l?{text:S,isChecked:R,userTriggered:A}:{text:S,isChecked:R});let L=g.name;I==="radio"&&L&&R&&t.querySelectorAll(`input[type="radio"][name="${Js(L)}"]`).forEach(U=>{if(U!==g){let X=U.value;h(U,l?{text:X,isChecked:!R,userTriggered:!1}:{text:X,isChecked:!R})}})}function h(v,g){let A=cn.get(v);if(!A||A.text!==g.text||A.isChecked!==g.isChecked){cn.set(v,g);let M=r.getId(v);O(e)({...g,id:M})}}let m=(d.input==="last"?["change"]:["input","change"]).map(v=>ne(v,O(u),t)),f=t.defaultView;if(!f)return()=>{m.forEach(v=>v())};let C=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),w=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return C&&C.set&&m.push(...w.map(v=>Tt(v[0],v[1],{set(){O(u)({target:this,isTrusted:!1})}},!1,f))),O(()=>{m.forEach(v=>v())})}function Et(e){let t=[];function r(n,o){if(gt("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||gt("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||gt("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||gt("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a)}return o}return r(e,t)}function Js(e){return e.replace(/["\\]/g,"\\$&")}function Ie(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function Xs({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:O((l,u,h)=>{let[p,m]=h,{id:f,styleId:C}=Ie(u,t,r.styleMirror);return(f&&f!==-1||C&&C!==-1)&&e({id:f,styleId:C,adds:[{rule:p,index:m}]}),l.apply(u,h)})}),n.CSSStyleSheet.prototype.addRule=function(l,u,h=this.cssRules.length){let p=`${l} { ${u} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,h])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:O((l,u,h)=>{let[p]=h,{id:m,styleId:f}=Ie(u,t,r.styleMirror);return(m&&m!==-1||f&&f!==-1)&&e({id:m,styleId:f,removes:[{index:p}]}),l.apply(u,h)})}),n.CSSStyleSheet.prototype.removeRule=function(l){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[l])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:O((l,u,h)=>{let[p]=h,{id:m,styleId:f}=Ie(u,t,r.styleMirror);return(m&&m!==-1||f&&f!==-1)&&e({id:m,styleId:f,replace:p}),l.apply(u,h)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:O((l,u,h)=>{let[p]=h,{id:m,styleId:f}=Ie(u,t,r.styleMirror);return(m&&m!==-1||f&&f!==-1)&&e({id:m,styleId:f,replaceSync:p}),l.apply(u,h)})}));let i={};yt("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(yt("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),yt("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),yt("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let d={};return Object.entries(i).forEach(([l,u])=>{d[l]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(d[l].insertRule,{apply:O((h,p,m)=>{let[f,C]=m,{id:w,styleId:v}=Ie(p.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||v&&v!==-1)&&e({id:w,styleId:v,adds:[{rule:f,index:[...Et(p),C||0]}]}),h.apply(p,m)})}),u.prototype.deleteRule=new Proxy(d[l].deleteRule,{apply:O((h,p,m)=>{let[f]=m,{id:C,styleId:w}=Ie(p.parentStyleSheet,t,r.styleMirror);return(C&&C!==-1||w&&w!==-1)&&e({id:C,styleId:w,removes:[{index:[...Et(p),f]}]}),h.apply(p,m)})})}),O(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=s,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([l,u])=>{u.prototype.insertRule=d[l].insertRule,u.prototype.deleteRule=d[l].deleteRule})})}function Fn({mirror:e,stylesheetManager:t},r){var n,o,s;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(_.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(s=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var d;return(d=i.get)==null?void 0:d.call(this)},set(d){var l;let u=(l=i.set)==null?void 0:l.call(this,d);if(a!==null&&a!==-1)try{t.adoptStyleSheets(d,a)}catch{}return u}}),O(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function qs({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:O((c,i,d)=>{var l;let[u,h,p]=d;if(r.has(u))return s.apply(i,[u,h,p]);let{id:m,styleId:f}=Ie((l=i.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||f&&f!==-1)&&e({id:m,styleId:f,set:{property:u,value:h,priority:p},index:Et(i.parentRule)}),c.apply(i,d)})});let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:O((c,i,d)=>{var l;let[u]=d;if(r.has(u))return a.apply(i,[u]);let{id:h,styleId:p}=Ie((l=i.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||p&&p!==-1)&&e({id:h,styleId:p,remove:{property:u},index:Et(i.parentRule)}),c.apply(i,d)})}),O(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function Qs({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:s}){let a=O(i=>Qe(O(d=>{let l=et(d);if(!l||oe(l,t,r,!0))return;let{currentTime:u,volume:h,muted:p,playbackRate:m,loop:f}=l;e({type:i,id:n.getId(l),currentTime:u,volume:h,muted:p,playbackRate:m,loop:f})}),o.media||500)),c=[ne("play",a(Fe.Play),s),ne("pause",a(Fe.Pause),s),ne("seeked",a(Fe.Seeked),s),ne("volumechange",a(Fe.VolumeChange),s),ne("ratechange",a(Fe.RateChange),s)];return O(()=>{c.forEach(i=>i())})}function ei({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(i,d,l){let u=new s(i,d,l);return o.set(u,{family:i,buffer:typeof d!="string",descriptors:l,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),u};let a=He(t.fonts,"add",function(c){return function(i){return setTimeout(O(()=>{let d=o.get(i);d&&(e(d),o.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=s}),n.push(a),O(()=>{n.forEach(c=>c())})}function ti(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:s}=e,a=!0,c=O(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let d=[],l=i.rangeCount||0;for(let u=0;u<l;u++){let h=i.getRangeAt(u),{startContainer:p,startOffset:m,endContainer:f,endOffset:C}=h;oe(p,n,o,!0)||oe(f,n,o,!0)||d.push({start:r.getId(p),startOffset:m,end:r.getId(f),endOffset:C})}s({ranges:d})});return c(),ne("selectionchange",c)}function ri({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:He(r.customElements,"define",function(o){return function(s,a,c){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,c])}})}function ni(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:d,styleDeclarationCb:l,canvasMutationCb:u,fontCb:h,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...f)=>{t.mutation&&t.mutation(...f),r(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),n(...f)},e.mouseInteractionCb=(...f)=>{t.mouseInteraction&&t.mouseInteraction(...f),o(...f)},e.scrollCb=(...f)=>{t.scroll&&t.scroll(...f),s(...f)},e.viewportResizeCb=(...f)=>{t.viewportResize&&t.viewportResize(...f),a(...f)},e.inputCb=(...f)=>{t.input&&t.input(...f),c(...f)},e.mediaInteractionCb=(...f)=>{t.mediaInteaction&&t.mediaInteaction(...f),i(...f)},e.styleSheetRuleCb=(...f)=>{t.styleSheetRule&&t.styleSheetRule(...f),d(...f)},e.styleDeclarationCb=(...f)=>{t.styleDeclaration&&t.styleDeclaration(...f),l(...f)},e.canvasMutationCb=(...f)=>{t.canvasMutation&&t.canvasMutation(...f),u(...f)},e.fontCb=(...f)=>{t.font&&t.font(...f),h(...f)},e.selectionCb=(...f)=>{t.selection&&t.selection(...f),p(...f)},e.customElementCb=(...f)=>{t.customElement&&t.customElement(...f),m(...f)}}function oi(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};ni(e,t);let n;e.recordDOM&&(n=Dn(e,e.doc));let o=js(e),s=$s(e),a=Pn(e),c=Ys(e,{win:r}),i=Ks(e),d=Qs(e),l=()=>{},u=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(l=Xs(e,{win:r}),u=Fn(e,e.doc),h=qs(e,{win:r}),e.collectFonts&&(p=ei(e)));let m=ti(e),f=ri(e),C=[];for(let w of e.plugins)C.push(w.observer(w.callback,r,w.options));return O(()=>{Te.forEach(w=>w.reset()),n?.disconnect(),o(),s(),a(),c(),i(),d(),l(),u(),h(),p(),m(),f(),C.forEach(w=>w())})}function gt(e){return typeof window[e]<"u"}function yt(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var At=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let s=n||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),c=s.get(r);return c||(c=this.generateIdFn(),s.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=o.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},lr=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new At(vn)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new At(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let s=this.transformCrossOriginEvent(o,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:P.IncrementalSnapshot,data:{source:N.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return r;case P.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case P.IncrementalSnapshot:switch(r.data.source){case N.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(o.node,s)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case N.Drag:case N.TouchMove:case N.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case N.ViewportResize:return!1;case N.MediaInteraction:case N.MouseInteraction:case N.Scroll:case N.CanvasMutation:case N.Input:return this.replaceIds(r.data,t,["id"]),r;case N.StyleSheetRule:case N.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case N.Font:return r;case N.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case N.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(let s of o)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==J.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},cr=class{constructor(t){y(this,"shadowDoms",new WeakSet),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Je(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=Dn({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Pn({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(_.host(t))),this.restoreHandlers.push(Fn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(He(t.prototype,"attachShadow",function(o){return function(s){let a=o.call(this,s),c=_.shadowRoot(this);return c&&On(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},We="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",si=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ze=0;Ze<We.length;Ze++)si[We.charCodeAt(Ze)]=Ze;var Ze,ii=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=We[t[r]>>2],o+=We[(t[r]&3)<<4|t[r+1]>>4],o+=We[(t[r+1]&15)<<2|t[r+2]>>6],o+=We[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o},dn=new Map;function ai(e,t){let r=dn.get(e);return r||(r=new Map,dn.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var zn=(e,t,r)=>{if(!e||!(Wn(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=ai(r,n),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function St(e,t,r){if(e instanceof Array)return e.map(n=>St(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,o=ii(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[St(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[St(e.data,t,r),e.width,e.height]};if(Wn(e,t)||typeof e=="object"){let n=e.constructor.name,o=zn(e,t,r);return{rr_type:n,index:o}}}}return e}var Un=(e,t,r)=>e.map(n=>St(n,t,r)),Wn=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function li(e,t,r,n){let o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=He(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...d){return oe(this.canvas,r,n,!0)||setTimeout(()=>{let l=Un(d,t,this);e(this.canvas,{type:Be["2D"],property:a,args:l})},0),i.apply(this,d)}});o.push(c)}catch{let c=Tt(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:Be["2D"],property:a,args:[i],setter:!0})}});o.push(c)}return()=>{o.forEach(a=>a())}}function ci(e){return e==="experimental-webgl"?"webgl":e}function un(e,t,r,n){let o=[];try{let s=He(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!oe(this,t,r,!0)){let d=ci(c);if("__context"in this||(this.__context=d),n&&["webgl","webgl2"].includes(d))if(i[0]&&typeof i[0]=="object"){let l=i[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function fn(e,t,r,n,o,s){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let d=He(e,i,function(l){return function(...u){let h=l.apply(this,u);if(zn(h,s,this),"tagName"in this.canvas&&!oe(this.canvas,n,o,!0)){let p=Un(u,s,this),m={type:t,property:i,args:p};r(this.canvas,m)}return h}});a.push(d)}catch{let d=Tt(e,i,{set(l){r(this.canvas,{type:t,property:i,args:[l],setter:!0})}});a.push(d)}return a}function di(e,t,r,n){let o=[];return o.push(...fn(t.WebGLRenderingContext.prototype,Be.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...fn(t.WebGL2RenderingContext.prototype,Be.WebGL2,e,r,n,t)),()=>{o.forEach(s=>s())}}var Bn="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",ui=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),hn=typeof window<"u"&&window.Blob&&new Blob([ui(Bn)],{type:"text/javascript;charset=utf-8"});function fi(e){let t;try{if(t=hn&&(window.URL||window.webkitURL).createObjectURL(hn),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+Bn,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var dr=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(i,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(d)});let{sampling:r="all",win:n,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,s,{dataURLOptions:c})}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(t,r,n,o,s){let a=un(r,n,o,!0),c=new Map,i=new fi;i.onmessage=m=>{let{id:f}=m.data;if(c.set(f,!1),!("base64"in m.data))return;let{base64:C,type:w,width:v,height:g}=m.data;this.mutationCb({id:f,type:Be["2D"],commands:[{property:"clearRect",args:[0,0,v,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:C}],type:w}]},0,0]}]})};let d=1e3/t,l=0,u,h=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(f=>{oe(f,n,o,!0)||m.push(f)}),m},p=m=>{if(l&&m-l<d){u=requestAnimationFrame(p);return}l=m,h().forEach(async f=>{var C;let w=this.mirror.getId(f);if(c.get(w)||f.width===0||f.height===0)return;if(c.set(w,!0),["webgl","webgl2"].includes(f.__context)){let g=f.getContext(f.__context);((C=g?.getContextAttributes())==null?void 0:C.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let v=await createImageBitmap(f);i.postMessage({id:w,bitmap:v,width:f.width,height:f.height,dataURLOptions:s.dataURLOptions},[v])}),u=requestAnimationFrame(p)};u=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=un(t,r,n,!1),s=li(this.processMutation.bind(this),t,r,n),a=di(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let o=n.map(a=>{let{type:c,...i}=a;return i}),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}},ur=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new or),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},o=[];for(let s of t){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(c,i)=>({rule:yn(c,s.href),index:i}))})),n.styleIds.push(a)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},fr=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},Y,vt,Qt,kt=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Zr=e.contentWindow)==null?void 0:Zr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ue=rs();function me(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:d=null,inlineStylesheet:l=!0,maskAllInputs:u,maskInputOptions:h,slimDOMOptions:p,maskInputFn:m,maskTextFn:f,maskAnchorHrefFn:C,blockImgSrcPattern:w=null,blockImgSrcFillOptions:v={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},hooks:g,packFn:A,sampling:M={},dataURLOptions:S={},mousemoveWait:R,recordDOM:I=!0,recordCanvas:L=!1,recordCrossOriginIframes:U=!1,recordAfter:X=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:F=!1,collectFonts:q=!1,inlineImages:H=!1,plugins:W,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:T=new Set([]),errorHandler:Z}=e;Gs(Z);let k=U?window.parent===window:!0,D=!1;if(!k)try{window.parent.document&&(D=!1)}catch{D=!0}if(k&&!t)throw new Error("emit function is required");if(!k&&!D)return()=>{};R!==void 0&&M.mousemove===void 0&&(M.mousemove=R),ue.reset();let G=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:h!==void 0?h:{password:!0},K=p===!0||p==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all",headTitleMutations:p==="all"}:p||{};Us();let te,ie=0,Q=x=>{for(let de of W||[])de.eventProcessor&&(x=de.eventProcessor(x));return A&&!D&&(x=A(x)),x};Y=(x,de)=>{var j;let $=x;if($.timestamp=Rt(),(j=Te[0])!=null&&j.isFrozen()&&$.type!==P.FullSnapshot&&!($.type===P.IncrementalSnapshot&&$.data.source===N.Mutation)&&Te.forEach(pe=>pe.unfreeze()),k)t?.(Q($),de);else if(D){let pe={type:"rrweb",event:Q($),origin:window.location.origin,isCheckout:de};window.parent.postMessage(pe,"*")}if($.type===P.FullSnapshot)te=$,ie=0;else if($.type===P.IncrementalSnapshot){if($.data.source===N.Mutation&&$.data.isAttachIframe)return;ie++;let pe=n&&ie>=n,B=r&&$.timestamp-te.timestamp>r;(pe||B)&&vt(!0)}};let Ne=x=>{Y({type:P.IncrementalSnapshot,data:{source:N.Mutation,...x}})},$e=x=>Y({type:P.IncrementalSnapshot,data:{source:N.Scroll,...x}}),xe=x=>Y({type:P.IncrementalSnapshot,data:{source:N.CanvasMutation,...x}}),Ut=x=>Y({type:P.IncrementalSnapshot,data:{source:N.AdoptedStyleSheet,...x}}),fe=new ur({mutationCb:Ne,adoptedStyleSheetCb:Ut}),he=new lr({mirror:ue,mutationCb:Ne,stylesheetManager:fe,recordCrossOriginIframes:U,wrappedEmit:Y});for(let x of W||[])x.getMirror&&x.getMirror({nodeMirror:ue,crossOriginIframeMirror:he.crossOriginIframeMirror,crossOriginIframeStyleMirror:he.crossOriginIframeStyleMirror});let Oe=new fr;Qt=new dr({recordCanvas:L,mutationCb:xe,win:window,blockClass:o,blockSelector:s,mirror:ue,sampling:M.canvas,dataURLOptions:S});let at=new cr({mutationCb:Ne,scrollCb:$e,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:d,inlineStylesheet:l,maskInputOptions:G,dataURLOptions:S,maskTextFn:f,maskInputFn:m,maskAnchorHrefFn:C,blockImgSrcPattern:w,blockImgSrcFillOptions:v,recordCanvas:L,inlineImages:H,sampling:M,slimDOMOptions:K,iframeManager:he,stylesheetManager:fe,canvasManager:Qt,keepIframeSrcFn:E,processedNodeManager:Oe},mirror:ue});vt=(x=!1)=>{if(!I)return;Y({type:P.Meta,data:{href:window.location.href,width:kn(),height:An()}},x),fe.reset(),at.init(),Te.forEach(j=>j.lock());let de=As(document,{mirror:ue,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:d,inlineStylesheet:l,maskAllInputs:G,maskTextFn:f,maskInputFn:m,maskAnchorHrefFn:C,blockImgSrcPattern:w,blockImgSrcFillOptions:v,slimDOM:K,dataURLOptions:S,recordCanvas:L,inlineImages:H,onSerialize:j=>{_n(j,ue)&&he.addIframe(j),Nn(j,ue)&&fe.trackLinkElement(j),nr(j)&&at.addShadowRoot(_.shadowRoot(j),document)},onIframeLoad:(j,$)=>{he.attachIframe(j,$),at.observeAttachShadow(j)},onStylesheetLoad:(j,$)=>{fe.attachLinkElement(j,$)},keepIframeSrcFn:E});if(!de)return console.warn("Failed to snapshot the document");Y({type:P.FullSnapshot,data:{node:de,initialOffset:En(window)}},x),Te.forEach(j=>j.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&fe.adoptStyleSheets(document.adoptedStyleSheets,ue.getId(document))};try{let x=[],de=$=>{var pe;return O(oi)({mutationCb:Ne,mousemoveCb:(B,Wt)=>Y({type:P.IncrementalSnapshot,data:{source:Wt,positions:B}}),mouseInteractionCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.MouseInteraction,...B}}),scrollCb:$e,viewportResizeCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.ViewportResize,...B}}),inputCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.Input,...B}}),mediaInteractionCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.MediaInteraction,...B}}),styleSheetRuleCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.StyleSheetRule,...B}}),styleDeclarationCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.StyleDeclaration,...B}}),canvasMutationCb:xe,fontCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.Font,...B}}),selectionCb:B=>{Y({type:P.IncrementalSnapshot,data:{source:N.Selection,...B}})},customElementCb:B=>{Y({type:P.IncrementalSnapshot,data:{source:N.CustomElement,...B}})},blockClass:o,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:d,maskInputOptions:G,inlineStylesheet:l,sampling:M,recordDOM:I,recordCanvas:L,inlineImages:H,userTriggeredOnInput:F,collectFonts:q,doc:$,maskInputFn:m,maskTextFn:f,maskAnchorHrefFn:C,blockImgSrcPattern:w,blockImgSrcFillOptions:v,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:K,dataURLOptions:S,mirror:ue,iframeManager:he,stylesheetManager:fe,shadowDomManager:at,processedNodeManager:Oe,canvasManager:Qt,ignoreCSSAttributes:T,plugins:((pe=W?.filter(B=>B.observer))==null?void 0:pe.map(B=>({observer:B.observer,options:B.options,callback:Wt=>Y({type:P.Plugin,data:{plugin:B.name,payload:Wt}})})))||[]},g)};he.addLoadListener($=>{try{x.push(de($.contentDocument))}catch(pe){console.warn(pe)}});let j=()=>{vt(),x.push(de(document)),kt=!0};return document.readyState==="interactive"||document.readyState==="complete"?j():(x.push(ne("DOMContentLoaded",()=>{Y({type:P.DomContentLoaded,data:{}}),X==="DOMContentLoaded"&&j()})),x.push(ne("load",()=>{Y({type:P.Load,data:{}}),X==="load"&&j()},window))),()=>{x.forEach($=>$()),Oe.destroy(),kt=!1,Vs()}}catch(x){console.warn(x)}}me.addCustomEvent=(e,t)=>{if(!kt)throw new Error("please add custom event after start recording");Y({type:P.Custom,data:{tag:e,payload:t}})};me.freezePage=()=>{Te.forEach(e=>e.freeze())};me.takeFullSnapshot=e=>{if(!kt)throw new Error("please take full snapshot after start recording");vt(e)};me.mirror=ue;var pn;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(pn||(pn={}));function Mt(e,t){if(!t)return;let r=new URL(e),n={};for(let[o,s]of r.searchParams)t.includes(o)&&(n[o]=s);return Object.keys(n).length>0?n:void 0}import{minimatch as mi}from"minimatch";function yr(e){throw new Error(`This code path should be unreachable: ${e}`)}function hi(e){return(e.startsWith("http://")||e.startsWith("https://"))&&(e=e.replace(/^https?:\/\//,"")),e.endsWith("/")&&(e=e.substring(0,e.length-1)),e=e.replace(/:\d+$/,""),e}function pi(e,t){if(!t||t==="")return!1;if(t==="*")return!0;let r=hi(t);return e===r}function le({urlStr:e,pathConfig:t}){let r=new URL(e),n=r.pathname,o=r.hostname,s=t.rules.filter(c=>pi(o,c.domain));if(s.length>0){let c=s.find(i=>i.path==="**");if(!c)return t.defaultAction==="allow"?r:void 0;for(let i of s){if(i.path==="**")continue;let d=Le(n,i);if(d!==void 0)switch(i.action){case"allow":return r;case"block":return;case"replace":return r.pathname=d,r;default:yr(i.action)}}return c.action==="allow"?r:void 0}let a=t.rules.filter(c=>!c.domain);for(let c of a){let i=Le(n,c);if(i!==void 0)switch(c.action){case"allow":return r;case"block":return;case"replace":return r.pathname=i,r;default:yr(c.action)}}return t.defaultAction==="allow"?r:void 0}function tt(e,t,r){let n=le({urlStr:e,pathConfig:r});n||(n=new URL(e));let o=gi(n.pathname,t.rules||[]),s=[];for(let a of n.searchParams.keys()){let c=yi(a,o?.rules||[]);switch(c){case"accept":break;case"delete":s.push(a);break;case"anonymize":n.searchParams.set(a,"*");break;default:ke(c)}}for(let a of s)n.searchParams.delete(a);if(n.pathname.includes("%3F")){let a=n.pathname.split("/");a[a.length-1]=a[a.length-1].split("%3F")[0],n.pathname=a.join("/")}return n.hash.includes("=")&&(n.hash=""),n.toString()}function gi(e,t){for(let r of t)if(Le(e,{path:r.path}))return r}function yi(e,t){for(let r of t)if(mi(e,r.param))return r.anonymizeValue?"anonymize":"accept";return"delete"}var Sr=class{constructor(t,r,n){this.org=t;this.recorder=r;this.events=[];this._estimatedByteSize=0;this.events=n,this._estimatedByteSize=this.calculateTotalSize()}get estimatedByteSize(){return this._estimatedByteSize}calculateTotalSize(){try{let t=JSON.stringify(this.events,this.getCircularReplacer());return Si(t)}catch(t){return b(`Error calculating event size: ${t}. Falling back to approximation.`),this.events.length*500}}getCircularReplacer(){let t=new WeakSet;return(r,n)=>{if(typeof n=="object"&&n!==null){if(t.has(n))return;t.add(n)}return n}}clearEvents(){this.events=[],this._estimatedByteSize=this.calculateTotalSize()}pushEvent({eventHref:t,event:r}){if(!le({urlStr:t,pathConfig:this.org.pathConfig})){b(`URL not accepted: ${t}`);return}if(!this.recorder.isRecording){b("Dropping event - recorder is not recording");return}this.events.push(r),this._estimatedByteSize=this.calculateTotalSize()}getEvents(){return this.events}},_t=class{constructor(t,r,n,o,s){this.org=t;this.eventStorage=r;this.getHref=n;this.eventStore=new Sr(t,o,s)}get estimatedSerializedByteSize(){return this.eventStore.estimatedByteSize}clear(){this.eventStore.clearEvents(),this.eventStorage.removeEvents()}getEvents(){return this.eventStore.getEvents()}onVisibilityChange(t){t||this.eventStorage.setEvents(this.getEvents())}append(t){let r=this.getHref();if(t.type===re.Meta)t.data.href=tt(t.data.href,this.org.allowedQueryParams,this.org.pathConfig),this.lastHref=this.getHref();else if(this.lastHref&&r!==this.lastHref){b(`URL changed from ${this.lastHref} to ${r}, adding artificial meta event for ${this.getHref()}`),this.eventStore.pushEvent({eventHref:r,event:Wr({href:tt(r,this.org.allowedQueryParams,this.org.pathConfig),delay:t.delay,timestamp:t.timestamp})});let n=Mt(r,this.org.customQueryParamsCohorts);n&&this.eventStore.pushEvent({eventHref:r,event:Ye({payload:{userCohorts:n,source:"query_params"},timestamp:t.timestamp,delay:t.delay})}),this.lastHref=this.getHref()}if(t.type===re.IncrementalSnapshot&&t.data.source===Ae.MouseInteraction&&t.data.type===Ht.Click){let n=me.mirror.getNode(t.data.id);if(n){let o=vi(n),s=Ur({dom0EventHandlers:o,delay:t.delay,timestamp:t.timestamp});this.eventStore.pushEvent({eventHref:r,event:s})}}this.eventStore.pushEvent({eventHref:r,event:t})}};function Si(e){return new Blob([e]).size}function vi(e){let t=[];for(let r=0;r<Gt.length;r++){let o=Gt[r];typeof e[o]=="function"&&t.push(o)}return t}var ce=Uint8Array,se=Uint16Array,st=Uint32Array,Rr=new ce([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Er=new ce([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Hn=new ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$n=function(e,t){for(var r=new se(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new st(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)o[s]=s-r[n]<<5|n;return[r,o]},Yn=$n(Rr,2),bi=Yn[0],br=Yn[1];bi[28]=258,br[258]=28;var Zn=$n(Er,0),Za=Zn[0],Gn=Zn[1],Cr=new se(32768);for(z=0;z<32768;++z)be=(z&43690)>>>1|(z&21845)<<1,be=(be&52428)>>>2|(be&13107)<<2,be=(be&61680)>>>4|(be&3855)<<4,Cr[z]=((be&65280)>>>8|(be&255)<<8)>>>1;var be,z,ot=function(e,t,r){for(var n=e.length,o=0,s=new se(t);o<n;++o)++s[e[o]-1];var a=new se(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;var c;if(r){c=new se(1<<t);var i=15-t;for(o=0;o<n;++o)if(e[o])for(var d=o<<4|e[o],l=t-e[o],u=a[e[o]-1]++<<l,h=u|(1<<l)-1;u<=h;++u)c[Cr[u]>>>i]=d}else for(c=new se(n),o=0;o<n;++o)c[o]=Cr[a[e[o]-1]++]>>>15-e[o];return c},_e=new ce(288);for(z=0;z<144;++z)_e[z]=8;var z;for(z=144;z<256;++z)_e[z]=9;var z;for(z=256;z<280;++z)_e[z]=7;var z;for(z=280;z<288;++z)_e[z]=8;var z,Nt=new ce(32);for(z=0;z<32;++z)Nt[z]=5;var z,Ci=ot(_e,9,0);var wi=ot(Nt,5,0);var Kn=function(e){return(e/8>>0)+(e&7&&1)},Jn=function(e,t,r){(r==null||r>e.length)&&(r=e.length);var n=new(e instanceof se?se:e instanceof st?st:ce)(r-t);return n.set(e.subarray(t,r)),n};var Ce=function(e,t,r){r<<=t&7;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8},rt=function(e,t,r){r<<=t&7;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},vr=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var o=r.length,s=r.slice();if(!o)return[new ce(0),0];if(o==1){var a=new ce(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(M,S){return M.f-S.f}),r.push({s:-1,f:25001});var c=r[0],i=r[1],d=0,l=1,u=2;for(r[0]={s:-1,f:c.f+i.f,l:c,r:i};l!=o-1;)c=r[r[d].f<r[u].f?d++:u++],i=r[d!=l&&r[d].f<r[u].f?d++:u++],r[l++]={s:-1,f:c.f+i.f,l:c,r:i};for(var h=s[0].s,n=1;n<o;++n)s[n].s>h&&(h=s[n].s);var p=new se(h+1),m=wr(r[l-1],p,0);if(m>t){var n=0,f=0,C=m-t,w=1<<C;for(s.sort(function(S,R){return p[R.s]-p[S.s]||S.f-R.f});n<o;++n){var v=s[n].s;if(p[v]>t)f+=w-(1<<m-p[v]),p[v]=t;else break}for(f>>>=C;f>0;){var g=s[n].s;p[g]<t?f-=1<<t-p[g]++-1:++n}for(;n>=0&&f;--n){var A=s[n].s;p[A]==t&&(--p[A],++f)}m=t}return[new ce(p),m]},wr=function(e,t,r){return e.s==-1?Math.max(wr(e.l,t,r+1),wr(e.r,t,r+1)):t[e.s]=r},Vn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new se(++t),n=0,o=e[0],s=1,a=function(i){r[n++]=i},c=1;c<=t;++c)if(e[c]==o&&c!=t)++s;else{if(!o&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(o),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(o);s=1,o=e[c]}return[r.subarray(0,n),t]},nt=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Ir=function(e,t,r){var n=r.length,o=Kn(t+2);e[o]=n&255,e[o+1]=n>>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var s=0;s<n;++s)e[o+s+4]=r[s];return(o+4+n)*8},jn=function(e,t,r,n,o,s,a,c,i,d,l){Ce(t,l++,r),++o[256];for(var u=vr(o,15),h=u[0],p=u[1],m=vr(s,15),f=m[0],C=m[1],w=Vn(h),v=w[0],g=w[1],A=Vn(f),M=A[0],S=A[1],R=new se(19),I=0;I<v.length;++I)R[v[I]&31]++;for(var I=0;I<M.length;++I)R[M[I]&31]++;for(var L=vr(R,7),U=L[0],X=L[1],F=19;F>4&&!U[Hn[F-1]];--F);var q=d+5<<3,H=nt(o,_e)+nt(s,Nt)+a,W=nt(o,h)+nt(s,f)+a+14+3*F+nt(R,U)+(2*R[16]+3*R[17]+7*R[18]);if(q<=H&&q<=W)return Ir(t,l,e.subarray(i,i+d));var E,T,Z,k;if(Ce(t,l,1+(W<H)),l+=2,W<H){E=ot(h,p,0),T=h,Z=ot(f,C,0),k=f;var D=ot(U,X,0);Ce(t,l,g-257),Ce(t,l+5,S-1),Ce(t,l+10,F-4),l+=14;for(var I=0;I<F;++I)Ce(t,l+3*I,U[Hn[I]]);l+=3*F;for(var G=[v,M],K=0;K<2;++K)for(var te=G[K],I=0;I<te.length;++I){var ie=te[I]&31;Ce(t,l,D[ie]),l+=U[ie],ie>15&&(Ce(t,l,te[I]>>>5&127),l+=te[I]>>>12)}}else E=Ci,T=_e,Z=wi,k=Nt;for(var I=0;I<c;++I)if(n[I]>255){var ie=n[I]>>>18&31;rt(t,l,E[ie+257]),l+=T[ie+257],ie>7&&(Ce(t,l,n[I]>>>23&31),l+=Rr[ie]);var Q=n[I]&31;rt(t,l,Z[Q]),l+=k[Q],Q>3&&(rt(t,l,n[I]>>>5&8191),l+=Er[Q])}else rt(t,l,E[n[I]]),l+=T[n[I]];return rt(t,l,E[256]),l+T[256]},Ii=new st([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ri=function(e,t,r,n,o,s){var a=e.length,c=new ce(n+a+5*(1+Math.floor(a/7e3))+o),i=c.subarray(n,c.length-o),d=0;if(!t||a<8)for(var l=0;l<=a;l+=65535){var u=l+65535;u<a?d=Ir(i,d,e.subarray(l,u)):(i[l]=s,d=Ir(i,d,e.subarray(l,a)))}else{for(var h=Ii[t-1],p=h>>>13,m=h&8191,f=(1<<r)-1,C=new se(32768),w=new se(f+1),v=Math.ceil(r/3),g=2*v,A=function(x){return(e[x]^e[x+1]<<v^e[x+2]<<g)&f},M=new st(25e3),S=new se(288),R=new se(32),I=0,L=0,l=0,U=0,X=0,F=0;l<a;++l){var q=A(l),H=l&32767,W=w[q];if(C[H]=W,w[q]=H,X<=l){var E=a-l;if((I>7e3||U>24576)&&E>423){d=jn(e,i,0,M,S,R,L,U,F,l-F,d),U=I=L=0,F=l;for(var T=0;T<286;++T)S[T]=0;for(var T=0;T<30;++T)R[T]=0}var Z=2,k=0,D=m,G=H-W&32767;if(E>2&&q==A(l-G))for(var K=Math.min(p,E)-1,te=Math.min(32767,l),ie=Math.min(258,E);G<=te&&--D&&H!=W;){if(e[l+Z]==e[l+Z-G]){for(var Q=0;Q<ie&&e[l+Q]==e[l+Q-G];++Q);if(Q>Z){if(Z=Q,k=G,Q>K)break;for(var Ne=Math.min(G,Q-2),$e=0,T=0;T<Ne;++T){var xe=l-G+T+32768&32767,Ut=C[xe],fe=xe-Ut+32768&32767;fe>$e&&($e=fe,W=xe)}}}H=W,W=C[H],G+=H-W+32768&32767}if(k){M[U++]=268435456|br[Z]<<18|Gn[k];var he=br[Z]&31,Oe=Gn[k]&31;L+=Rr[he]+Er[Oe],++S[257+he],++R[Oe],X=l+Z,++I}else M[U++]=e[l],++S[e[l]]}}d=jn(e,i,s,M,S,R,L,U,F,l-F,d)}return Jn(c,0,n+Kn(d)+o)},Ei=function(){var e=1,t=0;return{p:function(r){for(var n=e,o=t,s=r.length,a=0;a!=s;){for(var c=Math.min(a+5552,s);a<c;++a)n+=r[a],o+=n;n%=65521,o%=65521}e=n,t=o},d:function(){return(e>>>8<<16|(t&255)<<8|t>>>8)+((e&255)<<23)*2}}},Ai=function(e,t,r,n,o){return Ri(e,t.level==null?6:t.level,t.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):12+t.mem,r,n,!o)},ki=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},Ti=function(e,t){var r=t.level,n=r==0?0:r<6?1:r==9?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1)};function Xn(e,t){t===void 0&&(t={});var r=Ei();r.p(e);var n=Ai(e,t,2,4);return Ti(n,t),ki(n,n.length-4,r.d()),n}function Ar(e,t){var r=e.length;if(!t&&typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var n=new ce(e.length+(e.length>>>1)),o=0,s=function(d){n[o++]=d},a=0;a<r;++a){if(o+5>n.length){var c=new ce(o+8+(r-a<<1));c.set(n),n=c}var i=e.charCodeAt(a);i<128||t?s(i):i<2048?(s(192|i>>>6),s(128|i&63)):i>55295&&i<57344?(i=65536+(i&1047552)|e.charCodeAt(++a)&1023,s(240|i>>>18),s(128|i>>>12&63),s(128|i>>>6&63),s(128|i&63)):(s(224|i>>>12),s(128|i>>>6&63),s(128|i&63))}return Jn(n,0,o)}function kr(e,t){var r="";if(!t&&typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var n=0;n<e.length;){var o=e[n++];o<128||t?r+=String.fromCharCode(o):o<224?r+=String.fromCharCode((o&31)<<6|e[n++]&63):o<240?r+=String.fromCharCode((o&15)<<12|(e[n++]&63)<<6|e[n++]&63):(o=((o&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,r+=String.fromCharCode(55296|o>>10,56320|o&1023))}return r}var Tr="v1";var Mr=e=>{let t={...e,v:Tr};return kr(Xn(Ar(JSON.stringify(t))),!0)};function qn(e){let t=new URL(e),r={};for(let[n,o]of t.searchParams)switch(n){case"utm_source":case"utm_medium":case"utm_campaign":case"utm_term":case"utm_content":r[`UTM@@${n}`]=o;break}return Object.keys(r).length>0?r:void 0}var Qn=3*1024*1024,eo=5e3,xt=class{constructor(t,r,n,o,s,a,c){this.window=t;this.storage=r;this.eventHolder=n;this.recorder=o;this.api=s;this.organization=a;this.windowGetters=c;this.lastSendTime=-1;this.lastAutoCohorts=void 0;this.fastpathToken=void 0;o.setOnEvent(i=>this.onEvent(i))}onEvent(t){if(t.type===re.FullSnapshot){let s,a=ht(this.window,this.organization.cohortsBootstrapConfig),c=qn(this.windowGetters.getHref()),i=Mt(this.windowGetters.getHref(),this.organization.customQueryParamsCohorts),d=$t(this.window);this.lastAutoCohorts=d,(c||a||d||i)&&(s=Ye({payload:{userCohorts:{...a||{},...d||{},...c||{},...i||{}},source:"window_getters"},delay:t.delay,timestamp:t.timestamp}));let l=s?[...this.eventHolder.getEvents(),s,t]:[...this.eventHolder.getEvents(),t];this.clearAndSaveEvents(l);return}else if(t.type===re.IncrementalSnapshot&&t.data.source===Ae.Mutation){let s=$t(this.window);s&&(!this.lastAutoCohorts||Object.keys(s).length!==Object.keys(this.lastAutoCohorts).length)&&(b("auto cohorts different, appending new event",s),this.eventHolder.append(Ye({payload:{userCohorts:s,source:"window_getters"},delay:t.delay,timestamp:t.timestamp}))),this.lastAutoCohorts=s}this.eventHolder.append(t);let r=this.eventHolder.estimatedSerializedByteSize,o=Date.now()-this.lastSendTime;r>Qn&&o>=eo&&(b(`MAX_EVENT_BYTE_SIZE and timeSinceLastSend exceeded: ${r} > ${Qn} and ${o} >= ${eo}`),this.clearAndSaveEvents())}async clearAndSaveEvents(t){let r=this.windowGetters.getHref();if(!le({urlStr:r,pathConfig:this.organization.pathConfig}))return;let n=t||this.eventHolder.getEvents();if(n.length!==0){this.eventHolder.clear();try{b("saving events...");let o=await this.prepareAndSendEvents(n);switch(b("save events result",o.type),o.type){case"success":break;case"recreate-session":await this.recreateSession(o.session);break;case"no-session":case"unknown-failure":case"rate-limit-exceeded":this.storage.removeSession(),this.eventHolder.clear();break;default:ke(o)}}catch(o){throw b("error saving events",o),this.storage.removeSession(),o}}}async prepareAndSendEvents(t){this.lastSendTime=Date.now();let r=this.storage.getSession();if(!r)return{type:"no-session"};if(r.eventPostUrl&&r.eventPostToken){let s=JSON.parse(atob(r.eventPostToken.split(".")[1]));if(s&&Date.now()>s.lastEventAt-10*1e3){b("refreshing token as it is about to expire");let a=await this.refreshToken(r);if(a.type!=="success")return a;if(r=this.storage.getSession(),!r)return{type:"no-session"}}}let n=r.compressionType==="RRWEB_PACK"?t.map(s=>Mr(s)):t,o=await this.api.saveSessionEvents({sessionId:r.id,events:n,metadata:{url:tt(this.windowGetters.getHref(),this.organization.allowedQueryParams,this.organization.pathConfig)},eventPostUrl:r.eventPostUrl,eventPostToken:r.eventPostToken,fastpathToken:this.fastpathToken});if(!o)return{type:"unknown-failure"};if(o.error)switch(o.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:r};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}if(!o.data)return{type:"unknown-failure"};if(o.data&&"code"in o.data)switch(o.data.code){case"TOKEN_REFRESH":{b("refreshing token as it expired on the worker");let s=await this.refreshToken(r);return s.type!=="success"?s:this.prepareAndSendEvents(t)}default:ke(o.data.code)}if(this.fastpathToken=o.data.fastpathToken,o.response.status<200||o.response.status>201)throw new Error(`got status ${o.response.status}`);return{type:"success"}}async refreshToken(t){let r=await this.api.refreshEventToken({sessionId:t.id});if(!r)return{type:"unknown-failure"};if(r.error)switch(r.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:t};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}return r.data?(this.storage.setSession({...t,eventPostToken:r.data.token}),{type:"success"}):{type:"unknown-failure"}}async recreateSession(t){b("recreating sessions");let r=this.recorder.isRecording;this.recorder.setRecording(!1),this.storage.removeSession(),this.fastpathToken=void 0;try{b("recreating session...");let n=await this.api.startSession({orgId:t.settings.orgId,language:t.settings.language||this.windowGetters.getLanguage(),domain:new URL(this.windowGetters.getHref()).hostname,userCohorts:t.settings.userCohorts||{},uid:t.settings.uid,devicePixelRatio:this.windowGetters.getDevicePixelRatio(),adoraUserId:t.adoraUserId,documentReferrer:t.documentReferrer,snippetVersion:ft});if(!n||n.error)return;if(n.response.status!==201){b("session not created, aborting");return}if(!n.data||!("session"in n.data)){b("malformed session, exiting");return}let o=ut(n.data),s=Vr(t,o);this.storage.setSession(s),this.eventHolder.clear(),r&&this.recorder.setRecording(!0)}catch{}}};var Lt=class{constructor(t){this._options=t;this._buckets={};this._refillBuckets=()=>{Object.keys(this._buckets).forEach(t=>{let r=this._getBucket(t)+this._refillRate;r>=this._bucketSize?delete this._buckets[t]:this._setBucket(t,r)})};this._getBucket=t=>this._buckets[String(t)];this._setBucket=(t,r)=>{this._buckets[String(t)]=r};this.consumeRateLimit=t=>{let r=this._getBucket(t)??this._bucketSize;if(r=Math.max(r-1,0),r===0)return!0;this._setBucket(t,r);let n=r===0;return n&&this._onBucketRateLimited?.(t),n};this._onBucketRateLimited=this._options._onBucketRateLimited,this._bucketSize=Ot(this._options.bucketSize,0,100),this._refillRate=Ot(this._options.refillRate,0,this._bucketSize),this._refillInterval=Ot(this._options.refillInterval,0,864e5),this._removeInterval=setInterval(()=>{this._refillBuckets()},this._refillInterval)}stop(){this._removeInterval&&(clearInterval(this._removeInterval),this._removeInterval=void 0)}};function Ot(e,t,r,n){return t>r&&(t=r),Mi(e)?e>r?r:e<t?t:e:Ot(n||r,t,r)}var Mi=e=>toString.call(e)==="[object Number]";var Dt=class{constructor(t,r={}){this._rrweb=t;this._options=r;this._loggedTracker={};this._onNodeRateLimited=t=>{if(!this._loggedTracker[t]){this._loggedTracker[t]=!0;let r=this._getNode(t);this._options.onBlockedNode?.(t,r)}};this._getNodeOrRelevantParent=t=>{let r=this._getNode(t);if(r?.nodeName!=="svg"&&r instanceof Element){let n=r.closest("svg");if(n)return[this._rrweb.mirror.getId(n),n]}return[t,r]};this._getNode=t=>this._rrweb.mirror.getNode(t);this._numberOfChanges=t=>(t.removes?.length??0)+(t.attributes?.length??0)+(t.texts?.length??0)+(t.adds?.length??0);this.throttleMutations=t=>{if(t.type!==re.IncrementalSnapshot||t.data.source!==Ae.Mutation)return t;let r=t.data,n=this._numberOfChanges(r);r.attributes&&(r.attributes=r.attributes.filter(s=>{let[a]=this._getNodeOrRelevantParent(s.id);return this._rateLimiter.consumeRateLimit(a)?!1:s}));let o=this._numberOfChanges(r);if(!(o===0&&n!==o))return t};this._rateLimiter=new Lt({bucketSize:this._options.bucketSize??100,refillRate:this._options.refillRate??10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}};var Ge,to=()=>{if(Ge!==void 0)return Ge;try{return Ge=document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")===0,b("adora script - isWebpSupported? - ",Ge),Ge}catch{return Ge=!1,!1}};var Pt=class{constructor(t,r,n,o){this.limitedCanvasRecording=t;this.canvasRecordingEnabled=r;this.org=n;this.rrwebRecorder=o;this.startable=!0;b("new recorder")}setOnEvent(t){this.onEvent=t}get args(){let t=this.org.blockedCSSClasses.length>0?`|(${this.org.blockedCSSClasses.join(")|(")})`:"",r=this.org.maskedCSSClasses&&this.org.maskedCSSClasses?.length>0?`|(${this.org.maskedCSSClasses?.join(")|(")})`:"",n=to()?"image/webp":this.limitedCanvasRecording?"image/jpeg":"image/png";return{emit:o=>{if(!this.onEvent)throw new Error("onEvent must be assigned before starting recording");o.type===re.FullSnapshot&&this.mutationThrottler?.reset();let s=this.mutationThrottler?this.mutationThrottler.throttleMutations(o):o;s&&this.onEvent(s)},userTriggeredOnInput:!0,blockClass:new RegExp(`(adora-block)|(rr-block|fs-exclude|ph-no-capture)${t}`),blockSelector:"[data-adora-block]",maskTextClass:new RegExp(`(adora-mask)|(rr-mask|fs-mask)${r}`),maskAllInputs:!0,maskInputFn:(o,s)=>ro(this.org,s)?o:"*".repeat(o.length),maskTextFn:(o,s)=>s&&this.org.maskByDefault&&s.closest('button,a,div[role="button"],div[role*="menuitem"],input[type="button"],input[type="submit"],input[type="reset"]')||s&&ro(this.org,s)?o:o.replace(/[\S]/g,"*"),maskTextSelector:this.org?.maskByDefault?"*":'[data-adora-masking="true"]',recordCanvas:this.canvasRecordingEnabled,sampling:this.canvasRecordingEnabled?{canvas:this.limitedCanvasRecording?1:2}:void 0,dataURLOptions:this.canvasRecordingEnabled?{type:n,quality:.6}:{}}}recordChangeCustomCohort(t){b("sending custom cohort change",t),this.rrwebRecorder.addCustomEvent(zr,t)}recordCLS(t){this.rrwebRecorder.addCustomEvent("CLS",t)}recordINP(t){this.rrwebRecorder.addCustomEvent("INP",t)}recordLCP(t){this.rrwebRecorder.addCustomEvent("LCP",t)}recordVisibilityChange(t){this.rrwebRecorder.addCustomEvent("Adora.VisibilityChange",{visibilityState:t})}recordFocusChange(t){this.rrwebRecorder.addCustomEvent("Adora.FocusChange",{focusState:t})}get isRecording(){return this.rrwebRecorder.isRecording}setRecording(t){if(b("setRecording",`requested status: ${t}`,`current status ${this.rrwebRecorder.isRecording}`),this.rrwebRecorder.isRecording!==t){if(t){this.startRecording();return}this.stopRecording()}}startRecording(){if(this.isRecording)throw new Error("recording already in progress!");if(!this.startable){b("recorder is not startable, returning");return}this.mutationThrottler=new Dt(this.rrwebRecorder,{bucketSize:100,refillRate:10,onBlockedNode:(t,r)=>{b("mutation throttler blocked node",{id:t,node:r})}}),this.rrwebRecorder.record(this.args)}stopRecording(){this.mutationThrottler?.stop(),this.mutationThrottler=void 0,this.rrwebRecorder.stop()}stopFutureRecordings(){this.startable=!1}};function ro(e,t){if(t.classList.contains("adora-unmask"))return!0;for(let r of e.unmaskSelectors)if(Array.from(document.querySelectorAll(r)).find(n=>n===t))return!0;return!1}var Ft=class{constructor(){this._isRecording=!1}get isRecording(){return this._isRecording}get mirror(){return me.mirror}record(t){if(b("record",{stopFn:typeof this.stopFn,isRecording:this._isRecording}),this.stopFn!==void 0&&this.stop(),this._isRecording=!0,this.stopFn=me(t),!this.stopFn)throw new Error("recorder could not successfully start")}stop(){this._isRecording=!1,this.stopFn&&(this.stopFn(),this.stopFn=void 0)}addCustomEvent(t,r){if(!this._isRecording)return b("WARNING! attempting to add custom event with recording off"),!1;try{me.addCustomEvent(t,r)}catch(n){return b("trying to record an event even though",n),!1}return!0}};var no=5e3;function oo({sessionType:e}){b("initialize recording");let t=new we(e,new Se),r=t.getSession();if(!r)return;let n=new ye(r.settings.backendUrl),o=new dt(e,new Se),s=o.getEvents();o.removeEvents();let a=()=>window.location.href,c=()=>window.navigator.language,i=()=>window.devicePixelRatio,d=new Ft,l=new Pt(r.limitedCanvasRecording??!1,r.canvasRecordingEnabled??!1,r.organization,d),u=new _t(r.organization,o,a,l,s||[]),h=new xt(window,t,u,l,n,r.organization,{getHref:a,getLanguage:c,getDevicePixelRatio:i}),p=window.location.href;le({urlStr:p,pathConfig:r.organization.pathConfig})?(b("starting recording..."),l.setRecording(!0)):b("recording did not start as current URL is blocked");let m=ht(window,r.organization.cohortsBootstrapConfig);l.isRecording&&(l.recordChangeCustomCohort({uid:r.settings.uid,userCohorts:r.settings.userCohorts?{...m,...r.settings.userCohorts}:{}}),t.setSession(r)),Ve.onCLS(A=>{l.isRecording&&l.recordCLS(A)}),Ve.onINP(A=>{l.isRecording&&l.recordINP(A)}),Ve.onLCP(A=>{l.isRecording&&l.recordLCP(A)});let f=()=>{h.clearAndSaveEvents(u.getEvents())},C=window.setInterval(f,no);window.addEventListener("blur",()=>{l.recordFocusChange("blur")}),window.addEventListener("focus",()=>{l.recordFocusChange("focus")}),document.addEventListener("visibilitychange",()=>{if(b(`detected a visibility change to ${document.visibilityState}`),l.isRecording&&l.recordVisibilityChange(document.visibilityState),document.visibilityState==="hidden"){C&&(b("clearing the saveInterval"),clearInterval(C),C=void 0),u.onVisibilityChange(!1);return}C||(b("resuming the saveInterval"),C=window.setInterval(f,no))});let w=p,v=new MutationObserver(()=>{if(u&&window.location.href!==w){let A=le({urlStr:window.location.href,pathConfig:r.organization.pathConfig});b(`url changed detected, status: ${!!A}`),l.setRecording(!!A),w=window.location.href}});return v.observe(document,{subtree:!0,childList:!0}),{recorder:l,eventSync:h,urlChangeObserverDispose:()=>{v.disconnect()}}}var so=e=>oo(e);var je=!1,io="_adora_user_id",ao="_adora_rate_limited",ge,it,_r="stopped",lo=()=>{b("startRecording",`adoraIsRunning: ${je}`),_r==="started"&&(ge=so({sessionType:"adoraSessionScript"}))},co=1e3*60*30,oc=async({userCohorts:e,...t})=>{let r=t;if(_r="started",b("adora start",{adoraIsRunning:je,uid:r.uid,userCohorts:e||{}}),typeof window.sessionStorage!="object"){b("SSR detected");return}if(e){r.userCohorts={};for(let[i,d]of Object.entries(e))d!==void 0?(b("setting user cohorts key",{key:i,value:d}),r.userCohorts[i]=d):b("found undefined user cohorts key",{key:i})}let n=new we("adoraSessionScript",new Se),o=n.getSession();if(o){b("session detected; finding if changes should be written");let i=!1;if(r.uid&&o.settings.uid!==r.uid&&(b("detected uid change"),o.settings.uid=r.uid,n.setSession(o),i=!0),r.userCohorts&&Object.keys(r.userCohorts).length>0){b("detected user cohorts");let d=structuredClone(o.settings.userCohorts);_i(d,r.userCohorts)||(b("detected user cohorts have been changed"),o.settings.userCohorts=r.userCohorts,n.setSession(o),i=!0)}i&&ge?.recorder&&ge?.recorder.isRecording&&(b("writing cohort change to recorder"),ge?.recorder.recordChangeCustomCohort({uid:o.settings.uid,userCohorts:o.settings.userCohorts?{...o.settings.userCohorts}:{}}))}if(je===!0)return;je=!0;let s=n.lastRateLimitedTimestamp;if(s!==void 0){if(Date.now()-s<co){b("exiting as the session has been rate limited recently");return}n.clearLastRateLimitedTimestamp()}if(zt.get(ao)){b("exiting as the domain has been rate limited recently");return}if(o){b("start recording for existing session"),lo();return}let a=!1,c=async(i,d)=>{if(b("start status",{started:a}),a)return;a=!0;let l=await jr("adoraSessionScript",d,r);if(l.type==="error"){l.code==="RateLimitExceeded"&&(b("setting expiration on local storage"),n.setLastRateLimitedTimestamp(Date.now()),i&&(b("setting expiration cookie"),zt.set(ao,i,{expires:new Date(Date.now()+co),domain:i})));return}lo()};b("launching session preload");try{let i=await new ye(r.backendUrl).sessionPreload({orgId:r.orgId});b("session preload resolved");let d=window.location.href;if(i){if(i.error){b("error preloading",i.error);return}let l=Hr(i.data);if("scheduledDowntime"in l){b("scheduled downtime; exiting");return}let{organization:u}=l;b("session preload success");let h=zt.get(io),p;b("existing adora user id cookie:",h);for(let m of u.cookieDomains)(window.location.hostname.toLowerCase()===m||window.location.hostname.toLowerCase().endsWith(`.${m}`))&&(p=m,h||(h=Ni(),zt.set(io,h,{domain:m,expires:new Date(Date.now()+365*24*60*60*1e3)}),b("setting adoraUserId cookie on domain",h)));b("using adora user id:",h),le({urlStr:d,pathConfig:u.pathConfig})?(b("at an unblocked URL, starting adora"),await c(p,h)):(b("at an blocked URL, waiting for unblocked URL to start adora"),it&&it.disconnect(),it=new MutationObserver((m,f)=>{if(d!==window.location.href){let C=window.location.href,w=le({urlStr:C,pathConfig:u.pathConfig});if(b(`url changed detected during blocked state, status: ${!!w}`),w){b("disconnecting observer"),f.disconnect(),b("scheduling adora to start"),c(p,h);return}d=C}}),it.observe(document,{subtree:!0,childList:!0}))}}catch(i){b("Error in adoraStart:",i)}},sc=async()=>{_r="stopped",b("adora stop",{adoraIsRunning:je}),ge&&(ge.recorder.setRecording(!1),ge.recorder.stopFutureRecordings(),ge.urlChangeObserverDispose(),await ge.eventSync.clearAndSaveEvents()),it?.disconnect(),je=!1,ge=void 0};export{je as adoraIsRunning,oc as adoraStart,sc as adoraStop};
3
+ or you can use record.mirror to access the mirror instance during recording.`,en={map:{},getId(){return console.error(Pe),-1},getNode(){return console.error(Pe),null},removeNodeFromMap(){console.error(Pe)},has(){return console.error(Pe),!1},reset(){console.error(Pe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(en=new Proxy(en,{get(e,t,r){return t==="map"&&console.error(Pe),Reflect.get(e,t,r)}}));function qe(e,t,r={}){let n=null,o=0;return function(...s){let a=Date.now();!o&&r.leading===!1&&(o=a);let c=t-(a-o),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),o=a,e.apply(i,s)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(i,s)},c))}}function kt(e,t,r,n,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>kt(e,t,s||{},!0)}function He(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var Rt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Rt=()=>new Date().getTime());function wn(e){var t,r,n,o;let s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=M.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((n=M.parentElement(s.body))==null?void 0:n.scrollTop)||((o=s?.body)==null?void 0:o.scrollTop)||0}}function In(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Rn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function En(e){return e?e.nodeType===e.ELEMENT_NODE?e:M.parentElement(e):null}function ne(e,t,r,n){if(!e)return!1;let o=En(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(It(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function Ps(e,t){return t.getId(e)!==-1}function Xt(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Je}function Tn(e,t){if(Ze(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=M.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Tn(n,t):!0}function er(e){return!!e.changedTouches}function Fs(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function An(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function kn(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function tr(e){return e?e instanceof Qt&&"shadowRoot"in e?!!e.shadowRoot:!!M.shadowRoot(e):!1}var rr=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function _n(e){var t;let r=null;return"getRootNode"in e&&((t=M.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&M.host(M.getRootNode(e))&&(r=M.host(M.getRootNode(e))),r}function Us(e){let t=e,r;for(;r=_n(t);)t=r;return t}function zs(e){let t=e.ownerDocument;if(!t)return!1;let r=Us(e);return M.contains(t,r)}function Mn(e){let t=e.ownerDocument;return t?M.contains(t,e)||zs(e):!1}var P=(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))(P||{}),N=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(N||{}),ae=(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))(ae||{}),Se=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Se||{}),Be=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Be||{}),Fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Fe||{});function tn(e){return"__ln"in e}var nr=class{constructor(){y(this,"length",0),y(this,"head",null),y(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&tn(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&tn(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},rn=(e,t)=>`${e}@${t}`,or=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"maskAnchorHrefFn"),y(this,"blockImgSrcPattern"),y(this,"blockImgSrcFillOptions"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"canvasManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new nr,o=i=>{let d=i,l=Je;for(;l===Je;)d=d&&d.nextSibling,l=d&&this.mirror.getId(d);return l},s=i=>{let d=M.parentNode(i);if(!d||!Mn(i))return;let l=!1;if(i.nodeType===Node.TEXT_NODE){let m=d.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(d)&&(l=!0)}let u=Ze(d)?this.mirror.getId(_n(i)):this.mirror.getId(d),f=o(i);if(u===-1||f===-1)return n.addNode(i);let p=ze(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAnchorHrefFn:this.maskAnchorHrefFn,blockImgSrcPattern:this.blockImgSrcPattern,blockImgSrcFillOptions:this.blockImgSrcFillOptions,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{An(m,this.mirror)&&this.iframeManager.addIframe(m),kn(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),tr(i)&&this.shadowDomManager.addShadowRoot(M.shadowRoot(i),this.doc)},onIframeLoad:(m,h)=>{this.iframeManager.attachIframe(m,h),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,h)=>{this.stylesheetManager.attachLinkElement(m,h)},cssCaptured:l});p&&(t.push({parentId:u,nextId:f,node:p}),r.add(p.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let i of this.movedSet)nn(this.removes,i,this.mirror)&&!this.movedSet.has(M.parentNode(i))||s(i);for(let i of this.addedSet)!on(this.droppedSet,i)&&!nn(this.removes,i,this.mirror)||on(this.movedSet,i)?s(i):this.droppedSet.add(i);let a=null;for(;n.length;){let i=null;if(a){let d=this.mirror.getId(M.parentNode(a.value)),l=o(a.value);d!==-1&&l!==-1&&(i=a)}if(!i){let d=n.tail;for(;d;){let l=d;if(d=d.previous,l){let u=this.mirror.getId(M.parentNode(l.value));if(o(l.value)===-1)continue;if(u!==-1){i=l;break}else{let p=l.value,m=M.parentNode(p);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=M.host(m);if(this.mirror.getId(h)!==-1){i=l;break}}}}}}if(!i){for(;n.head;)n.removeNode(n.head.value);break}a=i.previous,n.removeNode(i.value),s(i.value)}let c={texts:this.texts.map(i=>{let d=i.node,l=M.parentNode(d);return l&&l.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(l),{id:this.mirror.getId(d),value:i.value}}).filter(i=>!r.has(i.id)).filter(i=>this.mirror.has(i.id)),attributes:this.attributes.map(i=>{let{attributes:d}=i;if(typeof d.style=="string"){let l=JSON.stringify(i.styleDiff),u=JSON.stringify(i._unchangedStyles);l.length<d.style.length&&(l+u).split("var(").length===d.style.split("var(").length&&(d.style=i.styleDiff)}return{id:this.mirror.getId(i.node),attributes:d}}).filter(i=>!r.has(i.id)).filter(i=>this.mirror.has(i.id)),removes:this.removes,adds:t};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(c))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=r.attributes.value=Array.from(M.childNodes(t),o=>M.textContent(o)||"").join("");r.attributes.value=Ct({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:null,value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!Xt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=M.textContent(t.target);!ne(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Sn(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,En(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,o=t.target.getAttribute(n);if(n==="value"){let c=hr(r);o=Ct({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn})}let s=ne(t.target,this.blockClass,this.blockSelector,!1);if(s&&n==="style"){let c=t.target,{width:i,height:d}=c.getBoundingClientRect(),l=this.attributeMap.get(t.target);l||(l={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(l),this.attributeMap.set(t.target,l)),l.attributes.rr_width=`${i}px`,l.attributes.rr_height=`${d}px`}if(s||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!vn(r.tagName,n))if(a.attributes[n]=yn(this.doc,ke(r.tagName),ke(n),o),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let d=r.style.getPropertyValue(i),l=r.style.getPropertyPriority(i);d!==c.style.getPropertyValue(i)||l!==c.style.getPropertyPriority(i)?l===""?a.styleDiff[i]=d:a.styleDiff[i]=[d,l]:a._unchangedStyles[i]=[d,l]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(ne(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),o=Ze(t.target)?this.mirror.getId(M.host(t.target)):this.mirror.getId(t.target);ne(t.target,this.blockClass,this.blockSelector,!1)||Xt(r,this.mirror,this.slimDOMOptions)||!Ps(r,this.mirror)||(this.addedSet.has(r)?(sr(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Tn(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[rn(n,o)]?sr(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:Ze(t.target)&&Ke(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Xt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[rn(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ne(t,this.blockClass,this.blockSelector,!1)||(M.childNodes(t).forEach(n=>this.genAdds(n)),tr(t)&&M.childNodes(M.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAnchorHrefFn","blockImgSrcPattern","blockImgSrcFillOptions","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 sr(e,t){e.delete(t),M.childNodes(t).forEach(r=>sr(e,r))}function nn(e,t,r){return e.length===0?!1:Ws(e,t,r)}function Ws(e,t,r){let n=M.parentNode(t);for(;n;){let o=r.getId(n);if(e.some(s=>s.id===o))return!0;n=M.parentNode(n)}return!1}function on(e,t){return e.size===0?!1:Nn(e,t)}function Nn(e,t){let r=M.parentNode(t);return r?e.has(r)?!0:Nn(e,r):!1}var Xe;function Bs(e){Xe=e}function Hs(){Xe=void 0}var O=e=>Xe?(...r)=>{try{return e(...r)}catch(n){if(Xe&&Xe(n)===!0)return;throw n}}:e,Ae=[];function Qe(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function xn(e,t){let r=new or;Ae.push(r),r.init(e);let n=new(Cn())(O(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function Gs({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=qe(O(u=>{let f=Date.now()-c;e(a.map(p=>(p.timeOffset-=f,p)),u),a=[],c=null}),s),d=O(qe(O(u=>{let f=Qe(u),{clientX:p,clientY:m}=er(u)?u.changedTouches[0]:u;c||(c=Rt()),a.push({x:p,y:m,id:n.getId(f),timeOffset:Rt()-c}),i(typeof DragEvent<"u"&&u instanceof DragEvent?N.Drag:u instanceof MouseEvent?N.MouseMove:N.TouchMove)}),o,{trailing:!1})),l=[re("mousemove",d,r),re("touchmove",d,r),re("drag",d,r)];return O(()=>{l.forEach(u=>u())})}function Vs({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],i=null,d=l=>u=>{let f=Qe(u);if(ne(f,n,o,!0))return;let p=null,m=l;if("pointerType"in u){switch(u.pointerType){case"mouse":p=Se.Mouse;break;case"touch":p=Se.Touch;break;case"pen":p=Se.Pen;break}p===Se.Touch?ae[l]===ae.MouseDown?m="TouchStart":ae[l]===ae.MouseUp&&(m="TouchEnd"):Se.Pen}else er(u)&&(p=Se.Touch);p!==null?(i=p,(m.startsWith("Touch")&&p===Se.Touch||m.startsWith("Mouse")&&p===Se.Mouse)&&(p=null)):ae[l]===ae.Click&&(p=i,i=null);let h=er(u)?u.changedTouches[0]:u;if(!h)return;let C=r.getId(f),{clientX:w,clientY:S}=h;O(e)({type:ae[m],id:C,x:w,y:S,...p!==null&&{pointerType:p}})};return Object.keys(ae).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let u=ke(l),f=d(l);if(window.PointerEvent)switch(ae[l]){case ae.MouseDown:case ae.MouseUp:u=u.replace("mouse","pointer");break;case ae.TouchStart:case ae.TouchEnd:return}c.push(re(u,f,t))}),O(()=>{c.forEach(l=>l())})}function On({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){let a=O(qe(O(c=>{let i=Qe(c);if(!i||ne(i,n,o,!0))return;let d=r.getId(i);if(i===t&&t.defaultView){let l=wn(t.defaultView);e({id:d,x:l.left,y:l.top})}else e({id:d,x:i.scrollLeft,y:i.scrollTop})}),s.scroll||100));return re("scroll",a,t)}function js({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=O(qe(O(()=>{let s=In(),a=Rn();(r!==s||n!==a)&&(e({width:Number(a),height:Number(s)}),r=s,n=a)}),200));return re("resize",o,t)}var $s=["INPUT","TEXTAREA","SELECT"],sn=new WeakMap;function Ys({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:d,userTriggeredOnInput:l}){function u(S){let g=Qe(S),T=S.isTrusted,_=g&&g.tagName;if(g&&_==="OPTION"&&(g=M.parentElement(g)),!g||!_||$s.indexOf(_)<0||ne(g,n,o,!0)||g.classList.contains(s)||a&&g.matches(a))return;let v=g.value,R=!1,I=hr(g)||"";I==="radio"||I==="checkbox"?R=g.checked:(c[_.toLowerCase()]||c[I])&&(v=Ct({element:g,maskInputOptions:c,tagName:_,type:I,value:v,maskInputFn:i})),f(g,l?{text:v,isChecked:R,userTriggered:T}:{text:v,isChecked:R});let L=g.name;I==="radio"&&L&&R&&t.querySelectorAll(`input[type="radio"][name="${Zs(L)}"]`).forEach(z=>{if(z!==g){let J=z.value;f(z,l?{text:J,isChecked:!R,userTriggered:!1}:{text:J,isChecked:!R})}})}function f(S,g){let T=sn.get(S);if(!T||T.text!==g.text||T.isChecked!==g.isChecked){sn.set(S,g);let _=r.getId(S);O(e)({...g,id:_})}}let m=(d.input==="last"?["change"]:["input","change"]).map(S=>re(S,O(u),t)),h=t.defaultView;if(!h)return()=>{m.forEach(S=>S())};let C=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),w=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return C&&C.set&&m.push(...w.map(S=>kt(S[0],S[1],{set(){O(u)({target:this,isTrusted:!1})}},!1,h))),O(()=>{m.forEach(S=>S())})}function Et(e){let t=[];function r(n,o){if(gt("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||gt("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||gt("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||gt("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a)}return o}return r(e,t)}function Zs(e){return e.replace(/["\\]/g,"\\$&")}function Ie(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function Ks({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:O((l,u,f)=>{let[p,m]=f,{id:h,styleId:C}=Ie(u,t,r.styleMirror);return(h&&h!==-1||C&&C!==-1)&&e({id:h,styleId:C,adds:[{rule:p,index:m}]}),l.apply(u,f)})}),n.CSSStyleSheet.prototype.addRule=function(l,u,f=this.cssRules.length){let p=`${l} { ${u} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,f])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:O((l,u,f)=>{let[p]=f,{id:m,styleId:h}=Ie(u,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,removes:[{index:p}]}),l.apply(u,f)})}),n.CSSStyleSheet.prototype.removeRule=function(l){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[l])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:O((l,u,f)=>{let[p]=f,{id:m,styleId:h}=Ie(u,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,replace:p}),l.apply(u,f)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:O((l,u,f)=>{let[p]=f,{id:m,styleId:h}=Ie(u,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,replaceSync:p}),l.apply(u,f)})}));let i={};yt("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(yt("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),yt("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),yt("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let d={};return Object.entries(i).forEach(([l,u])=>{d[l]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(d[l].insertRule,{apply:O((f,p,m)=>{let[h,C]=m,{id:w,styleId:S}=Ie(p.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||S&&S!==-1)&&e({id:w,styleId:S,adds:[{rule:h,index:[...Et(p),C||0]}]}),f.apply(p,m)})}),u.prototype.deleteRule=new Proxy(d[l].deleteRule,{apply:O((f,p,m)=>{let[h]=m,{id:C,styleId:w}=Ie(p.parentStyleSheet,t,r.styleMirror);return(C&&C!==-1||w&&w!==-1)&&e({id:C,styleId:w,removes:[{index:[...Et(p),h]}]}),f.apply(p,m)})})}),O(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=s,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([l,u])=>{u.prototype.insertRule=d[l].insertRule,u.prototype.deleteRule=d[l].deleteRule})})}function Ln({mirror:e,stylesheetManager:t},r){var n,o,s;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(M.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(s=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var d;return(d=i.get)==null?void 0:d.call(this)},set(d){var l;let u=(l=i.set)==null?void 0:l.call(this,d);if(a!==null&&a!==-1)try{t.adoptStyleSheets(d,a)}catch{}return u}}),O(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function Xs({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:O((c,i,d)=>{var l;let[u,f,p]=d;if(r.has(u))return s.apply(i,[u,f,p]);let{id:m,styleId:h}=Ie((l=i.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,set:{property:u,value:f,priority:p},index:Et(i.parentRule)}),c.apply(i,d)})});let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:O((c,i,d)=>{var l;let[u]=d;if(r.has(u))return a.apply(i,[u]);let{id:f,styleId:p}=Ie((l=i.parentRule)==null?void 0:l.parentStyleSheet,t,n.styleMirror);return(f&&f!==-1||p&&p!==-1)&&e({id:f,styleId:p,remove:{property:u},index:Et(i.parentRule)}),c.apply(i,d)})}),O(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function Js({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:s}){let a=O(i=>qe(O(d=>{let l=Qe(d);if(!l||ne(l,t,r,!0))return;let{currentTime:u,volume:f,muted:p,playbackRate:m,loop:h}=l;e({type:i,id:n.getId(l),currentTime:u,volume:f,muted:p,playbackRate:m,loop:h})}),o.media||500)),c=[re("play",a(Fe.Play),s),re("pause",a(Fe.Pause),s),re("seeked",a(Fe.Seeked),s),re("volumechange",a(Fe.VolumeChange),s),re("ratechange",a(Fe.RateChange),s)];return O(()=>{c.forEach(i=>i())})}function qs({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(i,d,l){let u=new s(i,d,l);return o.set(u,{family:i,buffer:typeof d!="string",descriptors:l,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),u};let a=He(t.fonts,"add",function(c){return function(i){return setTimeout(O(()=>{let d=o.get(i);d&&(e(d),o.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=s}),n.push(a),O(()=>{n.forEach(c=>c())})}function Qs(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:s}=e,a=!0,c=O(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let d=[],l=i.rangeCount||0;for(let u=0;u<l;u++){let f=i.getRangeAt(u),{startContainer:p,startOffset:m,endContainer:h,endOffset:C}=f;ne(p,n,o,!0)||ne(h,n,o,!0)||d.push({start:r.getId(p),startOffset:m,end:r.getId(h),endOffset:C})}s({ranges:d})});return c(),re("selectionchange",c)}function ei({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:He(r.customElements,"define",function(o){return function(s,a,c){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,c])}})}function ti(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:d,styleDeclarationCb:l,canvasMutationCb:u,fontCb:f,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),r(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),n(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),o(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),s(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),c(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),i(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),d(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),l(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),u(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),f(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),p(...h)},e.customElementCb=(...h)=>{t.customElement&&t.customElement(...h),m(...h)}}function ri(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};ti(e,t);let n;e.recordDOM&&(n=xn(e,e.doc));let o=Gs(e),s=Vs(e),a=On(e),c=js(e,{win:r}),i=Ys(e),d=Js(e),l=()=>{},u=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(l=Ks(e,{win:r}),u=Ln(e,e.doc),f=Xs(e,{win:r}),e.collectFonts&&(p=qs(e)));let m=Qs(e),h=ei(e),C=[];for(let w of e.plugins)C.push(w.observer(w.callback,r,w.options));return O(()=>{Ae.forEach(w=>w.reset()),n?.disconnect(),o(),s(),a(),c(),i(),d(),l(),u(),f(),p(),m(),h(),C.forEach(w=>w())})}function gt(e){return typeof window[e]<"u"}function yt(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Tt=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let s=n||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),c=s.get(r);return c||(c=this.generateIdFn(),s.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=o.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},ir=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new Tt(gn)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Tt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let s=this.transformCrossOriginEvent(o,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case P.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:P.IncrementalSnapshot,data:{source:N.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case P.Meta:case P.Load:case P.DomContentLoaded:return!1;case P.Plugin:return r;case P.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case P.IncrementalSnapshot:switch(r.data.source){case N.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(o.node,s)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case N.Drag:case N.TouchMove:case N.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case N.ViewportResize:return!1;case N.MediaInteraction:case N.MouseInteraction:case N.Scroll:case N.CanvasMutation:case N.Input:return this.replaceIds(r.data,t,["id"]),r;case N.StyleSheetRule:case N.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case N.Font:return r;case N.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case N.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(let s of o)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==X.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},ar=class{constructor(t){y(this,"shadowDoms",new WeakSet),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Ke(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=xn({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(On({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(M.host(t))),this.restoreHandlers.push(Ln({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(He(t.prototype,"attachShadow",function(o){return function(s){let a=o.call(this,s),c=M.shadowRoot(this);return c&&Mn(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},We="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ni=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ye=0;Ye<We.length;Ye++)ni[We.charCodeAt(Ye)]=Ye;var Ye,oi=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=We[t[r]>>2],o+=We[(t[r]&3)<<4|t[r+1]>>4],o+=We[(t[r+1]&15)<<2|t[r+2]>>6],o+=We[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o},an=new Map;function si(e,t){let r=an.get(e);return r||(r=new Map,an.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Dn=(e,t,r)=>{if(!e||!(Fn(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=si(r,n),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function vt(e,t,r){if(e instanceof Array)return e.map(n=>vt(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,o=oi(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[vt(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[vt(e.data,t,r),e.width,e.height]};if(Fn(e,t)||typeof e=="object"){let n=e.constructor.name,o=Dn(e,t,r);return{rr_type:n,index:o}}}}return e}var Pn=(e,t,r)=>e.map(n=>vt(n,t,r)),Fn=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function ii(e,t,r,n){let o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=He(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...d){return ne(this.canvas,r,n,!0)||setTimeout(()=>{let l=Pn(d,t,this);e(this.canvas,{type:Be["2D"],property:a,args:l})},0),i.apply(this,d)}});o.push(c)}catch{let c=kt(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:Be["2D"],property:a,args:[i],setter:!0})}});o.push(c)}return()=>{o.forEach(a=>a())}}function ai(e){return e==="experimental-webgl"?"webgl":e}function ln(e,t,r,n){let o=[];try{let s=He(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!ne(this,t,r,!0)){let d=ai(c);if("__context"in this||(this.__context=d),n&&["webgl","webgl2"].includes(d))if(i[0]&&typeof i[0]=="object"){let l=i[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function cn(e,t,r,n,o,s){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let d=He(e,i,function(l){return function(...u){let f=l.apply(this,u);if(Dn(f,s,this),"tagName"in this.canvas&&!ne(this.canvas,n,o,!0)){let p=Pn(u,s,this),m={type:t,property:i,args:p};r(this.canvas,m)}return f}});a.push(d)}catch{let d=kt(e,i,{set(l){r(this.canvas,{type:t,property:i,args:[l],setter:!0})}});a.push(d)}return a}function li(e,t,r,n){let o=[];return o.push(...cn(t.WebGLRenderingContext.prototype,Be.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...cn(t.WebGL2RenderingContext.prototype,Be.WebGL2,e,r,n,t)),()=>{o.forEach(s=>s())}}var Un="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",ci=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),dn=typeof window<"u"&&window.Blob&&new Blob([ci(Un)],{type:"text/javascript;charset=utf-8"});function di(e){let t;try{if(t=dn&&(window.URL||window.webkitURL).createObjectURL(dn),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+Un,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var lr=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(i,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(d)});let{sampling:r="all",win:n,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,s,{dataURLOptions:c})}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(t,r,n,o,s){let a=ln(r,n,o,!0),c=new Map,i=new di;i.onmessage=m=>{let{id:h}=m.data;if(c.set(h,!1),!("base64"in m.data))return;let{base64:C,type:w,width:S,height:g}=m.data;this.mutationCb({id:h,type:Be["2D"],commands:[{property:"clearRect",args:[0,0,S,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:C}],type:w}]},0,0]}]})};let d=1e3/t,l=0,u,f=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(h=>{ne(h,n,o,!0)||m.push(h)}),m},p=m=>{if(l&&m-l<d){u=requestAnimationFrame(p);return}l=m,f().forEach(async h=>{var C;let w=this.mirror.getId(h);if(c.get(w)||h.width===0||h.height===0)return;if(c.set(w,!0),["webgl","webgl2"].includes(h.__context)){let g=h.getContext(h.__context);((C=g?.getContextAttributes())==null?void 0:C.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let S=await createImageBitmap(h);i.postMessage({id:w,bitmap:S,width:h.width,height:h.height,dataURLOptions:s.dataURLOptions},[S])}),u=requestAnimationFrame(p)};u=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(u)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=ln(t,r,n,!1),s=ii(this.processMutation.bind(this),t,r,n),a=li(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let o=n.map(a=>{let{type:c,...i}=a;return i}),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}},cr=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new rr),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},o=[];for(let s of t){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(c,i)=>({rule:pn(c,s.href),index:i}))})),n.styleIds.push(a)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},dr=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},Y,St,Jt,At=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((jr=e.contentWindow)==null?void 0:jr.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ue=es();function me(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:d=null,inlineStylesheet:l=!0,maskAllInputs:u,maskInputOptions:f,slimDOMOptions:p,maskInputFn:m,maskTextFn:h,maskAnchorHrefFn:C,blockImgSrcPattern:w=null,blockImgSrcFillOptions:S={backgroundColor:"#F6F7F9",strokeColor:"#E9EBEF",strokeWidth:"1px"},hooks:g,packFn:T,sampling:_={},dataURLOptions:v={},mousemoveWait:R,recordDOM:I=!0,recordCanvas:L=!1,recordCrossOriginIframes:z=!1,recordAfter:J=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:F=!1,collectFonts:q=!1,inlineImages:H=!1,plugins:W,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:k=new Set([]),errorHandler:Z}=e;Bs(Z);let A=z?window.parent===window:!0,D=!1;if(!A)try{window.parent.document&&(D=!1)}catch{D=!0}if(A&&!t)throw new Error("emit function is required");if(!A&&!D)return()=>{};R!==void 0&&_.mousemove===void 0&&(_.mousemove=R),ue.reset();let G=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f!==void 0?f:{password:!0},K=p===!0||p==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all",headTitleMutations:p==="all"}:p||{};Fs();let te,ie=0,Q=x=>{for(let de of W||[])de.eventProcessor&&(x=de.eventProcessor(x));return T&&!D&&(x=T(x)),x};Y=(x,de)=>{var j;let $=x;if($.timestamp=Rt(),(j=Ae[0])!=null&&j.isFrozen()&&$.type!==P.FullSnapshot&&!($.type===P.IncrementalSnapshot&&$.data.source===N.Mutation)&&Ae.forEach(pe=>pe.unfreeze()),A)t?.(Q($),de);else if(D){let pe={type:"rrweb",event:Q($),origin:window.location.origin,isCheckout:de};window.parent.postMessage(pe,"*")}if($.type===P.FullSnapshot)te=$,ie=0;else if($.type===P.IncrementalSnapshot){if($.data.source===N.Mutation&&$.data.isAttachIframe)return;ie++;let pe=n&&ie>=n,B=r&&$.timestamp-te.timestamp>r;(pe||B)&&St(!0)}};let Ne=x=>{Y({type:P.IncrementalSnapshot,data:{source:N.Mutation,...x}})},$e=x=>Y({type:P.IncrementalSnapshot,data:{source:N.Scroll,...x}}),xe=x=>Y({type:P.IncrementalSnapshot,data:{source:N.CanvasMutation,...x}}),zt=x=>Y({type:P.IncrementalSnapshot,data:{source:N.AdoptedStyleSheet,...x}}),he=new cr({mutationCb:Ne,adoptedStyleSheetCb:zt}),fe=new ir({mirror:ue,mutationCb:Ne,stylesheetManager:he,recordCrossOriginIframes:z,wrappedEmit:Y});for(let x of W||[])x.getMirror&&x.getMirror({nodeMirror:ue,crossOriginIframeMirror:fe.crossOriginIframeMirror,crossOriginIframeStyleMirror:fe.crossOriginIframeStyleMirror});let Oe=new dr;Jt=new lr({recordCanvas:L,mutationCb:xe,win:window,blockClass:o,blockSelector:s,mirror:ue,sampling:_.canvas,dataURLOptions:v});let at=new ar({mutationCb:Ne,scrollCb:$e,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:d,inlineStylesheet:l,maskInputOptions:G,dataURLOptions:v,maskTextFn:h,maskInputFn:m,maskAnchorHrefFn:C,blockImgSrcPattern:w,blockImgSrcFillOptions:S,recordCanvas:L,inlineImages:H,sampling:_,slimDOMOptions:K,iframeManager:fe,stylesheetManager:he,canvasManager:Jt,keepIframeSrcFn:E,processedNodeManager:Oe},mirror:ue});St=(x=!1)=>{if(!I)return;Y({type:P.Meta,data:{href:window.location.href,width:Rn(),height:In()}},x),he.reset(),at.init(),Ae.forEach(j=>j.lock());let de=Rs(document,{mirror:ue,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:d,inlineStylesheet:l,maskAllInputs:G,maskTextFn:h,maskInputFn:m,maskAnchorHrefFn:C,blockImgSrcPattern:w,blockImgSrcFillOptions:S,slimDOM:K,dataURLOptions:v,recordCanvas:L,inlineImages:H,onSerialize:j=>{An(j,ue)&&fe.addIframe(j),kn(j,ue)&&he.trackLinkElement(j),tr(j)&&at.addShadowRoot(M.shadowRoot(j),document)},onIframeLoad:(j,$)=>{fe.attachIframe(j,$),at.observeAttachShadow(j)},onStylesheetLoad:(j,$)=>{he.attachLinkElement(j,$)},keepIframeSrcFn:E});if(!de)return console.warn("Failed to snapshot the document");Y({type:P.FullSnapshot,data:{node:de,initialOffset:wn(window)}},x),Ae.forEach(j=>j.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&he.adoptStyleSheets(document.adoptedStyleSheets,ue.getId(document))};try{let x=[],de=$=>{var pe;return O(ri)({mutationCb:Ne,mousemoveCb:(B,Wt)=>Y({type:P.IncrementalSnapshot,data:{source:Wt,positions:B}}),mouseInteractionCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.MouseInteraction,...B}}),scrollCb:$e,viewportResizeCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.ViewportResize,...B}}),inputCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.Input,...B}}),mediaInteractionCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.MediaInteraction,...B}}),styleSheetRuleCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.StyleSheetRule,...B}}),styleDeclarationCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.StyleDeclaration,...B}}),canvasMutationCb:xe,fontCb:B=>Y({type:P.IncrementalSnapshot,data:{source:N.Font,...B}}),selectionCb:B=>{Y({type:P.IncrementalSnapshot,data:{source:N.Selection,...B}})},customElementCb:B=>{Y({type:P.IncrementalSnapshot,data:{source:N.CustomElement,...B}})},blockClass:o,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:d,maskInputOptions:G,inlineStylesheet:l,sampling:_,recordDOM:I,recordCanvas:L,inlineImages:H,userTriggeredOnInput:F,collectFonts:q,doc:$,maskInputFn:m,maskTextFn:h,maskAnchorHrefFn:C,blockImgSrcPattern:w,blockImgSrcFillOptions:S,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:K,dataURLOptions:v,mirror:ue,iframeManager:fe,stylesheetManager:he,shadowDomManager:at,processedNodeManager:Oe,canvasManager:Jt,ignoreCSSAttributes:k,plugins:((pe=W?.filter(B=>B.observer))==null?void 0:pe.map(B=>({observer:B.observer,options:B.options,callback:Wt=>Y({type:P.Plugin,data:{plugin:B.name,payload:Wt}})})))||[]},g)};fe.addLoadListener($=>{try{x.push(de($.contentDocument))}catch(pe){console.warn(pe)}});let j=()=>{St(),x.push(de(document)),At=!0};return document.readyState==="interactive"||document.readyState==="complete"?j():(x.push(re("DOMContentLoaded",()=>{Y({type:P.DomContentLoaded,data:{}}),J==="DOMContentLoaded"&&j()})),x.push(re("load",()=>{Y({type:P.Load,data:{}}),J==="load"&&j()},window))),()=>{x.forEach($=>$()),Oe.destroy(),At=!1,Hs()}}catch(x){console.warn(x)}}me.addCustomEvent=(e,t)=>{if(!At)throw new Error("please add custom event after start recording");Y({type:P.Custom,data:{tag:e,payload:t}})};me.freezePage=()=>{Ae.forEach(e=>e.freeze())};me.takeFullSnapshot=e=>{if(!At)throw new Error("please take full snapshot after start recording");St(e)};me.mirror=ue;var un;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(un||(un={}));var oe=(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))(oe||{}),_e=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(_e||{}),mr=(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))(mr||{});function _t(e,t){if(!t)return;let r=new URL(e),n={};for(let[o,s]of r.searchParams)t.includes(o)&&(n[o]=s);return Object.keys(n).length>0?n:void 0}var ui="Adora.URLChange",zn="Adora.Cohort",hi="Adora.AddCohort",fi="Adora.Click";var gr=["onclick","ondblclick","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onchange","onfocus","onblur","onscroll","onselect","onsubmit","onkeydown","onkeypress","onkeyup","onload","onunload"];function Wn({dom0EventHandlers:e,delay:t,timestamp:r}){return{type:oe.Custom,data:{tag:fi,payload:{dom0EventHandlers:e}},delay:t,timestamp:r}}function et({payload:e,delay:t,timestamp:r}){return{type:oe.Custom,data:{tag:hi,payload:e},delay:t,timestamp:r}}function Bn({href:e,delay:t,timestamp:r}){return{type:oe.Custom,data:{tag:ui,payload:{href:e}},delay:t,timestamp:r}}import{minimatch as gi}from"minimatch";function Te(e){throw new Error(`This code path should be unreachable: ${e}`)}function pi(e){return(e.startsWith("http://")||e.startsWith("https://"))&&(e=e.replace(/^https?:\/\//,"")),e.endsWith("/")&&(e=e.substring(0,e.length-1)),e=e.replace(/:\d+$/,""),e}function mi(e,t){if(!t||t==="")return!1;if(t==="*")return!0;let r=pi(t);return e===r}function le({urlStr:e,pathConfig:t}){let r=new URL(e),n=r.pathname,o=r.hostname,s=t.rules.filter(c=>mi(o,c.domain));if(s.length>0){let c=s.find(i=>i.path==="**");if(!c)return t.defaultAction==="allow"?r:void 0;for(let i of s){if(i.path==="**")continue;let d=Le(n,i);if(d!==void 0)switch(i.action){case"allow":return r;case"block":return;case"replace":return r.pathname=d,r;default:Te(i.action)}}return c.action==="allow"?r:void 0}let a=t.rules.filter(c=>!c.domain);for(let c of a){let i=Le(n,c);if(i!==void 0)switch(c.action){case"allow":return r;case"block":return;case"replace":return r.pathname=i,r;default:Te(c.action)}}return t.defaultAction==="allow"?r:void 0}function tt(e,t,r){let n=le({urlStr:e,pathConfig:r});n||(n=new URL(e));let o=yi(n.pathname,t.rules||[]),s=[];for(let a of n.searchParams.keys()){let c=vi(a,o?.rules||[]);switch(c){case"accept":break;case"delete":s.push(a);break;case"anonymize":n.searchParams.set(a,"*");break;default:Te(c)}}for(let a of s)n.searchParams.delete(a);if(n.pathname.includes("%3F")){let a=n.pathname.split("/");a[a.length-1]=a[a.length-1].split("%3F")[0],n.pathname=a.join("/")}return n.hash.includes("=")&&(n.hash=""),n.toString()}function yi(e,t){for(let r of t)if(Le(e,{path:r.path}))return r}function vi(e,t){for(let r of t)if(gi(e,r.param))return r.anonymizeValue?"anonymize":"accept";return"delete"}var yr=class{constructor(t,r,n){this.org=t;this.recorder=r;this.events=[];this._estimatedByteSize=0;this.events=n,this._estimatedByteSize=this.calculateTotalSize()}get estimatedByteSize(){return this._estimatedByteSize}calculateTotalSize(){try{let t=JSON.stringify(this.events,this.getCircularReplacer());return Si(t)}catch(t){return b(`Error calculating event size: ${t}. Falling back to approximation.`),this.events.length*500}}getCircularReplacer(){let t=new WeakSet;return(r,n)=>{if(typeof n=="object"&&n!==null){if(t.has(n))return;t.add(n)}return n}}clearEvents(){this.events=[],this._estimatedByteSize=this.calculateTotalSize()}pushEvent({eventHref:t,event:r}){if(!le({urlStr:t,pathConfig:this.org.pathConfig})){b(`URL not accepted: ${t}`);return}if(!this.recorder.isRecording){b("Dropping event - recorder is not recording");return}this.events.push(r),this._estimatedByteSize=this.calculateTotalSize()}getEvents(){return this.events}},Mt=class{constructor(t,r,n,o,s){this.org=t;this.eventStorage=r;this.getHref=n;this.eventStore=new yr(t,o,s)}get estimatedSerializedByteSize(){return this.eventStore.estimatedByteSize}clear(){this.eventStore.clearEvents(),this.eventStorage.removeEvents()}getEvents(){return this.eventStore.getEvents()}onVisibilityChange(t){t||this.eventStorage.setEvents(this.getEvents())}append(t){let r=this.getHref();if(t.type===oe.Meta)t.data.href=tt(t.data.href,this.org.allowedQueryParams,this.org.pathConfig),this.lastHref=this.getHref();else if(this.lastHref&&r!==this.lastHref){b(`URL changed from ${this.lastHref} to ${r}, adding artificial meta event for ${this.getHref()}`),this.eventStore.pushEvent({eventHref:r,event:Bn({href:tt(r,this.org.allowedQueryParams,this.org.pathConfig),delay:t.delay,timestamp:t.timestamp})});let n=_t(r,this.org.customQueryParamsCohorts);n&&this.eventStore.pushEvent({eventHref:r,event:et({payload:{userCohorts:n,source:"query_params"},timestamp:t.timestamp,delay:t.delay})}),this.lastHref=this.getHref()}if(t.type===oe.IncrementalSnapshot&&t.data.source===_e.MouseInteraction&&t.data.type===mr.Click){let n=me.mirror.getNode(t.data.id);if(n){let o=Hn(n),s=Wn({dom0EventHandlers:o,delay:t.delay,timestamp:t.timestamp});this.eventStore.pushEvent({eventHref:r,event:s})}}this.eventStore.pushEvent({eventHref:r,event:t})}};function Si(e){return new Blob([e]).size}function Hn(e){let t=[];for(let r=0;r<gr.length;r++){let o=gr[r];typeof e[o]=="function"&&t.push(o)}return t}var ce=Uint8Array,se=Uint16Array,st=Uint32Array,Ir=new ce([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Rr=new ce([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Gn=new ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yn=function(e,t){for(var r=new se(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var o=new st(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)o[s]=s-r[n]<<5|n;return[r,o]},Zn=Yn(Ir,2),bi=Zn[0],Sr=Zn[1];bi[28]=258,Sr[258]=28;var Kn=Yn(Rr,0),Ba=Kn[0],Vn=Kn[1],br=new se(32768);for(U=0;U<32768;++U)be=(U&43690)>>>1|(U&21845)<<1,be=(be&52428)>>>2|(be&13107)<<2,be=(be&61680)>>>4|(be&3855)<<4,br[U]=((be&65280)>>>8|(be&255)<<8)>>>1;var be,U,ot=function(e,t,r){for(var n=e.length,o=0,s=new se(t);o<n;++o)++s[e[o]-1];var a=new se(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;var c;if(r){c=new se(1<<t);var i=15-t;for(o=0;o<n;++o)if(e[o])for(var d=o<<4|e[o],l=t-e[o],u=a[e[o]-1]++<<l,f=u|(1<<l)-1;u<=f;++u)c[br[u]>>>i]=d}else for(c=new se(n),o=0;o<n;++o)c[o]=br[a[e[o]-1]++]>>>15-e[o];return c},Me=new ce(288);for(U=0;U<144;++U)Me[U]=8;var U;for(U=144;U<256;++U)Me[U]=9;var U;for(U=256;U<280;++U)Me[U]=7;var U;for(U=280;U<288;++U)Me[U]=8;var U,Nt=new ce(32);for(U=0;U<32;++U)Nt[U]=5;var U,Ci=ot(Me,9,0);var wi=ot(Nt,5,0);var Xn=function(e){return(e/8>>0)+(e&7&&1)},Jn=function(e,t,r){(r==null||r>e.length)&&(r=e.length);var n=new(e instanceof se?se:e instanceof st?st:ce)(r-t);return n.set(e.subarray(t,r)),n};var Ce=function(e,t,r){r<<=t&7;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8},rt=function(e,t,r){r<<=t&7;var n=t/8>>0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},vr=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var o=r.length,s=r.slice();if(!o)return[new ce(0),0];if(o==1){var a=new ce(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(_,v){return _.f-v.f}),r.push({s:-1,f:25001});var c=r[0],i=r[1],d=0,l=1,u=2;for(r[0]={s:-1,f:c.f+i.f,l:c,r:i};l!=o-1;)c=r[r[d].f<r[u].f?d++:u++],i=r[d!=l&&r[d].f<r[u].f?d++:u++],r[l++]={s:-1,f:c.f+i.f,l:c,r:i};for(var f=s[0].s,n=1;n<o;++n)s[n].s>f&&(f=s[n].s);var p=new se(f+1),m=Cr(r[l-1],p,0);if(m>t){var n=0,h=0,C=m-t,w=1<<C;for(s.sort(function(v,R){return p[R.s]-p[v.s]||v.f-R.f});n<o;++n){var S=s[n].s;if(p[S]>t)h+=w-(1<<m-p[S]),p[S]=t;else break}for(h>>>=C;h>0;){var g=s[n].s;p[g]<t?h-=1<<t-p[g]++-1:++n}for(;n>=0&&h;--n){var T=s[n].s;p[T]==t&&(--p[T],++h)}m=t}return[new ce(p),m]},Cr=function(e,t,r){return e.s==-1?Math.max(Cr(e.l,t,r+1),Cr(e.r,t,r+1)):t[e.s]=r},jn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new se(++t),n=0,o=e[0],s=1,a=function(i){r[n++]=i},c=1;c<=t;++c)if(e[c]==o&&c!=t)++s;else{if(!o&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(o),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(o);s=1,o=e[c]}return[r.subarray(0,n),t]},nt=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},wr=function(e,t,r){var n=r.length,o=Xn(t+2);e[o]=n&255,e[o+1]=n>>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var s=0;s<n;++s)e[o+s+4]=r[s];return(o+4+n)*8},$n=function(e,t,r,n,o,s,a,c,i,d,l){Ce(t,l++,r),++o[256];for(var u=vr(o,15),f=u[0],p=u[1],m=vr(s,15),h=m[0],C=m[1],w=jn(f),S=w[0],g=w[1],T=jn(h),_=T[0],v=T[1],R=new se(19),I=0;I<S.length;++I)R[S[I]&31]++;for(var I=0;I<_.length;++I)R[_[I]&31]++;for(var L=vr(R,7),z=L[0],J=L[1],F=19;F>4&&!z[Gn[F-1]];--F);var q=d+5<<3,H=nt(o,Me)+nt(s,Nt)+a,W=nt(o,f)+nt(s,h)+a+14+3*F+nt(R,z)+(2*R[16]+3*R[17]+7*R[18]);if(q<=H&&q<=W)return wr(t,l,e.subarray(i,i+d));var E,k,Z,A;if(Ce(t,l,1+(W<H)),l+=2,W<H){E=ot(f,p,0),k=f,Z=ot(h,C,0),A=h;var D=ot(z,J,0);Ce(t,l,g-257),Ce(t,l+5,v-1),Ce(t,l+10,F-4),l+=14;for(var I=0;I<F;++I)Ce(t,l+3*I,z[Gn[I]]);l+=3*F;for(var G=[S,_],K=0;K<2;++K)for(var te=G[K],I=0;I<te.length;++I){var ie=te[I]&31;Ce(t,l,D[ie]),l+=z[ie],ie>15&&(Ce(t,l,te[I]>>>5&127),l+=te[I]>>>12)}}else E=Ci,k=Me,Z=wi,A=Nt;for(var I=0;I<c;++I)if(n[I]>255){var ie=n[I]>>>18&31;rt(t,l,E[ie+257]),l+=k[ie+257],ie>7&&(Ce(t,l,n[I]>>>23&31),l+=Ir[ie]);var Q=n[I]&31;rt(t,l,Z[Q]),l+=A[Q],Q>3&&(rt(t,l,n[I]>>>5&8191),l+=Rr[Q])}else rt(t,l,E[n[I]]),l+=k[n[I]];return rt(t,l,E[256]),l+k[256]},Ii=new st([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ri=function(e,t,r,n,o,s){var a=e.length,c=new ce(n+a+5*(1+Math.floor(a/7e3))+o),i=c.subarray(n,c.length-o),d=0;if(!t||a<8)for(var l=0;l<=a;l+=65535){var u=l+65535;u<a?d=wr(i,d,e.subarray(l,u)):(i[l]=s,d=wr(i,d,e.subarray(l,a)))}else{for(var f=Ii[t-1],p=f>>>13,m=f&8191,h=(1<<r)-1,C=new se(32768),w=new se(h+1),S=Math.ceil(r/3),g=2*S,T=function(x){return(e[x]^e[x+1]<<S^e[x+2]<<g)&h},_=new st(25e3),v=new se(288),R=new se(32),I=0,L=0,l=0,z=0,J=0,F=0;l<a;++l){var q=T(l),H=l&32767,W=w[q];if(C[H]=W,w[q]=H,J<=l){var E=a-l;if((I>7e3||z>24576)&&E>423){d=$n(e,i,0,_,v,R,L,z,F,l-F,d),z=I=L=0,F=l;for(var k=0;k<286;++k)v[k]=0;for(var k=0;k<30;++k)R[k]=0}var Z=2,A=0,D=m,G=H-W&32767;if(E>2&&q==T(l-G))for(var K=Math.min(p,E)-1,te=Math.min(32767,l),ie=Math.min(258,E);G<=te&&--D&&H!=W;){if(e[l+Z]==e[l+Z-G]){for(var Q=0;Q<ie&&e[l+Q]==e[l+Q-G];++Q);if(Q>Z){if(Z=Q,A=G,Q>K)break;for(var Ne=Math.min(G,Q-2),$e=0,k=0;k<Ne;++k){var xe=l-G+k+32768&32767,zt=C[xe],he=xe-zt+32768&32767;he>$e&&($e=he,W=xe)}}}H=W,W=C[H],G+=H-W+32768&32767}if(A){_[z++]=268435456|Sr[Z]<<18|Vn[A];var fe=Sr[Z]&31,Oe=Vn[A]&31;L+=Ir[fe]+Rr[Oe],++v[257+fe],++R[Oe],J=l+Z,++I}else _[z++]=e[l],++v[e[l]]}}d=$n(e,i,s,_,v,R,L,z,F,l-F,d)}return Jn(c,0,n+Xn(d)+o)},Ei=function(){var e=1,t=0;return{p:function(r){for(var n=e,o=t,s=r.length,a=0;a!=s;){for(var c=Math.min(a+5552,s);a<c;++a)n+=r[a],o+=n;n%=65521,o%=65521}e=n,t=o},d:function(){return(e>>>8<<16|(t&255)<<8|t>>>8)+((e&255)<<23)*2}}},Ti=function(e,t,r,n,o){return Ri(e,t.level==null?6:t.level,t.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):12+t.mem,r,n,!o)},Ai=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},ki=function(e,t){var r=t.level,n=r==0?0:r<6?1:r==9?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1)};function qn(e,t){t===void 0&&(t={});var r=Ei();r.p(e);var n=Ti(e,t,2,4);return ki(n,t),Ai(n,n.length-4,r.d()),n}function Er(e,t){var r=e.length;if(!t&&typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var n=new ce(e.length+(e.length>>>1)),o=0,s=function(d){n[o++]=d},a=0;a<r;++a){if(o+5>n.length){var c=new ce(o+8+(r-a<<1));c.set(n),n=c}var i=e.charCodeAt(a);i<128||t?s(i):i<2048?(s(192|i>>>6),s(128|i&63)):i>55295&&i<57344?(i=65536+(i&1047552)|e.charCodeAt(++a)&1023,s(240|i>>>18),s(128|i>>>12&63),s(128|i>>>6&63),s(128|i&63)):(s(224|i>>>12),s(128|i>>>6&63),s(128|i&63))}return Jn(n,0,o)}function Tr(e,t){var r="";if(!t&&typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var n=0;n<e.length;){var o=e[n++];o<128||t?r+=String.fromCharCode(o):o<224?r+=String.fromCharCode((o&31)<<6|e[n++]&63):o<240?r+=String.fromCharCode((o&15)<<12|(e[n++]&63)<<6|e[n++]&63):(o=((o&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,r+=String.fromCharCode(55296|o>>10,56320|o&1023))}return r}var Ar="v1";var kr=e=>{let t={...e,v:Ar};return Tr(qn(Er(JSON.stringify(t))),!0)};function Qn(e){let t=new URL(e),r={};for(let[n,o]of t.searchParams)switch(n){case"utm_source":case"utm_medium":case"utm_campaign":case"utm_term":case"utm_content":r[`UTM@@${n}`]=o;break}return Object.keys(r).length>0?r:void 0}var eo=3*1024*1024,to=5e3,xt=class{constructor(t,r,n,o,s,a,c){this.window=t;this.storage=r;this.eventHolder=n;this.recorder=o;this.api=s;this.organization=a;this.windowGetters=c;this.lastSendTime=-1;this.lastAutoCohorts=void 0;this.fastpathToken=void 0;o.setOnEvent(i=>this.onEvent(i))}onEvent(t){if(t.type===oe.FullSnapshot){let s,a=ft(this.window,this.organization.cohortsBootstrapConfig),c=Qn(this.windowGetters.getHref()),i=_t(this.windowGetters.getHref(),this.organization.customQueryParamsCohorts),d=Vt(this.window);this.lastAutoCohorts=d,(c||a||d||i)&&(s=et({payload:{userCohorts:{...a||{},...d||{},...c||{},...i||{}},source:"window_getters"},delay:t.delay,timestamp:t.timestamp}));let l=s?[...this.eventHolder.getEvents(),s,t]:[...this.eventHolder.getEvents(),t];this.clearAndSaveEvents(l);return}else if(t.type===oe.IncrementalSnapshot&&t.data.source===_e.Mutation){let s=Vt(this.window);s&&(!this.lastAutoCohorts||Object.keys(s).length!==Object.keys(this.lastAutoCohorts).length)&&(b("auto cohorts different, appending new event",s),this.eventHolder.append(et({payload:{userCohorts:s,source:"window_getters"},delay:t.delay,timestamp:t.timestamp}))),this.lastAutoCohorts=s}this.eventHolder.append(t);let r=this.eventHolder.estimatedSerializedByteSize,o=Date.now()-this.lastSendTime;r>eo&&o>=to&&(b(`MAX_EVENT_BYTE_SIZE and timeSinceLastSend exceeded: ${r} > ${eo} and ${o} >= ${to}`),this.clearAndSaveEvents())}async clearAndSaveEvents(t){let r=this.windowGetters.getHref();if(!le({urlStr:r,pathConfig:this.organization.pathConfig}))return;let n=t||this.eventHolder.getEvents();if(n.length!==0){this.eventHolder.clear();try{b("saving events...");let o=await this.prepareAndSendEvents(n);switch(b("save events result",o.type),o.type){case"success":break;case"recreate-session":await this.recreateSession(o.session);break;case"no-session":case"unknown-failure":case"rate-limit-exceeded":this.storage.removeSession(),this.eventHolder.clear();break;default:Te(o)}}catch(o){throw b("error saving events",o),this.storage.removeSession(),o}}}async prepareAndSendEvents(t){this.lastSendTime=Date.now();let r=this.storage.getSession();if(!r)return{type:"no-session"};if(r.eventPostUrl&&r.eventPostToken){let s=JSON.parse(atob(r.eventPostToken.split(".")[1]));if(s&&Date.now()>s.lastEventAt-10*1e3){b("refreshing token as it is about to expire");let a=await this.refreshToken(r);if(a.type!=="success")return a;if(r=this.storage.getSession(),!r)return{type:"no-session"}}}let n=r.compressionType==="RRWEB_PACK"?t.map(s=>kr(s)):t,o=await this.api.saveSessionEvents({sessionId:r.id,events:n,metadata:{url:tt(this.windowGetters.getHref(),this.organization.allowedQueryParams,this.organization.pathConfig)},eventPostUrl:r.eventPostUrl,eventPostToken:r.eventPostToken,fastpathToken:this.fastpathToken});if(!o)return{type:"unknown-failure"};if(o.error)switch(o.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:r};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}if(!o.data)return{type:"unknown-failure"};if(o.data&&"code"in o.data)switch(o.data.code){case"TOKEN_REFRESH":{b("refreshing token as it expired on the worker");let s=await this.refreshToken(r);return s.type!=="success"?s:this.prepareAndSendEvents(t)}default:Te(o.data.code)}if(this.fastpathToken=o.data.fastpathToken,o.response.status<200||o.response.status>201)throw new Error(`got status ${o.response.status}`);return{type:"success"}}async refreshToken(t){let r=await this.api.refreshEventToken({sessionId:t.id});if(!r)return{type:"unknown-failure"};if(r.error)switch(r.error.code){case"SessionNotFound":case"SessionAlreadySynced":return{type:"recreate-session",session:t};case"RateLimitExceeded":return{type:"rate-limit-exceeded"}}return r.data?(this.storage.setSession({...t,eventPostToken:r.data.token}),{type:"success"}):{type:"unknown-failure"}}async recreateSession(t){b("recreating sessions");let r=this.recorder.isRecording;this.recorder.setRecording(!1),this.storage.removeSession(),this.fastpathToken=void 0;try{b("recreating session...");let n=await this.api.startSession({orgId:t.settings.orgId,language:t.settings.language||this.windowGetters.getLanguage(),domain:new URL(this.windowGetters.getHref()).hostname,userCohorts:t.settings.userCohorts||{},uid:t.settings.uid,devicePixelRatio:this.windowGetters.getDevicePixelRatio(),adoraUserId:t.adoraUserId,documentReferrer:t.documentReferrer,snippetVersion:ht});if(!n||n.error)return;if(n.response.status!==201){b("session not created, aborting");return}if(!n.data||!("session"in n.data)){b("malformed session, exiting");return}let o=ut(n.data),s=Br(t,o);this.storage.setSession(s),this.eventHolder.clear(),r&&this.recorder.setRecording(!0)}catch{}}};var Lt=class{constructor(t){this._options=t;this._buckets={};this._refillBuckets=()=>{Object.keys(this._buckets).forEach(t=>{let r=this._getBucket(t)+this._refillRate;r>=this._bucketSize?delete this._buckets[t]:this._setBucket(t,r)})};this._getBucket=t=>this._buckets[String(t)];this._setBucket=(t,r)=>{this._buckets[String(t)]=r};this.consumeRateLimit=t=>{let r=this._getBucket(t)??this._bucketSize;if(r=Math.max(r-1,0),r===0)return!0;this._setBucket(t,r);let n=r===0;return n&&this._onBucketRateLimited?.(t),n};this._onBucketRateLimited=this._options._onBucketRateLimited,this._bucketSize=Ot(this._options.bucketSize,0,100),this._refillRate=Ot(this._options.refillRate,0,this._bucketSize),this._refillInterval=Ot(this._options.refillInterval,0,864e5),this._removeInterval=setInterval(()=>{this._refillBuckets()},this._refillInterval)}stop(){this._removeInterval&&(clearInterval(this._removeInterval),this._removeInterval=void 0)}};function Ot(e,t,r,n){return t>r&&(t=r),_i(e)?e>r?r:e<t?t:e:Ot(n||r,t,r)}var _i=e=>toString.call(e)==="[object Number]";var Dt=class{constructor(t,r={}){this._rrweb=t;this._options=r;this._loggedTracker={};this._onNodeRateLimited=t=>{if(!this._loggedTracker[t]){this._loggedTracker[t]=!0;let r=this._getNode(t);this._options.onBlockedNode?.(t,r)}};this._getNodeOrRelevantParent=t=>{let r=this._getNode(t);if(r?.nodeName!=="svg"&&r instanceof Element){let n=r.closest("svg");if(n)return[this._rrweb.mirror.getId(n),n]}return[t,r]};this._getNode=t=>this._rrweb.mirror.getNode(t);this._numberOfChanges=t=>(t.removes?.length??0)+(t.attributes?.length??0)+(t.texts?.length??0)+(t.adds?.length??0);this.throttleMutations=t=>{if(t.type!==oe.IncrementalSnapshot||t.data.source!==_e.Mutation)return t;let r=t.data,n=this._numberOfChanges(r);r.attributes&&(r.attributes=r.attributes.filter(s=>{let[a]=this._getNodeOrRelevantParent(s.id);return this._rateLimiter.consumeRateLimit(a)?!1:s}));let o=this._numberOfChanges(r);if(!(o===0&&n!==o))return t};this._rateLimiter=new Lt({bucketSize:this._options.bucketSize??100,refillRate:this._options.refillRate??10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}};var Ge,ro=()=>{if(Ge!==void 0)return Ge;try{return Ge=document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")===0,b("adora script - isWebpSupported? - ",Ge),Ge}catch{return Ge=!1,!1}};var Pt=class{constructor(t,r,n,o){this.limitedCanvasRecording=t;this.canvasRecordingEnabled=r;this.org=n;this.rrwebRecorder=o;this.startable=!0;b("new recorder")}setOnEvent(t){this.onEvent=t}get args(){let t=this.org.blockedCSSClasses.length>0?`|(${this.org.blockedCSSClasses.join(")|(")})`:"",r=this.org.maskedCSSClasses&&this.org.maskedCSSClasses?.length>0?`|(${this.org.maskedCSSClasses?.join(")|(")})`:"",n=ro()?"image/webp":this.limitedCanvasRecording?"image/jpeg":"image/png";return{emit:o=>{if(!this.onEvent)throw new Error("onEvent must be assigned before starting recording");o.type===oe.FullSnapshot&&this.mutationThrottler?.reset();let s=this.mutationThrottler?this.mutationThrottler.throttleMutations(o):o;s&&this.onEvent(s)},userTriggeredOnInput:!0,blockClass:new RegExp(`(adora-block)|(rr-block|fs-exclude|ph-no-capture)${t}`),blockSelector:"[data-adora-block]",maskTextClass:new RegExp(`(adora-mask)|(rr-mask|fs-mask)${r}`),maskAllInputs:!0,maskInputFn:(o,s)=>no(this.org,s)?o:"*".repeat(o.length),maskTextFn:(o,s)=>s&&this.org.maskByDefault&&s.closest('button,a,div[role="button"],div[role*="menuitem"],input[type="button"],input[type="submit"],input[type="reset"]')||s&&no(this.org,s)?o:o.replace(/[\S]/g,"*"),maskTextSelector:this.org?.maskByDefault?"*":'[data-adora-masking="true"]',recordCanvas:this.canvasRecordingEnabled,sampling:this.canvasRecordingEnabled?{canvas:this.limitedCanvasRecording?1:2}:void 0,dataURLOptions:this.canvasRecordingEnabled?{type:n,quality:.6}:{}}}recordChangeCustomCohort(t){b("sending custom cohort change",t),this.rrwebRecorder.addCustomEvent(zn,t)}recordCLS(t){this.rrwebRecorder.addCustomEvent("CLS",t)}recordINP(t){this.rrwebRecorder.addCustomEvent("INP",t)}recordLCP(t){this.rrwebRecorder.addCustomEvent("LCP",t)}recordVisibilityChange(t){this.rrwebRecorder.addCustomEvent("Adora.VisibilityChange",{visibilityState:t})}recordFocusChange(t){this.rrwebRecorder.addCustomEvent("Adora.FocusChange",{focusState:t})}get isRecording(){return this.rrwebRecorder.isRecording}setRecording(t){if(b("setRecording",`requested status: ${t}`,`current status ${this.rrwebRecorder.isRecording}`),this.rrwebRecorder.isRecording!==t){if(t){this.startRecording();return}this.stopRecording()}}startRecording(){if(this.isRecording)throw new Error("recording already in progress!");if(!this.startable){b("recorder is not startable, returning");return}this.mutationThrottler=new Dt(this.rrwebRecorder,{bucketSize:100,refillRate:10,onBlockedNode:(t,r)=>{b("mutation throttler blocked node",{id:t,node:r})}}),this.rrwebRecorder.record(this.args)}stopRecording(){this.mutationThrottler?.stop(),this.mutationThrottler=void 0,this.rrwebRecorder.stop()}stopFutureRecordings(){this.startable=!1}};function no(e,t){if(t.classList.contains("adora-unmask"))return!0;for(let r of e.unmaskSelectors)if(Array.from(document.querySelectorAll(r)).find(n=>n===t))return!0;return!1}var Ft=class{constructor(){this._isRecording=!1}get isRecording(){return this._isRecording}get mirror(){return me.mirror}record(t){if(b("record",{stopFn:typeof this.stopFn,isRecording:this._isRecording}),this.stopFn!==void 0&&this.stop(),this._isRecording=!0,this.stopFn=me(t),!this.stopFn)throw new Error("recorder could not successfully start")}stop(){this._isRecording=!1,this.stopFn&&(this.stopFn(),this.stopFn=void 0)}addCustomEvent(t,r){if(!this._isRecording)return b("WARNING! attempting to add custom event with recording off"),!1;try{me.addCustomEvent(t,r)}catch(n){return b("trying to record an event even though",n),!1}return!0}};var oo=5e3;function so({sessionType:e}){b("initialize recording");let t=new we(e,new ve),r=t.getSession();if(!r)return;let n=new ye(r.settings.backendUrl),o=new dt(e,new ve),s=o.getEvents();o.removeEvents();let a=()=>window.location.href,c=()=>window.navigator.language,i=()=>window.devicePixelRatio,d=new Ft,l=new Pt(r.limitedCanvasRecording??!1,r.canvasRecordingEnabled??!1,r.organization,d),u=new Mt(r.organization,o,a,l,s||[]),f=new xt(window,t,u,l,n,r.organization,{getHref:a,getLanguage:c,getDevicePixelRatio:i}),p=window.location.href;le({urlStr:p,pathConfig:r.organization.pathConfig})?(b("starting recording..."),l.setRecording(!0)):b("recording did not start as current URL is blocked");let m=ft(window,r.organization.cohortsBootstrapConfig);l.isRecording&&(l.recordChangeCustomCohort({uid:r.settings.uid,userCohorts:r.settings.userCohorts?{...m,...r.settings.userCohorts}:{}}),t.setSession(r)),Ve.onCLS(T=>{l.isRecording&&l.recordCLS(T)}),Ve.onINP(T=>{l.isRecording&&l.recordINP(T)}),Ve.onLCP(T=>{l.isRecording&&l.recordLCP(T)});let h=()=>{f.clearAndSaveEvents(u.getEvents())},C=window.setInterval(h,oo);window.addEventListener("blur",()=>{l.recordFocusChange("blur")}),window.addEventListener("focus",()=>{l.recordFocusChange("focus")}),document.addEventListener("visibilitychange",()=>{if(b(`detected a visibility change to ${document.visibilityState}`),l.isRecording&&l.recordVisibilityChange(document.visibilityState),document.visibilityState==="hidden"){C&&(b("clearing the saveInterval"),clearInterval(C),C=void 0),u.onVisibilityChange(!1);return}C||(b("resuming the saveInterval"),C=window.setInterval(h,oo))});let w=p,S=new MutationObserver(()=>{if(u&&window.location.href!==w){let T=le({urlStr:window.location.href,pathConfig:r.organization.pathConfig});b(`url changed detected, status: ${!!T}`),l.setRecording(!!T),w=window.location.href}});return S.observe(document,{subtree:!0,childList:!0}),{recorder:l,eventSync:f,urlChangeObserverDispose:()=>{S.disconnect()}}}var io=e=>so(e);var je=!1,ao="_adora_user_id",lo="_adora_rate_limited",ge,it,_r="stopped",co=()=>{b("startRecording",`adoraIsRunning: ${je}`),_r==="started"&&(ge=io({sessionType:"adoraSessionScript"}))},uo=1e3*60*30,ql=async({userCohorts:e,...t})=>{let r=t;if(_r="started",b("adora start",{adoraIsRunning:je,uid:r.uid,userCohorts:e||{}}),typeof window.sessionStorage!="object"){b("SSR detected");return}if(e){r.userCohorts={};for(let[i,d]of Object.entries(e))d!==void 0?(b("setting user cohorts key",{key:i,value:d}),r.userCohorts[i]=d):b("found undefined user cohorts key",{key:i})}let n=new we("adoraSessionScript",new ve),o=n.getSession();if(o){b("session detected; finding if changes should be written");let i=!1;if(r.uid&&o.settings.uid!==r.uid&&(b("detected uid change"),o.settings.uid=r.uid,n.setSession(o),i=!0),r.userCohorts&&Object.keys(r.userCohorts).length>0){b("detected user cohorts");let d=structuredClone(o.settings.userCohorts);Mi(d,r.userCohorts)||(b("detected user cohorts have been changed"),o.settings.userCohorts=r.userCohorts,n.setSession(o),i=!0)}i&&ge?.recorder&&ge?.recorder.isRecording&&(b("writing cohort change to recorder"),ge?.recorder.recordChangeCustomCohort({uid:o.settings.uid,userCohorts:o.settings.userCohorts?{...o.settings.userCohorts}:{}}))}if(je===!0)return;je=!0;let s=n.lastRateLimitedTimestamp;if(s!==void 0){if(Date.now()-s<uo){b("exiting as the session has been rate limited recently");return}n.clearLastRateLimitedTimestamp()}if(Ut.get(lo)){b("exiting as the domain has been rate limited recently");return}if(o){b("start recording for existing session"),co();return}let a=!1,c=async(i,d)=>{if(b("start status",{started:a}),a)return;a=!0;let l=await Hr("adoraSessionScript",d,r);if(l.type==="error"){l.code==="RateLimitExceeded"&&(b("setting expiration on local storage"),n.setLastRateLimitedTimestamp(Date.now()),i&&(b("setting expiration cookie"),Ut.set(lo,i,{expires:new Date(Date.now()+uo),domain:i})));return}co()};b("launching session preload");try{let i=await new ye(r.backendUrl).sessionPreload({orgId:r.orgId});b("session preload resolved");let d=window.location.href;if(i){if(i.error){b("error preloading",i.error);return}let l=zr(i.data);if("scheduledDowntime"in l){b("scheduled downtime; exiting");return}let{organization:u}=l;b("session preload success");let f=Ut.get(ao),p;b("existing adora user id cookie:",f);for(let m of u.cookieDomains)(window.location.hostname.toLowerCase()===m||window.location.hostname.toLowerCase().endsWith(`.${m}`))&&(p=m,f||(f=Ni(),Ut.set(ao,f,{domain:m,expires:new Date(Date.now()+365*24*60*60*1e3)}),b("setting adoraUserId cookie on domain",f)));b("using adora user id:",f),le({urlStr:d,pathConfig:u.pathConfig})?(b("at an unblocked URL, starting adora"),await c(p,f)):(b("at an blocked URL, waiting for unblocked URL to start adora"),it&&it.disconnect(),it=new MutationObserver((m,h)=>{if(d!==window.location.href){let C=window.location.href,w=le({urlStr:C,pathConfig:u.pathConfig});if(b(`url changed detected during blocked state, status: ${!!w}`),w){b("disconnecting observer"),h.disconnect(),b("scheduling adora to start"),c(p,f);return}d=C}}),it.observe(document,{subtree:!0,childList:!0}))}}catch(i){b("Error in adoraStart:",i)}},Ql=async()=>{_r="stopped",b("adora stop",{adoraIsRunning:je}),ge&&(ge.recorder.setRecording(!1),ge.recorder.stopFutureRecordings(),ge.urlChangeObserverDispose(),await ge.eventSync.clearAndSaveEvents()),it?.disconnect(),je=!1,ge=void 0};export{je as adoraIsRunning,ql as adoraStart,Ql as adoraStop,Hn as getDom0EventHandlers};
4
4
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adora-so/adora-js",
3
3
  "description": "Adora JavaScript SDK",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "dependencies": {
6
6
  "fast-equals": "5.3.3",
7
7
  "js-cookie": "3.0.5",