@extn/segi-js 0.2.5 → 0.2.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/cdn.global.js +2 -2
- package/dist/replay/index.js +7 -5
- package/dist/replay/index.mjs +7 -5
- package/package.json +1 -1
package/dist/cdn.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var Segi=(()=>{var yu=Object.create;var jt=Object.defineProperty;var wu=Object.getOwnPropertyDescriptor;var Su=Object.getOwnPropertyNames;var bu=Object.getPrototypeOf,vu=Object.prototype.hasOwnProperty;var Cu=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var je=(s,e)=>()=>(s&&(e=s(s=0)),e);var Gt=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),Ht=(s,e)=>{for(var t in e)jt(s,t,{get:e[t],enumerable:!0})},In=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Su(e))!vu.call(s,i)&&i!==t&&jt(s,i,{get:()=>e[i],enumerable:!(r=wu(e,i))||r.enumerable});return s};var Eu=(s,e,t)=>(t=s!=null?yu(bu(s)):{},In(e||!s||!s.__esModule?jt(t,"default",{value:s,enumerable:!0}):t,s)),Iu=s=>In(jt({},"__esModule",{value:!0}),s);var Nn=Gt(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.SEGI_DEFAULT_ADMIN_URL=le.SEGI_DEFAULT_CDN_URL=le.SEGI_DEFAULT_PM2_ENDPOINT=le.SEGI_DEFAULT_INGEST_ENDPOINT=le.SEGI_DEFAULT_API_BASE=void 0;le.SEGI_DEFAULT_API_BASE="https://segiapi.extn.ai";le.SEGI_DEFAULT_INGEST_ENDPOINT="https://segiapi.extn.ai/api/ingest/events";le.SEGI_DEFAULT_PM2_ENDPOINT="https://segiapi.extn.ai/api/ingest/pm2";le.SEGI_DEFAULT_CDN_URL="https://cdn.extn.ai/segi/segi.min.js";le.SEGI_DEFAULT_ADMIN_URL="https://segi.extn.ai"});var On=Gt(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.scrubHeaders=Rn;dt.scrubObject=Fe;dt.scrubEvent=Au;var xu=new Set(["authorization","cookie","set-cookie","x-api-key","proxy-authorization"]),Mu=[/^password$/i,/^passwd$/i,/token/i,/secret/i,/api[-_]?key/i,/^authorization$/i,/card[-_]?number/i,/^rrn$/i,/^residentnumber$/i],An="[Filtered]";function Rn(s){if(!s)return s;let e={};for(let[t,r]of Object.entries(s))xu.has(t.toLowerCase())?e[t]=An:e[t]=r;return e}function Nu(s){return Mu.some(e=>e.test(s))}function Fe(s,e=0){if(e>8||s==null)return s;if(Array.isArray(s))return s.map(t=>Fe(t,e+1));if(typeof s=="object"){let t={};for(let[r,i]of Object.entries(s))Nu(r)?t[r]=An:t[r]=Fe(i,e+1);return t}return s}function Au(s){let e=JSON.parse(JSON.stringify(s));return e.request&&(e.request.headers=Rn(e.request.headers),e.request.body=Fe(e.request.body),e.request.query=Fe(e.request.query)),e.extra&&(e.extra=Fe(e.extra)),e.tags&&(e.tags=Fe(e.tags)),e}});var Dn=Gt(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.generateFingerprint=Du;var Ru=Cu("crypto");function hs(s){return s?s.replace(/0x[0-9a-fA-F]+/g,"0xX").replace(/\b\d{4,}\b/g,"N").replace(/[\r\n]+/g," ").trim().slice(0,500):""}function Ou(s){if(!s)return"";let e=s.split(`
|
|
2
|
-
`).map(r=>r.trim()).filter(Boolean),t=e.find(r=>r.startsWith("at "))??e[1]??"";return hs(t)}function Du(s){let e=[String(s.projectId),hs(s.errorName??""),hs(s.message??""),Ou(s.stack??"")];return(0,Ru.createHash)("sha256").update(e.join("|")).digest("hex")}});var Tn=Gt(we=>{"use strict";var Tu=we&&we.__createBinding||(Object.create?(function(s,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,i)}):(function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]})),ds=we&&we.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tu(e,s,t)};Object.defineProperty(we,"__esModule",{value:!0});ds(Nn(),we);ds(On(),we);ds(Dn(),we)});function Ln(s){return s<640?"mobile":s<1024?"tablet":"desktop"}function ku(s,e){let t=s;for(;t;){if(t.classList?.contains(e))return!0;t=t.parentElement}return!1}function Lu(s){try{if(s.id)return`#${s.id}`;let e=s.tagName?.toLowerCase();if(!e)return;let t=(s.className&&typeof s.className=="string"?s.className.split(/\s+/).filter(Boolean).slice(0,2):[]).map(r=>`.${r}`);return`${e}${t.join("")}`.slice(0,512)}catch{return}}function $n(s){let e=s.options.mask?.class??"segi-mask",t=!1,r=[],i=-1,n=0,o=(h={})=>{if(r.length===0)return;let f=r.splice(0,r.length);s.sendClicks(f,!!h.useBeacon)},a=setInterval(()=>{t||o()},5e3),l=h=>{if(!t)try{let f=h.target;if(!f||ku(f,e))return;let g=Math.max(document.documentElement.scrollWidth,document.body?.scrollWidth??0,1),m=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0,1),p=h.pageX,d=h.pageY,y=window.innerWidth,b={sessionUid:s.sessionUid,ts:new Date().toISOString(),urlPath:location.pathname.slice(0,255),device:Ln(y),viewportW:y,viewportH:window.innerHeight,x:Math.round(h.clientX),y:Math.round(h.clientY),pageX:Math.round(p),pageY:Math.round(d),relX:Math.max(0,Math.min(1,p/g)),relY:Math.max(0,Math.min(1,d/m)),selector:Lu(f),tag:f.tagName?.toLowerCase().slice(0,32),text:(f.textContent??void 0)?.trim().slice(0,128)||void 0};r.push(b),r.length>=50&&o()}catch{}},u=()=>{if(t)return;let h=Date.now();if(!(h-n<1e3))try{let f=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0,1),g=window.innerHeight,m=Math.round(window.scrollY+g),p=Math.max(0,Math.min(100,Math.round(m/f*100)));if(p<=i)return;i=p,n=h;let d=window.innerWidth;s.sendScroll({sessionUid:s.sessionUid,urlPath:location.pathname.slice(0,255),device:Ln(d),viewportH:g,docH:f,maxScrollY:m,maxScrollPct:p},!1)}catch{}},c=()=>{o({useBeacon:!0})};return window.addEventListener("click",l,!0),window.addEventListener("scroll",u,{capture:!0,passive:!0}),window.addEventListener("pagehide",c),{pause(){t=!0},resume(){t=!1},stop(){clearInterval(a),window.removeEventListener("click",l,!0),window.removeEventListener("scroll",u,!0),window.removeEventListener("pagehide",c),o({useBeacon:!0})},flushClicks:o}}var Pn=je(()=>{"use strict"});function Yt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function Wn(){try{if(typeof sessionStorage>"u")return null;let s=sessionStorage.getItem(Un),e=Number(sessionStorage.getItem(Bn)??"0");return!s||!e?null:{uid:s,at:e}}catch{return null}}function gs(s,e){try{if(typeof sessionStorage>"u")return;sessionStorage.setItem(Un,s),sessionStorage.setItem(Bn,String(e))}catch{}}function zn(){let s=Date.now(),e=Wn();if(e&&s-e.at<18e5)return gs(e.uid,s),e.uid;let t=Yt();return gs(t,s),$u=t,t}function Vn(){let s=Wn();s&&gs(s.uid,Date.now())}function ys(){try{if(typeof localStorage>"u")return Ge||(Ge=Yt()),Ge;let s=localStorage.getItem(Fn);if(s)return s;let e=Yt();return localStorage.setItem(Fn,e),e}catch{return Ge||(Ge=Yt()),Ge}}var Un,Bn,Fn,$u,Ge,jn=je(()=>{"use strict";Un="_bd_session_uid",Bn="_bd_session_at",Fn="_bd_anon",$u=null,Ge=null});function Gn(s){return(s&&s.trim()||Pu).replace(/\/+$/,"").replace(/\/api\/ingest\/events$/,"").replace(/\/api\/ingest$/,"").replace(/\/api$/,"")}async function Ne(s,e,t){let r=`${Gn(s.endpoint)}/api/trace${e}`;try{return await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-Segi-Project-Key":s.projectKey},body:JSON.stringify(t),keepalive:!0})}catch{return null}}function ws(s,e,t){try{if(typeof navigator>"u"||!navigator.sendBeacon)return!1;let r=`${Gn(s.endpoint)}/api/trace${e}?pk=${encodeURIComponent(s.projectKey)}`,i=new Blob([JSON.stringify(t)],{type:"application/json"});return navigator.sendBeacon(r,i)}catch{return!1}}var Pu,Hn=je(()=>{"use strict";Pu="https://segiapi.extn.ai"});var ou={};Ht(ou,{EventType:()=>I,IncrementalSource:()=>E,MouseInteractions:()=>$,Replayer:()=>Li,ReplayerEvents:()=>L,addCustomEvent:()=>Ym,canvasMutation:()=>_i,freezePage:()=>Xm,mirror:()=>Vr,record:()=>_e,takeFullSnapshot:()=>Zm,utils:()=>am});function $i(s){if(Xt[s])return Xt[s];let e=globalThis[s],t=e.prototype,r=s in Zn?Zn[s]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(t,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),n=s in Kn?Kn[s]:void 0,o=!!(n&&n.every(a=>{var l;return typeof t[a]=="function"&&((l=t[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&o&&!zu())return Xt[s]=e.prototype,e.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return e.prototype;let u=l[s].prototype;return document.body.removeChild(a),u?Xt[s]=u:t}catch{return t}}function Ie(s,e,t){var r;let i=`${s}.${String(t)}`;if(Ss[i])return Ss[i].call(e);let n=$i(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Ss[i]=o,o.call(e)):e[t]}function oa(s,e,t){let r=`${s}.${String(t)}`;if(bs[r])return bs[r].bind(e);let n=$i(s)[t];return typeof n!="function"?e[t]:(bs[r]=n,n.bind(e))}function Vu(s){return Ie("Node",s,"ownerDocument")}function ju(s){return Ie("Node",s,"childNodes")}function Gu(s){return Ie("Node",s,"parentNode")}function Hu(s){return Ie("Node",s,"parentElement")}function Yu(s){return Ie("Node",s,"textContent")}function Xu(s,e){return oa("Node",s,"contains")(e)}function Zu(s){return oa("Node",s,"getRootNode")()}function Ku(s){return!s||!("host"in s)?null:Ie("ShadowRoot",s,"host")}function Ju(s){return s.styleSheets}function qu(s){return!s||!("shadowRoot"in s)?null:Ie("Element",s,"shadowRoot")}function Qu(s,e){return Ie("Element",s,"querySelector")(e)}function ec(s,e){return Ie("Element",s,"querySelectorAll")(e)}function tc(){return $i("MutationObserver").constructor}function rc(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}function Pi(s){return s.nodeType===s.ELEMENT_NODE}function bt(s){let e=s&&"host"in s&&"mode"in s&&ee.host(s)||null;return!!(e&&"shadowRoot"in e&&ee.shadowRoot(e)===s)}function vt(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function sc(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function ic(s){let{cssText:e}=s;if(e.split('"').length<3)return e;let t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function ks(s){try{let e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);let r=Array.from(e,i=>aa(i,t)).join("");return sc(r)}catch{return null}}function aa(s,e){if(oc(s)){let t;try{t=ks(s.styleSheet)||ic(s)}catch{t=s.cssText}return s.styleSheet.href?Nr(t,s.styleSheet.href):t}else{let t=s.cssText;return ac(s)&&s.selectorText.includes(":")&&(t=nc(t)),e?Nr(t,e):t}}function nc(s){let e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function oc(s){return"styleSheet"in s}function ac(s){return"selectorText"in s}function la(){return new It}function xr({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||"",a=r&&Te(r);return(e[t.toLowerCase()]||a&&e[a])&&(n?o=n(o,s):o="*".repeat(o.length)),o}function Te(s){return s.toLowerCase()}function lc(s){let e=s.getContext("2d");if(!e)return!0;let t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){let n=e.getImageData,o=Jn in n?n[Jn]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function uc(s,e){return!s||!e||s.type!==e.type?!1:s.type===O.Document?s.compatMode===e.compatMode:s.type===O.DocumentType?s.name===e.name&&s.publicId===e.publicId&&s.systemId===e.systemId:s.type===O.Comment||s.type===O.Text||s.type===O.CDATA?s.textContent===e.textContent:s.type===O.Element?s.tagName===e.tagName&&JSON.stringify(s.attributes)===JSON.stringify(e.attributes)&&s.isSVG===e.isSVG&&s.needBlock===e.needBlock:!1}function Mr(s){let e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Te(e):null}function Fi(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return i?.[1]??null}function cc(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}function Nr(s,e){return(s||"").replace(hc,(t,r,i,n,o,a)=>{let l=i||o||a,u=r||n||"";if(!l)return t;if(fc.test(l)||dc.test(l))return`url(${u}${l}${u})`;if(pc.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${cc(e)+l}${u})`;let c=e.split("/"),h=l.split("/");c.pop();for(let f of h)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}function Zt(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function mc(s,e,t=!1){let r=Array.from(e.childNodes),i=[],n=0;if(r.length>1&&s&&typeof s=="string"){let o=Zt(s,t),a=o.length/s.length;for(let l=1;l<r.length;l++)if(r[l].textContent&&typeof r[l].textContent=="string"){let u=Zt(r[l].textContent,t),c=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let f=u.substring(0,h),g=o.split(f),m=-1;if(g.length===2)m=g[0].length;else if(g.length>2&&g[0]===""&&r[l-1].textContent!=="")m=o.indexOf(f,1);else if(g.length===1){if(f=f.substring(0,f.length-1),g=o.split(f),g.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(m=o.indexOf(f));if(g.length>=2&&h>c){let p=r[l-1].textContent;if(p&&typeof p=="string"){let d=Zt(p).length;m=o.indexOf(f,d)}m===-1&&(m=g[0].length)}if(m!==-1){let p=Math.floor(m/a);for(;p>0&&p<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;let d=Zt(s.substring(0,p),t);if(d.length===m){i.push(s.substring(0,p)),s=s.substring(p),o=o.substring(m);break}else d.length<m?p+=Math.max(1,Math.floor((m-d.length)/a)):p-=Math.max(1,Math.floor((d.length-m)*a))}break}}}}return i.push(s),i}function gc(s,e){return mc(s,e).join("/* rr_split */")}function ua(){return yc++}function Sc(s){if(s instanceof HTMLFormElement)return"form";let e=Te(s.tagName);return wc.test(e)?"div":e}function Cc(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o,a=n.exec(e.substring(t));return a?(o=a[0],t+=o.length,o):""}let i=[];for(;r(vc),!(t>=e.length);){let n=r(bc);if(n.slice(-1)===",")n=Ke(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Ke(s,n);let a=!1;for(;;){let l=e.charAt(t);if(l===""){i.push((n+o).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){t+=1,i.push((n+o).trim());break}else l==="("&&(a=!0);o+=l,t+=1}}}return i.join(", ")}function Ke(s,e){return!e||e.trim()===""?e:Ui(s,e)}function Ec(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function Ui(s,e){let t=Qn.get(s);if(t||(t=s.createElement("a"),Qn.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function ca(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&["table","td","th"].includes(e)?Ke(s,r):t==="srcset"?Cc(s,r):t==="style"?Nr(r,Ui(s)):e==="object"&&t==="data"?Ke(s,r):r)}function ha(s,e,t){return["video","audio"].includes(s)&&e==="autoplay"}function Ic(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function Ar(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Ar(ee.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}return t?Ar(ee.parentNode(s),e,t):!1}function fa(s,e,t,r){let i;if(Pi(s)){if(i=s,!ee.childNodes(i).length)return!1}else{if(ee.parentElement(s)===null)return!1;i=ee.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Ar(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function xc(s,e,t){let r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!=="complete"){let a=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(a),i=!0,e()});return}let o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function Mc(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;let n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function Nc(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:f,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:p=!1,cssCaptured:d=!1}=e,y=Ac(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:O.Document,childNodes:[],compatMode:s.compatMode}:{type:O.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:O.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:y};case s.ELEMENT_NODE:return Oc(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:h,inlineImages:f,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:p,rootId:y});case s.TEXT_NODE:return Rc(s,{doc:t,needsMask:o,maskTextFn:u,rootId:y,cssCaptured:d});case s.CDATA_SECTION_NODE:return{type:O.CDATA,textContent:"",rootId:y};case s.COMMENT_NODE:return{type:O.Comment,textContent:ee.textContent(s)||"",rootId:y};default:return!1}}function Ac(s,e){if(!e.hasNode(s))return;let t=e.getId(s);return t===1?void 0:t}function Rc(s,e){let{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=ee.parentNode(s),a=o&&o.tagName,l="",u=a==="STYLE"?!0:void 0,c=a==="SCRIPT"?!0:void 0;return c?l="SCRIPT_PLACEHOLDER":n||(l=ee.textContent(s),u&&l&&(l=Nr(l,Ui(e.doc)))),!u&&!c&&l&&t&&(l=r?r(l,ee.parentElement(s)):l.replace(/[\S]/g,"*")),{type:O.Text,textContent:l||"",rootId:i}}function Oc(s,e){let{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:a,dataURLOptions:l={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:g}=e,m=Ic(s,r,i),p=Sc(s),d={},y=s.attributes.length;for(let w=0;w<y;w++){let v=s.attributes[w];ha(p,v.name,v.value)||(d[v.name]=ca(t,p,Te(v.name),v.value))}if(p==="link"&&n){let w=Array.from(t.styleSheets).find(x=>x.href===s.href),v=null;w&&(v=ks(w)),v&&(delete d.rel,delete d.href,d._cssText=v)}if(p==="style"&&s.sheet){let w=ks(s.sheet);w&&(s.childNodes.length>1&&(w=gc(w,s)),d._cssText=w)}if(["input","textarea","select"].includes(p)){let w=s.value,v=s.checked;d.type!=="radio"&&d.type!=="checkbox"&&d.type!=="submit"&&d.type!=="button"&&w?d.value=xr({element:s,type:Mr(s),tagName:p,value:w,maskInputOptions:o,maskInputFn:a}):v&&(d.checked=v)}if(p==="option"&&(s.selected&&!o.select?d.selected=!0:delete d.selected),p==="dialog"&&s.open&&(d.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),p==="canvas"&&c){if(s.__context==="2d")lc(s)||(d.rr_dataURL=s.toDataURL(l.type,l.quality));else if(!("__context"in s)){let w=s.toDataURL(l.type,l.quality),v=t.createElement("canvas");v.width=s.width,v.height=s.height;let x=v.toDataURL(l.type,l.quality);w!==x&&(d.rr_dataURL=w)}}if(p==="img"&&u){He||(He=t.createElement("canvas"),qn=He.getContext("2d"));let w=s,v=w.currentSrc||w.getAttribute("src")||"<unknown-src>",x=w.crossOrigin,N=()=>{w.removeEventListener("load",N);try{He.width=w.naturalWidth,He.height=w.naturalHeight,qn.drawImage(w,0,0),d.rr_dataURL=He.toDataURL(l.type,l.quality)}catch(R){if(w.crossOrigin!=="anonymous"){w.crossOrigin="anonymous",w.complete&&w.naturalWidth!==0?N():w.addEventListener("load",N);return}else console.warn(`Cannot inline img src=${v}! Error: ${R}`)}w.crossOrigin==="anonymous"&&(x?d.crossOrigin=x:w.removeAttribute("crossorigin"))};w.complete&&w.naturalWidth!==0?N():w.addEventListener("load",N)}if(["audio","video"].includes(p)){let w=d;w.rr_mediaState=s.paused?"paused":"played",w.rr_mediaCurrentTime=s.currentTime,w.rr_mediaPlaybackRate=s.playbackRate,w.rr_mediaMuted=s.muted,w.rr_mediaLoop=s.loop,w.rr_mediaVolume=s.volume}if(f||(s.scrollLeft&&(d.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(d.rr_scrollTop=s.scrollTop)),m){let{width:w,height:v}=s.getBoundingClientRect();d={class:d.class,rr_width:`${w}px`,rr_height:`${v}px`}}p==="iframe"&&!h(d.src)&&(s.contentDocument||(d.rr_src=d.src),delete d.src);let b;try{customElements.get(p)&&(b=!0)}catch{}return{type:O.Element,tagName:p,attributes:d,childNodes:[],isSVG:Ec(s)||void 0,needBlock:m,rootId:g,isCustom:b}}function V(s){return s==null?"":s.toLowerCase()}function da(s){return s===!0||s==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s==="all",headMetaDescKeywords:s==="all",headTitleMutations:s==="all"}:s||{}}function Dc(s,e){if(e.comment&&s.type===O.Comment)return!0;if(s.type===O.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&Fi(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(V(s.attributes.name).match(/^msapplication-tile(image|color)$/)||V(s.attributes.name)==="application-name"||V(s.attributes.rel)==="icon"||V(s.attributes.rel)==="apple-touch-icon"||V(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&V(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(V(s.attributes.property).match(/^(og|twitter|fb):/)||V(s.attributes.name).match(/^(og|twitter):/)||V(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(V(s.attributes.name)==="robots"||V(s.attributes.name)==="googlebot"||V(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(V(s.attributes.name)==="author"||V(s.attributes.name)==="generator"||V(s.attributes.name)==="framework"||V(s.attributes.name)==="publisher"||V(s.attributes.name)==="progid"||V(s.attributes.property).match(/^article:/)||V(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(V(s.attributes.name)==="google-site-verification"||V(s.attributes.name)==="yandex-verification"||V(s.attributes.name)==="csrf-token"||V(s.attributes.name)==="p:domain_verify"||V(s.attributes.name)==="verify-v1"||V(s.attributes.name)==="verification"||V(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Je(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m={},inlineImages:p=!1,recordCanvas:d=!1,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:N=()=>!1,newlyAddedElement:R=!1,cssCaptured:A=!1}=e,{needsMask:P}=e,{preserveWhiteSpace:q=!0}=e;P||(P=fa(s,o,a,P===void 0));let se=Nc(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:P,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,dataURLOptions:m,inlineImages:p,recordCanvas:d,keepIframeSrcFn:N,newlyAddedElement:R,cssCaptured:A});if(!se)return console.warn(s,"not serialized"),null;let ie;r.hasNode(s)?ie=r.getId(s):Dc(se,g)||!q&&se.type===O.Text&&!se.textContent.replace(/^\s+|\s+$/gm,"").length?ie=xt:ie=ua();let T=Object.assign(se,{id:ie});if(r.add(s,T),ie===xt)return null;y&&y(s);let ke=!l;if(T.type===O.Element){ke=ke&&!T.needBlock,delete T.needBlock;let X=ee.shadowRoot(s);X&&vt(X)&&(T.isShadowHost=!0)}if((T.type===O.Document||T.type===O.Element)&&ke){g.headWhitespace&&T.type===O.Element&&T.tagName==="head"&&(q=!1);let X={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m,inlineImages:p,recordCanvas:d,preserveWhiteSpace:q,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:N,cssCaptured:!1};if(!(T.type===O.Element&&T.tagName==="textarea"&&T.attributes.value!==void 0)){T.type===O.Element&&T.attributes._cssText!==void 0&&typeof T.attributes._cssText=="string"&&(X.cssCaptured=!0);for(let ue of Array.from(ee.childNodes(s))){let ne=Je(ue,X);ne&&T.childNodes.push(ne)}}let U=null;if(Pi(s)&&(U=ee.shadowRoot(s)))for(let ue of Array.from(ee.childNodes(U))){let ne=Je(ue,X);ne&&(vt(U)&&(ne.isShadow=!0),T.childNodes.push(ne))}}let Le=ee.parentNode(s);return Le&&bt(Le)&&vt(Le)&&(T.isShadow=!0),T.type===O.Element&&T.tagName==="iframe"&&xc(s,()=>{let X=s.contentDocument;if(X&&b){let U=Je(X,{doc:X,mirror:r,blockClass:i,blockSelector:n,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m,inlineImages:p,recordCanvas:d,preserveWhiteSpace:q,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:N});U&&b(s,U)}},w),T.type===O.Element&&T.tagName==="link"&&typeof T.attributes.rel=="string"&&(T.attributes.rel==="stylesheet"||T.attributes.rel==="preload"&&typeof T.attributes.href=="string"&&Fi(T.attributes.href)==="css")&&Mc(s,()=>{if(v){let X=Je(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m,inlineImages:p,recordCanvas:d,preserveWhiteSpace:q,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:N});X&&v(s,X)}},x),T}function Tc(s,e){let{mirror:t=new It,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:f,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:p,onSerialize:d,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:v,keepIframeSrcFn:x=()=>!1}=e||{},N=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}:c===!1?{password:!0}:c,R=da(g);return Je(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:N,maskTextFn:h,maskInputFn:f,slimDOMOptions:R,dataURLOptions:m,inlineImages:l,recordCanvas:u,preserveWhiteSpace:p,onSerialize:d,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:v,keepIframeSrcFn:x,newlyAddedElement:!1})}function $c(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Pc(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}function Wc(s){return s[0].toUpperCase()+s.slice(1)}function Ps(s,e){new zc(e).stringify(s)}function Fs(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>Fs(o,t)):(n==="object"&&i!==null&&(i=Fs(i)),t[r]=i)}return t}function th(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}function Ra(s){return s.map(e=>(e.nodes&&(e.nodes=Ra(e.nodes)),delete e.source,e))}function Oa(s){if(s[Ea]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Oa(e)}function _h(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}function Tr(s,e){let t=new Fh(s,e),r=new Ph(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`
|
|
2
|
+
`).map(r=>r.trim()).filter(Boolean),t=e.find(r=>r.startsWith("at "))??e[1]??"";return hs(t)}function Du(s){let e=[String(s.projectId),hs(s.errorName??""),hs(s.message??""),Ou(s.stack??"")];return(0,Ru.createHash)("sha256").update(e.join("|")).digest("hex")}});var Tn=Gt(we=>{"use strict";var Tu=we&&we.__createBinding||(Object.create?(function(s,e,t,r){r===void 0&&(r=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,i)}):(function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]})),ds=we&&we.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tu(e,s,t)};Object.defineProperty(we,"__esModule",{value:!0});ds(Nn(),we);ds(On(),we);ds(Dn(),we)});function Ln(s){return s<640?"mobile":s<1024?"tablet":"desktop"}function ku(s,e){let t=s;for(;t;){if(t.classList?.contains(e))return!0;t=t.parentElement}return!1}function Lu(s){try{if(s.id)return`#${s.id}`;let e=s.tagName?.toLowerCase();if(!e)return;let t=(s.className&&typeof s.className=="string"?s.className.split(/\s+/).filter(Boolean).slice(0,2):[]).map(r=>`.${r}`);return`${e}${t.join("")}`.slice(0,512)}catch{return}}function $n(s){let e=s.options.mask?.class??"segi-mask",t=!1,r=[],i=-1,n=0,o=(h={})=>{if(r.length===0)return;let f=r.splice(0,r.length);s.sendClicks(f,!!h.useBeacon)},a=setInterval(()=>{t||o()},5e3),l=h=>{if(!t)try{let f=h.target;if(!f||ku(f,e))return;let g=Math.max(document.documentElement.scrollWidth,document.body?.scrollWidth??0,1),m=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0,1),p=h.pageX,d=h.pageY,y=window.innerWidth,b={sessionUid:s.sessionUid,ts:new Date().toISOString(),urlPath:location.pathname.slice(0,255),device:Ln(y),viewportW:y,viewportH:window.innerHeight,x:Math.round(h.clientX),y:Math.round(h.clientY),pageX:Math.round(p),pageY:Math.round(d),relX:Math.max(0,Math.min(1,p/g)),relY:Math.max(0,Math.min(1,d/m)),selector:Lu(f),tag:f.tagName?.toLowerCase().slice(0,32),text:(f.textContent??void 0)?.trim().slice(0,128)||void 0};r.push(b),r.length>=50&&o()}catch{}},u=()=>{if(t)return;let h=Date.now();if(!(h-n<1e3))try{let f=Math.max(document.documentElement.scrollHeight,document.body?.scrollHeight??0,1),g=window.innerHeight,m=Math.round(window.scrollY+g),p=Math.max(0,Math.min(100,Math.round(m/f*100)));if(p<=i)return;i=p,n=h;let d=window.innerWidth;s.sendScroll({sessionUid:s.sessionUid,urlPath:location.pathname.slice(0,255),device:Ln(d),viewportH:g,docH:f,maxScrollY:m,maxScrollPct:p},!1)}catch{}},c=()=>{o({useBeacon:!0})};return window.addEventListener("click",l,!0),window.addEventListener("scroll",u,{capture:!0,passive:!0}),window.addEventListener("pagehide",c),{pause(){t=!0},resume(){t=!1},stop(){clearInterval(a),window.removeEventListener("click",l,!0),window.removeEventListener("scroll",u,!0),window.removeEventListener("pagehide",c),o({useBeacon:!0})},flushClicks:o}}var Pn=je(()=>{"use strict"});function Yt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function Wn(){try{if(typeof sessionStorage>"u")return null;let s=sessionStorage.getItem(Un),e=Number(sessionStorage.getItem(Bn)??"0");return!s||!e?null:{uid:s,at:e}}catch{return null}}function gs(s,e){try{if(typeof sessionStorage>"u")return;sessionStorage.setItem(Un,s),sessionStorage.setItem(Bn,String(e))}catch{}}function zn(){let s=Date.now(),e=Wn();if(e&&s-e.at<18e5)return gs(e.uid,s),e.uid;let t=Yt();return gs(t,s),$u=t,t}function Vn(){let s=Wn();s&&gs(s.uid,Date.now())}function ys(){try{if(typeof localStorage>"u")return Ge||(Ge=Yt()),Ge;let s=localStorage.getItem(Fn);if(s)return s;let e=Yt();return localStorage.setItem(Fn,e),e}catch{return Ge||(Ge=Yt()),Ge}}var Un,Bn,Fn,$u,Ge,jn=je(()=>{"use strict";Un="_bd_session_uid",Bn="_bd_session_at",Fn="_bd_anon",$u=null,Ge=null});function Gn(s){return(s&&s.trim()||Pu).replace(/\/+$/,"").replace(/\/api\/ingest\/events$/,"").replace(/\/api\/ingest$/,"").replace(/\/api$/,"")}async function Ne(s,e,t){let r=`${Gn(s.endpoint)}/api/trace${e}`;try{return await fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-Segi-Project-Key":s.projectKey},body:JSON.stringify(t)})}catch{return null}}function ws(s,e,t){try{if(typeof navigator>"u"||!navigator.sendBeacon)return!1;let r=`${Gn(s.endpoint)}/api/trace${e}?pk=${encodeURIComponent(s.projectKey)}`,i=new Blob([JSON.stringify(t)],{type:"application/json"});return navigator.sendBeacon(r,i)}catch{return!1}}var Pu,Hn=je(()=>{"use strict";Pu="https://segiapi.extn.ai"});var ou={};Ht(ou,{EventType:()=>I,IncrementalSource:()=>E,MouseInteractions:()=>$,Replayer:()=>Li,ReplayerEvents:()=>L,addCustomEvent:()=>Ym,canvasMutation:()=>_i,freezePage:()=>Xm,mirror:()=>Vr,record:()=>_e,takeFullSnapshot:()=>Zm,utils:()=>am});function $i(s){if(Xt[s])return Xt[s];let e=globalThis[s],t=e.prototype,r=s in Zn?Zn[s]:void 0,i=!!(r&&r.every(a=>{var l,u;return!!((u=(l=Object.getOwnPropertyDescriptor(t,a))==null?void 0:l.get)!=null&&u.toString().includes("[native code]"))})),n=s in Kn?Kn[s]:void 0,o=!!(n&&n.every(a=>{var l;return typeof t[a]=="function"&&((l=t[a])==null?void 0:l.toString().includes("[native code]"))}));if(i&&o&&!zu())return Xt[s]=e.prototype,e.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return e.prototype;let u=l[s].prototype;return document.body.removeChild(a),u?Xt[s]=u:t}catch{return t}}function Ie(s,e,t){var r;let i=`${s}.${String(t)}`;if(Ss[i])return Ss[i].call(e);let n=$i(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Ss[i]=o,o.call(e)):e[t]}function oa(s,e,t){let r=`${s}.${String(t)}`;if(bs[r])return bs[r].bind(e);let n=$i(s)[t];return typeof n!="function"?e[t]:(bs[r]=n,n.bind(e))}function Vu(s){return Ie("Node",s,"ownerDocument")}function ju(s){return Ie("Node",s,"childNodes")}function Gu(s){return Ie("Node",s,"parentNode")}function Hu(s){return Ie("Node",s,"parentElement")}function Yu(s){return Ie("Node",s,"textContent")}function Xu(s,e){return oa("Node",s,"contains")(e)}function Zu(s){return oa("Node",s,"getRootNode")()}function Ku(s){return!s||!("host"in s)?null:Ie("ShadowRoot",s,"host")}function Ju(s){return s.styleSheets}function qu(s){return!s||!("shadowRoot"in s)?null:Ie("Element",s,"shadowRoot")}function Qu(s,e){return Ie("Element",s,"querySelector")(e)}function ec(s,e){return Ie("Element",s,"querySelectorAll")(e)}function tc(){return $i("MutationObserver").constructor}function rc(s,e,t){try{if(!(e in s))return()=>{};let r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}function Pi(s){return s.nodeType===s.ELEMENT_NODE}function bt(s){let e=s&&"host"in s&&"mode"in s&&ee.host(s)||null;return!!(e&&"shadowRoot"in e&&ee.shadowRoot(e)===s)}function vt(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function sc(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function ic(s){let{cssText:e}=s;if(e.split('"').length<3)return e;let t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function ks(s){try{let e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);let r=Array.from(e,i=>aa(i,t)).join("");return sc(r)}catch{return null}}function aa(s,e){if(oc(s)){let t;try{t=ks(s.styleSheet)||ic(s)}catch{t=s.cssText}return s.styleSheet.href?Nr(t,s.styleSheet.href):t}else{let t=s.cssText;return ac(s)&&s.selectorText.includes(":")&&(t=nc(t)),e?Nr(t,e):t}}function nc(s){let e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function oc(s){return"styleSheet"in s}function ac(s){return"selectorText"in s}function la(){return new It}function xr({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||"",a=r&&Te(r);return(e[t.toLowerCase()]||a&&e[a])&&(n?o=n(o,s):o="*".repeat(o.length)),o}function Te(s){return s.toLowerCase()}function lc(s){let e=s.getContext("2d");if(!e)return!0;let t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){let n=e.getImageData,o=Jn in n?n[Jn]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(l=>l!==0))return!1}return!0}function uc(s,e){return!s||!e||s.type!==e.type?!1:s.type===O.Document?s.compatMode===e.compatMode:s.type===O.DocumentType?s.name===e.name&&s.publicId===e.publicId&&s.systemId===e.systemId:s.type===O.Comment||s.type===O.Text||s.type===O.CDATA?s.textContent===e.textContent:s.type===O.Element?s.tagName===e.tagName&&JSON.stringify(s.attributes)===JSON.stringify(e.attributes)&&s.isSVG===e.isSVG&&s.needBlock===e.needBlock:!1}function Mr(s){let e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Te(e):null}function Fi(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}let r=/\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return i?.[1]??null}function cc(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}function Nr(s,e){return(s||"").replace(hc,(t,r,i,n,o,a)=>{let l=i||o||a,u=r||n||"";if(!l)return t;if(fc.test(l)||dc.test(l))return`url(${u}${l}${u})`;if(pc.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${cc(e)+l}${u})`;let c=e.split("/"),h=l.split("/");c.pop();for(let f of h)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}function Zt(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function mc(s,e,t=!1){let r=Array.from(e.childNodes),i=[],n=0;if(r.length>1&&s&&typeof s=="string"){let o=Zt(s,t),a=o.length/s.length;for(let l=1;l<r.length;l++)if(r[l].textContent&&typeof r[l].textContent=="string"){let u=Zt(r[l].textContent,t),c=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let f=u.substring(0,h),g=o.split(f),m=-1;if(g.length===2)m=g[0].length;else if(g.length>2&&g[0]===""&&r[l-1].textContent!=="")m=o.indexOf(f,1);else if(g.length===1){if(f=f.substring(0,f.length-1),g=o.split(f),g.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(m=o.indexOf(f));if(g.length>=2&&h>c){let p=r[l-1].textContent;if(p&&typeof p=="string"){let d=Zt(p).length;m=o.indexOf(f,d)}m===-1&&(m=g[0].length)}if(m!==-1){let p=Math.floor(m/a);for(;p>0&&p<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;let d=Zt(s.substring(0,p),t);if(d.length===m){i.push(s.substring(0,p)),s=s.substring(p),o=o.substring(m);break}else d.length<m?p+=Math.max(1,Math.floor((m-d.length)/a)):p-=Math.max(1,Math.floor((d.length-m)*a))}break}}}}return i.push(s),i}function gc(s,e){return mc(s,e).join("/* rr_split */")}function ua(){return yc++}function Sc(s){if(s instanceof HTMLFormElement)return"form";let e=Te(s.tagName);return wc.test(e)?"div":e}function Cc(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o,a=n.exec(e.substring(t));return a?(o=a[0],t+=o.length,o):""}let i=[];for(;r(vc),!(t>=e.length);){let n=r(bc);if(n.slice(-1)===",")n=Ke(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Ke(s,n);let a=!1;for(;;){let l=e.charAt(t);if(l===""){i.push((n+o).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){t+=1,i.push((n+o).trim());break}else l==="("&&(a=!0);o+=l,t+=1}}}return i.join(", ")}function Ke(s,e){return!e||e.trim()===""?e:Ui(s,e)}function Ec(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function Ui(s,e){let t=Qn.get(s);if(t||(t=s.createElement("a"),Qn.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function ca(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&["table","td","th"].includes(e)?Ke(s,r):t==="srcset"?Cc(s,r):t==="style"?Nr(r,Ui(s)):e==="object"&&t==="data"?Ke(s,r):r)}function ha(s,e,t){return["video","audio"].includes(s)&&e==="autoplay"}function Ic(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function Ar(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Ar(ee.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){let i=s.classList[r];if(e.test(i))return!0}return t?Ar(ee.parentNode(s),e,t):!1}function fa(s,e,t,r){let i;if(Pi(s)){if(i=s,!ee.childNodes(i).length)return!1}else{if(ee.parentElement(s)===null)return!1;i=ee.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Ar(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function xc(s,e,t){let r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!=="complete"){let a=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(a),i=!0,e()});return}let o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function Mc(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;let n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function Nc(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:f,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:p=!1,cssCaptured:d=!1}=e,y=Ac(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:O.Document,childNodes:[],compatMode:s.compatMode}:{type:O.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:O.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:y};case s.ELEMENT_NODE:return Oc(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,dataURLOptions:h,inlineImages:f,recordCanvas:g,keepIframeSrcFn:m,newlyAddedElement:p,rootId:y});case s.TEXT_NODE:return Rc(s,{doc:t,needsMask:o,maskTextFn:u,rootId:y,cssCaptured:d});case s.CDATA_SECTION_NODE:return{type:O.CDATA,textContent:"",rootId:y};case s.COMMENT_NODE:return{type:O.Comment,textContent:ee.textContent(s)||"",rootId:y};default:return!1}}function Ac(s,e){if(!e.hasNode(s))return;let t=e.getId(s);return t===1?void 0:t}function Rc(s,e){let{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=ee.parentNode(s),a=o&&o.tagName,l="",u=a==="STYLE"?!0:void 0,c=a==="SCRIPT"?!0:void 0;return c?l="SCRIPT_PLACEHOLDER":n||(l=ee.textContent(s),u&&l&&(l=Nr(l,Ui(e.doc)))),!u&&!c&&l&&t&&(l=r?r(l,ee.parentElement(s)):l.replace(/[\S]/g,"*")),{type:O.Text,textContent:l||"",rootId:i}}function Oc(s,e){let{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:a,dataURLOptions:l={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:g}=e,m=Ic(s,r,i),p=Sc(s),d={},y=s.attributes.length;for(let w=0;w<y;w++){let v=s.attributes[w];ha(p,v.name,v.value)||(d[v.name]=ca(t,p,Te(v.name),v.value))}if(p==="link"&&n){let w=Array.from(t.styleSheets).find(x=>x.href===s.href),v=null;w&&(v=ks(w)),v&&(delete d.rel,delete d.href,d._cssText=v)}if(p==="style"&&s.sheet){let w=ks(s.sheet);w&&(s.childNodes.length>1&&(w=gc(w,s)),d._cssText=w)}if(["input","textarea","select"].includes(p)){let w=s.value,v=s.checked;d.type!=="radio"&&d.type!=="checkbox"&&d.type!=="submit"&&d.type!=="button"&&w?d.value=xr({element:s,type:Mr(s),tagName:p,value:w,maskInputOptions:o,maskInputFn:a}):v&&(d.checked=v)}if(p==="option"&&(s.selected&&!o.select?d.selected=!0:delete d.selected),p==="dialog"&&s.open&&(d.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),p==="canvas"&&c){if(s.__context==="2d")lc(s)||(d.rr_dataURL=s.toDataURL(l.type,l.quality));else if(!("__context"in s)){let w=s.toDataURL(l.type,l.quality),v=t.createElement("canvas");v.width=s.width,v.height=s.height;let x=v.toDataURL(l.type,l.quality);w!==x&&(d.rr_dataURL=w)}}if(p==="img"&&u){He||(He=t.createElement("canvas"),qn=He.getContext("2d"));let w=s,v=w.currentSrc||w.getAttribute("src")||"<unknown-src>",x=w.crossOrigin,N=()=>{w.removeEventListener("load",N);try{He.width=w.naturalWidth,He.height=w.naturalHeight,qn.drawImage(w,0,0),d.rr_dataURL=He.toDataURL(l.type,l.quality)}catch(R){if(w.crossOrigin!=="anonymous"){w.crossOrigin="anonymous",w.complete&&w.naturalWidth!==0?N():w.addEventListener("load",N);return}else console.warn(`Cannot inline img src=${v}! Error: ${R}`)}w.crossOrigin==="anonymous"&&(x?d.crossOrigin=x:w.removeAttribute("crossorigin"))};w.complete&&w.naturalWidth!==0?N():w.addEventListener("load",N)}if(["audio","video"].includes(p)){let w=d;w.rr_mediaState=s.paused?"paused":"played",w.rr_mediaCurrentTime=s.currentTime,w.rr_mediaPlaybackRate=s.playbackRate,w.rr_mediaMuted=s.muted,w.rr_mediaLoop=s.loop,w.rr_mediaVolume=s.volume}if(f||(s.scrollLeft&&(d.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(d.rr_scrollTop=s.scrollTop)),m){let{width:w,height:v}=s.getBoundingClientRect();d={class:d.class,rr_width:`${w}px`,rr_height:`${v}px`}}p==="iframe"&&!h(d.src)&&(s.contentDocument||(d.rr_src=d.src),delete d.src);let b;try{customElements.get(p)&&(b=!0)}catch{}return{type:O.Element,tagName:p,attributes:d,childNodes:[],isSVG:Ec(s)||void 0,needBlock:m,rootId:g,isCustom:b}}function V(s){return s==null?"":s.toLowerCase()}function da(s){return s===!0||s==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s==="all",headMetaDescKeywords:s==="all",headTitleMutations:s==="all"}:s||{}}function Dc(s,e){if(e.comment&&s.type===O.Comment)return!0;if(s.type===O.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&Fi(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(V(s.attributes.name).match(/^msapplication-tile(image|color)$/)||V(s.attributes.name)==="application-name"||V(s.attributes.rel)==="icon"||V(s.attributes.rel)==="apple-touch-icon"||V(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&V(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(V(s.attributes.property).match(/^(og|twitter|fb):/)||V(s.attributes.name).match(/^(og|twitter):/)||V(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(V(s.attributes.name)==="robots"||V(s.attributes.name)==="googlebot"||V(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(V(s.attributes.name)==="author"||V(s.attributes.name)==="generator"||V(s.attributes.name)==="framework"||V(s.attributes.name)==="publisher"||V(s.attributes.name)==="progid"||V(s.attributes.property).match(/^article:/)||V(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(V(s.attributes.name)==="google-site-verification"||V(s.attributes.name)==="yandex-verification"||V(s.attributes.name)==="csrf-token"||V(s.attributes.name)==="p:domain_verify"||V(s.attributes.name)==="verify-v1"||V(s.attributes.name)==="verification"||V(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Je(s,e){let{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m={},inlineImages:p=!1,recordCanvas:d=!1,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:N=()=>!1,newlyAddedElement:R=!1,cssCaptured:A=!1}=e,{needsMask:P}=e,{preserveWhiteSpace:q=!0}=e;P||(P=fa(s,o,a,P===void 0));let se=Nc(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:P,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,dataURLOptions:m,inlineImages:p,recordCanvas:d,keepIframeSrcFn:N,newlyAddedElement:R,cssCaptured:A});if(!se)return console.warn(s,"not serialized"),null;let ie;r.hasNode(s)?ie=r.getId(s):Dc(se,g)||!q&&se.type===O.Text&&!se.textContent.replace(/^\s+|\s+$/gm,"").length?ie=xt:ie=ua();let T=Object.assign(se,{id:ie});if(r.add(s,T),ie===xt)return null;y&&y(s);let ke=!l;if(T.type===O.Element){ke=ke&&!T.needBlock,delete T.needBlock;let X=ee.shadowRoot(s);X&&vt(X)&&(T.isShadowHost=!0)}if((T.type===O.Document||T.type===O.Element)&&ke){g.headWhitespace&&T.type===O.Element&&T.tagName==="head"&&(q=!1);let X={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m,inlineImages:p,recordCanvas:d,preserveWhiteSpace:q,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:N,cssCaptured:!1};if(!(T.type===O.Element&&T.tagName==="textarea"&&T.attributes.value!==void 0)){T.type===O.Element&&T.attributes._cssText!==void 0&&typeof T.attributes._cssText=="string"&&(X.cssCaptured=!0);for(let ue of Array.from(ee.childNodes(s))){let ne=Je(ue,X);ne&&T.childNodes.push(ne)}}let U=null;if(Pi(s)&&(U=ee.shadowRoot(s)))for(let ue of Array.from(ee.childNodes(U))){let ne=Je(ue,X);ne&&(vt(U)&&(ne.isShadow=!0),T.childNodes.push(ne))}}let Le=ee.parentNode(s);return Le&&bt(Le)&&vt(Le)&&(T.isShadow=!0),T.type===O.Element&&T.tagName==="iframe"&&xc(s,()=>{let X=s.contentDocument;if(X&&b){let U=Je(X,{doc:X,mirror:r,blockClass:i,blockSelector:n,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m,inlineImages:p,recordCanvas:d,preserveWhiteSpace:q,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:N});U&&b(s,U)}},w),T.type===O.Element&&T.tagName==="link"&&typeof T.attributes.rel=="string"&&(T.attributes.rel==="stylesheet"||T.attributes.rel==="preload"&&typeof T.attributes.href=="string"&&Fi(T.attributes.href)==="css")&&Mc(s,()=>{if(v){let X=Je(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:f,slimDOMOptions:g,dataURLOptions:m,inlineImages:p,recordCanvas:d,preserveWhiteSpace:q,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:N});X&&v(s,X)}},x),T}function Tc(s,e){let{mirror:t=new It,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:f,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:p,onSerialize:d,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:v,keepIframeSrcFn:x=()=>!1}=e||{},N=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}:c===!1?{password:!0}:c,R=da(g);return Je(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:N,maskTextFn:h,maskInputFn:f,slimDOMOptions:R,dataURLOptions:m,inlineImages:l,recordCanvas:u,preserveWhiteSpace:p,onSerialize:d,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:v,keepIframeSrcFn:x,newlyAddedElement:!1})}function $c(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Pc(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}function Wc(s){return s[0].toUpperCase()+s.slice(1)}function Ps(s,e){new zc(e).stringify(s)}function Fs(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>Fs(o,t)):(n==="object"&&i!==null&&(i=Fs(i)),t[r]=i)}return t}function th(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}function Ra(s){return s.map(e=>(e.nodes&&(e.nodes=Ra(e.nodes)),delete e.source,e))}function Oa(s){if(s[Ea]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)Oa(e)}function _h(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}function Tr(s,e){let t=new Fh(s,e),r=new Ph(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`
|
|
3
3
|
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(e.from)?i.message+=`
|
|
4
4
|
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(e.from)&&(i.message+=`
|
|
5
5
|
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}function mt(s){return typeof s=="object"&&typeof s.then=="function"}function za(s){let e=!1,t=Yh[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,st,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,st,t+"Exit"]:[t,t+"Exit"]}function wo(s){let e;return s.type==="document"?e=["Document",st,"DocumentExit"]:s.type==="root"?e=["Root",st,"RootExit"]:e=za(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function Ys(s){return s[me]=!1,s.nodes&&s.nodes.forEach(e=>Ys(e)),s}function Rt(s,e){if(Array.isArray(s))return s.map(i=>Rt(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:ff.prototype};n.map&&(n.map={...n.map,__proto__:uf.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>Rt(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new df(r);if(r.type==="decl")return new lf(r);if(r.type==="rule")return new pf(r);if(r.type==="comment")return new cf(r);if(r.type==="atrule")return new hf(r);throw new Error("Unknown node type: "+s.type)}function B(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new Zi(s)}function Af(s){let e=So[s.tagName]?So[s.tagName]:s.tagName;return e==="link"&&s.attributes._cssText&&(e="style"),e}function es(s,e){let t=e?.stylesWithHoverClass.get(s);if(t)return t;let r=s;try{r=H([kc,Lc]).process(s).css}catch(i){console.warn("Failed to adapt css for replay",i)}return e?.stylesWithHoverClass.set(s,r),r}function bo(){return{stylesWithHoverClass:new Map}}function Rf(s,e,t,r){let i=[];for(let l of s.childNodes)l.type===O.Text&&i.push(l);let n=e.split("/* rr_split */");for(;n.length>1&&n.length>i.length;)n.splice(-2,2,n.slice(-2).join(""));let o="";t&&(o=es(n.join(""),r));let a=0;for(let l=0;l<i.length&&l!==n.length;l++){let u=i[l];if(!t)u.textContent=n[l];else if(l<n.length-1){let c=a,h=n[l+1].length;h=Math.min(h,30);let f=!1;for(;h>2;h--){let g=n[l+1].substring(0,h),m=o.substring(a).indexOf(g);if(f=m!==-1,f){c+=m;break}}f||(c+=n[l].length),u.textContent=o.substring(a,c),a=c}else u.textContent=o.substring(a)}}function Of(s,e,t,r){let{doc:i,hackCss:n,cache:o}=r;s.childNodes.length?Rf(s,t,n,o):(n&&(t=es(t,o)),e.appendChild(i.createTextNode(t)))}function Df(s,e){var t;let{doc:r,hackCss:i,cache:n}=e;switch(s.type){case O.Document:return r.implementation.createDocument(null,"",null);case O.DocumentType:return r.implementation.createDocumentType(s.name||"html",s.publicId,s.systemId);case O.Element:{let o=Af(s),a;s.isSVG?a=r.createElementNS("http://www.w3.org/2000/svg",o):(s.isCustom&&((t=r.defaultView)!=null&&t.customElements)&&!r.defaultView.customElements.get(s.tagName)&&r.defaultView.customElements.define(s.tagName,class extends r.defaultView.HTMLElement{}),a=r.createElement(o));let l={};for(let u in s.attributes){if(!Object.prototype.hasOwnProperty.call(s.attributes,u))continue;let c=s.attributes[u];if(!(o==="option"&&u==="selected"&&c===!1)&&c!==null){if(c===!0&&(c=""),u.startsWith("rr_")){l[u]=c;continue}if(typeof c=="string"){if(o==="style"&&u==="_cssText"){Of(s,a,c,e);continue}else if(o==="textarea"&&u==="value"){a.appendChild(r.createTextNode(c)),s.childNodes=[];continue}}try{if(s.isSVG&&u==="xlink:href")a.setAttributeNS("http://www.w3.org/1999/xlink",u,c.toString());else if(u==="onload"||u==="onclick"||u.substring(0,7)==="onmouse")a.setAttribute("_"+u,c.toString());else if(o==="meta"&&s.attributes["http-equiv"]==="Content-Security-Policy"&&u==="content"){a.setAttribute("csp-content",c.toString());continue}else o==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||o==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&Fi(s.attributes.href)==="js"||(o==="img"&&s.attributes.srcset&&s.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",s.attributes.srcset):a.setAttribute(u,c.toString()))}catch{}}}for(let u in l){let c=l[u];if(o==="canvas"&&u==="rr_dataURL"){let h=r.createElement("img");h.onload=()=>{let f=a.getContext("2d");f&&f.drawImage(h,0,0,h.width,h.height)},h.src=c.toString(),a.RRNodeType&&(a.rr_dataURL=c.toString())}else if(o==="img"&&u==="rr_dataURL"){let h=a;h.currentSrc.startsWith("data:")||(h.setAttribute("rrweb-original-src",s.attributes.src),h.src=c.toString())}if(u==="rr_width")a.style.setProperty("width",c.toString());else if(u==="rr_height")a.style.setProperty("height",c.toString());else if(u==="rr_mediaCurrentTime"&&typeof c=="number")a.currentTime=c;else if(u==="rr_mediaState")switch(c){case"played":a.play().catch(h=>console.warn("media playback error",h));break;case"paused":a.pause();break}else u==="rr_mediaPlaybackRate"&&typeof c=="number"?a.playbackRate=c:u==="rr_mediaMuted"&&typeof c=="boolean"?a.muted=c:u==="rr_mediaLoop"&&typeof c=="boolean"?a.loop=c:u==="rr_mediaVolume"&&typeof c=="number"?a.volume=c:u==="rr_open_mode"&&a.setAttribute("rr_open_mode",c)}if(s.isShadowHost)if(!a.shadowRoot)a.attachShadow({mode:"open"});else for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);return a}case O.Text:return s.isStyle&&i?r.createTextNode(es(s.textContent,n)):r.createTextNode(s.textContent);case O.CDATA:return r.createCDATASection(s.textContent);case O.Comment:return r.createComment(s.textContent);default:return null}}function Ct(s,e){let{doc:t,mirror:r,skipChild:i=!1,hackCss:n=!0,afterAppend:o,cache:a}=e;if(r.has(s.id)){let u=r.getNode(s.id),c=r.getMeta(u);if(uc(c,s))return r.getNode(s.id)}let l=Df(s,{doc:t,hackCss:n,cache:a});if(!l)return null;if(s.rootId&&r.getNode(s.rootId)!==t&&r.replace(s.rootId,t),s.type===O.Document&&(t.close(),t.open(),s.compatMode==="BackCompat"&&s.childNodes&&s.childNodes[0].type!==O.DocumentType&&(s.childNodes[0].type===O.Element&&"xmlns"in s.childNodes[0].attributes&&s.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?t.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):t.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=t),r.add(l,s),(s.type===O.Document||s.type===O.Element)&&!i)for(let u of s.childNodes){let c=Ct(u,{doc:t,mirror:r,skipChild:!1,hackCss:n,afterAppend:o,cache:a});if(!c){console.warn("Failed to rebuild",u);continue}if(u.isShadow&&Pi(l)&&l.shadowRoot)l.shadowRoot.appendChild(c);else if(s.type===O.Document&&u.type==O.Element){let h=c,f=null;h.childNodes.forEach(g=>{g.nodeName==="BODY"&&(f=g)}),f?(h.removeChild(f),l.appendChild(c),h.appendChild(f)):l.appendChild(c)}else l.appendChild(c);o&&o(c,u.id)}return l}function Tf(s,e){function t(r){e(r)}for(let r of s.getIds())s.has(r)&&t(s.getNode(r))}function _f(s,e){let t=e.getMeta(s);if(t?.type!==O.Element)return;let r=s;for(let i in t.attributes){if(!(Object.prototype.hasOwnProperty.call(t.attributes,i)&&i.startsWith("rr_")))continue;let n=t.attributes[i];i==="rr_scrollLeft"&&(r.scrollLeft=n),i==="rr_scrollTop"&&(r.scrollTop=n)}}function kf(s,e){let{doc:t,onVisit:r,hackCss:i=!0,afterAppend:n,cache:o,mirror:a=new It}=e,l=Ct(s,{doc:t,mirror:a,skipChild:!1,hackCss:i,afterAppend:n,cache:o});return Tf(a,u=>{r&&r(u),_f(u,a)}),l}function Bf(){return new Uf}function Wf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function zf(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}function Hf(s){return s[0].toUpperCase()+s.slice(1)}function qs(s,e){new Yf(e).stringify(s)}function Qs(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>Qs(o,t)):(n==="object"&&i!==null&&(i=Qs(i)),t[r]=i)}return t}function od(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}function fl(s){return s.map(e=>(e.nodes&&(e.nodes=fl(e.nodes)),delete e.source,e))}function dl(s){if(s[ol]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)dl(e)}function Fd(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}function $r(s,e){let t=new Vd(s,e),r=new zd(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`
|
|
@@ -58,7 +58,7 @@ https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.p
|
|
|
58
58
|
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
59
59
|
https://www.w3ctech.com/topic/2226`));let a=t(...o);return a.postcssPlugin=e,a.postcssVersion=new on().version,a}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,a,l){return W([i(l)]).process(o,a)},i};W.stringify=Ep;W.parse=Ap;W.fromJSON=Ip;W.list=Rp;W.comment=s=>new Ol(s);W.atRule=s=>new Dl(s);W.decl=s=>new Al(s);W.rule=s=>new Tl(s);W.root=s=>new _l(s);W.document=s=>new Rl(s);W.CssSyntaxError=bp;W.Declaration=Al;W.Container=Cp;W.Processor=on;W.Document=Rl;W.Comment=Ol;W.Warning=xp;W.AtRule=Dl;W.Result=Mp;W.Input=Np;W.Rule=Tl;W.Root=_l;W.Node=Op;vp.registerPostcss(W);Dp=W;W.default=W;Y=Wf(Dp);Y.stringify;Y.fromJSON;Y.plugin;Y.parse;Y.list;Y.document;Y.comment;Y.atRule;Y.rule;Y.decl;Y.root;Y.CssSyntaxError;Y.Declaration;Y.Container;Y.Processor;Y.Document;Y.Comment;Y.Warning;Y.AtRule;Y.Result;Y.Input;Y.Rule;Y.Root;Y.Node;_=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(_||{});_p=/-([a-z])/g,kp=/^--[a-zA-Z0-9-]+$/,hi=s=>kp.test(s)?s:s.replace(_p,(e,t)=>t?t.toUpperCase():""),Lp=/\B([A-Z])/g,$p=s=>s.replace(Lp,"-$1").toLowerCase(),fe=class s{constructor(...e){C(this,"parentElement",null),C(this,"parentNode",null),C(this,"ownerDocument"),C(this,"firstChild",null),C(this,"lastChild",null),C(this,"previousSibling",null),C(this,"nextSibling",null),C(this,"ELEMENT_NODE",1),C(this,"TEXT_NODE",3),C(this,"nodeType"),C(this,"nodeName"),C(this,"RRNodeType")}get childNodes(){let e=[],t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof s){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}},fi=class s extends fe{constructor(...e){super(e),C(this,"nodeType",9),C(this,"nodeName","#document"),C(this,"compatMode","CSS1Compat"),C(this,"RRNodeType",_.Document),C(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(e=>e.RRNodeType===_.Element&&e.tagName==="HTML")||null}get body(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===_.Element&&t.tagName==="BODY"))||null}get head(){var e;return((e=this.documentElement)==null?void 0:e.childNodes.find(t=>t.RRNodeType===_.Element&&t.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){let t=e.RRNodeType;if((t===_.Element||t===_.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===t))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===_.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);let r=an(this,e);return r.parentElement=null,r}insertBefore(e,t){let r=e.RRNodeType;if((r===_.Element||r===_.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===_.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);let i=kl(this,e,t);return i.parentElement=null,i}removeChild(e){return Ll(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if(e==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?t="-//W3C//DTD XHTML 1.0 Transitional//EN":e==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){let r=this.createDocumentType("html",t,"");this.open(),this.appendChild(r)}}createDocument(e,t,r){return new s}createDocumentType(e,t,r){let i=new Pr(e,t,r);return i.ownerDocument=this,i}createElement(e){let t=new lt(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){let t=new Fr(e);return t.ownerDocument=this,t}createComment(e){let t=new Ur(e);return t.ownerDocument=this,t}createCDATASection(e){let t=new Br(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}},Pr=class extends fe{constructor(e,t,r){super(),C(this,"nodeType",10),C(this,"RRNodeType",_.DocumentType),C(this,"name"),C(this,"publicId"),C(this,"systemId"),C(this,"textContent",null),this.name=e,this.publicId=t,this.systemId=r,this.nodeName=e}toString(){return"RRDocumentType"}},lt=class extends fe{constructor(e){super(),C(this,"nodeType",1),C(this,"RRNodeType",_.Element),C(this,"tagName"),C(this,"attributes",{}),C(this,"shadowRoot",null),C(this,"scrollLeft"),C(this,"scrollTop"),this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(t=>e+=t.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new mi(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){let e=this.attributes.style?Tp(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(r,i,n)=>{if(t.test(r))return;let o=hi(r);i?e[o]=i:delete e[o],n==="important"&&(e[o]+=" !important"),this.attributes.style=Uo(e)},e.removeProperty=r=>{if(t.test(r))return"";let i=hi(r),n=e[i]||"";return delete e[i],this.attributes.style=Uo(e),n},e}getAttribute(e){return this.attributes[e]===void 0?null:this.attributes[e]}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,r){this.setAttribute(t,r)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return an(this,e)}insertBefore(e,t){return kl(this,e,t)}removeChild(e){return Ll(this,e)}attachShadow(e){let t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(let t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}},di=class extends lt{constructor(){super(...arguments),C(this,"currentTime"),C(this,"volume"),C(this,"paused"),C(this,"muted"),C(this,"playbackRate"),C(this,"loop")}attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}},pi=class extends lt{constructor(){super(...arguments),C(this,"tagName","DIALOG"),C(this,"nodeName","DIALOG")}get isModal(){return this.getAttribute("rr_open_mode")==="modal"}get open(){return this.getAttribute("open")!==null}close(){this.removeAttribute("open"),this.removeAttribute("rr_open_mode")}show(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","non-modal")}showModal(){this.setAttribute("open",""),this.setAttribute("rr_open_mode","modal")}},Fr=class extends fe{constructor(e){super(),C(this,"nodeType",3),C(this,"nodeName","#text"),C(this,"RRNodeType",_.Text),C(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}},Ur=class extends fe{constructor(e){super(),C(this,"nodeType",8),C(this,"nodeName","#comment"),C(this,"RRNodeType",_.Comment),C(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}},Br=class extends fe{constructor(e){super(),C(this,"nodeName","#cdata-section"),C(this,"nodeType",4),C(this,"RRNodeType",_.CDATA),C(this,"data"),this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}},mi=class{constructor(e,t){if(C(this,"onChange"),C(this,"classes",[]),C(this,"add",(...r)=>{for(let i of r){let n=String(i);this.classes.indexOf(n)>=0||this.classes.push(n)}this.onChange&&this.onChange(this.classes.join(" "))}),C(this,"remove",(...r)=>{this.classes=this.classes.filter(i=>r.indexOf(i)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),e){let r=e.trim().split(/\s+/);this.classes.push(...r)}this.onChange=t}};ae=(s=>(s[s.PLACEHOLDER=0]="PLACEHOLDER",s[s.ELEMENT_NODE=1]="ELEMENT_NODE",s[s.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",s[s.TEXT_NODE=3]="TEXT_NODE",s[s.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",s[s.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",s[s.ENTITY_NODE=6]="ENTITY_NODE",s[s.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",s[s.COMMENT_NODE=8]="COMMENT_NODE",s[s.DOCUMENT_NODE=9]="DOCUMENT_NODE",s[s.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",s[s.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",s))(ae||{}),gi={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Pp={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"},ye=null;ut=class s extends fi{constructor(e){super(),C(this,"UNSERIALIZED_STARTING_ID",-2),C(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),C(this,"mirror",Yp()),C(this,"scrollData",null),e&&(this.mirror=e)}get unserializedId(){return this._unserializedId--}createDocument(e,t,r){return new s}createDocumentType(e,t,r){let i=new Wp(e,t,r);return i.ownerDocument=this,i}createElement(e){let t=e.toUpperCase(),r;switch(t){case"AUDIO":case"VIDEO":r=new yi(t);break;case"IFRAME":r=new vi(t,this.mirror);break;case"CANVAS":r=new Si(t);break;case"STYLE":r=new bi(t);break;case"DIALOG":r=new wi(t);break;default:r=new ct(t);break}return r.ownerDocument=this,r}createComment(e){let t=new Vp(e);return t.ownerDocument=this,t}createCDATASection(e){let t=new jp(e);return t.ownerDocument=this,t}createTextNode(e){let t=new zp(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}},Wp=Pr,ct=class extends lt{constructor(){super(...arguments),C(this,"inputData",null),C(this,"scrollData",null)}},yi=class extends di{},wi=class extends pi{},Si=class extends ct{constructor(){super(...arguments),C(this,"rr_dataURL",null),C(this,"canvasMutations",[])}getContext(){return null}},bi=class extends ct{constructor(){super(...arguments),C(this,"rules",[])}},vi=class extends ct{constructor(e,t){super(e),C(this,"contentDocument",new ut),this.contentDocument.mirror=t}},zp=Fr,Vp=Ur,jp=Br;Ci=class{constructor(){C(this,"idNodeMap",new Map),C(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};Bo={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Wo={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pr={},Xp=()=>!!globalThis.Zone;Rs={};Os={};D={ownerDocument:Zp,childNodes:Kp,parentNode:Jp,parentElement:qp,textContent:Qp,contains:em,getRootNode:tm,host:rm,styleSheets:sm,shadowRoot:im,querySelector:nm,querySelectorAll:om,mutationObserver:Bl,patch:ze};Xe=`Please stop import mirror directly. Instead of that,\r
|
|
60
60
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
61
|
-
or you can use record.mirror to access the mirror instance during recording.`,Vr={map:{},getId(){return console.error(Xe),-1},getNode(){return console.error(Xe),null},removeNodeFromMap(){console.error(Xe)},has(){return console.error(Xe),!1},reset(){console.error(Xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Vr=new Proxy(Vr,{get(s,e,t){return e==="map"&&console.error(Xe),Reflect.get(s,e,t)}}));kt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(kt=()=>new Date().getTime());Lt=class{constructor(){S(this,"id",1),S(this,"styleIDMap",new WeakMap),S(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};am=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Lt,get _mirror(){return Vr},closestElementOfNode:dn,getBaseDimension:wn,getNestedRule:qe,getPositionsAndIndex:Ei,getRootShadowHost:jl,getShadowHost:Sn,getWindowHeight:hn,getWindowScroll:cn,getWindowWidth:fn,hasShadowRoot:Oe,hookSetter:Bt,inDom:bn,isAncestorRemoved:pn,isBlocked:re,isIgnored:Cr,isSerialized:Wl,isSerializedIframe:tt,isSerializedStylesheet:yn,iterateResolveTree:gn,legacy_isTouchEvent:jr,get nowTimestamp(){return kt},on:te,polyfill:mn,queueToResolveTrees:zl,shadowHostInDom:Gl,throttle:ht,uniqueTextMutations:Vl},Symbol.toStringTag,{value:"Module"})),I=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(I||{}),E=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(E||{}),$=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))($||{}),Se=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(Se||{}),Ee=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(Ee||{}),Re=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Re||{}),L=(s=>(s.Start="start",s.Pause="pause",s.Resume="resume",s.Resize="resize",s.Finish="finish",s.FullsnapshotRebuilded="fullsnapshot-rebuilded",s.LoadStylesheetStart="load-stylesheet-start",s.LoadStylesheetEnd="load-stylesheet-end",s.SkipStart="skip-start",s.SkipEnd="skip-end",s.MouseInteraction="mouse-interaction",s.EventCast="event-cast",s.CustomEvent="custom-event",s.Flush="flush",s.StateChange="state-change",s.PlayBack="play-back",s.Destroy="destroy",s))(L||{}),be=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(be||{});Ii=class{constructor(){S(this,"length",0),S(this,"head",null),S(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&zo(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&zo(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Vo=(s,e)=>`${s}@${e}`,xi=class{constructor(){S(this,"frozen",!1),S(this,"locked",!1),S(this,"texts",[]),S(this,"attributes",[]),S(this,"attributeMap",new WeakMap),S(this,"removes",[]),S(this,"mapRemoves",[]),S(this,"movedMap",{}),S(this,"addedSet",new Set),S(this,"movedSet",new Set),S(this,"droppedSet",new Set),S(this,"removesSubTreeCache",new Set),S(this,"mutationCb"),S(this,"blockClass"),S(this,"blockSelector"),S(this,"maskTextClass"),S(this,"maskTextSelector"),S(this,"inlineStylesheet"),S(this,"maskInputOptions"),S(this,"maskTextFn"),S(this,"maskInputFn"),S(this,"keepIframeSrcFn"),S(this,"recordCanvas"),S(this,"inlineImages"),S(this,"slimDOMOptions"),S(this,"dataURLOptions"),S(this,"doc"),S(this,"mirror"),S(this,"iframeManager"),S(this,"stylesheetManager"),S(this,"shadowDomManager"),S(this,"canvasManager"),S(this,"processedNodeManager"),S(this,"unattachedDoc"),S(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),S(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new Ii,i=l=>{let u=l,c=xt;for(;c===xt;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=l=>{let u=D.parentNode(l);if(!u||!bn(l))return;let c=!1;if(l.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=bt(u)?this.mirror.getId(Sn(l)):this.mirror.getId(u),f=i(l);if(h===-1||f===-1)return r.addNode(l);let g=Je(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{tt(m,this.mirror)&&this.iframeManager.addIframe(m),yn(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),Oe(l)&&this.shadowDomManager.addShadowRoot(D.shadowRoot(l),this.doc)},onIframeLoad:(m,p)=>{this.iframeManager.attachIframe(m,p),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,p)=>{this.stylesheetManager.attachLinkElement(m,p)},cssCaptured:c});g&&(e.push({parentId:h,nextId:f,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)jo(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(D.parentNode(l))||n(l);for(let l of this.addedSet)!Go(this.droppedSet,l)&&!jo(this.removesSubTreeCache,l,this.mirror)||Go(this.movedSet,l)?n(l):this.droppedSet.add(l);let o=null;for(;r.length;){let l=null;if(o){let u=this.mirror.getId(D.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(l=o)}if(!l){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(D.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){l=c;break}else{let g=c.value,m=D.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let p=D.host(m);if(this.mirror.getId(p)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}o=l.previous,r.removeNode(l.value),n(l.value)}let a={texts:this.texts.map(l=>{let u=l.node,c=D.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:l.value}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:u}=l;if(typeof u.style=="string"){let c=JSON.stringify(l.styleDiff),h=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),S(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(D.childNodes(e),i=>D.textContent(i)||"").join("");t.attributes.value=xr({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Mr(e),value:r,maskInputFn:this.maskInputFn})}),S(this,"processMutation",e=>{if(!Cr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=D.textContent(e.target);!re(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:fa(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,dn(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=Mr(t);i=xr({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(re(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!ha(t.tagName,r))if(n.attributes[r]=ca(this.doc,Te(t.tagName),Te(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let a of Array.from(t.style)){let l=t.style.getPropertyValue(a),u=t.style.getPropertyPriority(a);l!==o.style.getPropertyValue(a)||u!==o.style.getPropertyPriority(a)?u===""?n.styleDiff[a]=l:n.styleDiff[a]=[l,u]:n._unchangedStyles[a]=[l,u]}for(let a of Array.from(o.style))t.style.getPropertyValue(a)===""&&(n.styleDiff[a]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(re(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=bt(e.target)?this.mirror.getId(D.host(e.target)):this.mirror.getId(e.target);re(e.target,this.blockClass,this.blockSelector,!1)||Cr(t,this.mirror,this.slimDOMOptions)||!Wl(t,this.mirror)||(this.addedSet.has(t)?(Mi(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||pn(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Vo(r,i)]?Mi(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:bt(e.target)&&vt(e.target)?!0:void 0}),lm(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),S(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Cr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Vo(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);re(e,this.blockClass,this.blockSelector,!1)||(D.childNodes(e).forEach(r=>this.genAdds(r)),Oe(e)&&D.childNodes(D.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}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()}};k=s=>Et?(...t)=>{try{return s(...t)}catch(r){if(Et&&Et(r)===!0)return;throw r}}:s,Ue=[];mm=["INPUT","TEXTAREA","SELECT"],Ho=new WeakMap;Hr=class{constructor(e){S(this,"iframeIdToRemoteIdMap",new WeakMap),S(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),a=n.get(t);return a||(a=this.generateIdFn(),n.set(t,a),o.set(a,t)),a}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Ni=class{constructor(e){S(this,"iframes",new WeakMap),S(this,"crossOriginIframeMap",new WeakMap),S(this,"crossOriginIframeMirror",new Hr(ua)),S(this,"crossOriginIframeStyleMirror"),S(this,"crossOriginIframeRootIdMap",new WeakMap),S(this,"mirror"),S(this,"mutationCb"),S(this,"wrappedEmit"),S(this,"loadListener"),S(this,"stylesheetManager"),S(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hr(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,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.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){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case I.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:I.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case I.Meta:case I.Load:case I.DomContentLoaded:return!1;case I.Plugin:return t;case I.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case I.IncrementalSnapshot:switch(t.data.source){case E.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.Drag:case E.TouchMove:case E.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(t.data,e,["id"]),t;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case E.Font:return t;case E.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case E.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==be.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},Ai=class{constructor(e){S(this,"shadowDoms",new WeakSet),S(this,"mutationCb"),S(this,"scrollCb"),S(this,"bypassOptions"),S(this,"mirror"),S(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!vt(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=Yl({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Xl({...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(D.host(e))),this.restoreHandlers.push(Zl({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(ze(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),a=D.shadowRoot(this);return a&&bn(this)&&r.addShadowRoot(a,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",St=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(wt=0;wt<Qe.length;wt++)St[Qe.charCodeAt(wt)]=wt;xm=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Qe[e[t]>>2],i+=Qe[(e[t]&3)<<4|e[t+1]>>4],i+=Qe[(e[t+1]&15)<<2|e[t+2]>>6],i+=Qe[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Mm=function(s){var e=s.length*.75,t=s.length,r,i=0,n,o,a,l;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);var u=new ArrayBuffer(e),c=new Uint8Array(u);for(r=0;r<t;r+=4)n=St[s.charCodeAt(r)],o=St[s.charCodeAt(r+1)],a=St[s.charCodeAt(r+2)],l=St[s.charCodeAt(r+3)],c[i++]=n<<2|o>>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return u},Yo=new Map;Kl=(s,e,t)=>{if(!s||!(ql(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=Nm(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};Jl=(s,e,t)=>s.map(r=>Er(r,e,t)),ql=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);Ql="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Dm=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Ko=typeof window<"u"&&window.Blob&&new Blob([Dm(Ql)],{type:"text/javascript;charset=utf-8"});Ri=class{constructor(e){S(this,"pendingCanvasMutations",new Map),S(this,"rafStamps",{latestId:0,invokeId:null}),S(this,"mirror"),S(this,"mutationCb"),S(this,"resetObservers"),S(this,"frozen",!1),S(this,"locked",!1),S(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)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{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,t,r,i,n){let o=Xo(t,r,i,!0),a=new Map,l=new Tm;l.onmessage=m=>{let{id:p}=m.data;if(a.set(p,!1),!("base64"in m.data))return;let{base64:d,type:y,width:b,height:w}=m.data;this.mutationCb({id:p,type:Ee["2D"],commands:[{property:"clearRect",args:[0,0,b,w]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:d}],type:y}]},0,0]}]})};let u=1e3/e,c=0,h,f=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(p=>{re(p,r,i,!0)||m.push(p)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,f().forEach(async p=>{var d;let y=this.mirror.getId(p);if(a.get(y)||p.width===0||p.height===0)return;if(a.set(y,!0),["webgl","webgl2"].includes(p.__context)){let w=p.getContext(p.__context);((d=w?.getContextAttributes())==null?void 0:d.preserveDrawingBuffer)===!1&&w.clear(w.COLOR_BUFFER_BIT)}let b=await createImageBitmap(p);l.postMessage({id:y,bitmap:b,width:p.width,height:p.height,dataURLOptions:n.dataURLOptions},[b])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Xo(e,t,r,!1),n=Am(this.processMutation.bind(this),e,t,r),o=Om(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:a,...l}=o;return l}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},Oi=class{constructor(e){S(this,"trackedLinkElements",new WeakSet),S(this,"mutationCb"),S(this,"adoptedStyleSheetCb"),S(this,"styleMirror",new Lt),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(a,l)=>({rule:aa(a,n.href),index:l}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Di=class{constructor(){S(this,"nodeMap",new WeakMap),S(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Yr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Yn=s.contentWindow)==null?void 0:Yn.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}he=la();_e.addCustomEvent=(s,e)=>{if(!Yr)throw new Error("please add custom event after start recording");J({type:I.Custom,data:{tag:s,payload:e}})};_e.freezePage=()=>{Ue.forEach(s=>s.freeze())};_e.takeFullSnapshot=s=>{if(!Yr)throw new Error("please take full snapshot after start recording");Ir(s)};_e.mirror=he;_m=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"}));Ti=class{constructor(e=[],t){S(this,"timeOffset",0),S(this,"speed"),S(this,"actions"),S(this,"raf",null),S(this,"lastTimestamp"),this.actions=e,this.speed=t.speed}addAction(e){let t=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{let r=this.findActionIndex(e);this.actions.splice(r,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){let e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){let t=this.actions[0];if(this.timeOffset>=t.delay)this.actions.shift(),t.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let t=0,r=this.actions.length-1;for(;t<=r;){let i=Math.floor((t+r)/2);if(this.actions[i].delay<e.delay)t=i+1;else if(this.actions[i].delay>e.delay)r=i-1;else return i+1}return t}};(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(et||(et={}));tu={type:"xstate.init"};ra=function(s,e){return s.actions.forEach(function(t){var r=t.exec;return r&&r(s.context,e)})};Fm=s=>[`.${s} { background: currentColor }`,"noscript { display: none !important; }"],sa=new Map;Bm=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];ki=class{constructor(e){S(this,"mediaMap",new Map),S(this,"warn"),S(this,"service"),S(this,"speedService"),S(this,"emitter"),S(this,"getCurrentTime"),S(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(L.Start,this.start.bind(this)),this.emitter.on(L.SkipStart,this.start.bind(this)),this.emitter.on(L.Pause,this.pause.bind(this)),this.emitter.on(L.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((t,r)=>{this.syncTargetWithState(r),e.pause&&r.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:t,mediaState:r}){if(r.isPlaying){let n=(e-r.lastInteractionTimeOffset)/1e3*r.playbackRate,o="duration"in t&&t.duration;if(Number.isNaN(o)){this.waitForMetadata(t);return}let a=r.currentTimeAtLastInteraction+n;t.loop&&o!==!1&&(a=a%o),t.currentTime=a}else t.pause(),t.currentTime=r.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;let t=()=>{this.metadataCallbackMap.delete(e);let r=this.mediaMap.get(e);r&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:r})};this.metadataCallbackMap.set(e,t),e.addEventListener("loadedmetadata",t,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:t,mutation:r}){let i=this.mediaMap.get(e),{type:n,playbackRate:o,currentTime:a,muted:l,volume:u,loop:c}=r;return{isPlaying:n===Re.Play||n!==Re.Pause&&(i?.isPlaying||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:a??i?.currentTimeAtLastInteraction??0,lastInteractionTimeOffset:t,playbackRate:o??i?.playbackRate??1,volume:u??i?.volume??1,muted:l??i?.muted??e.getAttribute("muted")===null,loop:c??i?.loop??e.getAttribute("loop")===null}}syncTargetWithState(e){let t=this.mediaMap.get(e);if(!t)return;let{muted:r,loop:i,volume:n,isPlaying:o}=t,a=this.service.state.matches("paused"),l=t.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:t}),e.volume!==n&&(e.volume=n),e.muted=r,e.loop=i,e.playbackRate!==l&&(e.playbackRate=l),o&&!a?e.play():e.pause()}catch(u){this.warn(`Failed to replay media interactions: ${u.message||u}`)}}addMediaElements(e,t,r){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;let i=e,n=r.getMeta(i);if(!n||!("attributes"in n))return;let o=this.service.state.matches("paused"),a=n.attributes,l=!1;a.rr_mediaState?l=a.rr_mediaState==="played":l=i.getAttribute("autoplay")!==null,l&&o&&i.pause();let u=1;typeof a.rr_mediaPlaybackRate=="number"&&(u=a.rr_mediaPlaybackRate);let c=!1;typeof a.rr_mediaMuted=="boolean"?c=a.rr_mediaMuted:c=i.getAttribute("muted")!==null;let h=!1;typeof a.rr_mediaLoop=="boolean"?h=a.rr_mediaLoop:h=i.getAttribute("loop")!==null;let f=1;typeof a.rr_mediaVolume=="number"&&(f=a.rr_mediaVolume);let g=0;typeof a.rr_mediaCurrentTime=="number"&&(g=a.rr_mediaCurrentTime),this.mediaMap.set(i,{isPlaying:l,currentTimeAtLastInteraction:g,lastInteractionTimeOffset:t,playbackRate:u,volume:f,muted:c,loop:h}),this.syncTargetWithState(i)}mediaMutation({target:e,timeOffset:t,mutation:r}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:t,mutation:r})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}};Gm=5*1e3,Hm=eu||_m,ia="[replayer]",_s={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};Li=class{constructor(e,t){if(S(this,"wrapper"),S(this,"iframe"),S(this,"service"),S(this,"speedService"),S(this,"config"),S(this,"usingVirtualDom",!1),S(this,"virtualDom",new ut),S(this,"mouse"),S(this,"mouseTail",null),S(this,"tailPositions",[]),S(this,"emitter",Hm()),S(this,"nextUserInteractionEvent"),S(this,"legacy_missingNodeRetryMap",{}),S(this,"cache",bo()),S(this,"imageMap",new Map),S(this,"canvasEventMap",new Map),S(this,"mirror",la()),S(this,"styleMirror",new Lt),S(this,"mediaManager"),S(this,"firstFullSnapshot",null),S(this,"newDocumentQueue",[]),S(this,"mousePos",null),S(this,"touchActive",null),S(this,"lastMouseDownEvent",null),S(this,"lastHoveredRootNode"),S(this,"lastSelectionData",null),S(this,"constructedStyleMutations",[]),S(this,"adoptedStyleSheets",[]),S(this,"handleResize",a=>{this.iframe.style.display="inherit";for(let l of[this.mouseTail,this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)))}),S(this,"applyEventsSynchronously",a=>{for(let l of a){switch(l.type){case I.DomContentLoaded:case I.Load:case I.Custom:continue;case I.FullSnapshot:case I.Meta:case I.Plugin:case I.IncrementalSnapshot:break}this.getCastFn(l,!0)()}}),S(this,"getCastFn",(a,l=!1)=>{let u;switch(a.type){case I.DomContentLoaded:case I.Load:break;case I.Custom:u=()=>{this.emitter.emit(L.CustomEvent,a)};break;case I.Meta:u=()=>this.emitter.emit(L.Resize,{width:a.data.width,height:a.data.height});break;case I.FullSnapshot:u=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(a,l),(h=this.iframe.contentWindow)==null||h.scrollTo(a.data.initialOffset)};break;case I.IncrementalSnapshot:u=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(let h of this.service.state.context.events)if(!(h.timestamp<=a.timestamp)&&this.isUserInteraction(h)){h.delay-a.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){let h=this.nextUserInteractionEvent.delay-a.delay,f={speed:Math.min(Math.round(h/Gm),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(L.SkipStart,f)}}};break}return()=>{u&&u();for(let f of this.config.plugins||[])f.handler&&f.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});let h=this.service.state.context.events.length-1;if(!this.config.liveMode&&a===this.service.state.context.events[h]){let f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(L.Finish))},g=50;a.type===I.IncrementalSnapshot&&a.data.source===E.MouseMove&&a.data.positions.length&&(g+=Math.max(0,-a.data.positions[0].timeOffset)),setTimeout(f,g)}this.emitter.emit(L.EventCast,a)}}),!t?.liveMode&&e.length<2)throw new Error("Replayer need at least 2 events.");let r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:_s,useVirtualDom:!0,logger:console};this.config=Object.assign({},r,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(L.Resize,this.handleResize),this.setupDom();for(let a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on(L.Flush,()=>{if(this.usingVirtualDom){let a={mirror:this.mirror,applyCanvas:(l,u,c)=>{_i({event:l,mutation:u,target:c,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(l,u)=>{l.source===E.StyleSheetRule?this.applyStyleSheetRule(l,u):l.source===E.StyleDeclaration&&this.applyStyleDeclaration(l,u)},afterAppend:(l,u)=>{for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(l,{id:u,replayer:this})}};if(this.iframe.contentDocument)try{Wr(this.iframe.contentDocument,this.virtualDom,a,this.virtualDom.mirror)}catch(l){console.warn(l)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(let l in this.legacy_missingNodeRetryMap)try{let u=this.legacy_missingNodeRetryMap[l],c=zr(u.node,this.mirror,this.virtualDom.mirror);Wr(c,u.node,a,this.virtualDom.mirror),u.node=c}catch(u){this.warn(u)}this.constructedStyleMutations.forEach(l=>{this.applyStyleSheetMutation(l)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(l=>{this.applyAdoptedStyleSheet(l)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){let[a,l]=this.lastMouseDownEvent;a.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(L.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});let i=new Ti([],{speed:this.config.speed});this.service=$m({events:e.map(a=>t&&t.unpackFn?t.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit(L.StateChange,{player:a})}),this.speedService=Pm({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit(L.StateChange,{speed:a})}),this.mediaManager=new ki({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});let n=this.service.state.context.events.find(a=>a.type===I.Meta),o=this.service.state.context.events.find(a=>a.type===I.FullSnapshot);if(n){let{width:a,height:l}=n.data;setTimeout(()=>{this.emitter.emit(L.Resize,{width:a,height:l})},0)}o&&setTimeout(()=>{var a;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(a=this.iframe.contentWindow)==null||a.scrollTo(o.data.initialOffset))},1),this.service.state.context.events.find(na)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){let e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){let{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,r;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.remove("rrweb-paused"),this.emitter.emit(L.Start)}pause(e){var t,r;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.add("rrweb-paused"),this.emitter.emit(L.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(L.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(L.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){let t=this.config.unpackFn?this.config.unpackFn(e):e;na(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=bo()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");let e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(km(this.iframe.contentWindow,this.iframe.contentDocument),mn(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};let r=[],i=new Set,n=(l,u)=>{if(l.nodeName==="DIALOG"&&i.add(l),this.collectIframeAndAttachDocument(r,l),this.mediaManager.isSupportedMediaElement(l)){let{events:c}=this.service.state.context;this.mediaManager.addMediaElements(l,e.timestamp-c[0].timestamp,this.mirror)}for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(l,{id:u,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),kf(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(let{mutationInQueue:l,builtNode:u}of r)this.attachDocumentToIframe(l,u),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==l);let{documentElement:o,head:a}=this.iframe.contentDocument;this.insertStyleRules(o,a),i.forEach(l=>yr(l)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(L.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var r;let i=Fm(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!i.length)if(this.usingVirtualDom){let n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,Fl(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:E.StyleSheetRule,adds:i.map((o,a)=>({rule:o,index:a}))})}else{let n=document.createElement("style");e.insertBefore(n,t);for(let o=0;o<i.length;o++)(r=n.sheet)==null||r.insertRule(i[o],o)}}attachDocumentToIframe(e,t){let r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[],n=new Set,o=(a,l)=>{a.nodeName==="DIALOG"&&n.add(a),this.collectIframeAndAttachDocument(i,a);let u=r.getMeta(a);if(u?.type===be.Element&&u?.tagName.toUpperCase()==="HTML"){let{documentElement:c,head:h}=t.contentDocument;this.insertStyleRules(c,h)}if(!this.usingVirtualDom)for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(a,{id:l,replayer:this})};Ct(e.node,{doc:t.contentDocument,mirror:r,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(let{mutationInQueue:a,builtNode:l}of i)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==a);n.forEach(a=>yr(a))}collectIframeAndAttachDocument(e,t){if(tt(t,this.mirror)){let r=this.newDocumentQueue.find(i=>i.parentId===this.mirror.getId(t));r&&e.push({mutationInQueue:r,builtNode:t})}}waitForStylesheetLoad(){var e;let t=(e=this.iframe.contentDocument)==null?void 0:e.head;if(t){let r=new Set,i,n=this.service.state,o=()=>{n=this.service.state};this.emitter.on(L.Start,o),this.emitter.on(L.Pause,o);let a=()=>{this.emitter.off(L.Start,o),this.emitter.off(L.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(r.add(l),l.addEventListener("load",()=>{r.delete(l),r.size===0&&i!==-1&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(L.LoadStylesheetEnd),i&&clearTimeout(i),a())}))}),r.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(L.LoadStylesheetStart),i=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),i=-1,a()},this.config.loadTimeout))}}async preloadAllImages(){let e=[];for(let t of this.service.state.context.events)t.type===I.IncrementalSnapshot&&t.data.source===E.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(t.data,t)),("commands"in t.data?t.data.commands:[t.data]).forEach(i=>{this.preloadImages(i,t)}));return Promise.all(e)}preloadImages(e,t){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(t)){let r=document.createElement("canvas"),i=r.getContext("2d"),n=i?.createImageData(r.width,r.height);i?.putImageData(n,0,0)}}async deserializeAndPreloadCanvasEvents(e,t){if(!this.canvasEventMap.has(t)){let r={isUnchanged:!0};if("commands"in e){let i=await Promise.all(e.commands.map(async n=>{let o=await Promise.all(n.args.map(De(this.imageMap,null,r)));return{...n,args:o}}));r.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,commands:i})}else{let i=await Promise.all(e.args.map(De(this.imageMap,null,r)));r.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,args:i})}}}applyIncremental(e,t){var r,i,n;let{data:o}=e;switch(o.source){case E.Mutation:{try{this.applyMutation(o,t)}catch(a){this.warn(`Exception in mutation ${a.message||a}`,o)}break}case E.Drag:case E.TouchMove:case E.MouseMove:if(t){let a=o.positions[o.positions.length-1];this.mousePos={x:a.x,y:a.y,id:a.id,debugData:o}}else o.positions.forEach(a=>{let l={doAction:()=>{this.moveAndHover(a.x,a.y,a.id,t,o)},delay:a.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(l)}),this.timer.addAction({doAction(){},delay:e.delay-((r=o.positions[0])==null?void 0:r.timeOffset)});break;case E.MouseInteraction:{if(o.id===-1)break;let a=new Event(Te($[o.type])),l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);this.emitter.emit(L.MouseInteraction,{type:o.type,target:l});let{triggerFocus:u}=this.config;switch(o.type){case $.Blur:"blur"in l&&l.blur();break;case $.Focus:u&&l.focus&&l.focus({preventScroll:!0});break;case $.Click:case $.TouchStart:case $.TouchEnd:case $.MouseDown:case $.MouseUp:t?(o.type===$.TouchStart?this.touchActive=!0:o.type===$.TouchEnd&&(this.touchActive=!1),o.type===$.MouseDown?this.lastMouseDownEvent=[l,a]:o.type===$.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===$.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===$.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===$.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===$.TouchEnd?this.mouse.classList.remove("touch-active"):l.dispatchEvent(a));break;case $.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:l.dispatchEvent(a)}break}case E.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.scrollData=o;break}this.applyScroll(o,t);break}case E.ViewportResize:this.emitter.emit(L.Resize,{width:o.width,height:o.height});break;case E.Input:{if(o.id===-1)break;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.inputData=o;break}this.applyInput(o);break}case E.MediaInteraction:{let a=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);let l=a,{events:u}=this.service.state.context;this.mediaManager.mediaMutation({target:l,timeOffset:e.timestamp-u[0].timestamp,mutation:o});break}case E.StyleSheetRule:case E.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((i=this.virtualDom.mirror.getNode(o.id))==null||i.rules.push(o)):this.applyStyleSheetMutation(o);break}case E.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.canvasMutations.push({event:e,mutation:o})}else{let a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);_i({event:e,mutation:o,target:a,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case E.Font:{try{let a=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(n=this.iframe.contentDocument)==null||n.fonts.add(a)}catch(a){this.warn(a)}break}case E.Selection:{if(t){this.lastSelectionData=o;break}this.applySelection(o);break}case E.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,Hp(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(let u in this.legacy_missingNodeRetryMap)try{let c=this.legacy_missingNodeRetryMap[u],h=Pl(c.node,this.virtualDom,this.mirror);h&&(c.node=h)}catch(c){this.warn(c)}let r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(u=>r.getNode(u.id)?!0:(this.warnNodeNotFound(e,u.id),!1)),e.removes.forEach(u=>{var c;let h=r.getNode(u.id);if(!h)return;let f=r.getNode(u.parentId);if(!f)return this.warnNodeNotFound(e,u.parentId);if(u.isShadow&&Oe(f)&&(f=f.shadowRoot),r.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((c=f.rules)==null?void 0:c.length)>0&&(f.rules=[])}catch(g){if(g instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,e);else throw g}});let i={...this.legacy_missingNodeRetryMap},n=[],o=u=>{let c=null;return u.nextId&&(c=r.getNode(u.nextId)),u.nextId!==null&&u.nextId!==void 0&&u.nextId!==-1&&!c},a=u=>{var c,h;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let f=r.getNode(u.parentId);if(!f)return u.node.type===be.Document?this.newDocumentQueue.push(u):n.push(u);u.node.isShadow&&(Oe(f)||f.attachShadow({mode:"open"}),f=f.shadowRoot);let g=null,m=null;if(u.previousId&&(g=r.getNode(u.previousId)),u.nextId&&(m=r.getNode(u.nextId)),o(u))return n.push(u);if(u.node.rootId&&!r.getNode(u.node.rootId))return;let p=u.node.rootId?r.getNode(u.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(tt(f,r)){this.attachDocumentToIframe(u,f);return}let d=(w,v)=>{if(!this.usingVirtualDom){yr(w);for(let x of this.config.plugins||[])x.onBuild&&x.onBuild(w,{id:v,replayer:this})}},y=Ct(u.node,{doc:p,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:d});if(u.previousId===-1||u.nextId===-1){i[u.node.id]={node:y,mutation:u};return}let b=r.getMeta(f);if(b&&b.type===be.Element&&u.node.type===be.Text){let w=Array.isArray(f.childNodes)?f.childNodes:Array.from(f.childNodes);if(b.tagName==="textarea")for(let v of w)v.nodeType===f.TEXT_NODE&&f.removeChild(v);else if(b.tagName==="style"&&w.length===1)for(let v of w)v.nodeType===f.TEXT_NODE&&!r.hasNode(v)&&(y.textContent=v.textContent,f.removeChild(v))}else if(b?.type===be.Document){let w=f;u.node.type===be.DocumentType&&((c=w.childNodes[0])==null?void 0:c.nodeType)===Node.DOCUMENT_TYPE_NODE&&w.removeChild(w.childNodes[0]),y.nodeName==="HTML"&&w.documentElement&&w.removeChild(w.documentElement)}if(g&&g.nextSibling&&g.nextSibling.parentNode?f.insertBefore(y,g.nextSibling):m&&m.parentNode?f.contains(m)?f.insertBefore(y,m):f.insertBefore(y,null):f.appendChild(y),d(y,u.node.id),this.usingVirtualDom&&y.nodeName==="#text"&&f.nodeName==="STYLE"&&((h=f.rules)==null?void 0:h.length)>0&&(f.rules=[]),tt(y,this.mirror)){let w=this.mirror.getId(y),v=this.newDocumentQueue.find(x=>x.parentId===w);v&&(this.attachDocumentToIframe(v,y),this.newDocumentQueue=this.newDocumentQueue.filter(x=>x!==v))}(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(i,f,y,u)};e.adds.forEach(u=>{a(u)});let l=Date.now();for(;n.length;){let u=zl(n);if(n.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",u);break}for(let c of u)r.getNode(c.value.parentId)?gn(c,f=>{a(f)}):this.debug("Drop resolve tree since there is no parent for the root node.",c)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),Vl(e.texts).forEach(u=>{var c;let h=r.getNode(u.id);if(!h)return e.removes.find(g=>g.id===u.id)?void 0:this.warnNodeNotFound(e,u.id);let f=h.parentElement;if(u.value&&f&&f.tagName==="STYLE"?h.textContent=es(u.value,this.cache):h.textContent=u.value,this.usingVirtualDom){let g=h.parentNode;((c=g?.rules)==null?void 0:c.length)>0&&(g.rules=[])}}),e.attributes.forEach(u=>{var c;let h=r.getNode(u.id);if(!h)return e.removes.find(f=>f.id===u.id)?void 0:this.warnNodeNotFound(e,u.id);for(let f in u.attributes)if(typeof f=="string"){let g=u.attributes[f];if(g===null)h.removeAttribute(f),f==="open"&&jm(h,u);else if(typeof g=="string")try{if(f==="_cssText"&&(h.nodeName==="LINK"||h.nodeName==="STYLE"))try{let m=r.getMeta(h),p=Ct({...m,attributes:{...m.attributes,...u.attributes}},{doc:h.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(m.attributes,u.attributes);let d=h.nextSibling,y=h.parentNode;if(p&&y){y.removeChild(h),y.insertBefore(p,d),r.replace(u.id,p);break}}catch{}if(f==="value"&&h.nodeName==="TEXTAREA"){let m=h;m.childNodes.forEach(d=>m.removeChild(d));let p=(c=h.ownerDocument)==null?void 0:c.createTextNode(g);p&&m.appendChild(p)}else h.setAttribute(f,g);f==="rr_open_mode"&&h.nodeName==="DIALOG"&&yr(h,u)}catch(m){this.warn("An error occurred may due to the checkout feature.",m)}else if(f==="style"){let m=g,p=h;for(let d in m)if(m[d]===!1)p.style.removeProperty(d);else if(m[d]instanceof Array){let y=m[d];p.style.setProperty(d,y[0],y[1])}else{let y=m[d];p.style.setProperty(d,y)}}}})}applyScroll(e,t){var r,i;let n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);let o=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)(r=this.iframe.contentWindow)==null||r.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if(o?.type===be.Document)(i=n.defaultView)==null||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch{}}applyInput(e){let t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch{}}applySelection(e){try{let t=new Set,r=e.ranges.map(({start:i,startOffset:n,end:o,endOffset:a})=>{let l=this.mirror.getNode(i),u=this.mirror.getNode(o);if(!l||!u)return;let c=new Range;c.setStart(l,n),c.setEnd(u,a);let h=l.ownerDocument,f=h?.getSelection();return f&&t.add(f),{range:c,selection:f}});t.forEach(i=>i.removeAllRanges()),r.forEach(i=>{var n;return i&&((n=i.selection)==null?void 0:n.addRange(i.range))})}catch{}}applyStyleSheetMutation(e){var t;let r=null;e.styleId?r=this.styleMirror.getStyle(e.styleId):e.id&&(r=((t=this.mirror.getNode(e.id))==null?void 0:t.sheet)||null),r&&(e.source===E.StyleSheetRule?this.applyStyleSheetRule(e,r):e.source===E.StyleDeclaration&&this.applyStyleDeclaration(e,r))}applyStyleSheetRule(e,t){var r,i,n,o;if((r=e.adds)==null||r.forEach(({rule:a,index:l})=>{try{if(Array.isArray(l)){let{positions:u,index:c}=Ei(l);qe(t.cssRules,u).insertRule(a,c)}else{let u=l===void 0?void 0:Math.min(l,t.cssRules.length);t?.insertRule(a,u)}}catch{}}),(i=e.removes)==null||i.forEach(({index:a})=>{try{if(Array.isArray(a)){let{positions:l,index:u}=Ei(a);qe(t.cssRules,l).deleteRule(u||0)}else t?.deleteRule(a)}catch{}}),e.replace)try{(n=t.replace)==null||n.call(t,e.replace)}catch{}if(e.replaceSync)try{(o=t.replaceSync)==null||o.call(t,e.replaceSync)}catch{}}applyStyleDeclaration(e,t){e.set&&qe(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&qe(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;let r=this.mirror.getNode(e.id);if(!r)return;(t=e.styles)==null||t.forEach(a=>{var l;let u=null,c=null;if(Oe(r)?c=((l=r.ownerDocument)==null?void 0:l.defaultView)||null:r.nodeName==="#document"&&(c=r.defaultView),!!c)try{u=new c.CSSStyleSheet,this.styleMirror.add(u,a.styleId),this.applyStyleSheetRule({source:E.StyleSheetRule,adds:a.rules},u)}catch{}});let i=10,n=0,o=(a,l)=>{let u=l.map(c=>this.styleMirror.getStyle(c)).filter(c=>c!==null);Oe(a)?a.shadowRoot.adoptedStyleSheets=u:a.nodeName==="#document"&&(a.adoptedStyleSheets=u),u.length!==l.length&&n<i&&(setTimeout(()=>o(a,l),0+100*n),n++)};o(r,e.styleIds)}legacy_resolveMissingNode(e,t,r,i){let{previousId:n,nextId:o}=i,a=n&&e[n],l=o&&e[o];if(a){let{node:u,mutation:c}=a;t.insertBefore(u,r),delete e[c.node.id],delete this.legacy_missingNodeRetryMap[c.node.id],(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(e,t,u,c)}if(l){let{node:u,mutation:c}=l;t.insertBefore(u,r.nextSibling),delete e[c.node.id],delete this.legacy_missingNodeRetryMap[c.node.id],(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(e,t,u,c)}}moveAndHover(e,t,r,i,n){let o=this.mirror.getNode(r);if(!o)return this.debugNodeNotFound(n,r);let a=wn(o,this.iframe),l=e*a.absoluteScale+a.x,u=t*a.absoluteScale+a.y;this.mouse.style.left=`${l}px`,this.mouse.style.top=`${u}px`,i||this.drawMouseTail({x:l,y:u}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;let{lineCap:t,lineWidth:r,strokeStyle:i,duration:n}=this.config.mouseTail===!0?_s:Object.assign({},_s,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;let a=this.mouseTail.getContext("2d");!a||!this.tailPositions.length||(a.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),a.beginPath(),a.lineWidth=r,a.lineCap=t,a.strokeStyle=i,a.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(l=>a.lineTo(l.x,l.y)),a.stroke())};this.tailPositions.push(e),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(a=>a!==e),o()},n/this.speedService.state.context.timer.speed)}hoverElements(e){var t;(t=this.lastHoveredRootNode||this.iframe.contentDocument)==null||t.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let r=e;for(;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement}isUserInteraction(e){return e.type!==I.IncrementalSnapshot?!1:e.data.source>E.Mutation&&e.data.source<=E.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(L.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(ia,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(ia,...e)}},{addCustomEvent:Ym}=_e,{freezePage:Xm}=_e,{takeFullSnapshot:Zm}=_e});var uu={};Ht(uu,{startRrweb:()=>Km});async function Km(s){if(typeof window>"u")return null;let e;try{e=await Promise.resolve().then(()=>(au(),ou))}catch{return null}let t=s.options.mask?.class??"segi-mask",r=s.options.mask?.inputs??"all",i=r==="all"?{password:!0,email:!0,tel:!0,number:!0,text:!0,textarea:!0}:r==="sensitive"?{password:!0,email:!0,tel:!0,number:!0}:{password:!0},n=[],o=0,a=null,l=Date.now(),u=!1,c=!1,h=setInterval(()=>{u||c||p()},1e4),f=setInterval(()=>{u||c||Date.now()-l>=18e4&&m()},15e3);function g(){if(a)return;let w=0,v=(...R)=>{typeof console<"u"&&console.log("[segi.replay]",...R)};v("startRecorder() called, rrweb keys:",Object.keys(e).slice(0,12));let x=e.record({emit(R){w++;let A=R;if(u||c)return;let P;try{P=JSON.stringify(R)}catch(q){v(`emit #${w} type:${A.type} source:${A.data?.source} STRINGIFY_FAILED:`,q.message);return}w<=10&&v(`emit #${w}`,"type:",A.type,"source:",A.data?.source,"size:",P.length),n.push(P),o+=P.length,o>=102400&&p()},sampling:{mousemove:20,scroll:150,input:"last"},maskAllInputs:r==="all",maskInputOptions:i,blockClass:t,ignoreClass:t,maskTextClass:t,recordCanvas:!1,collectFonts:!1,checkoutEveryNms:3e4});a=typeof x=="function"?x:null,v("record() returned, stopFn:",typeof x,"rrweb.record.takeFullSnapshot:",typeof e.record.takeFullSnapshot,"rrweb.takeFullSnapshot:",typeof e.takeFullSnapshot);let N=R=>{if(!(c||u))try{let A=e;typeof A.record.takeFullSnapshot=="function"?(v(`forceSnapshot[${R}] via record.takeFullSnapshot`),A.record.takeFullSnapshot(!0)):typeof A.takeFullSnapshot=="function"?(v(`forceSnapshot[${R}] via top-level takeFullSnapshot`),A.takeFullSnapshot(!0)):v(`forceSnapshot[${R}] no takeFullSnapshot found`)}catch(A){v(`forceSnapshot[${R}] threw:`,A)}};setTimeout(()=>N("100ms"),100),setTimeout(()=>N("500ms"),500),setTimeout(()=>N("2000ms"),2e3)}function m(){try{a?.()}finally{a=null}p()}function p(w=!1){if(n.length===0)return;let v=n;if(n=[],o=0,typeof console<"u"){let x=v.reduce((R,A)=>R+A.length,0),N={};for(let R of v){let A=R.match(/^\{"type":(\d+)/),P=A?A[1]:"?";N[P]=(N[P]??0)+1}console.log("[segi.replay] flush:",v.length,"events,",x,"bytes, types:",N,"useBeacon:",w)}try{s.sendChunk(v,w)}catch{}}function d(){l=Date.now(),!a&&!u&&!c&&g()}for(let w of lu)window.addEventListener(w,d,{passive:!0,capture:!0});let y=()=>p(!0),b=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&p(!0)};return window.addEventListener("pagehide",y),typeof document<"u"&&document.addEventListener("visibilitychange",b),g(),{pause(){u=!0,m()},resume(){u=!1,l=Date.now(),g()},stop(){c=!0,m(),clearInterval(h),clearInterval(f);for(let w of lu)window.removeEventListener(w,d,{capture:!0});window.removeEventListener("pagehide",y),typeof document<"u"&&document.removeEventListener("visibilitychange",b)},flush:p,takeFullSnapshot(){if(!(c||u))try{e.record.takeFullSnapshot?.()}catch{}}}}var lu,cu=je(()=>{"use strict";lu=["mousemove","mousedown","keydown","touchstart","scroll","wheel"]});var du={};Ht(du,{activateReplay:()=>qm,replayApi:()=>Qm,withReplay:()=>Jm});function Jm(s={}){return{__segi_replay:!0,options:s}}function hu(){if(typeof window>"u")return"desktop";let s=window.innerWidth;return s<640?"mobile":s<1024?"tablet":"desktop"}function Ve(s){if(!(typeof location>"u"))try{return new URLSearchParams(location.search).get(s)??void 0}catch{return}}function fu(s,e){return(s.blockRoutes??[]).some(r=>e.startsWith(r))}async function qm(s){if(M||typeof window>"u")return;let e=s.config.options;if(e.enabled===!1)return;let t=Math.max(0,Math.min(100,e.sample??100));if(Math.random()*100>=t||fu(e,location.pathname))return;let r=zn(),i=ys(),n={endpoint:e.endpoint??s.endpoint,projectKey:s.projectKey},o={sessionUid:r,anonId:i,startedAt:new Date().toISOString(),device:hu(),viewportW:window.innerWidth,viewportH:window.innerHeight,ua:navigator.userAgent?.slice(0,512),referrer:document.referrer||void 0,landingUrl:location.href.slice(0,512),utmSource:Ve("utm_source"),utmMedium:Ve("utm_medium"),utmCampaign:Ve("utm_campaign"),utmContent:Ve("utm_content"),utmTerm:Ve("utm_term"),fbclid:Ve("fbclid"),gclid:Ve("gclid")},a=!0;try{let h=await Ne(n,"/session/start",o);h&&h.ok&&(await h.json().catch(()=>({}))).recordingEnabled===!1&&(a=!1)}catch{}if(!a){M={sessionUid:r,config:n,options:e,heatmap:null,rrweb:null,replayBlocked:!1,paused:!0,userId:null,startedAt:o.startedAt,pagesVisited:0,clickCount:0,recordingEnabled:!1};return}let l=$n({sessionUid:r,options:e,sendClicks:(h,f)=>{f?ws(n,"/heatmap/clicks",{clicks:h}):Ne(n,"/heatmap/clicks",{clicks:h})},sendScroll:h=>{Ne(n,"/heatmap/scroll",h)}});M={sessionUid:r,config:n,options:e,heatmap:l,rrweb:null,replayBlocked:!1,paused:!1,userId:null,startedAt:o.startedAt,pagesVisited:1,clickCount:0,recordingEnabled:!0};let u=window,c=h=>{let f=!1,g=()=>{f||(f=!0,typeof u.requestIdleCallback=="function"?u.requestIdleCallback(h,{timeout:2e3}):setTimeout(h,1e3))};typeof document<"u"&&document.readyState==="complete"?g():(window.addEventListener("load",g,{once:!0}),setTimeout(g,5e3))};Promise.resolve().then(()=>(cu(),uu)).then(({startRrweb:h})=>new Promise(f=>{c(()=>{h({sessionUid:r,options:e,sendChunk:async(g,m)=>{if(!M||M.replayBlocked)return;let p=`{"sessionUid":${JSON.stringify(r)},"chunk":[${g.join(",")}]}`,d=(n.endpoint||"https://segiapi.extn.ai").replace(/\/+$/,"").replace(/\/api\/ingest\/events$/,"").replace(/\/api\/ingest$/,"").replace(/\/api$/,"");if(m){try{let y=`${d}/api/trace/replay?pk=${encodeURIComponent(n.projectKey)}`,b=new Blob([p],{type:"application/json"});typeof navigator<"u"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(y,b)}catch{}return}try{let y=await fetch(`${d}/api/trace/replay`,{method:"POST",headers:{"Content-Type":"application/json","X-Segi-Project-Key":n.projectKey},body:p,keepalive:!0});typeof console<"u"&&console.log("[segi.replay] /replay POST",y.status,p.length,"bytes"),y.status===429&&M&&(M.replayBlocked=!0,M.rrweb?.stop(),M.rrweb=null)}catch(y){typeof console<"u"&&console.log("[segi.replay] /replay POST FETCH FAILED:",y.message)}}}).then(f,()=>f(null))})})).then(h=>{h&&M&&(M.rrweb=h)}).catch(()=>{}),Ne(n,"/events",{events:[{sessionUid:r,ts:new Date().toISOString(),type:"page_view",url:location.href,title:document.title}]}),window.addEventListener("pagehide",()=>{M&&(M.rrweb?.flush(!0),ws(M.config,"/session/end",{sessionUid:M.sessionUid,endedAt:new Date().toISOString(),durationMs:Date.now()-new Date(M.startedAt).getTime(),pagesVisited:M.pagesVisited,clickCount:M.clickCount}))})}var M,Qm,pu=je(()=>{"use strict";Pn();jn();Hn();M=null;Qm={pause(){M?.heatmap?.pause(),M?.rrweb?.pause(),M&&(M.paused=!0)},resume(){M?.heatmap?.resume(),M?.rrweb?.resume(),M&&(M.paused=!1),Vn()},setUser(s){M&&(M.userId=s?.id??null,Ne(M.config,"/session/start",{sessionUid:M.sessionUid,anonId:ys(),userId:M.userId,startedAt:M.startedAt,device:hu(),viewportW:window.innerWidth,viewportH:window.innerHeight}))},event(s,e){!M||M.paused||Ne(M.config,"/events",{events:[{sessionUid:M.sessionUid,ts:new Date().toISOString(),type:"custom",name:s.slice(0,64),url:location.href,meta:e}]})},notifyRouteChange(s,e){if(!(!M||M.paused)){if(fu(M.options,location.pathname)){M.heatmap?.pause(),M.rrweb?.pause(),M.paused=!0;return}M.paused&&(M.heatmap?.resume(),M.rrweb?.resume(),M.paused=!1),M.pagesVisited+=1,M.rrweb?.takeFullSnapshot(),Ne(M.config,"/events",{events:[{sessionUid:M.sessionUid,ts:new Date().toISOString(),type:"page_view",url:s??location.href,title:e??document.title}]})}},_sessionUid(){return M?.sessionUid??null}}});var ig={};Ht(ig,{Segi:()=>Me,default:()=>sg});function xn(){return{options:{projectKey:"",endpoint:""},user:null,tags:{},breadcrumbs:[],initialized:!1}}function Mn(s,e){let t=s.options.maxBreadcrumbs??50;s.breadcrumbs.push(e),s.breadcrumbs.length>t&&s.breadcrumbs.splice(0,s.breadcrumbs.length-t)}function cs(s,e){let t={type:e.type??"error",level:e.level??"error",message:e.message??"",errorName:e.errorName,stack:e.stack,platform:e.platform,runtime:e.runtime,environment:e.environment??s.options.environment,release:e.release??s.options.release,transaction:e.transaction,url:e.url,userAgent:e.userAgent,user:e.user??s.user??void 0,tags:{...s.tags,...e.tags??{}},extra:e.extra,breadcrumbs:s.breadcrumbs.slice(),request:e.request,timestamp:e.timestamp??new Date().toISOString()};if(s.options.beforeSend)try{let r=s.options.beforeSend(t);return r||{...t,_drop:!0}}catch{return t}return t}var kn=Eu(Tn()),_n=new Set;function ps(s,e){_n.has(s)||(_n.add(s),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[segi] ${e}`))}function _u(s){return s===401||s===403?"ingest rejected the project key (check projectKey + endpoint region)":s===404?"ingest endpoint not found (check endpoint URL)":s===413?"event payload too large; dropped by ingest":s===429?"ingest rate-limited (over plan quota or burst)":s>=500?"ingest is returning 5xx \u2014 events may be lost":"ingest returned a non-2xx response"}function ms(s,e,t){let r=s||kn.SEGI_DEFAULT_INGEST_ENDPOINT;if(!r||!e){ps("missing-config",e?"init() called without a valid endpoint \u2014 events will not be sent":"init() called without a projectKey \u2014 events will not be sent");return}if(!t._drop)try{let i=JSON.stringify(t),n={"Content-Type":"application/json","X-Segi-Project-Key":e};if(typeof fetch=="function"){fetch(r,{method:"POST",headers:n,body:i,keepalive:!0,mode:"cors",credentials:"omit"}).then(o=>{o.ok||ps(`status-${o.status}`,`${_u(o.status)} (HTTP ${o.status} from ${r})`)}).catch(o=>{ps("network-error",`network error reaching ${r} \u2014 events not delivered (${o instanceof Error?o.message:String(o)})`)});return}if(typeof navigator<"u"&&typeof navigator.sendBeacon=="function"){let o=`${r}${r.includes("?")?"&":"?"}pk=${encodeURIComponent(e)}`,a=new Blob([i],{type:"application/json"});navigator.sendBeacon(o,a)}}catch{}}var Q=xn();function eg(s){try{if(s&&typeof s=="object"&&"stack"in s)return String(s.stack??"")}catch{}}function os(s){if(Q.initialized)try{if(s instanceof ErrorEvent){let e=s.error,t=e?.message??s.message??"Error";Me.captureException(e??new Error(t),{message:t,url:typeof location<"u"?location.href:void 0})}else if("reason"in s){let e=s.reason,t=e instanceof Error?e.message:typeof e=="string"?e:"Unhandled promise rejection";Me.captureException(e,{message:t,url:typeof location<"u"?location.href:void 0})}}catch{}}function tg(){typeof window>"u"||(window.addEventListener("error",os,!0),window.addEventListener("unhandledrejection",os,!0))}function mu(){typeof window>"u"||(window.removeEventListener("error",os,!0),window.removeEventListener("unhandledrejection",os,!0))}var rg={pause(){},resume(){},setUser(){},event(){},notifyRouteChange(){}},Me={replay:rg,init(s,e={}){try{let t=typeof window<"u"?window:null;if((Q.initialized||t?.__segiInitialized===!0)&&!e.force){!e.silent&&typeof console<"u"&&console.warn("[segi] init() called more than once; ignoring. Pass { force: true } to override.");return}Q.initialized&&mu();let{replay:i,...n}=s;Q.options={...n},Q.initialized=!0,t&&(t.__segiInitialized=!0),tg(),i?.__segi_replay&&Promise.resolve().then(()=>(pu(),du)).then(o=>(Me.replay=o.replayApi,o.activateReplay({projectKey:n.projectKey,endpoint:n.endpoint,config:i}))).catch(()=>{})}catch{}},isInitialized(){return Q.initialized},close(){try{if(mu(),Q.initialized=!1,Q.user=null,Q.tags={},Q.breadcrumbs=[],typeof window<"u"){let s=window;s.__segiInitialized=!1}}catch{}},captureException(s,e={}){try{if(!Q.initialized)return;let t=s instanceof Error?s:new Error(typeof s=="string"?s:JSON.stringify(s)),r=cs(Q,{type:"error",level:"error",message:t.message,errorName:t.name,stack:eg(t),platform:"javascript",runtime:"browser",url:e.url??(typeof location<"u"?location.href:void 0),userAgent:e.userAgent??(typeof navigator<"u"?navigator.userAgent:void 0),...e});ms(Q.options.endpoint,Q.options.projectKey,r)}catch{}},captureMessage(s,e={}){try{if(!Q.initialized)return;let t=cs(Q,{type:"message",level:e.level??"info",message:s,platform:"javascript",runtime:"browser",url:typeof location<"u"?location.href:void 0,userAgent:typeof navigator<"u"?navigator.userAgent:void 0,...e});ms(Q.options.endpoint,Q.options.projectKey,t)}catch{}},setUser(s){try{Q.user=s}catch{}},setTag(s,e){try{Q.tags[s]=e}catch{}},addBreadcrumb(s){try{Mn(Q,{...s,timestamp:s.timestamp??new Date().toISOString()})}catch{}}};(function(){try{let e=window;if(e.__segiBundleLoaded){typeof console<"u"&&console.warn("[segi] segi.min.js loaded more than once; ignoring this load.");return}e.__segiBundleLoaded=!0;let t=e.SegiConfig??{},r={},i=document.getElementsByTagName("script");for(let a=i.length-1;a>=0;a--){let l=i[a];if(l.src&&/segi(\.min)?\.js/.test(l.src)){r={projectKey:l.dataset.projectKey,endpoint:l.dataset.endpoint,environment:l.dataset.environment,release:l.dataset.release};break}}let n=t.projectKey??r.projectKey,o=t.endpoint??r.endpoint;if(!n){e.Segi=Me;return}Me.init({projectKey:n,endpoint:o,environment:t.environment??r.environment,release:t.release??r.release}),e.Segi=Me}catch{}})();var sg=Me;return Iu(ig);})();
|
|
61
|
+
or you can use record.mirror to access the mirror instance during recording.`,Vr={map:{},getId(){return console.error(Xe),-1},getNode(){return console.error(Xe),null},removeNodeFromMap(){console.error(Xe)},has(){return console.error(Xe),!1},reset(){console.error(Xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Vr=new Proxy(Vr,{get(s,e,t){return e==="map"&&console.error(Xe),Reflect.get(s,e,t)}}));kt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(kt=()=>new Date().getTime());Lt=class{constructor(){S(this,"id",1),S(this,"styleIDMap",new WeakMap),S(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};am=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Lt,get _mirror(){return Vr},closestElementOfNode:dn,getBaseDimension:wn,getNestedRule:qe,getPositionsAndIndex:Ei,getRootShadowHost:jl,getShadowHost:Sn,getWindowHeight:hn,getWindowScroll:cn,getWindowWidth:fn,hasShadowRoot:Oe,hookSetter:Bt,inDom:bn,isAncestorRemoved:pn,isBlocked:re,isIgnored:Cr,isSerialized:Wl,isSerializedIframe:tt,isSerializedStylesheet:yn,iterateResolveTree:gn,legacy_isTouchEvent:jr,get nowTimestamp(){return kt},on:te,polyfill:mn,queueToResolveTrees:zl,shadowHostInDom:Gl,throttle:ht,uniqueTextMutations:Vl},Symbol.toStringTag,{value:"Module"})),I=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(I||{}),E=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(E||{}),$=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))($||{}),Se=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(Se||{}),Ee=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(Ee||{}),Re=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Re||{}),L=(s=>(s.Start="start",s.Pause="pause",s.Resume="resume",s.Resize="resize",s.Finish="finish",s.FullsnapshotRebuilded="fullsnapshot-rebuilded",s.LoadStylesheetStart="load-stylesheet-start",s.LoadStylesheetEnd="load-stylesheet-end",s.SkipStart="skip-start",s.SkipEnd="skip-end",s.MouseInteraction="mouse-interaction",s.EventCast="event-cast",s.CustomEvent="custom-event",s.Flush="flush",s.StateChange="state-change",s.PlayBack="play-back",s.Destroy="destroy",s))(L||{}),be=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(be||{});Ii=class{constructor(){S(this,"length",0),S(this,"head",null),S(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=t?.next||null;return t}addNode(e){let t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&zo(e.previousSibling)){let r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&zo(e.nextSibling)&&e.nextSibling.__ln.previous){let r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){let t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Vo=(s,e)=>`${s}@${e}`,xi=class{constructor(){S(this,"frozen",!1),S(this,"locked",!1),S(this,"texts",[]),S(this,"attributes",[]),S(this,"attributeMap",new WeakMap),S(this,"removes",[]),S(this,"mapRemoves",[]),S(this,"movedMap",{}),S(this,"addedSet",new Set),S(this,"movedSet",new Set),S(this,"droppedSet",new Set),S(this,"removesSubTreeCache",new Set),S(this,"mutationCb"),S(this,"blockClass"),S(this,"blockSelector"),S(this,"maskTextClass"),S(this,"maskTextSelector"),S(this,"inlineStylesheet"),S(this,"maskInputOptions"),S(this,"maskTextFn"),S(this,"maskInputFn"),S(this,"keepIframeSrcFn"),S(this,"recordCanvas"),S(this,"inlineImages"),S(this,"slimDOMOptions"),S(this,"dataURLOptions"),S(this,"doc"),S(this,"mirror"),S(this,"iframeManager"),S(this,"stylesheetManager"),S(this,"shadowDomManager"),S(this,"canvasManager"),S(this,"processedNodeManager"),S(this,"unattachedDoc"),S(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),S(this,"emit",()=>{if(this.frozen||this.locked)return;let e=[],t=new Set,r=new Ii,i=l=>{let u=l,c=xt;for(;c===xt;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=l=>{let u=D.parentNode(l);if(!u||!bn(l))return;let c=!1;if(l.nodeType===Node.TEXT_NODE){let m=u.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(u)&&(c=!0)}let h=bt(u)?this.mirror.getId(Sn(l)):this.mirror.getId(u),f=i(l);if(h===-1||f===-1)return r.addNode(l);let g=Je(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:m=>{tt(m,this.mirror)&&this.iframeManager.addIframe(m),yn(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),Oe(l)&&this.shadowDomManager.addShadowRoot(D.shadowRoot(l),this.doc)},onIframeLoad:(m,p)=>{this.iframeManager.attachIframe(m,p),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,p)=>{this.stylesheetManager.attachLinkElement(m,p)},cssCaptured:c});g&&(e.push({parentId:h,nextId:f,node:g}),t.add(g.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)jo(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(D.parentNode(l))||n(l);for(let l of this.addedSet)!Go(this.droppedSet,l)&&!jo(this.removesSubTreeCache,l,this.mirror)||Go(this.movedSet,l)?n(l):this.droppedSet.add(l);let o=null;for(;r.length;){let l=null;if(o){let u=this.mirror.getId(D.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(l=o)}if(!l){let u=r.tail;for(;u;){let c=u;if(u=u.previous,c){let h=this.mirror.getId(D.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){l=c;break}else{let g=c.value,m=D.parentNode(g);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let p=D.host(m);if(this.mirror.getId(p)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}o=l.previous,r.removeNode(l.value),n(l.value)}let a={texts:this.texts.map(l=>{let u=l.node,c=D.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:l.value}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:u}=l;if(typeof u.style=="string"){let c=JSON.stringify(l.styleDiff),h=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!t.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),S(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(D.childNodes(e),i=>D.textContent(i)||"").join("");t.attributes.value=xr({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Mr(e),value:r,maskInputFn:this.maskInputFn})}),S(this,"processMutation",e=>{if(!Cr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=D.textContent(e.target);!re(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:fa(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,dn(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){let o=Mr(t);i=xr({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(re(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!ha(t.tagName,r))if(n.attributes[r]=ca(this.doc,Te(t.tagName),Te(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(let a of Array.from(t.style)){let l=t.style.getPropertyValue(a),u=t.style.getPropertyPriority(a);l!==o.style.getPropertyValue(a)||u!==o.style.getPropertyPriority(a)?u===""?n.styleDiff[a]=l:n.styleDiff[a]=[l,u]:n._unchangedStyles[a]=[l,u]}for(let a of Array.from(o.style))t.style.getPropertyValue(a)===""&&(n.styleDiff[a]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(re(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{let r=this.mirror.getId(t),i=bt(e.target)?this.mirror.getId(D.host(e.target)):this.mirror.getId(e.target);re(e.target,this.blockClass,this.blockSelector,!1)||Cr(t,this.mirror,this.slimDOMOptions)||!Wl(t,this.mirror)||(this.addedSet.has(t)?(Mi(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||pn(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Vo(r,i)]?Mi(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:bt(e.target)&&vt(e.target)?!0:void 0}),lm(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),S(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Cr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Vo(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);re(e,this.blockClass,this.blockSelector,!1)||(D.childNodes(e).forEach(r=>this.genAdds(r)),Oe(e)&&D.childNodes(D.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}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()}};k=s=>Et?(...t)=>{try{return s(...t)}catch(r){if(Et&&Et(r)===!0)return;throw r}}:s,Ue=[];mm=["INPUT","TEXTAREA","SELECT"],Ho=new WeakMap;Hr=class{constructor(e){S(this,"iframeIdToRemoteIdMap",new WeakMap),S(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){let n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e),a=n.get(t);return a||(a=this.generateIdFn(),n.set(t,a),o.set(a,t)),a}getIds(e,t){let r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){let i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let n=i.get(t);return n||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},Ni=class{constructor(e){S(this,"iframes",new WeakMap),S(this,"crossOriginIframeMap",new WeakMap),S(this,"crossOriginIframeMirror",new Hr(ua)),S(this,"crossOriginIframeStyleMirror"),S(this,"crossOriginIframeRootIdMap",new WeakMap),S(this,"mirror"),S(this,"mutationCb"),S(this,"wrappedEmit"),S(this,"loadListener"),S(this,"stylesheetManager"),S(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hr(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,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.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){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let i=this.crossOriginIframeMap.get(e.source);if(!i)return;let n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case I.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:I.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case I.Meta:case I.Load:case I.DomContentLoaded:return!1;case I.Plugin:return t;case I.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case I.IncrementalSnapshot:switch(t.data.source){case E.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.Drag:case E.TouchMove:case E.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(t.data,e,["id"]),t;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case E.Font:return t;case E.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case E.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(let n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==be.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},Ai=class{constructor(e){S(this,"shadowDoms",new WeakSet),S(this,"mutationCb"),S(this,"scrollCb"),S(this,"bypassOptions"),S(this,"mirror"),S(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!vt(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);let r=Yl({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Xl({...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(D.host(e))),this.restoreHandlers.push(Zl({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(ze(e.prototype,"attachShadow",function(i){return function(n){let o=i.call(this,n),a=D.shadowRoot(this);return a&&bn(this)&&r.addShadowRoot(a,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",St=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(wt=0;wt<Qe.length;wt++)St[Qe.charCodeAt(wt)]=wt;xm=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Qe[e[t]>>2],i+=Qe[(e[t]&3)<<4|e[t+1]>>4],i+=Qe[(e[t+1]&15)<<2|e[t+2]>>6],i+=Qe[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Mm=function(s){var e=s.length*.75,t=s.length,r,i=0,n,o,a,l;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);var u=new ArrayBuffer(e),c=new Uint8Array(u);for(r=0;r<t;r+=4)n=St[s.charCodeAt(r)],o=St[s.charCodeAt(r+1)],a=St[s.charCodeAt(r+2)],l=St[s.charCodeAt(r+3)],c[i++]=n<<2|o>>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return u},Yo=new Map;Kl=(s,e,t)=>{if(!s||!(ql(s,e)||typeof s=="object"))return;let r=s.constructor.name,i=Nm(t,r),n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};Jl=(s,e,t)=>s.map(r=>Er(r,e,t)),ql=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);Ql="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Dm=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Ko=typeof window<"u"&&window.Blob&&new Blob([Dm(Ql)],{type:"text/javascript;charset=utf-8"});Ri=class{constructor(e){S(this,"pendingCanvasMutations",new Map),S(this,"rafStamps",{latestId:0,invokeId:null}),S(this,"mirror"),S(this,"mutationCb"),S(this,"resetObservers"),S(this,"frozen",!1),S(this,"locked",!1),S(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)});let{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{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,t,r,i,n){let o=Xo(t,r,i,!0),a=new Map,l=new Tm;l.onmessage=m=>{let{id:p}=m.data;if(a.set(p,!1),!("base64"in m.data))return;let{base64:d,type:y,width:b,height:w}=m.data;this.mutationCb({id:p,type:Ee["2D"],commands:[{property:"clearRect",args:[0,0,b,w]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:d}],type:y}]},0,0]}]})};let u=1e3/e,c=0,h,f=()=>{let m=[];return t.document.querySelectorAll("canvas").forEach(p=>{re(p,r,i,!0)||m.push(p)}),m},g=m=>{if(c&&m-c<u){h=requestAnimationFrame(g);return}c=m,f().forEach(async p=>{var d;let y=this.mirror.getId(p);if(a.get(y)||p.width===0||p.height===0)return;if(a.set(y,!0),["webgl","webgl2"].includes(p.__context)){let w=p.getContext(p.__context);((d=w?.getContextAttributes())==null?void 0:d.preserveDrawingBuffer)===!1&&w.clear(w.COLOR_BUFFER_BIT)}let b=await createImageBitmap(p);l.postMessage({id:y,bitmap:b,width:p.width,height:p.height,dataURLOptions:n.dataURLOptions},[b])}),h=requestAnimationFrame(g)};h=requestAnimationFrame(g),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let i=Xo(e,t,r,!1),n=Am(this.processMutation.bind(this),e,t,r),o=Om(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let i=r.map(o=>{let{type:a,...l}=o;return l}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}},Oi=class{constructor(e){S(this,"trackedLinkElements",new WeakSet),S(this,"mutationCb"),S(this,"adoptedStyleSheetCb"),S(this,"styleMirror",new Lt),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},i=[];for(let n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(a,l)=>({rule:aa(a,n.href),index:l}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Di=class{constructor(){S(this,"nodeMap",new WeakMap),S(this,"active",!1)}inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Yr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){let s=document.createElement("iframe");document.body.appendChild(s),Array.from=((Yn=s.contentWindow)==null?void 0:Yn.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}he=la();_e.addCustomEvent=(s,e)=>{if(!Yr)throw new Error("please add custom event after start recording");J({type:I.Custom,data:{tag:s,payload:e}})};_e.freezePage=()=>{Ue.forEach(s=>s.freeze())};_e.takeFullSnapshot=s=>{if(!Yr)throw new Error("please take full snapshot after start recording");Ir(s)};_e.mirror=he;_m=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"}));Ti=class{constructor(e=[],t){S(this,"timeOffset",0),S(this,"speed"),S(this,"actions"),S(this,"raf",null),S(this,"lastTimestamp"),this.actions=e,this.speed=t.speed}addAction(e){let t=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{let r=this.findActionIndex(e);this.actions.splice(r,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){let e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){let t=this.actions[0];if(this.timeOffset>=t.delay)this.actions.shift(),t.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let t=0,r=this.actions.length-1;for(;t<=r;){let i=Math.floor((t+r)/2);if(this.actions[i].delay<e.delay)t=i+1;else if(this.actions[i].delay>e.delay)r=i-1;else return i+1}return t}};(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(et||(et={}));tu={type:"xstate.init"};ra=function(s,e){return s.actions.forEach(function(t){var r=t.exec;return r&&r(s.context,e)})};Fm=s=>[`.${s} { background: currentColor }`,"noscript { display: none !important; }"],sa=new Map;Bm=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];ki=class{constructor(e){S(this,"mediaMap",new Map),S(this,"warn"),S(this,"service"),S(this,"speedService"),S(this,"emitter"),S(this,"getCurrentTime"),S(this,"metadataCallbackMap",new Map),this.warn=e.warn,this.service=e.service,this.speedService=e.speedService,this.emitter=e.emitter,this.getCurrentTime=e.getCurrentTime,this.emitter.on(L.Start,this.start.bind(this)),this.emitter.on(L.SkipStart,this.start.bind(this)),this.emitter.on(L.Pause,this.pause.bind(this)),this.emitter.on(L.Finish,this.pause.bind(this)),this.speedService.subscribe(()=>{this.syncAllMediaElements()})}syncAllMediaElements(e={pause:!1}){this.mediaMap.forEach((t,r)=>{this.syncTargetWithState(r),e.pause&&r.pause()})}start(){this.syncAllMediaElements()}pause(){this.syncAllMediaElements({pause:!0})}seekTo({time:e,target:t,mediaState:r}){if(r.isPlaying){let n=(e-r.lastInteractionTimeOffset)/1e3*r.playbackRate,o="duration"in t&&t.duration;if(Number.isNaN(o)){this.waitForMetadata(t);return}let a=r.currentTimeAtLastInteraction+n;t.loop&&o!==!1&&(a=a%o),t.currentTime=a}else t.pause(),t.currentTime=r.currentTimeAtLastInteraction}waitForMetadata(e){if(this.metadataCallbackMap.has(e)||!("addEventListener"in e))return;let t=()=>{this.metadataCallbackMap.delete(e);let r=this.mediaMap.get(e);r&&this.seekTo({time:this.getCurrentTime(),target:e,mediaState:r})};this.metadataCallbackMap.set(e,t),e.addEventListener("loadedmetadata",t,{once:!0})}getMediaStateFromMutation({target:e,timeOffset:t,mutation:r}){let i=this.mediaMap.get(e),{type:n,playbackRate:o,currentTime:a,muted:l,volume:u,loop:c}=r;return{isPlaying:n===Re.Play||n!==Re.Pause&&(i?.isPlaying||e.getAttribute("autoplay")!==null),currentTimeAtLastInteraction:a??i?.currentTimeAtLastInteraction??0,lastInteractionTimeOffset:t,playbackRate:o??i?.playbackRate??1,volume:u??i?.volume??1,muted:l??i?.muted??e.getAttribute("muted")===null,loop:c??i?.loop??e.getAttribute("loop")===null}}syncTargetWithState(e){let t=this.mediaMap.get(e);if(!t)return;let{muted:r,loop:i,volume:n,isPlaying:o}=t,a=this.service.state.matches("paused"),l=t.playbackRate*this.speedService.state.context.timer.speed;try{this.seekTo({time:this.getCurrentTime(),target:e,mediaState:t}),e.volume!==n&&(e.volume=n),e.muted=r,e.loop=i,e.playbackRate!==l&&(e.playbackRate=l),o&&!a?e.play():e.pause()}catch(u){this.warn(`Failed to replay media interactions: ${u.message||u}`)}}addMediaElements(e,t,r){if(!["AUDIO","VIDEO"].includes(e.nodeName))return;let i=e,n=r.getMeta(i);if(!n||!("attributes"in n))return;let o=this.service.state.matches("paused"),a=n.attributes,l=!1;a.rr_mediaState?l=a.rr_mediaState==="played":l=i.getAttribute("autoplay")!==null,l&&o&&i.pause();let u=1;typeof a.rr_mediaPlaybackRate=="number"&&(u=a.rr_mediaPlaybackRate);let c=!1;typeof a.rr_mediaMuted=="boolean"?c=a.rr_mediaMuted:c=i.getAttribute("muted")!==null;let h=!1;typeof a.rr_mediaLoop=="boolean"?h=a.rr_mediaLoop:h=i.getAttribute("loop")!==null;let f=1;typeof a.rr_mediaVolume=="number"&&(f=a.rr_mediaVolume);let g=0;typeof a.rr_mediaCurrentTime=="number"&&(g=a.rr_mediaCurrentTime),this.mediaMap.set(i,{isPlaying:l,currentTimeAtLastInteraction:g,lastInteractionTimeOffset:t,playbackRate:u,volume:f,muted:c,loop:h}),this.syncTargetWithState(i)}mediaMutation({target:e,timeOffset:t,mutation:r}){this.mediaMap.set(e,this.getMediaStateFromMutation({target:e,timeOffset:t,mutation:r})),this.syncTargetWithState(e)}isSupportedMediaElement(e){return["AUDIO","VIDEO"].includes(e.nodeName)}reset(){this.mediaMap.clear()}};Gm=5*1e3,Hm=eu||_m,ia="[replayer]",_s={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};Li=class{constructor(e,t){if(S(this,"wrapper"),S(this,"iframe"),S(this,"service"),S(this,"speedService"),S(this,"config"),S(this,"usingVirtualDom",!1),S(this,"virtualDom",new ut),S(this,"mouse"),S(this,"mouseTail",null),S(this,"tailPositions",[]),S(this,"emitter",Hm()),S(this,"nextUserInteractionEvent"),S(this,"legacy_missingNodeRetryMap",{}),S(this,"cache",bo()),S(this,"imageMap",new Map),S(this,"canvasEventMap",new Map),S(this,"mirror",la()),S(this,"styleMirror",new Lt),S(this,"mediaManager"),S(this,"firstFullSnapshot",null),S(this,"newDocumentQueue",[]),S(this,"mousePos",null),S(this,"touchActive",null),S(this,"lastMouseDownEvent",null),S(this,"lastHoveredRootNode"),S(this,"lastSelectionData",null),S(this,"constructedStyleMutations",[]),S(this,"adoptedStyleSheets",[]),S(this,"handleResize",a=>{this.iframe.style.display="inherit";for(let l of[this.mouseTail,this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)))}),S(this,"applyEventsSynchronously",a=>{for(let l of a){switch(l.type){case I.DomContentLoaded:case I.Load:case I.Custom:continue;case I.FullSnapshot:case I.Meta:case I.Plugin:case I.IncrementalSnapshot:break}this.getCastFn(l,!0)()}}),S(this,"getCastFn",(a,l=!1)=>{let u;switch(a.type){case I.DomContentLoaded:case I.Load:break;case I.Custom:u=()=>{this.emitter.emit(L.CustomEvent,a)};break;case I.Meta:u=()=>this.emitter.emit(L.Resize,{width:a.data.width,height:a.data.height});break;case I.FullSnapshot:u=()=>{var h;if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.mediaManager.reset(),this.styleMirror.reset(),this.rebuildFullSnapshot(a,l),(h=this.iframe.contentWindow)==null||h.scrollTo(a.data.initialOffset)};break;case I.IncrementalSnapshot:u=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(let h of this.service.state.context.events)if(!(h.timestamp<=a.timestamp)&&this.isUserInteraction(h)){h.delay-a.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=h);break}if(this.nextUserInteractionEvent){let h=this.nextUserInteractionEvent.delay-a.delay,f={speed:Math.min(Math.round(h/Gm),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:f}),this.emitter.emit(L.SkipStart,f)}}};break}return()=>{u&&u();for(let f of this.config.plugins||[])f.handler&&f.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});let h=this.service.state.context.events.length-1;if(!this.config.liveMode&&a===this.service.state.context.events[h]){let f=()=>{h<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(L.Finish))},g=50;a.type===I.IncrementalSnapshot&&a.data.source===E.MouseMove&&a.data.positions.length&&(g+=Math.max(0,-a.data.positions[0].timeOffset)),setTimeout(f,g)}this.emitter.emit(L.EventCast,a)}}),!t?.liveMode&&e.length<2)throw new Error("Replayer need at least 2 events.");let r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:_s,useVirtualDom:!0,logger:console};this.config=Object.assign({},r,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(L.Resize,this.handleResize),this.setupDom();for(let a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on(L.Flush,()=>{if(this.usingVirtualDom){let a={mirror:this.mirror,applyCanvas:(l,u,c)=>{_i({event:l,mutation:u,target:c,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(l,u)=>{l.source===E.StyleSheetRule?this.applyStyleSheetRule(l,u):l.source===E.StyleDeclaration&&this.applyStyleDeclaration(l,u)},afterAppend:(l,u)=>{for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(l,{id:u,replayer:this})}};if(this.iframe.contentDocument)try{Wr(this.iframe.contentDocument,this.virtualDom,a,this.virtualDom.mirror)}catch(l){console.warn(l)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(let l in this.legacy_missingNodeRetryMap)try{let u=this.legacy_missingNodeRetryMap[l],c=zr(u.node,this.mirror,this.virtualDom.mirror);Wr(c,u.node,a,this.virtualDom.mirror),u.node=c}catch(u){this.warn(u)}this.constructedStyleMutations.forEach(l=>{this.applyStyleSheetMutation(l)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(l=>{this.applyAdoptedStyleSheet(l)}),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){let[a,l]=this.lastMouseDownEvent;a.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on(L.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset()});let i=new Ti([],{speed:this.config.speed});this.service=$m({events:e.map(a=>t&&t.unpackFn?t.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit(L.StateChange,{player:a})}),this.speedService=Pm({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit(L.StateChange,{speed:a})}),this.mediaManager=new ki({warn:this.warn.bind(this),service:this.service,speedService:this.speedService,emitter:this.emitter,getCurrentTime:this.getCurrentTime.bind(this)});let n=this.service.state.context.events.find(a=>a.type===I.Meta),o=this.service.state.context.events.find(a=>a.type===I.FullSnapshot);if(n){let{width:a,height:l}=n.data;setTimeout(()=>{this.emitter.emit(L.Resize,{width:a,height:l})},0)}o&&setTimeout(()=>{var a;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),(a=this.iframe.contentWindow)==null||a.scrollTo(o.data.initialOffset))},1),this.service.state.context.events.find(na)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach(t=>{e[t],this.config[t]=e[t]}),this.config.skipInactive||this.backToNormal(),typeof e.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),typeof e.mouseTail<"u"&&(e.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){let e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){let{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,r;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:e}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.remove("rrweb-paused"),this.emitter.emit(L.Start)}pause(e){var t,r;e===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof e=="number"&&(this.play(e),this.service.send({type:"PAUSE"})),(r=(t=this.iframe.contentDocument)==null?void 0:t.getElementsByTagName("html")[0])==null||r.classList.add("rrweb-paused"),this.emitter.emit(L.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(L.Resume)}destroy(){this.pause(),this.mirror.reset(),this.styleMirror.reset(),this.mediaManager.reset(),this.config.root.removeChild(this.wrapper),this.emitter.emit(L.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){let t=this.config.unpackFn?this.config.unpackFn(e):e;na(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:t}}))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=bo()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");let e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(km(this.iframe.contentWindow,this.iframe.contentDocument),mn(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};let r=[],i=new Set,n=(l,u)=>{if(l.nodeName==="DIALOG"&&i.add(l),this.collectIframeAndAttachDocument(r,l),this.mediaManager.isSupportedMediaElement(l)){let{events:c}=this.service.state.context;this.mediaManager.addMediaElements(l,e.timestamp-c[0].timestamp,this.mirror)}for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(l,{id:u,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),kf(e.data.node,{doc:this.iframe.contentDocument,afterAppend:n,cache:this.cache,mirror:this.mirror}),n(this.iframe.contentDocument,e.data.node.id);for(let{mutationInQueue:l,builtNode:u}of r)this.attachDocumentToIframe(l,u),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==l);let{documentElement:o,head:a}=this.iframe.contentDocument;this.insertStyleRules(o,a),i.forEach(l=>yr(l)),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(L.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var r;let i=Fm(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),!!i.length)if(this.usingVirtualDom){let n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,Fl(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:E.StyleSheetRule,adds:i.map((o,a)=>({rule:o,index:a}))})}else{let n=document.createElement("style");e.insertBefore(n,t);for(let o=0;o<i.length;o++)(r=n.sheet)==null||r.insertRule(i[o],o)}}attachDocumentToIframe(e,t){let r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[],n=new Set,o=(a,l)=>{a.nodeName==="DIALOG"&&n.add(a),this.collectIframeAndAttachDocument(i,a);let u=r.getMeta(a);if(u?.type===be.Element&&u?.tagName.toUpperCase()==="HTML"){let{documentElement:c,head:h}=t.contentDocument;this.insertStyleRules(c,h)}if(!this.usingVirtualDom)for(let c of this.config.plugins||[])c.onBuild&&c.onBuild(a,{id:l,replayer:this})};Ct(e.node,{doc:t.contentDocument,mirror:r,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(let{mutationInQueue:a,builtNode:l}of i)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==a);n.forEach(a=>yr(a))}collectIframeAndAttachDocument(e,t){if(tt(t,this.mirror)){let r=this.newDocumentQueue.find(i=>i.parentId===this.mirror.getId(t));r&&e.push({mutationInQueue:r,builtNode:t})}}waitForStylesheetLoad(){var e;let t=(e=this.iframe.contentDocument)==null?void 0:e.head;if(t){let r=new Set,i,n=this.service.state,o=()=>{n=this.service.state};this.emitter.on(L.Start,o),this.emitter.on(L.Pause,o);let a=()=>{this.emitter.off(L.Start,o),this.emitter.off(L.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(r.add(l),l.addEventListener("load",()=>{r.delete(l),r.size===0&&i!==-1&&(n.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(L.LoadStylesheetEnd),i&&clearTimeout(i),a())}))}),r.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(L.LoadStylesheetStart),i=setTimeout(()=>{n.matches("playing")&&this.play(this.getCurrentTime()),i=-1,a()},this.config.loadTimeout))}}async preloadAllImages(){let e=[];for(let t of this.service.state.context.events)t.type===I.IncrementalSnapshot&&t.data.source===E.CanvasMutation&&(e.push(this.deserializeAndPreloadCanvasEvents(t.data,t)),("commands"in t.data?t.data.commands:[t.data]).forEach(i=>{this.preloadImages(i,t)}));return Promise.all(e)}preloadImages(e,t){if(e.property==="drawImage"&&typeof e.args[0]=="string"&&!this.imageMap.has(t)){let r=document.createElement("canvas"),i=r.getContext("2d"),n=i?.createImageData(r.width,r.height);i?.putImageData(n,0,0)}}async deserializeAndPreloadCanvasEvents(e,t){if(!this.canvasEventMap.has(t)){let r={isUnchanged:!0};if("commands"in e){let i=await Promise.all(e.commands.map(async n=>{let o=await Promise.all(n.args.map(De(this.imageMap,null,r)));return{...n,args:o}}));r.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,commands:i})}else{let i=await Promise.all(e.args.map(De(this.imageMap,null,r)));r.isUnchanged===!1&&this.canvasEventMap.set(t,{...e,args:i})}}}applyIncremental(e,t){var r,i,n;let{data:o}=e;switch(o.source){case E.Mutation:{try{this.applyMutation(o,t)}catch(a){this.warn(`Exception in mutation ${a.message||a}`,o)}break}case E.Drag:case E.TouchMove:case E.MouseMove:if(t){let a=o.positions[o.positions.length-1];this.mousePos={x:a.x,y:a.y,id:a.id,debugData:o}}else o.positions.forEach(a=>{let l={doAction:()=>{this.moveAndHover(a.x,a.y,a.id,t,o)},delay:a.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(l)}),this.timer.addAction({doAction(){},delay:e.delay-((r=o.positions[0])==null?void 0:r.timeOffset)});break;case E.MouseInteraction:{if(o.id===-1)break;let a=new Event(Te($[o.type])),l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);this.emitter.emit(L.MouseInteraction,{type:o.type,target:l});let{triggerFocus:u}=this.config;switch(o.type){case $.Blur:"blur"in l&&l.blur();break;case $.Focus:u&&l.focus&&l.focus({preventScroll:!0});break;case $.Click:case $.TouchStart:case $.TouchEnd:case $.MouseDown:case $.MouseUp:t?(o.type===$.TouchStart?this.touchActive=!0:o.type===$.TouchEnd&&(this.touchActive=!1),o.type===$.MouseDown?this.lastMouseDownEvent=[l,a]:o.type===$.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===$.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===$.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===$.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===$.TouchEnd?this.mouse.classList.remove("touch-active"):l.dispatchEvent(a));break;case $.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:l.dispatchEvent(a)}break}case E.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.scrollData=o;break}this.applyScroll(o,t);break}case E.ViewportResize:this.emitter.emit(L.Resize,{width:o.width,height:o.height});break;case E.Input:{if(o.id===-1)break;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.inputData=o;break}this.applyInput(o);break}case E.MediaInteraction:{let a=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);let l=a,{events:u}=this.service.state.context;this.mediaManager.mediaMutation({target:l,timeOffset:e.timestamp-u[0].timestamp,mutation:o});break}case E.StyleSheetRule:case E.StyleDeclaration:{this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&((i=this.virtualDom.mirror.getNode(o.id))==null||i.rules.push(o)):this.applyStyleSheetMutation(o);break}case E.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){let a=this.virtualDom.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);a.canvasMutations.push({event:e,mutation:o})}else{let a=this.mirror.getNode(o.id);if(!a)return this.debugNodeNotFound(o,o.id);_i({event:e,mutation:o,target:a,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case E.Font:{try{let a=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(n=this.iframe.contentDocument)==null||n.fonts.add(a)}catch(a){this.warn(a)}break}case E.Selection:{if(t){this.lastSelectionData=o;break}this.applySelection(o);break}case E.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o);break}}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,Hp(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(let u in this.legacy_missingNodeRetryMap)try{let c=this.legacy_missingNodeRetryMap[u],h=Pl(c.node,this.virtualDom,this.mirror);h&&(c.node=h)}catch(c){this.warn(c)}let r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter(u=>r.getNode(u.id)?!0:(this.warnNodeNotFound(e,u.id),!1)),e.removes.forEach(u=>{var c;let h=r.getNode(u.id);if(!h)return;let f=r.getNode(u.parentId);if(!f)return this.warnNodeNotFound(e,u.parentId);if(u.isShadow&&Oe(f)&&(f=f.shadowRoot),r.removeNodeFromMap(h),f)try{f.removeChild(h),this.usingVirtualDom&&h.nodeName==="#text"&&f.nodeName==="STYLE"&&((c=f.rules)==null?void 0:c.length)>0&&(f.rules=[])}catch(g){if(g instanceof DOMException)this.warn("parent could not remove child in mutation",f,h,e);else throw g}});let i={...this.legacy_missingNodeRetryMap},n=[],o=u=>{let c=null;return u.nextId&&(c=r.getNode(u.nextId)),u.nextId!==null&&u.nextId!==void 0&&u.nextId!==-1&&!c},a=u=>{var c,h;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let f=r.getNode(u.parentId);if(!f)return u.node.type===be.Document?this.newDocumentQueue.push(u):n.push(u);u.node.isShadow&&(Oe(f)||f.attachShadow({mode:"open"}),f=f.shadowRoot);let g=null,m=null;if(u.previousId&&(g=r.getNode(u.previousId)),u.nextId&&(m=r.getNode(u.nextId)),o(u))return n.push(u);if(u.node.rootId&&!r.getNode(u.node.rootId))return;let p=u.node.rootId?r.getNode(u.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(tt(f,r)){this.attachDocumentToIframe(u,f);return}let d=(w,v)=>{if(!this.usingVirtualDom){yr(w);for(let x of this.config.plugins||[])x.onBuild&&x.onBuild(w,{id:v,replayer:this})}},y=Ct(u.node,{doc:p,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:d});if(u.previousId===-1||u.nextId===-1){i[u.node.id]={node:y,mutation:u};return}let b=r.getMeta(f);if(b&&b.type===be.Element&&u.node.type===be.Text){let w=Array.isArray(f.childNodes)?f.childNodes:Array.from(f.childNodes);if(b.tagName==="textarea")for(let v of w)v.nodeType===f.TEXT_NODE&&f.removeChild(v);else if(b.tagName==="style"&&w.length===1)for(let v of w)v.nodeType===f.TEXT_NODE&&!r.hasNode(v)&&(y.textContent=v.textContent,f.removeChild(v))}else if(b?.type===be.Document){let w=f;u.node.type===be.DocumentType&&((c=w.childNodes[0])==null?void 0:c.nodeType)===Node.DOCUMENT_TYPE_NODE&&w.removeChild(w.childNodes[0]),y.nodeName==="HTML"&&w.documentElement&&w.removeChild(w.documentElement)}if(g&&g.nextSibling&&g.nextSibling.parentNode?f.insertBefore(y,g.nextSibling):m&&m.parentNode?f.contains(m)?f.insertBefore(y,m):f.insertBefore(y,null):f.appendChild(y),d(y,u.node.id),this.usingVirtualDom&&y.nodeName==="#text"&&f.nodeName==="STYLE"&&((h=f.rules)==null?void 0:h.length)>0&&(f.rules=[]),tt(y,this.mirror)){let w=this.mirror.getId(y),v=this.newDocumentQueue.find(x=>x.parentId===w);v&&(this.attachDocumentToIframe(v,y),this.newDocumentQueue=this.newDocumentQueue.filter(x=>x!==v))}(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(i,f,y,u)};e.adds.forEach(u=>{a(u)});let l=Date.now();for(;n.length;){let u=zl(n);if(n.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",u);break}for(let c of u)r.getNode(c.value.parentId)?gn(c,f=>{a(f)}):this.debug("Drop resolve tree since there is no parent for the root node.",c)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),Vl(e.texts).forEach(u=>{var c;let h=r.getNode(u.id);if(!h)return e.removes.find(g=>g.id===u.id)?void 0:this.warnNodeNotFound(e,u.id);let f=h.parentElement;if(u.value&&f&&f.tagName==="STYLE"?h.textContent=es(u.value,this.cache):h.textContent=u.value,this.usingVirtualDom){let g=h.parentNode;((c=g?.rules)==null?void 0:c.length)>0&&(g.rules=[])}}),e.attributes.forEach(u=>{var c;let h=r.getNode(u.id);if(!h)return e.removes.find(f=>f.id===u.id)?void 0:this.warnNodeNotFound(e,u.id);for(let f in u.attributes)if(typeof f=="string"){let g=u.attributes[f];if(g===null)h.removeAttribute(f),f==="open"&&jm(h,u);else if(typeof g=="string")try{if(f==="_cssText"&&(h.nodeName==="LINK"||h.nodeName==="STYLE"))try{let m=r.getMeta(h),p=Ct({...m,attributes:{...m.attributes,...u.attributes}},{doc:h.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache});Object.assign(m.attributes,u.attributes);let d=h.nextSibling,y=h.parentNode;if(p&&y){y.removeChild(h),y.insertBefore(p,d),r.replace(u.id,p);break}}catch{}if(f==="value"&&h.nodeName==="TEXTAREA"){let m=h;m.childNodes.forEach(d=>m.removeChild(d));let p=(c=h.ownerDocument)==null?void 0:c.createTextNode(g);p&&m.appendChild(p)}else h.setAttribute(f,g);f==="rr_open_mode"&&h.nodeName==="DIALOG"&&yr(h,u)}catch(m){this.warn("An error occurred may due to the checkout feature.",m)}else if(f==="style"){let m=g,p=h;for(let d in m)if(m[d]===!1)p.style.removeProperty(d);else if(m[d]instanceof Array){let y=m[d];p.style.setProperty(d,y[0],y[1])}else{let y=m[d];p.style.setProperty(d,y)}}}})}applyScroll(e,t){var r,i;let n=this.mirror.getNode(e.id);if(!n)return this.debugNodeNotFound(e,e.id);let o=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)(r=this.iframe.contentWindow)==null||r.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if(o?.type===be.Document)(i=n.defaultView)==null||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch{}}applyInput(e){let t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch{}}applySelection(e){try{let t=new Set,r=e.ranges.map(({start:i,startOffset:n,end:o,endOffset:a})=>{let l=this.mirror.getNode(i),u=this.mirror.getNode(o);if(!l||!u)return;let c=new Range;c.setStart(l,n),c.setEnd(u,a);let h=l.ownerDocument,f=h?.getSelection();return f&&t.add(f),{range:c,selection:f}});t.forEach(i=>i.removeAllRanges()),r.forEach(i=>{var n;return i&&((n=i.selection)==null?void 0:n.addRange(i.range))})}catch{}}applyStyleSheetMutation(e){var t;let r=null;e.styleId?r=this.styleMirror.getStyle(e.styleId):e.id&&(r=((t=this.mirror.getNode(e.id))==null?void 0:t.sheet)||null),r&&(e.source===E.StyleSheetRule?this.applyStyleSheetRule(e,r):e.source===E.StyleDeclaration&&this.applyStyleDeclaration(e,r))}applyStyleSheetRule(e,t){var r,i,n,o;if((r=e.adds)==null||r.forEach(({rule:a,index:l})=>{try{if(Array.isArray(l)){let{positions:u,index:c}=Ei(l);qe(t.cssRules,u).insertRule(a,c)}else{let u=l===void 0?void 0:Math.min(l,t.cssRules.length);t?.insertRule(a,u)}}catch{}}),(i=e.removes)==null||i.forEach(({index:a})=>{try{if(Array.isArray(a)){let{positions:l,index:u}=Ei(a);qe(t.cssRules,l).deleteRule(u||0)}else t?.deleteRule(a)}catch{}}),e.replace)try{(n=t.replace)==null||n.call(t,e.replace)}catch{}if(e.replaceSync)try{(o=t.replaceSync)==null||o.call(t,e.replaceSync)}catch{}}applyStyleDeclaration(e,t){e.set&&qe(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority),e.remove&&qe(t.rules,e.index).style.removeProperty(e.remove.property)}applyAdoptedStyleSheet(e){var t;let r=this.mirror.getNode(e.id);if(!r)return;(t=e.styles)==null||t.forEach(a=>{var l;let u=null,c=null;if(Oe(r)?c=((l=r.ownerDocument)==null?void 0:l.defaultView)||null:r.nodeName==="#document"&&(c=r.defaultView),!!c)try{u=new c.CSSStyleSheet,this.styleMirror.add(u,a.styleId),this.applyStyleSheetRule({source:E.StyleSheetRule,adds:a.rules},u)}catch{}});let i=10,n=0,o=(a,l)=>{let u=l.map(c=>this.styleMirror.getStyle(c)).filter(c=>c!==null);Oe(a)?a.shadowRoot.adoptedStyleSheets=u:a.nodeName==="#document"&&(a.adoptedStyleSheets=u),u.length!==l.length&&n<i&&(setTimeout(()=>o(a,l),0+100*n),n++)};o(r,e.styleIds)}legacy_resolveMissingNode(e,t,r,i){let{previousId:n,nextId:o}=i,a=n&&e[n],l=o&&e[o];if(a){let{node:u,mutation:c}=a;t.insertBefore(u,r),delete e[c.node.id],delete this.legacy_missingNodeRetryMap[c.node.id],(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(e,t,u,c)}if(l){let{node:u,mutation:c}=l;t.insertBefore(u,r.nextSibling),delete e[c.node.id],delete this.legacy_missingNodeRetryMap[c.node.id],(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(e,t,u,c)}}moveAndHover(e,t,r,i,n){let o=this.mirror.getNode(r);if(!o)return this.debugNodeNotFound(n,r);let a=wn(o,this.iframe),l=e*a.absoluteScale+a.x,u=t*a.absoluteScale+a.y;this.mouse.style.left=`${l}px`,this.mouse.style.top=`${u}px`,i||this.drawMouseTail({x:l,y:u}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;let{lineCap:t,lineWidth:r,strokeStyle:i,duration:n}=this.config.mouseTail===!0?_s:Object.assign({},_s,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;let a=this.mouseTail.getContext("2d");!a||!this.tailPositions.length||(a.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),a.beginPath(),a.lineWidth=r,a.lineCap=t,a.strokeStyle=i,a.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(l=>a.lineTo(l.x,l.y)),a.stroke())};this.tailPositions.push(e),o(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(a=>a!==e),o()},n/this.speedService.state.context.timer.speed)}hoverElements(e){var t;(t=this.lastHoveredRootNode||this.iframe.contentDocument)==null||t.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")}),this.lastHoveredRootNode=e.getRootNode();let r=e;for(;r;)r.classList&&r.classList.add(":hover"),r=r.parentElement}isUserInteraction(e){return e.type!==I.IncrementalSnapshot?!1:e.data.source>E.Mutation&&e.data.source<=E.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(L.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(ia,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(ia,...e)}},{addCustomEvent:Ym}=_e,{freezePage:Xm}=_e,{takeFullSnapshot:Zm}=_e});var uu={};Ht(uu,{startRrweb:()=>Km});async function Km(s){if(typeof window>"u")return null;let e;try{e=await Promise.resolve().then(()=>(au(),ou))}catch{return null}let t=s.options.mask?.class??"segi-mask",r=s.options.mask?.inputs??"all",i=r==="all"?{password:!0,email:!0,tel:!0,number:!0,text:!0,textarea:!0}:r==="sensitive"?{password:!0,email:!0,tel:!0,number:!0}:{password:!0},n=[],o=0,a=null,l=Date.now(),u=!1,c=!1,h=setInterval(()=>{u||c||p()},1e4),f=setInterval(()=>{u||c||Date.now()-l>=18e4&&m()},15e3);function g(){if(a)return;let w=0,v=(...R)=>{typeof console<"u"&&console.log("[segi.replay]",...R)};v("startRecorder() called, rrweb keys:",Object.keys(e).slice(0,12));let x=e.record({emit(R){w++;let A=R;if(u||c)return;let P;try{P=JSON.stringify(R)}catch(q){v(`emit #${w} type:${A.type} source:${A.data?.source} STRINGIFY_FAILED:`,q.message);return}w<=10&&v(`emit #${w}`,"type:",A.type,"source:",A.data?.source,"size:",P.length),n.push(P),o+=P.length,o>=102400&&p()},sampling:{mousemove:20,scroll:150,input:"last"},maskAllInputs:r==="all",maskInputOptions:i,blockClass:t,ignoreClass:t,maskTextClass:t,recordCanvas:!1,collectFonts:!1,checkoutEveryNms:3e4});a=typeof x=="function"?x:null,v("record() returned, stopFn:",typeof x,"rrweb.record.takeFullSnapshot:",typeof e.record.takeFullSnapshot,"rrweb.takeFullSnapshot:",typeof e.takeFullSnapshot);let N=R=>{if(!(c||u))try{let A=e;typeof A.record.takeFullSnapshot=="function"?(v(`forceSnapshot[${R}] via record.takeFullSnapshot`),A.record.takeFullSnapshot(!0)):typeof A.takeFullSnapshot=="function"?(v(`forceSnapshot[${R}] via top-level takeFullSnapshot`),A.takeFullSnapshot(!0)):v(`forceSnapshot[${R}] no takeFullSnapshot found`)}catch(A){v(`forceSnapshot[${R}] threw:`,A)}};setTimeout(()=>N("100ms"),100),setTimeout(()=>N("500ms"),500),setTimeout(()=>N("2000ms"),2e3)}function m(){try{a?.()}finally{a=null}p()}function p(w=!1){if(n.length===0)return;let v=n;if(n=[],o=0,typeof console<"u"){let x=v.reduce((R,A)=>R+A.length,0),N={};for(let R of v){let A=R.match(/^\{"type":(\d+)/),P=A?A[1]:"?";N[P]=(N[P]??0)+1}console.log("[segi.replay] flush:",v.length,"events,",x,"bytes, types:",N,"useBeacon:",w)}try{s.sendChunk(v,w)}catch{}}function d(){l=Date.now(),!a&&!u&&!c&&g()}for(let w of lu)window.addEventListener(w,d,{passive:!0,capture:!0});let y=()=>p(!0),b=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&p(!0)};return window.addEventListener("pagehide",y),typeof document<"u"&&document.addEventListener("visibilitychange",b),g(),{pause(){u=!0,m()},resume(){u=!1,l=Date.now(),g()},stop(){c=!0,m(),clearInterval(h),clearInterval(f);for(let w of lu)window.removeEventListener(w,d,{capture:!0});window.removeEventListener("pagehide",y),typeof document<"u"&&document.removeEventListener("visibilitychange",b)},flush:p,takeFullSnapshot(){if(!(c||u))try{e.record.takeFullSnapshot?.()}catch{}}}}var lu,cu=je(()=>{"use strict";lu=["mousemove","mousedown","keydown","touchstart","scroll","wheel"]});var du={};Ht(du,{activateReplay:()=>qm,replayApi:()=>Qm,withReplay:()=>Jm});function Jm(s={}){return{__segi_replay:!0,options:s}}function hu(){if(typeof window>"u")return"desktop";let s=window.innerWidth;return s<640?"mobile":s<1024?"tablet":"desktop"}function Ve(s){if(!(typeof location>"u"))try{return new URLSearchParams(location.search).get(s)??void 0}catch{return}}function fu(s,e){return(s.blockRoutes??[]).some(r=>e.startsWith(r))}async function qm(s){if(M||typeof window>"u")return;let e=s.config.options;if(e.enabled===!1)return;let t=Math.max(0,Math.min(100,e.sample??100));if(Math.random()*100>=t||fu(e,location.pathname))return;let r=zn(),i=ys(),n={endpoint:e.endpoint??s.endpoint,projectKey:s.projectKey},o={sessionUid:r,anonId:i,startedAt:new Date().toISOString(),device:hu(),viewportW:window.innerWidth,viewportH:window.innerHeight,ua:navigator.userAgent?.slice(0,512),referrer:document.referrer||void 0,landingUrl:location.href.slice(0,512),utmSource:Ve("utm_source"),utmMedium:Ve("utm_medium"),utmCampaign:Ve("utm_campaign"),utmContent:Ve("utm_content"),utmTerm:Ve("utm_term"),fbclid:Ve("fbclid"),gclid:Ve("gclid")},a=!0;try{let h=await Ne(n,"/session/start",o);h&&h.ok&&(await h.json().catch(()=>({}))).recordingEnabled===!1&&(a=!1)}catch{}if(!a){M={sessionUid:r,config:n,options:e,heatmap:null,rrweb:null,replayBlocked:!1,paused:!0,userId:null,startedAt:o.startedAt,pagesVisited:0,clickCount:0,recordingEnabled:!1};return}let l=$n({sessionUid:r,options:e,sendClicks:(h,f)=>{f?ws(n,"/heatmap/clicks",{clicks:h}):Ne(n,"/heatmap/clicks",{clicks:h})},sendScroll:h=>{Ne(n,"/heatmap/scroll",h)}});M={sessionUid:r,config:n,options:e,heatmap:l,rrweb:null,replayBlocked:!1,paused:!1,userId:null,startedAt:o.startedAt,pagesVisited:1,clickCount:0,recordingEnabled:!0};let u=window,c=h=>{let f=!1,g=()=>{f||(f=!0,typeof u.requestIdleCallback=="function"?u.requestIdleCallback(h,{timeout:2e3}):setTimeout(h,1e3))};typeof document<"u"&&document.readyState==="complete"?g():(window.addEventListener("load",g,{once:!0}),setTimeout(g,5e3))};Promise.resolve().then(()=>(cu(),uu)).then(({startRrweb:h})=>new Promise(f=>{c(()=>{h({sessionUid:r,options:e,sendChunk:async(g,m)=>{if(!M||M.replayBlocked)return;let p=`{"sessionUid":${JSON.stringify(r)},"chunk":[${g.join(",")}]}`,d=(n.endpoint||"https://segiapi.extn.ai").replace(/\/+$/,"").replace(/\/api\/ingest\/events$/,"").replace(/\/api\/ingest$/,"").replace(/\/api$/,"");if(m){try{let y=`${d}/api/trace/replay?pk=${encodeURIComponent(n.projectKey)}`,b=new Blob([p],{type:"application/json"});typeof navigator<"u"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(y,b)}catch{}return}try{let y=await fetch(`${d}/api/trace/replay`,{method:"POST",headers:{"Content-Type":"application/json","X-Segi-Project-Key":n.projectKey},body:p});typeof console<"u"&&console.log("[segi.replay] /replay POST",y.status,p.length,"bytes"),y.status===429&&M&&(M.replayBlocked=!0,M.rrweb?.stop(),M.rrweb=null)}catch(y){typeof console<"u"&&console.log("[segi.replay] /replay POST FETCH FAILED:",y.message)}}}).then(f,()=>f(null))})})).then(h=>{h&&M&&(M.rrweb=h)}).catch(()=>{}),Ne(n,"/events",{events:[{sessionUid:r,ts:new Date().toISOString(),type:"page_view",url:location.href,title:document.title}]}),window.addEventListener("pagehide",()=>{M&&(M.rrweb?.flush(!0),ws(M.config,"/session/end",{sessionUid:M.sessionUid,endedAt:new Date().toISOString(),durationMs:Date.now()-new Date(M.startedAt).getTime(),pagesVisited:M.pagesVisited,clickCount:M.clickCount}))})}var M,Qm,pu=je(()=>{"use strict";Pn();jn();Hn();M=null;Qm={pause(){M?.heatmap?.pause(),M?.rrweb?.pause(),M&&(M.paused=!0)},resume(){M?.heatmap?.resume(),M?.rrweb?.resume(),M&&(M.paused=!1),Vn()},setUser(s){M&&(M.userId=s?.id??null,Ne(M.config,"/session/start",{sessionUid:M.sessionUid,anonId:ys(),userId:M.userId,startedAt:M.startedAt,device:hu(),viewportW:window.innerWidth,viewportH:window.innerHeight}))},event(s,e){!M||M.paused||Ne(M.config,"/events",{events:[{sessionUid:M.sessionUid,ts:new Date().toISOString(),type:"custom",name:s.slice(0,64),url:location.href,meta:e}]})},notifyRouteChange(s,e){if(!(!M||M.paused)){if(fu(M.options,location.pathname)){M.heatmap?.pause(),M.rrweb?.pause(),M.paused=!0;return}M.paused&&(M.heatmap?.resume(),M.rrweb?.resume(),M.paused=!1),M.pagesVisited+=1,M.rrweb?.takeFullSnapshot(),Ne(M.config,"/events",{events:[{sessionUid:M.sessionUid,ts:new Date().toISOString(),type:"page_view",url:s??location.href,title:e??document.title}]})}},_sessionUid(){return M?.sessionUid??null}}});var ig={};Ht(ig,{Segi:()=>Me,default:()=>sg});function xn(){return{options:{projectKey:"",endpoint:""},user:null,tags:{},breadcrumbs:[],initialized:!1}}function Mn(s,e){let t=s.options.maxBreadcrumbs??50;s.breadcrumbs.push(e),s.breadcrumbs.length>t&&s.breadcrumbs.splice(0,s.breadcrumbs.length-t)}function cs(s,e){let t={type:e.type??"error",level:e.level??"error",message:e.message??"",errorName:e.errorName,stack:e.stack,platform:e.platform,runtime:e.runtime,environment:e.environment??s.options.environment,release:e.release??s.options.release,transaction:e.transaction,url:e.url,userAgent:e.userAgent,user:e.user??s.user??void 0,tags:{...s.tags,...e.tags??{}},extra:e.extra,breadcrumbs:s.breadcrumbs.slice(),request:e.request,timestamp:e.timestamp??new Date().toISOString()};if(s.options.beforeSend)try{let r=s.options.beforeSend(t);return r||{...t,_drop:!0}}catch{return t}return t}var kn=Eu(Tn()),_n=new Set;function ps(s,e){_n.has(s)||(_n.add(s),typeof console<"u"&&typeof console.warn=="function"&&console.warn(`[segi] ${e}`))}function _u(s){return s===401||s===403?"ingest rejected the project key (check projectKey + endpoint region)":s===404?"ingest endpoint not found (check endpoint URL)":s===413?"event payload too large; dropped by ingest":s===429?"ingest rate-limited (over plan quota or burst)":s>=500?"ingest is returning 5xx \u2014 events may be lost":"ingest returned a non-2xx response"}function ms(s,e,t){let r=s||kn.SEGI_DEFAULT_INGEST_ENDPOINT;if(!r||!e){ps("missing-config",e?"init() called without a valid endpoint \u2014 events will not be sent":"init() called without a projectKey \u2014 events will not be sent");return}if(!t._drop)try{let i=JSON.stringify(t),n={"Content-Type":"application/json","X-Segi-Project-Key":e};if(typeof fetch=="function"){fetch(r,{method:"POST",headers:n,body:i,keepalive:!0,mode:"cors",credentials:"omit"}).then(o=>{o.ok||ps(`status-${o.status}`,`${_u(o.status)} (HTTP ${o.status} from ${r})`)}).catch(o=>{ps("network-error",`network error reaching ${r} \u2014 events not delivered (${o instanceof Error?o.message:String(o)})`)});return}if(typeof navigator<"u"&&typeof navigator.sendBeacon=="function"){let o=`${r}${r.includes("?")?"&":"?"}pk=${encodeURIComponent(e)}`,a=new Blob([i],{type:"application/json"});navigator.sendBeacon(o,a)}}catch{}}var Q=xn();function eg(s){try{if(s&&typeof s=="object"&&"stack"in s)return String(s.stack??"")}catch{}}function os(s){if(Q.initialized)try{if(s instanceof ErrorEvent){let e=s.error,t=e?.message??s.message??"Error";Me.captureException(e??new Error(t),{message:t,url:typeof location<"u"?location.href:void 0})}else if("reason"in s){let e=s.reason,t=e instanceof Error?e.message:typeof e=="string"?e:"Unhandled promise rejection";Me.captureException(e,{message:t,url:typeof location<"u"?location.href:void 0})}}catch{}}function tg(){typeof window>"u"||(window.addEventListener("error",os,!0),window.addEventListener("unhandledrejection",os,!0))}function mu(){typeof window>"u"||(window.removeEventListener("error",os,!0),window.removeEventListener("unhandledrejection",os,!0))}var rg={pause(){},resume(){},setUser(){},event(){},notifyRouteChange(){}},Me={replay:rg,init(s,e={}){try{let t=typeof window<"u"?window:null;if((Q.initialized||t?.__segiInitialized===!0)&&!e.force){!e.silent&&typeof console<"u"&&console.warn("[segi] init() called more than once; ignoring. Pass { force: true } to override.");return}Q.initialized&&mu();let{replay:i,...n}=s;Q.options={...n},Q.initialized=!0,t&&(t.__segiInitialized=!0),tg(),i?.__segi_replay&&Promise.resolve().then(()=>(pu(),du)).then(o=>(Me.replay=o.replayApi,o.activateReplay({projectKey:n.projectKey,endpoint:n.endpoint,config:i}))).catch(()=>{})}catch{}},isInitialized(){return Q.initialized},close(){try{if(mu(),Q.initialized=!1,Q.user=null,Q.tags={},Q.breadcrumbs=[],typeof window<"u"){let s=window;s.__segiInitialized=!1}}catch{}},captureException(s,e={}){try{if(!Q.initialized)return;let t=s instanceof Error?s:new Error(typeof s=="string"?s:JSON.stringify(s)),r=cs(Q,{type:"error",level:"error",message:t.message,errorName:t.name,stack:eg(t),platform:"javascript",runtime:"browser",url:e.url??(typeof location<"u"?location.href:void 0),userAgent:e.userAgent??(typeof navigator<"u"?navigator.userAgent:void 0),...e});ms(Q.options.endpoint,Q.options.projectKey,r)}catch{}},captureMessage(s,e={}){try{if(!Q.initialized)return;let t=cs(Q,{type:"message",level:e.level??"info",message:s,platform:"javascript",runtime:"browser",url:typeof location<"u"?location.href:void 0,userAgent:typeof navigator<"u"?navigator.userAgent:void 0,...e});ms(Q.options.endpoint,Q.options.projectKey,t)}catch{}},setUser(s){try{Q.user=s}catch{}},setTag(s,e){try{Q.tags[s]=e}catch{}},addBreadcrumb(s){try{Mn(Q,{...s,timestamp:s.timestamp??new Date().toISOString()})}catch{}}};(function(){try{let e=window;if(e.__segiBundleLoaded){typeof console<"u"&&console.warn("[segi] segi.min.js loaded more than once; ignoring this load.");return}e.__segiBundleLoaded=!0;let t=e.SegiConfig??{},r={},i=document.getElementsByTagName("script");for(let a=i.length-1;a>=0;a--){let l=i[a];if(l.src&&/segi(\.min)?\.js/.test(l.src)){r={projectKey:l.dataset.projectKey,endpoint:l.dataset.endpoint,environment:l.dataset.environment,release:l.dataset.release};break}}let n=t.projectKey??r.projectKey,o=t.endpoint??r.endpoint;if(!n){e.Segi=Me;return}Me.init({projectKey:n,endpoint:o,environment:t.environment??r.environment,release:t.release??r.release}),e.Segi=Me}catch{}})();var sg=Me;return Iu(ig);})();
|
|
62
62
|
/*! Bundled license information:
|
|
63
63
|
|
|
64
64
|
rrweb/dist/rrweb.js:
|
package/dist/replay/index.js
CHANGED
|
@@ -221,9 +221,12 @@ async function postTrace(cfg, path, body) {
|
|
|
221
221
|
"Content-Type": "application/json",
|
|
222
222
|
"X-Segi-Project-Key": cfg.projectKey
|
|
223
223
|
},
|
|
224
|
-
body: JSON.stringify(body)
|
|
225
|
-
//
|
|
226
|
-
|
|
224
|
+
body: JSON.stringify(body)
|
|
225
|
+
// No `keepalive: true` — Chrome caps keepalive request bodies at
|
|
226
|
+
// 64 KB and rejects larger ones synchronously with "Failed to
|
|
227
|
+
// fetch", which silently nukes uploads (FullSnapshots routinely
|
|
228
|
+
// exceed 64 KB). Unload-path flushing goes through sendBeacon
|
|
229
|
+
// instead (separate API, no throw).
|
|
227
230
|
});
|
|
228
231
|
return res;
|
|
229
232
|
} catch (e8) {
|
|
@@ -397,8 +400,7 @@ async function activateReplay(args) {
|
|
|
397
400
|
"Content-Type": "application/json",
|
|
398
401
|
"X-Segi-Project-Key": transportCfg.projectKey
|
|
399
402
|
},
|
|
400
|
-
body: bodyStr
|
|
401
|
-
keepalive: true
|
|
403
|
+
body: bodyStr
|
|
402
404
|
});
|
|
403
405
|
if (typeof console !== "undefined") {
|
|
404
406
|
console.log(
|
package/dist/replay/index.mjs
CHANGED
|
@@ -221,9 +221,12 @@ async function postTrace(cfg, path, body) {
|
|
|
221
221
|
"Content-Type": "application/json",
|
|
222
222
|
"X-Segi-Project-Key": cfg.projectKey
|
|
223
223
|
},
|
|
224
|
-
body: JSON.stringify(body)
|
|
225
|
-
//
|
|
226
|
-
|
|
224
|
+
body: JSON.stringify(body)
|
|
225
|
+
// No `keepalive: true` — Chrome caps keepalive request bodies at
|
|
226
|
+
// 64 KB and rejects larger ones synchronously with "Failed to
|
|
227
|
+
// fetch", which silently nukes uploads (FullSnapshots routinely
|
|
228
|
+
// exceed 64 KB). Unload-path flushing goes through sendBeacon
|
|
229
|
+
// instead (separate API, no throw).
|
|
227
230
|
});
|
|
228
231
|
return res;
|
|
229
232
|
} catch {
|
|
@@ -397,8 +400,7 @@ async function activateReplay(args) {
|
|
|
397
400
|
"Content-Type": "application/json",
|
|
398
401
|
"X-Segi-Project-Key": transportCfg.projectKey
|
|
399
402
|
},
|
|
400
|
-
body: bodyStr
|
|
401
|
-
keepalive: true
|
|
403
|
+
body: bodyStr
|
|
402
404
|
});
|
|
403
405
|
if (typeof console !== "undefined") {
|
|
404
406
|
console.log(
|