alphana-sdk 2.0.5 → 2.0.6

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.
@@ -1,8 +1,8 @@
1
- "use strict";var AlphanaSDK=(()=>{var ft=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var jr=Object.getOwnPropertyNames;var Qr=Object.prototype.hasOwnProperty;var mt=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var qr=(t,e)=>{for(var r in e)ft(t,r,{get:e[r],enumerable:!0})},Xr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jr(e))!Qr.call(t,i)&&i!==r&&ft(t,i,{get:()=>e[i],enumerable:!(n=Jr(e,i))||n.enumerable});return t};var $r=t=>Xr(ft({},"__esModule",{value:!0}),t);var wi={};qr(wi,{ALPHANA_SDK_VERSION:()=>Ge,DEFAULT_ENDPOINT:()=>Ut,LogCapture:()=>we,UserTracker:()=>We,command:()=>Vt,getTracker:()=>Ci,init:()=>Ht,renderHeatmap:()=>Xt});function Ne(t){return t.replace(/\/events\/?$/,"")}function Ue(t){return`${Ne(t)}/collect`}function gt(t,e){return{...e.appId?{appId:e.appId}:{},visitorId:e.visitorId,events:t.map(r=>({sessionId:e.sessionId,type:r.type,data:r.data}))}}function yt(t){return{...t.appId?{appId:t.appId}:{},visitorId:t.visitorId,heartbeat:{sessionId:t.sessionId,visitorId:t.visitorId,path:t.path,active:t.active,...t.appId?{appId:t.appId}:{}}}}function Kt(t){return{...t.appId?{appId:t.appId}:{},log:t}}var vt="application/x-alphana-gzip";function en(){return typeof CompressionStream!="undefined"}async function Zt(t){if(!en())return null;try{let e=new TextEncoder().encode(t),r=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(r).arrayBuffer())}catch(e){return null}}var Jt=1024;async function zt(t,e,r=!1){var o;let n=(o=e.compressionThresholdBytes)!=null?o:Jt;if(!r&&e.compressPayloads!==!1&&t.length>=n){let s=await Zt(t);if(s)return{codec:"gzip",body:s,contentType:vt}}return{codec:"json",body:t,contentType:"application/json"}}async function Yt(t,e,r){var i,o;let n={"Content-Type":e.contentType,...e.codec==="gzip"?{Accept:vt}:{},...(i=r.authHeaders)!=null?i:{}};return fetch(t,{method:"POST",headers:n,body:e.body,keepalive:(o=r.keepalive)!=null?o:!1})}async function fe(t,e,r={}){try{let n=await zt(e,r),i=await Yt(t,n,r);if(n.codec==="gzip"&&(i.status===415||i.status===400)){let o=await zt(e,r,!0);i=await Yt(t,o,r)}}catch(n){}}function It(t,e,r={}){var o,s;let n=(o=r.compressionThresholdBytes)!=null?o:Jt;if(r.compressPayloads!==!1&&e.length>=n||Object.keys((s=r.authHeaders)!=null?s:{}).length>0){fe(t,e,{...r,keepalive:!0});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let a=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,a))return}fe(t,e,{...r,keepalive:!0})}var we=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=!1;var r,n,i;this.collectUrl=(r=e.collectEndpoint)!=null?r:Ue(e.endpoint),this.sessionId=e.sessionId,this.appId=e.appId,this.authHeaders=e.secretKey?{Authorization:`Bearer ${e.secretKey}`}:{},this.compressPayloads=(n=e.compressPayloads)!=null?n:!0,this.compressionThresholdBytes=(i=e.compressionThresholdBytes)!=null?i:1024}init(){typeof window=="undefined"||this.initialized||(this.origInfo=console.info.bind(console),this.origWarn=console.warn.bind(console),this.origError=console.error.bind(console),console.info=(...e)=>{this.origInfo(...e),this.send("info",this.format(e))},console.warn=(...e)=>{this.origWarn(...e),this.send("warn",this.format(e))},console.error=(...e)=>{this.origError(...e);let[r]=e,n=r instanceof Error?r.stack:void 0;this.send("error",this.format(e),{stack:n})},this.prevOnError=window.onerror,window.onerror=(e,r,n,i,o)=>(this.send("error",String(e),{stack:o==null?void 0:o.stack,meta:{src:r,line:n,col:i}}),typeof this.prevOnError=="function"?this.prevOnError(e,r,n,i,o):!1),this.prevOnUnhandledRejection=e=>{let r=e.reason,n=r instanceof Error?r.message:String(r!=null?r:"Unhandled promise rejection");this.send("error",n,{stack:r instanceof Error?r.stack:void 0})},window.addEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!0)}destroy(){this.initialized&&(console.info=this.origInfo,console.warn=this.origWarn,console.error=this.origError,window.onerror=this.prevOnError,this.prevOnUnhandledRejection&&window.removeEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!1)}capture(e,r,n){this.send(e,r,n)}format(e){return e.map(r=>{if(r instanceof Error)return r.message;if(typeof r=="object")try{return JSON.stringify(r)}catch(n){return String(r)}return String(r)}).join(" ")}send(e,r,n){let i={sessionId:this.sessionId,...this.appId?{appId:this.appId}:{},level:e,message:r,url:typeof window!="undefined"?window.location.href:void 0,stack:n==null?void 0:n.stack,meta:n==null?void 0:n.meta,timestamp:Date.now()},o=JSON.stringify(Kt(i));fe(this.collectUrl,o,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:!0}).catch(s=>{this.origError&&this.origError("[user-tracker] Failed to send log:",s)})}};var Ge="2.0.2";function jt(t){var r,n;let e=t.toLowerCase();return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|android|iphone|ipod|windows phone/i.test(e)?"mobile":typeof navigator!="undefined"&&navigator.maxTouchPoints>0&&typeof window!="undefined"&&((n=(r=window.matchMedia)==null?void 0:r.call(window,"(pointer: coarse)"))==null?void 0:n.matches)&&/macintosh|mac os x/i.test(e)?"tablet":"desktop"}function tn(t){return/windows/i.test(t)?"Windows":/android/i.test(t)?"Android":/iphone|ipad|ipod/i.test(t)?"iOS":/mac os x|macintosh/i.test(t)?"macOS":/linux/i.test(t)?"Linux":"Other"}function rn(t){return/edg\//i.test(t)?"Edge":/opr\/|opera/i.test(t)?"Opera":/chrome\/[0-9]/i.test(t)&&!/chromium/i.test(t)?"Chrome":/firefox\/[0-9]/i.test(t)?"Firefox":/safari\/[0-9]/i.test(t)&&!/chrome/i.test(t)?"Safari":"Other"}function nn(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function on(t,e){var n;let r=((n=e.platform)!=null?n:"").toLowerCase();return r==="ios"||r==="ipados"||r==="android"?e.mobile?"mobile":"tablet":e.mobile===!0?"mobile":jt(t)}function Qt(t){var a,c,l,d,u,p,m,h,v,I,y,f;if(typeof window=="undefined"||typeof navigator=="undefined")return{sessionId:t,timestamp:Date.now(),device:"desktop",os:"Other",browser:"Other",language:"",languages:[],colorScheme:"",screenWidth:0,screenHeight:0,viewportWidth:0,viewportHeight:0,devicePixelRatio:1,timeZone:"",sdkVersion:Ge};let e=navigator.userAgent||"",r=nn(),n=r.mobile!==void 0||r.platform?on(e,r):jt(e),i="";(c=(a=window.matchMedia)==null?void 0:a.call(window,"(prefers-color-scheme: dark)"))!=null&&c.matches?i="dark":(d=(l=window.matchMedia)==null?void 0:l.call(window,"(prefers-color-scheme: light)"))!=null&&d.matches&&(i="light");let o="";try{o=(u=Intl.DateTimeFormat().resolvedOptions().timeZone)!=null?u:""}catch(g){o=""}let s=typeof navigator.languages!="undefined"&&navigator.languages.length?[...navigator.languages]:navigator.language?[navigator.language]:[];return{sessionId:t,timestamp:Date.now(),device:n,os:tn(e),browser:rn(e),language:navigator.language||"",languages:s,colorScheme:i,screenWidth:(m=(p=window.screen)==null?void 0:p.width)!=null?m:0,screenHeight:(v=(h=window.screen)==null?void 0:h.height)!=null?v:0,viewportWidth:(I=window.innerWidth)!=null?I:0,viewportHeight:(y=window.innerHeight)!=null?y:0,devicePixelRatio:(f=window.devicePixelRatio)!=null?f:1,timeZone:o,sdkVersion:Ge}}function sn(){let t=[[0,0,255],[0,255,255],[0,255,0],[255,255,0],[255,128,0],[255,0,0]],e=[],r=51;for(let n=0;n<t.length-1;n++){let[i,o,s]=t[n],[a,c,l]=t[n+1];for(let d=0;d<r;d++){let u=d/r;e.push([Math.round(i+(a-i)*u),Math.round(o+(c-o)*u),Math.round(s+(l-s)*u)])}}return e}var qt=sn();function Xt(t,e,r={}){let{radius:n=25,maxOpacity:i=.85,minOpacity:o=0}=r,s=t.getContext("2d");if(!s)return;let{width:a,height:c}=t;if(s.clearRect(0,0,a,c),e.length===0)return;let l=document.createElement("canvas");l.width=a,l.height=c;let d=l.getContext("2d");if(!d)return;for(let I of e){let y=I.xPct/100*a,f=I.yPct/100*c,g=I.type==="click"?n*1.6:n,b=d.createRadialGradient(y,f,0,y,f,g);b.addColorStop(0,"rgba(0,0,0,0.15)"),b.addColorStop(1,"rgba(0,0,0,0)"),d.fillStyle=b,d.beginPath(),d.arc(y,f,g,0,Math.PI*2),d.fill()}let u=d.getImageData(0,0,a,c),p=s.createImageData(a,c),m=u.data,h=p.data,v=qt.length-1;for(let I=0;I<m.length;I+=4){let y=m[I+3];if(y===0)continue;let f=y/255,g=Math.min(Math.floor(f*v),v),[b,x,P]=qt[g],B=o+f*(i-o);h[I]=b,h[I+1]=x,h[I+2]=P,h[I+3]=Math.round(B*255)}s.putImageData(p,0,0)}var $t="__ut_vid__";function Ct(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function er(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem($t)}catch(t){return null}}function tr(t){if(typeof localStorage!="undefined")try{localStorage.setItem($t,t)}catch(e){}}function E(t){if(!t)return t;let e=t.indexOf("?"),r=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e):"",i=r;for(let s=0;s<5;s++)try{let a=decodeURIComponent(i);if(a===i)break;i=a}catch(a){break}let o=n;for(let s=0;s<5;s++)try{let a=decodeURIComponent(o);if(a===o)break;o=a}catch(a){break}return i+o}var ir="__ut_last_pv_path__",or="__ut_last_pv_entry_ms__";function rr(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function nr(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e)}catch(r){}}function an(t,e){nr(ir,t),nr(or,String(e))}function cn(){if(typeof performance=="undefined")return;let e=performance.getEntriesByType("navigation")[0];if(e!=null&&e.type)return e.type;let r=performance.navigation;if((r==null?void 0:r.type)===2)return"back_forward"}var Oe=class Oe{constructor({emit:e,sessionId:r}){this.previousPath="";this.originalPushState=null;this.originalReplaceState=null;this.pageEntryTime=0;this.handlePopState=()=>{this.handleNavigation()};this.emit=e,this.sessionId=r}init(){let e=E(window.location.pathname+window.location.search);cn()==="back_forward"&&this.tryEmitMpaHistoryTraversalUturn(e),this.recordPageView(e),window.addEventListener("popstate",this.handlePopState),this.originalPushState=history.pushState.bind(history);let r=this.originalPushState;history.pushState=(i,o,s)=>{r(i,o,s),this.handleNavigation()},this.originalReplaceState=history.replaceState.bind(history);let n=this.originalReplaceState;history.replaceState=(i,o,s)=>{n(i,o,s),this.handleNavigation()}}destroy(){window.removeEventListener("popstate",this.handlePopState),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState)}tryEmitMpaHistoryTraversalUturn(e){let r=rr(ir),n=rr(or),i=n?Number(n):0;if(!r||!Number.isFinite(i)||i<=0||E(r)===e)return;let o=Date.now()-i;o<0||o>Oe.UTURN_THRESHOLD_MS||this.emitUturn(E(r),e,o)}handleNavigation(){let e=E(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=Oe.UTURN_THRESHOLD_MS&&this.emitUturn(this.previousPath,e,r)}this.recordPageView(e)}}emitUturn(e,r,n){this.emit({type:"uturn",data:{fromPath:e,toPath:r,timeOnPageMs:n,timestamp:Date.now(),sessionId:this.sessionId}})}recordPageView(e){let r=E(e);this.previousPath=r,this.pageEntryTime=Date.now(),an(r,this.pageEntryTime),this.emit({type:"pageview",data:{path:r,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer||void 0}}),window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:r,title:document.title}}))}};Oe.UTURN_THRESHOLD_MS=5e3;var He=Oe;var Ve=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=!1;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=E(e.detail.path),this.startTracking()};this.handleVisibilityChange=()=>{document.hidden?this.stopTracking():this.startTracking()};this.handleUnload=()=>{this.stopTracking()};this.emit=e,this.sessionId=r}init(){this.currentPath=E(window.location.pathname+window.location.search),this.startTracking(),window.addEventListener("tracker:navigate",this.handleNavigate),document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleUnload),window.addEventListener("pagehide",this.handleUnload)}destroy(){this.stopTracking(),window.removeEventListener("tracker:navigate",this.handleNavigate),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleUnload),window.removeEventListener("pagehide",this.handleUnload)}startTracking(){this.startTime=Date.now(),this.tracking=!0}stopTracking(){if(!this.tracking||!this.currentPath)return;let e=Date.now()-this.startTime;if(e<100){this.tracking=!1;return}this.emit({type:"timespent",data:{path:this.currentPath,duration:e,sessionId:this.sessionId,timestamp:Date.now()}}),this.tracking=!1}};function bt(t,e){let r=0;return(...n)=>{let i=Date.now();i-r>=e&&(r=i,t(...n))}}var ln="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",sr=/^[A-Za-z][\w-]*$/;function dn(t){if(!t||t.nodeType!==1)return"";let e=t.id;if(e&&sr.test(e))return"#"+e;let r=[],n=t,i=0;for(;n&&n.nodeType===1&&n!==document.body&&i<5;){let o=n.id;if(o&&sr.test(o)){r.unshift("#"+o);break}let s=n.tagName.toLowerCase(),a=1,c=n.previousElementSibling;for(;c;)c.tagName===n.tagName&&a++,c=c.previousElementSibling;r.unshift(s+":nth-of-type("+a+")"),n=n.parentElement,i++}return r.join(">")}function ar(t,e,r){let n=t instanceof Element?t:null;if(!n)return{};let i=n.closest(ln);if(!i)return{};let o=dn(i);if(!o)return{};let s=i.getBoundingClientRect();if(s.width<=0||s.height<=0)return{selector:o};let a=Math.min(1,Math.max(0,(e-s.left)/s.width)),c=Math.min(1,Math.max(0,(r-s.top)/s.height));return{selector:o,relX:Math.round(a*1e3)/1e3,relY:Math.round(c*1e3)/1e3}}var ue=class ue{constructor({emit:e,sessionId:r,sampleRate:n=.3,maxPoints:i=2e3,allowedPaths:o}){this.currentPath="";this.pointCounts={};this.maxScrollDepth={};this.recentClicks=[];this.handleMouseMove=e=>{if(Math.random()>this.sampleRate)return;let r=document.documentElement.scrollWidth,n=document.documentElement.scrollHeight,i=e.clientY+window.scrollY;this.recordPoint({x:e.clientX,y:i,xPct:r>0?e.clientX/r*100:0,yPct:n>0?i/n*100:0,pw:r,ph:n,vw:window.innerWidth,type:"move"})};this.handleClick=e=>{if(Date.now()-this.lastTouchTime<500)return;let r=document.documentElement.scrollWidth,n=document.documentElement.scrollHeight,i=e.clientY+window.scrollY,o=this.getClickTarget(e),s=ar(e.target,e.clientX,e.clientY);this.recordPoint({x:e.clientX,y:i,xPct:r>0?e.clientX/r*100:0,yPct:n>0?i/n*100:0,pw:r,ph:n,vw:window.innerWidth,type:"click",...o?{target:o}:{},...s}),this.checkRageClick(e.clientX,i,this.currentPath)};this.lastTouchTime=0;this.handleTouchEnd=e=>{let r=e.changedTouches[0];if(!r)return;let n=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight,o=r.clientY+window.scrollY;this.lastTouchTime=Date.now();let s=ar(e.target,r.clientX,r.clientY);this.recordPoint({x:r.clientX,y:o,xPct:n>0?r.clientX/n*100:0,yPct:i>0?o/i*100:0,pw:n,ph:i,vw:window.innerWidth,type:"click",...s}),this.checkRageClick(r.clientX,o,this.currentPath)};this.handleScroll=()=>{var p;let e=document.documentElement.scrollWidth,r=document.documentElement.scrollHeight,n=window.innerWidth,i=window.innerHeight,o=window.scrollX,s=window.scrollY,a=Math.min(r,s+i),c=r>0?a/r*100:0,l=(p=this.maxScrollDepth[this.currentPath])!=null?p:0,d=c>l+1;if(d&&(this.maxScrollDepth[this.currentPath]=c),!d&&Math.random()>this.sampleRate)return;let u=o+n/2;this.recordPoint({x:n/2,y:a,xPct:e>0?u/e*100:50,yPct:c,pw:e,ph:r,vw:n,type:"scroll"})};this.handleNavigate=e=>{this.currentPath=E(e.detail.path)};this.emit=e,this.sessionId=r,this.sampleRate=n,this.maxPoints=i,this.allowedPaths=o&&o.length>0?new Set(o.map(s=>E(s))):null,this.throttledMouseMove=bt(this.handleMouseMove,50),this.throttledScroll=bt(this.handleScroll,100)}init(){this.currentPath=E(window.location.pathname+window.location.search),document.addEventListener("mousemove",this.throttledMouseMove),document.addEventListener("click",this.handleClick),document.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),window.addEventListener("scroll",this.throttledScroll,{passive:!0}),window.addEventListener("tracker:navigate",this.handleNavigate)}destroy(){document.removeEventListener("mousemove",this.throttledMouseMove),document.removeEventListener("click",this.handleClick),document.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("scroll",this.throttledScroll),window.removeEventListener("tracker:navigate",this.handleNavigate)}canRecord(){var e;return this.allowedPaths!==null&&!this.allowedPaths.has(this.currentPath)?!1:((e=this.pointCounts[this.currentPath])!=null?e:0)<this.maxPoints}recordPoint(e){var r;this.canRecord()&&(this.pointCounts[this.currentPath]=((r=this.pointCounts[this.currentPath])!=null?r:0)+1,this.emit({type:"heatmap",data:{...e,path:this.currentPath,timestamp:Date.now()}}))}getClickTarget(e){var i,o,s,a;let r=e.target;return r&&(r.getAttribute("aria-label")||((i=r.closest("[aria-label]"))==null?void 0:i.getAttribute("aria-label"))||r.getAttribute("data-track-label")||r.getAttribute("id")||(r instanceof HTMLButtonElement||r instanceof HTMLAnchorElement?(o=r.innerText)==null?void 0:o.trim().slice(0,60):(a=(s=r.closest("button, a"))==null?void 0:s.textContent)==null?void 0:a.trim().slice(0,60)))||void 0}checkRageClick(e,r,n){let i=Date.now();this.recentClicks=this.recentClicks.filter(s=>i-s.t<ue.RAGE_WINDOW_MS),this.recentClicks.push({x:e,y:r,t:i});let o=this.recentClicks.filter(s=>Math.hypot(s.x-e,s.y-r)<=ue.RAGE_RADIUS_PX);o.length>=ue.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:n,x:e,y:r,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[])}};ue.RAGE_THRESHOLD=3,ue.RAGE_WINDOW_MS=1e3,ue.RAGE_RADIUS_PX=50;var Ke=ue;var _;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(_||(_={}));function un(t){return t.nodeType===t.ELEMENT_NODE}function ve(t){var e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function ge(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function hn(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function St(t){try{var e=t.rules||t.cssRules;return e?hn(Array.from(e).map(wt).join("")):null}catch(r){return null}}function wt(t){var e=t.cssText;if(pn(t))try{e=St(t.styleSheet)||e}catch(r){}return e}function pn(t){return"styleSheet"in t}var dr=(function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var r;if(!e)return-1;var n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n!=null?n:-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(i){return r.removeNodeFromMap(i)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r)},t.prototype.replace=function(e,r){var n=this.getNode(e);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(e,r)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t})();function ur(){return new dr}function Pe(t){var e=t.maskInputOptions,r=t.tagName,n=t.type,i=t.value,o=t.maskInputFn,s=i||"";return(e[r.toLowerCase()]||e[n])&&(o?s=o(s):s="*".repeat(s.length)),s}var cr="__rrweb_original__";function fn(t){var e=t.getContext("2d");if(!e)return!0;for(var r=50,n=0;n<t.width;n+=r)for(var i=0;i<t.height;i+=r){var o=e.getImageData,s=cr in o?o[cr]:o,a=new Uint32Array(s.call(e,n,i,Math.min(r,t.width-n),Math.min(r,t.height-i)).data.buffer);if(a.some(function(c){return c!==0}))return!1}return!0}var mn=1,gn=new RegExp("[^a-z0-9-_:]"),ye=-2;function At(){return mn++}function yn(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return gn.test(e)?"div":e}function vn(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function In(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ae,lr,Cn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,bn=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Sn=/^(data:)([^,]*),(.*)/i;function Ze(t,e){return(t||"").replace(Cn,function(r,n,i,o,s,a){var c=i||s||a,l=n||o||"";if(!c)return r;if(!bn.test(c)||Sn.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(In(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var p=0,m=u;p<m.length;p++){var h=m[p];h!=="."&&(h===".."?d.pop():d.push(h))}return"url(".concat(l).concat(d.join("/")).concat(l,")")})}var wn=/^[^ \t\n\r\u000c]+/,An=/^[, \t\n\r\u000c]+/;function kn(t,e){if(e.trim()==="")return e;var r=0;function n(l){var d,u=l.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var i=[];n(An),!(r>=e.length);){var o=n(wn);if(o.slice(-1)===",")o=ke(t,o.substring(0,o.length-1)),i.push(o);else{var s="";o=ke(t,o);for(var a=!1;;){var c=e.charAt(r);if(c===""){i.push((o+s).trim());break}else if(a)c===")"&&(a=!1);else if(c===","){r+=1,i.push((o+s).trim());break}else c==="("&&(a=!0);s+=c,r+=1}}}return i.join(", ")}function ke(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function Tn(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function kt(){var t=document.createElement("a");return t.href="",t.href}function Tt(t,e,r,n){return r==="src"||r==="href"&&n&&!(e==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(e==="table"||e==="td"||e==="th")?ke(t,n):r==="srcset"&&n?kn(t,n):r==="style"&&n?Ze(n,kt()):e==="object"&&r==="data"&&n?ke(t,n):n}function En(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return!0}return r?t.matches(r):!1}function Le(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return r?Le(t.parentNode,e,r):!1;for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return!0}return r?Le(t.parentNode,e,r):!1}function Et(t,e,r){var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return!1;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return!0}else if(Le(n,e,!0))return!0;return!!(r&&(n.matches(r)||n.closest(r)))}function Rn(t,e,r){var n=t.contentWindow;if(n){var i=!1,o;try{o=n.document.readyState}catch(c){return}if(o!=="complete"){var s=setTimeout(function(){i||(e(),i=!0)},r);t.addEventListener("load",function(){clearTimeout(s),i=!0,e()});return}var a="about:blank";if(n.location.href!==a||t.src===a||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function xn(t,e,r){var n=!1,i;try{i=t.sheet}catch(s){return}if(!i){var o=setTimeout(function(){n||(e(),n=!0)},r);t.addEventListener("load",function(){clearTimeout(o),n=!0,e()})}}function Mn(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,p=e.maskInputFn,m=e.dataURLOptions,h=m===void 0?{}:m,v=e.inlineImages,I=e.recordCanvas,y=e.keepIframeSrcFn,f=e.newlyAddedElement,g=f===void 0?!1:f,b=Nn(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:_.Document,childNodes:[],compatMode:t.compatMode}:{type:_.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:_.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return Ln(t,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:c,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:v,recordCanvas:I,keepIframeSrcFn:y,newlyAddedElement:g,rootId:b});case t.TEXT_NODE:return On(t,{maskTextClass:s,maskTextSelector:a,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:_.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:_.Comment,textContent:t.textContent||"",rootId:b};default:return!1}}function Nn(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function On(t,e){var r,n=e.maskTextClass,i=e.maskTextSelector,o=e.maskTextFn,s=e.rootId,a=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=a==="STYLE"?!0:void 0,d=a==="SCRIPT"?!0:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=vn(t.parentNode.sheet))}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t)}c=Ze(c,kt())}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&Et(t,n,i)&&(c=o?o(c):c.replace(/[\S]/g,"*")),{type:_.Text,textContent:c||"",isStyle:l,rootId:s}}function Ln(t,e){for(var r=e.doc,n=e.blockClass,i=e.blockSelector,o=e.inlineStylesheet,s=e.maskInputOptions,a=s===void 0?{}:s,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,p=e.recordCanvas,m=e.keepIframeSrcFn,h=e.newlyAddedElement,v=h===void 0?!1:h,I=e.rootId,y=En(t,n,i),f=yn(t),g={},b=t.attributes.length,x=0;x<b;x++){var P=t.attributes[x];g[P.name]=Tt(r,f,P.name,P.value)}if(f==="link"&&o){var B=Array.from(r.styleSheets).find(function(Q){return Q.href===t.href}),T=null;B&&(T=St(B)),T&&(delete g.rel,delete g.href,g._cssText=Ze(T,B.href))}if(f==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=St(t.sheet);T&&(g._cssText=Ze(T,kt()))}if(f==="input"||f==="textarea"||f==="select"){var Y=t.value,J=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&Y?g.value=Pe({type:g.type,tagName:f,value:Y,maskInputOptions:a,maskInputFn:c}):J&&(g.checked=J)}if(f==="option"&&(t.selected&&!a.select?g.selected=!0:delete g.selected),f==="canvas"&&p){if(t.__context==="2d")fn(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var X=t.toDataURL(d.type,d.quality),$=document.createElement("canvas");$.width=t.width,$.height=t.height;var ee=$.toDataURL(d.type,d.quality);X!==ee&&(g.rr_dataURL=X)}}if(f==="img"&&u){Ae||(Ae=r.createElement("canvas"),lr=Ae.getContext("2d"));var F=t,j=F.crossOrigin;F.crossOrigin="anonymous";var re=function(){try{Ae.width=F.naturalWidth,Ae.height=F.naturalHeight,lr.drawImage(F,0,0),g.rr_dataURL=Ae.toDataURL(d.type,d.quality)}catch(Q){console.warn("Cannot inline img src=".concat(F.currentSrc,"! Error: ").concat(Q))}j?g.crossOrigin=j:F.removeAttribute("crossorigin")};F.complete&&F.naturalWidth!==0?re():F.onload=re}if((f==="audio"||f==="video")&&(g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(g.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(g.rr_scrollTop=t.scrollTop)),y){var se=t.getBoundingClientRect(),ce=se.width,H=se.height;g={class:g.class,rr_width:"".concat(ce,"px"),rr_height:"".concat(H,"px")}}return f==="iframe"&&!m(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:_.Element,tagName:f,attributes:g,childNodes:[],isSVG:Tn(t)||void 0,needBlock:y,rootId:I}}function R(t){return t===void 0?"":t.toLowerCase()}function Pn(t,e){if(e.comment&&t.type===_.Comment)return!0;if(t.type===_.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(R(t.attributes.name).match(/^msapplication-tile(image|color)$/)||R(t.attributes.name)==="application-name"||R(t.attributes.rel)==="icon"||R(t.attributes.rel)==="apple-touch-icon"||R(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&R(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(R(t.attributes.property).match(/^(og|twitter|fb):/)||R(t.attributes.name).match(/^(og|twitter):/)||R(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(R(t.attributes.name)==="robots"||R(t.attributes.name)==="googlebot"||R(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(R(t.attributes.name)==="author"||R(t.attributes.name)==="generator"||R(t.attributes.name)==="framework"||R(t.attributes.name)==="publisher"||R(t.attributes.name)==="progid"||R(t.attributes.property).match(/^article:/)||R(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(R(t.attributes.name)==="google-site-verification"||R(t.attributes.name)==="yandex-verification"||R(t.attributes.name)==="csrf-token"||R(t.attributes.name)==="p:domain_verify"||R(t.attributes.name)==="verify-v1"||R(t.attributes.name)==="verification"||R(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function me(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,c=e.skipChild,l=c===void 0?!1:c,d=e.inlineStylesheet,u=d===void 0?!0:d,p=e.maskInputOptions,m=p===void 0?{}:p,h=e.maskTextFn,v=e.maskInputFn,I=e.slimDOMOptions,y=e.dataURLOptions,f=y===void 0?{}:y,g=e.inlineImages,b=g===void 0?!1:g,x=e.recordCanvas,P=x===void 0?!1:x,B=e.onSerialize,T=e.onIframeLoad,Y=e.iframeLoadTimeout,J=Y===void 0?5e3:Y,X=e.onStylesheetLoad,$=e.stylesheetLoadTimeout,ee=$===void 0?5e3:$,F=e.keepIframeSrcFn,j=F===void 0?function(){return!1}:F,re=e.newlyAddedElement,se=re===void 0?!1:re,ce=e.preserveWhiteSpace,H=ce===void 0?!0:ce,Q=Mn(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:v,dataURLOptions:f,inlineImages:b,recordCanvas:P,keepIframeSrcFn:j,newlyAddedElement:se});if(!Q)return console.warn(t,"not serialized"),null;var de;n.hasNode(t)?de=n.getId(t):Pn(Q,I)||!H&&Q.type===_.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?de=ye:de=At();var L=Object.assign(Q,{id:de});if(n.add(t,L),de===ye)return null;B&&B(t);var ne=!l;if(L.type===_.Element){ne=ne&&!L.needBlock,delete L.needBlock;var ae=t.shadowRoot;ae&&ge(ae)&&(L.isShadowHost=!0)}if((L.type===_.Document||L.type===_.Element)&&ne){I.headWhitespace&&L.type===_.Element&&L.tagName==="head"&&(H=!1);for(var Se={doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:f,inlineImages:b,recordCanvas:P,preserveWhiteSpace:H,onSerialize:B,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:j},C=0,U=Array.from(t.childNodes);C<U.length;C++){var V=U[C],M=me(V,Se);M&&L.childNodes.push(M)}if(un(t)&&t.shadowRoot)for(var q=0,A=Array.from(t.shadowRoot.childNodes);q<A.length;q++){var V=A[q],M=me(V,Se);M&&(ge(t.shadowRoot)&&(M.isShadow=!0),L.childNodes.push(M))}}return t.parentNode&&ve(t.parentNode)&&ge(t.parentNode)&&(L.isShadow=!0),L.type===_.Element&&L.tagName==="iframe"&&Rn(t,function(){var K=t.contentDocument;if(K&&T){var Me=me(K,{doc:K,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:f,inlineImages:b,recordCanvas:P,preserveWhiteSpace:H,onSerialize:B,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:j});Me&&T(t,Me)}},J),L.type===_.Element&&L.tagName==="link"&&L.attributes.rel==="stylesheet"&&xn(t,function(){if(X){var K=me(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:f,inlineImages:b,recordCanvas:P,preserveWhiteSpace:H,onSerialize:B,onIframeLoad:T,iframeLoadTimeout:J,onStylesheetLoad:X,stylesheetLoadTimeout:ee,keepIframeSrcFn:j});K&&X(t,K)}},ee),L}function hr(t,e){var r=e||{},n=r.mirror,i=n===void 0?new dr:n,o=r.blockClass,s=o===void 0?"rr-block":o,a=r.blockSelector,c=a===void 0?null:a,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,p=u===void 0?null:u,m=r.inlineStylesheet,h=m===void 0?!0:m,v=r.inlineImages,I=v===void 0?!1:v,y=r.recordCanvas,f=y===void 0?!1:y,g=r.maskAllInputs,b=g===void 0?!1:g,x=r.maskTextFn,P=r.maskInputFn,B=r.slimDOM,T=B===void 0?!1:B,Y=r.dataURLOptions,J=r.preserveWhiteSpace,X=r.onSerialize,$=r.onIframeLoad,ee=r.iframeLoadTimeout,F=r.onStylesheetLoad,j=r.stylesheetLoadTimeout,re=r.keepIframeSrcFn,se=re===void 0?function(){return!1}:re,ce=b===!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}:b===!1?{password:!0}:b,H=T===!0||T==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:T==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:T===!1?{}:T;return me(t,{doc:t,mirror:i,blockClass:s,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:ce,maskTextFn:x,maskInputFn:P,slimDOMOptions:H,dataURLOptions:Y,inlineImages:I,recordCanvas:f,preserveWhiteSpace:J,onSerialize:X,onIframeLoad:$,iframeLoadTimeout:ee,onStylesheetLoad:F,stylesheetLoadTimeout:j,keepIframeSrcFn:se,newlyAddedElement:!1})}var Bn=/([^\\]):hover/,zi=new RegExp(Bn.source,"g");function W(t,e,r=document){let n={capture:!0,passive:!0};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Te=`Please stop import mirror directly. Instead of that,\r
1
+ "use strict";var AlphanaSDK=(()=>{var yt=Object.defineProperty;var ar=Object.getOwnPropertyDescriptor;var cr=Object.getOwnPropertyNames;var lr=Object.prototype.hasOwnProperty;var vt=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,n)=>(typeof require!="undefined"?require:e)[n]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var dr=(t,e)=>{for(var n in e)yt(t,n,{get:e[n],enumerable:!0})},ur=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cr(e))!lr.call(t,i)&&i!==n&&yt(t,i,{get:()=>e[i],enumerable:!(r=ar(e,i))||r.enumerable});return t};var pr=t=>ur(yt({},"__esModule",{value:!0}),t);var Wi={};dr(Wi,{ALPHANA_SDK_VERSION:()=>ze,DEFAULT_ENDPOINT:()=>zt,LogCapture:()=>ke,UserTracker:()=>Ve,command:()=>Yt,getTracker:()=>Bi,init:()=>Zt,renderHeatmap:()=>nn});function we(t){return t.replace(/\/events\/?$/,"")}function Ge(t){return`${we(t)}/collect`}function bt(t,e){return{...e.appId?{appId:e.appId}:{},visitorId:e.visitorId,events:t.map(n=>({sessionId:e.sessionId,type:n.type,data:n.data}))}}function It(t){return{...t.appId?{appId:t.appId}:{},visitorId:t.visitorId,heartbeat:{sessionId:t.sessionId,visitorId:t.visitorId,path:t.path,active:t.active,...t.appId?{appId:t.appId}:{}}}}function jt(t){return{...t.appId?{appId:t.appId}:{},log:t}}var Ct="application/x-alphana-gzip";function hr(){return typeof CompressionStream!="undefined"}async function Jt(t){if(!hr())return null;try{let e=new TextEncoder().encode(t),n=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return new Uint8Array(await new Response(n).arrayBuffer())}catch(e){return null}}var Xt=1024;async function qt(t,e,n=!1){var o;let r=(o=e.compressionThresholdBytes)!=null?o:Xt;if(!n&&e.compressPayloads!==!1&&t.length>=r){let s=await Jt(t);if(s)return{codec:"gzip",body:s,contentType:Ct}}return{codec:"json",body:t,contentType:"application/json"}}async function Qt(t,e,n){var i,o;let r={"Content-Type":e.contentType,...e.codec==="gzip"?{Accept:Ct}:{},...(i=n.authHeaders)!=null?i:{}};return fetch(t,{method:"POST",headers:r,body:e.body,keepalive:(o=n.keepalive)!=null?o:!1})}async function me(t,e,n={}){try{let r=await qt(e,n),i=await Qt(t,r,n);if(r.codec==="gzip"&&(i.status===415||i.status===400)){let o=await qt(e,n,!0);i=await Qt(t,o,n)}}catch(r){}}function St(t,e,n={}){var o,s;let r=(o=n.compressionThresholdBytes)!=null?o:Xt;if(n.compressPayloads!==!1&&e.length>=r||Object.keys((s=n.authHeaders)!=null?s:{}).length>0){me(t,e,{...n,keepalive:!0});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let a=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,a))return}me(t,e,{...n,keepalive:!0})}var ke=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=!1;var n,r,i;this.collectUrl=(n=e.collectEndpoint)!=null?n:Ge(e.endpoint),this.sessionId=e.sessionId,this.appId=e.appId,this.authHeaders=e.secretKey?{Authorization:`Bearer ${e.secretKey}`}:{},this.compressPayloads=(r=e.compressPayloads)!=null?r:!0,this.compressionThresholdBytes=(i=e.compressionThresholdBytes)!=null?i:1024}init(){typeof window=="undefined"||this.initialized||(this.origInfo=console.info.bind(console),this.origWarn=console.warn.bind(console),this.origError=console.error.bind(console),console.info=(...e)=>{this.origInfo(...e),this.send("info",this.format(e))},console.warn=(...e)=>{this.origWarn(...e),this.send("warn",this.format(e))},console.error=(...e)=>{this.origError(...e);let[n]=e,r=n instanceof Error?n.stack:void 0;this.send("error",this.format(e),{stack:r})},this.prevOnError=window.onerror,window.onerror=(e,n,r,i,o)=>(this.send("error",String(e),{stack:o==null?void 0:o.stack,meta:{src:n,line:r,col:i}}),typeof this.prevOnError=="function"?this.prevOnError(e,n,r,i,o):!1),this.prevOnUnhandledRejection=e=>{let n=e.reason,r=n instanceof Error?n.message:String(n!=null?n:"Unhandled promise rejection");this.send("error",r,{stack:n instanceof Error?n.stack:void 0})},window.addEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!0)}destroy(){this.initialized&&(console.info=this.origInfo,console.warn=this.origWarn,console.error=this.origError,window.onerror=this.prevOnError,this.prevOnUnhandledRejection&&window.removeEventListener("unhandledrejection",this.prevOnUnhandledRejection),this.initialized=!1)}capture(e,n,r){this.send(e,n,r)}format(e){return e.map(n=>{if(n instanceof Error)return n.message;if(typeof n=="object")try{return JSON.stringify(n)}catch(r){return String(n)}return String(n)}).join(" ")}send(e,n,r){let i={sessionId:this.sessionId,...this.appId?{appId:this.appId}:{},level:e,message:n,url:typeof window!="undefined"?window.location.href:void 0,stack:r==null?void 0:r.stack,meta:r==null?void 0:r.meta,timestamp:Date.now()},o=JSON.stringify(jt(i));me(this.collectUrl,o,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:!0}).catch(s=>{this.origError&&this.origError("[user-tracker] Failed to send log:",s)})}};var ze="2.0.2";function $t(t){var n,r;let e=t.toLowerCase();return/ipad|tablet|(android(?!.*mobile))/i.test(e)?"tablet":/mobile|android|iphone|ipod|windows phone/i.test(e)?"mobile":typeof navigator!="undefined"&&navigator.maxTouchPoints>0&&typeof window!="undefined"&&((r=(n=window.matchMedia)==null?void 0:n.call(window,"(pointer: coarse)"))==null?void 0:r.matches)&&/macintosh|mac os x/i.test(e)?"tablet":"desktop"}function mr(t){return/windows/i.test(t)?"Windows":/android/i.test(t)?"Android":/iphone|ipad|ipod/i.test(t)?"iOS":/mac os x|macintosh/i.test(t)?"macOS":/linux/i.test(t)?"Linux":"Other"}function fr(t){return/edg\//i.test(t)?"Edge":/opr\/|opera/i.test(t)?"Opera":/chrome\/[0-9]/i.test(t)&&!/chromium/i.test(t)?"Chrome":/firefox\/[0-9]/i.test(t)?"Firefox":/safari\/[0-9]/i.test(t)&&!/chrome/i.test(t)?"Safari":"Other"}function gr(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function yr(t,e){var r;let n=((r=e.platform)!=null?r:"").toLowerCase();return n==="ios"||n==="ipados"||n==="android"?e.mobile?"mobile":"tablet":e.mobile===!0?"mobile":$t(t)}function en(t){var a,l,c,d,u,h,f,p,v,b,y,m;if(typeof window=="undefined"||typeof navigator=="undefined")return{sessionId:t,timestamp:Date.now(),device:"desktop",os:"Other",browser:"Other",language:"",languages:[],colorScheme:"",screenWidth:0,screenHeight:0,viewportWidth:0,viewportHeight:0,devicePixelRatio:1,timeZone:"",sdkVersion:ze};let e=navigator.userAgent||"",n=gr(),r=n.mobile!==void 0||n.platform?yr(e,n):$t(e),i="";(l=(a=window.matchMedia)==null?void 0:a.call(window,"(prefers-color-scheme: dark)"))!=null&&l.matches?i="dark":(d=(c=window.matchMedia)==null?void 0:c.call(window,"(prefers-color-scheme: light)"))!=null&&d.matches&&(i="light");let o="";try{o=(u=Intl.DateTimeFormat().resolvedOptions().timeZone)!=null?u:""}catch(g){o=""}let s=typeof navigator.languages!="undefined"&&navigator.languages.length?[...navigator.languages]:navigator.language?[navigator.language]:[];return{sessionId:t,timestamp:Date.now(),device:r,os:mr(e),browser:fr(e),language:navigator.language||"",languages:s,colorScheme:i,screenWidth:(f=(h=window.screen)==null?void 0:h.width)!=null?f:0,screenHeight:(v=(p=window.screen)==null?void 0:p.height)!=null?v:0,viewportWidth:(b=window.innerWidth)!=null?b:0,viewportHeight:(y=window.innerHeight)!=null?y:0,devicePixelRatio:(m=window.devicePixelRatio)!=null?m:1,timeZone:o,sdkVersion:ze}}function vr(){let t=[[0,0,255],[0,255,255],[0,255,0],[255,255,0],[255,128,0],[255,0,0]],e=[],n=51;for(let r=0;r<t.length-1;r++){let[i,o,s]=t[r],[a,l,c]=t[r+1];for(let d=0;d<n;d++){let u=d/n;e.push([Math.round(i+(a-i)*u),Math.round(o+(l-o)*u),Math.round(s+(c-s)*u)])}}return e}var tn=vr();function nn(t,e,n={}){let{radius:r=25,maxOpacity:i=.85,minOpacity:o=0}=n,s=t.getContext("2d");if(!s)return;let{width:a,height:l}=t;if(s.clearRect(0,0,a,l),e.length===0)return;let c=document.createElement("canvas");c.width=a,c.height=l;let d=c.getContext("2d");if(!d)return;for(let b of e){let y=b.xPct/100*a,m=b.yPct/100*l,g=b.type==="click"?r*1.6:r,I=d.createRadialGradient(y,m,0,y,m,g);I.addColorStop(0,"rgba(0,0,0,0.15)"),I.addColorStop(1,"rgba(0,0,0,0)"),d.fillStyle=I,d.beginPath(),d.arc(y,m,g,0,Math.PI*2),d.fill()}let u=d.getImageData(0,0,a,l),h=s.createImageData(a,l),f=u.data,p=h.data,v=tn.length-1;for(let b=0;b<f.length;b+=4){let y=f[b+3];if(y===0)continue;let m=y/255,g=Math.min(Math.floor(m*v),v),[I,T,k]=tn[g],N=o+m*(i-o);p[b]=I,p[b+1]=T,p[b+2]=k,p[b+3]=Math.round(N*255)}s.putImageData(h,0,0)}var rn="__ut_vid__";function wt(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function on(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(rn)}catch(t){return null}}function sn(t){if(typeof localStorage!="undefined")try{localStorage.setItem(rn,t)}catch(e){}}function P(t){if(!t)return t;let e=t.indexOf("?"),n=e>=0?t.slice(0,e):t,r=e>=0?t.slice(e):"",i=n;for(let s=0;s<5;s++)try{let a=decodeURIComponent(i);if(a===i)break;i=a}catch(a){break}let o=r;for(let s=0;s<5;s++)try{let a=decodeURIComponent(o);if(a===o)break;o=a}catch(a){break}return i+o}var ln="__ut_last_pv_path__",dn="__ut_last_pv_entry_ms__";function an(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function cn(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e)}catch(n){}}function br(t,e){cn(ln,t),cn(dn,String(e))}function Ir(){if(typeof performance=="undefined")return;let e=performance.getEntriesByType("navigation")[0];if(e!=null&&e.type)return e.type;let n=performance.navigation;if((n==null?void 0:n.type)===2)return"back_forward"}var Le=class Le{constructor({emit:e,sessionId:n}){this.previousPath="";this.originalPushState=null;this.originalReplaceState=null;this.pageEntryTime=0;this.handlePopState=()=>{this.handleNavigation()};this.emit=e,this.sessionId=n}init(){let e=P(window.location.pathname+window.location.search);Ir()==="back_forward"&&this.tryEmitMpaHistoryTraversalUturn(e),this.recordPageView(e),window.addEventListener("popstate",this.handlePopState),this.originalPushState=history.pushState.bind(history);let n=this.originalPushState;history.pushState=(i,o,s)=>{n(i,o,s),this.handleNavigation()},this.originalReplaceState=history.replaceState.bind(history);let r=this.originalReplaceState;history.replaceState=(i,o,s)=>{r(i,o,s),this.handleNavigation()}}destroy(){window.removeEventListener("popstate",this.handlePopState),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState)}tryEmitMpaHistoryTraversalUturn(e){let n=an(ln),r=an(dn),i=r?Number(r):0;if(!n||!Number.isFinite(i)||i<=0||P(n)===e)return;let o=Date.now()-i;o<0||o>Le.UTURN_THRESHOLD_MS||this.emitUturn(P(n),e,o)}handleNavigation(){let e=P(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let n=Date.now()-this.pageEntryTime;n<=Le.UTURN_THRESHOLD_MS&&this.emitUturn(this.previousPath,e,n)}this.recordPageView(e)}}emitUturn(e,n,r){this.emit({type:"uturn",data:{fromPath:e,toPath:n,timeOnPageMs:r,timestamp:Date.now(),sessionId:this.sessionId}})}recordPageView(e){let n=P(e);this.previousPath=n,this.pageEntryTime=Date.now(),br(n,this.pageEntryTime),this.emit({type:"pageview",data:{path:n,title:document.title,timestamp:Date.now(),sessionId:this.sessionId,referrer:document.referrer||void 0}}),window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:n,title:document.title}}))}};Le.UTURN_THRESHOLD_MS=5e3;var Ke=Le;var Ze=class{constructor({emit:e,sessionId:n}){this.currentPath="";this.startTime=0;this.tracking=!1;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=P(e.detail.path),this.startTracking()};this.handleVisibilityChange=()=>{document.hidden?this.stopTracking():this.startTracking()};this.handleUnload=()=>{this.stopTracking()};this.emit=e,this.sessionId=n}init(){this.currentPath=P(window.location.pathname+window.location.search),this.startTracking(),window.addEventListener("tracker:navigate",this.handleNavigate),document.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("beforeunload",this.handleUnload),window.addEventListener("pagehide",this.handleUnload)}destroy(){this.stopTracking(),window.removeEventListener("tracker:navigate",this.handleNavigate),document.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("beforeunload",this.handleUnload),window.removeEventListener("pagehide",this.handleUnload)}startTracking(){this.startTime=Date.now(),this.tracking=!0}stopTracking(){if(!this.tracking||!this.currentPath)return;let e=Date.now()-this.startTime;if(e<100){this.tracking=!1;return}this.emit({type:"timespent",data:{path:this.currentPath,duration:e,sessionId:this.sessionId,timestamp:Date.now()}}),this.tracking=!1}};function kt(t,e){let n=0;return(...r)=>{let i=Date.now();i-n>=e&&(n=i,t(...r))}}var Cr="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",un=/^[A-Za-z][\w-]*$/;function Sr(t){if(!t||t.nodeType!==1)return"";let e=t.id;if(e&&un.test(e))return"#"+e;let n=[],r=t,i=0;for(;r&&r.nodeType===1&&r!==document.body&&i<5;){let o=r.id;if(o&&un.test(o)){n.unshift("#"+o);break}let s=r.tagName.toLowerCase(),a=1,l=r.previousElementSibling;for(;l;)l.tagName===r.tagName&&a++,l=l.previousElementSibling;n.unshift(s+":nth-of-type("+a+")"),r=r.parentElement,i++}return n.join(">")}function pn(t,e,n){let r=t instanceof Element?t:null;if(!r)return{};let i=r.closest(Cr);if(!i)return{};let o=Sr(i);if(!o)return{};let s=i.getBoundingClientRect();if(s.width<=0||s.height<=0)return{selector:o};let a=Math.min(1,Math.max(0,(e-s.left)/s.width)),l=Math.min(1,Math.max(0,(n-s.top)/s.height));return{selector:o,relX:Math.round(a*1e3)/1e3,relY:Math.round(l*1e3)/1e3}}var ue=class ue{constructor({emit:e,sessionId:n,sampleRate:r=.3,maxPoints:i=2e3,allowedPaths:o}){this.currentPath="";this.pointCounts={};this.maxScrollDepth={};this.recentClicks=[];this.handleMouseMove=e=>{if(Math.random()>this.sampleRate)return;let n=document.documentElement.scrollWidth,r=document.documentElement.scrollHeight,i=e.clientY+window.scrollY;this.recordPoint({x:e.clientX,y:i,xPct:n>0?e.clientX/n*100:0,yPct:r>0?i/r*100:0,pw:n,ph:r,vw:window.innerWidth,type:"move"})};this.handleClick=e=>{if(Date.now()-this.lastTouchTime<500)return;let n=document.documentElement.scrollWidth,r=document.documentElement.scrollHeight,i=e.clientY+window.scrollY,o=this.getClickTarget(e),s=pn(e.target,e.clientX,e.clientY);this.recordPoint({x:e.clientX,y:i,xPct:n>0?e.clientX/n*100:0,yPct:r>0?i/r*100:0,pw:n,ph:r,vw:window.innerWidth,type:"click",...o?{target:o}:{},...s}),this.checkRageClick(e.clientX,i,this.currentPath)};this.lastTouchTime=0;this.handleTouchEnd=e=>{let n=e.changedTouches[0];if(!n)return;let r=document.documentElement.scrollWidth,i=document.documentElement.scrollHeight,o=n.clientY+window.scrollY;this.lastTouchTime=Date.now();let s=pn(e.target,n.clientX,n.clientY);this.recordPoint({x:n.clientX,y:o,xPct:r>0?n.clientX/r*100:0,yPct:i>0?o/i*100:0,pw:r,ph:i,vw:window.innerWidth,type:"click",...s}),this.checkRageClick(n.clientX,o,this.currentPath)};this.handleScroll=()=>{var h;let e=document.documentElement.scrollWidth,n=document.documentElement.scrollHeight,r=window.innerWidth,i=window.innerHeight,o=window.scrollX,s=window.scrollY,a=Math.min(n,s+i),l=n>0?a/n*100:0,c=(h=this.maxScrollDepth[this.currentPath])!=null?h:0,d=l>c+1;if(d&&(this.maxScrollDepth[this.currentPath]=l),!d&&Math.random()>this.sampleRate)return;let u=o+r/2;this.recordPoint({x:r/2,y:a,xPct:e>0?u/e*100:50,yPct:l,pw:e,ph:n,vw:r,type:"scroll"})};this.handleNavigate=e=>{this.currentPath=P(e.detail.path)};this.emit=e,this.sessionId=n,this.sampleRate=r,this.maxPoints=i,this.allowedPaths=o&&o.length>0?new Set(o.map(s=>P(s))):null,this.throttledMouseMove=kt(this.handleMouseMove,50),this.throttledScroll=kt(this.handleScroll,100)}init(){this.currentPath=P(window.location.pathname+window.location.search),document.addEventListener("mousemove",this.throttledMouseMove),document.addEventListener("click",this.handleClick),document.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),window.addEventListener("scroll",this.throttledScroll,{passive:!0}),window.addEventListener("tracker:navigate",this.handleNavigate)}destroy(){document.removeEventListener("mousemove",this.throttledMouseMove),document.removeEventListener("click",this.handleClick),document.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("scroll",this.throttledScroll),window.removeEventListener("tracker:navigate",this.handleNavigate)}canRecord(){var e;return this.allowedPaths!==null&&!this.allowedPaths.has(this.currentPath)?!1:((e=this.pointCounts[this.currentPath])!=null?e:0)<this.maxPoints}recordPoint(e){var n;this.canRecord()&&(this.pointCounts[this.currentPath]=((n=this.pointCounts[this.currentPath])!=null?n:0)+1,this.emit({type:"heatmap",data:{...e,path:this.currentPath,timestamp:Date.now()}}))}getClickTarget(e){var i,o,s,a;let n=e.target;return n&&(n.getAttribute("aria-label")||((i=n.closest("[aria-label]"))==null?void 0:i.getAttribute("aria-label"))||n.getAttribute("data-track-label")||n.getAttribute("id")||(n instanceof HTMLButtonElement||n instanceof HTMLAnchorElement?(o=n.innerText)==null?void 0:o.trim().slice(0,60):(a=(s=n.closest("button, a"))==null?void 0:s.textContent)==null?void 0:a.trim().slice(0,60)))||void 0}checkRageClick(e,n,r){let i=Date.now();this.recentClicks=this.recentClicks.filter(s=>i-s.t<ue.RAGE_WINDOW_MS),this.recentClicks.push({x:e,y:n,t:i});let o=this.recentClicks.filter(s=>Math.hypot(s.x-e,s.y-n)<=ue.RAGE_RADIUS_PX);o.length>=ue.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:r,x:e,y:n,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[])}};ue.RAGE_THRESHOLD=3,ue.RAGE_WINDOW_MS=1e3,ue.RAGE_RADIUS_PX=50;var Ye=ue;var V;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(V||(V={}));function wr(t){return t.nodeType===t.ELEMENT_NODE}function ve(t){var e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function ge(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function kr(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function At(t){try{var e=t.rules||t.cssRules;return e?kr(Array.from(e).map(xt).join("")):null}catch(n){return null}}function xt(t){var e=t.cssText;if(Ar(t))try{e=At(t.styleSheet)||e}catch(n){}return e}function Ar(t){return"styleSheet"in t}var fn=(function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var n;if(!e)return-1;var r=(n=this.getMeta(e))===null||n===void 0?void 0:n.id;return r!=null?r:-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var n=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(i){return n.removeNodeFromMap(i)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,n){var r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)},t.prototype.replace=function(e,n){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(e,n)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t})();function gn(){return new fn}function Pe(t){var e=t.maskInputOptions,n=t.tagName,r=t.type,i=t.value,o=t.maskInputFn,s=i||"";return(e[n.toLowerCase()]||e[r])&&(o?s=o(s):s="*".repeat(s.length)),s}var hn="__rrweb_original__";function xr(t){var e=t.getContext("2d");if(!e)return!0;for(var n=50,r=0;r<t.width;r+=n)for(var i=0;i<t.height;i+=n){var o=e.getImageData,s=hn in o?o[hn]:o,a=new Uint32Array(s.call(e,r,i,Math.min(n,t.width-r),Math.min(n,t.height-i)).data.buffer);if(a.some(function(l){return l!==0}))return!1}return!0}var Er=1,Tr=new RegExp("[^a-z0-9-_:]"),ye=-2;function Et(){return Er++}function Rr(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return Tr.test(e)?"div":e}function Mr(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Nr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ae,mn,Lr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Or=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Pr=/^(data:)([^,]*),(.*)/i;function je(t,e){return(t||"").replace(Lr,function(n,r,i,o,s,a){var l=i||s||a,c=r||o||"";if(!l)return n;if(!Or.test(l)||Pr.test(l))return"url(".concat(c).concat(l).concat(c,")");if(l[0]==="/")return"url(".concat(c).concat(Nr(e)+l).concat(c,")");var d=e.split("/"),u=l.split("/");d.pop();for(var h=0,f=u;h<f.length;h++){var p=f[h];p!=="."&&(p===".."?d.pop():d.push(p))}return"url(".concat(c).concat(d.join("/")).concat(c,")")})}var Fr=/^[^ \t\n\r\u000c]+/,Br=/^[, \t\n\r\u000c]+/;function Dr(t,e){if(e.trim()==="")return e;var n=0;function r(c){var d,u=c.exec(e.substring(n));return u?(d=u[0],n+=d.length,d):""}for(var i=[];r(Br),!(n>=e.length);){var o=r(Fr);if(o.slice(-1)===",")o=xe(t,o.substring(0,o.length-1)),i.push(o);else{var s="";o=xe(t,o);for(var a=!1;;){var l=e.charAt(n);if(l===""){i.push((o+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){n+=1,i.push((o+s).trim());break}else l==="("&&(a=!0);s+=l,n+=1}}}return i.join(", ")}function xe(t,e){if(!e||e.trim()==="")return e;var n=t.createElement("a");return n.href=e,n.href}function _r(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function Tt(){var t=document.createElement("a");return t.href="",t.href}function Rt(t,e,n,r){return n==="src"||n==="href"&&r&&!(e==="use"&&r[0]==="#")||n==="xlink:href"&&r&&r[0]!=="#"||n==="background"&&r&&(e==="table"||e==="td"||e==="th")?xe(t,r):n==="srcset"&&r?Dr(t,r):n==="style"&&r?je(r,Tt()):e==="object"&&n==="data"&&r?xe(t,r):r}function Wr(t,e,n){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var r=t.classList.length;r--;){var i=t.classList[r];if(e.test(i))return!0}return n?t.matches(n):!1}function Oe(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return n?Oe(t.parentNode,e,n):!1;for(var r=t.classList.length;r--;){var i=t.classList[r];if(e.test(i))return!0}return n?Oe(t.parentNode,e,n):!1}function Mt(t,e,n){var r=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(r===null)return!1;if(typeof e=="string"){if(r.classList.contains(e)||r.closest(".".concat(e)))return!0}else if(Oe(r,e,!0))return!0;return!!(n&&(r.matches(n)||r.closest(n)))}function Hr(t,e,n){var r=t.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch(l){return}if(o!=="complete"){var s=setTimeout(function(){i||(e(),i=!0)},n);t.addEventListener("load",function(){clearTimeout(s),i=!0,e()});return}var a="about:blank";if(r.location.href!==a||t.src===a||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function Ur(t,e,n){var r=!1,i;try{i=t.sheet}catch(s){return}if(!i){var o=setTimeout(function(){r||(e(),r=!0)},n);t.addEventListener("load",function(){clearTimeout(o),r=!0,e()})}}function Vr(t,e){var n=e.doc,r=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,l=e.inlineStylesheet,c=e.maskInputOptions,d=c===void 0?{}:c,u=e.maskTextFn,h=e.maskInputFn,f=e.dataURLOptions,p=f===void 0?{}:f,v=e.inlineImages,b=e.recordCanvas,y=e.keepIframeSrcFn,m=e.newlyAddedElement,g=m===void 0?!1:m,I=Gr(n,r);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:V.Document,childNodes:[],compatMode:t.compatMode}:{type:V.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:V.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:I};case t.ELEMENT_NODE:return Kr(t,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:l,maskInputOptions:d,maskInputFn:h,dataURLOptions:p,inlineImages:v,recordCanvas:b,keepIframeSrcFn:y,newlyAddedElement:g,rootId:I});case t.TEXT_NODE:return zr(t,{maskTextClass:s,maskTextSelector:a,maskTextFn:u,rootId:I});case t.CDATA_SECTION_NODE:return{type:V.CDATA,textContent:"",rootId:I};case t.COMMENT_NODE:return{type:V.Comment,textContent:t.textContent||"",rootId:I};default:return!1}}function Gr(t,e){if(e.hasNode(t)){var n=e.getId(t);return n===1?void 0:n}}function zr(t,e){var n,r=e.maskTextClass,i=e.maskTextSelector,o=e.maskTextFn,s=e.rootId,a=t.parentNode&&t.parentNode.tagName,l=t.textContent,c=a==="STYLE"?!0:void 0,d=a==="SCRIPT"?!0:void 0;if(c&&l){try{t.nextSibling||t.previousSibling||!((n=t.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(l=Mr(t.parentNode.sheet))}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t)}l=je(l,Tt())}return d&&(l="SCRIPT_PLACEHOLDER"),!c&&!d&&l&&Mt(t,r,i)&&(l=o?o(l):l.replace(/[\S]/g,"*")),{type:V.Text,textContent:l||"",isStyle:c,rootId:s}}function Kr(t,e){for(var n=e.doc,r=e.blockClass,i=e.blockSelector,o=e.inlineStylesheet,s=e.maskInputOptions,a=s===void 0?{}:s,l=e.maskInputFn,c=e.dataURLOptions,d=c===void 0?{}:c,u=e.inlineImages,h=e.recordCanvas,f=e.keepIframeSrcFn,p=e.newlyAddedElement,v=p===void 0?!1:p,b=e.rootId,y=Wr(t,r,i),m=Rr(t),g={},I=t.attributes.length,T=0;T<I;T++){var k=t.attributes[T];g[k.name]=Rt(n,m,k.name,k.value)}if(m==="link"&&o){var N=Array.from(n.styleSheets).find(function($){return $.href===t.href}),w=null;N&&(w=At(N)),w&&(delete g.rel,delete g.href,g._cssText=je(w,N.href))}if(m==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var w=At(t.sheet);w&&(g._cssText=je(w,Tt()))}if(m==="input"||m==="textarea"||m==="select"){var C=t.value,E=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&C?g.value=Pe({type:g.type,tagName:m,value:C,maskInputOptions:a,maskInputFn:l}):E&&(g.checked=E)}if(m==="option"&&(t.selected&&!a.select?g.selected=!0:delete g.selected),m==="canvas"&&h){if(t.__context==="2d")xr(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var R=t.toDataURL(d.type,d.quality),A=document.createElement("canvas");A.width=t.width,A.height=t.height;var G=A.toDataURL(d.type,d.quality);R!==G&&(g.rr_dataURL=R)}}if(m==="img"&&u){Ae||(Ae=n.createElement("canvas"),mn=Ae.getContext("2d"));var D=t,X=D.crossOrigin;D.crossOrigin="anonymous";var ne=function(){try{Ae.width=D.naturalWidth,Ae.height=D.naturalHeight,mn.drawImage(D,0,0),g.rr_dataURL=Ae.toDataURL(d.type,d.quality)}catch($){console.warn("Cannot inline img src=".concat(D.currentSrc,"! Error: ").concat($))}X?g.crossOrigin=X:D.removeAttribute("crossorigin")};D.complete&&D.naturalWidth!==0?ne():D.onload=ne}if((m==="audio"||m==="video")&&(g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(g.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(g.rr_scrollTop=t.scrollTop)),y){var se=t.getBoundingClientRect(),ce=se.width,Y=se.height;g={class:g.class,rr_width:"".concat(ce,"px"),rr_height:"".concat(Y,"px")}}return m==="iframe"&&!f(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:V.Element,tagName:m,attributes:g,childNodes:[],isSVG:_r(t)||void 0,needBlock:y,rootId:b}}function F(t){return t===void 0?"":t.toLowerCase()}function Zr(t,e){if(e.comment&&t.type===V.Comment)return!0;if(t.type===V.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(F(t.attributes.name).match(/^msapplication-tile(image|color)$/)||F(t.attributes.name)==="application-name"||F(t.attributes.rel)==="icon"||F(t.attributes.rel)==="apple-touch-icon"||F(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&F(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(F(t.attributes.property).match(/^(og|twitter|fb):/)||F(t.attributes.name).match(/^(og|twitter):/)||F(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(F(t.attributes.name)==="robots"||F(t.attributes.name)==="googlebot"||F(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(F(t.attributes.name)==="author"||F(t.attributes.name)==="generator"||F(t.attributes.name)==="framework"||F(t.attributes.name)==="publisher"||F(t.attributes.name)==="progid"||F(t.attributes.property).match(/^article:/)||F(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(F(t.attributes.name)==="google-site-verification"||F(t.attributes.name)==="yandex-verification"||F(t.attributes.name)==="csrf-token"||F(t.attributes.name)==="p:domain_verify"||F(t.attributes.name)==="verify-v1"||F(t.attributes.name)==="verification"||F(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function fe(t,e){var n=e.doc,r=e.mirror,i=e.blockClass,o=e.blockSelector,s=e.maskTextClass,a=e.maskTextSelector,l=e.skipChild,c=l===void 0?!1:l,d=e.inlineStylesheet,u=d===void 0?!0:d,h=e.maskInputOptions,f=h===void 0?{}:h,p=e.maskTextFn,v=e.maskInputFn,b=e.slimDOMOptions,y=e.dataURLOptions,m=y===void 0?{}:y,g=e.inlineImages,I=g===void 0?!1:g,T=e.recordCanvas,k=T===void 0?!1:T,N=e.onSerialize,w=e.onIframeLoad,C=e.iframeLoadTimeout,E=C===void 0?5e3:C,R=e.onStylesheetLoad,A=e.stylesheetLoadTimeout,G=A===void 0?5e3:A,D=e.keepIframeSrcFn,X=D===void 0?function(){return!1}:D,ne=e.newlyAddedElement,se=ne===void 0?!1:ne,ce=e.preserveWhiteSpace,Y=ce===void 0?!0:ce,$=Vr(t,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,dataURLOptions:m,inlineImages:I,recordCanvas:k,keepIframeSrcFn:X,newlyAddedElement:se});if(!$)return console.warn(t,"not serialized"),null;var de;r.hasNode(t)?de=r.getId(t):Zr($,b)||!Y&&$.type===V.Text&&!$.isStyle&&!$.textContent.replace(/^\s+|\s+$/gm,"").length?de=ye:de=Et();var H=Object.assign($,{id:de});if(r.add(t,H),de===ye)return null;N&&N(t);var re=!c;if(H.type===V.Element){re=re&&!H.needBlock,delete H.needBlock;var ae=t.shadowRoot;ae&&ge(ae)&&(H.isShadowHost=!0)}if((H.type===V.Document||H.type===V.Element)&&re){b.headWhitespace&&H.type===V.Element&&H.tagName==="head"&&(Y=!1);for(var Se={doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:c,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:b,dataURLOptions:m,inlineImages:I,recordCanvas:k,preserveWhiteSpace:Y,onSerialize:N,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:R,stylesheetLoadTimeout:G,keepIframeSrcFn:X},S=0,K=Array.from(t.childNodes);S<K.length;S++){var j=K[S],B=fe(j,Se);B&&H.childNodes.push(B)}if(wr(t)&&t.shadowRoot)for(var ee=0,L=Array.from(t.shadowRoot.childNodes);ee<L.length;ee++){var j=L[ee],B=fe(j,Se);B&&(ge(t.shadowRoot)&&(B.isShadow=!0),H.childNodes.push(B))}}return t.parentNode&&ve(t.parentNode)&&ge(t.parentNode)&&(H.isShadow=!0),H.type===V.Element&&H.tagName==="iframe"&&Hr(t,function(){var J=t.contentDocument;if(J&&w){var Ne=fe(J,{doc:J,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:b,dataURLOptions:m,inlineImages:I,recordCanvas:k,preserveWhiteSpace:Y,onSerialize:N,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:R,stylesheetLoadTimeout:G,keepIframeSrcFn:X});Ne&&w(t,Ne)}},E),H.type===V.Element&&H.tagName==="link"&&H.attributes.rel==="stylesheet"&&Ur(t,function(){if(R){var J=fe(t,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:b,dataURLOptions:m,inlineImages:I,recordCanvas:k,preserveWhiteSpace:Y,onSerialize:N,onIframeLoad:w,iframeLoadTimeout:E,onStylesheetLoad:R,stylesheetLoadTimeout:G,keepIframeSrcFn:X});J&&R(t,J)}},G),H}function yn(t,e){var n=e||{},r=n.mirror,i=r===void 0?new fn:r,o=n.blockClass,s=o===void 0?"rr-block":o,a=n.blockSelector,l=a===void 0?null:a,c=n.maskTextClass,d=c===void 0?"rr-mask":c,u=n.maskTextSelector,h=u===void 0?null:u,f=n.inlineStylesheet,p=f===void 0?!0:f,v=n.inlineImages,b=v===void 0?!1:v,y=n.recordCanvas,m=y===void 0?!1:y,g=n.maskAllInputs,I=g===void 0?!1:g,T=n.maskTextFn,k=n.maskInputFn,N=n.slimDOM,w=N===void 0?!1:N,C=n.dataURLOptions,E=n.preserveWhiteSpace,R=n.onSerialize,A=n.onIframeLoad,G=n.iframeLoadTimeout,D=n.onStylesheetLoad,X=n.stylesheetLoadTimeout,ne=n.keepIframeSrcFn,se=ne===void 0?function(){return!1}:ne,ce=I===!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}:I===!1?{password:!0}:I,Y=w===!0||w==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:w==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:w===!1?{}:w;return fe(t,{doc:t,mirror:i,blockClass:s,blockSelector:l,maskTextClass:d,maskTextSelector:h,skipChild:!1,inlineStylesheet:p,maskInputOptions:ce,maskTextFn:T,maskInputFn:k,slimDOMOptions:Y,dataURLOptions:C,inlineImages:b,recordCanvas:m,preserveWhiteSpace:E,onSerialize:R,onIframeLoad:A,iframeLoadTimeout:G,onStylesheetLoad:D,stylesheetLoadTimeout:X,keepIframeSrcFn:se,newlyAddedElement:!1})}var Yr=/([^\\]):hover/,co=new RegExp(Yr.source,"g");function z(t,e,n=document){let r={capture:!0,passive:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}var Ee=`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.`,pr={map:{},getId(){return console.error(Te),-1},getNode(){return console.error(Te),null},removeNodeFromMap(){console.error(Te)},has(){return console.error(Te),!1},reset(){console.error(Te)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(pr=new Proxy(pr,{get(t,e,r){return e==="map"&&console.error(Te),Reflect.get(t,e,r)}}));function Ee(t,e,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===!1&&(i=s);let a=e-(s-i),c=this;a<=0||a>e?(n&&(clearTimeout(n),n=null),i=s,t.apply(c,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,t.apply(c,o)},a))}}function Ie(t,e,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>Ie(t,e,o||{},!0)}function ie(t,e,r){try{if(!(e in t))return()=>{};let n=t[e],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=i,()=>{t[e]=n}}catch(n){return()=>{}}}function Ye(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Je(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function N(t,e,r,n){if(!t)return!1;let i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!i)return!1;if(typeof e=="string"){if(i.classList.contains(e)||n&&i.closest("."+e)!==null)return!0}else if(Le(i,e,n))return!0;return!!(r&&(t.matches(r)||n&&i.closest(r)!==null))}function fr(t,e){return e.getId(t)!==-1}function je(t,e){return e.getId(t)===ye}function Rt(t,e){if(ve(t))return!1;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?Rt(t.parentNode,e):!0:!0}function xt(t){return!!t.changedTouches}function mr(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function Qe(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function qe(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Xe(t){return!!(t!=null&&t.shadowRoot)}var ze=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var r;return(r=this.styleIDMap.get(e))!==null&&r!==void 0?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};var w=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(w||{}),S=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(S||{}),$e=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))($e||{}),le=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(le||{});function gr(t){return"__ln"in t}var Mt=class{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<e;n++)r=(r==null?void 0:r.next)||null;return r}addNode(e){let r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&gr(e.previousSibling)){let n=e.previousSibling.__ln.next;r.next=n,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(e.nextSibling&&gr(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;r.previous=n,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++}removeNode(e){let r=e.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next&&(r.next.previous=r.previous)):(this.head=r.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}},yr=(t,e)=>`${t}@${e}`,et=class{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],r=new Mt,n=a=>{let c=a,l=ye;for(;l===ye;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},i=a=>{var c,l,d,u;let p=null;((l=(c=a.getRootNode)===null||c===void 0?void 0:c.call(a))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&a.getRootNode().host&&(p=a.getRootNode().host);let m=p;for(;((u=(d=m==null?void 0:m.getRootNode)===null||d===void 0?void 0:d.call(m))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&m.getRootNode().host;)m=m.getRootNode().host;let h=!this.doc.contains(a)&&(!m||!this.doc.contains(m));if(!a.parentNode||h)return;let v=ve(a.parentNode)?this.mirror.getId(p):this.mirror.getId(a.parentNode),I=n(a);if(v===-1||I===-1)return r.addNode(a);let y=me(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{Qe(f,this.mirror)&&this.iframeManager.addIframe(f),qe(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Xe(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(f,g)=>{this.iframeManager.attachIframe(f,g),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,g)=>{this.stylesheetManager.attachLinkElement(f,g)}});y&&e.push({parentId:v,nextId:I,node:y})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of Array.from(this.movedSet.values()))vr(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||i(a);for(let a of Array.from(this.addedSet.values()))!Ir(this.droppedSet,a)&&!vr(this.removes,a,this.mirror)||Ir(this.movedSet,a)?i(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){let c=this.mirror.getId(o.value.parentNode),l=n(o.value);c!==-1&&l!==-1&&(a=o)}if(!a)for(let c=r.length-1;c>=0;c--){let l=r.get(c);if(l){let d=this.mirror.getId(l.value.parentNode);if(n(l.value)===-1)continue;if(d!==-1){a=l;break}else{let p=l.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=p.parentNode.host;if(this.mirror.getId(m)!==-1){a=l;break}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),i(a.value)}let s={texts:this.texts.map(a=>({id:this.mirror.getId(a.node),value:a.value})).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>({id:this.mirror.getId(a.node),attributes:a.attributes})).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!je(e.target,this.mirror))switch(e.type){case"characterData":{let r=e.target.textContent;!N(e.target,this.blockClass,this.blockSelector,!1)&&r!==e.oldValue&&this.texts.push({value:Et(e.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:e.target});break}case"attributes":{let r=e.target,n=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(n=Pe({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),N(e.target,this.blockClass,this.blockSelector,!1)||n===e.oldValue)return;let i=this.attributes.find(o=>o.node===e.target);if(r.tagName==="IFRAME"&&e.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)e.attributeName="rr_src";else return;if(i||(i={node:e.target,attributes:{}},this.attributes.push(i)),e.attributeName==="style"){let o=this.doc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue),(i.attributes.style===void 0||i.attributes.style===null)&&(i.attributes.style={});let s=i.attributes.style;for(let a of Array.from(r.style)){let c=r.style.getPropertyValue(a),l=r.style.getPropertyPriority(a);(c!==o.style.getPropertyValue(a)||l!==o.style.getPropertyPriority(a))&&(l===""?s[a]=c:s[a]=[c,l])}for(let a of Array.from(o.style))r.style.getPropertyValue(a)===""&&(s[a]=!1)}else i.attributes[e.attributeName]=Tt(this.doc,r.tagName,e.attributeName,n);break}case"childList":{if(N(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=ve(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);N(e.target,this.blockClass,this.blockSelector,!1)||je(r,this.mirror)||!fr(r,this.mirror)||(this.addedSet.has(r)?(Nt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||Rt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[yr(n,i)]?Nt(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:ve(e.target)&&ge(e.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(je(e,this.mirror))return;this.movedSet.add(e);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[yr(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);N(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(n=>this.genAdds(n))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=e[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 Nt(t,e){t.delete(e),e.childNodes.forEach(r=>Nt(t,r))}function vr(t,e,r){return t.length===0?!1:Cr(t,e,r)}function Cr(t,e,r){let{parentNode:n}=e;if(!n)return!1;let i=r.getId(n);return t.some(o=>o.id===i)?!0:Cr(t,n,r)}function Ir(t,e){return t.size===0?!1:br(t,e)}function br(t,e){let{parentNode:r}=e;return r?t.has(r)?!0:br(t,r):!1}var pe=[],Ar=typeof CSSGroupingRule!="undefined",kr=typeof CSSMediaRule!="undefined",Tr=typeof CSSSupportsRule!="undefined",Er=typeof CSSConditionRule!="undefined";function Be(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch(e){return t.target}}function Ot(t,e){var r,n;let i=new et;pe.push(i),i.init(t);let o=window.MutationObserver||window.__rrMutationObserver,s=(n=(r=window==null?void 0:window.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");s&&window[s]&&(o=window[s]);let a=new o(i.processMutations.bind(i));return a.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Fn({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,s=[],a,c=Ee(u=>{let p=Date.now()-a;t(s.map(m=>(m.timeOffset-=p,m)),u),s=[],a=null},o),l=Ee(u=>{let p=Be(u),{clientX:m,clientY:h}=xt(u)?u.changedTouches[0]:u;a||(a=Date.now()),s.push({x:m,y:h,id:n.getId(p),timeOffset:Date.now()-a}),c(typeof DragEvent!="undefined"&&u instanceof DragEvent?S.Drag:u instanceof MouseEvent?S.MouseMove:S.TouchMove)},i,{trailing:!1}),d=[W("mousemove",l,r),W("touchmove",l,r),W("drag",l,r)];return()=>{d.forEach(u=>u())}}function Dn({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],c=l=>d=>{let u=Be(d);if(N(u,n,i,!0))return;let p=xt(d)?d.changedTouches[0]:d;if(!p)return;let m=r.getId(u),{clientX:h,clientY:v}=p;t({type:$e[l],id:m,x:h,y:v})};return Object.keys($e).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&s[l]!==!1).forEach(l=>{let d=l.toLowerCase(),u=c(l);a.push(W(d,u,e))}),()=>{a.forEach(l=>l())}}function Lt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=Ee(a=>{let c=Be(a);if(!c||N(c,n,i,!0))return;let l=r.getId(c);if(c===e){let d=e.scrollingElement||e.documentElement;t({id:l,x:d.scrollLeft,y:d.scrollTop})}else t({id:l,x:c.scrollLeft,y:c.scrollTop})},o.scroll||100);return W("scroll",s,e)}function _n({viewportResizeCb:t}){let e=-1,r=-1,n=Ee(()=>{let i=Ye(),o=Je();(e!==i||r!==o)&&(t({width:Number(o),height:Number(i)}),e=i,r=o)},200);return W("resize",n,window)}function Sr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Wn=["INPUT","TEXTAREA","SELECT"],wr=new WeakMap;function Un({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,maskInputOptions:s,maskInputFn:a,sampling:c,userTriggeredOnInput:l}){function d(y){let f=Be(y),g=y.isTrusted;if(f&&f.tagName==="OPTION"&&(f=f.parentElement),!f||!f.tagName||Wn.indexOf(f.tagName)<0||N(f,n,i,!0))return;let b=f.type;if(f.classList.contains(o))return;let x=f.value,P=!1;b==="radio"||b==="checkbox"?P=f.checked:(s[f.tagName.toLowerCase()]||s[b])&&(x=Pe({maskInputOptions:s,tagName:f.tagName,type:b,value:x,maskInputFn:a})),u(f,Sr({text:x,isChecked:P,userTriggered:g},l));let B=f.name;b==="radio"&&B&&P&&e.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(T=>{T!==f&&u(T,Sr({text:T.value,isChecked:!P,userTriggered:!1},l))})}function u(y,f){let g=wr.get(y);if(!g||g.text!==f.text||g.isChecked!==f.isChecked){wr.set(y,f);let b=r.getId(y);t(Object.assign(Object.assign({},f),{id:b}))}}let m=(c.input==="last"?["change"]:["input","change"]).map(y=>W(y,d,e)),h=e.defaultView;if(!h)return()=>{m.forEach(y=>y())};let v=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),I=[[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 v&&v.set&&m.push(...I.map(y=>Ie(y[0],y[1],{set(){d({target:this})}},!1,h))),()=>{m.forEach(y=>y())}}function tt(t){let e=[];function r(n,i){if(Ar&&n.parentRule instanceof CSSGroupingRule||kr&&n.parentRule instanceof CSSMediaRule||Tr&&n.parentRule instanceof CSSSupportsRule||Er&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(t,e)}function he(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function Gn({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){let i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:p,styleId:m}=he(this,e,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&t({id:p,styleId:m,adds:[{rule:d,index:u}]}),i.apply(this,[d,u])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,removes:[{index:d}]}),o.apply(this,[d])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replace:d}),s.apply(this,[d])});let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:p}=he(this,e,r.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),a.apply(this,[d])});let c={};Ar?c.CSSGroupingRule=n.CSSGroupingRule:(kr&&(c.CSSMediaRule=n.CSSMediaRule),Er&&(c.CSSConditionRule=n.CSSConditionRule),Tr&&(c.CSSSupportsRule=n.CSSSupportsRule));let l={};return Object.entries(c).forEach(([d,u])=>{l[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(p,m){let{id:h,styleId:v}=he(this.parentStyleSheet,e,r.styleMirror);return(h&&h!==-1||v&&v!==-1)&&t({id:h,styleId:v,adds:[{rule:p,index:[...tt(this),m||0]}]}),l[d].insertRule.apply(this,[p,m])},u.prototype.deleteRule=function(p){let{id:m,styleId:h}=he(this.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&t({id:m,styleId:h,removes:[{index:[...tt(this),p]}]}),l[d].deleteRule.apply(this,[p])}}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule})}}function Pt({mirror:t,stylesheetManager:e},r){var n,i,o;let s=null;r.nodeName==="#document"?s=t.getId(r):s=t.getId(r.host);let a=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(o=(i=r.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,c=Object.getOwnPropertyDescriptor(a==null?void 0:a.prototype,"adoptedStyleSheets");return s===null||s===-1||!a||!c?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return(l=c.get)===null||l===void 0?void 0:l.call(this)},set(l){var d;let u=(d=c.set)===null||d===void 0?void 0:d.call(this,l);if(s!==null&&s!==-1)try{e.adoptStyleSheets(l,s)}catch(p){}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})}function Hn({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(a,c,l){var d;if(r.has(a))return o.apply(this,[a,c,l]);let{id:u,styleId:p}=he((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,n.styleMirror);return(u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,set:{property:a,value:c,priority:l},index:tt(this.parentRule)}),o.apply(this,[a,c,l])};let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(a){var c;if(r.has(a))return s.apply(this,[a]);let{id:l,styleId:d}=he((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,e,n.styleMirror);return(l&&l!==-1||d&&d!==-1)&&t({id:l,styleId:d,remove:{property:a},index:tt(this.parentRule)}),s.apply(this,[a])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s}}function Vn({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i}){let o=a=>Ee(c=>{let l=Be(c);if(!l||N(l,e,r,!0))return;let{currentTime:d,volume:u,muted:p,playbackRate:m}=l;t({type:a,id:n.getId(l),currentTime:d,volume:u,muted:p,playbackRate:m})},i.media||500),s=[W("play",o(0)),W("pause",o(1)),W("seeked",o(2)),W("volumechange",o(3)),W("ratechange",o(4))];return()=>{s.forEach(a=>a())}}function Kn({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return()=>{};let n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(c,l,d){let u=new o(c,l,d);return i.set(u,{family:c,buffer:typeof l!="string",descriptors:d,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),u};let s=ie(e.fonts,"add",function(a){return function(c){return setTimeout(()=>{let l=i.get(c);l&&(t(l),i.delete(c))},0),a.apply(this,[c])}});return n.push(()=>{r.FontFace=o}),n.push(s),()=>{n.forEach(a=>a())}}function Zn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=t,s=!0,a=()=>{let c=e.getSelection();if(!c||s&&(c!=null&&c.isCollapsed))return;s=c.isCollapsed||!1;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let p=c.getRangeAt(u),{startContainer:m,startOffset:h,endContainer:v,endOffset:I}=p;N(m,n,i,!0)||N(v,n,i,!0)||l.push({start:r.getId(m),startOffset:h,end:r.getId(v),endOffset:I})}o({ranges:l})};return a(),W("selectionchange",a)}function zn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:m}=t;t.mutationCb=(...h)=>{e.mutation&&e.mutation(...h),r(...h)},t.mousemoveCb=(...h)=>{e.mousemove&&e.mousemove(...h),n(...h)},t.mouseInteractionCb=(...h)=>{e.mouseInteraction&&e.mouseInteraction(...h),i(...h)},t.scrollCb=(...h)=>{e.scroll&&e.scroll(...h),o(...h)},t.viewportResizeCb=(...h)=>{e.viewportResize&&e.viewportResize(...h),s(...h)},t.inputCb=(...h)=>{e.input&&e.input(...h),a(...h)},t.mediaInteractionCb=(...h)=>{e.mediaInteaction&&e.mediaInteaction(...h),c(...h)},t.styleSheetRuleCb=(...h)=>{e.styleSheetRule&&e.styleSheetRule(...h),l(...h)},t.styleDeclarationCb=(...h)=>{e.styleDeclaration&&e.styleDeclaration(...h),d(...h)},t.canvasMutationCb=(...h)=>{e.canvasMutation&&e.canvasMutation(...h),u(...h)},t.fontCb=(...h)=>{e.font&&e.font(...h),p(...h)},t.selectionCb=(...h)=>{e.selection&&e.selection(...h),m(...h)}}function Rr(t,e={}){let r=t.doc.defaultView;if(!r)return()=>{};zn(t,e);let n=Ot(t,t.doc),i=Fn(t),o=Dn(t),s=Lt(t),a=_n(t),c=Un(t),l=Vn(t),d=Gn(t,{win:r}),u=Pt(t,t.doc),p=Hn(t,{win:r}),m=t.collectFonts?Kn(t):()=>{},h=Zn(t),v=[];for(let I of t.plugins)v.push(I.observer(I.callback,r,I.options));return()=>{pe.forEach(I=>I.reset()),n.disconnect(),i(),o(),s(),a(),c(),l(),d(),u(),p(),m(),h(),v.forEach(I=>I())}}var Fe=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,r,n,i){let o=n||this.getIdToRemoteIdMap(e),s=i||this.getRemoteIdToIdMap(e),a=o.get(r);return a||(a=this.generateIdFn(),o.set(r,a),s.set(a,r)),a}getIds(e,r){let n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return r.map(o=>this.getId(e,o,n,i))}getRemoteId(e,r,n){let i=n||this.getRemoteIdToIdMap(e);if(typeof r!="number")return r;let o=i.get(r);return o||-1}getRemoteIds(e,r){let n=this.getRemoteIdToIdMap(e);return r.map(i=>this.getRemoteId(e,i,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}};var rt=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Fe(At),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Fe(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)===null||n===void 0||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if(e.data.type==="rrweb"){if(!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let i=this.transformCrossOriginEvent(n,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}transformCrossOriginEvent(e,r){var n;switch(r.type){case w.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:w.IncrementalSnapshot,data:{source:S.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case w.Meta:case w.Load:case w.DomContentLoaded:return!1;case w.Plugin:return r;case w.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case w.IncrementalSnapshot:switch(r.data.source){case S.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e)}),r.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),r;case S.Drag:case S.TouchMove:case S.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),r;case S.ViewportResize:return!1;case S.MediaInteraction:case S.MouseInteraction:case S.Scroll:case S.CanvasMutation:case S.Input:return this.replaceIds(r.data,e,["id"]),r;case S.StyleSheetRule:case S.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case S.Font:return r;case S.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),r;case S.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),r}}}replace(e,r,n,i){for(let o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=e.getIds(n,r[o]):r[o]=e.getId(n,r[o]));return r}replaceIds(e,r,n){return this.replace(this.crossOriginIframeMirror,e,r,n)}replaceStyleIds(e,r,n){return this.replace(this.crossOriginIframeStyleMirror,e,r,n)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id"]),"childNodes"in e&&e.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}};var nt=class{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;let r=this;this.restorePatches.push(ie(Element.prototype,"attachShadow",function(n){return function(i){let o=n.call(this,i);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),o}}))}addShadowRoot(e,r){ge(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),Ot(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Lt(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Pt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ie(e.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(i){let o=n.call(this,i);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,e.contentDocument),o}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}};function xr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Mr(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{l(n.next(d))}catch(u){s(u)}}function c(d){try{l(n.throw(d))}catch(u){s(u)}}function l(d){d.done?o(d.value):i(d.value).then(a,c)}l((n=n.apply(t,e||[])).next())})}var Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Yn=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(De=0;De<Re.length;De++)Yn[Re.charCodeAt(De)]=De;var De,Nr=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=Re[e[r]>>2],i+=Re[(e[r]&3)<<4|e[r+1]>>4],i+=Re[(e[r+1]&15)<<2|e[r+2]>>6],i+=Re[e[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Or=new Map;function Jn(t,e){let r=Or.get(t);return r||(r=new Map,Or.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Bt=(t,e,r)=>{if(!t||!(Lr(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=Jn(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function it(t,e,r){if(t instanceof Array)return t.map(n=>it(n,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let n=t.constructor.name,i=Nr(t);return{rr_type:n,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[it(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let n=t.constructor.name,{src:i}=t;return{rr_type:n,src:i}}else if(t instanceof HTMLCanvasElement){let n="HTMLImageElement",i=t.toDataURL();return{rr_type:n,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[it(t.data,e,r),t.width,t.height]};if(Lr(t,e)||typeof t=="object"){let n=t.constructor.name,i=Bt(t,e,r);return{rr_type:n,index:i}}}}return t}var ot=(t,e,r)=>[...t].map(n=>it(n,e,r)),Lr=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>t instanceof e[i]);function Pr(t,e,r,n){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof e.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=ie(e.CanvasRenderingContext2D.prototype,s,function(c){return function(...l){return N(this.canvas,r,n,!0)||setTimeout(()=>{let d=ot([...l],e,this);t(this.canvas,{type:le["2D"],property:s,args:d})},0),c.apply(this,l)}});i.push(a)}catch(a){let c=Ie(e.CanvasRenderingContext2D.prototype,s,{set(l){t(this.canvas,{type:le["2D"],property:s,args:[l],setter:!0})}});i.push(c)}return()=>{i.forEach(s=>s())}}function Ft(t,e,r){let n=[];try{let i=ie(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(s,...a){return N(this,e,r,!0)||"__context"in this||(this.__context=s),o.apply(this,[s,...a])}});n.push(i)}catch(i){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(i=>i())}}function Br(t,e,r,n,i,o,s){let a=[],c=Object.getOwnPropertyNames(t);for(let l of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof t[l]!="function")continue;let d=ie(t,l,function(u){return function(...p){let m=u.apply(this,p);if(Bt(m,s,this),!N(this.canvas,n,i,!0)){let h=ot([...p],s,this),v={type:e,property:l,args:h};r(this.canvas,v)}return m}});a.push(d)}catch(d){let u=Ie(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:!0})}});a.push(u)}return a}function Fr(t,e,r,n,i){let o=[];return o.push(...Br(e.WebGLRenderingContext.prototype,le.WebGL,t,r,n,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Br(e.WebGL2RenderingContext.prototype,le.WebGL2,t,r,n,i,e)),()=>{o.forEach(s=>s())}}var Dt=null;try{Dr=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof mt=="function"&&mt("worker_threads"),Dt=Dr.Worker}catch(t){}var Dr;function jn(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}function _r(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=jn(t,i),s=o.indexOf(`
4
- `,10)+1,a=o.substring(s)+(n?"//# sourceMappingURL="+n:"");return function(l){return new Dt(a,Object.assign({},l,{eval:!0}))}}function Qn(t,e){var r=atob(t);if(e){for(var n=new Uint8Array(r.length),i=0,o=r.length;i<o;++i)n[i]=r.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(n.buffer))}return r}function qn(t,e,r){var n=e===void 0?null:e,i=r===void 0?!1:r,o=Qn(t,i),s=o.indexOf(`
5
- `,10)+1,a=o.substring(s)+(n?"//# sourceMappingURL="+n:""),c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function Wr(t,e,r){var n;return function(o){return n=n||qn(t,e,r),new Worker(n,o)}}var Xn=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Ur(){return Xn}function Gr(t,e,r){return Ur()?_r(t,e,r):Wr(t,e,r)}var Hr=Gr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);var st=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(c,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(l)};let{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,r,n,i,o){let s=Ft(r,n,i),a=new Map,c=new Hr;c.onmessage=h=>{let{id:v}=h.data;if(a.set(v,!1),!("base64"in h.data))return;let{base64:I,type:y,width:f,height:g}=h.data;this.mutationCb({id:v,type:le["2D"],commands:[{property:"clearRect",args:[0,0,f,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:I}],type:y}]},0,0]}]})};let l=1e3/e,d=0,u,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(v=>{N(v,n,i,!0)||h.push(v)}),h},m=h=>{if(d&&h-d<l){u=requestAnimationFrame(m);return}d=h,p().forEach(v=>Mr(this,void 0,void 0,function*(){var I;let y=this.mirror.getId(v);if(a.get(y))return;if(a.set(y,!0),["webgl","webgl2"].includes(v.__context)){let g=v.getContext(v.__context);((I=g==null?void 0:g.getContextAttributes())===null||I===void 0?void 0:I.preserveDrawingBuffer)===!1&&(g==null||g.clear(g.COLOR_BUFFER_BIT))}let f=yield createImageBitmap(v);c.postMessage({id:y,bitmap:f,width:v.width,height:v.height,dataURLOptions:o.dataURLOptions},[f])})),u=requestAnimationFrame(m)};u=requestAnimationFrame(m),this.resetObservers=()=>{s(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Ft(e,r,n),o=Pr(this.processMutation.bind(this),e,r,n),s=Fr(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||r===-1)return;let i=n.map(s=>xr(s,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e)}};var at=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new ze,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,r){if(e.length===0)return;let n={id:r,styleIds:[]},i=[];for(let o of e){let s;if(this.styleMirror.has(o))s=this.styleMirror.getId(o);else{s=this.styleMirror.add(o);let a=Array.from(o.rules||CSSRule);i.push({styleId:s,rules:a.map((c,l)=>({rule:wt(c),index:l}))})}n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}};function D(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var O,ct,_t,lt=!1,oe=ur();function Ce(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:p,maskInputFn:m,maskTextFn:h,hooks:v,packFn:I,sampling:y={},dataURLOptions:f={},mousemoveWait:g,recordCanvas:b=!1,recordCrossOriginIframes:x=!1,userTriggeredOnInput:P=!1,collectFonts:B=!1,inlineImages:T=!1,plugins:Y,keepIframeSrcFn:J=()=>!1,ignoreCSSAttributes:X=new Set([])}=t,$=x?window.parent===window:!0,ee=!1;if(!$)try{window.parent.document,ee=!1}catch(C){ee=!0}if($&&!e)throw new Error("emit function is required");g!==void 0&&y.mousemove===void 0&&(y.mousemove=g),oe.reset();let F=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u!==void 0?u:{password:!0},j=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"}:p||{};mr();let re,se=0,ce=C=>{for(let U of Y||[])U.eventProcessor&&(C=U.eventProcessor(C));return I&&(C=I(C)),C};O=(C,U)=>{var V;if(!((V=pe[0])===null||V===void 0)&&V.isFrozen()&&C.type!==w.FullSnapshot&&!(C.type===w.IncrementalSnapshot&&C.data.source===S.Mutation)&&pe.forEach(M=>M.unfreeze()),$)e==null||e(ce(C),U);else if(ee){let M={type:"rrweb",event:ce(C),isCheckout:U};window.parent.postMessage(M,"*")}if(C.type===w.FullSnapshot)re=C,se=0;else if(C.type===w.IncrementalSnapshot){if(C.data.source===S.Mutation&&C.data.isAttachIframe)return;se++;let M=n&&se>=n,q=r&&C.timestamp-re.timestamp>r;(M||q)&&ct(!0)}};let H=C=>{O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.Mutation},C)}))},Q=C=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.Scroll},C)})),de=C=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.CanvasMutation},C)})),L=C=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.AdoptedStyleSheet},C)})),ne=new at({mutationCb:H,adoptedStyleSheetCb:L}),ae=new rt({mirror:oe,mutationCb:H,stylesheetManager:ne,recordCrossOriginIframes:x,wrappedEmit:O});for(let C of Y||[])C.getMirror&&C.getMirror({nodeMirror:oe,crossOriginIframeMirror:ae.crossOriginIframeMirror,crossOriginIframeStyleMirror:ae.crossOriginIframeStyleMirror});_t=new st({recordCanvas:b,mutationCb:de,win:window,blockClass:i,blockSelector:o,mirror:oe,sampling:y.canvas,dataURLOptions:f});let Se=new nt({mutationCb:H,scrollCb:Q,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:F,dataURLOptions:f,maskTextFn:h,maskInputFn:m,recordCanvas:b,inlineImages:T,sampling:y,slimDOMOptions:j,iframeManager:ae,stylesheetManager:ne,canvasManager:_t,keepIframeSrcFn:J},mirror:oe});ct=(C=!1)=>{var U,V,M,q,A,K;O(D({type:w.Meta,data:{href:window.location.href,width:Je(),height:Ye()}}),C),ne.reset(),pe.forEach(G=>G.lock());let Me=hr(document,{mirror:oe,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:F,maskTextFn:h,slimDOM:j,dataURLOptions:f,recordCanvas:b,inlineImages:T,onSerialize:G=>{Qe(G,oe)&&ae.addIframe(G),qe(G,oe)&&ne.trackLinkElement(G),Xe(G)&&Se.addShadowRoot(G.shadowRoot,document)},onIframeLoad:(G,pt)=>{ae.attachIframe(G,pt),Se.observeAttachShadow(G)},onStylesheetLoad:(G,pt)=>{ne.attachLinkElement(G,pt)},keepIframeSrcFn:J});if(!Me)return console.warn("Failed to snapshot the document");O(D({type:w.FullSnapshot,data:{node:Me,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((V=(U=document==null?void 0:document.body)===null||U===void 0?void 0:U.parentElement)===null||V===void 0?void 0:V.scrollLeft)||((M=document==null?void 0:document.body)===null||M===void 0?void 0:M.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((A=(q=document==null?void 0:document.body)===null||q===void 0?void 0:q.parentElement)===null||A===void 0?void 0:A.scrollTop)||((K=document==null?void 0:document.body)===null||K===void 0?void 0:K.scrollTop)||0}}})),pe.forEach(G=>G.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ne.adoptStyleSheets(document.adoptedStyleSheets,oe.getId(document))};try{let C=[];C.push(W("DOMContentLoaded",()=>{O(D({type:w.DomContentLoaded,data:{}}))}));let U=M=>{var q;return Rr({mutationCb:H,mousemoveCb:(A,K)=>O(D({type:w.IncrementalSnapshot,data:{source:K,positions:A}})),mouseInteractionCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.MouseInteraction},A)})),scrollCb:Q,viewportResizeCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.ViewportResize},A)})),inputCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.Input},A)})),mediaInteractionCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.MediaInteraction},A)})),styleSheetRuleCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.StyleSheetRule},A)})),styleDeclarationCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.StyleDeclaration},A)})),canvasMutationCb:de,fontCb:A=>O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.Font},A)})),selectionCb:A=>{O(D({type:w.IncrementalSnapshot,data:Object.assign({source:S.Selection},A)}))},blockClass:i,ignoreClass:s,maskTextClass:a,maskTextSelector:c,maskInputOptions:F,inlineStylesheet:l,sampling:y,recordCanvas:b,inlineImages:T,userTriggeredOnInput:P,collectFonts:B,doc:M,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:J,blockSelector:o,slimDOMOptions:j,dataURLOptions:f,mirror:oe,iframeManager:ae,stylesheetManager:ne,shadowDomManager:Se,canvasManager:_t,ignoreCSSAttributes:X,plugins:((q=Y==null?void 0:Y.filter(A=>A.observer))===null||q===void 0?void 0:q.map(A=>({observer:A.observer,options:A.options,callback:K=>O(D({type:w.Plugin,data:{plugin:A.name,payload:K}}))})))||[]},v)};ae.addLoadListener(M=>{C.push(U(M.contentDocument))});let V=()=>{ct(),C.push(U(document)),lt=!0};return document.readyState==="interactive"||document.readyState==="complete"?V():C.push(W("load",()=>{O(D({type:w.Load,data:{}})),V()},window)),()=>{C.forEach(M=>M()),lt=!1}}catch(C){console.warn(C)}}Ce.addCustomEvent=(t,e)=>{if(!lt)throw new Error("please add custom event after start recording");O(D({type:w.Custom,data:{tag:t,payload:e}}))};Ce.freezePage=()=>{pe.forEach(t=>t.freeze())};Ce.takeFullSnapshot=t=>{if(!lt)throw new Error("please take full snapshot after start recording");ct(t)};Ce.mirror=oe;var dt=class{constructor(e){this.opts=e;this.seq=0;this.buffer=[];this.stopRecording=null;this.flushTimer=null}start(){var r,n,i;if(typeof document=="undefined"||this.stopRecording)return;let e={emit:o=>{this.buffer.push(o),this.buffer.length>=this.opts.maxEventsPerBatch&&this.flush()},checkoutEveryNms:(r=this.opts.checkoutEveryNms)!=null?r:6e5,inlineStylesheet:(n=this.opts.inlineStylesheet)!=null?n:!1,maskAllInputs:this.opts.maskAllInputs,maskTextClass:this.opts.maskTextClass,blockClass:this.opts.blockClass};this.stopRecording=(i=Ce(e))!=null?i:null,this.flushTimer=setInterval(()=>{this.buffer.length>0&&this.flush()},this.opts.flushIntervalMs)}flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);this.opts.emit({type:"session_replay",data:{seq:this.seq++,events:e}})}destroy(){var e;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush(),(e=this.stopRecording)==null||e.call(this),this.stopRecording=null}};function $n(t){var n;let e=(n=t.getAttribute("data-alphana-amount"))==null?void 0:n.trim();if(!e)return;let r=Number(e);return Number.isFinite(r)?r:void 0}function ei(t){var r;return((r=t.getAttribute("data-alphana-currency"))==null?void 0:r.trim())||void 0}function ti(t){var r;return((r=t.getAttribute("data-alphana-event-name"))==null?void 0:r.trim())||void 0}function ri(t,e){var n;if(!t||typeof t.getAttribute!="function"||typeof t.id!="string")return null;let r=t;for(;r;){let i=(n=r.id)==null?void 0:n.trim();if(i){let o=e.get(i);if(o)return{binding:o,matchedEl:r}}r=r.parentElement}return null}function ni(t,e){var o,s,a;let r=(o=$n(t))!=null?o:e.value,n=(s=ei(t))!=null?s:e.currency;if(r==null||!n)return null;let i=(a=ti(t))!=null?a:e.eventName;return{amount:r,currency:n,eventName:i}}var ut=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=!1;this.onClick=e=>{let r=ri(e.target,this.bindingsById);if(!r)return;let{binding:n,matchedEl:i}=r;if(n.eventKind==="goal"){this.handlers.onGoal(n);return}let o=ni(i,n);if(!o){typeof console!="undefined"&&console.debug("[alphana-sdk] revenue element click skipped: missing amount/currency",n.elementId);return}this.handlers.onRevenue(n,o.amount,o.currency,o.eventName)}}setBindings(e){this.bindingsById=new Map(e.filter(r=>typeof r.elementId=="string"&&r.elementId.trim()).map(r=>[r.elementId.trim(),r]))}start(){typeof document=="undefined"||this.attached||(document.addEventListener("click",this.onClick,!0),this.attached=!0)}destroy(){!this.attached||typeof document=="undefined"||(document.removeEventListener("click",this.onClick,!0),this.attached=!1)}};var Vr="alphana-cookie-consent",ii="https://alphana.ir",oi="https://storage.alphana.ir/cdn/logos/Fav-Alphana.png";function xe(){var t;typeof document!="undefined"&&((t=document.getElementById(Vr))==null||t.remove())}function Kr(t,e){var b;if(typeof document=="undefined")return;xe();let r=document.createElement("div");r.id=Vr,r.setAttribute("data-alphana-widget","cookie-consent"),Object.assign(r.style,{all:"initial",position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483646",pointerEvents:"none"});let n=r.attachShadow({mode:"open"}),i=document.documentElement.getAttribute("dir")==="rtl"||/^(fa|ar|he|ur)/i.test(document.documentElement.lang)?"rtl":"ltr",o=t.theme,s=i==="rtl"?"\u0633\u06CC\u0627\u0633\u062A \u062D\u0631\u06CC\u0645 \u062E\u0635\u0648\u0635\u06CC":"Privacy policy",a=i==="rtl"?"\u0642\u062F\u0631\u062A\u200C\u06AF\u0631\u0641\u062A\u0647 \u0627\u0632 Alphana":"Powered by Alphana",c=document.createElement("style");c.textContent=`
3
+ or you can use record.mirror to access the mirror instance during recording.`,vn={map:{},getId(){return console.error(Ee),-1},getNode(){return console.error(Ee),null},removeNodeFromMap(){console.error(Ee)},has(){return console.error(Ee),!1},reset(){console.error(Ee)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(vn=new Proxy(vn,{get(t,e,n){return e==="map"&&console.error(Ee),Reflect.get(t,e,n)}}));function Te(t,e,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=e-(s-i),l=this;a<=0||a>e?(r&&(clearTimeout(r),r=null),i=s,t.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,t.apply(l,o)},a))}}function be(t,e,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>be(t,e,o||{},!0)}function ie(t,e,n){try{if(!(e in t))return()=>{};let r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch(r){return()=>{}}}function qe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Qe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _(t,e,n,r){if(!t)return!1;let i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!i)return!1;if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Oe(i,e,r))return!0;return!!(n&&(t.matches(n)||r&&i.closest(n)!==null))}function bn(t,e){return e.getId(t)!==-1}function Xe(t,e){return e.getId(t)===ye}function Nt(t,e){if(ve(t))return!1;let n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?Nt(t.parentNode,e):!0:!0}function Lt(t){return!!t.changedTouches}function In(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function $e(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function et(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function tt(t){return!!(t!=null&&t.shadowRoot)}var Je=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var n;return(n=this.styleIDMap.get(e))!==null&&n!==void 0?n:-1}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};var M=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(M||{}),x=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(x||{}),nt=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(nt||{}),le=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(le||{});function Cn(t){return"__ln"in t}var Ot=class{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=(n==null?void 0:n.next)||null;return n}addNode(e){let n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&Cn(e.previousSibling)){let r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&Cn(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;this.length++}removeNode(e){let n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next&&(n.next.previous=n.previous)):(this.head=n.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}},Sn=(t,e)=>`${t}@${e}`,rt=class{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],n=new Ot,r=a=>{let l=a,c=ye;for(;c===ye;)l=l&&l.nextSibling,c=l&&this.mirror.getId(l);return c},i=a=>{var l,c,d,u;let h=null;((c=(l=a.getRootNode)===null||l===void 0?void 0:l.call(a))===null||c===void 0?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&a.getRootNode().host&&(h=a.getRootNode().host);let f=h;for(;((u=(d=f==null?void 0:f.getRootNode)===null||d===void 0?void 0:d.call(f))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&f.getRootNode().host;)f=f.getRootNode().host;let p=!this.doc.contains(a)&&(!f||!this.doc.contains(f));if(!a.parentNode||p)return;let v=ve(a.parentNode)?this.mirror.getId(h):this.mirror.getId(a.parentNode),b=r(a);if(v===-1||b===-1)return n.addNode(a);let y=fe(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{$e(m,this.mirror)&&this.iframeManager.addIframe(m),et(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),tt(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(m,g)=>{this.iframeManager.attachIframe(m,g),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,g)=>{this.stylesheetManager.attachLinkElement(m,g)}});y&&e.push({parentId:v,nextId:b,node:y})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of Array.from(this.movedSet.values()))wn(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||i(a);for(let a of Array.from(this.addedSet.values()))!kn(this.droppedSet,a)&&!wn(this.removes,a,this.mirror)||kn(this.movedSet,a)?i(a):this.droppedSet.add(a);let o=null;for(;n.length;){let a=null;if(o){let l=this.mirror.getId(o.value.parentNode),c=r(o.value);l!==-1&&c!==-1&&(a=o)}if(!a)for(let l=n.length-1;l>=0;l--){let c=n.get(l);if(c){let d=this.mirror.getId(c.value.parentNode);if(r(c.value)===-1)continue;if(d!==-1){a=c;break}else{let h=c.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=h.parentNode.host;if(this.mirror.getId(f)!==-1){a=c;break}}}}}if(!a){for(;n.head;)n.removeNode(n.head.value);break}o=a.previous,n.removeNode(a.value),i(a.value)}let s={texts:this.texts.map(a=>({id:this.mirror.getId(a.node),value:a.value})).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>({id:this.mirror.getId(a.node),attributes:a.attributes})).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.processMutation=e=>{if(!Xe(e.target,this.mirror))switch(e.type){case"characterData":{let n=e.target.textContent;!_(e.target,this.blockClass,this.blockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:Mt(e.target,this.maskTextClass,this.maskTextSelector)&&n?this.maskTextFn?this.maskTextFn(n):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{let n=e.target,r=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(r=Pe({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),_(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let i=this.attributes.find(o=>o.node===e.target);if(n.tagName==="IFRAME"&&e.attributeName==="src"&&!this.keepIframeSrcFn(r))if(!n.contentDocument)e.attributeName="rr_src";else return;if(i||(i={node:e.target,attributes:{}},this.attributes.push(i)),e.attributeName==="style"){let o=this.doc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue),(i.attributes.style===void 0||i.attributes.style===null)&&(i.attributes.style={});let s=i.attributes.style;for(let a of Array.from(n.style)){let l=n.style.getPropertyValue(a),c=n.style.getPropertyPriority(a);(l!==o.style.getPropertyValue(a)||c!==o.style.getPropertyPriority(a))&&(c===""?s[a]=l:s[a]=[l,c])}for(let a of Array.from(o.style))n.style.getPropertyValue(a)===""&&(s[a]=!1)}else i.attributes[e.attributeName]=Rt(this.doc,n.tagName,e.attributeName,r);break}case"childList":{if(_(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{let r=this.mirror.getId(n),i=ve(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);_(e.target,this.blockClass,this.blockSelector,!1)||Xe(n,this.mirror)||!bn(n,this.mirror)||(this.addedSet.has(n)?(Pt(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||Nt(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Sn(r,i)]?Pt(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:ve(e.target)&&ge(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(this.mirror.hasNode(e)){if(Xe(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Sn(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach(r=>this.genAdds(r))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(n=>{this[n]=e[n]})}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 Pt(t,e){t.delete(e),e.childNodes.forEach(n=>Pt(t,n))}function wn(t,e,n){return t.length===0?!1:An(t,e,n)}function An(t,e,n){let{parentNode:r}=e;if(!r)return!1;let i=n.getId(r);return t.some(o=>o.id===i)?!0:An(t,r,n)}function kn(t,e){return t.size===0?!1:xn(t,e)}function xn(t,e){let{parentNode:n}=e;return n?t.has(n)?!0:xn(t,n):!1}var he=[],Rn=typeof CSSGroupingRule!="undefined",Mn=typeof CSSMediaRule!="undefined",Nn=typeof CSSSupportsRule!="undefined",Ln=typeof CSSConditionRule!="undefined";function Fe(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch(e){return t.target}}function Ft(t,e){var n,r;let i=new rt;he.push(i),i.init(t);let o=window.MutationObserver||window.__rrMutationObserver,s=(r=(n=window==null?void 0:window.Zone)===null||n===void 0?void 0:n.__symbol__)===null||r===void 0?void 0:r.call(n,"MutationObserver");s&&window[s]&&(o=window[s]);let a=new o(i.processMutations.bind(i));return a.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function jr({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,s=[],a,l=Te(u=>{let h=Date.now()-a;t(s.map(f=>(f.timeOffset-=h,f)),u),s=[],a=null},o),c=Te(u=>{let h=Fe(u),{clientX:f,clientY:p}=Lt(u)?u.changedTouches[0]:u;a||(a=Date.now()),s.push({x:f,y:p,id:r.getId(h),timeOffset:Date.now()-a}),l(typeof DragEvent!="undefined"&&u instanceof DragEvent?x.Drag:u instanceof MouseEvent?x.MouseMove:x.TouchMove)},i,{trailing:!1}),d=[z("mousemove",c,n),z("touchmove",c,n),z("drag",c,n)];return()=>{d.forEach(u=>u())}}function Jr({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],l=c=>d=>{let u=Fe(d);if(_(u,r,i,!0))return;let h=Lt(d)?d.changedTouches[0]:d;if(!h)return;let f=n.getId(u),{clientX:p,clientY:v}=h;t({type:nt[c],id:f,x:p,y:v})};return Object.keys(nt).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&s[c]!==!1).forEach(c=>{let d=c.toLowerCase(),u=l(c);a.push(z(d,u,e))}),()=>{a.forEach(c=>c())}}function Bt({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=Te(a=>{let l=Fe(a);if(!l||_(l,r,i,!0))return;let c=n.getId(l);if(l===e){let d=e.scrollingElement||e.documentElement;t({id:c,x:d.scrollLeft,y:d.scrollTop})}else t({id:c,x:l.scrollLeft,y:l.scrollTop})},o.scroll||100);return z("scroll",s,e)}function qr({viewportResizeCb:t}){let e=-1,n=-1,r=Te(()=>{let i=qe(),o=Qe();(e!==i||n!==o)&&(t({width:Number(o),height:Number(i)}),e=i,n=o)},200);return z("resize",r,window)}function En(t,e){let n=Object.assign({},t);return e||delete n.userTriggered,n}var Qr=["INPUT","TEXTAREA","SELECT"],Tn=new WeakMap;function Xr({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,maskInputOptions:s,maskInputFn:a,sampling:l,userTriggeredOnInput:c}){function d(y){let m=Fe(y),g=y.isTrusted;if(m&&m.tagName==="OPTION"&&(m=m.parentElement),!m||!m.tagName||Qr.indexOf(m.tagName)<0||_(m,r,i,!0))return;let I=m.type;if(m.classList.contains(o))return;let T=m.value,k=!1;I==="radio"||I==="checkbox"?k=m.checked:(s[m.tagName.toLowerCase()]||s[I])&&(T=Pe({maskInputOptions:s,tagName:m.tagName,type:I,value:T,maskInputFn:a})),u(m,En({text:T,isChecked:k,userTriggered:g},c));let N=m.name;I==="radio"&&N&&k&&e.querySelectorAll(`input[type="radio"][name="${N}"]`).forEach(w=>{w!==m&&u(w,En({text:w.value,isChecked:!k,userTriggered:!1},c))})}function u(y,m){let g=Tn.get(y);if(!g||g.text!==m.text||g.isChecked!==m.isChecked){Tn.set(y,m);let I=n.getId(y);t(Object.assign(Object.assign({},m),{id:I}))}}let f=(l.input==="last"?["change"]:["input","change"]).map(y=>z(y,d,e)),p=e.defaultView;if(!p)return()=>{f.forEach(y=>y())};let v=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),b=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&f.push(...b.map(y=>be(y[0],y[1],{set(){d({target:this})}},!1,p))),()=>{f.forEach(y=>y())}}function it(t){let e=[];function n(r,i){if(Rn&&r.parentRule instanceof CSSGroupingRule||Mn&&r.parentRule instanceof CSSMediaRule||Nn&&r.parentRule instanceof CSSSupportsRule||Ln&&r.parentRule instanceof CSSConditionRule){let s=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(s)}else if(r.parentStyleSheet){let s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(s)}return i}return n(t,e)}function pe(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function $r({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:h,styleId:f}=pe(this,e,n.styleMirror);return(h&&h!==-1||f&&f!==-1)&&t({id:h,styleId:f,adds:[{rule:d,index:u}]}),i.apply(this,[d,u])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=function(d){let{id:u,styleId:h}=pe(this,e,n.styleMirror);return(u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,removes:[{index:d}]}),o.apply(this,[d])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:h}=pe(this,e,n.styleMirror);return(u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,replace:d}),s.apply(this,[d])});let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:h}=pe(this,e,n.styleMirror);return(u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,replaceSync:d}),a.apply(this,[d])});let l={};Rn?l.CSSGroupingRule=r.CSSGroupingRule:(Mn&&(l.CSSMediaRule=r.CSSMediaRule),Ln&&(l.CSSConditionRule=r.CSSConditionRule),Nn&&(l.CSSSupportsRule=r.CSSSupportsRule));let c={};return Object.entries(l).forEach(([d,u])=>{c[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(h,f){let{id:p,styleId:v}=pe(this.parentStyleSheet,e,n.styleMirror);return(p&&p!==-1||v&&v!==-1)&&t({id:p,styleId:v,adds:[{rule:h,index:[...it(this),f||0]}]}),c[d].insertRule.apply(this,[h,f])},u.prototype.deleteRule=function(h){let{id:f,styleId:p}=pe(this.parentStyleSheet,e,n.styleMirror);return(f&&f!==-1||p&&p!==-1)&&t({id:f,styleId:p,removes:[{index:[...it(this),h]}]}),c[d].deleteRule.apply(this,[h])}}),()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([d,u])=>{u.prototype.insertRule=c[d].insertRule,u.prototype.deleteRule=c[d].deleteRule})}}function Dt({mirror:t,stylesheetManager:e},n){var r,i,o;let s=null;n.nodeName==="#document"?s=t.getId(n):s=t.getId(n.host);let a=n.nodeName==="#document"?(r=n.defaultView)===null||r===void 0?void 0:r.Document:(o=(i=n.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,l=Object.getOwnPropertyDescriptor(a==null?void 0:a.prototype,"adoptedStyleSheets");return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)===null||c===void 0?void 0:c.call(this)},set(c){var d;let u=(d=l.set)===null||d===void 0?void 0:d.call(this,c);if(s!==null&&s!==-1)try{e.adoptStyleSheets(c,s)}catch(h){}return u}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})}function ei({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(a,l,c){var d;if(n.has(a))return o.apply(this,[a,l,c]);let{id:u,styleId:h}=pe((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,r.styleMirror);return(u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,set:{property:a,value:l,priority:c},index:it(this.parentRule)}),o.apply(this,[a,l,c])};let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(a){var l;if(n.has(a))return s.apply(this,[a]);let{id:c,styleId:d}=pe((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,e,r.styleMirror);return(c&&c!==-1||d&&d!==-1)&&t({id:c,styleId:d,remove:{property:a},index:it(this.parentRule)}),s.apply(this,[a])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s}}function ti({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:r,sampling:i}){let o=a=>Te(l=>{let c=Fe(l);if(!c||_(c,e,n,!0))return;let{currentTime:d,volume:u,muted:h,playbackRate:f}=c;t({type:a,id:r.getId(c),currentTime:d,volume:u,muted:h,playbackRate:f})},i.media||500),s=[z("play",o(0)),z("pause",o(1)),z("seeked",o(2)),z("volumechange",o(3)),z("ratechange",o(4))];return()=>{s.forEach(a=>a())}}function ni({fontCb:t,doc:e}){let n=e.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,c,d){let u=new o(l,c,d);return i.set(u,{family:l,buffer:typeof c!="string",descriptors:d,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let s=ie(e.fonts,"add",function(a){return function(l){return setTimeout(()=>{let c=i.get(l);c&&(t(c),i.delete(l))},0),a.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(s),()=>{r.forEach(a=>a())}}function ri(t){let{doc:e,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=t,s=!0,a=()=>{let l=e.getSelection();if(!l||s&&(l!=null&&l.isCollapsed))return;s=l.isCollapsed||!1;let c=[],d=l.rangeCount||0;for(let u=0;u<d;u++){let h=l.getRangeAt(u),{startContainer:f,startOffset:p,endContainer:v,endOffset:b}=h;_(f,r,i,!0)||_(v,r,i,!0)||c.push({start:n.getId(f),startOffset:p,end:n.getId(v),endOffset:b})}o({ranges:c})};return a(),z("selectionchange",a)}function ii(t,e){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:f}=t;t.mutationCb=(...p)=>{e.mutation&&e.mutation(...p),n(...p)},t.mousemoveCb=(...p)=>{e.mousemove&&e.mousemove(...p),r(...p)},t.mouseInteractionCb=(...p)=>{e.mouseInteraction&&e.mouseInteraction(...p),i(...p)},t.scrollCb=(...p)=>{e.scroll&&e.scroll(...p),o(...p)},t.viewportResizeCb=(...p)=>{e.viewportResize&&e.viewportResize(...p),s(...p)},t.inputCb=(...p)=>{e.input&&e.input(...p),a(...p)},t.mediaInteractionCb=(...p)=>{e.mediaInteaction&&e.mediaInteaction(...p),l(...p)},t.styleSheetRuleCb=(...p)=>{e.styleSheetRule&&e.styleSheetRule(...p),c(...p)},t.styleDeclarationCb=(...p)=>{e.styleDeclaration&&e.styleDeclaration(...p),d(...p)},t.canvasMutationCb=(...p)=>{e.canvasMutation&&e.canvasMutation(...p),u(...p)},t.fontCb=(...p)=>{e.font&&e.font(...p),h(...p)},t.selectionCb=(...p)=>{e.selection&&e.selection(...p),f(...p)}}function On(t,e={}){let n=t.doc.defaultView;if(!n)return()=>{};ii(t,e);let r=Ft(t,t.doc),i=jr(t),o=Jr(t),s=Bt(t),a=qr(t),l=Xr(t),c=ti(t),d=$r(t,{win:n}),u=Dt(t,t.doc),h=ei(t,{win:n}),f=t.collectFonts?ni(t):()=>{},p=ri(t),v=[];for(let b of t.plugins)v.push(b.observer(b.callback,n,b.options));return()=>{he.forEach(b=>b.reset()),r.disconnect(),i(),o(),s(),a(),l(),c(),d(),u(),h(),f(),p(),v.forEach(b=>b())}}var Be=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,r,i){let o=r||this.getIdToRemoteIdMap(e),s=i||this.getRemoteIdToIdMap(e),a=o.get(n);return a||(a=this.generateIdFn(),o.set(n,a),s.set(a,n)),a}getIds(e,n){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return n.map(o=>this.getId(e,o,r,i))}getRemoteId(e,n,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;let o=i.get(n);return o||-1}getRemoteIds(e,n){let r=this.getRemoteIdToIdMap(e);return n.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}};var ot=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Be(Et),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Be(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(r=this.loadListener)===null||r===void 0||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if(e.data.type==="rrweb"){if(!e.source)return;let r=this.crossOriginIframeMap.get(e.source);if(!r)return;let i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}transformCrossOriginEvent(e,n){var r;switch(n.type){case M.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e),{timestamp:n.timestamp,type:M.IncrementalSnapshot,data:{source:x.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case M.Meta:case M.Load:case M.DomContentLoaded:return!1;case M.Plugin:return n;case M.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case M.IncrementalSnapshot:switch(n.data.source){case x.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e)}),n.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),n;case x.Drag:case x.TouchMove:case x.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),n;case x.ViewportResize:return!1;case x.MediaInteraction:case x.MouseInteraction:case x.Scroll:case x.CanvasMutation:case x.Input:return this.replaceIds(n.data,e,["id"]),n;case x.StyleSheetRule:case x.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case x.Font:return n;case x.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),n;case x.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),(r=n.data.styles)===null||r===void 0||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),n}}}replace(e,n,r,i){for(let o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=e.getIds(r,n[o]):n[o]=e.getId(r,n[o]));return n}replaceIds(e,n,r){return this.replace(this.crossOriginIframeMirror,e,n,r)}replaceStyleIds(e,n,r){return this.replace(this.crossOriginIframeStyleMirror,e,n,r)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}};var st=class{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;let n=this;this.restorePatches.push(ie(Element.prototype,"attachShadow",function(r){return function(i){let o=r.call(this,i);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,this.ownerDocument),o}}))}addShadowRoot(e,n){ge(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),Ft(Object.assign(Object.assign({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Bt(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Dt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)},0)))}observeAttachShadow(e){if(e.contentWindow){let n=this;this.restorePatches.push(ie(e.contentWindow.HTMLElement.prototype,"attachShadow",function(r){return function(i){let o=r.call(this,i);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,e.contentDocument),o}}))}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet}};function Pn(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Fn(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(d){try{c(r.next(d))}catch(u){s(u)}}function l(d){try{c(r.throw(d))}catch(u){s(u)}}function c(d){d.done?o(d.value):i(d.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}var Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oi=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(De=0;De<Re.length;De++)oi[Re.charCodeAt(De)]=De;var De,Bn=function(t){var e=new Uint8Array(t),n,r=e.length,i="";for(n=0;n<r;n+=3)i+=Re[e[n]>>2],i+=Re[(e[n]&3)<<4|e[n+1]>>4],i+=Re[(e[n+1]&15)<<2|e[n+2]>>6],i+=Re[e[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};var Dn=new Map;function si(t,e){let n=Dn.get(t);return n||(n=new Map,Dn.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}var _t=(t,e,n)=>{if(!t||!(_n(t,e)||typeof t=="object"))return;let r=t.constructor.name,i=si(n,r),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function at(t,e,n){if(t instanceof Array)return t.map(r=>at(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let r=t.constructor.name,i=Bn(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[at(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let r=t.constructor.name,{src:i}=t;return{rr_type:r,src:i}}else if(t instanceof HTMLCanvasElement){let r="HTMLImageElement",i=t.toDataURL();return{rr_type:r,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[at(t.data,e,n),t.width,t.height]};if(_n(t,e)||typeof t=="object"){let r=t.constructor.name,i=_t(t,e,n);return{rr_type:r,index:i}}}}return t}var ct=(t,e,n)=>[...t].map(r=>at(r,e,n)),_n=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>t instanceof e[i]);function Wn(t,e,n,r){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof e.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=ie(e.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return _(this.canvas,n,r,!0)||setTimeout(()=>{let d=ct([...c],e,this);t(this.canvas,{type:le["2D"],property:s,args:d})},0),l.apply(this,c)}});i.push(a)}catch(a){let l=be(e.CanvasRenderingContext2D.prototype,s,{set(c){t(this.canvas,{type:le["2D"],property:s,args:[c],setter:!0})}});i.push(l)}return()=>{i.forEach(s=>s())}}function Wt(t,e,n){let r=[];try{let i=ie(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(s,...a){return _(this,e,n,!0)||"__context"in this||(this.__context=s),o.apply(this,[s,...a])}});r.push(i)}catch(i){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach(i=>i())}}function Hn(t,e,n,r,i,o,s){let a=[],l=Object.getOwnPropertyNames(t);for(let c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof t[c]!="function")continue;let d=ie(t,c,function(u){return function(...h){let f=u.apply(this,h);if(_t(f,s,this),!_(this.canvas,r,i,!0)){let p=ct([...h],s,this),v={type:e,property:c,args:p};n(this.canvas,v)}return f}});a.push(d)}catch(d){let u=be(t,c,{set(h){n(this.canvas,{type:e,property:c,args:[h],setter:!0})}});a.push(u)}return a}function Un(t,e,n,r,i){let o=[];return o.push(...Hn(e.WebGLRenderingContext.prototype,le.WebGL,t,n,r,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Hn(e.WebGL2RenderingContext.prototype,le.WebGL2,t,n,r,i,e)),()=>{o.forEach(s=>s())}}var Ht=null;try{Vn=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof vt=="function"&&vt("worker_threads"),Ht=Vn.Worker}catch(t){}var Vn;function ai(t,e){return Buffer.from(t,"base64").toString(e?"utf16":"utf8")}function Gn(t,e,n){var r=e===void 0?null:e,i=n===void 0?!1:n,o=ai(t,i),s=o.indexOf(`
4
+ `,10)+1,a=o.substring(s)+(r?"//# sourceMappingURL="+r:"");return function(c){return new Ht(a,Object.assign({},c,{eval:!0}))}}function ci(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function li(t,e,n){var r=e===void 0?null:e,i=n===void 0?!1:n,o=ci(t,i),s=o.indexOf(`
5
+ `,10)+1,a=o.substring(s)+(r?"//# sourceMappingURL="+r:""),l=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(l)}function zn(t,e,n){var r;return function(o){return r=r||li(t,e,n),new Worker(r,o)}}var di=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Kn(){return di}function Zn(t,e,n){return Kn()?Gn(t,e,n):zn(t,e,n)}var Yn=Zn("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);var lt=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(l,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c)};let{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&n==="all"&&this.initCanvasMutationObserver(r,i,o),s&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:a})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,n,r,i,o){let s=Wt(n,r,i),a=new Map,l=new Yn;l.onmessage=p=>{let{id:v}=p.data;if(a.set(v,!1),!("base64"in p.data))return;let{base64:b,type:y,width:m,height:g}=p.data;this.mutationCb({id:v,type:le["2D"],commands:[{property:"clearRect",args:[0,0,m,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:b}],type:y}]},0,0]}]})};let c=1e3/e,d=0,u,h=()=>{let p=[];return n.document.querySelectorAll("canvas").forEach(v=>{_(v,r,i,!0)||p.push(v)}),p},f=p=>{if(d&&p-d<c){u=requestAnimationFrame(f);return}d=p,h().forEach(v=>Fn(this,void 0,void 0,function*(){var b;let y=this.mirror.getId(v);if(a.get(y))return;if(a.set(y,!0),["webgl","webgl2"].includes(v.__context)){let g=v.getContext(v.__context);((b=g==null?void 0:g.getContextAttributes())===null||b===void 0?void 0:b.preserveDrawingBuffer)===!1&&(g==null||g.clear(g.COLOR_BUFFER_BIT))}let m=yield createImageBitmap(v);l.postMessage({id:y,bitmap:m,width:v.width,height:v.height,dataURLOptions:o.dataURLOptions},[m])})),u=requestAnimationFrame(f)};u=requestAnimationFrame(f),this.resetObservers=()=>{s(),cancelAnimationFrame(u)}}initCanvasMutationObserver(e,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Wt(e,n,r),o=Wn(this.processMutation.bind(this),e,n,r),s=Un(this.processMutation.bind(this),e,n,r,this.mirror);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=n=>{this.rafStamps.latestId=n,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,n)=>{let r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,n){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||n===-1)return;let i=r.map(s=>Pn(s,["type"])),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(e)}};var dt=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Je,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;let r={id:n,styleIds:[]},i=[];for(let o of e){let s;if(this.styleMirror.has(o))s=this.styleMirror.getId(o);else{s=this.styleMirror.add(o);let a=Array.from(o.rules||CSSRule);i.push({styleId:s,rules:a.map((l,c)=>({rule:xt(l),index:c}))})}r.styleIds.push(s)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}};function U(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var W,ut,Ut,pt=!1,oe=gn();function Ie(t={}){let{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",maskTextClass:a="rr-mask",maskTextSelector:l=null,inlineStylesheet:c=!0,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:h,maskInputFn:f,maskTextFn:p,hooks:v,packFn:b,sampling:y={},dataURLOptions:m={},mousemoveWait:g,recordCanvas:I=!1,recordCrossOriginIframes:T=!1,userTriggeredOnInput:k=!1,collectFonts:N=!1,inlineImages:w=!1,plugins:C,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:R=new Set([])}=t,A=T?window.parent===window:!0,G=!1;if(!A)try{window.parent.document,G=!1}catch(S){G=!0}if(A&&!e)throw new Error("emit function is required");g!==void 0&&y.mousemove===void 0&&(y.mousemove=g),oe.reset();let D=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u!==void 0?u:{password:!0},X=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};In();let ne,se=0,ce=S=>{for(let K of C||[])K.eventProcessor&&(S=K.eventProcessor(S));return b&&(S=b(S)),S};W=(S,K)=>{var j;if(!((j=he[0])===null||j===void 0)&&j.isFrozen()&&S.type!==M.FullSnapshot&&!(S.type===M.IncrementalSnapshot&&S.data.source===x.Mutation)&&he.forEach(B=>B.unfreeze()),A)e==null||e(ce(S),K);else if(G){let B={type:"rrweb",event:ce(S),isCheckout:K};window.parent.postMessage(B,"*")}if(S.type===M.FullSnapshot)ne=S,se=0;else if(S.type===M.IncrementalSnapshot){if(S.data.source===x.Mutation&&S.data.isAttachIframe)return;se++;let B=r&&se>=r,ee=n&&S.timestamp-ne.timestamp>n;(B||ee)&&ut(!0)}};let Y=S=>{W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.Mutation},S)}))},$=S=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.Scroll},S)})),de=S=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.CanvasMutation},S)})),H=S=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.AdoptedStyleSheet},S)})),re=new dt({mutationCb:Y,adoptedStyleSheetCb:H}),ae=new ot({mirror:oe,mutationCb:Y,stylesheetManager:re,recordCrossOriginIframes:T,wrappedEmit:W});for(let S of C||[])S.getMirror&&S.getMirror({nodeMirror:oe,crossOriginIframeMirror:ae.crossOriginIframeMirror,crossOriginIframeStyleMirror:ae.crossOriginIframeStyleMirror});Ut=new lt({recordCanvas:I,mutationCb:de,win:window,blockClass:i,blockSelector:o,mirror:oe,sampling:y.canvas,dataURLOptions:m});let Se=new st({mutationCb:Y,scrollCb:$,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:l,inlineStylesheet:c,maskInputOptions:D,dataURLOptions:m,maskTextFn:p,maskInputFn:f,recordCanvas:I,inlineImages:w,sampling:y,slimDOMOptions:X,iframeManager:ae,stylesheetManager:re,canvasManager:Ut,keepIframeSrcFn:E},mirror:oe});ut=(S=!1)=>{var K,j,B,ee,L,J;W(U({type:M.Meta,data:{href:window.location.href,width:Qe(),height:qe()}}),S),re.reset(),he.forEach(Z=>Z.lock());let Ne=yn(document,{mirror:oe,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:l,inlineStylesheet:c,maskAllInputs:D,maskTextFn:p,slimDOM:X,dataURLOptions:m,recordCanvas:I,inlineImages:w,onSerialize:Z=>{$e(Z,oe)&&ae.addIframe(Z),et(Z,oe)&&re.trackLinkElement(Z),tt(Z)&&Se.addShadowRoot(Z.shadowRoot,document)},onIframeLoad:(Z,gt)=>{ae.attachIframe(Z,gt),Se.observeAttachShadow(Z)},onStylesheetLoad:(Z,gt)=>{re.attachLinkElement(Z,gt)},keepIframeSrcFn:E});if(!Ne)return console.warn("Failed to snapshot the document");W(U({type:M.FullSnapshot,data:{node:Ne,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((j=(K=document==null?void 0:document.body)===null||K===void 0?void 0:K.parentElement)===null||j===void 0?void 0:j.scrollLeft)||((B=document==null?void 0:document.body)===null||B===void 0?void 0:B.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((L=(ee=document==null?void 0:document.body)===null||ee===void 0?void 0:ee.parentElement)===null||L===void 0?void 0:L.scrollTop)||((J=document==null?void 0:document.body)===null||J===void 0?void 0:J.scrollTop)||0}}})),he.forEach(Z=>Z.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,oe.getId(document))};try{let S=[];S.push(z("DOMContentLoaded",()=>{W(U({type:M.DomContentLoaded,data:{}}))}));let K=B=>{var ee;return On({mutationCb:Y,mousemoveCb:(L,J)=>W(U({type:M.IncrementalSnapshot,data:{source:J,positions:L}})),mouseInteractionCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.MouseInteraction},L)})),scrollCb:$,viewportResizeCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.ViewportResize},L)})),inputCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.Input},L)})),mediaInteractionCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.MediaInteraction},L)})),styleSheetRuleCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.StyleSheetRule},L)})),styleDeclarationCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.StyleDeclaration},L)})),canvasMutationCb:de,fontCb:L=>W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.Font},L)})),selectionCb:L=>{W(U({type:M.IncrementalSnapshot,data:Object.assign({source:x.Selection},L)}))},blockClass:i,ignoreClass:s,maskTextClass:a,maskTextSelector:l,maskInputOptions:D,inlineStylesheet:c,sampling:y,recordCanvas:I,inlineImages:w,userTriggeredOnInput:k,collectFonts:N,doc:B,maskInputFn:f,maskTextFn:p,keepIframeSrcFn:E,blockSelector:o,slimDOMOptions:X,dataURLOptions:m,mirror:oe,iframeManager:ae,stylesheetManager:re,shadowDomManager:Se,canvasManager:Ut,ignoreCSSAttributes:R,plugins:((ee=C==null?void 0:C.filter(L=>L.observer))===null||ee===void 0?void 0:ee.map(L=>({observer:L.observer,options:L.options,callback:J=>W(U({type:M.Plugin,data:{plugin:L.name,payload:J}}))})))||[]},v)};ae.addLoadListener(B=>{S.push(K(B.contentDocument))});let j=()=>{ut(),S.push(K(document)),pt=!0};return document.readyState==="interactive"||document.readyState==="complete"?j():S.push(z("load",()=>{W(U({type:M.Load,data:{}})),j()},window)),()=>{S.forEach(B=>B()),pt=!1}}catch(S){console.warn(S)}}Ie.addCustomEvent=(t,e)=>{if(!pt)throw new Error("please add custom event after start recording");W(U({type:M.Custom,data:{tag:t,payload:e}}))};Ie.freezePage=()=>{he.forEach(t=>t.freeze())};Ie.takeFullSnapshot=t=>{if(!pt)throw new Error("please take full snapshot after start recording");ut(t)};Ie.mirror=oe;var ht=class{constructor(e){this.opts=e;this.seq=0;this.buffer=[];this.stopRecording=null;this.flushTimer=null}start(){var n,r,i;if(typeof document=="undefined"||this.stopRecording)return;let e={emit:o=>{this.buffer.push(o),this.buffer.length>=this.opts.maxEventsPerBatch&&this.flush()},checkoutEveryNms:(n=this.opts.checkoutEveryNms)!=null?n:6e5,inlineStylesheet:(r=this.opts.inlineStylesheet)!=null?r:!1,maskAllInputs:this.opts.maskAllInputs,maskTextClass:this.opts.maskTextClass,blockClass:this.opts.blockClass};this.stopRecording=(i=Ie(e))!=null?i:null,this.flushTimer=setInterval(()=>{this.buffer.length>0&&this.flush()},this.opts.flushIntervalMs)}flush(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);this.opts.emit({type:"session_replay",data:{seq:this.seq++,events:e}})}destroy(){var e;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush(),(e=this.stopRecording)==null||e.call(this),this.stopRecording=null}};function ui(t){var r;let e=(r=t.getAttribute("data-alphana-amount"))==null?void 0:r.trim();if(!e)return;let n=Number(e);return Number.isFinite(n)?n:void 0}function pi(t){var n;return((n=t.getAttribute("data-alphana-currency"))==null?void 0:n.trim())||void 0}function hi(t){var n;return((n=t.getAttribute("data-alphana-event-name"))==null?void 0:n.trim())||void 0}function mi(t,e){var r;if(!t||typeof t.getAttribute!="function"||typeof t.id!="string")return null;let n=t;for(;n;){let i=(r=n.id)==null?void 0:r.trim();if(i){let o=e.get(i);if(o)return{binding:o,matchedEl:n}}n=n.parentElement}return null}function fi(t,e){var o,s,a;let n=(o=ui(t))!=null?o:e.value,r=(s=pi(t))!=null?s:e.currency;if(n==null||!r)return null;let i=(a=hi(t))!=null?a:e.eventName;return{amount:n,currency:r,eventName:i}}var mt=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=!1;this.onClick=e=>{let n=mi(e.target,this.bindingsById);if(!n)return;let{binding:r,matchedEl:i}=n;if(r.eventKind==="goal"){this.handlers.onGoal(r);return}let o=fi(i,r);if(!o){typeof console!="undefined"&&console.debug("[alphana-sdk] revenue element click skipped: missing amount/currency",r.elementId);return}this.handlers.onRevenue(r,o.amount,o.currency,o.eventName)}}setBindings(e){this.bindingsById=new Map(e.filter(n=>typeof n.elementId=="string"&&n.elementId.trim()).map(n=>[n.elementId.trim(),n]))}start(){typeof document=="undefined"||this.attached||(document.addEventListener("click",this.onClick,!0),this.attached=!0)}destroy(){!this.attached||typeof document=="undefined"||(document.removeEventListener("click",this.onClick,!0),this.attached=!1)}};var jn="alphana-cookie-consent",gi="https://alphana.ir",yi="https://storage.alphana.ir/cdn/logos/Fav-Alphana.png";function Me(){var t;typeof document!="undefined"&&((t=document.getElementById(jn))==null||t.remove())}function Jn(t,e){var I;if(typeof document=="undefined")return;Me();let n=document.createElement("div");n.id=jn,n.setAttribute("data-alphana-widget","cookie-consent"),Object.assign(n.style,{all:"initial",position:"fixed",left:"0",right:"0",bottom:"0",zIndex:"2147483646",pointerEvents:"none"});let r=n.attachShadow({mode:"open"}),i=document.documentElement.getAttribute("dir")==="rtl"||/^(fa|ar|he|ur)/i.test(document.documentElement.lang)?"rtl":"ltr",o=t.theme,s=i==="rtl"?"\u0633\u06CC\u0627\u0633\u062A \u062D\u0631\u06CC\u0645 \u062E\u0635\u0648\u0635\u06CC":"Privacy policy",a=i==="rtl"?"\u0642\u062F\u0631\u062A\u200C\u06AF\u0631\u0641\u062A\u0647 \u0627\u0632 Alphana":"Powered by Alphana",l=document.createElement("style");l.textContent=`
6
6
  :host { all: initial; }
7
7
  .sheet {
8
8
  pointer-events: auto;
@@ -109,7 +109,264 @@ or you can use record.mirror to access the mirror instance during recording.`,pr
109
109
  .actions { flex-direction: column-reverse; }
110
110
  button { width: 100%; }
111
111
  }
112
- `;let l=document.createElement("div");l.className="sheet",l.setAttribute("dir",i),l.setAttribute("role","dialog"),l.setAttribute("aria-live","polite"),l.setAttribute("aria-label",t.title);let d=document.createElement("p");d.className="title",d.textContent=t.title;let u=document.createElement("p");u.className="message",u.textContent=t.message,l.append(d,u);let p=(b=t.policyUrl)==null?void 0:b.trim();if(p){let x=document.createElement("a");x.className="policy",x.href=p,x.target="_blank",x.rel="noopener noreferrer",x.textContent=s,l.append(x)}else u.style.marginBottom="14px";let m=document.createElement("div");m.className="actions";let h=document.createElement("button");h.type="button",h.className="reject",h.textContent=t.rejectLabel,h.addEventListener("click",()=>{xe(),e.onReject()});let v=document.createElement("button");v.type="button",v.className="accept",v.textContent=t.acceptLabel,v.addEventListener("click",()=>{xe(),e.onAccept()}),m.append(h,v);let I=document.createElement("div");I.className="footer";let y=document.createElement("a");y.className="brand",y.href=ii,y.target="_blank",y.rel="noopener noreferrer",y.setAttribute("aria-label",a);let f=document.createElement("img");f.src=oi,f.alt="",f.width=14,f.height=14,f.decoding="async";let g=document.createElement("span");g.textContent=a,y.append(f,g),I.append(y),l.append(m,I),n.append(c,l),document.documentElement.appendChild(r)}var Zr="__alphana_consent__";function si(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function ai(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function zr(){let t=si(Zr);if(!t)return null;try{let e=JSON.parse(t);return(e.status==="granted"||e.status==="rejected")&&typeof e.version=="number"&&typeof e.decidedAt=="number"?e:null}catch(e){return null}}function Wt(t,e){let r={status:t,version:e,decidedAt:Date.now()};ai(Zr,JSON.stringify(r))}var Ut="https://api.alphana.ir/api/events",ci={endpoint:Ut,trackNavigation:!0,trackTime:!0,trackHeatmap:!0,trackLogs:!0,mouseSampleRate:.1,maxHeatmapPoints:2e3,batchSize:20,flushInterval:5e3,compressPayloads:!0,compressionThresholdBytes:1024,sessionReplay:!0,sessionReplayCheckoutEveryNms:6e5,sessionReplayInlineStylesheet:!1,sessionReplayMaxEventsPerBatch:48,sessionReplayFlushIntervalMs:4e3,sessionReplayMaskAllInputs:!0,sessionReplayMaskTextClass:"alphana-mask",sessionReplayBlockClass:"alphana-block"},_e="__alphana_first_touch__",ht="__alphana_last_touch__",li={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},di=["gclid","fbclid","ttclid","msclkid"];function ui(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function hi(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(r){}}function be(t){let e=ui(t);if(e)try{let r=JSON.parse(e);return typeof r.landingPage=="string"&&typeof r.capturedAt=="number"?r:void 0}catch(r){return}}function Yr(t,e){hi(t,JSON.stringify(e))}function pi(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function fi(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function mi(t){var r;let e={};for(let[n,i]of Object.entries(li)){let o=(r=t.get(n))==null?void 0:r.trim();o&&(e[i]=o)}return Object.keys(e).length>0?e:void 0}function gi(t){var r;let e={};for(let n of di){let i=(r=t.get(n))==null?void 0:r.trim();i&&(e[n]=i)}return Object.keys(e).length>0?e:void 0}function yi(t){switch(t.type){case"pageview":return{type:"pageview",data:{...t.data,path:E(t.data.path)}};case"timespent":return{type:"timespent",data:{...t.data,path:E(t.data.path)}};case"heatmap":return{type:"heatmap",data:{...t.data,path:E(t.data.path)}};case"rageclik":return{type:"rageclik",data:{...t.data,path:E(t.data.path)}};case"uturn":return{type:"uturn",data:{...t.data,fromPath:E(t.data.fromPath),toPath:E(t.data.toPath)}};case"identify":return t;case"revenue":return t;case"goal":return{type:"goal",data:{...t.data,path:E(t.data.path)}};case"journey_step":return{type:"journey_step",data:{...t.data,path:E(t.data.path)}};case"client_context":return t;case"session_replay":return t;default:return t}}var We=class{constructor(e={}){this.initialized=!1;this.trackingAllowed=!1;this.trackingBlocked=!1;this.visitorPersisted=!1;this.subscribers=new Set;this.queue=[];this.flushTimer=null;this.heartbeatTimer=null;this.userProperties={};this.flags={};this.flagSubscribers=new Set;this.abVariants={};this.abTestSubscribers=new Set;this.handleVisibilityChange=()=>{var e;document.visibilityState==="hidden"&&((e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate())};this.handlePageHide=()=>{var e;(e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate()};this.handleNavigate=e=>{};var n;this.cfg={...ci,...e};try{new URL(this.cfg.endpoint)}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let r=er();this.visitorPersisted=!!r,this.session={id:(n=e.sessionId)!=null?n:Ct(),visitorId:r!=null?r:Ct(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:be(_e),lastTouch:be(ht)}}}updateAttributionForPageView(e,r){let n=fi(),i=mi(n),o=gi(n),s=be(_e),c=!!(i||o||r)?{landingPage:e,referrer:r,referrerHost:pi(r),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!s&&c&&Yr(_e,c),c&&Yr(ht,c);let l={firstTouch:be(_e),lastTouch:be(ht)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:be(_e),lastTouch:be(ht)};return this.session.attribution=e,e}init(){return typeof window=="undefined"||this.initialized?this:(this.initialized=!0,this.bootstrapRuntime(),this)}async bootstrapRuntime(){var i,o;let e=await this.fetchRuntimeConfig();if(this.applyElementBindings((i=e==null?void 0:e.elementBindings)!=null?i:[]),this.cfg.consentMode==="disabled"){this.startTracking();return}let r=(o=e==null?void 0:e.widgets)==null?void 0:o.cookieConsent;if(!(r!=null&&r.enabled)){this.startTracking();return}let n=zr();if(n&&n.version===r.version){n.status==="granted"?this.startTracking():this.blockTracking();return}Kr(r,{onAccept:()=>{Wt("granted",r.version),this.startTracking()},onReject:()=>{Wt("rejected",r.version),this.blockTracking()}})}applyElementBindings(e){this.elementBindings||(this.elementBindings=new ut({onGoal:r=>{this.trackGoal({key:r.key,name:r.name,value:r.value,currency:r.currency,metadata:{source:"element_click",elementId:r.elementId}})},onRevenue:(r,n,i,o)=>{this.trackRevenue({eventName:o!=null?o:"purchase",amount:n,currency:i,metadata:{source:"element_click",elementId:r.elementId,triggerKey:r.key}})}})),this.elementBindings.setBindings(e)}persistVisitorIfNeeded(){this.visitorPersisted||(tr(this.session.visitorId),this.visitorPersisted=!0)}startTracking(){var n;if(this.trackingAllowed||this.trackingBlocked)return;this.trackingAllowed=!0,this.persistVisitorIfNeeded();let e=this.emit.bind(this),{id:r}=this.session;e({type:"client_context",data:Qt(r)}),this.cfg.trackNavigation&&(this.navigation=new He({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new Ve({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new Ke({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new dt({emit:e,checkoutEveryNms:this.cfg.sessionReplayCheckoutEveryNms,inlineStylesheet:this.cfg.sessionReplayInlineStylesheet,maxEventsPerBatch:this.cfg.sessionReplayMaxEventsPerBatch,flushIntervalMs:this.cfg.sessionReplayFlushIntervalMs,maskAllInputs:this.cfg.sessionReplayMaskAllInputs,maskTextClass:this.cfg.sessionReplayMaskTextClass,blockClass:this.cfg.sessionReplayBlockClass}),this.sessionReplay.start()),this.cfg.endpoint&&(this.flushTimer=setInterval(()=>{this.queue.length>0&&this.flushQueue()},this.cfg.flushInterval),window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("pagehide",this.handlePageHide),this.heartbeatTimer=setInterval(()=>{document.visibilityState!=="hidden"&&this.sendHeartbeat()},3e4),this.cfg.trackLogs&&(this.logCapture=new we({endpoint:this.cfg.endpoint,collectEndpoint:this.collectUrl,sessionId:this.session.id,secretKey:this.cfg.secretKey,appId:this.cfg.appId,compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes}),this.logCapture.init())),(n=this.elementBindings)==null||n.start(),this.fetchFlags(),this.fetchAbTests()}blockTracking(){var e;this.trackingBlocked=!0,this.trackingAllowed=!1,this.queue=[],xe(),(e=this.elementBindings)==null||e.destroy()}destroy(){var e,r,n,i,o,s;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),typeof window!="undefined"&&(window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("pagehide",this.handlePageHide)),(e=this.navigation)==null||e.destroy(),(r=this.time)==null||r.destroy(),(n=this.heatmap)==null||n.destroy(),(i=this.sessionReplay)==null||i.destroy(),this.sessionReplay=void 0,(o=this.logCapture)==null||o.destroy(),(s=this.elementBindings)==null||s.destroy(),xe(),typeof window!="undefined"&&window.removeEventListener("tracker:navigate",this.handleNavigate),this.queue.length>0&&this.cfg.endpoint&&this.trackingAllowed&&this.flushBeacon(),this.initialized=!1,this.trackingAllowed=!1,this.trackingBlocked=!1}async sendHeartbeat(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(yt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!0,appId:this.cfg.appId}));try{await fe(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e,keepalive:!0})}catch(n){}}sendDeactivate(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(yt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!1,appId:this.cfg.appId}));It(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e})}emit(e){var r,n,i,o;if(!(!this.trackingAllowed||this.trackingBlocked)){if(e=yi(e),e.type==="pageview"){let s=this.updateAttributionForPageView(e.data.path,e.data.referrer);e={type:"pageview",data:{...e.data,utm:(r=s.lastTouch)==null?void 0:r.utm,attribution:s}}}switch(e.type){case"pageview":this.session.pageViews.push(e.data);break;case"timespent":{let s=(n=this.session.timeSpent[e.data.path])!=null?n:0;this.session.timeSpent[e.data.path]=s+e.data.duration;break}case"heatmap":{let s=e.data.path;this.session.heatmap[s]||(this.session.heatmap[s]=[]);let a=this.session.heatmap[s];a.length<this.cfg.maxHeatmapPoints&&a.push(e.data);break}case"rageclik":case"uturn":case"identify":case"revenue":case"goal":case"journey_step":case"client_context":case"session_replay":break}this.subscribers.forEach(s=>s(e)),(o=(i=this.cfg).onEvent)==null||o.call(i,e),this.cfg.endpoint&&(this.queue.push(e),this.queue.length>=this.cfg.batchSize&&this.flushQueue())}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}trackPageView(e){let r=E(e!=null?e:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"pageview",data:{path:r,title:typeof document!="undefined"?document.title:"",timestamp:Date.now(),sessionId:this.session.id,referrer:typeof document!="undefined"&&document.referrer||void 0}}),typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:r,title:document.title}}))}trackRevenue(e){var r,n;this.emit({type:"revenue",data:{...e,eventName:(r=e.eventName)!=null?r:"purchase",status:(n=e.status)!=null?n:"paid",sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now(),attribution:this.currentAttribution()}})}trackGoal(e){let r=E(typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"goal",data:{...e,sessionId:this.session.id,visitorId:this.session.visitorId,path:r,timestamp:Date.now()}})}trackJourneyStep(e){var n;let r=E((n=e.path)!=null?n:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"journey_step",data:{...e,path:r,sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now()}})}identify(e){this.userProperties={...this.userProperties,...e},this.session.userProperties={...this.userProperties},this.emit({type:"identify",data:{properties:{...this.userProperties},visitorId:this.session.visitorId,timestamp:Date.now()}}),this.fetchFlags()}getFlags(){return{...this.flags}}isFeatureEnabled(e){return this.flags[e]===!0}onFlagsChange(e){return this.flagSubscribers.add(e),()=>this.flagSubscribers.delete(e)}async fetchFlags(){if(!this.cfg.endpoint||!this.cfg.secretKey||!this.trackingAllowed)return;let e=Ne(this.cfg.endpoint)+"/feature-flags/evaluate";try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({userProperties:this.userProperties})});if(!r.ok)return;let n=await r.json();this.flags=n,this.flagSubscribers.forEach(i=>i({...this.flags}))}catch(r){}}getAbVariants(){return{...this.abVariants}}getAbVariant(e){let r=this.abVariants[e];return r!=null?r:null}isAbVariant(e,r){return this.abVariants[e]===r}onAbTestsChange(e){return this.abTestSubscribers.add(e),()=>this.abTestSubscribers.delete(e)}async fetchAbTests(e){if(!this.cfg.endpoint||!this.cfg.secretKey||!this.trackingAllowed)return;let r=Ne(this.cfg.endpoint)+"/ab-tests/evaluate";try{let n={visitorId:this.session.visitorId};e!=null&&e.length&&(n.keys=e);let i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify(n)});if(!i.ok)return;let o=await i.json();this.abVariants=e!=null&&e.length?{...this.abVariants,...o}:{...o},this.abTestSubscribers.forEach(s=>s({...this.abVariants}))}catch(n){}}getSession(){return this.session}getPageViews(){return[...this.session.pageViews]}getTimeSpent(){return{...this.session.timeSpent}}getHeatmapData(e){var r;return e!==void 0?[...(r=this.session.heatmap[e])!=null?r:[]]:Object.entries(this.session.heatmap).reduce((n,[i,o])=>(n[i]=[...o],n),{})}get collectUrl(){var e;return(e=this.cfg.collectEndpoint)!=null?e:Ue(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=Ne(this.cfg.endpoint)+"/sdk/runtime-config";try{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({...this.cfg.appId?{appId:this.cfg.appId}:{}})});return r.ok?await r.json():null}catch(r){return null}}currentPath(){return E(typeof window!="undefined"?window.location.pathname+window.location.search:"/")}flush(){this.flushQueue()}async flushQueue(){if(this.queue.length===0)return;let e=this.queue.splice(0);await this.sendBatch(e)}flushBeacon(){if(this.queue.length===0)return;let e=this.queue.splice(0),r=JSON.stringify(gt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};It(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:n})}async sendBatch(e){let r=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},n=JSON.stringify(gt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await fe(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r})}};var k;function Gt(){typeof window=="undefined"||!window.AlphanaSDK||(k?window.AlphanaSDK.tracker=k:delete window.AlphanaSDK.tracker)}function z(t,e){var n;let r=(n=t.dataset[e])==null?void 0:n.trim();return r||void 0}function te(t,e){let r=z(t,e);if(r!==void 0){if(["1","true","yes","on"].includes(r.toLowerCase()))return!0;if(["0","false","no","off"].includes(r.toLowerCase()))return!1}}function Z(t,e){let r=z(t,e);if(r===void 0)return;let n=Number(r);return Number.isFinite(n)?n:void 0}function vi(){if(typeof document=="undefined")return{};let t=document.currentScript;return t instanceof HTMLScriptElement?{...z(t,"endpoint")?{endpoint:z(t,"endpoint")}:{},...z(t,"appId")?{appId:z(t,"appId")}:{},...z(t,"secretKey")?{secretKey:z(t,"secretKey")}:{},...z(t,"sessionId")?{sessionId:z(t,"sessionId")}:{},...te(t,"trackNavigation")!==void 0?{trackNavigation:te(t,"trackNavigation")}:{},...te(t,"trackTime")!==void 0?{trackTime:te(t,"trackTime")}:{},...te(t,"trackHeatmap")!==void 0?{trackHeatmap:te(t,"trackHeatmap")}:{},...te(t,"trackLogs")!==void 0?{trackLogs:te(t,"trackLogs")}:{},...te(t,"sessionReplay")!==void 0?{sessionReplay:te(t,"sessionReplay")}:{},...Z(t,"sessionReplayCheckoutEveryNms")!==void 0?{sessionReplayCheckoutEveryNms:Z(t,"sessionReplayCheckoutEveryNms")}:{},...Z(t,"sessionReplayMaxEventsPerBatch")!==void 0?{sessionReplayMaxEventsPerBatch:Z(t,"sessionReplayMaxEventsPerBatch")}:{},...Z(t,"sessionReplayFlushIntervalMs")!==void 0?{sessionReplayFlushIntervalMs:Z(t,"sessionReplayFlushIntervalMs")}:{},...te(t,"sessionReplayMaskAllInputs")!==void 0?{sessionReplayMaskAllInputs:te(t,"sessionReplayMaskAllInputs")}:{},...z(t,"sessionReplayMaskTextClass")?{sessionReplayMaskTextClass:z(t,"sessionReplayMaskTextClass")}:{},...z(t,"sessionReplayBlockClass")?{sessionReplayBlockClass:z(t,"sessionReplayBlockClass")}:{},...Z(t,"mouseSampleRate")!==void 0?{mouseSampleRate:Z(t,"mouseSampleRate")}:{},...Z(t,"maxHeatmapPoints")!==void 0?{maxHeatmapPoints:Z(t,"maxHeatmapPoints")}:{},...Z(t,"batchSize")!==void 0?{batchSize:Z(t,"batchSize")}:{},...Z(t,"flushInterval")!==void 0?{flushInterval:Z(t,"flushInterval")}:{}}:{}}function Ii(t){return Object.keys(t).length>0}function Ht(t={}){return k||(k=new We(t).init(),Gt(),k)}function Ci(){return k}function Vt(t,...e){var r,n;switch(t){case"init":return Ht((r=e[0])!=null?r:{});case"identify":k==null||k.identify((n=e[0])!=null?n:{});return;case"trackPageView":k==null||k.trackPageView(e[0]);return;case"trackRevenue":k==null||k.trackRevenue(e[0]);return;case"trackGoal":k==null||k.trackGoal(e[0]);return;case"trackJourneyStep":k==null||k.trackJourneyStep(e[0]);return;case"flush":k==null||k.flush();return;case"destroy":k==null||k.destroy(),k=void 0,Gt();return;default:return t}}function bi(){var n;if(typeof window=="undefined")return[];let t=window.alphana,e=(n=t==null?void 0:t.q)!=null?n:[],r=((i,...o)=>Vt(i,...o));return r.q=[],window.alphana=r,e}function Si(){var n;if(typeof window=="undefined")return;let t=bi(),e=t.some(([i])=>i==="init"),r={...vi(),...(n=window.AlphanaSDKConfig)!=null?n:{}};!e&&Ii(r)&&Ht(r);for(let[i,...o]of t)Vt(i,...o);setTimeout(Gt,0)}Si();return $r(wi);})();
112
+ `;let c=document.createElement("div");c.className="sheet",c.setAttribute("dir",i),c.setAttribute("role","dialog"),c.setAttribute("aria-live","polite"),c.setAttribute("aria-label",t.title);let d=document.createElement("p");d.className="title",d.textContent=t.title;let u=document.createElement("p");u.className="message",u.textContent=t.message,c.append(d,u);let h=(I=t.policyUrl)==null?void 0:I.trim();if(h){let T=document.createElement("a");T.className="policy",T.href=h,T.target="_blank",T.rel="noopener noreferrer",T.textContent=s,c.append(T)}else u.style.marginBottom="14px";let f=document.createElement("div");f.className="actions";let p=document.createElement("button");p.type="button",p.className="reject",p.textContent=t.rejectLabel,p.addEventListener("click",()=>{Me(),e.onReject()});let v=document.createElement("button");v.type="button",v.className="accept",v.textContent=t.acceptLabel,v.addEventListener("click",()=>{Me(),e.onAccept()}),f.append(p,v);let b=document.createElement("div");b.className="footer";let y=document.createElement("a");y.className="brand",y.href=gi,y.target="_blank",y.rel="noopener noreferrer",y.setAttribute("aria-label",a);let m=document.createElement("img");m.src=yi,m.alt="",m.width=14,m.height=14,m.decoding="async";let g=document.createElement("span");g.textContent=a,y.append(m,g),b.append(y),c.append(f,b),r.append(l,c),document.documentElement.appendChild(n)}var qn="__alphana_consent__";function vi(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function bi(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(n){}}function Qn(){let t=vi(qn);if(!t)return null;try{let e=JSON.parse(t);return(e.status==="granted"||e.status==="rejected")&&typeof e.version=="number"&&typeof e.decidedAt=="number"?e:null}catch(e){return null}}function Vt(t,e){let n={status:t,version:e,decidedAt:Date.now()};bi(qn,JSON.stringify(n))}var $n="alphana-feedback-widget",Ii="https://alphana.ir",Ci="https://storage.alphana.ir/cdn/logos/Fav-Alphana.png";function _e(){var t;typeof document!="undefined"&&((t=document.getElementById($n))==null||t.remove())}function er(t,e){var m;if(typeof document=="undefined")return;_e();let n=document.createElement("div");n.id=$n,n.setAttribute("data-alphana-widget","feedback"),Object.assign(n.style,{all:"initial",position:"fixed",right:"16px",bottom:"16px",zIndex:"2147483645",pointerEvents:"none"});let r=n.attachShadow({mode:"open"}),i=document.documentElement.getAttribute("dir")==="rtl"||/^(fa|ar|he|ur)/i.test(document.documentElement.lang)?"rtl":"ltr",o=t.theme,s=i==="rtl"?"\u0642\u062F\u0631\u062A\u200C\u06AF\u0631\u0641\u062A\u0647 \u0627\u0632 Alphana":"Powered by Alphana",a=i==="rtl"?"\u0628\u0633\u062A\u0646":"Close",l=document.createElement("style");l.textContent=`
113
+ :host { all: initial; }
114
+ .sheet {
115
+ pointer-events: auto;
116
+ width: min(360px, calc(100vw - 32px));
117
+ padding: 16px 18px 12px;
118
+ border-radius: ${o.borderRadius};
119
+ background: ${o.background};
120
+ color: ${o.text};
121
+ box-shadow: 0 12px 40px rgba(0,0,0,.28);
122
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
123
+ position: relative;
124
+ }
125
+ .close {
126
+ position: absolute;
127
+ top: 8px;
128
+ inset-inline-end: 8px;
129
+ appearance: none;
130
+ border: 0;
131
+ background: transparent;
132
+ color: ${o.text};
133
+ opacity: .7;
134
+ cursor: pointer;
135
+ font-size: 18px;
136
+ line-height: 1;
137
+ padding: 4px 8px;
138
+ }
139
+ .close:hover { opacity: 1; }
140
+ .title {
141
+ font-size: 15px;
142
+ font-weight: 650;
143
+ margin: 0 28px 8px 0;
144
+ line-height: 1.35;
145
+ }
146
+ .message {
147
+ font-size: 13px;
148
+ line-height: 1.55;
149
+ margin: 0 0 12px;
150
+ opacity: .92;
151
+ }
152
+ .stars {
153
+ display: flex;
154
+ gap: 6px;
155
+ margin: 0 0 12px;
156
+ }
157
+ .star {
158
+ appearance: none;
159
+ border: 1px solid color-mix(in srgb, ${o.text} 30%, transparent);
160
+ background: transparent;
161
+ color: ${o.text};
162
+ border-radius: 10px;
163
+ width: 40px;
164
+ height: 40px;
165
+ cursor: pointer;
166
+ font-size: 14px;
167
+ font-weight: 700;
168
+ font-family: inherit;
169
+ }
170
+ .star[aria-pressed="true"] {
171
+ background: ${o.primary};
172
+ color: ${o.primaryText};
173
+ border-color: ${o.primary};
174
+ }
175
+ textarea {
176
+ width: 100%;
177
+ box-sizing: border-box;
178
+ min-height: 72px;
179
+ resize: vertical;
180
+ border-radius: 10px;
181
+ border: 1px solid color-mix(in srgb, ${o.text} 25%, transparent);
182
+ background: transparent;
183
+ color: ${o.text};
184
+ padding: 10px 12px;
185
+ font: inherit;
186
+ font-size: 13px;
187
+ margin: 0 0 12px;
188
+ }
189
+ .actions {
190
+ display: flex;
191
+ justify-content: flex-end;
192
+ }
193
+ .submit {
194
+ appearance: none;
195
+ border: 0;
196
+ cursor: pointer;
197
+ border-radius: 10px;
198
+ padding: 9px 14px;
199
+ font-size: 13px;
200
+ font-weight: 600;
201
+ background: ${o.primary};
202
+ color: ${o.primaryText};
203
+ font-family: inherit;
204
+ }
205
+ .submit:disabled {
206
+ opacity: .5;
207
+ cursor: not-allowed;
208
+ }
209
+ .thanks {
210
+ font-size: 14px;
211
+ font-weight: 600;
212
+ margin: 8px 0 4px;
213
+ text-align: center;
214
+ }
215
+ .footer {
216
+ display: flex;
217
+ align-items: center;
218
+ justify-content: center;
219
+ margin-top: 14px;
220
+ padding-top: 12px;
221
+ border-top: 1px solid color-mix(in srgb, ${o.text} 18%, transparent);
222
+ }
223
+ a.brand {
224
+ display: inline-flex;
225
+ align-items: center;
226
+ gap: 6px;
227
+ color: ${o.text};
228
+ opacity: .72;
229
+ font-size: 11px;
230
+ font-weight: 500;
231
+ text-decoration: none;
232
+ }
233
+ a.brand:hover { opacity: 1; }
234
+ a.brand img {
235
+ width: 14px;
236
+ height: 14px;
237
+ object-fit: contain;
238
+ }
239
+ `;let c=document.createElement("div");c.className="sheet",c.setAttribute("dir",i),c.setAttribute("role","dialog"),c.setAttribute("aria-label",t.title);let d=document.createElement("button");d.type="button",d.className="close",d.setAttribute("aria-label",a),d.textContent="\xD7",d.addEventListener("click",()=>{_e(),e.onDismiss()});let u=document.createElement("p");if(u.className="title",u.textContent=t.title,c.append(d,u),t.message){let g=document.createElement("p");g.className="message",g.textContent=t.message,c.append(g)}let h=0,f=document.createElement("div");f.className="stars",f.setAttribute("role","radiogroup"),f.setAttribute("aria-label",t.title);let p=[];for(let g=1;g<=5;g+=1){let I=document.createElement("button");I.type="button",I.className="star",I.textContent=String(g),I.setAttribute("aria-label",String(g)),I.setAttribute("aria-pressed","false"),I.addEventListener("click",()=>{h=g;for(let T of p)T.setAttribute("aria-pressed",T===I?"true":"false");y.disabled=!1}),p.push(I),f.append(I)}let v=document.createElement("textarea");v.placeholder=(m=t.commentPlaceholder)!=null?m:"",v.maxLength=2e3;let b=document.createElement("div");b.className="actions";let y=document.createElement("button");y.type="button",y.className="submit",y.textContent=t.submitLabel,y.disabled=!0,y.addEventListener("click",()=>{if(h<1)return;y.disabled=!0;let g={rating:h},I=v.value.trim();I&&(g.comment=I),Promise.resolve(e.onSubmit(g)).finally(()=>{c.replaceChildren();let T=document.createElement("p");T.className="thanks",T.textContent=t.thankYouMessage,c.append(T,Xn(s,o)),window.setTimeout(()=>_e(),1800)})}),b.append(y),c.append(f,v,b,Xn(s,o)),r.append(l,c),document.documentElement.appendChild(n)}function Xn(t,e){let n=document.createElement("div");n.className="footer";let r=document.createElement("a");r.className="brand",r.href=Ii,r.target="_blank",r.rel="noopener noreferrer",r.setAttribute("aria-label",t);let i=document.createElement("img");i.src=Ci,i.alt="",i.width=14,i.height=14;let o=document.createElement("span");return o.textContent=t,r.append(i,o),n.append(r),n}var rr="alphana-survey-widget",tr="https://alphana.ir",nr="https://storage.alphana.ir/cdn/logos/Fav-Alphana.png";function We(){var t;typeof document!="undefined"&&((t=document.getElementById(rr))==null||t.remove())}function ir(t,e){var I,T;if(typeof document=="undefined")return;We();let n=document.createElement("div");n.id=rr,n.setAttribute("data-alphana-widget","survey"),Object.assign(n.style,{all:"initial",position:"fixed",left:"16px",bottom:"16px",zIndex:"2147483645",pointerEvents:"none"});let r=n.attachShadow({mode:"open"}),i=document.documentElement.getAttribute("dir")==="rtl"||/^(fa|ar|he|ur)/i.test(document.documentElement.lang)?"rtl":"ltr",o=t.theme,s=i==="rtl"?"\u0642\u062F\u0631\u062A\u200C\u06AF\u0631\u0641\u062A\u0647 \u0627\u0632 Alphana":"Powered by Alphana",a=i==="rtl"?"\u0628\u0633\u062A\u0646":"Close",l=document.createElement("style");l.textContent=`
240
+ :host { all: initial; }
241
+ .sheet {
242
+ pointer-events: auto;
243
+ width: min(420px, calc(100vw - 32px));
244
+ max-height: min(80vh, 640px);
245
+ overflow: auto;
246
+ padding: 16px 18px 12px;
247
+ border-radius: ${o.borderRadius};
248
+ background: ${o.background};
249
+ color: ${o.text};
250
+ box-shadow: 0 12px 40px rgba(0,0,0,.28);
251
+ font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
252
+ position: relative;
253
+ }
254
+ .close {
255
+ position: absolute;
256
+ top: 8px;
257
+ inset-inline-end: 8px;
258
+ appearance: none;
259
+ border: 0;
260
+ background: transparent;
261
+ color: ${o.text};
262
+ opacity: .7;
263
+ cursor: pointer;
264
+ font-size: 18px;
265
+ line-height: 1;
266
+ padding: 4px 8px;
267
+ }
268
+ .title {
269
+ font-size: 15px;
270
+ font-weight: 650;
271
+ margin: 0 28px 8px 0;
272
+ }
273
+ .description {
274
+ font-size: 13px;
275
+ line-height: 1.55;
276
+ margin: 0 0 14px;
277
+ opacity: .92;
278
+ }
279
+ .question {
280
+ margin: 0 0 14px;
281
+ }
282
+ .qlabel {
283
+ display: block;
284
+ font-size: 13px;
285
+ font-weight: 600;
286
+ margin: 0 0 8px;
287
+ }
288
+ .req { opacity: .7; font-weight: 500; }
289
+ .stars, .options {
290
+ display: flex;
291
+ flex-wrap: wrap;
292
+ gap: 6px;
293
+ }
294
+ .star, .option {
295
+ appearance: none;
296
+ border: 1px solid color-mix(in srgb, ${o.text} 30%, transparent);
297
+ background: transparent;
298
+ color: ${o.text};
299
+ border-radius: 10px;
300
+ min-height: 36px;
301
+ padding: 6px 10px;
302
+ cursor: pointer;
303
+ font-size: 13px;
304
+ font-weight: 600;
305
+ font-family: inherit;
306
+ }
307
+ .star[aria-pressed="true"], .option[aria-pressed="true"] {
308
+ background: ${o.primary};
309
+ color: ${o.primaryText};
310
+ border-color: ${o.primary};
311
+ }
312
+ textarea, input[type="text"] {
313
+ width: 100%;
314
+ box-sizing: border-box;
315
+ border-radius: 10px;
316
+ border: 1px solid color-mix(in srgb, ${o.text} 25%, transparent);
317
+ background: transparent;
318
+ color: ${o.text};
319
+ padding: 10px 12px;
320
+ font: inherit;
321
+ font-size: 13px;
322
+ }
323
+ textarea { min-height: 64px; resize: vertical; }
324
+ .actions { display: flex; justify-content: flex-end; margin-top: 8px; }
325
+ .submit {
326
+ appearance: none;
327
+ border: 0;
328
+ cursor: pointer;
329
+ border-radius: 10px;
330
+ padding: 9px 14px;
331
+ font-size: 13px;
332
+ font-weight: 600;
333
+ background: ${o.primary};
334
+ color: ${o.primaryText};
335
+ font-family: inherit;
336
+ }
337
+ .submit:disabled { opacity: .5; cursor: not-allowed; }
338
+ .error {
339
+ color: #fca5a5;
340
+ font-size: 12px;
341
+ margin: 0 0 10px;
342
+ }
343
+ .thanks {
344
+ font-size: 14px;
345
+ font-weight: 600;
346
+ margin: 8px 0 4px;
347
+ text-align: center;
348
+ }
349
+ .footer {
350
+ display: flex;
351
+ align-items: center;
352
+ justify-content: center;
353
+ margin-top: 14px;
354
+ padding-top: 12px;
355
+ border-top: 1px solid color-mix(in srgb, ${o.text} 18%, transparent);
356
+ }
357
+ a.brand {
358
+ display: inline-flex;
359
+ align-items: center;
360
+ gap: 6px;
361
+ color: ${o.text};
362
+ opacity: .72;
363
+ font-size: 11px;
364
+ font-weight: 500;
365
+ text-decoration: none;
366
+ }
367
+ a.brand:hover { opacity: 1; }
368
+ a.brand img { width: 14px; height: 14px; object-fit: contain; }
369
+ `;let c=document.createElement("div");c.className="sheet",c.setAttribute("dir",i),c.setAttribute("role","dialog"),c.setAttribute("aria-label",t.title);let d=document.createElement("button");d.type="button",d.className="close",d.setAttribute("aria-label",a),d.textContent="\xD7",d.addEventListener("click",()=>{We(),e.onDismiss()});let u=document.createElement("p");if(u.className="title",u.textContent=t.title,c.append(d,u),t.description){let k=document.createElement("p");k.className="description",k.textContent=t.description,c.append(k)}let h=new Map,f=document.createElement("p");f.className="error",f.hidden=!0;for(let k of t.questions){let N=document.createElement("div");N.className="question";let w=document.createElement("label");if(w.className="qlabel",w.textContent=k.label,k.required){let C=document.createElement("span");C.className="req",C.textContent=" *",w.append(C)}switch(N.append(w),k.type){case"text":{let C=document.createElement("textarea");C.maxLength=2e3,N.append(C),h.set(k.id,()=>C.value.trim()||void 0);break}case"rating":{let C=0,E=document.createElement("div");E.className="stars";for(let R=1;R<=5;R+=1){let A=document.createElement("button");A.type="button",A.className="star",A.textContent=String(R),A.setAttribute("aria-pressed","false"),A.addEventListener("click",()=>{C=R,Array.from(E.children).forEach((G,D)=>{G.setAttribute("aria-pressed",D+1===R?"true":"false")})}),E.append(A)}N.append(E),h.set(k.id,()=>C>0?C:void 0);break}case"single_choice":{let C="",E=document.createElement("div");E.className="options";for(let R of(I=k.options)!=null?I:[]){let A=document.createElement("button");A.type="button",A.className="option",A.textContent=R,A.setAttribute("aria-pressed","false"),A.addEventListener("click",()=>{C=R,Array.from(E.children).forEach(G=>{G.setAttribute("aria-pressed",G.textContent===R?"true":"false")})}),E.append(A)}N.append(E),h.set(k.id,()=>C||void 0);break}case"multi_choice":{let C=new Set,E=document.createElement("div");E.className="options";for(let R of(T=k.options)!=null?T:[]){let A=document.createElement("button");A.type="button",A.className="option",A.textContent=R,A.setAttribute("aria-pressed","false"),A.addEventListener("click",()=>{C.has(R)?C.delete(R):C.add(R),A.setAttribute("aria-pressed",C.has(R)?"true":"false")}),E.append(A)}N.append(E),h.set(k.id,()=>C.size>0?Array.from(C):void 0);break}default:{let C=k.type}}c.append(N)}let p=document.createElement("div");p.className="actions";let v=document.createElement("button");v.type="button",v.className="submit",v.textContent=t.submitLabel,v.addEventListener("click",()=>{var N;f.hidden=!0;let k=[];for(let w of t.questions){let C=(N=h.get(w.id))==null?void 0:N();if(C===void 0){if(w.required){f.textContent=i==="rtl"?"\u0644\u0637\u0641\u0627\u064B \u0647\u0645\u0647 \u0633\u0648\u0627\u0644\u0627\u062A \u0627\u0644\u0632\u0627\u0645\u06CC \u0631\u0627 \u067E\u0627\u0633\u062E \u062F\u0647\u06CC\u062F.":"Please answer all required questions.",f.hidden=!1;return}continue}k.push({questionId:w.id,value:C})}v.disabled=!0,Promise.resolve(e.onSubmit({answers:k})).finally(()=>{c.replaceChildren();let w=document.createElement("p");w.className="thanks",w.textContent=t.thankYouMessage;let C=document.createElement("div");C.className="footer";let E=document.createElement("a");E.className="brand",E.href=tr,E.target="_blank",E.rel="noopener noreferrer";let R=document.createElement("img");R.src=nr,R.alt="",R.width=14,R.height=14;let A=document.createElement("span");A.textContent=s,E.append(R,A),C.append(E),c.append(w,C),window.setTimeout(()=>We(),1800)})}),p.append(v);let b=document.createElement("div");b.className="footer";let y=document.createElement("a");y.className="brand",y.href=tr,y.target="_blank",y.rel="noopener noreferrer";let m=document.createElement("img");m.src=nr,m.alt="",m.width=14,m.height=14;let g=document.createElement("span");g.textContent=s,y.append(m,g),b.append(y),c.append(f,p,b),r.append(l,c),document.documentElement.appendChild(n)}function or(t,e){return`__alphana_${t}_${e!=null?e:"default"}__`}function Si(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function wi(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(n){}}function Gt(t,e,n){let r=Si(or(t,n));if(!r)return!1;try{return JSON.parse(r).version===e}catch(i){return!1}}function He(t,e,n){wi(or(t,n),JSON.stringify({version:e,completedAt:Date.now()}))}var zt="https://api.alphana.ir/api/events",ki={endpoint:zt,trackNavigation:!0,trackTime:!0,trackHeatmap:!0,trackLogs:!0,mouseSampleRate:.1,maxHeatmapPoints:2e3,batchSize:20,flushInterval:5e3,compressPayloads:!0,compressionThresholdBytes:1024,sessionReplay:!0,sessionReplayCheckoutEveryNms:6e5,sessionReplayInlineStylesheet:!1,sessionReplayMaxEventsPerBatch:48,sessionReplayFlushIntervalMs:4e3,sessionReplayMaskAllInputs:!0,sessionReplayMaskTextClass:"alphana-mask",sessionReplayBlockClass:"alphana-block"},Ue="__alphana_first_touch__",ft="__alphana_last_touch__",Ai={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},xi=["gclid","fbclid","ttclid","msclkid"];function Ei(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Ti(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e)}catch(n){}}function Ce(t){let e=Ei(t);if(e)try{let n=JSON.parse(e);return typeof n.landingPage=="string"&&typeof n.capturedAt=="number"?n:void 0}catch(n){return}}function sr(t,e){Ti(t,JSON.stringify(e))}function Ri(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function Mi(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function Ni(t){var n;let e={};for(let[r,i]of Object.entries(Ai)){let o=(n=t.get(r))==null?void 0:n.trim();o&&(e[i]=o)}return Object.keys(e).length>0?e:void 0}function Li(t){var n;let e={};for(let r of xi){let i=(n=t.get(r))==null?void 0:n.trim();i&&(e[r]=i)}return Object.keys(e).length>0?e:void 0}function Oi(t){switch(t.type){case"pageview":return{type:"pageview",data:{...t.data,path:P(t.data.path)}};case"timespent":return{type:"timespent",data:{...t.data,path:P(t.data.path)}};case"heatmap":return{type:"heatmap",data:{...t.data,path:P(t.data.path)}};case"rageclik":return{type:"rageclik",data:{...t.data,path:P(t.data.path)}};case"uturn":return{type:"uturn",data:{...t.data,fromPath:P(t.data.fromPath),toPath:P(t.data.toPath)}};case"identify":return t;case"revenue":return t;case"goal":return{type:"goal",data:{...t.data,path:P(t.data.path)}};case"journey_step":return{type:"journey_step",data:{...t.data,path:P(t.data.path)}};case"client_context":return t;case"session_replay":return t;default:return t}}var Ve=class{constructor(e={}){this.initialized=!1;this.trackingAllowed=!1;this.trackingBlocked=!1;this.visitorPersisted=!1;this.subscribers=new Set;this.queue=[];this.flushTimer=null;this.heartbeatTimer=null;this.userProperties={};this.flags={};this.flagSubscribers=new Set;this.abVariants={};this.abTestSubscribers=new Set;this.handleVisibilityChange=()=>{var e;document.visibilityState==="hidden"&&((e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate())};this.handlePageHide=()=>{var e;(e=this.sessionReplay)==null||e.flush(),this.queue.length>0&&this.flushBeacon(),this.sendDeactivate()};this.handleNavigate=e=>{};var r;this.cfg={...ki,...e};try{new URL(this.cfg.endpoint)}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let n=on();this.visitorPersisted=!!n,this.session={id:(r=e.sessionId)!=null?r:wt(),visitorId:n!=null?n:wt(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:Ce(Ue),lastTouch:Ce(ft)}}}updateAttributionForPageView(e,n){let r=Mi(),i=Ni(r),o=Li(r),s=Ce(Ue),l=!!(i||o||n)?{landingPage:e,referrer:n,referrerHost:Ri(n),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!s&&l&&sr(Ue,l),l&&sr(ft,l);let c={firstTouch:Ce(Ue),lastTouch:Ce(ft)};return this.session.attribution=c,c}currentAttribution(){let e={firstTouch:Ce(Ue),lastTouch:Ce(ft)};return this.session.attribution=e,e}init(){return typeof window=="undefined"||this.initialized?this:(this.initialized=!0,this.bootstrapRuntime(),this)}async bootstrapRuntime(){var i,o;let e=await this.fetchRuntimeConfig();if(this.applyElementBindings((i=e==null?void 0:e.elementBindings)!=null?i:[]),this.cfg.consentMode==="disabled"){this.startTracking(),this.scheduleEngagementWidgets(e);return}let n=(o=e==null?void 0:e.widgets)==null?void 0:o.cookieConsent;if(!(n!=null&&n.enabled)){this.startTracking(),this.scheduleEngagementWidgets(e);return}let r=Qn();if(r&&r.version===n.version){r.status==="granted"?this.startTracking():this.blockTracking(),this.scheduleEngagementWidgets(e);return}Jn(n,{onAccept:()=>{Vt("granted",n.version),this.startTracking(),this.scheduleEngagementWidgets(e)},onReject:()=>{Vt("rejected",n.version),this.blockTracking(),this.scheduleEngagementWidgets(e)}})}scheduleEngagementWidgets(e){var i,o,s,a;let n=(i=e==null?void 0:e.widgets)==null?void 0:i.feedback;if(n!=null&&n.enabled){let l=Math.max(0,Math.floor((o=n.delaySeconds)!=null?o:0))*1e3;window.setTimeout(()=>{Gt("feedback",n.version,this.cfg.appId)||er(n,{onSubmit:async c=>{He("feedback",n.version,this.cfg.appId),await this.submitWidgetResponse({widgetType:"feedback",widgetVersion:n.version,payload:c})},onDismiss:()=>{He("feedback",n.version,this.cfg.appId)}})},l)}let r=(s=e==null?void 0:e.widgets)==null?void 0:s.survey;if(r!=null&&r.enabled){let l=Math.max(0,Math.floor((a=r.delaySeconds)!=null?a:0))*1e3;window.setTimeout(()=>{Gt("survey",r.version,this.cfg.appId)||ir(r,{onSubmit:async c=>{He("survey",r.version,this.cfg.appId),await this.submitWidgetResponse({widgetType:"survey",widgetVersion:r.version,payload:c})},onDismiss:()=>{He("survey",r.version,this.cfg.appId)}})},l)}}async submitWidgetResponse(e){if(!this.cfg.endpoint||!this.cfg.secretKey)return;let n=we(this.cfg.endpoint)+"/sdk/widget-responses";try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({...e,sessionId:this.session.id,pageUrl:typeof window!="undefined"?window.location.href:void 0})})}catch(r){}}applyElementBindings(e){this.elementBindings||(this.elementBindings=new mt({onGoal:n=>{this.trackGoal({key:n.key,name:n.name,value:n.value,currency:n.currency,metadata:{source:"element_click",elementId:n.elementId}})},onRevenue:(n,r,i,o)=>{this.trackRevenue({eventName:o!=null?o:"purchase",amount:r,currency:i,metadata:{source:"element_click",elementId:n.elementId,triggerKey:n.key}})}})),this.elementBindings.setBindings(e)}persistVisitorIfNeeded(){this.visitorPersisted||(sn(this.session.visitorId),this.visitorPersisted=!0)}startTracking(){var r;if(this.trackingAllowed||this.trackingBlocked)return;this.trackingAllowed=!0,this.persistVisitorIfNeeded();let e=this.emit.bind(this),{id:n}=this.session;e({type:"client_context",data:en(n)}),this.cfg.trackNavigation&&(this.navigation=new Ke({emit:e,sessionId:n}),this.navigation.init()),this.cfg.trackTime&&(this.time=new Ze({emit:e,sessionId:n}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new Ye({emit:e,sessionId:n,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new ht({emit:e,checkoutEveryNms:this.cfg.sessionReplayCheckoutEveryNms,inlineStylesheet:this.cfg.sessionReplayInlineStylesheet,maxEventsPerBatch:this.cfg.sessionReplayMaxEventsPerBatch,flushIntervalMs:this.cfg.sessionReplayFlushIntervalMs,maskAllInputs:this.cfg.sessionReplayMaskAllInputs,maskTextClass:this.cfg.sessionReplayMaskTextClass,blockClass:this.cfg.sessionReplayBlockClass}),this.sessionReplay.start()),this.cfg.endpoint&&(this.flushTimer=setInterval(()=>{this.queue.length>0&&this.flushQueue()},this.cfg.flushInterval),window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("pagehide",this.handlePageHide),this.heartbeatTimer=setInterval(()=>{document.visibilityState!=="hidden"&&this.sendHeartbeat()},3e4),this.cfg.trackLogs&&(this.logCapture=new ke({endpoint:this.cfg.endpoint,collectEndpoint:this.collectUrl,sessionId:this.session.id,secretKey:this.cfg.secretKey,appId:this.cfg.appId,compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes}),this.logCapture.init())),(r=this.elementBindings)==null||r.start(),this.fetchFlags(),this.fetchAbTests()}blockTracking(){var e;this.trackingBlocked=!0,this.trackingAllowed=!1,this.queue=[],Me(),(e=this.elementBindings)==null||e.destroy()}destroy(){var e,n,r,i,o,s;this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),typeof window!="undefined"&&(window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("pagehide",this.handlePageHide)),(e=this.navigation)==null||e.destroy(),(n=this.time)==null||n.destroy(),(r=this.heatmap)==null||r.destroy(),(i=this.sessionReplay)==null||i.destroy(),this.sessionReplay=void 0,(o=this.logCapture)==null||o.destroy(),(s=this.elementBindings)==null||s.destroy(),Me(),_e(),We(),typeof window!="undefined"&&window.removeEventListener("tracker:navigate",this.handleNavigate),this.queue.length>0&&this.cfg.endpoint&&this.trackingAllowed&&this.flushBeacon(),this.initialized=!1,this.trackingAllowed=!1,this.trackingBlocked=!1}async sendHeartbeat(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},n=JSON.stringify(It({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!0,appId:this.cfg.appId}));try{await me(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e,keepalive:!0})}catch(r){}}sendDeactivate(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},n=JSON.stringify(It({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:!1,appId:this.cfg.appId}));St(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:e})}emit(e){var n,r,i,o;if(!(!this.trackingAllowed||this.trackingBlocked)){if(e=Oi(e),e.type==="pageview"){let s=this.updateAttributionForPageView(e.data.path,e.data.referrer);e={type:"pageview",data:{...e.data,utm:(n=s.lastTouch)==null?void 0:n.utm,attribution:s}}}switch(e.type){case"pageview":this.session.pageViews.push(e.data);break;case"timespent":{let s=(r=this.session.timeSpent[e.data.path])!=null?r:0;this.session.timeSpent[e.data.path]=s+e.data.duration;break}case"heatmap":{let s=e.data.path;this.session.heatmap[s]||(this.session.heatmap[s]=[]);let a=this.session.heatmap[s];a.length<this.cfg.maxHeatmapPoints&&a.push(e.data);break}case"rageclik":case"uturn":case"identify":case"revenue":case"goal":case"journey_step":case"client_context":case"session_replay":break}this.subscribers.forEach(s=>s(e)),(o=(i=this.cfg).onEvent)==null||o.call(i,e),this.cfg.endpoint&&(this.queue.push(e),this.queue.length>=this.cfg.batchSize&&this.flushQueue())}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}trackPageView(e){let n=P(e!=null?e:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"pageview",data:{path:n,title:typeof document!="undefined"?document.title:"",timestamp:Date.now(),sessionId:this.session.id,referrer:typeof document!="undefined"&&document.referrer||void 0}}),typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("tracker:navigate",{detail:{path:n,title:document.title}}))}trackRevenue(e){var n,r;this.emit({type:"revenue",data:{...e,eventName:(n=e.eventName)!=null?n:"purchase",status:(r=e.status)!=null?r:"paid",sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now(),attribution:this.currentAttribution()}})}trackGoal(e){let n=P(typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"goal",data:{...e,sessionId:this.session.id,visitorId:this.session.visitorId,path:n,timestamp:Date.now()}})}trackJourneyStep(e){var r;let n=P((r=e.path)!=null?r:typeof window!="undefined"?window.location.pathname+window.location.search:"/");this.emit({type:"journey_step",data:{...e,path:n,sessionId:this.session.id,visitorId:this.session.visitorId,timestamp:Date.now()}})}identify(e){this.userProperties={...this.userProperties,...e},this.session.userProperties={...this.userProperties},this.emit({type:"identify",data:{properties:{...this.userProperties},visitorId:this.session.visitorId,timestamp:Date.now()}}),this.fetchFlags()}getFlags(){return{...this.flags}}isFeatureEnabled(e){return this.flags[e]===!0}onFlagsChange(e){return this.flagSubscribers.add(e),()=>this.flagSubscribers.delete(e)}async fetchFlags(){if(!this.cfg.endpoint||!this.cfg.secretKey||!this.trackingAllowed)return;let e=we(this.cfg.endpoint)+"/feature-flags/evaluate";try{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({userProperties:this.userProperties})});if(!n.ok)return;let r=await n.json();this.flags=r,this.flagSubscribers.forEach(i=>i({...this.flags}))}catch(n){}}getAbVariants(){return{...this.abVariants}}getAbVariant(e){let n=this.abVariants[e];return n!=null?n:null}isAbVariant(e,n){return this.abVariants[e]===n}onAbTestsChange(e){return this.abTestSubscribers.add(e),()=>this.abTestSubscribers.delete(e)}async fetchAbTests(e){if(!this.cfg.endpoint||!this.cfg.secretKey||!this.trackingAllowed)return;let n=we(this.cfg.endpoint)+"/ab-tests/evaluate";try{let r={visitorId:this.session.visitorId};e!=null&&e.length&&(r.keys=e);let i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify(r)});if(!i.ok)return;let o=await i.json();this.abVariants=e!=null&&e.length?{...this.abVariants,...o}:{...o},this.abTestSubscribers.forEach(s=>s({...this.abVariants}))}catch(r){}}getSession(){return this.session}getPageViews(){return[...this.session.pageViews]}getTimeSpent(){return{...this.session.timeSpent}}getHeatmapData(e){var n;return e!==void 0?[...(n=this.session.heatmap[e])!=null?n:[]]:Object.entries(this.session.heatmap).reduce((r,[i,o])=>(r[i]=[...o],r),{})}get collectUrl(){var e;return(e=this.cfg.collectEndpoint)!=null?e:Ge(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=we(this.cfg.endpoint)+"/sdk/runtime-config";try{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.cfg.secretKey}`},body:JSON.stringify({...this.cfg.appId?{appId:this.cfg.appId}:{}})});return n.ok?await n.json():null}catch(n){return null}}currentPath(){return P(typeof window!="undefined"?window.location.pathname+window.location.search:"/")}flush(){this.flushQueue()}async flushQueue(){if(this.queue.length===0)return;let e=this.queue.splice(0);await this.sendBatch(e)}flushBeacon(){if(this.queue.length===0)return;let e=this.queue.splice(0),n=JSON.stringify(bt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),r=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};St(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r})}async sendBatch(e){let n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(bt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await me(this.collectUrl,r,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:n})}};var O;function Kt(){typeof window=="undefined"||!window.AlphanaSDK||(O?window.AlphanaSDK.tracker=O:delete window.AlphanaSDK.tracker)}function Q(t,e){var r;let n=(r=t.dataset[e])==null?void 0:r.trim();return n||void 0}function te(t,e){let n=Q(t,e);if(n!==void 0){if(["1","true","yes","on"].includes(n.toLowerCase()))return!0;if(["0","false","no","off"].includes(n.toLowerCase()))return!1}}function q(t,e){let n=Q(t,e);if(n===void 0)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function Pi(){if(typeof document=="undefined")return{};let t=document.currentScript;return t instanceof HTMLScriptElement?{...Q(t,"endpoint")?{endpoint:Q(t,"endpoint")}:{},...Q(t,"appId")?{appId:Q(t,"appId")}:{},...Q(t,"secretKey")?{secretKey:Q(t,"secretKey")}:{},...Q(t,"sessionId")?{sessionId:Q(t,"sessionId")}:{},...te(t,"trackNavigation")!==void 0?{trackNavigation:te(t,"trackNavigation")}:{},...te(t,"trackTime")!==void 0?{trackTime:te(t,"trackTime")}:{},...te(t,"trackHeatmap")!==void 0?{trackHeatmap:te(t,"trackHeatmap")}:{},...te(t,"trackLogs")!==void 0?{trackLogs:te(t,"trackLogs")}:{},...te(t,"sessionReplay")!==void 0?{sessionReplay:te(t,"sessionReplay")}:{},...q(t,"sessionReplayCheckoutEveryNms")!==void 0?{sessionReplayCheckoutEveryNms:q(t,"sessionReplayCheckoutEveryNms")}:{},...q(t,"sessionReplayMaxEventsPerBatch")!==void 0?{sessionReplayMaxEventsPerBatch:q(t,"sessionReplayMaxEventsPerBatch")}:{},...q(t,"sessionReplayFlushIntervalMs")!==void 0?{sessionReplayFlushIntervalMs:q(t,"sessionReplayFlushIntervalMs")}:{},...te(t,"sessionReplayMaskAllInputs")!==void 0?{sessionReplayMaskAllInputs:te(t,"sessionReplayMaskAllInputs")}:{},...Q(t,"sessionReplayMaskTextClass")?{sessionReplayMaskTextClass:Q(t,"sessionReplayMaskTextClass")}:{},...Q(t,"sessionReplayBlockClass")?{sessionReplayBlockClass:Q(t,"sessionReplayBlockClass")}:{},...q(t,"mouseSampleRate")!==void 0?{mouseSampleRate:q(t,"mouseSampleRate")}:{},...q(t,"maxHeatmapPoints")!==void 0?{maxHeatmapPoints:q(t,"maxHeatmapPoints")}:{},...q(t,"batchSize")!==void 0?{batchSize:q(t,"batchSize")}:{},...q(t,"flushInterval")!==void 0?{flushInterval:q(t,"flushInterval")}:{}}:{}}function Fi(t){return Object.keys(t).length>0}function Zt(t={}){return O||(O=new Ve(t).init(),Kt(),O)}function Bi(){return O}function Yt(t,...e){var n,r;switch(t){case"init":return Zt((n=e[0])!=null?n:{});case"identify":O==null||O.identify((r=e[0])!=null?r:{});return;case"trackPageView":O==null||O.trackPageView(e[0]);return;case"trackRevenue":O==null||O.trackRevenue(e[0]);return;case"trackGoal":O==null||O.trackGoal(e[0]);return;case"trackJourneyStep":O==null||O.trackJourneyStep(e[0]);return;case"flush":O==null||O.flush();return;case"destroy":O==null||O.destroy(),O=void 0,Kt();return;default:return t}}function Di(){var r;if(typeof window=="undefined")return[];let t=window.alphana,e=(r=t==null?void 0:t.q)!=null?r:[],n=((i,...o)=>Yt(i,...o));return n.q=[],window.alphana=n,e}function _i(){var r;if(typeof window=="undefined")return;let t=Di(),e=t.some(([i])=>i==="init"),n={...Pi(),...(r=window.AlphanaSDKConfig)!=null?r:{}};!e&&Fi(n)&&Zt(n);for(let[i,...o]of t)Yt(i,...o);setTimeout(Kt,0)}_i();return pr(Wi);})();
113
370
  /*! Bundled license information:
114
371
 
115
372
  rrweb/es/rrweb/ext/tslib/tslib.es6.js: