alphana-sdk 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alphana-sdk.global.js +57 -14
- package/dist/index.js +58 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -15
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.js +57 -14
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +57 -14
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var ct=(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')});function Te(t){return t.replace(/\/events\/?$/,"")}function Be(t){return `${Te(t)}/collect`}function lt(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 dt(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 Bt(t){return {...t.appId?{appId:t.appId}:{},log:t}}var Ft="__ut_vid__";function ut(){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 Dt(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(Ft)}catch(t){return null}}function _t(t){if(typeof localStorage!="undefined")try{localStorage.setItem(Ft,t);}catch(e){}}function k(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 a=0;a<5;a++)try{let s=decodeURIComponent(i);if(s===i)break;i=s;}catch(s){break}let o=n;for(let a=0;a<5;a++)try{let s=decodeURIComponent(o);if(s===o)break;o=s;}catch(s){break}return i+o}var Gt="__ut_last_pv_path__",Vt="__ut_last_pv_entry_ms__";function Wt(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function Ut(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e);}catch(r){}}function Wr(t,e){Ut(Gt,t),Ut(Vt,String(e));}function Ur(){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 Ee=class Ee{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=k(window.location.pathname+window.location.search);Ur()==="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,a)=>{r(i,o,a),this.handleNavigation();},this.originalReplaceState=history.replaceState.bind(history);let n=this.originalReplaceState;history.replaceState=(i,o,a)=>{n(i,o,a),this.handleNavigation();};}destroy(){window.removeEventListener("popstate",this.handlePopState),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState);}tryEmitMpaHistoryTraversalUturn(e){let r=Wt(Gt),n=Wt(Vt),i=n?Number(n):0;if(!r||!Number.isFinite(i)||i<=0||k(r)===e)return;let o=Date.now()-i;o<0||o>Ee.UTURN_THRESHOLD_MS||this.emitUturn(k(r),e,o);}handleNavigation(){let e=k(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=Ee.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=k(e);this.previousPath=r,this.pageEntryTime=Date.now(),Wr(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}}));}};Ee.UTURN_THRESHOLD_MS=5e3;var Fe=Ee;var De=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=false;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=k(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=k(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=true;}stopTracking(){if(!this.tracking||!this.currentPath)return;let e=Date.now()-this.startTime;if(e<100){this.tracking=false;return}this.emit({type:"timespent",data:{path:this.currentPath,duration:e,sessionId:this.sessionId,timestamp:Date.now()}}),this.tracking=false;}};function ht(t,e){let r=0;return (...n)=>{let i=Date.now();i-r>=e&&(r=i,t(...n));}}var Gr="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",Ht=/^[A-Za-z][\w-]*$/;function Vr(t){if(!t||t.nodeType!==1)return "";let e=t.id;if(e&&Ht.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&&Ht.test(o)){r.unshift("#"+o);break}let a=n.tagName.toLowerCase(),s=1,c=n.previousElementSibling;for(;c;)c.tagName===n.tagName&&s++,c=c.previousElementSibling;r.unshift(a+":nth-of-type("+s+")"),n=n.parentElement,i++;}return r.join(">")}function Zt(t,e,r){let n=t instanceof Element?t:null;if(!n)return {};let i=n.closest(Gr);if(!i)return {};let o=Vr(i);if(!o)return {};let a=i.getBoundingClientRect();if(a.width<=0||a.height<=0)return {selector:o};let s=Math.min(1,Math.max(0,(e-a.left)/a.width)),c=Math.min(1,Math.max(0,(r-a.top)/a.height));return {selector:o,relX:Math.round(s*1e3)/1e3,relY:Math.round(c*1e3)/1e3}}var ae=class ae{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),a=Zt(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}:{},...a}),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 a=Zt(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",...a}),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,a=window.scrollY,s=Math.min(r,a+i),c=r>0?s/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:s,xPct:e>0?u/e*100:50,yPct:c,pw:e,ph:r,vw:n,type:"scroll"});};this.handleNavigate=e=>{this.currentPath=k(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(a=>k(a))):null,this.throttledMouseMove=ht(this.handleMouseMove,50),this.throttledScroll=ht(this.handleScroll,100);}init(){this.currentPath=k(window.location.pathname+window.location.search),document.addEventListener("mousemove",this.throttledMouseMove),document.addEventListener("click",this.handleClick),document.addEventListener("touchend",this.handleTouchEnd,{passive:true}),window.addEventListener("scroll",this.throttledScroll,{passive:true}),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)?false:((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,a,s;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):(s=(a=r.closest("button, a"))==null?void 0:a.textContent)==null?void 0:s.trim().slice(0,60)))||void 0}checkRageClick(e,r,n){let i=Date.now();this.recentClicks=this.recentClicks.filter(a=>i-a.t<ae.RAGE_WINDOW_MS),this.recentClicks.push({x:e,y:r,t:i});let o=this.recentClicks.filter(a=>Math.hypot(a.x-e,a.y-r)<=ae.RAGE_RADIUS_PX);o.length>=ae.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:n,x:e,y:r,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[]);}};ae.RAGE_THRESHOLD=3,ae.RAGE_WINDOW_MS=1e3,ae.RAGE_RADIUS_PX=50;var _e=ae;var pt="application/x-alphana-gzip";function Hr(){return typeof CompressionStream!="undefined"}async function Kt(t){if(!Hr())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=false){var o;let n=(o=e.compressionThresholdBytes)!=null?o:Jt;if(!r&&e.compressPayloads!==false&&t.length>=n){let a=await Kt(t);if(a)return {codec:"gzip",body:a,contentType:pt}}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:pt}:{},...(i=r.authHeaders)!=null?i:{}};return fetch(t,{method:"POST",headers:n,body:e.body,keepalive:(o=r.keepalive)!=null?o:false})}async function de(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 ft(t,e,r={}){var o,a;let n=(o=r.compressionThresholdBytes)!=null?o:Jt;if(r.compressPayloads!==false&&e.length>=n||Object.keys((a=r.authHeaders)!=null?a:{}).length>0){de(t,e,{...r,keepalive:true});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let s=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,s))return}de(t,e,{...r,keepalive:true});}var Re=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=false;var r,n,i;this.collectUrl=(r=e.collectEndpoint)!=null?r:Be(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:true,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):false),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=true);}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=false);}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(Bt(i));de(this.collectUrl,o,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:true}).catch(a=>{this.origError&&this.origError("[user-tracker] Failed to send log:",a);});}};var F;(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";})(F||(F={}));function Zr(t){return t.nodeType===t.ELEMENT_NODE}function fe(t){var e=t==null?void 0:t.host;return (e==null?void 0:e.shadowRoot)===t}function he(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 mt(t){try{var e=t.rules||t.cssRules;return e?Kr(Array.from(e).map(gt).join("")):null}catch(r){return null}}function gt(t){var e=t.cssText;if(zr(t))try{e=mt(t.styleSheet)||e;}catch(r){}return e}function zr(t){return "styleSheet"in t}var Xt=(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 qt(){return new Xt}function Me(t){var e=t.maskInputOptions,r=t.tagName,n=t.type,i=t.value,o=t.maskInputFn,a=i||"";return (e[r.toLowerCase()]||e[n])&&(o?a=o(a):a="*".repeat(a.length)),a}var jt="__rrweb_original__";function Yr(t){var e=t.getContext("2d");if(!e)return true;for(var r=50,n=0;n<t.width;n+=r)for(var i=0;i<t.height;i+=r){var o=e.getImageData,a=jt in o?o[jt]:o,s=new Uint32Array(a.call(e,n,i,Math.min(r,t.width-n),Math.min(r,t.height-i)).data.buffer);if(s.some(function(c){return c!==0}))return false}return true}var Jr=1,jr=new RegExp("[^a-z0-9-_:]"),pe=-2;function vt(){return Jr++}function Qr(t){if(t instanceof HTMLFormElement)return "form";var e=t.tagName.toLowerCase().trim();return jr.test(e)?"div":e}function Xr(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function qr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ie,Qt,$r=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,en=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,tn=/^(data:)([^,]*),(.*)/i;function We(t,e){return (t||"").replace($r,function(r,n,i,o,a,s){var c=i||a||s,l=n||o||"";if(!c)return r;if(!en.test(c)||tn.test(c))return "url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return "url(".concat(l).concat(qr(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var p=0,f=u;p<f.length;p++){var h=f[p];h!=="."&&(h===".."?d.pop():d.push(h));}return "url(".concat(l).concat(d.join("/")).concat(l,")")})}var rn=/^[^ \t\n\r\u000c]+/,nn=/^[, \t\n\r\u000c]+/;function on(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(nn),!(r>=e.length);){var o=n(rn);if(o.slice(-1)===",")o=Ce(t,o.substring(0,o.length-1)),i.push(o);else {var a="";o=Ce(t,o);for(var s=false;;){var c=e.charAt(r);if(c===""){i.push((o+a).trim());break}else if(s)c===")"&&(s=false);else if(c===","){r+=1,i.push((o+a).trim());break}else c==="("&&(s=true);a+=c,r+=1;}}}return i.join(", ")}function Ce(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function sn(t){return !!(t.tagName==="svg"||t.ownerSVGElement)}function yt(){var t=document.createElement("a");return t.href="",t.href}function It(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")?Ce(t,n):r==="srcset"&&n?on(t,n):r==="style"&&n?We(n,yt()):e==="object"&&r==="data"&&n?Ce(t,n):n}function an(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return true}else for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return true}return r?t.matches(r):false}function xe(t,e,r){if(!t)return false;if(t.nodeType!==t.ELEMENT_NODE)return r?xe(t.parentNode,e,r):false;for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return true}return r?xe(t.parentNode,e,r):false}function Ct(t,e,r){var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return false;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return true}else if(xe(n,e,true))return true;return !!(r&&(n.matches(r)||n.closest(r)))}function cn(t,e,r){var n=t.contentWindow;if(n){var i=false,o;try{o=n.document.readyState;}catch(c){return}if(o!=="complete"){var a=setTimeout(function(){i||(e(),i=true);},r);t.addEventListener("load",function(){clearTimeout(a),i=true,e();});return}var s="about:blank";if(n.location.href!==s||t.src===s||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e);}}function ln(t,e,r){var n=false,i;try{i=t.sheet;}catch(a){return}if(!i){var o=setTimeout(function(){n||(e(),n=true);},r);t.addEventListener("load",function(){clearTimeout(o),n=true,e();});}}function dn(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,p=e.maskInputFn,f=e.dataURLOptions,h=f===void 0?{}:f,v=e.inlineImages,I=e.recordCanvas,y=e.keepIframeSrcFn,m=e.newlyAddedElement,g=m===void 0?false:m,S=un(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:F.Document,childNodes:[],compatMode:t.compatMode}:{type:F.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return {type:F.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:S};case t.ELEMENT_NODE:return pn(t,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:c,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:v,recordCanvas:I,keepIframeSrcFn:y,newlyAddedElement:g,rootId:S});case t.TEXT_NODE:return hn(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:S});case t.CDATA_SECTION_NODE:return {type:F.CDATA,textContent:"",rootId:S};case t.COMMENT_NODE:return {type:F.Comment,textContent:t.textContent||"",rootId:S};default:return false}}function un(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function hn(t,e){var r,n=e.maskTextClass,i=e.maskTextSelector,o=e.maskTextFn,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=s==="STYLE"?true:void 0,d=s==="SCRIPT"?true:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=Xr(t.parentNode.sheet));}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t);}c=We(c,yt());}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&Ct(t,n,i)&&(c=o?o(c):c.replace(/[\S]/g,"*")),{type:F.Text,textContent:c||"",isStyle:l,rootId:a}}function pn(t,e){for(var r=e.doc,n=e.blockClass,i=e.blockSelector,o=e.inlineStylesheet,a=e.maskInputOptions,s=a===void 0?{}:a,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,p=e.recordCanvas,f=e.keepIframeSrcFn,h=e.newlyAddedElement,v=h===void 0?false:h,I=e.rootId,y=an(t,n,i),m=Qr(t),g={},S=t.attributes.length,D=0;D<S;D++){var O=t.attributes[D];g[O.name]=It(r,m,O.name,O.value);}if(m==="link"&&o){var L=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),T=null;L&&(T=mt(L)),T&&(delete g.rel,delete g.href,g._cssText=We(T,L.href));}if(m==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=mt(t.sheet);T&&(g._cssText=We(T,yt()));}if(m==="input"||m==="textarea"||m==="select"){var Z=t.value,K=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&Z?g.value=Me({type:g.type,tagName:m,value:Z,maskInputOptions:s,maskInputFn:c}):K&&(g.checked=K);}if(m==="option"&&(t.selected&&!s.select?g.selected=true:delete g.selected),m==="canvas"&&p){if(t.__context==="2d")Yr(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var j=t.toDataURL(d.type,d.quality),Q=document.createElement("canvas");Q.width=t.width,Q.height=t.height;var X=Q.toDataURL(d.type,d.quality);j!==X&&(g.rr_dataURL=j);}}if(m==="img"&&u){Ie||(Ie=r.createElement("canvas"),Qt=Ie.getContext("2d"));var P=t,z=P.crossOrigin;P.crossOrigin="anonymous";var q=function(){try{Ie.width=P.naturalWidth,Ie.height=P.naturalHeight,Qt.drawImage(P,0,0),g.rr_dataURL=Ie.toDataURL(d.type,d.quality);}catch(Y){console.warn("Cannot inline img src=".concat(P.currentSrc,"! Error: ").concat(Y));}z?g.crossOrigin=z:P.removeAttribute("crossorigin");};P.complete&&P.naturalWidth!==0?q():P.onload=q;}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 re=t.getBoundingClientRect(),ie=re.width,G=re.height;g={class:g.class,rr_width:"".concat(ie,"px"),rr_height:"".concat(G,"px")};}return m==="iframe"&&!f(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:F.Element,tagName:m,attributes:g,childNodes:[],isSVG:sn(t)||void 0,needBlock:y,rootId:I}}function E(t){return t===void 0?"":t.toLowerCase()}function fn(t,e){if(e.comment&&t.type===F.Comment)return true;if(t.type===F.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 true;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||E(t.attributes.name)==="application-name"||E(t.attributes.rel)==="icon"||E(t.attributes.rel)==="apple-touch-icon"||E(t.attributes.rel)==="shortcut icon")))return true;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return true;if(e.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||E(t.attributes.name)==="pinterest"))return true;if(e.headMetaRobots&&(E(t.attributes.name)==="robots"||E(t.attributes.name)==="googlebot"||E(t.attributes.name)==="bingbot"))return true;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return true;if(e.headMetaAuthorship&&(E(t.attributes.name)==="author"||E(t.attributes.name)==="generator"||E(t.attributes.name)==="framework"||E(t.attributes.name)==="publisher"||E(t.attributes.name)==="progid"||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return true;if(e.headMetaVerification&&(E(t.attributes.name)==="google-site-verification"||E(t.attributes.name)==="yandex-verification"||E(t.attributes.name)==="csrf-token"||E(t.attributes.name)==="p:domain_verify"||E(t.attributes.name)==="verify-v1"||E(t.attributes.name)==="verification"||E(t.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function ue(t,e){var r=e.doc,n=e.mirror,i=e.blockClass,o=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,c=e.skipChild,l=c===void 0?false:c,d=e.inlineStylesheet,u=d===void 0?true:d,p=e.maskInputOptions,f=p===void 0?{}:p,h=e.maskTextFn,v=e.maskInputFn,I=e.slimDOMOptions,y=e.dataURLOptions,m=y===void 0?{}:y,g=e.inlineImages,S=g===void 0?false:g,D=e.recordCanvas,O=D===void 0?false:D,L=e.onSerialize,T=e.onIframeLoad,Z=e.iframeLoadTimeout,K=Z===void 0?5e3:Z,j=e.onStylesheetLoad,Q=e.stylesheetLoadTimeout,X=Q===void 0?5e3:Q,P=e.keepIframeSrcFn,z=P===void 0?function(){return false}:P,q=e.newlyAddedElement,re=q===void 0?false:q,ie=e.preserveWhiteSpace,G=ie===void 0?true:ie,Y=dn(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,dataURLOptions:m,inlineImages:S,recordCanvas:O,keepIframeSrcFn:z,newlyAddedElement:re});if(!Y)return console.warn(t,"not serialized"),null;var se;n.hasNode(t)?se=n.getId(t):fn(Y,I)||!G&&Y.type===F.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?se=pe:se=vt();var N=Object.assign(Y,{id:se});if(n.add(t,N),se===pe)return null;L&&L(t);var $=!l;if(N.type===F.Element){$=$&&!N.needBlock,delete N.needBlock;var ne=t.shadowRoot;ne&&he(ne)&&(N.isShadowHost=true);}if((N.type===F.Document||N.type===F.Element)&&$){I.headWhitespace&&N.type===F.Element&&N.tagName==="head"&&(G=false);for(var ye={doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:m,inlineImages:S,recordCanvas:O,preserveWhiteSpace:G,onSerialize:L,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z},C=0,W=Array.from(t.childNodes);C<W.length;C++){var V=W[C],R=ue(V,ye);R&&N.childNodes.push(R);}if(Zr(t)&&t.shadowRoot)for(var J=0,A=Array.from(t.shadowRoot.childNodes);J<A.length;J++){var V=A[J],R=ue(V,ye);R&&(he(t.shadowRoot)&&(R.isShadow=true),N.childNodes.push(R));}}return t.parentNode&&fe(t.parentNode)&&he(t.parentNode)&&(N.isShadow=true),N.type===F.Element&&N.tagName==="iframe"&&cn(t,function(){var H=t.contentDocument;if(H&&T){var ke=ue(H,{doc:H,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:m,inlineImages:S,recordCanvas:O,preserveWhiteSpace:G,onSerialize:L,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z});ke&&T(t,ke);}},K),N.type===F.Element&&N.tagName==="link"&&N.attributes.rel==="stylesheet"&&ln(t,function(){if(j){var H=ue(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:f,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:m,inlineImages:S,recordCanvas:O,preserveWhiteSpace:G,onSerialize:L,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:z});H&&j(t,H);}},X),N}function $t(t,e){var r=e||{},n=r.mirror,i=n===void 0?new Xt:n,o=r.blockClass,a=o===void 0?"rr-block":o,s=r.blockSelector,c=s===void 0?null:s,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,p=u===void 0?null:u,f=r.inlineStylesheet,h=f===void 0?true:f,v=r.inlineImages,I=v===void 0?false:v,y=r.recordCanvas,m=y===void 0?false:y,g=r.maskAllInputs,S=g===void 0?false:g,D=r.maskTextFn,O=r.maskInputFn,L=r.slimDOM,T=L===void 0?false:L,Z=r.dataURLOptions,K=r.preserveWhiteSpace,j=r.onSerialize,Q=r.onIframeLoad,X=r.iframeLoadTimeout,P=r.onStylesheetLoad,z=r.stylesheetLoadTimeout,q=r.keepIframeSrcFn,re=q===void 0?function(){return false}:q,ie=S===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:S===false?{password:true}:S,G=T===true||T==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaDescKeywords:T==="all",headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaAuthorship:true,headMetaVerification:true}:T===false?{}:T;return ue(t,{doc:t,mirror:i,blockClass:a,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:false,inlineStylesheet:h,maskInputOptions:ie,maskTextFn:D,maskInputFn:O,slimDOMOptions:G,dataURLOptions:Z,inlineImages:I,recordCanvas:m,preserveWhiteSpace:K,onSerialize:j,onIframeLoad:Q,iframeLoadTimeout:X,onStylesheetLoad:P,stylesheetLoadTimeout:z,keepIframeSrcFn:re,newlyAddedElement:false})}function _(t,e,r=document){let n={capture:true,passive:true};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var be=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
var ct=(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')});function Te(t){return t.replace(/\/events\/?$/,"")}function Be(t){return `${Te(t)}/collect`}function lt(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 dt(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 Bt(t){return {...t.appId?{appId:t.appId}:{},log:t}}var Ft="__ut_vid__";function ut(){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 Dt(){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(Ft)}catch(t){return null}}function _t(t){if(typeof localStorage!="undefined")try{localStorage.setItem(Ft,t);}catch(e){}}function k(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 Gt="__ut_last_pv_path__",Vt="__ut_last_pv_entry_ms__";function Wt(t){if(typeof sessionStorage=="undefined")return null;try{return sessionStorage.getItem(t)}catch(e){return null}}function Ut(t,e){if(typeof sessionStorage!="undefined")try{sessionStorage.setItem(t,e);}catch(r){}}function Wr(t,e){Ut(Gt,t),Ut(Vt,String(e));}function Ur(){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 Ee=class Ee{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=k(window.location.pathname+window.location.search);Ur()==="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=Wt(Gt),n=Wt(Vt),i=n?Number(n):0;if(!r||!Number.isFinite(i)||i<=0||k(r)===e)return;let o=Date.now()-i;o<0||o>Ee.UTURN_THRESHOLD_MS||this.emitUturn(k(r),e,o);}handleNavigation(){let e=k(window.location.pathname+window.location.search);if(e!==this.previousPath){if(this.previousPath&&this.pageEntryTime>0){let r=Date.now()-this.pageEntryTime;r<=Ee.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=k(e);this.previousPath=r,this.pageEntryTime=Date.now(),Wr(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}}));}};Ee.UTURN_THRESHOLD_MS=5e3;var Fe=Ee;var De=class{constructor({emit:e,sessionId:r}){this.currentPath="";this.startTime=0;this.tracking=false;this.handleNavigate=e=>{this.stopTracking(),this.currentPath=k(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=k(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=true;}stopTracking(){if(!this.tracking||!this.currentPath)return;let e=Date.now()-this.startTime;if(e<100){this.tracking=false;return}this.emit({type:"timespent",data:{path:this.currentPath,duration:e,sessionId:this.sessionId,timestamp:Date.now()}}),this.tracking=false;}};function ht(t,e){let r=0;return (...n)=>{let i=Date.now();i-r>=e&&(r=i,t(...n));}}var Gr="a,button,input,select,textarea,label,summary,img,[role],[onclick],[data-track-label],[data-test-target],[id],h1,h2,h3,h4,h5,h6",Ht=/^[A-Za-z][\w-]*$/;function Vr(t){if(!t||t.nodeType!==1)return "";let e=t.id;if(e&&Ht.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&&Ht.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 Zt(t,e,r){let n=t instanceof Element?t:null;if(!n)return {};let i=n.closest(Gr);if(!i)return {};let o=Vr(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 ae=class ae{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=Zt(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=Zt(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=k(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=>k(s))):null,this.throttledMouseMove=ht(this.handleMouseMove,50),this.throttledScroll=ht(this.handleScroll,100);}init(){this.currentPath=k(window.location.pathname+window.location.search),document.addEventListener("mousemove",this.throttledMouseMove),document.addEventListener("click",this.handleClick),document.addEventListener("touchend",this.handleTouchEnd,{passive:true}),window.addEventListener("scroll",this.throttledScroll,{passive:true}),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)?false:((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<ae.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)<=ae.RAGE_RADIUS_PX);o.length>=ae.RAGE_THRESHOLD&&(this.emit({type:"rageclik",data:{path:n,x:e,y:r,count:o.length,timestamp:i,sessionId:this.sessionId}}),this.recentClicks=[]);}};ae.RAGE_THRESHOLD=3,ae.RAGE_WINDOW_MS=1e3,ae.RAGE_RADIUS_PX=50;var _e=ae;var pt="application/x-alphana-gzip";function Hr(){return typeof CompressionStream!="undefined"}async function Kt(t){if(!Hr())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=false){var o;let n=(o=e.compressionThresholdBytes)!=null?o:jt;if(!r&&e.compressPayloads!==false&&t.length>=n){let s=await Kt(t);if(s)return {codec:"gzip",body:s,contentType:pt}}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:pt}:{},...(i=r.authHeaders)!=null?i:{}};return fetch(t,{method:"POST",headers:n,body:e.body,keepalive:(o=r.keepalive)!=null?o:false})}async function de(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 ft(t,e,r={}){var o,s;let n=(o=r.compressionThresholdBytes)!=null?o:jt;if(r.compressPayloads!==false&&e.length>=n||Object.keys((s=r.authHeaders)!=null?s:{}).length>0){de(t,e,{...r,keepalive:true});return}if(typeof navigator!="undefined"&&navigator.sendBeacon){let a=new Blob([e],{type:"application/json"});if(navigator.sendBeacon(t,a))return}de(t,e,{...r,keepalive:true});}var xe=class{constructor(e){this.prevOnError=null;this.prevOnUnhandledRejection=null;this.initialized=false;var r,n,i;this.collectUrl=(r=e.collectEndpoint)!=null?r:Be(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:true,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):false),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=true);}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=false);}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(Bt(i));de(this.collectUrl,o,{compressPayloads:this.compressPayloads,compressionThresholdBytes:this.compressionThresholdBytes,authHeaders:this.authHeaders,keepalive:true}).catch(s=>{this.origError&&this.origError("[user-tracker] Failed to send log:",s);});}};var D;(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";})(D||(D={}));function Zr(t){return t.nodeType===t.ELEMENT_NODE}function fe(t){var e=t==null?void 0:t.host;return (e==null?void 0:e.shadowRoot)===t}function he(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 mt(t){try{var e=t.rules||t.cssRules;return e?Kr(Array.from(e).map(gt).join("")):null}catch(r){return null}}function gt(t){var e=t.cssText;if(zr(t))try{e=mt(t.styleSheet)||e;}catch(r){}return e}function zr(t){return "styleSheet"in t}var Xt=(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 qt(){return new Xt}function Me(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 Jt="__rrweb_original__";function Yr(t){var e=t.getContext("2d");if(!e)return true;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=Jt in o?o[Jt]: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 false}return true}var jr=1,Jr=new RegExp("[^a-z0-9-_:]"),pe=-2;function yt(){return jr++}function Qr(t){if(t instanceof HTMLFormElement)return "form";var e=t.tagName.toLowerCase().trim();return Jr.test(e)?"div":e}function Xr(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function qr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ie,Qt,$r=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,en=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,tn=/^(data:)([^,]*),(.*)/i;function We(t,e){return (t||"").replace($r,function(r,n,i,o,s,a){var c=i||s||a,l=n||o||"";if(!c)return r;if(!en.test(c)||tn.test(c))return "url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return "url(".concat(l).concat(qr(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 rn=/^[^ \t\n\r\u000c]+/,nn=/^[, \t\n\r\u000c]+/;function on(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(nn),!(r>=e.length);){var o=n(rn);if(o.slice(-1)===",")o=Ce(t,o.substring(0,o.length-1)),i.push(o);else {var s="";o=Ce(t,o);for(var a=false;;){var c=e.charAt(r);if(c===""){i.push((o+s).trim());break}else if(a)c===")"&&(a=false);else if(c===","){r+=1,i.push((o+s).trim());break}else c==="("&&(a=true);s+=c,r+=1;}}}return i.join(", ")}function Ce(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function sn(t){return !!(t.tagName==="svg"||t.ownerSVGElement)}function vt(){var t=document.createElement("a");return t.href="",t.href}function It(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")?Ce(t,n):r==="srcset"&&n?on(t,n):r==="style"&&n?We(n,vt()):e==="object"&&r==="data"&&n?Ce(t,n):n}function an(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return true}else for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return true}return r?t.matches(r):false}function Re(t,e,r){if(!t)return false;if(t.nodeType!==t.ELEMENT_NODE)return r?Re(t.parentNode,e,r):false;for(var n=t.classList.length;n--;){var i=t.classList[n];if(e.test(i))return true}return r?Re(t.parentNode,e,r):false}function Ct(t,e,r){var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return false;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return true}else if(Re(n,e,true))return true;return !!(r&&(n.matches(r)||n.closest(r)))}function cn(t,e,r){var n=t.contentWindow;if(n){var i=false,o;try{o=n.document.readyState;}catch(c){return}if(o!=="complete"){var s=setTimeout(function(){i||(e(),i=true);},r);t.addEventListener("load",function(){clearTimeout(s),i=true,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 ln(t,e,r){var n=false,i;try{i=t.sheet;}catch(s){return}if(!i){var o=setTimeout(function(){n||(e(),n=true);},r);t.addEventListener("load",function(){clearTimeout(o),n=true,e();});}}function dn(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?false:f,b=un(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:t.compatMode}:{type:D.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return {type:D.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return pn(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 hn(t,{maskTextClass:s,maskTextSelector:a,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return {type:D.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return {type:D.Comment,textContent:t.textContent||"",rootId:b};default:return false}}function un(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function hn(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"?true:void 0,d=a==="SCRIPT"?true:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=Xr(t.parentNode.sheet));}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t);}c=We(c,vt());}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&Ct(t,n,i)&&(c=o?o(c):c.replace(/[\S]/g,"*")),{type:D.Text,textContent:c||"",isStyle:l,rootId:s}}function pn(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?false:h,I=e.rootId,y=an(t,n,i),f=Qr(t),g={},b=t.attributes.length,x=0;x<b;x++){var L=t.attributes[x];g[L.name]=It(r,f,L.name,L.value);}if(f==="link"&&o){var P=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),T=null;P&&(T=mt(P)),T&&(delete g.rel,delete g.href,g._cssText=We(T,P.href));}if(f==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var T=mt(t.sheet);T&&(g._cssText=We(T,vt()));}if(f==="input"||f==="textarea"||f==="select"){var Z=t.value,K=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&Z?g.value=Me({type:g.type,tagName:f,value:Z,maskInputOptions:a,maskInputFn:c}):K&&(g.checked=K);}if(f==="option"&&(t.selected&&!a.select?g.selected=true:delete g.selected),f==="canvas"&&p){if(t.__context==="2d")Yr(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var J=t.toDataURL(d.type,d.quality),Q=document.createElement("canvas");Q.width=t.width,Q.height=t.height;var X=Q.toDataURL(d.type,d.quality);J!==X&&(g.rr_dataURL=J);}}if(f==="img"&&u){Ie||(Ie=r.createElement("canvas"),Qt=Ie.getContext("2d"));var B=t,z=B.crossOrigin;B.crossOrigin="anonymous";var q=function(){try{Ie.width=B.naturalWidth,Ie.height=B.naturalHeight,Qt.drawImage(B,0,0),g.rr_dataURL=Ie.toDataURL(d.type,d.quality);}catch(Y){console.warn("Cannot inline img src=".concat(B.currentSrc,"! Error: ").concat(Y));}z?g.crossOrigin=z:B.removeAttribute("crossorigin");};B.complete&&B.naturalWidth!==0?q():B.onload=q;}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 re=t.getBoundingClientRect(),ie=re.width,G=re.height;g={class:g.class,rr_width:"".concat(ie,"px"),rr_height:"".concat(G,"px")};}return f==="iframe"&&!m(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:D.Element,tagName:f,attributes:g,childNodes:[],isSVG:sn(t)||void 0,needBlock:y,rootId:I}}function E(t){return t===void 0?"":t.toLowerCase()}function fn(t,e){if(e.comment&&t.type===D.Comment)return true;if(t.type===D.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 true;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||E(t.attributes.name)==="application-name"||E(t.attributes.rel)==="icon"||E(t.attributes.rel)==="apple-touch-icon"||E(t.attributes.rel)==="shortcut icon")))return true;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return true;if(e.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||E(t.attributes.name)==="pinterest"))return true;if(e.headMetaRobots&&(E(t.attributes.name)==="robots"||E(t.attributes.name)==="googlebot"||E(t.attributes.name)==="bingbot"))return true;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return true;if(e.headMetaAuthorship&&(E(t.attributes.name)==="author"||E(t.attributes.name)==="generator"||E(t.attributes.name)==="framework"||E(t.attributes.name)==="publisher"||E(t.attributes.name)==="progid"||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return true;if(e.headMetaVerification&&(E(t.attributes.name)==="google-site-verification"||E(t.attributes.name)==="yandex-verification"||E(t.attributes.name)==="csrf-token"||E(t.attributes.name)==="p:domain_verify"||E(t.attributes.name)==="verify-v1"||E(t.attributes.name)==="verification"||E(t.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function ue(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?false:c,d=e.inlineStylesheet,u=d===void 0?true: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?false:g,x=e.recordCanvas,L=x===void 0?false:x,P=e.onSerialize,T=e.onIframeLoad,Z=e.iframeLoadTimeout,K=Z===void 0?5e3:Z,J=e.onStylesheetLoad,Q=e.stylesheetLoadTimeout,X=Q===void 0?5e3:Q,B=e.keepIframeSrcFn,z=B===void 0?function(){return false}:B,q=e.newlyAddedElement,re=q===void 0?false:q,ie=e.preserveWhiteSpace,G=ie===void 0?true:ie,Y=dn(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:L,keepIframeSrcFn:z,newlyAddedElement:re});if(!Y)return console.warn(t,"not serialized"),null;var se;n.hasNode(t)?se=n.getId(t):fn(Y,I)||!G&&Y.type===D.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?se=pe:se=yt();var O=Object.assign(Y,{id:se});if(n.add(t,O),se===pe)return null;P&&P(t);var $=!l;if(O.type===D.Element){$=$&&!O.needBlock,delete O.needBlock;var ne=t.shadowRoot;ne&&he(ne)&&(O.isShadowHost=true);}if((O.type===D.Document||O.type===D.Element)&&$){I.headWhitespace&&O.type===D.Element&&O.tagName==="head"&&(G=false);for(var ve={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:L,preserveWhiteSpace:G,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:z},C=0,W=Array.from(t.childNodes);C<W.length;C++){var V=W[C],R=ue(V,ve);R&&O.childNodes.push(R);}if(Zr(t)&&t.shadowRoot)for(var j=0,A=Array.from(t.shadowRoot.childNodes);j<A.length;j++){var V=A[j],R=ue(V,ve);R&&(he(t.shadowRoot)&&(R.isShadow=true),O.childNodes.push(R));}}return t.parentNode&&fe(t.parentNode)&&he(t.parentNode)&&(O.isShadow=true),O.type===D.Element&&O.tagName==="iframe"&&cn(t,function(){var H=t.contentDocument;if(H&&T){var ke=ue(H,{doc:H,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:false,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:G,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:z});ke&&T(t,ke);}},K),O.type===D.Element&&O.tagName==="link"&&O.attributes.rel==="stylesheet"&&ln(t,function(){if(J){var H=ue(t,{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:false,inlineStylesheet:u,maskInputOptions:m,maskTextFn:h,maskInputFn:v,slimDOMOptions:I,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:G,onSerialize:P,onIframeLoad:T,iframeLoadTimeout:K,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:z});H&&J(t,H);}},X),O}function $t(t,e){var r=e||{},n=r.mirror,i=n===void 0?new Xt: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?true:m,v=r.inlineImages,I=v===void 0?false:v,y=r.recordCanvas,f=y===void 0?false:y,g=r.maskAllInputs,b=g===void 0?false:g,x=r.maskTextFn,L=r.maskInputFn,P=r.slimDOM,T=P===void 0?false:P,Z=r.dataURLOptions,K=r.preserveWhiteSpace,J=r.onSerialize,Q=r.onIframeLoad,X=r.iframeLoadTimeout,B=r.onStylesheetLoad,z=r.stylesheetLoadTimeout,q=r.keepIframeSrcFn,re=q===void 0?function(){return false}:q,ie=b===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:b===false?{password:true}:b,G=T===true||T==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaDescKeywords:T==="all",headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaAuthorship:true,headMetaVerification:true}:T===false?{}:T;return ue(t,{doc:t,mirror:i,blockClass:s,blockSelector:c,maskTextClass:d,maskTextSelector:p,skipChild:false,inlineStylesheet:h,maskInputOptions:ie,maskTextFn:x,maskInputFn:L,slimDOMOptions:G,dataURLOptions:Z,inlineImages:I,recordCanvas:f,preserveWhiteSpace:K,onSerialize:J,onIframeLoad:Q,iframeLoadTimeout:X,onStylesheetLoad:B,stylesheetLoadTimeout:z,keepIframeSrcFn:re,newlyAddedElement:false})}function _(t,e,r=document){let n={capture:true,passive:true};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var be=`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.`,er={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be);},has(){return console.error(be),false},reset(){console.error(be);}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(er=new Proxy(er,{get(t,e,r){return e==="map"&&console.error(be),Reflect.get(t,e,r)}}));function Se(t,e,r={}){let n=null,i=0;return function(...o){let a=Date.now();!i&&r.leading===false&&(i=a);let s=e-(a-i),c=this;s<=0||s>e?(n&&(clearTimeout(n),n=null),i=a,t.apply(c,o)):!n&&r.trailing!==false&&(n=setTimeout(()=>{i=r.leading===false?0:Date.now(),n=null,t.apply(c,o);},s));}}function me(t,e,r,n,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,n?r:{set(a){setTimeout(()=>{r.set.call(this,a);},0),o&&o.set&&o.set.call(this,a);}}),()=>me(t,e,o||{},true)}function ee(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 Ge(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ve(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function x(t,e,r,n){if(!t)return false;let i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!i)return false;if(typeof e=="string"){if(i.classList.contains(e)||n&&i.closest("."+e)!==null)return true}else if(xe(i,e,n))return true;return !!(r&&(t.matches(r)||n&&i.closest(r)!==null))}function tr(t,e){return e.getId(t)!==-1}function He(t,e){return e.getId(t)===pe}function bt(t,e){if(fe(t))return false;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?false:t.parentNode?bt(t.parentNode,e):true:true}function St(t){return !!t.changedTouches}function rr(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 true;while(r=r&&r.parentNode);return false});}function Ze(t,e){return !!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Ke(t,e){return !!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function ze(t){return !!(t!=null&&t.shadowRoot)}var Ue=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||{}),b=(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))(b||{}),Ye=(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))(Ye||{}),oe=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(oe||{});function nr(t){return "__ln"in t}var wt=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&&nr(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&&nr(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--);}},ir=(t,e)=>`${t}@${e}`,Je=class{constructor(){this.frozen=false,this.locked=false,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 wt,n=s=>{let c=s,l=pe;for(;l===pe;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},i=s=>{var c,l,d,u;let p=null;((l=(c=s.getRootNode)===null||c===void 0?void 0:c.call(s))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(p=s.getRootNode().host);let f=p;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 h=!this.doc.contains(s)&&(!f||!this.doc.contains(f));if(!s.parentNode||h)return;let v=fe(s.parentNode)?this.mirror.getId(p):this.mirror.getId(s.parentNode),I=n(s);if(v===-1||I===-1)return r.addNode(s);let y=ue(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,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=>{Ze(m,this.mirror)&&this.iframeManager.addIframe(m),Ke(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),ze(s)&&this.shadowDomManager.addShadowRoot(s.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:I,node:y});};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))or(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||i(s);for(let s of Array.from(this.addedSet.values()))!sr(this.droppedSet,s)&&!or(this.removes,s,this.mirror)||sr(this.movedSet,s)?i(s):this.droppedSet.add(s);let o=null;for(;r.length;){let s=null;if(o){let c=this.mirror.getId(o.value.parentNode),l=n(o.value);c!==-1&&l!==-1&&(s=o);}if(!s)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){s=l;break}else {let p=l.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=p.parentNode.host;if(this.mirror.getId(f)!==-1){s=l;break}}}}}if(!s){for(;r.head;)r.removeNode(r.head.value);break}o=s.previous,r.removeNode(s.value),i(s.value);}let a={texts:this.texts.map(s=>({id:this.mirror.getId(s.node),value:s.value})).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>({id:this.mirror.getId(s.node),attributes:s.attributes})).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a));},this.processMutation=e=>{if(!He(e.target,this.mirror))switch(e.type){case "characterData":{let r=e.target.textContent;!x(e.target,this.blockClass,this.blockSelector,false)&&r!==e.oldValue&&this.texts.push({value:Ct(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=Me({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),x(e.target,this.blockClass,this.blockSelector,false)||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 a=i.attributes.style;for(let s of Array.from(r.style)){let c=r.style.getPropertyValue(s),l=r.style.getPropertyPriority(s);(c!==o.style.getPropertyValue(s)||l!==o.style.getPropertyPriority(s))&&(l===""?a[s]=c:a[s]=[c,l]);}for(let s of Array.from(o.style))r.style.getPropertyValue(s)===""&&(a[s]=false);}else i.attributes[e.attributeName]=It(this.doc,r.tagName,e.attributeName,n);break}case "childList":{if(x(e.target,this.blockClass,this.blockSelector,true))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=fe(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);x(e.target,this.blockClass,this.blockSelector,false)||He(r,this.mirror)||!tr(r,this.mirror)||(this.addedSet.has(r)?(At(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||bt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ir(n,i)]?At(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:fe(e.target)&&he(e.target)?true:void 0})),this.mapRemoves.push(r));});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(He(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[ir(this.mirror.getId(e),n)]=true);}else this.addedSet.add(e),this.droppedSet.delete(e);x(e,this.blockClass,this.blockSelector,false)||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=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function At(t,e){t.delete(e),e.childNodes.forEach(r=>At(t,r));}function or(t,e,r){return t.length===0?false:ar(t,e,r)}function ar(t,e,r){let{parentNode:n}=e;if(!n)return false;let i=r.getId(n);return t.some(o=>o.id===i)?true:ar(t,n,r)}function sr(t,e){return t.size===0?false:cr(t,e)}function cr(t,e){let{parentNode:r}=e;return r?t.has(r)?true:cr(t,r):false}var le=[],ur=typeof CSSGroupingRule!="undefined",hr=typeof CSSMediaRule!="undefined",pr=typeof CSSSupportsRule!="undefined",fr=typeof CSSConditionRule!="undefined";function Ne(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 kt(t,e){var r,n;let i=new Je;le.push(i),i.init(t);let o=window.MutationObserver||window.__rrMutationObserver,a=(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");a&&window[a]&&(o=window[a]);let s=new o(i.processMutations.bind(i));return s.observe(e,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),s}function gn({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===false)return ()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,a=[],s,c=Se(u=>{let p=Date.now()-s;t(a.map(f=>(f.timeOffset-=p,f)),u),a=[],s=null;},o),l=Se(u=>{let p=Ne(u),{clientX:f,clientY:h}=St(u)?u.changedTouches[0]:u;s||(s=Date.now()),a.push({x:f,y:h,id:n.getId(p),timeOffset:Date.now()-s}),c(typeof DragEvent!="undefined"&&u instanceof DragEvent?b.Drag:u instanceof MouseEvent?b.MouseMove:b.TouchMove);},i,{trailing:false}),d=[_("mousemove",l,r),_("touchmove",l,r),_("drag",l,r)];return ()=>{d.forEach(u=>u());}}function vn({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===false)return ()=>{};let a=o.mouseInteraction===true||o.mouseInteraction===void 0?{}:o.mouseInteraction,s=[],c=l=>d=>{let u=Ne(d);if(x(u,n,i,true))return;let p=St(d)?d.changedTouches[0]:d;if(!p)return;let f=r.getId(u),{clientX:h,clientY:v}=p;t({type:Ye[l],id:f,x:h,y:v});};return Object.keys(Ye).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==false).forEach(l=>{let d=l.toLowerCase(),u=c(l);s.push(_(d,u,e));}),()=>{s.forEach(l=>l());}}function Tt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let a=Se(s=>{let c=Ne(s);if(!c||x(c,n,i,true))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 _("scroll",a,e)}function yn({viewportResizeCb:t}){let e=-1,r=-1,n=Se(()=>{let i=Ge(),o=Ve();(e!==i||r!==o)&&(t({width:Number(o),height:Number(i)}),e=i,r=o);},200);return _("resize",n,window)}function lr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var In=["INPUT","TEXTAREA","SELECT"],dr=new WeakMap;function Cn({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,maskInputOptions:a,maskInputFn:s,sampling:c,userTriggeredOnInput:l}){function d(y){let m=Ne(y),g=y.isTrusted;if(m&&m.tagName==="OPTION"&&(m=m.parentElement),!m||!m.tagName||In.indexOf(m.tagName)<0||x(m,n,i,true))return;let S=m.type;if(m.classList.contains(o))return;let D=m.value,O=false;S==="radio"||S==="checkbox"?O=m.checked:(a[m.tagName.toLowerCase()]||a[S])&&(D=Me({maskInputOptions:a,tagName:m.tagName,type:S,value:D,maskInputFn:s})),u(m,lr({text:D,isChecked:O,userTriggered:g},l));let L=m.name;S==="radio"&&L&&O&&e.querySelectorAll(`input[type="radio"][name="${L}"]`).forEach(T=>{T!==m&&u(T,lr({text:T.value,isChecked:!O,userTriggered:false},l));});}function u(y,m){let g=dr.get(y);if(!g||g.text!==m.text||g.isChecked!==m.isChecked){dr.set(y,m);let S=r.getId(y);t(Object.assign(Object.assign({},m),{id:S}));}}let f=(c.input==="last"?["change"]:["input","change"]).map(y=>_(y,d,e)),h=e.defaultView;if(!h)return ()=>{f.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&&f.push(...I.map(y=>me(y[0],y[1],{set(){d({target:this});}},false,h))),()=>{f.forEach(y=>y());}}function je(t){let e=[];function r(n,i){if(ur&&n.parentRule instanceof CSSGroupingRule||hr&&n.parentRule instanceof CSSMediaRule||pr&&n.parentRule instanceof CSSSupportsRule||fr&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(a);}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(a);}return i}return r(t,e)}function ce(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function bn({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:f}=ce(this,e,r.styleMirror);return (p&&p!==-1||f&&f!==-1)&&t({id:p,styleId:f,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}=ce(this,e,r.styleMirror);return (u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,removes:[{index:d}]}),o.apply(this,[d])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:p}=ce(this,e,r.styleMirror);return (u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replace:d}),a.apply(this,[d])});let s;n.CSSStyleSheet.prototype.replaceSync&&(s=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:p}=ce(this,e,r.styleMirror);return (u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),s.apply(this,[d])});let c={};ur?c.CSSGroupingRule=n.CSSGroupingRule:(hr&&(c.CSSMediaRule=n.CSSMediaRule),fr&&(c.CSSConditionRule=n.CSSConditionRule),pr&&(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,f){let{id:h,styleId:v}=ce(this.parentStyleSheet,e,r.styleMirror);return (h&&h!==-1||v&&v!==-1)&&t({id:h,styleId:v,adds:[{rule:p,index:[...je(this),f||0]}]}),l[d].insertRule.apply(this,[p,f])},u.prototype.deleteRule=function(p){let{id:f,styleId:h}=ce(this.parentStyleSheet,e,r.styleMirror);return (f&&f!==-1||h&&h!==-1)&&t({id:f,styleId:h,removes:[{index:[...je(this),p]}]}),l[d].deleteRule.apply(this,[p])};}),()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule;});}}function Et({mirror:t,stylesheetManager:e},r){var n,i,o;let a=null;r.nodeName==="#document"?a=t.getId(r):a=t.getId(r.host);let s=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(s==null?void 0:s.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!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(a!==null&&a!==-1)try{e.adoptStyleSheets(l,a);}catch(p){}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set});})}function Sn({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(s,c,l){var d;if(r.has(s))return o.apply(this,[s,c,l]);let{id:u,styleId:p}=ce((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:s,value:c,priority:l},index:je(this.parentRule)}),o.apply(this,[s,c,l])};let a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(s){var c;if(r.has(s))return a.apply(this,[s]);let{id:l,styleId:d}=ce((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:s},index:je(this.parentRule)}),a.apply(this,[s])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a;}}function wn({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i}){let o=s=>Se(c=>{let l=Ne(c);if(!l||x(l,e,r,true))return;let{currentTime:d,volume:u,muted:p,playbackRate:f}=l;t({type:s,id:n.getId(l),currentTime:d,volume:u,muted:p,playbackRate:f});},i.media||500),a=[_("play",o(0)),_("pause",o(1)),_("seeked",o(2)),_("volumechange",o(3)),_("ratechange",o(4))];return ()=>{a.forEach(s=>s());}}function An({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 a=ee(e.fonts,"add",function(s){return function(c){return setTimeout(()=>{let l=i.get(c);l&&(t(l),i.delete(c));},0),s.apply(this,[c])}});return n.push(()=>{r.FontFace=o;}),n.push(a),()=>{n.forEach(s=>s());}}function kn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=t,a=true,s=()=>{let c=e.getSelection();if(!c||a&&(c!=null&&c.isCollapsed))return;a=c.isCollapsed||false;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let p=c.getRangeAt(u),{startContainer:f,startOffset:h,endContainer:v,endOffset:I}=p;x(f,n,i,true)||x(v,n,i,true)||l.push({start:r.getId(f),startOffset:h,end:r.getId(v),endOffset:I});}o({ranges:l});};return s(),_("selectionchange",s)}function Tn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:f}=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),a(...h);},t.inputCb=(...h)=>{e.input&&e.input(...h),s(...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),f(...h);};}function mr(t,e={}){let r=t.doc.defaultView;if(!r)return ()=>{};Tn(t,e);let n=kt(t,t.doc),i=gn(t),o=vn(t),a=Tt(t),s=yn(t),c=Cn(t),l=wn(t),d=bn(t,{win:r}),u=Et(t,t.doc),p=Sn(t,{win:r}),f=t.collectFonts?An(t):()=>{},h=kn(t),v=[];for(let I of t.plugins)v.push(I.observer(I.callback,r,I.options));return ()=>{le.forEach(I=>I.reset()),n.disconnect(),i(),o(),a(),s(),c(),l(),d(),u(),p(),f(),h(),v.forEach(I=>I());}}var Oe=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),a=i||this.getRemoteIdToIdMap(e),s=o.get(r);return s||(s=this.generateIdFn(),o.set(r,s),a.set(s,r)),s}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 Qe=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Oe(vt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Oe(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,true),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:true}),(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:b.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}};case w.Meta:case w.Load:case w.DomContentLoaded:return false;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 b.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 b.Drag:case b.TouchMove:case b.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,e,["id"]);}),r;case b.ViewportResize:return false;case b.MediaInteraction:case b.MouseInteraction:case b.Scroll:case b.CanvasMutation:case b.Input:return this.replaceIds(r.data,e,["id"]),r;case b.StyleSheetRule:case b.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case b.Font:return r;case b.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"]);}),r;case b.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 Xe=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(ee(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){he(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),kt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Tt(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)),Et({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e);},0)));}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ee(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 gr(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 vr(t,e,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o);})}return new(r||(r=Promise))(function(o,a){function s(d){try{l(n.next(d));}catch(u){a(u);}}function c(d){try{l(n.throw(d));}catch(u){a(u);}}function l(d){d.done?o(d.value):i(d.value).then(s,c);}l((n=n.apply(t,[])).next());})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",En=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(Le=0;Le<we.length;Le++)En[we.charCodeAt(Le)]=Le;var Le,yr=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=we[e[r]>>2],i+=we[(e[r]&3)<<4|e[r+1]>>4],i+=we[(e[r+1]&15)<<2|e[r+2]>>6],i+=we[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 Ir=new Map;function Rn(t,e){let r=Ir.get(t);return r||(r=new Map,Ir.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Rt=(t,e,r)=>{if(!t||!(Cr(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=Rn(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function qe(t,e,r){if(t instanceof Array)return t.map(n=>qe(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=yr(t);return {rr_type:n,base64:i}}else {if(t instanceof DataView)return {rr_type:t.constructor.name,args:[qe(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:[qe(t.data,e,r),t.width,t.height]};if(Cr(t,e)||typeof t=="object"){let n=t.constructor.name,i=Rt(t,e,r);return {rr_type:n,index:i}}}}return t}var $e=(t,e,r)=>[...t].map(n=>qe(n,e,r)),Cr=(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 br(t,e,r,n){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;let s=ee(e.CanvasRenderingContext2D.prototype,a,function(c){return function(...l){return x(this.canvas,r,n,!0)||setTimeout(()=>{let d=$e([...l],e,this);t(this.canvas,{type:oe["2D"],property:a,args:d});},0),c.apply(this,l)}});i.push(s);}catch(s){let c=me(e.CanvasRenderingContext2D.prototype,a,{set(l){t(this.canvas,{type:oe["2D"],property:a,args:[l],setter:true});}});i.push(c);}return ()=>{i.forEach(a=>a());}}function xt(t,e,r){let n=[];try{let i=ee(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(a,...s){return x(this,e,r,!0)||"__context"in this||(this.__context=a),o.apply(this,[a,...s])}});n.push(i);}catch(i){console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{n.forEach(i=>i());}}function Sr(t,e,r,n,i,o,a){let s=[],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=ee(t,l,function(u){return function(...p){let f=u.apply(this,p);if(Rt(f,a,this),!x(this.canvas,n,i,!0)){let h=$e([...p],a,this),v={type:e,property:l,args:h};r(this.canvas,v);}return f}});s.push(d);}catch(d){let u=me(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:true});}});s.push(u);}return s}function wr(t,e,r,n,i){let o=[];return o.push(...Sr(e.WebGLRenderingContext.prototype,oe.WebGL,t,r,n,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Sr(e.WebGL2RenderingContext.prototype,oe.WebGL2,t,r,n,i,e)),()=>{o.forEach(a=>a());}}var Mt=null;try{Ar=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ct=="function"&&ct("worker_threads"),Mt=Ar.Worker;}catch(t){}var Ar;function xn(t,e){return Buffer.from(t,"base64").toString("utf8")}function kr(t,e,r){var o=xn(t),a=o.indexOf(`
|
|
4
|
-
`,10)+1,
|
|
5
|
-
`,10)+1,s=o.substring(a)+(""),c=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(c)}function Tr(t,e,r){var n;return function(o){return n=n||Nn(t),new Worker(n,o)}}var On=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Er(){return On}function Rr(t,e,r){return Er()?kr(t):Tr(t)}var xr=Rr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");var et=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,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:a,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,i,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:s});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(e,r,n,i,o){let a=xt(r,n,i),s=new Map,c=new xr;c.onmessage=h=>{let{id:v}=h.data;if(s.set(v,false),!("base64"in h.data))return;let{base64:I,type:y,width:m,height:g}=h.data;this.mutationCb({id:v,type:oe["2D"],commands:[{property:"clearRect",args:[0,0,m,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=>{x(v,n,i,true)||h.push(v);}),h},f=h=>{if(d&&h-d<l){u=requestAnimationFrame(f);return}d=h,p().forEach(v=>vr(this,void 0,void 0,function*(){var I;let y=this.mirror.getId(v);if(s.get(y))return;if(s.set(y,true),["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)===false&&(g==null||g.clear(g.COLOR_BUFFER_BIT));}let m=yield createImageBitmap(v);c.postMessage({id:y,bitmap:m,width:v.width,height:v.height,dataURLOptions:o.dataURLOptions},[m]);})),u=requestAnimationFrame(f);};u=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(u);};}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=xt(e,r,n),o=br(this.processMutation.bind(this),e,r,n),a=wr(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{i(),o(),a();};}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(a=>gr(a,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e);}};var tt=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ue,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 a;if(this.styleMirror.has(o))a=this.styleMirror.getId(o);else {a=this.styleMirror.add(o);let s=Array.from(o.rules||CSSRule);i.push({styleId:a,rules:s.map((c,l)=>({rule:gt(c),index:l}))});}n.styleIds.push(a);}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(e){}};function B(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var M,rt,Nt,nt=false,te=qt();function ge(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=true,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:p,maskInputFn:f,maskTextFn:h,hooks:v,packFn:I,sampling:y={},dataURLOptions:m={},mousemoveWait:g,recordCanvas:S=false,recordCrossOriginIframes:D=false,userTriggeredOnInput:O=false,collectFonts:L=false,inlineImages:T=false,plugins:Z,keepIframeSrcFn:K=()=>false,ignoreCSSAttributes:j=new Set([])}=t,Q=D?window.parent===window:true,X=false;if(!Q)try{window.parent.document,X=!1;}catch(C){X=true;}if(Q&&!e)throw new Error("emit function is required");g!==void 0&&y.mousemove===void 0&&(y.mousemove=g),te.reset();let P=d===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:u!==void 0?u:{password:true},z=p===true||p==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all"}:p||{};rr();let q,re=0,ie=C=>{for(let W of Z||[])W.eventProcessor&&(C=W.eventProcessor(C));return I&&(C=I(C)),C};M=(C,W)=>{var V;if(!((V=le[0])===null||V===void 0)&&V.isFrozen()&&C.type!==w.FullSnapshot&&!(C.type===w.IncrementalSnapshot&&C.data.source===b.Mutation)&&le.forEach(R=>R.unfreeze()),Q)e==null||e(ie(C),W);else if(X){let R={type:"rrweb",event:ie(C),isCheckout:W};window.parent.postMessage(R,"*");}if(C.type===w.FullSnapshot)q=C,re=0;else if(C.type===w.IncrementalSnapshot){if(C.data.source===b.Mutation&&C.data.isAttachIframe)return;re++;let R=n&&re>=n,J=r&&C.timestamp-q.timestamp>r;(R||J)&&rt(true);}};let G=C=>{M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.Mutation},C)}));},Y=C=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.Scroll},C)})),se=C=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},C)})),N=C=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},C)})),$=new tt({mutationCb:G,adoptedStyleSheetCb:N}),ne=new Qe({mirror:te,mutationCb:G,stylesheetManager:$,recordCrossOriginIframes:D,wrappedEmit:M});for(let C of Z||[])C.getMirror&&C.getMirror({nodeMirror:te,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});Nt=new et({recordCanvas:S,mutationCb:se,win:window,blockClass:i,blockSelector:o,mirror:te,sampling:y.canvas,dataURLOptions:m});let ye=new Xe({mutationCb:G,scrollCb:Y,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:P,dataURLOptions:m,maskTextFn:h,maskInputFn:f,recordCanvas:S,inlineImages:T,sampling:y,slimDOMOptions:z,iframeManager:ne,stylesheetManager:$,canvasManager:Nt,keepIframeSrcFn:K},mirror:te});rt=(C=false)=>{var W,V,R,J,A,H;M(B({type:w.Meta,data:{href:window.location.href,width:Ve(),height:Ge()}}),C),$.reset(),le.forEach(U=>U.lock());let ke=$t(document,{mirror:te,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:P,maskTextFn:h,slimDOM:z,dataURLOptions:m,recordCanvas:S,inlineImages:T,onSerialize:U=>{Ze(U,te)&&ne.addIframe(U),Ke(U,te)&&$.trackLinkElement(U),ze(U)&&ye.addShadowRoot(U.shadowRoot,document);},onIframeLoad:(U,at)=>{ne.attachIframe(U,at),ye.observeAttachShadow(U);},onStylesheetLoad:(U,at)=>{$.attachLinkElement(U,at);},keepIframeSrcFn:K});if(!ke)return console.warn("Failed to snapshot the document");M(B({type:w.FullSnapshot,data:{node:ke,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((V=(W=document==null?void 0:document.body)===null||W===void 0?void 0:W.parentElement)===null||V===void 0?void 0:V.scrollLeft)||((R=document==null?void 0:document.body)===null||R===void 0?void 0:R.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((A=(J=document==null?void 0:document.body)===null||J===void 0?void 0:J.parentElement)===null||A===void 0?void 0:A.scrollTop)||((H=document==null?void 0:document.body)===null||H===void 0?void 0:H.scrollTop)||0}}})),le.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document));};try{let C=[];C.push(_("DOMContentLoaded",()=>{M(B({type:w.DomContentLoaded,data:{}}));}));let W=R=>{var J;return mr({mutationCb:G,mousemoveCb:(A,H)=>M(B({type:w.IncrementalSnapshot,data:{source:H,positions:A}})),mouseInteractionCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},A)})),scrollCb:Y,viewportResizeCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},A)})),inputCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.Input},A)})),mediaInteractionCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},A)})),styleSheetRuleCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},A)})),styleDeclarationCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},A)})),canvasMutationCb:se,fontCb:A=>M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.Font},A)})),selectionCb:A=>{M(B({type:w.IncrementalSnapshot,data:Object.assign({source:b.Selection},A)}));},blockClass:i,ignoreClass:a,maskTextClass:s,maskTextSelector:c,maskInputOptions:P,inlineStylesheet:l,sampling:y,recordCanvas:S,inlineImages:T,userTriggeredOnInput:O,collectFonts:L,doc:R,maskInputFn:f,maskTextFn:h,keepIframeSrcFn:K,blockSelector:o,slimDOMOptions:z,dataURLOptions:m,mirror:te,iframeManager:ne,stylesheetManager:$,shadowDomManager:ye,canvasManager:Nt,ignoreCSSAttributes:j,plugins:((J=Z==null?void 0:Z.filter(A=>A.observer))===null||J===void 0?void 0:J.map(A=>({observer:A.observer,options:A.options,callback:H=>M(B({type:w.Plugin,data:{plugin:A.name,payload:H}}))})))||[]},v)};ne.addLoadListener(R=>{C.push(W(R.contentDocument));});let V=()=>{rt(),C.push(W(document)),nt=!0;};return document.readyState==="interactive"||document.readyState==="complete"?V():C.push(_("load",()=>{M(B({type:w.Load,data:{}})),V();},window)),()=>{C.forEach(R=>R()),nt=!1;}}catch(C){console.warn(C);}}ge.addCustomEvent=(t,e)=>{if(!nt)throw new Error("please add custom event after start recording");M(B({type:w.Custom,data:{tag:t,payload:e}}));};ge.freezePage=()=>{le.forEach(t=>t.freeze());};ge.takeFullSnapshot=t=>{if(!nt)throw new Error("please take full snapshot after start recording");rt(t);};ge.mirror=te;var it=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:false,maskAllInputs:this.opts.maskAllInputs,maskTextClass:this.opts.maskTextClass,blockClass:this.opts.blockClass};this.stopRecording=(i=ge(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;}};var Ot="2.0.2";function Mr(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 Ln(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 Pn(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 Bn(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function Fn(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===true?"mobile":Mr(t)}function Nr(t){var s,c,l,d,u,p,f,h,v,I,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:Ot};let e=navigator.userAgent||"",r=Bn(),n=r.mobile!==void 0||r.platform?Fn(e,r):Mr(e),i="";(c=(s=window.matchMedia)==null?void 0:s.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 a=typeof navigator.languages!="undefined"&&navigator.languages.length?[...navigator.languages]:navigator.language?[navigator.language]:[];return {sessionId:t,timestamp:Date.now(),device:n,os:Ln(e),browser:Pn(e),language:navigator.language||"",languages:a,colorScheme:i,screenWidth:(f=(p=window.screen)==null?void 0:p.width)!=null?f: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:(m=window.devicePixelRatio)!=null?m:1,timeZone:o,sdkVersion:Ot}}function Dn(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 _n(t){var r;return ((r=t.getAttribute("data-alphana-currency"))==null?void 0:r.trim())||void 0}function Wn(t){var r;return ((r=t.getAttribute("data-alphana-event-name"))==null?void 0:r.trim())||void 0}function Un(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 Gn(t,e){var o,a,s;let r=(o=Dn(t))!=null?o:e.value,n=(a=_n(t))!=null?a:e.currency;if(r==null||!n)return null;let i=(s=Wn(t))!=null?s:e.eventName;return {amount:r,currency:n,eventName:i}}var ot=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=false;this.onClick=e=>{let r=Un(e.target,this.bindingsById);if(!r)return;let{binding:n,matchedEl:i}=r;if(n.eventKind==="goal"){this.handlers.onGoal(n);return}let o=Gn(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,true),this.attached=true);}destroy(){!this.attached||typeof document=="undefined"||(document.removeEventListener("click",this.onClick,true),this.attached=false);}};var Or="alphana-cookie-consent";function Ae(){var t;typeof document!="undefined"&&((t=document.getElementById(Or))==null||t.remove());}function Lr(t,e){if(typeof document=="undefined")return;Ae();let r=document.createElement("div");r.id=Or,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,a=document.createElement("style");a.textContent=`
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,er={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be);},has(){return console.error(be),false},reset(){console.error(be);}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(er=new Proxy(er,{get(t,e,r){return e==="map"&&console.error(be),Reflect.get(t,e,r)}}));function Se(t,e,r={}){let n=null,i=0;return function(...o){let s=Date.now();!i&&r.leading===false&&(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!==false&&(n=setTimeout(()=>{i=r.leading===false?0:Date.now(),n=null,t.apply(c,o);},a));}}function me(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);}}),()=>me(t,e,o||{},true)}function ee(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 Ge(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ve(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function M(t,e,r,n){if(!t)return false;let i=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!i)return false;if(typeof e=="string"){if(i.classList.contains(e)||n&&i.closest("."+e)!==null)return true}else if(Re(i,e,n))return true;return !!(r&&(t.matches(r)||n&&i.closest(r)!==null))}function tr(t,e){return e.getId(t)!==-1}function He(t,e){return e.getId(t)===pe}function bt(t,e){if(fe(t))return false;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?false:t.parentNode?bt(t.parentNode,e):true:true}function St(t){return !!t.changedTouches}function rr(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 true;while(r=r&&r.parentNode);return false});}function Ze(t,e){return !!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Ke(t,e){return !!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function ze(t){return !!(t!=null&&t.shadowRoot)}var Ue=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||{}),Ye=(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))(Ye||{}),oe=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(oe||{});function nr(t){return "__ln"in t}var wt=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&&nr(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&&nr(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--);}},ir=(t,e)=>`${t}@${e}`,je=class{constructor(){this.frozen=false,this.locked=false,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 wt,n=a=>{let c=a,l=pe;for(;l===pe;)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=fe(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=ue(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,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=>{Ze(f,this.mirror)&&this.iframeManager.addIframe(f),Ke(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),ze(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()))or(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||i(a);for(let a of Array.from(this.addedSet.values()))!sr(this.droppedSet,a)&&!or(this.removes,a,this.mirror)||sr(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(!He(e.target,this.mirror))switch(e.type){case "characterData":{let r=e.target.textContent;!M(e.target,this.blockClass,this.blockSelector,false)&&r!==e.oldValue&&this.texts.push({value:Ct(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=Me({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),M(e.target,this.blockClass,this.blockSelector,false)||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]=false);}else i.attributes[e.attributeName]=It(this.doc,r.tagName,e.attributeName,n);break}case "childList":{if(M(e.target,this.blockClass,this.blockSelector,true))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),i=fe(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);M(e.target,this.blockClass,this.blockSelector,false)||He(r,this.mirror)||!tr(r,this.mirror)||(this.addedSet.has(r)?(At(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||bt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ir(n,i)]?At(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:fe(e.target)&&he(e.target)?true:void 0})),this.mapRemoves.push(r));});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(He(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[ir(this.mirror.getId(e),n)]=true);}else this.addedSet.add(e),this.droppedSet.delete(e);M(e,this.blockClass,this.blockSelector,false)||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=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function At(t,e){t.delete(e),e.childNodes.forEach(r=>At(t,r));}function or(t,e,r){return t.length===0?false:ar(t,e,r)}function ar(t,e,r){let{parentNode:n}=e;if(!n)return false;let i=r.getId(n);return t.some(o=>o.id===i)?true:ar(t,n,r)}function sr(t,e){return t.size===0?false:cr(t,e)}function cr(t,e){let{parentNode:r}=e;return r?t.has(r)?true:cr(t,r):false}var le=[],ur=typeof CSSGroupingRule!="undefined",hr=typeof CSSMediaRule!="undefined",pr=typeof CSSSupportsRule!="undefined",fr=typeof CSSConditionRule!="undefined";function Ne(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 kt(t,e){var r,n;let i=new je;le.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:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),a}function gn({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===false)return ()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,s=[],a,c=Se(u=>{let p=Date.now()-a;t(s.map(m=>(m.timeOffset-=p,m)),u),s=[],a=null;},o),l=Se(u=>{let p=Ne(u),{clientX:m,clientY:h}=St(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:false}),d=[_("mousemove",l,r),_("touchmove",l,r),_("drag",l,r)];return ()=>{d.forEach(u=>u());}}function yn({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===false)return ()=>{};let s=o.mouseInteraction===true||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],c=l=>d=>{let u=Ne(d);if(M(u,n,i,true))return;let p=St(d)?d.changedTouches[0]:d;if(!p)return;let m=r.getId(u),{clientX:h,clientY:v}=p;t({type:Ye[l],id:m,x:h,y:v});};return Object.keys(Ye).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&s[l]!==false).forEach(l=>{let d=l.toLowerCase(),u=c(l);a.push(_(d,u,e));}),()=>{a.forEach(l=>l());}}function Tt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:i,sampling:o}){let s=Se(a=>{let c=Ne(a);if(!c||M(c,n,i,true))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 _("scroll",s,e)}function vn({viewportResizeCb:t}){let e=-1,r=-1,n=Se(()=>{let i=Ge(),o=Ve();(e!==i||r!==o)&&(t({width:Number(o),height:Number(i)}),e=i,r=o);},200);return _("resize",n,window)}function lr(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var In=["INPUT","TEXTAREA","SELECT"],dr=new WeakMap;function Cn({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=Ne(y),g=y.isTrusted;if(f&&f.tagName==="OPTION"&&(f=f.parentElement),!f||!f.tagName||In.indexOf(f.tagName)<0||M(f,n,i,true))return;let b=f.type;if(f.classList.contains(o))return;let x=f.value,L=false;b==="radio"||b==="checkbox"?L=f.checked:(s[f.tagName.toLowerCase()]||s[b])&&(x=Me({maskInputOptions:s,tagName:f.tagName,type:b,value:x,maskInputFn:a})),u(f,lr({text:x,isChecked:L,userTriggered:g},l));let P=f.name;b==="radio"&&P&&L&&e.querySelectorAll(`input[type="radio"][name="${P}"]`).forEach(T=>{T!==f&&u(T,lr({text:T.value,isChecked:!L,userTriggered:false},l));});}function u(y,f){let g=dr.get(y);if(!g||g.text!==f.text||g.isChecked!==f.isChecked){dr.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=>_(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=>me(y[0],y[1],{set(){d({target:this});}},false,h))),()=>{m.forEach(y=>y());}}function Je(t){let e=[];function r(n,i){if(ur&&n.parentRule instanceof CSSGroupingRule||hr&&n.parentRule instanceof CSSMediaRule||pr&&n.parentRule instanceof CSSSupportsRule||fr&&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 ce(t,e,r){let n,i;return t?(t.ownerNode?n=e.getId(t.ownerNode):i=r.getId(t),{styleId:i,id:n}):{}}function bn({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}=ce(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}=ce(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}=ce(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}=ce(this,e,r.styleMirror);return (u&&u!==-1||p&&p!==-1)&&t({id:u,styleId:p,replaceSync:d}),a.apply(this,[d])});let c={};ur?c.CSSGroupingRule=n.CSSGroupingRule:(hr&&(c.CSSMediaRule=n.CSSMediaRule),fr&&(c.CSSConditionRule=n.CSSConditionRule),pr&&(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}=ce(this.parentStyleSheet,e,r.styleMirror);return (h&&h!==-1||v&&v!==-1)&&t({id:h,styleId:v,adds:[{rule:p,index:[...Je(this),m||0]}]}),l[d].insertRule.apply(this,[p,m])},u.prototype.deleteRule=function(p){let{id:m,styleId:h}=ce(this.parentStyleSheet,e,r.styleMirror);return (m&&m!==-1||h&&h!==-1)&&t({id:m,styleId:h,removes:[{index:[...Je(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 Et({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 Sn({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}=ce((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:Je(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}=ce((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:Je(this.parentRule)}),s.apply(this,[a])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s;}}function wn({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:i}){let o=a=>Se(c=>{let l=Ne(c);if(!l||M(l,e,r,true))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=[_("play",o(0)),_("pause",o(1)),_("seeked",o(2)),_("volumechange",o(3)),_("ratechange",o(4))];return ()=>{s.forEach(a=>a());}}function An({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=ee(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 kn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=t,s=true,a=()=>{let c=e.getSelection();if(!c||s&&(c!=null&&c.isCollapsed))return;s=c.isCollapsed||false;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;M(m,n,i,true)||M(v,n,i,true)||l.push({start:r.getId(m),startOffset:h,end:r.getId(v),endOffset:I});}o({ranges:l});};return a(),_("selectionchange",a)}function Tn(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 mr(t,e={}){let r=t.doc.defaultView;if(!r)return ()=>{};Tn(t,e);let n=kt(t,t.doc),i=gn(t),o=yn(t),s=Tt(t),a=vn(t),c=Cn(t),l=wn(t),d=bn(t,{win:r}),u=Et(t,t.doc),p=Sn(t,{win:r}),m=t.collectFonts?An(t):()=>{},h=kn(t),v=[];for(let I of t.plugins)v.push(I.observer(I.callback,r,I.options));return ()=>{le.forEach(I=>I.reset()),n.disconnect(),i(),o(),s(),a(),c(),l(),d(),u(),p(),m(),h(),v.forEach(I=>I());}}var Oe=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 Qe=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Oe(yt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Oe(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,true),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:true}),(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:true}};case w.Meta:case w.Load:case w.DomContentLoaded:return false;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 false;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 Xe=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(ee(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){he(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),kt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Tt(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)),Et({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e);},0)));}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ee(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 gr(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 yr(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,[])).next());})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",En=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(Le=0;Le<we.length;Le++)En[we.charCodeAt(Le)]=Le;var Le,vr=function(t){var e=new Uint8Array(t),r,n=e.length,i="";for(r=0;r<n;r+=3)i+=we[e[r]>>2],i+=we[(e[r]&3)<<4|e[r+1]>>4],i+=we[(e[r+1]&15)<<2|e[r+2]>>6],i+=we[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 Ir=new Map;function xn(t,e){let r=Ir.get(t);return r||(r=new Map,Ir.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var xt=(t,e,r)=>{if(!t||!(Cr(t,e)||typeof t=="object"))return;let n=t.constructor.name,i=xn(r,n),o=i.indexOf(t);return o===-1&&(o=i.length,i.push(t)),o};function qe(t,e,r){if(t instanceof Array)return t.map(n=>qe(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=vr(t);return {rr_type:n,base64:i}}else {if(t instanceof DataView)return {rr_type:t.constructor.name,args:[qe(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:[qe(t.data,e,r),t.width,t.height]};if(Cr(t,e)||typeof t=="object"){let n=t.constructor.name,i=xt(t,e,r);return {rr_type:n,index:i}}}}return t}var $e=(t,e,r)=>[...t].map(n=>qe(n,e,r)),Cr=(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 br(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=ee(e.CanvasRenderingContext2D.prototype,s,function(c){return function(...l){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=$e([...l],e,this);t(this.canvas,{type:oe["2D"],property:s,args:d});},0),c.apply(this,l)}});i.push(a);}catch(a){let c=me(e.CanvasRenderingContext2D.prototype,s,{set(l){t(this.canvas,{type:oe["2D"],property:s,args:[l],setter:true});}});i.push(c);}return ()=>{i.forEach(s=>s());}}function Rt(t,e,r){let n=[];try{let i=ee(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(s,...a){return M(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 Sr(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=ee(t,l,function(u){return function(...p){let m=u.apply(this,p);if(xt(m,s,this),!M(this.canvas,n,i,!0)){let h=$e([...p],s,this),v={type:e,property:l,args:h};r(this.canvas,v);}return m}});a.push(d);}catch(d){let u=me(t,l,{set(p){r(this.canvas,{type:e,property:l,args:[p],setter:true});}});a.push(u);}return a}function wr(t,e,r,n,i){let o=[];return o.push(...Sr(e.WebGLRenderingContext.prototype,oe.WebGL,t,r,n,i,e)),typeof e.WebGL2RenderingContext!="undefined"&&o.push(...Sr(e.WebGL2RenderingContext.prototype,oe.WebGL2,t,r,n,i,e)),()=>{o.forEach(s=>s());}}var Mt=null;try{Ar=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ct=="function"&&ct("worker_threads"),Mt=Ar.Worker;}catch(t){}var Ar;function Rn(t,e){return Buffer.from(t,"base64").toString("utf8")}function kr(t,e,r){var o=Rn(t),s=o.indexOf(`
|
|
4
|
+
`,10)+1,a=o.substring(s)+("");return function(l){return new Mt(a,Object.assign({},l,{eval:true}))}}function Mn(t,e){var r=atob(t);return r}function Nn(t,e,r){var o=Mn(t),s=o.indexOf(`
|
|
5
|
+
`,10)+1,a=o.substring(s)+(""),c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}function Tr(t,e,r){var n;return function(o){return n=n||Nn(t),new Worker(n,o)}}var On=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function Er(){return On}function xr(t,e,r){return Er()?kr(t):Tr(t)}var Rr=xr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");var et=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,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=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(e,r,n,i,o){let s=Rt(r,n,i),a=new Map,c=new Rr;c.onmessage=h=>{let{id:v}=h.data;if(a.set(v,false),!("base64"in h.data))return;let{base64:I,type:y,width:f,height:g}=h.data;this.mutationCb({id:v,type:oe["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=>{M(v,n,i,true)||h.push(v);}),h},m=h=>{if(d&&h-d<l){u=requestAnimationFrame(m);return}d=h,p().forEach(v=>yr(this,void 0,void 0,function*(){var I;let y=this.mirror.getId(v);if(a.get(y))return;if(a.set(y,true),["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)===false&&(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=Rt(e,r,n),o=br(this.processMutation.bind(this),e,r,n),s=wr(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=>gr(s,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(e);}};var tt=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Ue,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:gt(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 F(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var N,rt,Nt,nt=false,te=qt();function ge(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=true,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:p,maskInputFn:m,maskTextFn:h,hooks:v,packFn:I,sampling:y={},dataURLOptions:f={},mousemoveWait:g,recordCanvas:b=false,recordCrossOriginIframes:x=false,userTriggeredOnInput:L=false,collectFonts:P=false,inlineImages:T=false,plugins:Z,keepIframeSrcFn:K=()=>false,ignoreCSSAttributes:J=new Set([])}=t,Q=x?window.parent===window:true,X=false;if(!Q)try{window.parent.document,X=!1;}catch(C){X=true;}if(Q&&!e)throw new Error("emit function is required");g!==void 0&&y.mousemove===void 0&&(y.mousemove=g),te.reset();let B=d===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:u!==void 0?u:{password:true},z=p===true||p==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all"}:p||{};rr();let q,re=0,ie=C=>{for(let W of Z||[])W.eventProcessor&&(C=W.eventProcessor(C));return I&&(C=I(C)),C};N=(C,W)=>{var V;if(!((V=le[0])===null||V===void 0)&&V.isFrozen()&&C.type!==w.FullSnapshot&&!(C.type===w.IncrementalSnapshot&&C.data.source===S.Mutation)&&le.forEach(R=>R.unfreeze()),Q)e==null||e(ie(C),W);else if(X){let R={type:"rrweb",event:ie(C),isCheckout:W};window.parent.postMessage(R,"*");}if(C.type===w.FullSnapshot)q=C,re=0;else if(C.type===w.IncrementalSnapshot){if(C.data.source===S.Mutation&&C.data.isAttachIframe)return;re++;let R=n&&re>=n,j=r&&C.timestamp-q.timestamp>r;(R||j)&&rt(true);}};let G=C=>{N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.Mutation},C)}));},Y=C=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.Scroll},C)})),se=C=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.CanvasMutation},C)})),O=C=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.AdoptedStyleSheet},C)})),$=new tt({mutationCb:G,adoptedStyleSheetCb:O}),ne=new Qe({mirror:te,mutationCb:G,stylesheetManager:$,recordCrossOriginIframes:x,wrappedEmit:N});for(let C of Z||[])C.getMirror&&C.getMirror({nodeMirror:te,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});Nt=new et({recordCanvas:b,mutationCb:se,win:window,blockClass:i,blockSelector:o,mirror:te,sampling:y.canvas,dataURLOptions:f});let ve=new Xe({mutationCb:G,scrollCb:Y,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:B,dataURLOptions:f,maskTextFn:h,maskInputFn:m,recordCanvas:b,inlineImages:T,sampling:y,slimDOMOptions:z,iframeManager:ne,stylesheetManager:$,canvasManager:Nt,keepIframeSrcFn:K},mirror:te});rt=(C=false)=>{var W,V,R,j,A,H;N(F({type:w.Meta,data:{href:window.location.href,width:Ve(),height:Ge()}}),C),$.reset(),le.forEach(U=>U.lock());let ke=$t(document,{mirror:te,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:B,maskTextFn:h,slimDOM:z,dataURLOptions:f,recordCanvas:b,inlineImages:T,onSerialize:U=>{Ze(U,te)&&ne.addIframe(U),Ke(U,te)&&$.trackLinkElement(U),ze(U)&&ve.addShadowRoot(U.shadowRoot,document);},onIframeLoad:(U,at)=>{ne.attachIframe(U,at),ve.observeAttachShadow(U);},onStylesheetLoad:(U,at)=>{$.attachLinkElement(U,at);},keepIframeSrcFn:K});if(!ke)return console.warn("Failed to snapshot the document");N(F({type:w.FullSnapshot,data:{node:ke,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((V=(W=document==null?void 0:document.body)===null||W===void 0?void 0:W.parentElement)===null||V===void 0?void 0:V.scrollLeft)||((R=document==null?void 0:document.body)===null||R===void 0?void 0:R.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((A=(j=document==null?void 0:document.body)===null||j===void 0?void 0:j.parentElement)===null||A===void 0?void 0:A.scrollTop)||((H=document==null?void 0:document.body)===null||H===void 0?void 0:H.scrollTop)||0}}})),le.forEach(U=>U.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document));};try{let C=[];C.push(_("DOMContentLoaded",()=>{N(F({type:w.DomContentLoaded,data:{}}));}));let W=R=>{var j;return mr({mutationCb:G,mousemoveCb:(A,H)=>N(F({type:w.IncrementalSnapshot,data:{source:H,positions:A}})),mouseInteractionCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.MouseInteraction},A)})),scrollCb:Y,viewportResizeCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.ViewportResize},A)})),inputCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.Input},A)})),mediaInteractionCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.MediaInteraction},A)})),styleSheetRuleCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.StyleSheetRule},A)})),styleDeclarationCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.StyleDeclaration},A)})),canvasMutationCb:se,fontCb:A=>N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.Font},A)})),selectionCb:A=>{N(F({type:w.IncrementalSnapshot,data:Object.assign({source:S.Selection},A)}));},blockClass:i,ignoreClass:s,maskTextClass:a,maskTextSelector:c,maskInputOptions:B,inlineStylesheet:l,sampling:y,recordCanvas:b,inlineImages:T,userTriggeredOnInput:L,collectFonts:P,doc:R,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:K,blockSelector:o,slimDOMOptions:z,dataURLOptions:f,mirror:te,iframeManager:ne,stylesheetManager:$,shadowDomManager:ve,canvasManager:Nt,ignoreCSSAttributes:J,plugins:((j=Z==null?void 0:Z.filter(A=>A.observer))===null||j===void 0?void 0:j.map(A=>({observer:A.observer,options:A.options,callback:H=>N(F({type:w.Plugin,data:{plugin:A.name,payload:H}}))})))||[]},v)};ne.addLoadListener(R=>{C.push(W(R.contentDocument));});let V=()=>{rt(),C.push(W(document)),nt=!0;};return document.readyState==="interactive"||document.readyState==="complete"?V():C.push(_("load",()=>{N(F({type:w.Load,data:{}})),V();},window)),()=>{C.forEach(R=>R()),nt=!1;}}catch(C){console.warn(C);}}ge.addCustomEvent=(t,e)=>{if(!nt)throw new Error("please add custom event after start recording");N(F({type:w.Custom,data:{tag:t,payload:e}}));};ge.freezePage=()=>{le.forEach(t=>t.freeze());};ge.takeFullSnapshot=t=>{if(!nt)throw new Error("please take full snapshot after start recording");rt(t);};ge.mirror=te;var it=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:false,maskAllInputs:this.opts.maskAllInputs,maskTextClass:this.opts.maskTextClass,blockClass:this.opts.blockClass};this.stopRecording=(i=ge(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;}};var Ot="2.0.2";function Mr(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 Ln(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 Pn(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 Bn(){let e=navigator.userAgentData;return e?{mobile:e.mobile,platform:e.platform}:{}}function Fn(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===true?"mobile":Mr(t)}function Nr(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:Ot};let e=navigator.userAgent||"",r=Bn(),n=r.mobile!==void 0||r.platform?Fn(e,r):Mr(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:Ln(e),browser:Pn(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:Ot}}function Dn(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 _n(t){var r;return ((r=t.getAttribute("data-alphana-currency"))==null?void 0:r.trim())||void 0}function Wn(t){var r;return ((r=t.getAttribute("data-alphana-event-name"))==null?void 0:r.trim())||void 0}function Un(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 Gn(t,e){var o,s,a;let r=(o=Dn(t))!=null?o:e.value,n=(s=_n(t))!=null?s:e.currency;if(r==null||!n)return null;let i=(a=Wn(t))!=null?a:e.eventName;return {amount:r,currency:n,eventName:i}}var ot=class{constructor(e){this.handlers=e;this.bindingsById=new Map;this.attached=false;this.onClick=e=>{let r=Un(e.target,this.bindingsById);if(!r)return;let{binding:n,matchedEl:i}=r;if(n.eventKind==="goal"){this.handlers.onGoal(n);return}let o=Gn(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,true),this.attached=true);}destroy(){!this.attached||typeof document=="undefined"||(document.removeEventListener("click",this.onClick,true),this.attached=false);}};var Or="alphana-cookie-consent",Vn="https://alphana.ir",Hn="https://storage.alphana.ir/cdn/logos/Fav-Alphana.png";function Ae(){var t;typeof document!="undefined"&&((t=document.getElementById(Or))==null||t.remove());}function Lr(t,e){var b;if(typeof document=="undefined")return;Ae();let r=document.createElement("div");r.id=Or,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=`
|
|
6
6
|
:host { all: initial; }
|
|
7
7
|
.sheet {
|
|
8
8
|
pointer-events: auto;
|
|
9
9
|
margin: 12px;
|
|
10
|
-
padding: 16px 18px;
|
|
10
|
+
padding: 16px 18px 12px;
|
|
11
11
|
border-radius: ${o.borderRadius};
|
|
12
12
|
background: ${o.background};
|
|
13
13
|
color: ${o.text};
|
|
@@ -21,12 +21,28 @@ or you can use record.mirror to access the mirror instance during recording.`,er
|
|
|
21
21
|
font-weight: 650;
|
|
22
22
|
margin: 0 0 8px;
|
|
23
23
|
line-height: 1.35;
|
|
24
|
+
color: ${o.text};
|
|
24
25
|
}
|
|
25
26
|
.message {
|
|
26
27
|
font-size: 13px;
|
|
27
28
|
line-height: 1.55;
|
|
28
|
-
margin: 0 0
|
|
29
|
+
margin: 0 0 10px;
|
|
29
30
|
opacity: .92;
|
|
31
|
+
color: ${o.text};
|
|
32
|
+
}
|
|
33
|
+
a.policy {
|
|
34
|
+
color: ${o.primary};
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 1.3;
|
|
38
|
+
text-decoration: underline;
|
|
39
|
+
text-underline-offset: 2px;
|
|
40
|
+
display: inline-block;
|
|
41
|
+
margin: 0 0 14px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
a.policy:hover {
|
|
45
|
+
opacity: .85;
|
|
30
46
|
}
|
|
31
47
|
.actions {
|
|
32
48
|
display: flex;
|
|
@@ -43,6 +59,7 @@ or you can use record.mirror to access the mirror instance during recording.`,er
|
|
|
43
59
|
font-size: 13px;
|
|
44
60
|
font-weight: 600;
|
|
45
61
|
line-height: 1.2;
|
|
62
|
+
font-family: inherit;
|
|
46
63
|
}
|
|
47
64
|
.accept {
|
|
48
65
|
background: ${o.primary};
|
|
@@ -53,20 +70,46 @@ or you can use record.mirror to access the mirror instance during recording.`,er
|
|
|
53
70
|
color: ${o.text};
|
|
54
71
|
border: 1px solid color-mix(in srgb, ${o.text} 35%, transparent);
|
|
55
72
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
.footer {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
margin-top: 14px;
|
|
78
|
+
padding-top: 12px;
|
|
79
|
+
border-top: 1px solid color-mix(in srgb, ${o.text} 18%, transparent);
|
|
80
|
+
text-align: center;
|
|
81
|
+
}
|
|
82
|
+
a.brand {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
gap: 6px;
|
|
87
|
+
color: ${o.text};
|
|
88
|
+
opacity: .72;
|
|
89
|
+
font-size: 11px;
|
|
90
|
+
font-weight: 500;
|
|
91
|
+
line-height: 1.2;
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
a.brand:hover {
|
|
96
|
+
opacity: 1;
|
|
60
97
|
text-decoration: underline;
|
|
61
|
-
|
|
62
|
-
|
|
98
|
+
text-underline-offset: 2px;
|
|
99
|
+
}
|
|
100
|
+
a.brand img {
|
|
101
|
+
display: block;
|
|
102
|
+
width: 14px;
|
|
103
|
+
height: 14px;
|
|
104
|
+
object-fit: contain;
|
|
105
|
+
flex-shrink: 0;
|
|
63
106
|
}
|
|
64
107
|
@media (max-width: 480px) {
|
|
65
|
-
.sheet { margin: 8px; padding: 14px; }
|
|
108
|
+
.sheet { margin: 8px; padding: 14px 14px 10px; }
|
|
66
109
|
.actions { flex-direction: column-reverse; }
|
|
67
110
|
button { width: 100%; }
|
|
68
111
|
}
|
|
69
|
-
`;let s=document.createElement("div");s.className="sheet",s.setAttribute("dir",i),s.setAttribute("role","dialog"),s.setAttribute("aria-live","polite"),s.setAttribute("aria-label",t.title);let c=document.createElement("p");c.className="title",c.textContent=t.title;let l=document.createElement("p");if(l.className="message",l.textContent=t.message,s.append(c,l),t.policyUrl){let f=document.createElement("a");f.className="policy",f.href=t.policyUrl,f.target="_blank",f.rel="noopener noreferrer",f.textContent=i==="rtl"?"\u0633\u06CC\u0627\u0633\u062A \u062D\u0631\u06CC\u0645 \u062E\u0635\u0648\u0635\u06CC":"Privacy policy",s.append(f);}let d=document.createElement("div");d.className="actions";let u=document.createElement("button");u.type="button",u.className="reject",u.textContent=t.rejectLabel,u.addEventListener("click",()=>{Ae(),e.onReject();});let p=document.createElement("button");p.type="button",p.className="accept",p.textContent=t.acceptLabel,p.addEventListener("click",()=>{Ae(),e.onAccept();}),d.append(u,p),s.append(d),n.append(a,s),document.documentElement.appendChild(r);}var Pr="__alphana_consent__";function Vn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Hn(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e);}catch(r){}}function Br(){let t=Vn(Pr);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 Lt(t,e){let r={status:t,version:e,decidedAt:Date.now()};Hn(Pr,JSON.stringify(r));}var Dr="https://api.alphana.ir/api/events",Zn={endpoint:Dr,trackNavigation:true,trackTime:true,trackHeatmap:true,trackLogs:true,mouseSampleRate:.1,maxHeatmapPoints:2e3,batchSize:20,flushInterval:5e3,compressPayloads:true,compressionThresholdBytes:1024,sessionReplay:true,sessionReplayCheckoutEveryNms:6e5,sessionReplayInlineStylesheet:false,sessionReplayMaxEventsPerBatch:48,sessionReplayFlushIntervalMs:4e3,sessionReplayMaskAllInputs:true,sessionReplayMaskTextClass:"alphana-mask",sessionReplayBlockClass:"alphana-block"},Pe="__alphana_first_touch__",st="__alphana_last_touch__",Kn={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},zn=["gclid","fbclid","ttclid","msclkid"];function Yn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Jn(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e);}catch(r){}}function ve(t){let e=Yn(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 Fr(t,e){Jn(t,JSON.stringify(e));}function jn(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function Qn(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function Xn(t){var r;let e={};for(let[n,i]of Object.entries(Kn)){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 qn(t){var r;let e={};for(let n of zn){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 $n(t){switch(t.type){case "pageview":return {type:"pageview",data:{...t.data,path:k(t.data.path)}};case "timespent":return {type:"timespent",data:{...t.data,path:k(t.data.path)}};case "heatmap":return {type:"heatmap",data:{...t.data,path:k(t.data.path)}};case "rageclik":return {type:"rageclik",data:{...t.data,path:k(t.data.path)}};case "uturn":return {type:"uturn",data:{...t.data,fromPath:k(t.data.fromPath),toPath:k(t.data.toPath)}};case "identify":return t;case "revenue":return t;case "goal":return {type:"goal",data:{...t.data,path:k(t.data.path)}};case "journey_step":return {type:"journey_step",data:{...t.data,path:k(t.data.path)}};case "client_context":return t;case "session_replay":return t;default:return t}}var Pt=class{constructor(e={}){this.initialized=false;this.trackingAllowed=false;this.trackingBlocked=false;this.visitorPersisted=false;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={...Zn,...e};try{new URL(this.cfg.endpoint);}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let r=Dt();this.visitorPersisted=!!r,this.session={id:(n=e.sessionId)!=null?n:ut(),visitorId:r!=null?r:ut(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:ve(Pe),lastTouch:ve(st)}};}updateAttributionForPageView(e,r){let n=Qn(),i=Xn(n),o=qn(n),a=ve(Pe),c=!!(i||o||r)?{landingPage:e,referrer:r,referrerHost:jn(r),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!a&&c&&Fr(Pe,c),c&&Fr(st,c);let l={firstTouch:ve(Pe),lastTouch:ve(st)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:ve(Pe),lastTouch:ve(st)};return this.session.attribution=e,e}init(){return typeof window=="undefined"||this.initialized?this:(this.initialized=true,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=Br();if(n&&n.version===r.version){n.status==="granted"?this.startTracking():this.blockTracking();return}Lr(r,{onAccept:()=>{Lt("granted",r.version),this.startTracking();},onReject:()=>{Lt("rejected",r.version),this.blockTracking();}});}applyElementBindings(e){this.elementBindings||(this.elementBindings=new ot({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||(_t(this.session.visitorId),this.visitorPersisted=true);}startTracking(){var n;if(this.trackingAllowed||this.trackingBlocked)return;this.trackingAllowed=true,this.persistVisitorIfNeeded();let e=this.emit.bind(this),{id:r}=this.session;e({type:"client_context",data:Nr(r)}),this.cfg.trackNavigation&&(this.navigation=new Fe({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new De({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new _e({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new it({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 Re({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=true,this.trackingAllowed=false,this.queue=[],Ae(),(e=this.elementBindings)==null||e.destroy();}destroy(){var e,r,n,i,o,a;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(),(a=this.elementBindings)==null||a.destroy(),Ae(),typeof window!="undefined"&&window.removeEventListener("tracker:navigate",this.handleNavigate),this.queue.length>0&&this.cfg.endpoint&&this.trackingAllowed&&this.flushBeacon(),this.initialized=false,this.trackingAllowed=false,this.trackingBlocked=false;}async sendHeartbeat(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(dt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:true,appId:this.cfg.appId}));try{await de(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(dt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:false,appId:this.cfg.appId}));ft(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=$n(e),e.type==="pageview"){let a=this.updateAttributionForPageView(e.data.path,e.data.referrer);e={type:"pageview",data:{...e.data,utm:(r=a.lastTouch)==null?void 0:r.utm,attribution:a}};}switch(e.type){case "pageview":this.session.pageViews.push(e.data);break;case "timespent":{let a=(n=this.session.timeSpent[e.data.path])!=null?n:0;this.session.timeSpent[e.data.path]=a+e.data.duration;break}case "heatmap":{let a=e.data.path;this.session.heatmap[a]||(this.session.heatmap[a]=[]);let s=this.session.heatmap[a];s.length<this.cfg.maxHeatmapPoints&&s.push(e.data);break}}this.subscribers.forEach(a=>a(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=k(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=k(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=k((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]===true}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=Te(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=Te(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(a=>a({...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:Be(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=Te(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 k(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(lt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};ft(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(lt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await de(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r});}};function ei(){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,a]=t[n],[s,c,l]=t[n+1];for(let d=0;d<r;d++){let u=d/r;e.push([Math.round(i+(s-i)*u),Math.round(o+(c-o)*u),Math.round(a+(l-a)*u)]);}}return e}var _r=ei();function ti(t,e,r={}){let{radius:n=25,maxOpacity:i=.85,minOpacity:o=0}=r,a=t.getContext("2d");if(!a)return;let{width:s,height:c}=t;if(a.clearRect(0,0,s,c),e.length===0)return;let l=document.createElement("canvas");l.width=s,l.height=c;let d=l.getContext("2d");if(!d)return;for(let I of e){let y=I.xPct/100*s,m=I.yPct/100*c,g=I.type==="click"?n*1.6:n,S=d.createRadialGradient(y,m,0,y,m,g);S.addColorStop(0,"rgba(0,0,0,0.15)"),S.addColorStop(1,"rgba(0,0,0,0)"),d.fillStyle=S,d.beginPath(),d.arc(y,m,g,0,Math.PI*2),d.fill();}let u=d.getImageData(0,0,s,c),p=a.createImageData(s,c),f=u.data,h=p.data,v=_r.length-1;for(let I=0;I<f.length;I+=4){let y=f[I+3];if(y===0)continue;let m=y/255,g=Math.min(Math.floor(m*v),v),[S,D,O]=_r[g],L=o+m*(i-o);h[I]=S,h[I+1]=D,h[I+2]=O,h[I+3]=Math.round(L*255);}a.putImageData(p,0,0);}/*! Bundled license information:
|
|
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",()=>{Ae(),e.onReject();});let v=document.createElement("button");v.type="button",v.className="accept",v.textContent=t.acceptLabel,v.addEventListener("click",()=>{Ae(),e.onAccept();}),m.append(h,v);let I=document.createElement("div");I.className="footer";let y=document.createElement("a");y.className="brand",y.href=Vn,y.target="_blank",y.rel="noopener noreferrer",y.setAttribute("aria-label",a);let f=document.createElement("img");f.src=Hn,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 Pr="__alphana_consent__";function Zn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Kn(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e);}catch(r){}}function Br(){let t=Zn(Pr);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 Lt(t,e){let r={status:t,version:e,decidedAt:Date.now()};Kn(Pr,JSON.stringify(r));}var Dr="https://api.alphana.ir/api/events",zn={endpoint:Dr,trackNavigation:true,trackTime:true,trackHeatmap:true,trackLogs:true,mouseSampleRate:.1,maxHeatmapPoints:2e3,batchSize:20,flushInterval:5e3,compressPayloads:true,compressionThresholdBytes:1024,sessionReplay:true,sessionReplayCheckoutEveryNms:6e5,sessionReplayInlineStylesheet:false,sessionReplayMaxEventsPerBatch:48,sessionReplayFlushIntervalMs:4e3,sessionReplayMaskAllInputs:true,sessionReplayMaskTextClass:"alphana-mask",sessionReplayBlockClass:"alphana-block"},Pe="__alphana_first_touch__",st="__alphana_last_touch__",Yn={utm_source:"source",utm_medium:"medium",utm_campaign:"campaign",utm_term:"term",utm_content:"content"},jn=["gclid","fbclid","ttclid","msclkid"];function Jn(t){if(typeof localStorage=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function Qn(t,e){if(typeof localStorage!="undefined")try{localStorage.setItem(t,e);}catch(r){}}function ye(t){let e=Jn(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 Fr(t,e){Qn(t,JSON.stringify(e));}function Xn(t){if(t)try{return new URL(t).hostname.replace(/^www\./,"").toLowerCase()}catch(e){return}}function qn(){return typeof window=="undefined"?new URLSearchParams:new URLSearchParams(window.location.search)}function $n(t){var r;let e={};for(let[n,i]of Object.entries(Yn)){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 ei(t){var r;let e={};for(let n of jn){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 ti(t){switch(t.type){case "pageview":return {type:"pageview",data:{...t.data,path:k(t.data.path)}};case "timespent":return {type:"timespent",data:{...t.data,path:k(t.data.path)}};case "heatmap":return {type:"heatmap",data:{...t.data,path:k(t.data.path)}};case "rageclik":return {type:"rageclik",data:{...t.data,path:k(t.data.path)}};case "uturn":return {type:"uturn",data:{...t.data,fromPath:k(t.data.fromPath),toPath:k(t.data.toPath)}};case "identify":return t;case "revenue":return t;case "goal":return {type:"goal",data:{...t.data,path:k(t.data.path)}};case "journey_step":return {type:"journey_step",data:{...t.data,path:k(t.data.path)}};case "client_context":return t;case "session_replay":return t;default:return t}}var Pt=class{constructor(e={}){this.initialized=false;this.trackingAllowed=false;this.trackingBlocked=false;this.visitorPersisted=false;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={...zn,...e};try{new URL(this.cfg.endpoint);}catch(i){throw new Error(`[alpha-tracker] Invalid endpoint URL: "${this.cfg.endpoint}"`)}let r=Dt();this.visitorPersisted=!!r,this.session={id:(n=e.sessionId)!=null?n:ut(),visitorId:r!=null?r:ut(),startedAt:Date.now(),pageViews:[],timeSpent:{},heatmap:{},userProperties:{},attribution:{firstTouch:ye(Pe),lastTouch:ye(st)}};}updateAttributionForPageView(e,r){let n=qn(),i=$n(n),o=ei(n),s=ye(Pe),c=!!(i||o||r)?{landingPage:e,referrer:r,referrerHost:Xn(r),utm:i,clickIds:o,capturedAt:Date.now()}:void 0;!s&&c&&Fr(Pe,c),c&&Fr(st,c);let l={firstTouch:ye(Pe),lastTouch:ye(st)};return this.session.attribution=l,l}currentAttribution(){let e={firstTouch:ye(Pe),lastTouch:ye(st)};return this.session.attribution=e,e}init(){return typeof window=="undefined"||this.initialized?this:(this.initialized=true,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=Br();if(n&&n.version===r.version){n.status==="granted"?this.startTracking():this.blockTracking();return}Lr(r,{onAccept:()=>{Lt("granted",r.version),this.startTracking();},onReject:()=>{Lt("rejected",r.version),this.blockTracking();}});}applyElementBindings(e){this.elementBindings||(this.elementBindings=new ot({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||(_t(this.session.visitorId),this.visitorPersisted=true);}startTracking(){var n;if(this.trackingAllowed||this.trackingBlocked)return;this.trackingAllowed=true,this.persistVisitorIfNeeded();let e=this.emit.bind(this),{id:r}=this.session;e({type:"client_context",data:Nr(r)}),this.cfg.trackNavigation&&(this.navigation=new Fe({emit:e,sessionId:r}),this.navigation.init()),this.cfg.trackTime&&(this.time=new De({emit:e,sessionId:r}),this.time.init()),this.cfg.trackHeatmap&&(this.heatmap=new _e({emit:e,sessionId:r,sampleRate:this.cfg.mouseSampleRate,maxPoints:this.cfg.maxHeatmapPoints}),this.heatmap.init()),this.cfg.sessionReplay&&(this.sessionReplay=new it({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 xe({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=true,this.trackingAllowed=false,this.queue=[],Ae(),(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(),Ae(),typeof window!="undefined"&&window.removeEventListener("tracker:navigate",this.handleNavigate),this.queue.length>0&&this.cfg.endpoint&&this.trackingAllowed&&this.flushBeacon(),this.initialized=false,this.trackingAllowed=false,this.trackingBlocked=false;}async sendHeartbeat(){if(!this.cfg.endpoint||!this.trackingAllowed)return;let e=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{},r=JSON.stringify(dt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:true,appId:this.cfg.appId}));try{await de(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(dt({sessionId:this.session.id,visitorId:this.session.visitorId,path:this.currentPath(),active:false,appId:this.cfg.appId}));ft(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=ti(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}}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=k(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=k(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=k((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]===true}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=Te(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=Te(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:Be(this.cfg.endpoint)}async fetchRuntimeConfig(){if(!this.cfg.endpoint||!this.cfg.secretKey)return null;let e=Te(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 k(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(lt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id})),n=this.cfg.secretKey?{Authorization:`Bearer ${this.cfg.secretKey}`}:{};ft(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(lt(e,{appId:this.cfg.appId,visitorId:this.session.visitorId,sessionId:this.session.id}));await de(this.collectUrl,n,{compressPayloads:this.cfg.compressPayloads,compressionThresholdBytes:this.cfg.compressionThresholdBytes,authHeaders:r});}};function ri(){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 _r=ri();function ni(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=_r.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,L]=_r[g],P=o+f*(i-o);h[I]=b,h[I+1]=x,h[I+2]=L,h[I+3]=Math.round(P*255);}s.putImageData(p,0,0);}/*! Bundled license information:
|
|
70
113
|
|
|
71
114
|
rrweb/es/rrweb/ext/tslib/tslib.es6.js:
|
|
72
115
|
(*! *****************************************************************************
|
|
@@ -83,5 +126,5 @@ rrweb/es/rrweb/ext/tslib/tslib.es6.js:
|
|
|
83
126
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
84
127
|
PERFORMANCE OF THIS SOFTWARE.
|
|
85
128
|
***************************************************************************** *)
|
|
86
|
-
*/export{Ot as ALPHANA_SDK_VERSION,Dr as DEFAULT_ENDPOINT,
|
|
129
|
+
*/export{Ot as ALPHANA_SDK_VERSION,Dr as DEFAULT_ENDPOINT,xe as LogCapture,Pt as UserTracker,k as normalizeTrackerPath,ni as renderHeatmap};//# sourceMappingURL=index.mjs.map
|
|
87
130
|
//# sourceMappingURL=index.mjs.map
|