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