landom-sdk 0.1.0

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.
@@ -0,0 +1,19 @@
1
+ const Wt={endpoint:"/api/v1/events",flushInterval:3e3,flushQueueSize:20,maxQueueSize:100,maxRetries:3,enableReplay:!0,replayMaskAllInputs:!0,replayBlockClass:"rr-block",replayBlockSelector:".no-record",replayMaskTextClass:"rr-mask",replayInlineStylesheet:!0,replayCheckoutEveryNms:6e5,replayMousemoveSampling:!1,replayMousemoveCallbackSampling:500,replayScrollSampling:200,replayInputSampling:"last",debug:!1},Qe=()=>{};function Gt(e){return e?{log:(...t)=>console.log("[LandOm]",...t),warn:(...t)=>console.warn("[LandOm]",...t)}:{log:Qe,warn:Qe}}function _t(e){const{endpoint:t,apiKey:r,maxRetries:n,logger:o}=e;function s(d){return d===429||d>=500}const a=6e4;async function i(d){const p=JSON.stringify(d),g=p.length<=a;g||o.warn("\uD398\uC774\uB85C\uB4DC \uD06C\uAE30 \uCD08\uACFC, keepalive \uBE44\uD65C\uC131\uD654:",p.length,"bytes");for(let h=0;h<=n;h++){try{const I=new AbortController,y=setTimeout(()=>I.abort(),1e4),m=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Project-Key":r},body:p,keepalive:g,signal:I.signal});if(clearTimeout(y),m.ok)return o.log("\uC804\uC1A1 \uC644\uB8CC:",d.events.length,"\uAC74"),!0;if(!s(m.status))return o.warn("\uC804\uC1A1 \uC2E4\uD328 (\uC7AC\uC2DC\uB3C4 \uBD88\uAC00):",m.status,m.statusText),!1;o.warn(`\uC804\uC1A1 \uC2E4\uD328 (${m.status}), \uC7AC\uC2DC\uB3C4 ${h+1}/${n}`)}catch(I){o.warn(`\uC804\uC1A1 \uC5D0\uB7EC, \uC7AC\uC2DC\uB3C4 ${h+1}/${n}:`,I)}if(h<n){const I=1e3*2**h;await new Promise(y=>setTimeout(y,I))}}return o.warn("\uCD5C\uB300 \uC7AC\uC2DC\uB3C4 \uCD08\uACFC, \uC804\uC1A1 \uD3EC\uAE30:",d.events.length,"\uAC74"),!1}const l=6e4;function u(d,p){const g=JSON.stringify({...d,apiKey:r,events:[]}).length,h=p-g-8,I=[];let y=[],m=0;for(const f of d.events){const C=JSON.stringify(f).length+1;y.length>0&&m+C>h&&(I.push(y),y=[],m=0),y.push(f),m+=C}return y.length>0&&I.push(y),I}function c(d){const p=u(d,l);for(const g of p){const h=JSON.stringify({...d,apiKey:r,events:g});if(h.length>l){o.warn("sendSync: \uB2E8\uC77C \uCCAD\uD06C\uAC00 sendBeacon \uD55C\uACC4 \uCD08\uACFC, \uB4DC\uB86D:",h.length,"bytes,",g.length,"\uAC74");continue}const I=new Blob([h],{type:"application/json"});navigator.sendBeacon(t,I)?o.log("sendBeacon \uC804\uC1A1:",g.length,"\uAC74"):o.warn("sendBeacon \uC2E4\uD328, \uCCAD\uD06C \uB4DC\uB86D:",g.length,"\uAC74")}}return{send:i,sendSync:c}}const Me="landom_session";function Zt(){const e=Date.now(),t=new Uint8Array(16);crypto.getRandomValues(t),t[0]=e/2**40&255,t[1]=e/2**32&255,t[2]=e/2**24&255,t[3]=e/2**16&255,t[4]=e/2**8&255,t[5]=e&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128;const r=Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function Vt(e){try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return null}}function Ge(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(r){}}function Ut(){const e=Date.now(),t={sessionId:Zt(),startedAt:e,lastActivityAt:e};return Ge(Me,t),t}function Kt(e){const t=Date.now(),r=t-e.lastActivityAt>18e5,n=t-e.startedAt>864e5;return r||n}function Je(){const e=Vt(Me);return e&&!Kt(e)?e:Ut()}function Ne(){const e=Je();e.lastActivityAt=Date.now(),Ge(Me,e)}function zt(){const e=Je();return e.lastActivityAt=Date.now(),Ge(Me,e),e.sessionId}function Ht(e){const{flushInterval:t,flushQueueSize:r,maxQueueSize:n,beforeSend:o,transport:s,logger:a}=e;let i=[],l=null;function u(m){return{sessionId:zt(),userAgent:navigator.userAgent,url:location.href,events:m}}function c(){if(i.length<=n)return;let m=i.length-n,f=0;const C=[];for(const O of i){if(m>0&&O.type==="replay"){m--,f++;continue}C.push(O)}let b=0;m>0&&(b=Math.min(m,C.length),C.splice(0,b)),i=C,a.warn(`\uD050 \uCD08\uACFC: replay ${f}\uAC74, \uAE30\uD0C0 ${b}\uAC74 \uB4DC\uB86D`)}function d(m){const f=o?o(m):m;if(!f){a.log("beforeSend\uC5D0 \uC758\uD574 \uC81C\uC678\uB428:",m.type);return}i.push(f),c(),i.length>=r&&p()}async function p(){if(i.length===0)return;if(!navigator.onLine){a.log("\uC624\uD504\uB77C\uC778 \uC0C1\uD0DC, \uC804\uC1A1 \uBCF4\uB958:",i.length,"\uAC74");return}const m=i.splice(0),f=u(m);a.log("flush:",m.length,"\uAC74"),await s.send(f)||(i.unshift(...m),c())}function g(){if(i.length===0)return;const m=i.splice(0),f=u(m);a.log("flushSync:",m.length,"\uAC74"),s.sendSync(f)}function h(){a.log("\uC628\uB77C\uC778 \uBCF5\uADC0, \uBCF4\uB958 \uC774\uBCA4\uD2B8 \uC804\uC1A1"),p()}function I(){l===null&&(l=setInterval(p,t),window.addEventListener("online",h),a.log(`\uD050 \uC2DC\uC791 (${t}ms \uAC04\uACA9)`))}function y(){l!==null&&(clearInterval(l),l=null),window.removeEventListener("online",h),p()}return{push:d,flush:p,flushSync:g,start:I,stop:y}}let Pe,Xe,je;function Yt(e,t,r){Pe=e,Xe=t,je=r}function oe(){return Pe}function Qt(){return Xe}function qe(){return je}function Jt(){return{setup(){oe().push({type:"start",timestamp:Date.now(),cssSelector:null,payload:{}})},teardown(){}}}function Pt(){function e(){const t=document.visibilityState==="visible";t&&Ne(),oe().push({type:"visibility",timestamp:Date.now(),cssSelector:null,payload:{isVisible:t}})}return{setup(){document.addEventListener("visibilitychange",e)},teardown(){document.removeEventListener("visibilitychange",e)}}}function Xt(e,t){let r=null,n=null;return(...o)=>{n=o,r===null&&(r=setTimeout(()=>{r=null,n&&(e(...n),n=null)},t))}}const jt=500;function qt(){const e=Xt(()=>{Ne();const t=window.scrollY,r=document.documentElement.scrollHeight-window.innerHeight,n=r>0?Math.round(t/r*100)/100:0;oe().push({type:"scroll",timestamp:Date.now(),cssSelector:null,payload:{yOffset:t,percentage:n}})},jt);return{setup(){window.addEventListener("scroll",e,{passive:!0})},teardown(){window.removeEventListener("scroll",e)}}}function _e(e){if(e.id)return`#${e.id}`;const t=e.tagName.toLowerCase();if(typeof e.className=="string"&&e.className.trim()){const r=e.className.trim().split(/\s+/)[0];return`${t}.${r}`}return t}function Te(e,t=document.body){const r=[],n=t.parentElement;let o=e;for(;o&&o!==n;){const s=o.getAttribute("id");if(s){const l=s.replace(/"/g,'\\"');r.push(`${o.tagName.toLowerCase()}[id="${l}"]`);break}let a=1,i=o.previousElementSibling;for(;i;)i.tagName===o.tagName&&a++,i=i.previousElementSibling;if(r.push(`${o.tagName.toLowerCase()}:nth-of-type(${a})`),o===t)break;o=o.parentElement}return r.reverse().join(" > ")}function $t(){function e(t){const r=t.target;r&&(Ne(),oe().push({type:"click",timestamp:Date.now(),cssSelector:Te(r),payload:{targetId:_e(r)}}))}return{setup(){document.addEventListener("click",e,{capture:!0})},teardown(){document.removeEventListener("click",e,{capture:!0})}}}const er=new Set(["INPUT","TEXTAREA","SELECT"]);function tr(){function e(t){const r=t.target;!r||!er.has(r.tagName)||(Ne(),oe().push({type:"input",timestamp:Date.now(),cssSelector:Te(r),payload:{fieldId:_e(r)}}))}return{setup(){document.addEventListener("focus",e,{capture:!0})},teardown(){document.removeEventListener("focus",e,{capture:!0})}}}var F;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(F||(F={}));function rr(e){return e.nodeType===e.ELEMENT_NODE}function Ce(e){var t=e==null?void 0:e.host;return(t==null?void 0:t.shadowRoot)===e}function Ie(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function nr(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Ze(e){try{var t=e.rules||e.cssRules;return t?nr(Array.from(t).map($e).join("")):null}catch(r){return null}}function $e(e){var t=e.cssText;if(or(e))try{t=Ze(e.styleSheet)||t}catch(r){}return t}function or(e){return"styleSheet"in e}var et=(function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var r;if(!t)return-1;var n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n!=null?n:-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(o){return r.removeNodeFromMap(o)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)},e.prototype.replace=function(t,r){var n=this.getNode(t);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e})();function ir(){return new et}function Ve(e){var t=e.maskInputOptions,r=e.tagName,n=e.type,o=e.value,s=e.maskInputFn,a=o||"";return(t[r.toLowerCase()]||t[n])&&(s?a=s(a):a="*".repeat(a.length)),a}var tt="__rrweb_original__";function sr(e){var t=e.getContext("2d");if(!t)return!0;for(var r=50,n=0;n<e.width;n+=r)for(var o=0;o<e.height;o+=r){var s=t.getImageData,a=tt in s?s[tt]:s,i=new Uint32Array(a.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer);if(i.some(function(l){return l!==0}))return!1}return!0}var ar=1,lr=new RegExp("[^a-z0-9-_:]"),ye=-2;function rt(){return ar++}function ur(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return lr.test(t)?"div":t}function cr(e){return e.cssRules?Array.from(e.cssRules).map(function(t){return t.cssText||""}).join(""):""}function dr(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ue,nt,hr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,pr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,gr=/^(data:)([^,]*),(.*)/i;function De(e,t){return(e||"").replace(hr,function(r,n,o,s,a,i){var l=o||a||i,u=n||s||"";if(!l)return r;if(!pr.test(l)||gr.test(l))return"url(".concat(u).concat(l).concat(u,")");if(l[0]==="/")return"url(".concat(u).concat(dr(t)+l).concat(u,")");var c=t.split("/"),d=l.split("/");c.pop();for(var p=0,g=d;p<g.length;p++){var h=g[p];h!=="."&&(h===".."?c.pop():c.push(h))}return"url(".concat(u).concat(c.join("/")).concat(u,")")})}var fr=/^[^ \t\n\r\u000c]+/,mr=/^[, \t\n\r\u000c]+/;function Cr(e,t){if(t.trim()==="")return t;var r=0;function n(u){var c,d=u.exec(t.substring(r));return d?(c=d[0],r+=c.length,c):""}for(var o=[];n(mr),!(r>=t.length);){var s=n(fr);if(s.slice(-1)===",")s=ce(e,s.substring(0,s.length-1)),o.push(s);else{var a="";s=ce(e,s);for(var i=!1;;){var l=t.charAt(r);if(l===""){o.push((s+a).trim());break}else if(i)l===")"&&(i=!1);else if(l===","){r+=1,o.push((s+a).trim());break}else l==="("&&(i=!0);a+=l,r+=1}}}return o.join(", ")}function ce(e,t){if(!t||t.trim()==="")return t;var r=e.createElement("a");return r.href=t,r.href}function Ir(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Ue(){var e=document.createElement("a");return e.href="",e.href}function ot(e,t,r,n){return r==="src"||r==="href"&&n&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(t==="table"||t==="td"||t==="th")?ce(e,n):r==="srcset"&&n?Cr(e,n):r==="style"&&n?De(n,Ue()):t==="object"&&r==="data"&&n?ce(e,n):n}function yr(e,t,r){if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;){var o=e.classList[n];if(t.test(o))return!0}return r?e.matches(r):!1}function Re(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Re(e.parentNode,t,r):!1;for(var n=e.classList.length;n--;){var o=e.classList[n];if(t.test(o))return!0}return r?Re(e.parentNode,t,r):!1}function it(e,t,r){var n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(n===null)return!1;if(typeof t=="string"){if(n.classList.contains(t)||n.closest(".".concat(t)))return!0}else if(Re(n,t,!0))return!0;return!!(r&&(n.matches(r)||n.closest(r)))}function Sr(e,t,r){var n=e.contentWindow;if(n){var o=!1,s;try{s=n.document.readyState}catch(l){return}if(s!=="complete"){var a=setTimeout(function(){o||(t(),o=!0)},r);e.addEventListener("load",function(){clearTimeout(a),o=!0,t()});return}var i="about:blank";if(n.location.href!==i||e.src===i||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function vr(e,t,r){var n=!1,o;try{o=e.sheet}catch(a){return}if(!o){var s=setTimeout(function(){n||(t(),n=!0)},r);e.addEventListener("load",function(){clearTimeout(s),n=!0,t()})}}function br(e,t){var r=t.doc,n=t.mirror,o=t.blockClass,s=t.blockSelector,a=t.maskTextClass,i=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=u===void 0?{}:u,d=t.maskTextFn,p=t.maskInputFn,g=t.dataURLOptions,h=g===void 0?{}:g,I=t.inlineImages,y=t.recordCanvas,m=t.keepIframeSrcFn,f=t.newlyAddedElement,C=f===void 0?!1:f,b=Ar(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:F.Document,childNodes:[],compatMode:e.compatMode}:{type:F.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:F.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return kr(e,{doc:r,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:c,maskInputFn:p,dataURLOptions:h,inlineImages:I,recordCanvas:y,keepIframeSrcFn:m,newlyAddedElement:C,rootId:b});case e.TEXT_NODE:return wr(e,{maskTextClass:a,maskTextSelector:i,maskTextFn:d,rootId:b});case e.CDATA_SECTION_NODE:return{type:F.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:F.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function Ar(e,t){if(t.hasNode(e)){var r=t.getId(e);return r===1?void 0:r}}function wr(e,t){var r,n=t.maskTextClass,o=t.maskTextSelector,s=t.maskTextFn,a=t.rootId,i=e.parentNode&&e.parentNode.tagName,l=e.textContent,u=i==="STYLE"?!0:void 0,c=i==="SCRIPT"?!0:void 0;if(u&&l){try{e.nextSibling||e.previousSibling||!((r=e.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(l=cr(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}l=De(l,Ue())}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&it(e,n,o)&&(l=s?s(l):l.replace(/[\S]/g,"*")),{type:F.Text,textContent:l||"",isStyle:u,rootId:a}}function kr(e,t){for(var r=t.doc,n=t.blockClass,o=t.blockSelector,s=t.inlineStylesheet,a=t.maskInputOptions,i=a===void 0?{}:a,l=t.maskInputFn,u=t.dataURLOptions,c=u===void 0?{}:u,d=t.inlineImages,p=t.recordCanvas,g=t.keepIframeSrcFn,h=t.newlyAddedElement,I=h===void 0?!1:h,y=t.rootId,m=yr(e,n,o),f=ur(e),C={},b=e.attributes.length,O=0;O<b;O++){var L=e.attributes[O];C[L.name]=ot(r,f,L.name,L.value)}if(f==="link"&&s){var B=Array.from(r.styleSheets).find(function(Y){return Y.href===e.href}),k=null;B&&(k=Ze(B)),k&&(delete C.rel,delete C.href,C._cssText=De(k,B.href))}if(f==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var k=Ze(e.sheet);k&&(C._cssText=De(k,Ue()))}if(f==="input"||f==="textarea"||f==="select"){var K=e.value,z=e.checked;C.type!=="radio"&&C.type!=="checkbox"&&C.type!=="submit"&&C.type!=="button"&&K?C.value=Ve({type:C.type,tagName:f,value:K,maskInputOptions:i,maskInputFn:l}):z&&(C.checked=z)}if(f==="option"&&(e.selected&&!i.select?C.selected=!0:delete C.selected),f==="canvas"&&p){if(e.__context==="2d")sr(e)||(C.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var J=e.toDataURL(c.type,c.quality),P=document.createElement("canvas");P.width=e.width,P.height=e.height;var X=P.toDataURL(c.type,c.quality);J!==X&&(C.rr_dataURL=J)}}if(f==="img"&&d){ue||(ue=r.createElement("canvas"),nt=ue.getContext("2d"));var R=e,H=R.crossOrigin;R.crossOrigin="anonymous";var j=function(){try{ue.width=R.naturalWidth,ue.height=R.naturalHeight,nt.drawImage(R,0,0),C.rr_dataURL=ue.toDataURL(c.type,c.quality)}catch(Y){console.warn("Cannot inline img src=".concat(R.currentSrc,"! Error: ").concat(Y))}H?C.crossOrigin=H:R.removeAttribute("crossorigin")};R.complete&&R.naturalWidth!==0?j():R.onload=j}if((f==="audio"||f==="video")&&(C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime),I||(e.scrollLeft&&(C.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(C.rr_scrollTop=e.scrollTop)),m){var ee=e.getBoundingClientRect(),re=ee.width,Z=ee.height;C={class:C.class,rr_width:"".concat(re,"px"),rr_height:"".concat(Z,"px")}}return f==="iframe"&&!g(C.src)&&(e.contentDocument||(C.rr_src=C.src),delete C.src),{type:F.Element,tagName:f,attributes:C,childNodes:[],isSVG:Ir(e)||void 0,needBlock:m,rootId:y}}function M(e){return e===void 0?"":e.toLowerCase()}function Mr(e,t){if(t.comment&&e.type===F.Comment)return!0;if(e.type===F.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(M(e.attributes.name).match(/^msapplication-tile(image|color)$/)||M(e.attributes.name)==="application-name"||M(e.attributes.rel)==="icon"||M(e.attributes.rel)==="apple-touch-icon"||M(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&M(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(M(e.attributes.property).match(/^(og|twitter|fb):/)||M(e.attributes.name).match(/^(og|twitter):/)||M(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(M(e.attributes.name)==="robots"||M(e.attributes.name)==="googlebot"||M(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(M(e.attributes.name)==="author"||M(e.attributes.name)==="generator"||M(e.attributes.name)==="framework"||M(e.attributes.name)==="publisher"||M(e.attributes.name)==="progid"||M(e.attributes.property).match(/^article:/)||M(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(M(e.attributes.name)==="google-site-verification"||M(e.attributes.name)==="yandex-verification"||M(e.attributes.name)==="csrf-token"||M(e.attributes.name)==="p:domain_verify"||M(e.attributes.name)==="verify-v1"||M(e.attributes.name)==="verification"||M(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function de(e,t){var r=t.doc,n=t.mirror,o=t.blockClass,s=t.blockSelector,a=t.maskTextClass,i=t.maskTextSelector,l=t.skipChild,u=l===void 0?!1:l,c=t.inlineStylesheet,d=c===void 0?!0:c,p=t.maskInputOptions,g=p===void 0?{}:p,h=t.maskTextFn,I=t.maskInputFn,y=t.slimDOMOptions,m=t.dataURLOptions,f=m===void 0?{}:m,C=t.inlineImages,b=C===void 0?!1:C,O=t.recordCanvas,L=O===void 0?!1:O,B=t.onSerialize,k=t.onIframeLoad,K=t.iframeLoadTimeout,z=K===void 0?5e3:K,J=t.onStylesheetLoad,P=t.stylesheetLoadTimeout,X=P===void 0?5e3:P,R=t.keepIframeSrcFn,H=R===void 0?function(){return!1}:R,j=t.newlyAddedElement,ee=j===void 0?!1:j,re=t.preserveWhiteSpace,Z=re===void 0?!0:re,Y=br(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,dataURLOptions:f,inlineImages:b,recordCanvas:L,keepIframeSrcFn:H,newlyAddedElement:ee});if(!Y)return console.warn(e,"not serialized"),null;var ne;n.hasNode(e)?ne=n.getId(e):Mr(Y,y)||!Z&&Y.type===F.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?ne=ye:ne=rt();var D=Object.assign(Y,{id:ne});if(n.add(e,D),ne===ye)return null;B&&B(e);var q=!u;if(D.type===F.Element){q=q&&!D.needBlock,delete D.needBlock;var te=e.shadowRoot;te&&Ie(te)&&(D.isShadowHost=!0)}if((D.type===F.Document||D.type===F.Element)&&q){y.headWhitespace&&D.type===F.Element&&D.tagName==="head"&&(Z=!1);for(var le={doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:u,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,slimDOMOptions:y,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:Z,onSerialize:B,onIframeLoad:k,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:H},S=0,x=Array.from(e.childNodes);S<x.length;S++){var V=x[S],N=de(V,le);N&&D.childNodes.push(N)}if(rr(e)&&e.shadowRoot)for(var Q=0,w=Array.from(e.shadowRoot.childNodes);Q<w.length;Q++){var V=w[Q],N=de(V,le);N&&(Ie(e.shadowRoot)&&(N.isShadow=!0),D.childNodes.push(N))}}return e.parentNode&&Ce(e.parentNode)&&Ie(e.parentNode)&&(D.isShadow=!0),D.type===F.Element&&D.tagName==="iframe"&&Sr(e,function(){var U=e.contentDocument;if(U&&k){var me=de(U,{doc:U,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,slimDOMOptions:y,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:Z,onSerialize:B,onIframeLoad:k,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:H});me&&k(e,me)}},z),D.type===F.Element&&D.tagName==="link"&&D.attributes.rel==="stylesheet"&&vr(e,function(){if(J){var U=de(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:g,maskTextFn:h,maskInputFn:I,slimDOMOptions:y,dataURLOptions:f,inlineImages:b,recordCanvas:L,preserveWhiteSpace:Z,onSerialize:B,onIframeLoad:k,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:X,keepIframeSrcFn:H});U&&J(e,U)}},X),D}function Nr(e,t){var r=t||{},n=r.mirror,o=n===void 0?new et:n,s=r.blockClass,a=s===void 0?"rr-block":s,i=r.blockSelector,l=i===void 0?null:i,u=r.maskTextClass,c=u===void 0?"rr-mask":u,d=r.maskTextSelector,p=d===void 0?null:d,g=r.inlineStylesheet,h=g===void 0?!0:g,I=r.inlineImages,y=I===void 0?!1:I,m=r.recordCanvas,f=m===void 0?!1:m,C=r.maskAllInputs,b=C===void 0?!1:C,O=r.maskTextFn,L=r.maskInputFn,B=r.slimDOM,k=B===void 0?!1:B,K=r.dataURLOptions,z=r.preserveWhiteSpace,J=r.onSerialize,P=r.onIframeLoad,X=r.iframeLoadTimeout,R=r.onStylesheetLoad,H=r.stylesheetLoadTimeout,j=r.keepIframeSrcFn,ee=j===void 0?function(){return!1}:j,re=b===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:b===!1?{password:!0}:b,Z=k===!0||k==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:k==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:k===!1?{}:k;return de(e,{doc:e,mirror:o,blockClass:a,blockSelector:l,maskTextClass:c,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:re,maskTextFn:O,maskInputFn:L,slimDOMOptions:Z,dataURLOptions:K,inlineImages:y,recordCanvas:f,preserveWhiteSpace:z,onSerialize:J,onIframeLoad:P,iframeLoadTimeout:X,onStylesheetLoad:R,stylesheetLoadTimeout:H,keepIframeSrcFn:ee,newlyAddedElement:!1})}function G(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const he=`Please stop import mirror directly. Instead of that,\r
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.`;let st={map:{},getId(){return console.error(he),-1},getNode(){return console.error(he),null},removeNodeFromMap(){console.error(he)},has(){return console.error(he),!1},reset(){console.error(he)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(st=new Proxy(st,{get(e,t,r){return t==="map"&&console.error(he),Reflect.get(e,t,r)}}));function Se(e,t,r={}){let n=null,o=0;return function(...s){const a=Date.now();!o&&r.leading===!1&&(o=a);const i=t-(a-o),l=this;i<=0||i>t?(n&&(clearTimeout(n),n=null),o=a,e.apply(l,s)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(l,s)},i))}}function Ee(e,t,r,n,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>Ee(e,t,s||{},!0)}function pe(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch(n){return()=>{}}}function at(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function lt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _(e,t,r,n){if(!e)return!1;const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!o)return!1;if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(Re(o,t,n))return!0;return!!(r&&(e.matches(r)||n&&o.closest(r)!==null))}function Tr(e,t){return t.getId(e)!==-1}function Ke(e,t){return t.getId(e)===ye}function ut(e,t){if(Ce(e))return!1;const r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?ut(e.parentNode,t):!0:!0}function ct(e){return!!e.changedTouches}function Dr(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function dt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function ht(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function pt(e){return!!(e!=null&&e.shadowRoot)}class Rr{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var r;return(r=this.styleIDMap.get(t))!==null&&r!==void 0?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var A=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(A||{}),v=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(v||{}),ze=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ze||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{});function gt(e){return"__ln"in e}class Er{constructor(){this.length=0,this.head=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=(r==null?void 0:r.next)||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&gt(t.previousSibling)){const n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&gt(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++}removeNode(t){const r=t.__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)),t.__ln&&delete t.__ln,this.length--)}}const ft=(e,t)=>`${e}@${t}`;class Or{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=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],r=new Er,n=i=>{let l=i,u=ye;for(;u===ye;)l=l&&l.nextSibling,u=l&&this.mirror.getId(l);return u},o=i=>{var l,u,c,d;let p=null;((u=(l=i.getRootNode)===null||l===void 0?void 0:l.call(i))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&i.getRootNode().host&&(p=i.getRootNode().host);let g=p;for(;((d=(c=g==null?void 0:g.getRootNode)===null||c===void 0?void 0:c.call(g))===null||d===void 0?void 0:d.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&g.getRootNode().host;)g=g.getRootNode().host;const h=!this.doc.contains(i)&&(!g||!this.doc.contains(g));if(!i.parentNode||h)return;const I=Ce(i.parentNode)?this.mirror.getId(p):this.mirror.getId(i.parentNode),y=n(i);if(I===-1||y===-1)return r.addNode(i);const m=de(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:f=>{dt(f,this.mirror)&&this.iframeManager.addIframe(f),ht(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),pt(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(f,C)=>{this.iframeManager.attachIframe(f,C),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,C)=>{this.stylesheetManager.attachLinkElement(f,C)}});m&&t.push({parentId:I,nextId:y,node:m})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const i of Array.from(this.movedSet.values()))mt(this.removes,i,this.mirror)&&!this.movedSet.has(i.parentNode)||o(i);for(const i of Array.from(this.addedSet.values()))!It(this.droppedSet,i)&&!mt(this.removes,i,this.mirror)||It(this.movedSet,i)?o(i):this.droppedSet.add(i);let s=null;for(;r.length;){let i=null;if(s){const l=this.mirror.getId(s.value.parentNode),u=n(s.value);l!==-1&&u!==-1&&(i=s)}if(!i)for(let l=r.length-1;l>=0;l--){const u=r.get(l);if(u){const c=this.mirror.getId(u.value.parentNode);if(n(u.value)===-1)continue;if(c!==-1){i=u;break}else{const p=u.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const g=p.parentNode.host;if(this.mirror.getId(g)!==-1){i=u;break}}}}}if(!i){for(;r.head;)r.removeNode(r.head.value);break}s=i.previous,r.removeNode(i.value),o(i.value)}const a={texts:this.texts.map(i=>({id:this.mirror.getId(i.node),value:i.value})).filter(i=>this.mirror.has(i.id)),attributes:this.attributes.map(i=>({id:this.mirror.getId(i.node),attributes:i.attributes})).filter(i=>this.mirror.has(i.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!Ke(t.target,this.mirror))switch(t.type){case"characterData":{const r=t.target.textContent;!_(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:it(t.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let n=t.target.getAttribute(t.attributeName);if(t.attributeName==="value"&&(n=Ve({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),_(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;let o=this.attributes.find(s=>s.node===t.target);if(r.tagName==="IFRAME"&&t.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)t.attributeName="rr_src";else return;if(o||(o={node:t.target,attributes:{}},this.attributes.push(o)),t.attributeName==="style"){const s=this.doc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});const a=o.attributes.style;for(const i of Array.from(r.style)){const l=r.style.getPropertyValue(i),u=r.style.getPropertyPriority(i);(l!==s.style.getPropertyValue(i)||u!==s.style.getPropertyPriority(i))&&(u===""?a[i]=l:a[i]=[l,u])}for(const i of Array.from(s.style))r.style.getPropertyValue(i)===""&&(a[i]=!1)}else o.attributes[t.attributeName]=ot(this.doc,r.tagName,t.attributeName,n);break}case"childList":{if(_(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const n=this.mirror.getId(r),o=Ce(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);_(t.target,this.blockClass,this.blockSelector,!1)||Ke(r,this.mirror)||!Tr(r,this.mirror)||(this.addedSet.has(r)?(He(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||ut(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ft(n,o)]?He(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:Ce(t.target)&&Ie(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,r)=>{if(this.mirror.hasNode(t)){if(Ke(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[ft(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);_(t,this.blockClass,this.blockSelector,!1)||t.childNodes.forEach(n=>this.genAdds(n))}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function He(e,t){e.delete(t),t.childNodes.forEach(r=>He(e,r))}function mt(e,t,r){return e.length===0?!1:Ct(e,t,r)}function Ct(e,t,r){const{parentNode:n}=t;if(!n)return!1;const o=r.getId(n);return e.some(s=>s.id===o)?!0:Ct(e,n,r)}function It(e,t){return e.size===0?!1:yt(e,t)}function yt(e,t){const{parentNode:r}=t;return r?e.has(r)?!0:yt(e,r):!1}const se=[],St=typeof CSSGroupingRule!="undefined",vt=typeof CSSMediaRule!="undefined",bt=typeof CSSSupportsRule!="undefined",At=typeof CSSConditionRule!="undefined";function ve(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function wt(e,t){var r,n;const o=new Or;se.push(o),o.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const a=(n=(r=window==null?void 0:window.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");a&&window[a]&&(s=window[a]);const i=new s(o.processMutations.bind(o));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Fr({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};const o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],i;const l=Se(d=>{const p=Date.now()-i;e(a.map(g=>(g.timeOffset-=p,g)),d),a=[],i=null},s),u=Se(d=>{const p=ve(d),{clientX:g,clientY:h}=ct(d)?d.changedTouches[0]:d;i||(i=Date.now()),a.push({x:g,y:h,id:n.getId(p),timeOffset:Date.now()-i}),l(typeof DragEvent!="undefined"&&d instanceof DragEvent?v.Drag:d instanceof MouseEvent?v.MouseMove:v.TouchMove)},o,{trailing:!1}),c=[G("mousemove",u,r),G("touchmove",u,r),G("drag",u,r)];return()=>{c.forEach(d=>d())}}function Lr({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};const a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,i=[],l=u=>c=>{const d=ve(c);if(_(d,n,o,!0))return;const p=ct(c)?c.changedTouches[0]:c;if(!p)return;const g=r.getId(d),{clientX:h,clientY:I}=p;e({type:ze[u],id:g,x:h,y:I})};return Object.keys(ze).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{const c=u.toLowerCase(),d=l(u);i.push(G(c,d,t))}),()=>{i.forEach(u=>u())}}function kt({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){const a=Se(i=>{const l=ve(i);if(!l||_(l,n,o,!0))return;const u=r.getId(l);if(l===t){const c=t.scrollingElement||t.documentElement;e({id:u,x:c.scrollLeft,y:c.scrollTop})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})},s.scroll||100);return G("scroll",a,t)}function Br({viewportResizeCb:e}){let t=-1,r=-1;const n=Se(()=>{const o=at(),s=lt();(t!==o||r!==s)&&(e({width:Number(s),height:Number(o)}),t=o,r=s)},200);return G("resize",n,window)}function Mt(e,t){const r=Object.assign({},e);return t||delete r.userTriggered,r}const xr=["INPUT","TEXTAREA","SELECT"],Nt=new WeakMap;function Wr({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:s,maskInputOptions:a,maskInputFn:i,sampling:l,userTriggeredOnInput:u}){function c(m){let f=ve(m);const C=m.isTrusted;if(f&&f.tagName==="OPTION"&&(f=f.parentElement),!f||!f.tagName||xr.indexOf(f.tagName)<0||_(f,n,o,!0))return;const b=f.type;if(f.classList.contains(s))return;let O=f.value,L=!1;b==="radio"||b==="checkbox"?L=f.checked:(a[f.tagName.toLowerCase()]||a[b])&&(O=Ve({maskInputOptions:a,tagName:f.tagName,type:b,value:O,maskInputFn:i})),d(f,Mt({text:O,isChecked:L,userTriggered:C},u));const B=f.name;b==="radio"&&B&&L&&t.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(k=>{k!==f&&d(k,Mt({text:k.value,isChecked:!L,userTriggered:!1},u))})}function d(m,f){const C=Nt.get(m);if(!C||C.text!==f.text||C.isChecked!==f.isChecked){Nt.set(m,f);const b=r.getId(m);e(Object.assign(Object.assign({},f),{id:b}))}}const g=(l.input==="last"?["change"]:["input","change"]).map(m=>G(m,c,t)),h=t.defaultView;if(!h)return()=>{g.forEach(m=>m())};const I=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),y=[[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 I&&I.set&&g.push(...y.map(m=>Ee(m[0],m[1],{set(){c({target:this})}},!1,h))),()=>{g.forEach(m=>m())}}function Oe(e){const t=[];function r(n,o){if(St&&n.parentRule instanceof CSSGroupingRule||vt&&n.parentRule instanceof CSSMediaRule||bt&&n.parentRule instanceof CSSSupportsRule||At&&n.parentRule instanceof CSSConditionRule){const a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a)}else if(n.parentStyleSheet){const a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a)}return o}return r(e,t)}function ie(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function Gr({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){const o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(c,d){const{id:p,styleId:g}=ie(this,t,r.styleMirror);return(p&&p!==-1||g&&g!==-1)&&e({id:p,styleId:g,adds:[{rule:c,index:d}]}),o.apply(this,[c,d])};const s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(c){const{id:d,styleId:p}=ie(this,t,r.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,removes:[{index:c}]}),s.apply(this,[c])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(c){const{id:d,styleId:p}=ie(this,t,r.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,replace:c}),a.apply(this,[c])});let i;n.CSSStyleSheet.prototype.replaceSync&&(i=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(c){const{id:d,styleId:p}=ie(this,t,r.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,replaceSync:c}),i.apply(this,[c])});const l={};St?l.CSSGroupingRule=n.CSSGroupingRule:(vt&&(l.CSSMediaRule=n.CSSMediaRule),At&&(l.CSSConditionRule=n.CSSConditionRule),bt&&(l.CSSSupportsRule=n.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=function(p,g){const{id:h,styleId:I}=ie(this.parentStyleSheet,t,r.styleMirror);return(h&&h!==-1||I&&I!==-1)&&e({id:h,styleId:I,adds:[{rule:p,index:[...Oe(this),g||0]}]}),u[c].insertRule.apply(this,[p,g])},d.prototype.deleteRule=function(p){const{id:g,styleId:h}=ie(this.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||h&&h!==-1)&&e({id:g,styleId:h,removes:[{index:[...Oe(this),p]}]}),u[c].deleteRule.apply(this,[p])}}),()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=s,a&&(n.CSSStyleSheet.prototype.replace=a),i&&(n.CSSStyleSheet.prototype.replaceSync=i),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})}}function Tt({mirror:e,stylesheetManager:t},r){var n,o,s;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(r.host);const i=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(s=(o=r.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||s===void 0?void 0:s.ShadowRoot,l=Object.getOwnPropertyDescriptor(i==null?void 0:i.prototype,"adoptedStyleSheets");return a===null||a===-1||!i||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)===null||u===void 0?void 0:u.call(this)},set(u){var c;const d=(c=l.set)===null||c===void 0?void 0:c.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch(p){}return d}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})}function _r({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(i,l,u){var c;if(r.has(i))return s.apply(this,[i,l,u]);const{id:d,styleId:p}=ie((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,n.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,set:{property:i,value:l,priority:u},index:Oe(this.parentRule)}),s.apply(this,[i,l,u])};const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(i){var l;if(r.has(i))return a.apply(this,[i]);const{id:u,styleId:c}=ie((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return(u&&u!==-1||c&&c!==-1)&&e({id:u,styleId:c,remove:{property:i},index:Oe(this.parentRule)}),a.apply(this,[i])},()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a}}function Zr({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o}){const s=i=>Se(l=>{const u=ve(l);if(!u||_(u,t,r,!0))return;const{currentTime:c,volume:d,muted:p,playbackRate:g}=u;e({type:i,id:n.getId(u),currentTime:c,volume:d,muted:p,playbackRate:g})},o.media||500),a=[G("play",s(0)),G("pause",s(1)),G("seeked",s(2)),G("volumechange",s(3)),G("ratechange",s(4))];return()=>{a.forEach(i=>i())}}function Vr({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(l,u,c){const d=new s(l,u,c);return o.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=pe(t.fonts,"add",function(i){return function(l){return setTimeout(()=>{const u=o.get(l);u&&(e(u),o.delete(l))},0),i.apply(this,[l])}});return n.push(()=>{r.FontFace=s}),n.push(a),()=>{n.forEach(i=>i())}}function Ur(e){const{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:s}=e;let a=!0;const i=()=>{const l=t.getSelection();if(!l||a&&(l!=null&&l.isCollapsed))return;a=l.isCollapsed||!1;const u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){const p=l.getRangeAt(d),{startContainer:g,startOffset:h,endContainer:I,endOffset:y}=p;_(g,n,o,!0)||_(I,n,o,!0)||u.push({start:r.getId(g),startOffset:h,end:r.getId(I),endOffset:y})}s({ranges:u})};return i(),G("selectionchange",i)}function Kr(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:i,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:p,selectionCb:g}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),r(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),n(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),o(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),s(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),i(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),l(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),u(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),c(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),d(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),p(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),g(...h)}}function zr(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};Kr(e,t);const n=wt(e,e.doc),o=Fr(e),s=Lr(e),a=kt(e),i=Br(e),l=Wr(e),u=Zr(e),c=Gr(e,{win:r}),d=Tt(e,e.doc),p=_r(e,{win:r}),g=e.collectFonts?Vr(e):()=>{},h=Ur(e),I=[];for(const y of e.plugins)I.push(y.observer(y.callback,r,y.options));return()=>{se.forEach(y=>y.reset()),n.disconnect(),o(),s(),a(),i(),l(),u(),c(),d(),p(),g(),h(),I.forEach(y=>y())}}class Dt{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,r,n,o){const s=n||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t);let i=s.get(r);return i||(i=this.generateIdFn(),s.set(r,i),a.set(i,r)),i}getIds(t,r){const n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,o))}getRemoteId(t,r,n){const o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const s=o.get(r);return s||-1}getRemoteIds(t,r){const n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Hr{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Dt(rt),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Dt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)===null||n===void 0||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){if(t.data.type==="rrweb"){if(!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const o=this.transformCrossOriginEvent(n,t.data.event);o&&this.wrappedEmit(o,t.data.isCheckout)}}transformCrossOriginEvent(t,r){var n;switch(r.type){case A.FullSnapshot:return this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t),{timestamp:r.timestamp,type:A.IncrementalSnapshot,data:{source:v.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case A.Meta:case A.Load:case A.DomContentLoaded:return!1;case A.Plugin:return r;case A.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case A.IncrementalSnapshot:switch(r.data.source){case v.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case v.Drag:case v.TouchMove:case v.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case v.ViewportResize:return!1;case v.MediaInteraction:case v.MouseInteraction:case v.Scroll:case v.CanvasMutation:case v.Input:return this.replaceIds(r.data,t,["id"]),r;case v.StyleSheetRule:case v.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case v.Font:return r;case v.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case v.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}}replace(t,r,n,o){for(const s of o)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}}class Yr{constructor(t){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror;const r=this;this.restorePatches.push(pe(Element.prototype,"attachShadow",function(n){return function(o){const s=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),s}}))}addShadowRoot(t,r){Ie(t)&&(this.shadowDoms.has(t)||(this.shadowDoms.add(t),wt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),kt(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),Tt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)},0)))}observeAttachShadow(t){if(t.contentWindow){const r=this;this.restorePatches.push(pe(t.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(o){const s=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,t.contentDocument),s}}))}}reset(){this.restorePatches.forEach(t=>t()),this.shadowDoms=new WeakSet}}/*! *****************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */function Qr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function Jr(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function i(c){try{u(n.next(c))}catch(d){a(d)}}function l(c){try{u(n.throw(c))}catch(d){a(d)}}function u(c){c.done?s(c.value):o(c.value).then(i,l)}u((n=n.apply(e,[])).next())})}for(var fe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pr=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Fe=0;Fe<fe.length;Fe++)Pr[fe.charCodeAt(Fe)]=Fe;var Xr=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=fe[t[r]>>2],o+=fe[(t[r]&3)<<4|t[r+1]>>4],o+=fe[(t[r+1]&15)<<2|t[r+2]>>6],o+=fe[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const Rt=new Map;function jr(e,t){let r=Rt.get(e);return r||(r=new Map,Rt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const Et=(e,t,r)=>{if(!e||!(Ft(e,t)||typeof e=="object"))return;const n=e.constructor.name,o=jr(r,n);let s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function Le(e,t,r){if(e instanceof Array)return e.map(n=>Le(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const n=e.constructor.name,o=Xr(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Le(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){const n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Le(e.data,t,r),e.width,e.height]};if(Ft(e,t)||typeof e=="object"){const n=e.constructor.name,o=Et(e,t,r);return{rr_type:n,index:o}}}}return e}const Ot=(e,t,r)=>[...e].map(n=>Le(n,t,r)),Ft=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function qr(e,t,r,n){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const i=pe(t.CanvasRenderingContext2D.prototype,a,function(l){return function(...u){return _(this.canvas,r,n,!0)||setTimeout(()=>{const c=Ot([...u],t,this);e(this.canvas,{type:ge["2D"],property:a,args:c})},0),l.apply(this,u)}});o.push(i)}catch(i){const l=Ee(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:ge["2D"],property:a,args:[u],setter:!0})}});o.push(l)}return()=>{o.forEach(a=>a())}}function Lt(e,t,r){const n=[];try{const o=pe(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...i){return _(this,t,r,!0)||"__context"in this||(this.__context=a),s.apply(this,[a,...i])}});n.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(o=>o())}}function Bt(e,t,r,n,o,s,a){const i=[],l=Object.getOwnPropertyNames(e);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const c=pe(e,u,function(d){return function(...p){const g=d.apply(this,p);if(Et(g,a,this),!_(this.canvas,n,o,!0)){const h=Ot([...p],a,this),I={type:t,property:u,args:h};r(this.canvas,I)}return g}});i.push(c)}catch(c){const d=Ee(e,u,{set(p){r(this.canvas,{type:t,property:u,args:[p],setter:!0})}});i.push(d)}return i}function $r(e,t,r,n,o){const s=[];return s.push(...Bt(t.WebGLRenderingContext.prototype,ge.WebGL,e,r,n,o,t)),typeof t.WebGL2RenderingContext!="undefined"&&s.push(...Bt(t.WebGL2RenderingContext.prototype,ge.WebGL2,e,r,n,o,t)),()=>{s.forEach(a=>a())}}var xt=null;try{var en=typeof module!="undefined"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof require=="function"&&require("worker_threads");xt=en.Worker}catch(e){}function tn(e,t){return Buffer.from(e,"base64").toString("utf8")}function rn(e,t,r){var n=tn(e),o=n.indexOf(`
17
+ `,10)+1,s=n.substring(o)+"";return function(i){return new xt(s,Object.assign({},i,{eval:!0}))}}function nn(e,t){var r=atob(e);return r}function on(e,t,r){var n=nn(e),o=n.indexOf(`
18
+ `,10)+1,s=n.substring(o)+"",a=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(a)}function sn(e,t,r){var n;return function(s){return n=n||on(e),new Worker(n,s)}}var an=Object.prototype.toString.call(typeof process!="undefined"?process:0)==="[object process]";function ln(){return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HQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");class dn{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(l,u)=>{(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(u)};const{sampling:r="all",win:n,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:i}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,s,{dataURLOptions:i})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,o,s){const a=Lt(r,n,o),i=new Map,l=new cn;l.onmessage=h=>{const{id:I}=h.data;if(i.set(I,!1),!("base64"in h.data))return;const{base64:y,type:m,width:f,height:C}=h.data;this.mutationCb({id:I,type:ge["2D"],commands:[{property:"clearRect",args:[0,0,f,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:m}]},0,0]}]})};const u=1e3/t;let c=0,d;const p=()=>{const h=[];return r.document.querySelectorAll("canvas").forEach(I=>{_(I,n,o,!0)||h.push(I)}),h},g=h=>{if(c&&h-c<u){d=requestAnimationFrame(g);return}c=h,p().forEach(I=>Jr(this,void 0,void 0,function*(){var y;const m=this.mirror.getId(I);if(i.get(m))return;if(i.set(m,!0),["webgl","webgl2"].includes(I.__context)){const C=I.getContext(I.__context);((y=C==null?void 0:C.getContextAttributes())===null||y===void 0?void 0:y.preserveDrawingBuffer)===!1&&(C==null||C.clear(C.COLOR_BUFFER_BIT))}const f=yield createImageBitmap(I);l.postMessage({id:m,bitmap:f,width:I.width,height:I.height,dataURLOptions:s.dataURLOptions},[f])})),d=requestAnimationFrame(g)};d=requestAnimationFrame(g),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Lt(t,r,n),s=qr(this.processMutation.bind(this),t,r,n),a=$r(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const o=n.map(a=>Qr(a,["type"])),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}}class hn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Rr,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},o=[];for(const s of t){let a;if(this.styleMirror.has(s))a=this.styleMirror.getId(s);else{a=this.styleMirror.add(s);const i=Array.from(s.rules||CSSRule);o.push({styleId:a,rules:i.map((l,u)=>({rule:$e(l),index:u}))})}n.styleIds.push(a)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}function E(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let T,Be,Ye,xe=!1;const $=ir();function be(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",maskTextClass:i="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:c,maskInputOptions:d,slimDOMOptions:p,maskInputFn:g,maskTextFn:h,hooks:I,packFn:y,sampling:m={},dataURLOptions:f={},mousemoveWait:C,recordCanvas:b=!1,recordCrossOriginIframes:O=!1,userTriggeredOnInput:L=!1,collectFonts:B=!1,inlineImages:k=!1,plugins:K,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:J=new Set([])}=e,P=O?window.parent===window:!0;let X=!1;if(!P)try{window.parent.document,X=!1}catch(S){X=!0}if(P&&!t)throw new Error("emit function is required");C!==void 0&&m.mousemove===void 0&&(m.mousemove=C),$.reset();const R=c===!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}:d!==void 0?d:{password:!0},H=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||{};Dr();let j,ee=0;const re=S=>{for(const x of K||[])x.eventProcessor&&(S=x.eventProcessor(S));return y&&(S=y(S)),S};T=(S,x)=>{var V;if(!((V=se[0])===null||V===void 0)&&V.isFrozen()&&S.type!==A.FullSnapshot&&!(S.type===A.IncrementalSnapshot&&S.data.source===v.Mutation)&&se.forEach(N=>N.unfreeze()),P)t==null||t(re(S),x);else if(X){const N={type:"rrweb",event:re(S),isCheckout:x};window.parent.postMessage(N,"*")}if(S.type===A.FullSnapshot)j=S,ee=0;else if(S.type===A.IncrementalSnapshot){if(S.data.source===v.Mutation&&S.data.isAttachIframe)return;ee++;const N=n&&ee>=n,Q=r&&S.timestamp-j.timestamp>r;(N||Q)&&Be(!0)}};const Z=S=>{T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.Mutation},S)}))},Y=S=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.Scroll},S)})),ne=S=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.CanvasMutation},S)})),D=S=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.AdoptedStyleSheet},S)})),q=new hn({mutationCb:Z,adoptedStyleSheetCb:D}),te=new Hr({mirror:$,mutationCb:Z,stylesheetManager:q,recordCrossOriginIframes:O,wrappedEmit:T});for(const S of K||[])S.getMirror&&S.getMirror({nodeMirror:$,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});Ye=new dn({recordCanvas:b,mutationCb:ne,win:window,blockClass:o,blockSelector:s,mirror:$,sampling:m.canvas,dataURLOptions:f});const le=new Yr({mutationCb:Z,scrollCb:Y,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:R,dataURLOptions:f,maskTextFn:h,maskInputFn:g,recordCanvas:b,inlineImages:k,sampling:m,slimDOMOptions:H,iframeManager:te,stylesheetManager:q,canvasManager:Ye,keepIframeSrcFn:z},mirror:$});Be=(S=!1)=>{var x,V,N,Q,w,U;T(E({type:A.Meta,data:{href:window.location.href,width:lt(),height:at()}}),S),q.reset(),se.forEach(W=>W.lock());const me=Nr(document,{mirror:$,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:R,maskTextFn:h,slimDOM:H,dataURLOptions:f,recordCanvas:b,inlineImages:k,onSerialize:W=>{dt(W,$)&&te.addIframe(W),ht(W,$)&&q.trackLinkElement(W),pt(W)&&le.addShadowRoot(W.shadowRoot,document)},onIframeLoad:(W,We)=>{te.attachIframe(W,We),le.observeAttachShadow(W)},onStylesheetLoad:(W,We)=>{q.attachLinkElement(W,We)},keepIframeSrcFn:z});if(!me)return console.warn("Failed to snapshot the document");T(E({type:A.FullSnapshot,data:{node:me,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:(document==null?void 0:document.documentElement.scrollLeft)||((V=(x=document==null?void 0:document.body)===null||x===void 0?void 0:x.parentElement)===null||V===void 0?void 0:V.scrollLeft)||((N=document==null?void 0:document.body)===null||N===void 0?void 0:N.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:(document==null?void 0:document.documentElement.scrollTop)||((w=(Q=document==null?void 0:document.body)===null||Q===void 0?void 0:Q.parentElement)===null||w===void 0?void 0:w.scrollTop)||((U=document==null?void 0:document.body)===null||U===void 0?void 0:U.scrollTop)||0}}})),se.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&q.adoptStyleSheets(document.adoptedStyleSheets,$.getId(document))};try{const S=[];S.push(G("DOMContentLoaded",()=>{T(E({type:A.DomContentLoaded,data:{}}))}));const x=N=>{var Q;return zr({mutationCb:Z,mousemoveCb:(w,U)=>T(E({type:A.IncrementalSnapshot,data:{source:U,positions:w}})),mouseInteractionCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.MouseInteraction},w)})),scrollCb:Y,viewportResizeCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.ViewportResize},w)})),inputCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.Input},w)})),mediaInteractionCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.MediaInteraction},w)})),styleSheetRuleCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.StyleSheetRule},w)})),styleDeclarationCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.StyleDeclaration},w)})),canvasMutationCb:ne,fontCb:w=>T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.Font},w)})),selectionCb:w=>{T(E({type:A.IncrementalSnapshot,data:Object.assign({source:v.Selection},w)}))},blockClass:o,ignoreClass:a,maskTextClass:i,maskTextSelector:l,maskInputOptions:R,inlineStylesheet:u,sampling:m,recordCanvas:b,inlineImages:k,userTriggeredOnInput:L,collectFonts:B,doc:N,maskInputFn:g,maskTextFn:h,keepIframeSrcFn:z,blockSelector:s,slimDOMOptions:H,dataURLOptions:f,mirror:$,iframeManager:te,stylesheetManager:q,shadowDomManager:le,canvasManager:Ye,ignoreCSSAttributes:J,plugins:((Q=K==null?void 0:K.filter(w=>w.observer))===null||Q===void 0?void 0:Q.map(w=>({observer:w.observer,options:w.options,callback:U=>T(E({type:A.Plugin,data:{plugin:w.name,payload:U}}))})))||[]},I)};te.addLoadListener(N=>{S.push(x(N.contentDocument))});const V=()=>{Be(),S.push(x(document)),xe=!0};return document.readyState==="interactive"||document.readyState==="complete"?V():S.push(G("load",()=>{T(E({type:A.Load,data:{}})),V()},window)),()=>{S.forEach(N=>N()),xe=!1}}catch(S){console.warn(S)}}be.addCustomEvent=(e,t)=>{if(!xe)throw new Error("please add custom event after start recording");T(E({type:A.Custom,data:{tag:e,payload:t}}))},be.freezePage=()=>{se.forEach(e=>e.freeze())},be.takeFullSnapshot=e=>{if(!xe)throw new Error("please take full snapshot after start recording");Be(e)},be.mirror=$;function pn(e){let t="";for(let r=0;r<e.length;r+=32768){const n=e.subarray(r,r+32768);t+=String.fromCharCode(...n)}return btoa(t)}async function gn(e){const t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip")),r=await new Response(t).arrayBuffer();return new Uint8Array(r)}async function fn(e,t){const r=await gn(JSON.stringify({event:e,isCheckout:t,version:"rrweb"}));return{compressed:!0,compression:"gzip",encoding:"base64",data:pn(r),version:"rrweb"}}function mn(){let e;return{setup(){const t=Qt(),r=qe();e=be({emit(n,o){fn(n,!!o).then(s=>{var a;const i={type:"replay",timestamp:(a=n.timestamp)!=null?a:Date.now(),cssSelector:null,payload:s};oe().push(i)}).catch(s=>{r.warn("rrweb payload \uC555\uCD95 \uC2E4\uD328, \uC774\uBCA4\uD2B8 \uB4DC\uB86D:",s)})},maskAllInputs:t.replayMaskAllInputs,blockClass:t.replayBlockClass,blockSelector:t.replayBlockSelector,maskTextClass:t.replayMaskTextClass,maskTextSelector:t.replayMaskTextSelector,slimDOMOptions:"all",inlineStylesheet:t.replayInlineStylesheet,checkoutEveryNms:t.replayCheckoutEveryNms,sampling:{mousemove:t.replayMousemoveSampling,mousemoveCallback:t.replayMousemoveCallbackSampling,scroll:t.replayScrollSampling,input:t.replayInputSampling}}),e?r.log("rrweb \uB9AC\uD50C\uB808\uC774 \uC218\uC9D1 \uC2DC\uC791"):r.warn("rrweb \uB9AC\uD50C\uB808\uC774 \uC218\uC9D1\uC744 \uC2DC\uC791\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.")},teardown(){e&&(e(),e=void 0,qe().log("rrweb \uB9AC\uD50C\uB808\uC774 \uC218\uC9D1 \uC885\uB8CC"))}}}const Cn=5e3;function In(){let e=null,t=null,r=null;return{setup(){e=new IntersectionObserver(n=>{for(const o of n)o.isIntersecting&&o.target.id&&(r=o.target)},{threshold:.3}),document.querySelectorAll("section[id]").forEach(n=>e.observe(n)),t=setInterval(()=>{r&&oe().push({type:"ping",timestamp:Date.now(),cssSelector:Te(r),payload:{sectionId:r.id}})},Cn)},teardown(){e&&(e.disconnect(),e=null),t!==null&&(clearInterval(t),t=null),r=null}}}function yn(){let e=!1,t=0;function r(){const s=document.documentElement.scrollHeight-window.innerHeight;if(s<=0)return;const a=Math.round(window.scrollY/s*100);a>t&&(t=a)}function n(){if(e)return;e=!0,r();const s=document.elementFromPoint(window.innerWidth/2,window.innerHeight-1),a=s?_e(s):"unknown",i=oe();i.push({type:"exit",timestamp:Date.now(),cssSelector:s?Te(s):null,payload:{lastElementId:a,maxDepth:t}}),i.flushSync()}function o(){document.visibilityState==="hidden"&&n()}return{setup(){window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("beforeunload",n),document.addEventListener("visibilitychange",o)},teardown(){window.removeEventListener("scroll",r),window.removeEventListener("beforeunload",n),document.removeEventListener("visibilitychange",o),e=!1,t=0}}}let Ae=!1,ae,we,ke=[];function Sn(e){if(Ae){console.warn("[LandOm] \uC774\uBBF8 \uCD08\uAE30\uD654\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");return}const t={...Wt,...e};ae=Gt(t.debug);const r=_t({endpoint:t.endpoint,apiKey:t.apiKey,maxRetries:t.maxRetries,logger:ae});we=Ht({flushInterval:t.flushInterval,flushQueueSize:t.flushQueueSize,maxQueueSize:t.maxQueueSize,beforeSend:t.beforeSend,transport:r,logger:ae}),Yt(we,t,ae),we.start(),Ae=!0;const n=[Jt(),Pt(),qt(),$t(),tr(),In(),yn()];t.enableReplay&&n.splice(5,0,mn()),vn(n),ae.log("SDK \uCD08\uAE30\uD654 \uC644\uB8CC",t)}function vn(e){ke=e,ke.forEach(t=>t.setup()),ae.log(`\uC218\uC9D1\uAE30 ${ke.length}\uAC1C \uB4F1\uB85D`)}function bn(e,t={}){if(!Ae){console.warn("[LandOm] \uCD08\uAE30\uD654 \uC804\uC5D0\uB294 capture\uB97C \uD638\uCD9C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");return}const r={type:e,timestamp:Date.now(),cssSelector:null,payload:t};we.push(r)}function An(){Ae&&(ke.forEach(e=>e.teardown()),ke=[],we.stop(),Ae=!1,ae.log("SDK \uC885\uB8CC"))}export{bn as capture,An as destroy,Sn as init};
19
+ //# sourceMappingURL=landom-sdk.esm.js.map