posthog-js 1.391.6 → 1.391.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";function t(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function e(e){return function(){var r=this,i=arguments;return new Promise((function(n,s){var a=e.apply(r,i);function o(e){t(a,n,s,o,u,"next",e)}function u(e){t(a,n,s,o,u,"throw",e)}o(void 0)}))}}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},r.apply(null,arguments)}var i,n=["type"],s=Object.defineProperty,a=(t,e,r)=>((t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),o=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(o||{}),u=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(u||{}),l=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(l||{}),h=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(h||{}),d=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(d||{}),c=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(c||{}),f=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(f||{}),v={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},p={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},m={};function g(t){if(m[t])return m[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in v?v[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in p?p[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return m[t]=e.prototype,e.prototype;var o=document.createElement("iframe");try{document.body.appendChild(o);var u=o.contentWindow;if(!u)return e.prototype;var l=u[t].prototype;return l?m[t]=l:r}catch(t){return r}finally{o.parentNode&&document.body.removeChild(o)}}var y={};function w(t,e,r){var i,n=t+"."+String(r);if(y[n])return y[n].call(e);var s=g(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(y[n]=a,a.call(e)):e[r]}var b={};function k(t,e,r){var i=t+"."+String(r);if(b[i])return b[i].bind(e);var n=g(t)[r];return"function"!=typeof n?e[r]:(b[i]=n,n.bind(e))}function S(){return g("MutationObserver").constructor}function I(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n=r(i);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i}})),t[e]=n,()=>{t[e]=i}}catch(t){return()=>{}}}var _={childNodes:t=>w("Node",t,"childNodes"),parentNode:t=>w("Node",t,"parentNode"),parentElement:t=>w("Node",t,"parentElement"),textContent:t=>w("Node",t,"textContent"),contains:(t,e)=>k("Node",t,"contains")(e),getRootNode:t=>k("Node",t,"getRootNode")(),host:t=>t&&"host"in t?w("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?w("Element",t,"shadowRoot"):null,querySelector:(t,e)=>k("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>k("Element",t,"querySelectorAll")(e),mutationObserver:S,patch:I};function C(t){return t.nodeType===t.ELEMENT_NODE}function M(t){var e=t&&"host"in t&&"mode"in t&&_.host(t)||null;return Boolean(e&&"shadowRoot"in e&&_.shadowRoot(e)===t)}function T(t){return"[object ShadowRoot]"==={}.toString.call(t)}function R(t){try{var e=t.rules||t.cssRules;if(!e)return null;var r=t.href;return!r&&t.ownerNode&&(r=t.ownerNode.baseURI),(i=Array.from(e,(t=>x(t,r))).join("")).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(t){return null}var i}function x(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=R(t.styleSheet)||function(t){var{cssText:e}=t;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return z(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),e?z(n,e):n}class O{constructor(){a(this,"idNodeMap",new Map),a(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),C(t)){var r=_.shadowRoot(t);r&&this.removeNodeFromMap(r),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function L(t){var{element:e,maskInputOptions:r,tagName:i,type:n,value:s,maskInputFn:a}=t,o=s||"",u=n&&E(n);return(r[i.toLowerCase()]||u&&r[u])&&(o=a?a(o,e):"*".repeat(o.length)),o}function E(t){return t.toLowerCase()}var A="__rrweb_original__";function F(t){var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?E(e):null}var N=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,D=/^(?:[a-z+]+:)?\/\//i,B=/^www\..*/i,W=/^(data:)([^,]*),(.*)/i;function z(t,e){return(t||"").replace(N,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(D.test(u)||B.test(u))return"url("+l+u+l+")";if(W.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var P,U,j="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",q=4096,H=1,G=new RegExp("[^a-z0-9-_:]"),V=-2;function Z(){return H++}var J=/^[^ \t\n\r\u000c]+/,Q=/^[, \t\n\r\u000c]+/,X=new WeakMap;function Y(t,e){return e&&""!==e.trim()?K(t,e):e}function K(t,e){var r=X.get(t);if(r||(r=t.createElement("a"),X.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function tt(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?j:t}(t,e.maxBase64ImageLength):t}function et(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=Y(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>q||t.naturalHeight>q)return e;try{var n=document.createElement("canvas");n.width=t.naturalWidth,n.height=t.naturalHeight;var s=n.getContext("2d");return s?(s.drawImage(t,0,0),n.toDataURL(r||"image/webp",null!=i?i:.4)):e}catch(t){return e}}(n,u,s.type,s.quality)),tt(l,s)}if("image"===e)return tt(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=Y(t,i);return"image"===e&&h.startsWith("data:")?tt(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(Q),e.length>r;){var s=i(J);if(","===s.slice(-1))s=Y(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=Y(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?z(i,K(t)):"object"===e&&"data"===r?Y(t,i):i:Y(t,i)}function rt(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function it(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&it(_.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&it(_.parentNode(t),e,r)}function nt(t,e,r,i){var n;if(C(t)){if(!_.childNodes(n=t).length)return!1}else{if(null===_.parentElement(t))return!1;n=_.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(it(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}var st=new Map;function at(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function ot(t){return null==t?"":t.toLowerCase()}var ut=50,lt=!1,ht=!1;function dt(t,e){var{doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:u=!1,inlineStylesheet:l=!0,maskInputOptions:h={},maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b=5e3,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=(()=>!1),newlyAddedElement:O=!1,depth:N=0,maxDepth:D=ut}=e,{needsMask:B}=e,{preserveWhiteSpace:W=!0}=e;if(N>=D)return ht=!0,lt||(lt=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+D+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;B||(B=nt(t,a,o,void 0===B));var j,q=function(t,e){var{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:a,inlineStylesheet:o,maskInputOptions:u={},maskTextFn:l,maskInputFn:h,dataURLOptions:d={},inlineImages:c,recordCanvas:v,keepIframeSrcFn:p,newlyAddedElement:m=!1}=e,g=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,i);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:f.Document,childNodes:[],compatMode:t.compatMode}:{type:f.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:g};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,{doc:a,blockClass:o,blockSelector:u,inlineStylesheet:l,maskInputOptions:h={},maskInputFn:d,dataURLOptions:c={},inlineImages:v,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1,rootId:y}=e,w=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,o,u),b=function(t){if(t instanceof HTMLFormElement)return"form";var e=E(t.tagName);return G.test(e)?"div":e}(t),k={},S=t.attributes.length,I=0;S>I;I++){var C=t.attributes[I];rt(b,C.name)||(k[C.name]=et(a,b,E(C.name),C.value,t,c))}if("link"===b&&l){var M=t.sheet;if(!M){var T=function(t){return t.href}(t);T&&!(M=at(a,T))&&T.includes(".css")&&(M=at(a,window.location.origin+"/"+T.replace(window.location.href,"")))}var x=null;M&&(x=R(M)),x&&(delete k.rel,delete k.href,k._cssText=x)}if("style"===b&&t.sheet&&!(t.innerText||_.textContent(t)||"").trim().length){var O=R(t.sheet);O&&(k._cssText=O)}if("input"===b||"textarea"===b||"select"===b){var N=t.value,D=t.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&N?k.value=L({element:t,type:F(t),tagName:b,value:N,maskInputOptions:h,maskInputFn:d}):D&&(k.checked=D)}if("option"===b&&(t.selected&&!h.select?k.selected=!0:delete k.selected),"dialog"===b&&t.open)try{k.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&p)if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((A in n?n[A]:n).call(e,r,i,Math.min(50,t.width-r),Math.min(50,t.height-i)).data.buffer).some((t=>0!==t)))return!1}return!0})(t)||(k.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){var B=t.toDataURL(c.type,c.quality),W=a.createElement("canvas");W.width=t.width,W.height=t.height,B!==W.toDataURL(c.type,c.quality)&&(k.rr_dataURL=B)}if("img"===b&&v){P||(P=a.createElement("canvas"),U=P.getContext("2d"));var z=t,j=z.currentSrc||z.getAttribute("src")||"<unknown-src>",q=z.crossOrigin,H=()=>{z.removeEventListener("load",H);try{P.width=z.naturalWidth,P.height=z.naturalHeight,U.drawImage(z,0,0),k.rr_dataURL=P.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==z.crossOrigin)return z.crossOrigin="anonymous",void(z.complete&&0!==z.naturalWidth?H():z.addEventListener("load",H));console.warn("Cannot inline img src="+j+"! Error: "+t)}"anonymous"===z.crossOrigin&&(q?k.crossOrigin=q:z.removeAttribute("crossorigin"))};z.complete&&0!==z.naturalWidth?H():z.addEventListener("load",H)}if("audio"===b||"video"===b){var V=k;V.rr_mediaState=t.paused?"paused":"played",V.rr_mediaCurrentTime=t.currentTime,V.rr_mediaPlaybackRate=t.playbackRate,V.rr_mediaMuted=t.muted,V.rr_mediaLoop=t.loop,V.rr_mediaVolume=t.volume}if(g||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),w){var{width:Z,height:J,left:Q,top:X}=t.getBoundingClientRect(),Y=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);k={class:k.class,rr_width:Z+"px",rr_height:J+"px",rr_left:Math.floor(Q+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(X+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},Y&&(k.rr_position=Y.position||"static",Y.transform&&"none"!==Y.transform&&(k.rr_transform=Y.transform),Y.display&&Y.display.startsWith("inline")&&(k.rr_display=Y.display))}"iframe"!==b||m(k.src)||(t.contentDocument||(k.rr_src=k.src),delete k.src);try{customElements.get(b)&&(s=!0)}catch(t){}return{type:f.Element,tagName:b,attributes:k,childNodes:[],isSVG:(K=t,Boolean("svg"===K.tagName||K.ownerSVGElement)||void 0),needBlock:w,rootId:y,isCustom:s};var K}(t,{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:u,maskInputFn:h,dataURLOptions:d,inlineImages:c,recordCanvas:v,keepIframeSrcFn:p,newlyAddedElement:m,rootId:g});case t.TEXT_NODE:return function(t,e){var r,{needsMask:i,maskTextFn:n,rootId:s}=e,a=_.parentNode(t),o=a&&a.tagName,u=_.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(null==(r=a.sheet)?void 0:r.cssRules){var d=R(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=z(u,K(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,_.parentElement(t)):u.replace(/[\S]/g,"*")),{type:f.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:a,maskTextFn:l,rootId:g});case t.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:g};case t.COMMENT_NODE:return{type:f.Comment,textContent:_.textContent(t)||"",rootId:g};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,dataURLOptions:p,inlineImages:m,recordCanvas:g,keepIframeSrcFn:x,newlyAddedElement:O});if(!q)return console.warn(t,"not serialized"),null;j=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===f.Comment)return!0;if(t.type===f.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(ot(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ot(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ot(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&ot(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ot(t.attributes.property).match(/^(og|twitter|fb):/)||ot(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===ot(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(ot(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(ot(t.attributes.name))||ot(t.attributes.property).match(/^article:/)||ot(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(ot(t.attributes.name)))return!0}}return!1}(q,v)||!W&&q.type===f.Text&&!q.isStyle&&!q.textContent.replace(/^\s+|\s+$/gm,"").length?V:Z();var H=Object.assign(q,{id:j});if(i.add(t,H),j===V)return null;y&&y(t);var J=!u;if(H.type===f.Element){J=J&&!H.needBlock,delete H.needBlock;var Q=_.shadowRoot(t);Q&&T(Q)&&(H.isShadowHost=!0)}if((H.type===f.Document||H.type===f.Element)&&J){v.headWhitespace&&H.type===f.Element&&"head"===H.tagName&&(W=!1);var X={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:u,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p,inlineImages:m,recordCanvas:g,preserveWhiteSpace:W,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x,depth:N+1,maxDepth:D};if(H.type===f.Element&&"textarea"===H.tagName&&void 0!==H.attributes.value);else for(var Y of Array.from(_.childNodes(t))){var tt=dt(Y,X);tt&&H.childNodes.push(tt)}var it=null;if(C(t)&&(it=_.shadowRoot(t)))for(var ct of Array.from(_.childNodes(it))){var ft=dt(ct,X);ft&&(T(it)&&(ft.isShadow=!0),H.childNodes.push(ft))}}var vt=_.parentNode(t);if(vt&&M(vt)&&T(vt)&&(H.isShadow=!0),H.type===f.Element&&"iframe"===H.tagName){var pt=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),t.removeEventListener("load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?t.removeEventListener("load",a):(o=!0,t.removeEventListener("load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var f=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(f),t.removeEventListener("load",a)}}return t.addEventListener("load",a),()=>{t.removeEventListener("load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&w){var r=dt(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p,inlineImages:m,recordCanvas:g,preserveWhiteSpace:W,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x,depth:N+1,maxDepth:D});r&&w(t,r)}}),b);null==k||k(t,pt)}return H.type===f.Element&&"link"===H.tagName&&"stylesheet"===H.attributes.rel&&function(e,u,f){if(!st.has(e)){var k;try{k=e.sheet}catch(t){return}if(!k){var _=new AbortController,C=!1,M=()=>{if(!C){C=!0;try{(()=>{if(S){var e=dt(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p,inlineImages:m,recordCanvas:g,preserveWhiteSpace:W,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x,depth:N,maxDepth:D});e&&S(t,e)}})()}finally{st.delete(e),_.abort()}}},T=setTimeout(M,f);_.signal.addEventListener("abort",(()=>clearTimeout(T)),{once:!0}),e.addEventListener("load",M,{signal:_.signal,once:!0}),st.set(e,_)}}}(t,0,I),H}function ct(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}class ft{constructor(){a(this,"parentElement",null),a(this,"parentNode",null),a(this,"ownerDocument"),a(this,"firstChild",null),a(this,"lastChild",null),a(this,"previousSibling",null),a(this,"nextSibling",null),a(this,"ELEMENT_NODE",1),a(this,"TEXT_NODE",3),a(this,"nodeType"),a(this,"nodeName"),a(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof ft))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function vt(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>r.removeEventListener(t,e,i)}function pt(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var mt="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",gt={map:{},getId(){return console.error(mt),-1},getNode(){return console.error(mt),null},removeNodeFromMap(){console.error(mt)},has(){return console.error(mt),!1},reset(){console.error(mt)}};function yt(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function wt(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){setTimeout((()=>{r.set.call(this,t)}),0),s&&s.set&&s.set.call(this,t)}}),()=>wt(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(gt=new Proxy(gt,{get(t,e,r){return"map"===e&&console.error(mt),Reflect.get(t,e,r)}}));var bt=Date.now;function kt(t){var e,r,i,n,s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(e=_.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=_.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function St(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function It(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _t(t){return t?t.nodeType===t.ELEMENT_NODE?t:_.parentElement(t):null}function Ct(t,e,r,i){if(!t)return!1;var n=_t(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(it(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function Mt(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===V}function Tt(t,e){if(M(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=_.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||Tt(i,e))}function Rt(t){return Boolean(t.changedTouches)}function xt(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Ot(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Lt(t){return!!t&&(t instanceof ft&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(_.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(bt=()=>(new Date).getTime());class Et{constructor(){a(this,"id",1),a(this,"styleIDMap",new WeakMap),a(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function At(t){var e,r=null;return"getRootNode"in t&&(null==(e=_.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&_.host(_.getRootNode(t))&&(r=_.host(_.getRootNode(t))),r}function Ft(t){var e=t.ownerDocument;return!!e&&(_.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=At(r);)r=e;return r}(t);return _.contains(e,r)}(t))}function Nt(t){return"__ln"in t}class Dt{constructor(){a(this,"length",0),a(this,"head",null),a(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Nt(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&Nt(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){var e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}var Bt,Wt=(t,e)=>t+"@"+e;class zt{constructor(){a(this,"frozen",!1),a(this,"locked",!1),a(this,"texts",[]),a(this,"attributes",[]),a(this,"attributeMap",new WeakMap),a(this,"removes",[]),a(this,"mapRemoves",[]),a(this,"movedMap",{}),a(this,"addedSet",new Set),a(this,"movedSet",new Set),a(this,"droppedSet",new Set),a(this,"removesSubTreeCache",new Set),a(this,"mutationCb"),a(this,"blockClass"),a(this,"blockSelector"),a(this,"maskTextClass"),a(this,"maskTextSelector"),a(this,"inlineStylesheet"),a(this,"maskInputOptions"),a(this,"maskTextFn"),a(this,"maskInputFn"),a(this,"keepIframeSrcFn"),a(this,"recordCanvas"),a(this,"inlineImages"),a(this,"slimDOMOptions"),a(this,"dataURLOptions"),a(this,"doc"),a(this,"mirror"),a(this,"iframeManager"),a(this,"stylesheetManager"),a(this,"shadowDomManager"),a(this,"canvasManager"),a(this,"processedNodeManager"),a(this,"unattachedDoc"),a(this,"canvasManagerReleased",!1),a(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),a(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var t=[],e=new Set,r=new Dt,i=t=>{for(var e=t,r=V;r===V;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=_.parentNode(n);if(s&&Ft(n)&&"TEXTAREA"!==s.tagName){var a=M(s)?this.mirror.getId(At(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=dt(n,{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:t=>{xt(t,this.mirror)&&this.iframeManager.addIframe(t),Ot(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Lt(n)&&this.shadowDomManager.addShadowRoot(_.shadowRoot(n),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)Ut(this.removesSubTreeCache,s)&&!this.movedSet.has(_.parentNode(s))||n(s);for(var a of this.addedSet)$t(this.droppedSet,a)||Ut(this.removesSubTreeCache,a)?$t(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(_.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var f=this.mirror.getId(_.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==f){u=c;break}var v=_.parentNode(c.value);if(v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=_.host(v);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var m={texts:this.texts.map((t=>{var e=t.node,r=_.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var{attributes:e}=t;if("string"==typeof e.style){var r=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>r.length&&(r+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}return{id:this.mirror.getId(t.node),attributes:e}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),removes:this.removes,adds:t};(m.texts.length||m.attributes.length||m.removes.length||m.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(m))}})),a(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),a(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(_.childNodes(t),(t=>_.textContent(t)||"")).join("");e.attributes.value=L({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:F(t),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(t=>{if(!Mt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=_.textContent(t.target);Ct(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:nt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,_t(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break;case"attributes":var r=t.target,i=t.attributeName,n=t.target.getAttribute(i);if("value"===i){var s=F(r);n=L({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(Ct(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;var a=this.attributeMap.get(t.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(a||(this.attributes.push(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===r.tagName&&"password"===(t.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!rt(r.tagName,i))if(a.attributes[i]=et(this.doc,E(r.tagName),E(i),n,r,this.dataURLOptions),"style"===i){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var u of(t.oldValue&&(o.style.cssText=t.oldValue),Array.from(r.style))){var l=r.style.getPropertyValue(u),h=r.style.getPropertyPriority(u);l!==o.style.getPropertyValue(u)||h!==o.style.getPropertyPriority(u)?a.styleDiff[u]=""===h?l:[l,h]:a._unchangedStyles[u]=[l,h]}for(var d of Array.from(o.style))""===r.style.getPropertyValue(d)&&(a.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(Ct(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach((e=>this.genAdds(e,t.target))),t.removedNodes.forEach((e=>{var r=this.mirror.getId(e),i=M(t.target)?this.mirror.getId(_.host(t.target)):this.mirror.getId(t.target);Ct(t.target,this.blockClass,this.blockSelector,!1)||Mt(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Pt(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||Tt(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Wt(r,i)]?Pt(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!M(t.target)||!T(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),_.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),a(this,"genAdds",((t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!this.addedSet.has(t)&&!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Mt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Wt(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Ct(t,this.blockClass,this.blockSelector,!1)||(_.childNodes(t).forEach((t=>this.genAdds(t))),Lt(t)&&_.childNodes(_.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((e=>{this[e]=t[e]})),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function Pt(t,e){t.delete(e),_.childNodes(e).forEach((e=>Pt(t,e)))}function Ut(t,e,r){return 0!==t.size&&function(t,e,r){var i=_.parentNode(e);return!!i&&t.has(i)}(t,e)}function $t(t,e){return 0!==t.size&&jt(t,e)}function jt(t,e){var r=_.parentNode(e);return!!r&&(!!t.has(r)||jt(t,r))}var qt=t=>Bt?function(){try{return t(...arguments)}catch(t){if(Bt&&!0===Bt(t))return;throw t}}:t,Ht=[];function Gt(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function Vt(t,e){var r=new zt;Ht.push(r),r.init(t);var i=new(S())(qt(r.processMutations.bind(r)));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{observer:i,buffer:r}}function Zt(t){var{scrollCb:e,doc:r,mirror:i,blockClass:n,blockSelector:s,sampling:a}=t,o=new Map,u=t=>{var a=Gt(t);if(a&&!Ct(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=kt(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[vt("scroll",qt(yt(qt((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(vt("scrollend",qt(u),r)),()=>l.forEach((t=>t()))}function Jt(t,e){for(var r=Ht.length-1;r>=0;r--){var i=Ht[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Ht.splice(r,1))}}}var Qt=["INPUT","TEXTAREA","SELECT"],Xt=new WeakMap;function Yt(t){return function t(e,r){if(re("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||re("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||re("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||re("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function Kt(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function te(t,e){var r,i,n,s,{mirror:a,stylesheetManager:o}=t;s=a.getId("#document"===e.nodeName?e:_.host(e));var u="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==u?void 0:u.prototype)?Object.getOwnPropertyDescriptor(null==u?void 0:u.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&u&&l?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null==(t=l.get)?void 0:t.call(this)},set(t){var e,r=null==(e=l.set)?void 0:e.call(this,t);if(null!==s&&-1!==s)try{o.adoptStyleSheets(t,s)}catch(t){}return r}}),qt((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function ee(t,e){void 0===e&&(e={});var i,n,s=t.doc.defaultView;if(!s)return()=>{};if(function(t,e){var{mutationCb:r,mousemoveCb:i,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:a,inputCb:o,mediaInteractionCb:u,styleSheetRuleCb:l,styleDeclarationCb:h,canvasMutationCb:d,fontCb:c,selectionCb:f,customElementCb:v}=t;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),f(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),v(...arguments)}}(t,e),t.recordDOM){var a=Vt(t,t.doc);i=a.observer,n=a.buffer}var o=function(t){var{mousemoveCb:e,sampling:r,doc:i,mirror:n}=t;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],h=yt(qt((t=>{var r=Date.now()-s;e(l.map((t=>(t.timeOffset-=r,t))),t),l=[],s=null})),o),d=qt(yt(qt((t=>{var e=Gt(t),{clientX:r,clientY:i}=Rt(t)?t.changedTouches[0]:t;s||(s=bt()),l.push({x:r,y:i,id:n.getId(e),timeOffset:bt()-s}),h("undefined"!=typeof DragEvent&&t instanceof DragEvent?u.Drag:t instanceof MouseEvent?u.MouseMove:u.TouchMove)})),a,{trailing:!1})),c=[vt("mousemove",d,i),vt("touchmove",d,i),vt("drag",d,i)];return qt((()=>{c.forEach((t=>t()))}))}(t),d=function(t){var{mouseInteractionCb:e,doc:i,mirror:n,blockClass:s,blockSelector:a,sampling:o}=t;if(!1===o.mouseInteraction)return()=>{};var u=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,d=[],c=null;return Object.keys(l).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==u[t])).forEach((t=>{var o=E(t),u=(t=>i=>{var o=Gt(i);if(!Ct(o,s,a,!0)){var u=null,d=t;if("pointerType"in i){switch(i.pointerType){case"mouse":u=h.Mouse;break;case"touch":u=h.Touch;break;case"pen":u=h.Pen}u===h.Touch&&(l[t]===l.MouseDown?d="TouchStart":l[t]===l.MouseUp&&(d="TouchEnd"))}else Rt(i)&&(u=h.Touch);null!==u?(c=u,(d.startsWith("Touch")&&u===h.Touch||d.startsWith("Mouse")&&u===h.Mouse)&&(u=null)):l[t]===l.Click&&(u=c,c=null);var f=Rt(i)?i.changedTouches[0]:i;if(f){var v=n.getId(o),{clientX:p,clientY:m}=f;qt(e)(r({type:l[d],id:v,x:p,y:m},null!==u&&{pointerType:u}))}}})(t);if(window.PointerEvent)switch(l[t]){case l.MouseDown:case l.MouseUp:o=o.replace("mouse","pointer");break;case l.TouchStart:case l.TouchEnd:return}d.push(vt(o,u,i))})),qt((()=>{d.forEach((t=>t()))}))}(t),f=Zt(t),v=function(t,e){var{viewportResizeCb:r}=t,{win:i}=e,n=-1,s=-1;return vt("resize",qt(yt(qt((()=>{var t=St(),e=It();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:s}),p=function(t){var{inputCb:e,doc:i,mirror:n,blockClass:s,blockSelector:a,ignoreClass:o,ignoreSelector:u,maskInputOptions:l,maskInputFn:h,sampling:d,userTriggeredOnInput:c}=t;function f(t){var e=Gt(t),r=t.isTrusted,n=e&&e.tagName;if(e&&"OPTION"===n&&(e=_.parentElement(e)),e&&n&&Qt.indexOf(n)>=0&&!Ct(e,s,a,!0)&&!(e.classList.contains(o)||u&&e.matches(u))){var d=e.value,f=!1,p=F(e)||"";"radio"===p||"checkbox"===p?f=e.checked:(l[n.toLowerCase()]||l[p])&&(d=L({element:e,maskInputOptions:l,tagName:n,type:p,value:d,maskInputFn:h})),v(e,c?{text:d,isChecked:f,userTriggered:r}:{text:d,isChecked:f});var m=e.name;"radio"===p&&m&&f&&i.querySelectorAll('input[type="radio"][name="'+m+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,c?{text:r,isChecked:!f,userTriggered:!1}:{text:r,isChecked:!f})}}))}}function v(t,i){var s=Xt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Xt.set(t,i);var a=n.getId(t);qt(e)(r({},i,{id:a}))}}var p=("last"===d.input?["change"]:["input","change"]).map((t=>vt(t,qt(f),i))),m=i.defaultView;if(!m)return()=>{p.forEach((t=>t()))};var g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]].map((t=>wt(t[0],t[1],{set(){qt(f)({target:this,isTrusted:!1})}},!1,m)))),qt((()=>{p.forEach((t=>t()))}))}(t),m=function(t){var{mediaInteractionCb:e,blockClass:r,blockSelector:i,mirror:n,sampling:s,doc:a}=t,o=qt((t=>yt(qt((s=>{var a=Gt(s);if(a&&!Ct(a,r,i,!0)){var{currentTime:o,volume:u,muted:l,playbackRate:h,loop:d}=a;e({type:t,id:n.getId(a),currentTime:o,volume:u,muted:l,playbackRate:h,loop:d})}})),s.media||500))),u=[vt("play",o(c.Play),a),vt("pause",o(c.Pause),a),vt("seeked",o(c.Seeked),a),vt("volumechange",o(c.VolumeChange),a),vt("ratechange",o(c.RateChange),a)];return qt((()=>{u.forEach((t=>t()))}))}(t),g=()=>{},y=()=>{},w=()=>{},b=()=>{};t.recordDOM&&(g=function(t,e){var{styleSheetRuleCb:r,mirror:i,stylesheetManager:n}=t,{win:s}=e;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:qt(((t,e,s)=>{var[a,o]=s,{id:u,styleId:l}=Kt(e,i,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,adds:[{rule:a,index:o}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var o,u,l=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,removes:[{index:a}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,replaceSync:a}),t.apply(e,s)}))}));var h={};ie("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(ie("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),ie("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),ie("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var[e,s]=t;d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:qt(((t,e,s)=>{var[a,o]=s,{id:u,styleId:l}=Kt(e.parentStyleSheet,i,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,adds:[{rule:a,index:[...Yt(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e.parentStyleSheet,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,removes:[{index:[...Yt(e),a]}]}),t.apply(e,s)}))})})),qt((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=l,o&&(s.CSSStyleSheet.prototype.replace=o),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(h).forEach((t=>{var[e,r]=t;r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:s}),y=te(t,t.doc),w=function(t,e){var{styleDeclarationCb:r,mirror:i,ignoreCSSAttributes:n,stylesheetManager:s}=t,{win:a}=e,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:qt(((t,e,a)=>{var u,[l,h,d]=a;if(n.has(l))return o.apply(e,[l,h,d]);var{id:c,styleId:f}=Kt(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror);return(c&&-1!==c||f&&-1!==f)&&r({id:c,styleId:f,set:{property:l,value:h,priority:d},index:Yt(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:qt(((t,e,a)=>{var o,[l]=a;if(n.has(l))return u.apply(e,[l]);var{id:h,styleId:d}=Kt(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror);return(h&&-1!==h||d&&-1!==d)&&r({id:h,styleId:d,remove:{property:l},index:Yt(e.parentRule)}),t.apply(e,a)}))}),qt((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:s}),t.collectFonts&&(b=function(t){var{fontCb:e,doc:r}=t,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=I(r.fonts,"add",(function(t){return function(r){return setTimeout(qt((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),qt((()=>{n.forEach((t=>t()))}))}(t)));var k=function(t){var{doc:e,mirror:r,blockClass:i,blockSelector:n,selectionCb:s}=t,a=!0,o=qt((()=>{var t=e.getSelection();if(!(!t||a&&(null==t?void 0:t.isCollapsed))){a=t.isCollapsed||!1;for(var o=[],u=t.rangeCount||0,l=0;u>l;l++){var h=t.getRangeAt(l),{startContainer:d,startOffset:c,endContainer:f,endOffset:v}=h;Ct(d,i,n,!0)||Ct(f,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(f),endOffset:v})}s({ranges:o})}}));return o(),vt("selectionchange",o)}(t),S=function(t){var{doc:e,customElementCb:r}=t,i=e.defaultView;return i&&i.customElements?I(i.customElements,"define",(function(t){return function(e,i,n){try{r({define:{name:e}})}catch(t){console.warn("Custom element callback failed for "+e)}return t.apply(this,[e,i,n])}})):()=>{}}(t),C=[];for(var M of t.plugins)C.push(M.observer(M.callback,s,M.options));return qt((()=>{if(n){n.destroy(),n.reset();var t=Ht.indexOf(n);-1!==t&&Ht.splice(t,1)}null==i||i.disconnect(),o(),d(),f(),v(),p(),m(),g(),y(),w(),b(),k(),S(),C.forEach((t=>t()))}))}function re(t){return void 0!==window[t]}function ie(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class ne{constructor(t){a(this,"iframeIdToRemoteIdMap",new WeakMap),a(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){var n=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=n.get(e);return a||(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i=r||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:i.get(e)||-1}getRemoteIds(t,e){var r=this.getRemoteIdToIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){var e=this.iframeIdToRemoteIdMap.get(t);return e||this.iframeIdToRemoteIdMap.set(t,e=new Map),e}getRemoteIdToIdMap(t){var e=this.iframeRemoteIdToIdMap.get(t);return e||this.iframeRemoteIdToIdMap.set(t,e=new Map),e}}class se{constructor(t){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new ne(Z)),a(this,"crossOriginIframeStyleMirror"),a(this,"crossOriginIframeRootIdMap",new WeakMap),a(this,"mirror"),a(this,"mutationCb"),a(this,"wrappedEmit"),a(this,"loadListener"),a(this,"pageHideListener"),a(this,"stylesheetManager"),a(this,"recordCrossOriginIframes"),a(this,"messageHandler"),a(this,"nestedIframeListeners",new Map),a(this,"attachedWindows",new WeakMap),a(this,"attachedDocuments",new WeakMap),a(this,"attachedIframes",new Map),a(this,"loadListenerDisposers",new WeakMap),a(this,"iframeElementsById",new Map),a(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ne(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>pt(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{var{win:e,handler:r}=t;pt((()=>e.removeEventListener("pagehide",r)))})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);pt((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}pt((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case o.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:o.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case o.Meta:case o.Load:case o.DomContentLoaded:return!1;case o.Plugin:return e;case o.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case o.IncrementalSnapshot:switch(e.data.source){case u.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),e.data.removes.forEach((e=>{this.replaceIds(e,t,["parentId","id"])})),e.data.attributes.forEach((e=>{this.replaceIds(e,t,["id"])})),e.data.texts.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case u.Drag:case u.TouchMove:case u.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(e.data,t,["id"]),e;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case u.Font:return e;case u.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case u.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach((t=>{this.replaceIdOnNode(t,e)}))}patchRootIdOnNode(t,e){t.type===f.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);if(n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(pt((()=>t.removeEventListener("message",e))),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)){var s=this.nestedIframeListeners.get(i);pt((()=>i.removeEventListener("message",s))),this.nestedIframeListeners.delete(i)}i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var a=this.attachedDocuments.get(r);a&&(a.forEach((t=>{pt((()=>this.mirror.removeNodeFromMap(t)))})),pt((()=>Jt(r,a))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var{content:r}=t;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{pt((()=>e.removeEventListener("message",t)))})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>{var{element:r}=e;return t.add(r)})),t.forEach((t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class ae{constructor(t){a(this,"shadowDoms",new WeakSet),a(this,"mutationCb"),a(this,"scrollCb"),a(this,"bypassOptions"),a(this,"mirror"),a(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){if(T(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var{observer:i,buffer:n}=Vt(r({},this.bypassOptions,{doc:e,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push((()=>{i.disconnect(),n.destroy(),n.releaseCanvasManager();var t=Ht.indexOf(n);-1!==t&&Ht.splice(t,1)})),this.restoreHandlers.push(Zt(r({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout((()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(_.host(t))),this.restoreHandlers.push(te({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))}),0)}}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){var r=this;this.restoreHandlers.push(I(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=_.shadowRoot(this);return s&&Ft(this)&&r.addShadowRoot(s,e),n}})))}reset(){this.restoreHandlers.forEach((t=>{try{t()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue="undefined"==typeof Uint8Array?[]:new Uint8Array(256),le=0;64>le;le++)ue[oe.charCodeAt(le)]=le;var he=new Map,de=(t,e,r)=>{if(t&&(ve(t,e)||"object"==typeof t)){var i=function(t,e){var r=he.get(t);return r||he.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function ce(t,e,r,i){if(t instanceof Array)return t.map((t=>ce(t,e,r,i)));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=oe[r[e]>>2],n+=oe[(3&r[e])<<4|r[e+1]>>4],n+=oe[(15&r[e+1])<<2|r[e+2]>>6],n+=oe[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}if(t instanceof DataView)return{rr_type:t.constructor.name,args:[ce(t.buffer,e,r,i),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){var a=t.constructor.name,{src:o}=t;return{rr_type:a,src:o}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[ce(t.data,e,r,i),t.width,t.height]}:ve(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:de(t,e,r)}:t}var fe=(t,e,r,i)=>t.map((t=>ce(t,e,r,i))),ve=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},pe=["webgl","webgl2"];function me(t){return"nodeType"in t}function ge(t,e,i,n){var s=[];try{if(n){var a=function(t,e,i){var n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return I(n.prototype,"configure",(function(n){return function(s){var a=function(t){var{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!a||me(a)&&Ct(a,e,i,!0))return n.call(this,s);me(a)&&!("__context"in a)&&(a.__context="webgpu");var o=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?r({},s,{usage:"number"==typeof s.usage?s.usage|o:o}):s)}}))}(t,e,i);a&&s.push(a)}var o=I(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(r){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(r),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!Ct(this,e,i,!0)&&("__context"in this||(this.__context=s),n&&pe.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[r,...o])}}));s.push(o)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((t=>t()))}}function ye(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=I(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(de(d,s,this),"tagName"in this.canvas&&!Ct(this.canvas,i,n,!0)){var c=fe(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=wt(t,u,{set(t){r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var we,be,ke,Se='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n function fnv1aHash(buffer) {\n const view = new Uint8Array(buffer);\n let hash = 2166136261;\n for (let i2 = 0; i2 < view.length; i2++) {\n hash ^= view[i2];\n hash = hash * 16777619 | 0;\n }\n return (hash >>> 0).toString(16);\n }\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions } = e.data;\n try {\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d");\n }\n reusableCtx.clearRect(0, 0, width, height);\n reusableCtx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const fingerprint = fnv1aHash(arrayBuffer);\n if (!lastFingerprintMap.has(id)) {\n const base642 = encode(arrayBuffer);\n if (await transparentBase64 === base642) {\n lastFingerprintMap.set(id, fingerprint);\n return worker.postMessage({ id });\n }\n lastFingerprintMap.set(id, fingerprint);\n worker.postMessage({ id, type, base64: base642, displayWidth, displayHeight });\n return;\n }\n if (lastFingerprintMap.get(id) === fingerprint)\n return worker.postMessage({ id });\n const base64 = encode(arrayBuffer);\n worker.postMessage({ id, type, base64, displayWidth, displayHeight });\n lastFingerprintMap.set(id, fingerprint);\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-CSpkoNCs.js.map\n',Ie="undefined"!=typeof self&&self.Blob&&new Blob([Se],{type:"text/javascript;charset=utf-8"});function _e(t){var e;try{if(!(e=Ie&&(self.URL||self.webkitURL).createObjectURL(Ie)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Se),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Ce{constructor(t){a(this,"pendingCanvasMutations",new Map),a(this,"rafStamps",{latestId:0,invokeId:null}),a(this,"mirror"),a(this,"mutationCb"),a(this,"resetObservers"),a(this,"frozen",!1),a(this,"locked",!1),a(this,"rafIdTimestamp",null),a(this,"rafIdFlush",null),a(this,"refCount",0),a(this,"torndown",!1),a(this,"processMutation",((t,e)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)}));var{sampling:e="all",win:r,blockClass:i,blockSelector:n,recordCanvas:s,dataURLOptions:o,resolutionScale:u}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&"all"===e&&this.initCanvasMutationObserver(r,i,n,o),s&&"number"==typeof e&&this.initCanvasFPSObserver(e,r,i,n,{dataURLOptions:o,resolutionScale:u})}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,i,n,s){var a=this;if("OffscreenCanvas"in r){var o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,u=ge(r,i,n,!0),l=new Map,h=new _e;h.onmessage=t=>{var{id:e}=t.data;if(l.set(e,!1),"base64"in t.data){var{base64:r,type:i,displayWidth:n,displayHeight:s}=t.data;this.mutationCb({id:e,type:d["2D"],commands:[{property:"clearRect",args:[0,0,n,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:i}]},0,0,n,s]}],displayWidth:n,displayHeight:s})}};var c,f=1e3/t,v=0,p=t=>{var u,d;v&&f>t-v||(v=t,(u=[],d=t=>{try{t.querySelectorAll("canvas").forEach((t=>{Ct(t,i,n,!0)||u.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&d(t.shadowRoot)}))}catch(t){}},d(r.document),u).forEach(function(){var t=e((function*(t){var e,r,i=a.mirror.getId(t);if(!l.get(i)&&0!==t.width&&0!==t.height){l.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var n=t.getContext(t.__context);if(null==(e=null==n?void 0:n.isContextLost)?void 0:e.call(n))return void l.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var u=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(u*o)),f=Math.max(1,Math.round(d*o)),v=yield createImageBitmap(t,1>o?{resizeWidth:c,resizeHeight:f,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:f});h.postMessage({id:i,bitmap:v,width:c,height:f,displayWidth:u,displayHeight:d,dataURLOptions:s.dataURLOptions},[v])}catch(t){l.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),c=requestAnimationFrame(p)};c=requestAnimationFrame(p),this.resetObservers=()=>{u(),cancelAnimationFrame(c)}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=ge(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=I(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return Ct(this.canvas,r,i,!0)||setTimeout((()=>{var r=fe(u,e,this,n);t(this.canvas,{type:d["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(r){var u=wt(e.CanvasRenderingContext2D.prototype,a,{set(e){t(this.canvas,{type:d["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...ye(e.WebGLRenderingContext.prototype,d.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...ye(e.WebGL2RenderingContext.prototype,d.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,n))),{type:s}=r[0];this.mutationCb({id:e,type:s,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class Me{constructor(t){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new Et),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;r.styleMirror.has(t)?e=r.styleMirror.getId(t):(e=r.styleMirror.add(t),n.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:x(e,t.href),index:r})))})),i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,st.forEach((t=>t.abort())),st.clear()}trackStylesheetInLinkElement(t){}}class Te{constructor(){a(this,"nodeMap",new WeakMap),a(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).some((t=>t!==e))}add(t,e){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}}var Re=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var xe=document.createElement("iframe");document.body.appendChild(xe),Array.from=(null==(i=xe.contentWindow)?void 0:i.Array.from)||Array.from,document.body.removeChild(xe)}}catch(t){console.debug("Unable to override Array.from",t)}var Oe=new O;function Le(t){void 0===t&&(t={});var{emit:e,checkoutEveryNms:i,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:h=null,maskTextClass:d="rr-mask",maskTextSelector:c=null,inlineStylesheet:f=!0,maskAllInputs:v,maskInputOptions:p,slimDOMOptions:m,maskInputFn:g,maskTextFn:y,hooks:w,packFn:b,sampling:k={},dataURLOptions:S={},canvasResolutionScale:I,mousemoveWait:C,recordDOM:M=!0,recordCanvas:T=!1,recordCrossOriginIframes:R=!1,recordAfter:x=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:L=!1,collectFonts:E=!1,inlineImages:A=!1,plugins:F,keepIframeSrcFn:N=(()=>!1),ignoreCSSAttributes:D=new Set([]),errorHandler:B}=t;Bt=B;var W=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),z=!R||window.parent===window,P=!1;if(!z)try{window.parent.document&&(P=!1)}catch(t){P=!0}if(z&&!e)throw new Error("emit function is required");if(!z&&!P)return()=>{};void 0!==C&&void 0===k.mousemove&&(k.mousemove=C),Oe.reset();var U,j=!0===v?{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}:void 0!==p?p:{password:!0},q=ct(void 0!==m&&m);!function(t){void 0===t&&(t=window),"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();var H,G,V=0,Z=new Map,J=t=>{for(var e of F||[])e.eventProcessor&&(t=e.eventProcessor(t));return b&&!P&&(t=b(t)),t};we=(t,r)=>{var s,a=t;if(a.timestamp=bt(),!(null==(s=Ht[0])?void 0:s.isFrozen())||a.type===o.FullSnapshot||a.type===o.IncrementalSnapshot&&a.data.source===u.Mutation||Ht.forEach((t=>t.unfreeze())),z)null==e||e(J(a),r);else if(P){var l={type:"rrweb",event:J(a),origin:window.location.origin,isCheckout:r};window.parent.postMessage(l,"*")}if(a.type===o.FullSnapshot)U=a,V=0;else if(a.type===o.IncrementalSnapshot){if(a.data.source===u.Mutation&&a.data.isAttachIframe)return;V++,(n&&V>=n||i&&a.timestamp-U.timestamp>i)&&be(!0)}};var Q=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,i=new Set;if(t.adds.length>0)for(var n of t.adds){var s=Oe.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}t.removes.forEach((t=>{var{id:r}=t;if(!e||!e.has(r)){var n=tt.getIframeElementById(r);n&&i.has(n)?tt.forgetIframeId(r):(null==H||H(r),tt.removeIframeById(r))}})),null==G||G(),tt.cleanupDetachedIframes()}we({type:o.IncrementalSnapshot,data:r({source:u.Mutation},t)})},X=t=>we({type:o.IncrementalSnapshot,data:r({source:u.Scroll},t)}),Y=t=>we({type:o.IncrementalSnapshot,data:r({source:u.CanvasMutation},t)}),K=new Me({mutationCb:Q,adoptedStyleSheetCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},t)})}),tt=new se({mirror:Oe,mutationCb:Q,stylesheetManager:K,recordCrossOriginIframes:R,wrappedEmit:we});for(var et of F||[])et.getMirror&&et.getMirror({nodeMirror:Oe,crossOriginIframeMirror:tt.crossOriginIframeMirror,crossOriginIframeStyleMirror:tt.crossOriginIframeStyleMirror});var rt=new Te;ke=new Ce({recordCanvas:T,mutationCb:Y,win:window,blockClass:s,blockSelector:a,mirror:Oe,sampling:k.canvas,dataURLOptions:W,resolutionScale:I});var it=new ae({mutationCb:Q,scrollCb:X,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:c,inlineStylesheet:f,maskInputOptions:j,dataURLOptions:W,maskTextFn:y,maskInputFn:g,recordCanvas:T,inlineImages:A,sampling:k,slimDOMOptions:q,iframeManager:tt,stylesheetManager:K,canvasManager:ke,keepIframeSrcFn:N,processedNodeManager:rt},mirror:Oe});be=function(t){if(void 0===t&&(t=!1),M){we({type:o.Meta,data:{href:window.location.href,width:It(),height:St()}},t),K.reset(),it.init(),Ht.forEach((t=>t.lock()));var e=function(t,e){var{mirror:r=new O,blockClass:i="rr-block",blockSelector:n=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:o=!0,inlineImages:u=!1,recordCanvas:l=!1,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:c,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:p,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:y,onIframeListenerRegistered:w,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:S=(()=>!1),maxDepth:I}=e||{};return dt(t,{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===h?{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}:!1===h?{password:!0}:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:ct(f),dataURLOptions:v,inlineImages:u,recordCanvas:l,preserveWhiteSpace:p,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:y,onIframeListenerRegistered:w,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:S,newlyAddedElement:!1,maxDepth:I})}(document,{mirror:Oe,blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:c,inlineStylesheet:f,maskAllInputs:j,maskTextFn:y,maskInputFn:g,slimDOM:q,dataURLOptions:W,recordCanvas:T,inlineImages:A,onSerialize(t){xt(t,Oe)&&tt.addIframe(t),Ot(t,Oe)&&K.trackLinkElement(t),Lt(t)&&it.addShadowRoot(_.shadowRoot(t),document)},onIframeLoad(t,e){tt.attachIframe(t,e),it.observeAttachShadow(t)},onIframeListenerRegistered(t,e){tt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){K.attachLinkElement(t,e)},keepIframeSrcFn:N});if(!e)return console.warn("Failed to snapshot the document");we({type:o.FullSnapshot,data:{node:e,initialOffset:kt(window)}},t),Ht.forEach((t=>t.unlock())),R&&tt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&K.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))}};try{var nt=[];H=t=>{var e=Z.get(t);e&&(e.forEach((t=>{pt(t);var e=nt.indexOf(t);-1!==e&&nt.splice(e,1)})),Z.delete(t))},G=()=>{for(var[t]of Z){var e=Oe.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==H||H(t)}catch(e){null==H||H(t)}else null==H||H(t)}};var st=t=>{var e;return qt(ee)({mutationCb:Q,mousemoveCb:(t,e)=>we({type:o.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.MouseInteraction},t)}),scrollCb:X,viewportResizeCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.ViewportResize},t)}),inputCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.Input},t)}),mediaInteractionCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.MediaInteraction},t)}),styleSheetRuleCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.StyleSheetRule},t)}),styleDeclarationCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.StyleDeclaration},t)}),canvasMutationCb:Y,fontCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.Font},t)}),selectionCb(t){we({type:o.IncrementalSnapshot,data:r({source:u.Selection},t)})},customElementCb(t){we({type:o.IncrementalSnapshot,data:r({source:u.CustomElement},t)})},blockClass:s,ignoreClass:l,ignoreSelector:h,maskTextClass:d,maskTextSelector:c,maskInputOptions:j,inlineStylesheet:f,sampling:k,recordDOM:M,recordCanvas:T,inlineImages:A,userTriggeredOnInput:L,collectFonts:E,doc:t,maskInputFn:g,maskTextFn:y,keepIframeSrcFn:N,blockSelector:a,slimDOMOptions:q,dataURLOptions:W,mirror:Oe,iframeManager:tt,stylesheetManager:K,shadowDomManager:it,processedNodeManager:rt,canvasManager:ke,ignoreCSSAttributes:D,plugins:(null==(e=null==F?void 0:F.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>we({type:o.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},w)};tt.addLoadListener((t=>{try{var e=Oe.getId(t),r=st(t.contentDocument);if(nt.push(r),-1!==e){var i=Z.get(e);i||Z.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),tt.addPageHideListener((t=>{var e=Oe.getId(t);null==H||H(e),Jt(t)}));var at=-1,ot=t=>we({type:o.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),ut=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?Oe.getId(s):-1;a!==at&&(-1!==at&&ot({id:at,enter:!1}),at=a,-1!==a&&ot({id:a,enter:!0}))},lt=()=>{be(),nt.push(st(document)),nt.push(vt("fullscreenchange",ut)),nt.push(vt("webkitfullscreenchange",ut)),nt.push(vt("mozfullscreenchange",ut)),nt.push(vt("MSFullscreenChange",ut)),Re=!0};return["interactive","complete"].includes(document.readyState)?lt():(nt.push(vt("DOMContentLoaded",(()=>{we({type:o.DomContentLoaded,data:{}}),"DOMContentLoaded"===x&&lt()}))),nt.push(vt("load",(()=>{we({type:o.Load,data:{}}),"load"===x&&lt()}),window))),()=>{nt.forEach((t=>pt(t))),rt.destroy(),tt.removeLoadListener(),tt.destroy(),Z.clear(),Oe.reset(),Re=!1,Bt=void 0}}catch(t){console.warn(t)}}Le.addCustomEvent=(t,e)=>{if(!Re)throw new Error("please add custom event after start recording");we({type:o.Custom,data:{tag:t,payload:e}})},Le.freezePage=()=>{Ht.forEach((t=>t.freeze()))},Le.takeFullSnapshot=t=>{if(!Re)throw new Error("please take full snapshot after start recording");be(t)},Le.mirror=Oe;var Ee=Object.defineProperty,Ae=(t,e,r)=>((t,e,r)=>e in t?Ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Fe{constructor(t){Ae(this,"fileName"),Ae(this,"functionName"),Ae(this,"lineNumber"),Ae(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Ne=/(^|@)\S+:\d+/,De=/^\s*at .*(\S+:\d+|\(native\))/m,Be=/^(eval@)?(\[native code])?$/,We={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(De)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error("Cannot parse given url: "+t);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter((function(t){return!!t.match(De)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new Fe({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(Be)}),this).map((function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Fe({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Fe({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Fe({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Fe({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Ne)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Fe({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function ze(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function Pe(t){return Array.isArray(t)}function Ue(t){return"object"==typeof t&&null!==t&&!Pe(t)}function $e(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(Ue(t[i])&&$e(t[i],e-1))return!0;return!1}function je(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Ue(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||Ue(a)&&$e(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=Pe(l)?ze(l.length?l[0]:null):l}return o}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e}))}var qe={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function He(t,e,r){var i,n=r?Object.assign({},qe,r):qe,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=We.parse(e.error).map((t=>t.toString())),s=[je(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[je("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[je("Uncaught (in promise)",n.stringifyOptions),je(e.reason,n.stringifyOptions)]);var s=We.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=We.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>je(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[je("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})(l);return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:l}})),e[s]=h,()=>{e[s]=l}}catch(t){return()=>{}}}(e,r):()=>{}}}var Ge="undefined"!=typeof window?window:void 0,Ve="undefined"!=typeof globalThis?globalThis:Ge;"undefined"==typeof self&&(Ve.self=Ve),"undefined"==typeof File&&(Ve.File=function(){});var Ze=null==Ve?void 0:Ve.document;null!=Ve&&Ve.XMLHttpRequest&&new Ve.XMLHttpRequest;var Je,Qe=null!=Ge?Ge:{},Xe="NativeGzipValidationError",Ye=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Xe,e},Ke=function(){var t=e((function*(t,e){18>t.size&&Ye("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&Ye("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Je)return Je;Je=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;Je[t]=e>>>0}return Je})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&Ye("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&Ye("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function tr(){return tr=e((function*(t,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(t),s=new CompressionStream("gzip"),a=s.writable.getWriter(),o=a.write(n).then((()=>a.close())).catch(function(){var t=e((function*(t){try{yield a.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(s.readable).blob(),[l]=yield Promise.all([u,o]);return yield Ke(l,n),l}catch(t){if(null!=i&&i.rethrow)throw t;return r&&console.error("Failed to gzip compress data",t),null}})),tr.apply(this,arguments)}var er=Object.prototype,rr=er.hasOwnProperty,ir=er.toString,nr=Array.isArray||function(t){return"[object Array]"===ir.call(t)},sr=t=>"function"==typeof t,ar=t=>t===Object(t)&&!nr(t),or=t=>void 0===t,ur=t=>"[object String]"==ir.call(t),lr=t=>null===t,hr=t=>or(t)||lr(t),dr=t=>"[object Number]"==ir.call(t)&&t==t,cr=t=>"[object Boolean]"===ir.call(t),fr=t=>t instanceof FormData;function vr(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),dr(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),vr(n||r,e,r,i))}class pr{constructor(t){this.$t={},this.Gt=t.Gt,this.Zt=vr(t.bucketSize,0,100,t.Qt),this.Jt=vr(t.refillRate,0,this.Zt,t.Qt),this.Kt=vr(t.refillInterval,0,864e5,t.Qt)}Yt(t,e){var r=Math.floor((e-t.lastAccess)/this.Kt);r>0&&(t.tokens=Math.min(t.tokens+r*this.Jt,this.Zt),t.lastAccess=t.lastAccess+r*this.Kt)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.$t[i];return n?this.Yt(n,r):this.$t[i]=n={tokens:this.Zt,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.Gt)||e.call(this,t)),0===n.tokens)}stop(){this.$t={}}}var mr=t=>t instanceof Document,gr={DEBUG:!1,LIB_VERSION:"1.391.6",LIB_NAME:"web"},yr=function(t,e){var{debugEnabled:r}=void 0===e?{}:e,i={k(e){if(Ge&&(Qe.POSTHOG_DEBUG||r)&&!or(Ge.console)&&Ge.console){for(var i=("__rrweb_original__"in Ge.console[e]?Ge.console[e].__rrweb_original__:Ge.console[e]),n=arguments.length,s=new Array(n>1?n-1:0),a=1;n>a;a++)s[a-1]=arguments[a];i(t,...s)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("error",...e)},critical(){for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning(t){i.error("You must initialize PostHog before calling "+t)},createLogger:(e,r)=>yr(t+" "+e,r)};return i},wr=yr("[PostHog.js]"),br=wr.createLogger;function kr(t,e){if(!hr(t))if(nr(t))t.forEach(e);else if(fr(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)rr.call(t,r)&&e(t[r],r)}function Sr(t,e,r,i){var{capture:n=!1,passive:s=!0}={};null==t||t.addEventListener(e,r,{capture:n,passive:s})}var Ir=["localhost","127.0.0.1"],_r=t=>{var e=null==Ze?void 0:Ze.createElement("a");return or(e)?null:(e.href=t,e)},Cr=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return kr(t,(function(t,e){or(t)||or(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)};function Mr(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n=r(i);return sr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=n,()=>{t[e]===n&&(t[e]=i)}}catch(t){return()=>{}}}function Tr(t,e){var r,i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var Rr="$session_recording_remote_config",xr="$replay_sample_rate",Or="$replay_override_sampling",Lr="$replay_override_linked_flag",Er="$replay_override_url_trigger",Ar="$replay_override_event_trigger",Fr="$session_is_sampled",Nr="$session_past_minimum_duration",Dr="$session_recording_url_trigger_activated_session",Br="$session_recording_event_trigger_activated_session",Wr="$posthog_sr_group_event_trigger_",zr="$posthog_sr_group_url_trigger_",Pr="$posthog_sr_group_sampling_",Ur="$debug_first_full_snapshot_timestamp",$r="$sess_rec_flush_size",jr="$stored_person_properties",qr="$sdk_debug_replay_remote_trigger_matching_config",Hr=new RegExp("(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})"),Gr=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),Vr="[SessionRecording]",Zr="redacted",Jr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"]},Qr=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Xr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Yr=["/s/","/e/","/i/"];function Kr(t,e,r,i){if(hr(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ur(n)&&(n=parseInt(n)),n>r?Vr+" "+i+" body too large to record ("+n+" bytes)":t}function ti(t,e){if(hr(t))return t;var r=t;return function(t,e){if(hr(t))return!1;if(ur(t)){if(t=t.trim(),Hr.test((t||"").replace(/[- ]/g,"")))return!1;if(Gr.test(t))return!1}return!0}(r)||(r=Vr+" "+e+" body "+Zr),kr(Xr,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Vr+" "+e+" body "+Zr+" as might contain: "+t)})),r}var ei=br("[Recorder]"),ri=t=>"navigation"===t.entryType,ii=t=>"resource"===t.entryType;function ni(t,e){return!!e&&(cr(e)||e[t])}function si(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var ai=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function oi(t){var{type:e,recordBody:r,headers:i,url:n}=t;function s(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!si(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(ai))return!1;if(cr(r))return!0;if(nr(r))return s(r);var a=r[e];return cr(a)?a:s(a)}function ui(t,e,r,i,n,s){return li.apply(this,arguments)}function li(){return li=e((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return ei.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(ii(a=t[s])&&a.initiatorType===e&&(or(i)||a.startTime>=i)&&(or(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),ui(t,e,r,i,n,s+1))})),li.apply(this,arguments)}function hi(t){var{body:e,options:r,url:i}=t;if(hr(e))return null;var{hostname:n,isHostDenied:s}=Tr(i,r);if(s)return n+" is in deny list";if(ur(e))return e;if(mr(e))return e.textContent;if(fr(e))return Cr(e);if(ar(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var di=t=>!lr(t)&&("navigation"===t.entryType||"resource"===t.entryType);function ci(t){var{entry:e,method:i,status:n,networkRequest:s,isInitial:a,start:o,end:u,url:l,initiatorType:h}=t;o=e?e.startTime:o,u=e?e.responseEnd:u;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(o||0)),f=[r({},e?e.toJSON():{name:l},{startTime:or(o)?void 0:Math.round(o),endTime:or(u)?void 0:Math.round(u),timeOrigin:d,timestamp:c,method:i,initiatorType:h||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:a})];if(di(e))for(var v of e.serverTiming||[])f.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:v.name,duration:v.duration,entryType:"serverTiming"});return f}var fi=["video/","audio/"];function vi(t){return new Promise((e=>{var r=setTimeout((()=>e("[SessionReplay] Timeout while trying to read body")),500);try{t.clone().text().then((t=>e(t)),(t=>e("[SessionReplay] Failed to read body: "+t))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e("[SessionReplay] Failed to read body")}}))}function pi(){return(pi=e((function*(t){var{r:e,options:r,url:i}=t,{hostname:n,isHostDenied:s}=Tr(i,r);return s?Promise.resolve(n+" is in deny list"):vi(e)}))).apply(this,arguments)}function mi(){return(mi=e((function*(t){var{r:e,options:r,url:i}=t,n=function(t){var e,{r:r,options:i,url:n}=t;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=fi.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var{hostname:o,isHostDenied:u}=Tr(n,i);return u?o+" is in deny list":null}({r:e,options:r,url:i});return lr(n)?vi(e):Promise.resolve(n)}))).apply(this,arguments)}var gi=null;function yi(t,i,n){if(!("performance"in i))return()=>{};if(gi)return ei.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},Jr,n):Jr,a=e=>{var i=[];e.requests.forEach((t=>{var e=s.maskRequestFn(t);e&&i.push(e)})),i.length>0&&t(r({},e,{requests:i}))},o=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>ri(t)||ii(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>ci({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>ri(t)||ii(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>ci({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(a,i,s),u=()=>{},l=()=>{};return(s.recordHeaders||s.recordBody)&&(u=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=ni("request",r.recordHeaders),n=ni("response",r.recordHeaders),s=Mr(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d,c,f=this,v=new Request(o),p={},m={},g=f.setRequestHeader.bind(f);f.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=f.send.bind(f);f.send=t=>(oi({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=hi({body:t,options:r,url:o})),d=e.performance.now(),y(t));var w=()=>{f.removeEventListener("readystatechange",b),f.removeEventListener("error",w),f.removeEventListener("abort",w),f.removeEventListener("timeout",w)},b=()=>{if(f.readyState===f.DONE){w(),c=e.performance.now();var i={};f.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),oi({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=hi({body:f.response,options:r,url:o})),ui(e,"xmlhttprequest",v.url,d,c).then((e=>{var r=ci({entry:e,method:a,status:null==f?void 0:f.status,networkRequest:p,start:d,end:c,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};f.addEventListener("readystatechange",b),f.addEventListener("error",w),f.addEventListener("abort",w),f.addEventListener("timeout",w),s.call(f,a,o.toString(),u,l,h)}));return()=>{s()}}(a,i,s),l=function(t,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=ni("request",i.recordHeaders),s=ni("response",i.recordHeaders),a=Mr(r,"fetch",(a=>function(){var o=e((function*(e,o){var u,l,h,d,c=new Request(e,o),f={};try{var v={};c.headers.forEach(((t,e)=>{v[e]=t})),n&&(f.requestHeaders=v),!(ar(d=null==o?void 0:o.body)&&sr(d.getReader)&&sr(d.tee))&&oi({type:"request",headers:v,url:e,recordBody:i.recordBody})&&(f.requestBody=yield function(t){return pi.apply(this,arguments)}({r:c,options:i,url:e})),l=r.performance.now(),u=si(e)?yield a(c):yield a(e,o),h=r.performance.now();var p={};return u.headers.forEach(((t,e)=>{p[e]=t})),s&&(f.responseHeaders=p),oi({type:"response",headers:p,url:e,recordBody:i.recordBody})&&(f.responseBody=yield function(t){return mi.apply(this,arguments)}({r:u,options:i,url:e})),u}finally{ui(r,"fetch",c.url,l,h).then((e=>{var r,i=ci({entry:e,method:c.method,status:null==(r=u)?void 0:r.status,networkRequest:f,start:l,end:h,url:c.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return o.apply(this,arguments)}}()));return()=>{a()}}(a,i,s)),gi=()=>{o(),u(),l(),gi=null}}var wi={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},bi={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},ki="disabled",Si="sampled",Ii="active",_i="buffering",Ci="paused",Mi="rrweb_error",Ti="trigger",Ri=Ti+"_activated",xi=Ti+"_pending",Oi=Ti+"_"+ki;function Li(t,e,r,i,n,s){return 0===e?Oi:(null==t?void 0:t.get_property(r?i+r:n))===s?Ri:xi}function Ei(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}class Ai{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(Ri)?Ri:e.includes(xi)?xi:Oi}stop(){this.u.forEach((t=>t.stop()))}}class Fi{constructor(t){this.u=t}triggerStatus(t){var e=new Set;for(var r of this.u)e.add(r.triggerStatus(t));switch(e.delete(Oi),e.size){case 0:return Oi;case 1:return Array.from(e)[0];default:return xi}}stop(){this.u.forEach((t=>t.stop()))}}class Ni{triggerStatus(){return Ri}stop(){}}var Di=t=>"sessionRecording"in t;class Bi{constructor(t,e){this.Zu=[],this.Ju=[],this.Qu=new Map,this.Ku=new Map,this.th="",this.urlBlocked=!1,this._instance=t,this.eh=e}onConfig(t){var e,r;this.Zu=(Di(t)?ar(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Ju=(Di(t)?ar(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.rh()}rh(){for(var t of(this.Qu.clear(),this.Ku.clear(),this.Zu))if("regex"===t.matching&&!this.Qu.has(t.url))try{this.Qu.set(t.url,new RegExp(t.url))}catch(e){wr.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.Ju)if("regex"===e.matching&&!this.Ku.has(e.url))try{this.Ku.set(e.url,new RegExp(e.url))}catch(t){wr.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}ih(t){return Li(this._instance,this.Zu.length,this.eh,zr,Dr,t)}triggerStatus(t){var e=this.ih(t),r=e===Ri?Ri:e===xi?xi:Oi;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){if(void 0!==Ge&&Ge.location.href){var r=Ge.location.href;if(r!==this.th){this.th=r;var i=this.urlBlocked,n=Ei(r,this.Ju,this.Ku);i&&n||(n&&!i?t():!n&&i&&e())}}}checkUrlTriggerConditions(t,e,r,i){if(void 0!==Ge&&Ge.location.href){var n=Ge.location.href;if(n!==this.th){this.th=n;var s=this.urlBlocked,a=Ei(n,this.Ju,this.Ku);a&&!s?t():!a&&s&&e();var o=this.ih(i)===Ri,u=Ei(n,this.Zu,this.Qu);!o&&u&&r("url",n)}}}stop(){this.th=""}}class Wi{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.nh=()=>{},this._instance=t}triggerStatus(){var t=xi;return hr(this.linkedFlag)&&(t=Oi),this.linkedFlagSeen&&(t=Ri),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(Di(t)?ar(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!hr(this.linkedFlag)&&!this.linkedFlagSeen){var i=ur(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ur(this.linkedFlag)?null:this.linkedFlag.variant;this.nh=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(ar(r)&&i in r){var a=r[i];s=cr(a)?!0===a:n?a===n:!!a}this.linkedFlagSeen=s,s&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.nh()}}class zi{constructor(t,e){this.sh=[],this._instance=t,this.eh=e}onConfig(t){var e;this.sh=(Di(t)?ar(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}ah(t){return Li(this._instance,this.sh.length,this.eh,Wr,Br,t)}triggerStatus(t){var e=this.ah(t),r=e===Ri?Ri:e===xi?xi:Oi;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.sh.length){var i=this.ah(r)===Ri,n=this.sh.includes(t);!i&&n&&e("event",t)}}stop(){}}class Pi{constructor(t,e,r){if(this._instance=t,this.group=e,this.oh=new Bi(t,e.id),this.uh=new zi(t,e.id),this.lh=new Wi(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.oh.onConfig(n),this.uh.onConfig(n),this.lh.onConfig(n,r);var s=[this.uh,this.oh,this.lh];this.hh="any"===e.conditions.matchType?new Ai(s):new Fi(s)}else this.hh=new Ni}triggerStatus(t){return this.hh.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.uh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.oh.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?zr+this.group.id:Wr+this.group.id]:e})}stop(){this.oh.stop(),this.uh.stop(),this.lh.stop()}}function Ui(t){if(t.rrwebError)return Mi;if(!t.receivedFlags)return _i;if(!t.isRecordingEnabled)return ki;if(t.urlTriggerMatching.urlBlocked)return Ci;var e=!0===t.isSampled,r=new Ai([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Si:r===Ri?Ii:r===xi?_i:!1===t.isSampled?ki:Ii}function $i(t){if(t.rrwebError)return Mi;if(!t.receivedFlags)return _i;if(!t.isRecordingEnabled)return ki;if(t.urlTriggerMatching.urlBlocked)return Ci;var e=new Fi([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Oi,i=cr(t.isSampled);return r&&e===xi?_i:r&&e===Oi||i&&!t.isSampled?ki:!0===t.isSampled?Si:Ii}function ji(t){var e,r;return(null==(e=JSON.stringify(t,(r=[],function(t,e){if(ar(e)){for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(e)?"[Circular]":(r.push(e),e)}return e})))?void 0:e.length)||0}function qi(t){if(lr(t))return 4;if(or(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":if(nr(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=or(i)||lr(i)?4:qi(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];or(u)||(a||(s+=1),a=!1,s+=o.length+3+qi(u))}return s;default:return 0}}function Hi(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[Hi({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Hi({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Gi=Uint8Array,Vi=Uint16Array,Zi=Uint32Array,Ji=new Gi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Qi=new Gi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Xi=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yi=function(t,e){for(var r=new Vi(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Zi(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Ki=Yi(Ji,2),tn=Ki[1];Ki[0][28]=258,tn[258]=28;for(var en=Yi(Qi,0)[1],rn=new Vi(32768),nn=0;32768>nn;++nn){var sn=(43690&nn)>>>1|(21845&nn)<<1;rn[nn]=((65280&(sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4))>>>8|(255&sn)<<8)>>>1}var an=function(t,e,r){for(var i=t.length,n=0,s=new Vi(e);i>n;++n)++s[t[n]-1];var a,o=new Vi(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new Vi(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)a[rn[d]>>>u]=l}else for(a=new Vi(i),n=0;i>n;++n)a[n]=rn[o[t[n]-1]++]>>>15-t[n];return a},on=new Gi(288);for(nn=0;144>nn;++nn)on[nn]=8;for(nn=144;256>nn;++nn)on[nn]=9;for(nn=256;280>nn;++nn)on[nn]=7;for(nn=280;288>nn;++nn)on[nn]=8;var un=new Gi(32);for(nn=0;32>nn;++nn)un[nn]=5;var ln=an(on,9,0),hn=an(un,5,0),dn=function(t){return(t/8>>0)+(7&t&&1)},cn=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof Vi?Vi:t instanceof Zi?Zi:Gi)(r-e);return i.set(t.subarray(e,r)),i},fn=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},vn=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},pn=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Gi(0),0];if(1==n){var a=new Gi(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var f=new Vi(c+1),v=mn(r[h-1],f,0);if(v>e){i=0;var p=0,m=v-e,g=1<<m;for(s.sort((function(t,e){return f[e.s]-f[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=f[y])break;p+=g-(1<<v-f[y]),f[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>f[w]?p-=1<<e-f[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;f[b]==e&&(--f[b],++p)}v=e}return[new Gi(f),v]},mn=function(t,e,r){return-1==t.s?Math.max(mn(t.l,e,r+1),mn(t.r,e,r+1)):e[t.s]=r},gn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Vi(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},yn=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},wn=function(t,e,r){var i=r.length,n=dn(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},bn=function(t,e,r,i,n,s,a,o,u,l,h){fn(e,h++,r),++n[256];for(var d=pn(n,15),c=d[0],f=d[1],v=pn(s,15),p=v[0],m=v[1],g=gn(c),y=g[0],w=g[1],b=gn(p),k=b[0],S=b[1],I=new Vi(19),_=0;y.length>_;++_)I[31&y[_]]++;for(_=0;k.length>_;++_)I[31&k[_]]++;for(var C=pn(I,7),M=C[0],T=C[1],R=19;R>4&&!M[Xi[R-1]];--R);var x,O,L,E,A=l+5<<3,F=yn(n,on)+yn(s,un)+a,N=yn(n,c)+yn(s,p)+a+14+3*R+yn(I,M)+(2*I[16]+3*I[17]+7*I[18]);if(F>=A&&N>=A)return wn(e,h,t.subarray(u,u+l));if(fn(e,h,1+(F>N)),h+=2,F>N){x=an(c,f,0),O=c,L=an(p,m,0),E=p;var D=an(M,T,0);for(fn(e,h,w-257),fn(e,h+5,S-1),fn(e,h+10,R-4),h+=14,_=0;R>_;++_)fn(e,h+3*_,M[Xi[_]]);h+=3*R;for(var B=[y,k],W=0;2>W;++W){var z=B[W];for(_=0;z.length>_;++_)fn(e,h,D[P=31&z[_]]),h+=M[P],P>15&&(fn(e,h,z[_]>>>5&127),h+=z[_]>>>12)}}else x=ln,O=on,L=hn,E=un;for(_=0;o>_;++_)if(i[_]>255){var P;vn(e,h,x[257+(P=i[_]>>>18&31)]),h+=O[P+257],P>7&&(fn(e,h,i[_]>>>23&31),h+=Ji[P]);var U=31&i[_];vn(e,h,L[U]),h+=E[U],U>3&&(vn(e,h,i[_]>>>5&8191),h+=Qi[U])}else vn(e,h,x[i[_]]),h+=O[i[_]];return vn(e,h,x[256]),h+O[256]},kn=new Zi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Sn=function(){for(var t=new Zi(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),In=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=Sn[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},_n=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new Gi(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=wn(u,l,t.subarray(h,d)):(u[h]=true,l=wn(u,l,t.subarray(h,a)))}else{for(var c=kn[e-1],f=c>>>13,v=8191&c,p=(1<<r)-1,m=new Vi(32768),g=new Vi(p+1),y=Math.ceil(r/3),w=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<w)&p},k=new Zi(25e3),S=new Vi(288),I=new Vi(32),_=0,C=0,M=(h=0,0),T=0,R=0;a>h;++h){var x=b(h),O=32767&h,L=g[x];if(m[O]=L,g[x]=O,h>=T){var E=a-h;if((_>7e3||M>24576)&&E>423){l=bn(t,u,0,k,S,I,C,M,R,h-R,l),M=_=C=0,R=h;for(var A=0;286>A;++A)S[A]=0;for(A=0;30>A;++A)I[A]=0}var F=2,N=0,D=v,B=O-L&32767;if(E>2&&x==b(h-B))for(var W=Math.min(f,E)-1,z=Math.min(32767,h),P=Math.min(258,E);z>=B&&--D&&O!=L;){if(t[h+F]==t[h+F-B]){for(var U=0;P>U&&t[h+U]==t[h+U-B];++U);if(U>F){if(F=U,N=B,U>W)break;var j=Math.min(B,U-2),q=0;for(A=0;j>A;++A){var H=h-B+A+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,L=H)}}}B+=(O=L)-(L=m[O])+32768&32767}if(N){k[M++]=268435456|tn[F]<<18|en[N];var V=31&tn[F],Z=31&en[N];C+=Ji[V]+Qi[Z],++S[257+V],++I[Z],T=h+F,++_}else k[M++]=t[h],++S[t[h]]}}l=bn(t,u,true,k,S,I,C,M,R,h-R,l)}return cn(o,0,i+dn(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Cn=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Mn=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Cn(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},Tn=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Rn(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class xn{constructor(t,e){var r,i;void 0===e&&(e={}),this.dh={},this.fh=t=>{if(!this.dh[t]){var e,r;this.dh[t]=!0;var i=this.ph(t);null==(e=(r=this.mh).onBlockedNode)||e.call(r,t,i)}},this.gh=t=>{var e=this.ph(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.ph=t=>this._rrweb.mirror.getNode(t),this.yh=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this.yh(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var[e]=this.gh(t.id);return!this.ba.consumeRateLimit(e)&&t})));var i=this.yh(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.mh=e,this.ba=new pr({bucketSize:null!==(r=this.mh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.mh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,Gt:this.fh,Qt:wr})}reset(){this.dh={}}stop(){this.ba.stop(),this.reset()}}class On{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.wh=t.get_property.bind(t),this.bh=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.bh($r,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.wh($r);return ar(e=r)&&ur(e.sessionId)&&dr(e.size)&&r.sessionId===t?r.size:0}}function Ln(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100<vr(100*e,0,100,wr)}var En=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},An={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>En(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!En(e,t))))),icontains:(t,e)=>e.map(Fn).some((e=>t.map(Fn).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Fn).every((e=>t.map(Fn).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r<parseFloat(t)))}))},Fn=t=>t.toLowerCase(),Nn=new Set(["is_not","not_icontains","not_regex"]);function Dn(t,e,r){return!t||0===t.length||t.every((t=>{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(or(n)||lr(n))return Nn.has(s);var a=An[s];return!!a&&!or(t.value)&&!lr(t.value)&&a(nr(t.value)?t.value.map(String):[String(t.value)],nr(n)?n.map(String):[String(n)])}))}var Bn=br("[SessionRecording]");function Wn(t,e){return e?t:"!"+t}function zn(t,e){return t===e||t!=="!"+e&&null}class Pn{constructor(t,e,r,i,n,s){this.kh=null,this.Sh=$i,this._instance=t,this.oh=e,this.uh=r,this.lh=i,this.Ih=n,this._h=s}onRemoteConfig(t){this.kh=dr(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ch=new Ai([this.uh,this.oh]),this.Sh=Ui):(this.Ch=new Fi([this.uh,this.oh]),this.Sh=$i),this._instance.register_for_session({[qr]:t.triggerMatchType}),this.oh.onConfig(t),this.uh.onConfig(t),this.lh.onConfig(t,((t,e)=>{this.Ih("linked_flag_matched",{flag:t,variant:e})}))}getStatus(t){return this.Sh({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return dr(r)?r:null}checkUrlTriggers(t,e,r,i){this.oh.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.uh.sh.length&&hr(this.Mh))return this.Mh=t((t=>{try{this.uh.checkEventTriggerConditions(t.event,r,e)}catch(t){Bn.error("Could not activate event trigger",t)}})),this.Mh}makeSamplingDecisions(t){var e,r,i,n=this.kh;if(!dr(n))return null==(r=this._instance.persistence)||r.unregister(Fr),void(null==(i=this._instance.persistence)||i.unregister(xr));var s=this._instance.get_property(Fr),a=this._instance.get_property(xr),o=zn(s,t),u=dr(a)&&a!==n,l=or(a)&&s===t,h=u||l||!cr(o),d=h?Ln(t,n):o;h&&(d?this.Ih("sampled"):Bn.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[Fr]:Wn(t,d),[xr]:lr(a)&&s===t?null:n})}ensureSamplingDecision(t){if(dr(this.kh)){var e=this._instance.get_property(Fr);cr(zn(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(Br),null==(e=this._instance.persistence)||e.unregister(Dr),null==(r=this._instance.persistence)||r.unregister(Fr),null==(i=this._instance.persistence)||i.unregister(xr),null==(n=this._instance.persistence)||n.unregister(Nr)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this.Ch)?void 0:e.triggerStatus(t))===xi}stop(){var t;null==(t=this.Mh)||t.call(this),this.Mh=void 0,this.uh.stop(),this.oh.stop(),this.lh.stop()}}class Un{constructor(t,e,r,i){this.Th=[],this.Rh=new Map,this.xh=!1,this._instance=t,this.oh=e,this.Ih=r,this.Oh=i}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Lh(t.triggerGroups),this._instance.register_for_session({[qr]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.oh.onConfig(t)):Bn.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Mi;if(t.urlTriggerMatching.urlBlocked)return Ci;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return ki;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Ri){var o=s.group.id,u=r.get(o);or(u)?wr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===xi&&(i=!0)}return n?Si:i?_i:ki}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Th,triggerGroupSamplingResults:this.Rh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Th)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;dr(i)&&(lr(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.oh.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Eh(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t))}),t)};for(var a of this.Th)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Mh=t((t=>{var r;if(this.xh)return Bn.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Mh)||r.call(this),void(this.Mh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Eh(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(jr);s.some((e=>!e.properties||0===e.properties.length||Dn(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e))}}),e)};for(var s of this.Th)n(s)}catch(t){Bn.error("Could not activate event trigger for trigger groups",t)}})),this.Mh}makeSamplingDecisions(t){for(var e of this.Th){var r,i=e.group,n=i.id,s=i.sampleRate,a=Pr+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(ar(o)){var c=o.sessionId,f=o.sampleRate,v=o.sampled;l="string"==typeof c&&c!==t,h=dr(f)&&f!==s,u=c===t&&dr(f)&&f===s&&cr(v)?v:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!cr(u),m=p?Ln(t+n,s):u;p&&this.Oh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Rh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.xh=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(Fr),null==(e=this._instance.persistence)||e.unregister(xr),null==(r=this._instance.persistence)||r.unregister(Nr),this.Th)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(Wr+o),null==(s=this._instance.persistence)||s.unregister(zr+o),null==(a=this._instance.persistence)||a.unregister(Pr+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Th){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Rh.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Th)if(e.triggerStatus(t)===xi)return!0;return!1}stop(){var t;null==(t=this.Mh)||t.call(this),this.Mh=void 0,this.Th.forEach((t=>t.stop())),this.Th=[],this.Rh.clear(),this.oh.stop()}Eh(t,e){var r=t.group.conditions.properties;return!r||0===r.length||Dn(r,e,this._instance.get_property(jr))}Lh(t){var e=this;this.Th.forEach((t=>t.stop())),this.Th=[],this.Rh.clear();var r=function(t){var r=new Pi(e._instance,t,((r,i)=>{e.Ih("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name})}));e.Th.push(r)};for(var i of t)r(i)}}function $n(t){return ar(t)?t.network_timing:t}var jn,qn,Hn="[SessionRecording]",Gn=br(Hn),Vn=[bi.MouseMove,bi.MouseInteraction,bi.Scroll,bi.ViewportResize,bi.Input,bi.TouchMove,bi.MediaInteraction,bi.Drag],Zn=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Jn(){var t;return null==Qe||null==(t=Qe.__PosthogExtensions__)?void 0:t.rrweb}function Qn(){var t;return null==(t=Jn())?void 0:t.record}function Xn(t){return Rn(function(t,e){void 0===e&&(e={});var r=In(),i=t.length;r.p(t);var n=_n(t,e,Tn(e),8),s=n.length;return Mn(n,e),Cn(n,s-8,r.d()),Cn(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gi(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new Gi(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return cn(i,0,n)}(JSON.stringify(t))))}function Yn(t){return Kn.apply(this,arguments)}function Kn(){return Kn=e((function*(t){var e=JSON.stringify(t),r=yield function(t,e,r){return tr.apply(this,arguments)}(e,gr.DEBUG,{rethrow:!0});return Rn(new Uint8Array(yield r.arrayBuffer()))})),Kn.apply(this,arguments)}var ts="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,es=!1;function rs(t){return nr(t)&&0===t.length?jn=null!=jn?jn:Xn([]):Xn(t)}function is(t){return ns.apply(this,arguments)}function ns(){return(ns=e((function*(t){return nr(t)&&0===t.length?jn||(qn=null!=qn?qn:Yn([]).then((t=>(jn=t,t))).catch((t=>{throw jn=void 0,qn=void 0,t}))):Yn(t)}))).apply(this,arguments)}function ss(t){return ts&&!es&&function(t){return t.type===wi.FullSnapshot||t.type===wi.IncrementalSnapshot&&(t.data.source===bi.Mutation||t.data.source===bi.StyleSheetRule)}(t)}function as(t){return{event:t,size:qi(t)}}function os(t,e){return r({},t,{data:e,cv:"2024-10"})}function us(t,e){return r({},t,{cv:"2024-10",data:r({},t.data,e)})}function ls(t){try{if(t.type===wi.FullSnapshot)return as(os(t,Xn(t.data)));if(t.type===wi.IncrementalSnapshot&&t.data.source===bi.Mutation)return as(us(t,{texts:rs(t.data.texts),attributes:rs(t.data.attributes),removes:rs(t.data.removes),adds:rs(t.data.adds)}));if(t.type===wi.IncrementalSnapshot&&t.data.source===bi.StyleSheetRule)return as(us(t,{adds:t.data.adds?Xn(t.data.adds):void 0,removes:t.data.removes?Xn(t.data.removes):void 0}))}catch(t){Gn.error("could not compress event - will use uncompressed event",t)}return{event:t,size:ji(t)}}function hs(){return(hs=e((function*(t){try{if(t.type===wi.FullSnapshot)return as(os(t,yield Yn(t.data)));if(t.type===wi.IncrementalSnapshot&&t.data.source===bi.Mutation){var[e,r,i,n]=yield Promise.all([is(t.data.texts),is(t.data.attributes),is(t.data.removes),is(t.data.adds)]);return as(us(t,{texts:e,attributes:r,removes:i,adds:n}))}if(t.type===wi.IncrementalSnapshot&&t.data.source===bi.StyleSheetRule){var[s,a]=yield Promise.all([t.data.adds?Yn(t.data.adds):void 0,t.data.removes?Yn(t.data.removes):void 0]);return as(us(t,{adds:s,removes:a}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===Xe})(e)&&(es=!0),Gn.error("could not compress event asynchronously - trying synchronous compression",e),ls(t)}return{event:t,size:ji(t)}}))).apply(this,arguments)}function ds(t,e){return t.type===wi.Custom&&t.data.tag===e}function cs(t){return ds(t,"sessionIdle")}function fs(t){return ds(t,"$session_ending")}function vs(t){return ds(t,"$session_starting")}class ps{get sessionId(){return this.un}get Ah(){if(!this._instance.sessionManager)throw new Error(Hn+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Fh(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Nh(){return zn(this._instance.get_property(Fr),this.sessionId)}get kh(){var t,e=null==(t=this.fl)?void 0:t.sampleRate;return dr(e)?e:null}get Dh(){var t,e;return null!==(t=null==(e=this.Bh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.Wh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.zh=void 0,this.Ph=Date.now(),this.Uh=!1,this.$h=[],this.jh="unknown",this.qh=!1,this.Hh=!1,this.Gh=!1,this.Vh=[],this.Zh=[],this.Jh=0,this.Qh=0,this.Xh=!1,this.Yh=void 0,this.Mh=void 0,this.Kh=void 0,this.td=void 0,this.ed=void 0,this.Zi=(t,e,r)=>{var i,n,s;if(r&&(t!==this.un||e!==this.ln)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.un,l=this.ln;o&&this.Oh("$session_ending",{currentSessionId:u,currentWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph,flushed_size:null==(a=this.rd)?void 0:a.currentTrackedSize(u)}),null==(i=this._instance.persistence)||i.unregister(Ur),this.Gh=!1,null==(n=Jn())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.Oh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.nd(),!0!==this.jh&&this.isStarted||(this.jh="unknown",this.stop(),this.start("session_id_changed")),o&&this.Oh("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph}),null==(s=this.Bh)||s.makeSamplingDecisions(t)}},this.sd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[Nr])===this.un},this.ad=()=>{var t,e;if(0===this.R.data.length)return null;var r=null==(t=this.R.data[0])?void 0:t.timestamp,i=null==(e=this.R.data[this.R.data.length-1])?void 0:e.timestamp;return dr(r)&&dr(i)?i-r:null},this.od=()=>{var t,e,r=this.Dh;if(!dr(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.ud;return dr(i)&&i>=0&&r>i}if(this.sd())return!1;var n,s=this.ad();return!!lr(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Nr]:this.un}),!1)},this.ld=()=>{this.status!==_i?(this.hd(),this.dd()):this.fd()},this.vd=()=>{this.Oh("browser offline",{})},this.pd=()=>{this.Oh("browser online",{})},this.Pt=()=>{null!=Ze&&Ze.visibilityState&&this.Oh("window "+Ze.visibilityState,{})},this._instance=t;var{sessionId:e,windowId:r}=this.Ah.checkAndGetSessionAndWindowId();this.un=e,this.ln=r,this.lh=new Wi(this._instance),this.oh=new Bi(this._instance),this.uh=new zi(this._instance),this.R=this.fd(),this.Ah.sessionTimeoutMs>this.Fh||Gn.warn("session_idle_threshold_ms ("+this.Fh+") is greater than the session timeout ("+this.Ah.sessionTimeoutMs+"). Session will never be detected as idle"),this.rd=new On(this._instance)}get md(){var t,e,r,i,n,s,a,o=null==(t=this.fl)?void 0:t.masking,u={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},l=null!==(n=null==u?void 0:u.maskAllInputs)&&void 0!==n?n:null==o?void 0:o.maskAllInputs,h=null!==(s=null==u?void 0:u.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,d=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return or(l)&&or(h)&&or(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}get gd(){var t;return vr(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,br("canvas recording resolution scale"),1)}get yd(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.fl)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:vr(h,0,12,br("canvas recording fps"),4),quality:vr(d,0,1,br("canvas recording quality"),.4)}}get wd(){var t,e=!(null==(t=this.fl)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get bd(){var t,e,r,i=null==(t=this.fl)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=$n(this._instance.config.capture_performance),u=$n(null==i?void 0:i.capturePerformance),l=!!(cr(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}kd(){var t,e,i=[],n=null==(t=Qe.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.wd&&i.push(n());var s,a,o,u,l,h,d,c,f,v,p,m=null==(e=Qe.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.bd&&sr(m)&&(!Ir.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(m((l={payloadSizeLimitBytes:Jr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Jr.performanceEntryTypeToObserve],payloadHostDenyList:[...(a=this.bd).payloadHostDenyList||[],...Jr.payloadHostDenyList]},h=!1!==(s=this._instance.config).session_recording.recordHeaders&&a.recordHeaders,d=!1!==s.session_recording.recordBody&&a.recordBody,c=!1!==s.capture_performance&&a.recordPerformance,u=Math.min(1e6,null!==(o=l.payloadSizeLimitBytes)&&void 0!==o?o:1e6),f=t=>(null!=t&&t.requestBody&&(t.requestBody=Kr(t.requestBody,t.requestHeaders,u,"Request")),null!=t&&t.responseBody&&(t.responseBody=Kr(t.responseBody,t.responseHeaders,u,"Response")),t),v=t=>{return f(((t,e)=>{var r,i=_r(t.name),n=0===e.indexOf("http")?null==(r=_r(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Yr.some((t=>0===s.indexOf(t)))))return t})((hr(r=(e=t).requestHeaders)||kr(Object.keys(null!=r?r:{}),(t=>{Qr.includes(t.toLowerCase())&&(r[t]=Zr)})),e),s.api_host));var e,r},(p=sr(s.session_recording.maskNetworkRequestFn))&&sr(s.session_recording.maskCapturedNetworkRequestFn)&&wr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),p&&(s.session_recording.maskCapturedNetworkRequestFn=t=>{var e=s.session_recording.maskNetworkRequestFn({url:t.name});return r({},t,{name:null==e?void 0:e.url})}),l.maskRequestFn=sr(s.session_recording.maskCapturedNetworkRequestFn)?t=>{var e,r=v(t);return r&&null!==(e=null==s.session_recording.maskCapturedNetworkRequestFn?void 0:s.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==e?e:void 0}:t=>function(t){if(!or(t))return t.requestBody=ti(t.requestBody,"Request"),t.responseBody=ti(t.responseBody,"Response"),t}(v(t)),r({},Jr,l,{recordHeaders:h,recordBody:d,recordPerformance:c,recordInitialRequests:c})))):Gn.info("NetworkCapture not started because we are on localhost.")),i}Sd(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}Id(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.$h.length?this.$h.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Gn.warn("could not emit queued rrweb event.",e,t),!1}}Oh(t,e){return this.Id(Zn((()=>Qn().addCustomEvent(t,e))))}_d(){try{if(this._instance.config.capture_pageview||!Ge)return;var t=new URL(Ge.location.href),e=this.Sd(t.origin+t.pathname+t.search);this.Cd!==e&&(this.Cd=e,this.Oh("$url_changed",{href:e}))}catch(t){}}Md(){if(this.$h.length){var t=[...this.$h];this.$h=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Id(t)}))}}_h(){return this.Id(Zn((()=>Qn().takeFullSnapshot())))}get Td(){var t,e,r;return null!=(t=this.Bh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)?6e4:null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Rd(){if(this.xd&&clearInterval(this.xd),!0!==this.jh){var t=this.Td;t&&(this.xd=setInterval((()=>{this._h()}),t))}}Od(){this.oh.urlBlocked||(this.oh.urlBlocked=!0,clearInterval(this.xd),Gn.info("recording paused due to URL blocker"),this.Oh("recording paused",{reason:"url blocker"}))}Ld(){this.oh.urlBlocked&&(this.oh.urlBlocked=!1,this._h(),this.Rd(),this.Oh("recording resumed",{reason:"left blocked url"}),Gn.info("recording resumed"))}Ed(t,e){var r;if(!this.Uh&&null!=(r=this.Bh)&&r.hasPendingTriggers(this.sessionId)){this.Uh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?Dr:Br]:this.sessionId}),null==(n=this.Bh)||n.updateActiveTriggers(this.sessionId),this.dd(),this.Ih(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Uh=!1}}}get isStarted(){return!!this.zh}get fl(){var t=this._instance.get_property(Rr);if(t){var e;try{e=ar(t)?t:JSON.parse(t)}catch(t){return void Gn.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Gn.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(Rr))}return e}}Ad(t,e,r){this._instance.get_property(t)&&(e(),r())}start(t){var e,r,i=this.fl;if(i){this.Xh&&(this.Fd(),this.fd());var{sessionId:n,windowId:s}=this.Ah.checkAndGetSessionAndWindowId();this.un=n,this.ln=s,null==(e=this._instance.persistence)||e.unregister(Ur),null!=i&&i.endpoint&&(this.Wh=null==i?void 0:i.endpoint),this.Bh=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new Un(this._instance,this.oh,this.Ih.bind(this),this.Oh.bind(this)):new Pn(this._instance,this.oh,this.uh,this.lh,this.Ih.bind(this),this._h.bind(this)),this.Bh.onRemoteConfig(i),null==(r=this.Mh)||r.call(this),this.Mh=this.Bh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.Ed(t,e))),this.Ad(Or,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Or)})),this.Ad(Lr,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Lr)})),this.Ad(Ar,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Ar)})),this.Ad(Er,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Er)})),this.Bh.makeSamplingDecisions(this.sessionId),this.Nd(),this.qh||(Sr(Ge,"beforeunload",this.ld),Sr(Ge,"offline",this.vd),Sr(Ge,"online",this.pd),Sr(Ge,"visibilitychange",this.Pt),this.Kh||(this.Kh=this.Ah.onSessionId(this.Zi)),this.td||(this.td=this.Ah.on("forcedIdleReset",(()=>{this.nd(),this.jh="unknown",this.stop(),this.ed=this.Ah.onSessionId(((t,e,r)=>{var i;null==(i=this.ed)||i.call(this),this.ed=void 0,this.Zi(t,e,r)}))}))),hr(this.Yh)&&(this.Yh=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Sd(null==t?void 0:t.properties.$current_url):"";if(!e)return;this.Oh("$pageview",{href:e})}}catch(t){Gn.error("Could not add $pageview to rrweb session",t)}}))),this.status===Ii&&this.Ih(t||"recording_initialized"))}else Gn.info("remote config must be stored in persistence before recording can start")}Dd(){var t,e,r,i,n,s;null==Ge||Ge.removeEventListener("beforeunload",this.ld),null==Ge||Ge.removeEventListener("offline",this.vd),null==Ge||Ge.removeEventListener("online",this.pd),null==Ge||Ge.removeEventListener("visibilitychange",this.Pt),clearInterval(this.xd),this.Bd(),null==(t=this.Yh)||t.call(this),this.Yh=void 0,null==(e=this.Mh)||e.call(this),this.Mh=void 0,null==(r=this.Kh)||r.call(this),this.Kh=void 0,null==(i=this.td)||i.call(this),this.td=void 0,null==(n=this.ed)||n.call(this),this.ed=void 0,null==(s=this.Bh)||s.stop(),this.Wd(),this.Fd()}Fd(){this.Qh+=1,this.Zh=[],this.Jh=0,this.zd=void 0,this.Xh=!1}Wd(){var t,e;null==(t=this.Pd)||t.stop(),this.$h=[],null==(e=this.zh)||e.call(this),this.zh=void 0}Ud(){if(!this.zd||0===this.Jh)return!1;if(this.Xh)return!0;this.Xh=!0;var t=this.Qh;return this.Bd(),this.Wd(),this.zd.catch((()=>{})).then((()=>{t===this.Qh&&(this.Xh=!1,this.dd(),this.fd(),this.Dd(),Gn.info("stopped"))})).catch((()=>{this.Xh=!1,this.Dd(),Gn.info("stopped")})),!0}stop(){this.Ud()||(this.dd(),this.fd(),this.Dd(),Gn.info("stopped"))}discard(){this.fd(),this.Dd(),Gn.info("discarded")}$d(t,e,r,i,n){var s,a={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};t.type===wi.FullSnapshot&&null!=(s=Jn())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this.Gh=!0),this.status!==ki?this.jd(a):this.fd()}qd(t){t.counted&&t.generation===this.Qh&&(this.Jh=Math.max(0,this.Jh-1)),t.counted=!1,this.Zh=this.Zh.filter((e=>e!==t))}Hd(t,e,r){t.processed||t.generation!==this.Qh||(t.processed=!0,this.$d(t.event,e,r,t.targetSessionId,t.targetWindowId))}Gd(t){try{var{event:e,size:r}=t.compressionEnabled?ls(t.event):{event:t.event,size:ji(t.event)};this.Hd(t,e,r)}finally{this.qd(t)}}hd(){[...this.Zh].forEach((t=>{this.Gd(t)}))}Vd(t,r,i,n){var s=this,a={event:t,compressionEnabled:r,targetSessionId:i,targetWindowId:n,generation:this.Qh,processed:!1,counted:!0};this.Zh.push(a),this.Jh+=1;var o=function(){var i=e((function*(){try{if(a.processed)return;var{event:e,size:i}=r?ss(t)?yield function(t){return hs.apply(this,arguments)}(t):ls(t):{event:t,size:ji(t)};s.Hd(a,e,i)}finally{s.qd(a)}}));return function(){return i.apply(this,arguments)}}();this.zd=this.zd?this.zd.catch((()=>{})).then(o):o()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.Md(),t&&ar(t))){if(t.type===wi.Meta){var u=this.Sd(t.data.href);if(this.Cd=u,!u)return;t.data.href=u}else this._d();if(null==(e=this.Bh)||e.checkUrlTriggers(this.sessionId,(()=>this.Od()),(()=>this.Ld()),((t,e)=>this.Ed(t,e))),!this.oh.urlBlocked||(l=t).type===wi.Custom&&"recording paused"===l.data.tag){var l,h,d;t.type===wi.FullSnapshot&&(this.Rd(),null==(h=this.Pd)||h.reset(),null==(d=this._instance.persistence)||d.register_once({[Ur]:t.timestamp},void 0)),t.type===wi.FullSnapshot&&null!=(r=this.Bh)&&r.hasPendingTriggers(this.sessionId)&&this.Zd();var c=this.Pd?this.Pd.throttleMutations(t):t;if(c){var f=function(t){var e=t;if(e&&ar(e)&&6===e.type&&ar(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(c),v=function(t){return fs(t)?t.data.payload:null}(f),p=function(t){return vs(t)?t.data.payload:null}(f);if(v||p){var m=null!=v?v:p;null!=m&&m.lastActivityTimestamp&&(f.timestamp=m.lastActivityTimestamp)}else this.Jd(f);t.type===wi.FullSnapshot&&(this.Vh.push([this.un,t.timestamp]),this.Vh.length>6&&(this.Vh=this.Vh.slice(-6)));var g=null!==(i=null!==(n=null==v?void 0:v.currentSessionId)&&void 0!==n?n:null==p?void 0:p.nextSessionId)&&void 0!==i?i:this.un,y=null!==(s=null!==(a=null==v?void 0:v.currentWindowId)&&void 0!==a?a:null==p?void 0:p.nextWindowId)&&void 0!==s?s:this.ln;if(!0!==this.jh||function(t){return cs(t)||fs(t)||vs(t)}(f)){if(cs(f)){var w=f.data.payload;w&&(f.timestamp=w.lastActivityTimestamp+w.threshold)}var b=null===(o=this._instance.config.session_recording.compress_events)||void 0===o||o;if(this.Jh>0||b&&ss(f))this.Vd(f,b,g,y);else{var{event:k,size:S}=b?ls(f):{event:f,size:ji(f)};this.$d(f,k,S,g,y)}}}}}}get status(){return this.Bh?this.Bh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Nh,rrwebError:this.qh,urlTriggerMatching:this.oh,eventTriggerMatching:this.uh,linkedFlagMatching:this.lh,remoteConfig:this.fl}):ki}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.lh.linkedFlagSeen=!0,this._h(),this.Ih("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[Fr]:this.sessionId,[xr]:null}),this._h(),this.Ih("sampling_overridden")}overrideTrigger(t){this.Ed(t)}Bd(){this.Qd&&(clearTimeout(this.Qd),this.Qd=void 0)}dd(){var t;this.Bd(),null==(t=this.Bh)||t.ensureSamplingDecision(this.sessionId);var e,r=this.od();return this.status===_i||this.status===Ci||this.status===ki||r?(this.Qd=setTimeout((()=>{this.dd()}),2e3),this.R):(this.R.data.length>0&&(Hi(this.R).forEach((t=>{var e;null==(e=this.rd)||e.trackSize(t.sessionId,t.size),this.Xd({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:gr.LIB_NAME,$lib_version:gr.LIB_VERSION})})),null==(e=this.Bh)||e.onFlushComplete()),this.fd())}jd(t){var e,r=2+((null==(e=this.R)?void 0:e.data.length)||0),i=t.$session_id;this.jh||943718.4>=this.R.size+t.$snapshot_bytes+r&&this.R.sessionId===i||(this.R=this.dd(),this.R.sessionId=i,this.R.windowId=t.$window_id),this.R.size+=t.$snapshot_bytes,this.R.data.push(t.$snapshot_data),this.R.sizes.push(t.$snapshot_bytes),this.Qd||this.jh||(this.Qd=setTimeout((()=>{this.dd()}),2e3))}Xd(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.Wh),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get ud(){var t,e,r=null==(t=this.R)?void 0:t.data[(null==(e=this.R)?void 0:e.data.length)-1],{sessionStartTimestamp:i}=this.Ah.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}Zd(){if(!this.R||0===this.R.data.length)return this.fd();for(var t=-1,e=this.R.data.length-1;e>=0;e--)if(this.R.data[e].type===wi.Meta){t=e;break}return 0>t?this.fd():(this.R.data=this.R.data.slice(t),this.R.sizes=this.R.sizes.slice(t),this.R.size=this.R.sizes.reduce(((t,e)=>t+e),0),this.R)}fd(){return this.R={size:0,data:[],sizes:[],sessionId:this.un,windowId:this.ln},this.R}Ih(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Gn.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Oh("$recording_started",r({reason:t},e))}Yd(t){var e;return 3===t.type&&-1!==Vn.indexOf(null==(e=t.data)?void 0:e.source)}Jd(t){var e=this.Yd(t);e||this.jh||t.timestamp-this.Ph>this.Fh&&(this.jh=!0,clearInterval(this.xd),this.Oh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Ph,threshold:this.Fh,bufferLength:this.R.data.length,bufferSize:this.R.size}),this.dd());var r=!1;if(e&&(this.Ph=t.timestamp,this.jh)){var i="unknown"===this.jh;this.jh=!1,i||(this.Oh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!this.jh){var{windowId:n,sessionId:s}=this.Ah.checkAndGetSessionAndWindowId(!e,t.timestamp),a=this.un!==s,o=this.ln!==n;this.ln=n,this.un=s,a||o?(this.stop(),this.start("session_id_changed")):r&&this.Rd()}}nd(){var t;null==(t=this.Bh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,{sessionStartTimestamp:e}=this.Ah.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.R.data.length,$sdk_debug_replay_internal_buffer_size:this.R.size,$sdk_debug_current_session_duration:this.ud,$sdk_debug_session_start:e,$sdk_debug_replay_flushed_size:null==(t=this.rd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Vh,$snapshot_max_depth_exceeded:this.Gh,$sdk_debug_replay_rrweb_error:this.qh,$sdk_debug_rrweb_attached:!!this.zh,$sdk_debug_rrweb_start_attempted:this.Hh}}Nd(){var t;if(!this.zh){this.Hh=!0;var e,i,n,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this._instance.config.session_recording;for(var[o,u]of Object.entries(a||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=r({password:!0},u):s[o]=u);this.yd&&this.yd.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.yd.fps},s.dataURLOptions={type:"image/webp",quality:this.yd.quality},s.canvasResolutionScale=this.gd),this.md&&(s.maskAllInputs=null===(e=this.md.maskAllInputs)||void 0===e||e,s.maskTextSelector=null!==(i=this.md.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(n=this.md.blockSelector)&&void 0!==n?n:void 0);var l=Qn();if(l){this.Pd=null!==(t=this.Pd)&&void 0!==t?t:new xn(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Gn.info(r,{node:e}),this.log(Hn+" "+r,"warn")}});var h=this.kd();if(this.zh=l(r({emit:t=>{this.onRRwebEmit(t)},plugins:h},s)),!this.zh)return this.qh=!0,void Gn.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.qh=!1,this.Ph=Date.now(),this.jh=cr(this.jh)?this.jh:"unknown",this.tryAddCustomEvent("$remote_config_received",this.fl),this.Oh("$session_options",{sessionRecordingOptions:s,activePlugins:h.map((t=>null==t?void 0:t.name))}),this.Oh("$posthog_config",{config:this._instance.config})}else Gn.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.Oh(t,e)}}Qe.__PosthogExtensions__=Qe.__PosthogExtensions__||{},Qe.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:He,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:yi,options:t})},Qe.__PosthogExtensions__.rrweb={record:Le,version:"v2",wasMaxDepthReached:()=>ht,resetMaxDepthState(){ht=!1,lt=!1}},Qe.__PosthogExtensions__.initSessionRecording=t=>new ps(t)}();
1
+ !function(){"use strict";function t(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function e(e){return function(){var r=this,i=arguments;return new Promise((function(n,s){var a=e.apply(r,i);function o(e){t(a,n,s,o,u,"next",e)}function u(e){t(a,n,s,o,u,"throw",e)}o(void 0)}))}}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},r.apply(null,arguments)}var i,n=["type"],s=Object.defineProperty,a=(t,e,r)=>((t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),o=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(o||{}),u=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(u||{}),l=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(l||{}),h=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(h||{}),d=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(d||{}),c=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(c||{}),f=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(f||{}),v={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},p={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},m={};function g(t){if(m[t])return m[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in v?v[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in p?p[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return m[t]=e.prototype,e.prototype;var o=document.createElement("iframe");try{document.body.appendChild(o);var u=o.contentWindow;if(!u)return e.prototype;var l=u[t].prototype;return l?m[t]=l:r}catch(t){return r}finally{o.parentNode&&document.body.removeChild(o)}}var y={};function w(t,e,r){var i,n=t+"."+String(r);if(y[n])return y[n].call(e);var s=g(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(y[n]=a,a.call(e)):e[r]}var b={};function k(t,e,r){var i=t+"."+String(r);if(b[i])return b[i].bind(e);var n=g(t)[r];return"function"!=typeof n?e[r]:(b[i]=n,n.bind(e))}function S(){return g("MutationObserver").constructor}function I(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n=r(i);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i}})),t[e]=n,()=>{t[e]=i}}catch(t){return()=>{}}}var _={childNodes:t=>w("Node",t,"childNodes"),parentNode:t=>w("Node",t,"parentNode"),parentElement:t=>w("Node",t,"parentElement"),textContent:t=>w("Node",t,"textContent"),contains:(t,e)=>k("Node",t,"contains")(e),getRootNode:t=>k("Node",t,"getRootNode")(),host:t=>t&&"host"in t?w("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?w("Element",t,"shadowRoot"):null,querySelector:(t,e)=>k("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>k("Element",t,"querySelectorAll")(e),mutationObserver:S,patch:I};function C(t){return t.nodeType===t.ELEMENT_NODE}function M(t){var e=t&&"host"in t&&"mode"in t&&_.host(t)||null;return Boolean(e&&"shadowRoot"in e&&_.shadowRoot(e)===t)}function T(t){return"[object ShadowRoot]"==={}.toString.call(t)}function R(t){try{var e=t.rules||t.cssRules;if(!e)return null;var r=t.href;return!r&&t.ownerNode&&(r=t.ownerNode.baseURI),(i=Array.from(e,(t=>x(t,r))).join("")).includes(" background-clip: text;")&&!i.includes(" -webkit-background-clip: text;")&&(i=i.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),i}catch(t){return null}var i}function x(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=R(t.styleSheet)||function(t){var{cssText:e}=t;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return z(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return function(t){return"selectorText"in t}(t)&&t.selectorText.includes(":")&&(n=n.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),e?z(n,e):n}class O{constructor(){a(this,"idNodeMap",new Map),a(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),C(t)){var r=_.shadowRoot(t);r&&this.removeNodeFromMap(r),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function L(t){var{element:e,maskInputOptions:r,tagName:i,type:n,value:s,maskInputFn:a}=t,o=s||"",u=n&&E(n);return(r[i.toLowerCase()]||u&&r[u])&&(o=a?a(o,e):"*".repeat(o.length)),o}function E(t){return t.toLowerCase()}var A="__rrweb_original__";function F(t){var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?E(e):null}var N=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,D=/^(?:[a-z+]+:)?\/\//i,B=/^www\..*/i,W=/^(data:)([^,]*),(.*)/i;function z(t,e){return(t||"").replace(N,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(D.test(u)||B.test(u))return"url("+l+u+l+")";if(W.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var P,U,j="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",q=4096,H=1,G=new RegExp("[^a-z0-9-_:]"),V=-2;function Z(){return H++}var J=/^[^ \t\n\r\u000c]+/,Q=/^[, \t\n\r\u000c]+/,X=new WeakMap;function Y(t,e){return e&&""!==e.trim()?K(t,e):e}function K(t,e){var r=X.get(t);if(r||(r=t.createElement("a"),X.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function tt(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?j:t}(t,e.maxBase64ImageLength):t}function et(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=Y(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>q||t.naturalHeight>q)return e;try{var n=document.createElement("canvas");n.width=t.naturalWidth,n.height=t.naturalHeight;var s=n.getContext("2d");return s?(s.drawImage(t,0,0),n.toDataURL(r||"image/webp",null!=i?i:.4)):e}catch(t){return e}}(n,u,s.type,s.quality)),tt(l,s)}if("image"===e)return tt(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=Y(t,i);return"image"===e&&h.startsWith("data:")?tt(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(Q),e.length>r;){var s=i(J);if(","===s.slice(-1))s=Y(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=Y(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?z(i,K(t)):"object"===e&&"data"===r?Y(t,i):i:Y(t,i)}function rt(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function it(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&it(_.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&it(_.parentNode(t),e,r)}function nt(t,e,r,i){var n;if(C(t)){if(!_.childNodes(n=t).length)return!1}else{if(null===_.parentElement(t))return!1;n=_.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(it(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}var st=new Map;function at(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function ot(t){return null==t?"":t.toLowerCase()}var ut=50,lt=!1,ht=!1;function dt(t,e){var{doc:r,mirror:i,blockClass:n,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:u=!1,inlineStylesheet:l=!0,maskInputOptions:h={},maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p={},inlineImages:m=!1,recordCanvas:g=!1,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b=5e3,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=(()=>!1),newlyAddedElement:O=!1,depth:N=0,maxDepth:D=ut}=e,{needsMask:B}=e,{preserveWhiteSpace:W=!0}=e;if(N>=D)return ht=!0,lt||(lt=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+D+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;B||(B=nt(t,a,o,void 0===B));var j,q=function(t,e){var{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:a,inlineStylesheet:o,maskInputOptions:u={},maskTextFn:l,maskInputFn:h,dataURLOptions:d={},inlineImages:c,recordCanvas:v,keepIframeSrcFn:p,newlyAddedElement:m=!1}=e,g=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,i);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:f.Document,childNodes:[],compatMode:t.compatMode}:{type:f.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:g};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,{doc:a,blockClass:o,blockSelector:u,inlineStylesheet:l,maskInputOptions:h={},maskInputFn:d,dataURLOptions:c={},inlineImages:v,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1,rootId:y}=e,w=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,o,u),b=function(t){if(t instanceof HTMLFormElement)return"form";var e=E(t.tagName);return G.test(e)?"div":e}(t),k={},S=t.attributes.length,I=0;S>I;I++){var C=t.attributes[I];rt(b,C.name)||(k[C.name]=et(a,b,E(C.name),C.value,t,c))}if("link"===b&&l){var M=t.sheet;if(!M){var T=function(t){return t.href}(t);T&&!(M=at(a,T))&&T.includes(".css")&&(M=at(a,window.location.origin+"/"+T.replace(window.location.href,"")))}var x=null;M&&(x=R(M)),x&&(delete k.rel,delete k.href,k._cssText=x)}if("style"===b&&t.sheet&&!(t.innerText||_.textContent(t)||"").trim().length){var O=R(t.sheet);O&&(k._cssText=O)}if("input"===b||"textarea"===b||"select"===b){var N=t.value,D=t.checked;"radio"!==k.type&&"checkbox"!==k.type&&"submit"!==k.type&&"button"!==k.type&&N?k.value=L({element:t,type:F(t),tagName:b,value:N,maskInputOptions:h,maskInputFn:d}):D&&(k.checked=D)}if("option"===b&&(t.selected&&!h.select?k.selected=!0:delete k.selected),"dialog"===b&&t.open)try{k.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){k.rr_open_mode="modal",k.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&p)if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((A in n?n[A]:n).call(e,r,i,Math.min(50,t.width-r),Math.min(50,t.height-i)).data.buffer).some((t=>0!==t)))return!1}return!0})(t)||(k.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){var B=t.toDataURL(c.type,c.quality),W=a.createElement("canvas");W.width=t.width,W.height=t.height,B!==W.toDataURL(c.type,c.quality)&&(k.rr_dataURL=B)}if("img"===b&&v){P||(P=a.createElement("canvas"),U=P.getContext("2d"));var z=t,j=z.currentSrc||z.getAttribute("src")||"<unknown-src>",q=z.crossOrigin,H=()=>{z.removeEventListener("load",H);try{P.width=z.naturalWidth,P.height=z.naturalHeight,U.drawImage(z,0,0),k.rr_dataURL=P.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==z.crossOrigin)return z.crossOrigin="anonymous",void(z.complete&&0!==z.naturalWidth?H():z.addEventListener("load",H));console.warn("Cannot inline img src="+j+"! Error: "+t)}"anonymous"===z.crossOrigin&&(q?k.crossOrigin=q:z.removeAttribute("crossorigin"))};z.complete&&0!==z.naturalWidth?H():z.addEventListener("load",H)}if("audio"===b||"video"===b){var V=k;V.rr_mediaState=t.paused?"paused":"played",V.rr_mediaCurrentTime=t.currentTime,V.rr_mediaPlaybackRate=t.playbackRate,V.rr_mediaMuted=t.muted,V.rr_mediaLoop=t.loop,V.rr_mediaVolume=t.volume}if(g||(t.scrollLeft&&(k.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(k.rr_scrollTop=t.scrollTop)),w){var{width:Z,height:J,left:Q,top:X}=t.getBoundingClientRect(),Y=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);k={class:k.class,rr_width:Z+"px",rr_height:J+"px",rr_left:Math.floor(Q+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(X+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},Y&&(k.rr_position=Y.position||"static",Y.transform&&"none"!==Y.transform&&(k.rr_transform=Y.transform),Y.display&&Y.display.startsWith("inline")&&(k.rr_display=Y.display))}"iframe"!==b||m(k.src)||(t.contentDocument||(k.rr_src=k.src),delete k.src);try{customElements.get(b)&&(s=!0)}catch(t){}return{type:f.Element,tagName:b,attributes:k,childNodes:[],isSVG:(K=t,Boolean("svg"===K.tagName||K.ownerSVGElement)||void 0),needBlock:w,rootId:y,isCustom:s};var K}(t,{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:u,maskInputFn:h,dataURLOptions:d,inlineImages:c,recordCanvas:v,keepIframeSrcFn:p,newlyAddedElement:m,rootId:g});case t.TEXT_NODE:return function(t,e){var r,{needsMask:i,maskTextFn:n,rootId:s}=e,a=_.parentNode(t),o=a&&a.tagName,u=_.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(null==(r=a.sheet)?void 0:r.cssRules){var d=R(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=z(u,K(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,_.parentElement(t)):u.replace(/[\S]/g,"*")),{type:f.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:a,maskTextFn:l,rootId:g});case t.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:g};case t.COMMENT_NODE:return{type:f.Comment,textContent:_.textContent(t)||"",rootId:g};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,dataURLOptions:p,inlineImages:m,recordCanvas:g,keepIframeSrcFn:x,newlyAddedElement:O});if(!q)return console.warn(t,"not serialized"),null;j=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===f.Comment)return!0;if(t.type===f.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(ot(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ot(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ot(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&ot(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ot(t.attributes.property).match(/^(og|twitter|fb):/)||ot(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===ot(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(ot(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(ot(t.attributes.name))||ot(t.attributes.property).match(/^article:/)||ot(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(ot(t.attributes.name)))return!0}}return!1}(q,v)||!W&&q.type===f.Text&&!q.isStyle&&!q.textContent.replace(/^\s+|\s+$/gm,"").length?V:Z();var H=Object.assign(q,{id:j});if(i.add(t,H),j===V)return null;y&&y(t);var J=!u;if(H.type===f.Element){J=J&&!H.needBlock,delete H.needBlock;var Q=_.shadowRoot(t);Q&&T(Q)&&(H.isShadowHost=!0)}if((H.type===f.Document||H.type===f.Element)&&J){v.headWhitespace&&H.type===f.Element&&"head"===H.tagName&&(W=!1);var X={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:u,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p,inlineImages:m,recordCanvas:g,preserveWhiteSpace:W,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x,depth:N+1,maxDepth:D};if(H.type===f.Element&&"textarea"===H.tagName&&void 0!==H.attributes.value);else for(var Y of Array.from(_.childNodes(t))){var tt=dt(Y,X);tt&&H.childNodes.push(tt)}var it=null;if(C(t)&&(it=_.shadowRoot(t)))for(var ct of Array.from(_.childNodes(it))){var ft=dt(ct,X);ft&&(T(it)&&(ft.isShadow=!0),H.childNodes.push(ft))}}var vt=_.parentNode(t);if(vt&&M(vt)&&T(vt)&&(H.isShadow=!0),H.type===f.Element&&"iframe"===H.tagName){var pt=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),t.removeEventListener("load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?t.removeEventListener("load",a):(o=!0,t.removeEventListener("load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var f=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(f),t.removeEventListener("load",a)}}return t.addEventListener("load",a),()=>{t.removeEventListener("load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&w){var r=dt(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p,inlineImages:m,recordCanvas:g,preserveWhiteSpace:W,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x,depth:N+1,maxDepth:D});r&&w(t,r)}}),b);null==k||k(t,pt)}return H.type===f.Element&&"link"===H.tagName&&"stylesheet"===H.attributes.rel&&function(e,u,f){if(!st.has(e)){var k;try{k=e.sheet}catch(t){return}if(!k){var _=new AbortController,C=!1,M=()=>{if(!C){C=!0;try{(()=>{if(S){var e=dt(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:B,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:v,dataURLOptions:p,inlineImages:m,recordCanvas:g,preserveWhiteSpace:W,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x,depth:N,maxDepth:D});e&&S(t,e)}})()}finally{st.delete(e),_.abort()}}},T=setTimeout(M,f);_.signal.addEventListener("abort",(()=>clearTimeout(T)),{once:!0}),e.addEventListener("load",M,{signal:_.signal,once:!0}),st.set(e,_)}}}(t,0,I),H}function ct(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}class ft{constructor(){a(this,"parentElement",null),a(this,"parentNode",null),a(this,"ownerDocument"),a(this,"firstChild",null),a(this,"lastChild",null),a(this,"previousSibling",null),a(this,"nextSibling",null),a(this,"ELEMENT_NODE",1),a(this,"TEXT_NODE",3),a(this,"nodeType"),a(this,"nodeName"),a(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof ft))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function vt(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>r.removeEventListener(t,e,i)}function pt(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var mt="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",gt={map:{},getId(){return console.error(mt),-1},getNode(){return console.error(mt),null},removeNodeFromMap(){console.error(mt)},has(){return console.error(mt),!1},reset(){console.error(mt)}};function yt(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function wt(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){setTimeout((()=>{r.set.call(this,t)}),0),s&&s.set&&s.set.call(this,t)}}),()=>wt(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(gt=new Proxy(gt,{get(t,e,r){return"map"===e&&console.error(mt),Reflect.get(t,e,r)}}));var bt=Date.now;function kt(t){var e,r,i,n,s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(e=_.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=_.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function St(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function It(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _t(t){return t?t.nodeType===t.ELEMENT_NODE?t:_.parentElement(t):null}function Ct(t,e,r,i){if(!t)return!1;var n=_t(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(it(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function Mt(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===V}function Tt(t,e){if(M(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=_.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||Tt(i,e))}function Rt(t){return Boolean(t.changedTouches)}function xt(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Ot(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Lt(t){return!!t&&(t instanceof ft&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(_.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(bt=()=>(new Date).getTime());class Et{constructor(){a(this,"id",1),a(this,"styleIDMap",new WeakMap),a(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function At(t){var e,r=null;return"getRootNode"in t&&(null==(e=_.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&_.host(_.getRootNode(t))&&(r=_.host(_.getRootNode(t))),r}function Ft(t){var e=t.ownerDocument;return!!e&&(_.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=At(r);)r=e;return r}(t);return _.contains(e,r)}(t))}function Nt(t){return"__ln"in t}class Dt{constructor(){a(this,"length",0),a(this,"head",null),a(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Nt(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&Nt(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){var e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}var Bt,Wt=(t,e)=>t+"@"+e;class zt{constructor(){a(this,"frozen",!1),a(this,"locked",!1),a(this,"texts",[]),a(this,"attributes",[]),a(this,"attributeMap",new WeakMap),a(this,"removes",[]),a(this,"mapRemoves",[]),a(this,"movedMap",{}),a(this,"addedSet",new Set),a(this,"movedSet",new Set),a(this,"droppedSet",new Set),a(this,"removesSubTreeCache",new Set),a(this,"mutationCb"),a(this,"blockClass"),a(this,"blockSelector"),a(this,"maskTextClass"),a(this,"maskTextSelector"),a(this,"inlineStylesheet"),a(this,"maskInputOptions"),a(this,"maskTextFn"),a(this,"maskInputFn"),a(this,"keepIframeSrcFn"),a(this,"recordCanvas"),a(this,"inlineImages"),a(this,"slimDOMOptions"),a(this,"dataURLOptions"),a(this,"doc"),a(this,"mirror"),a(this,"iframeManager"),a(this,"stylesheetManager"),a(this,"shadowDomManager"),a(this,"canvasManager"),a(this,"processedNodeManager"),a(this,"unattachedDoc"),a(this,"canvasManagerReleased",!1),a(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),a(this,"emit",(()=>{if(!this.frozen&&!this.locked){for(var t=[],e=new Set,r=new Dt,i=t=>{for(var e=t,r=V;r===V;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=_.parentNode(n);if(s&&Ft(n)&&"TEXTAREA"!==s.tagName){var a=M(s)?this.mirror.getId(At(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=dt(n,{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:t=>{xt(t,this.mirror)&&this.iframeManager.addIframe(t),Ot(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Lt(n)&&this.shadowDomManager.addShadowRoot(_.shadowRoot(n),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)Ut(this.removesSubTreeCache,s)&&!this.movedSet.has(_.parentNode(s))||n(s);for(var a of this.addedSet)$t(this.droppedSet,a)||Ut(this.removesSubTreeCache,a)?$t(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(_.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var f=this.mirror.getId(_.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==f){u=c;break}var v=_.parentNode(c.value);if(v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=_.host(v);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var m={texts:this.texts.map((t=>{var e=t.node,r=_.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var{attributes:e}=t;if("string"==typeof e.style){var r=JSON.stringify(t.styleDiff),i=JSON.stringify(t._unchangedStyles);e.style.length>r.length&&(r+i).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}return{id:this.mirror.getId(t.node),attributes:e}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),removes:this.removes,adds:t};(m.texts.length||m.attributes.length||m.removes.length||m.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(m))}})),a(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),a(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(_.childNodes(t),(t=>_.textContent(t)||"")).join("");e.attributes.value=L({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:F(t),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(t=>{if(!Mt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=_.textContent(t.target);Ct(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:nt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,_t(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break;case"attributes":var r=t.target,i=t.attributeName,n=t.target.getAttribute(i);if("value"===i){var s=F(r);n=L({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(Ct(t.target,this.blockClass,this.blockSelector,!1)||n===t.oldValue)return;var a=this.attributeMap.get(t.target);if("IFRAME"===r.tagName&&"src"===i&&!this.keepIframeSrcFn(n)){if(r.contentDocument)return;i="rr_src"}if(a||(this.attributes.push(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,a)),"type"===i&&"INPUT"===r.tagName&&"password"===(t.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!rt(r.tagName,i))if(a.attributes[i]=et(this.doc,E(r.tagName),E(i),n,r,this.dataURLOptions),"style"===i){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var u of(t.oldValue&&(o.style.cssText=t.oldValue),Array.from(r.style))){var l=r.style.getPropertyValue(u),h=r.style.getPropertyPriority(u);l!==o.style.getPropertyValue(u)||h!==o.style.getPropertyPriority(u)?a.styleDiff[u]=""===h?l:[l,h]:a._unchangedStyles[u]=[l,h]}for(var d of Array.from(o.style))""===r.style.getPropertyValue(d)&&(a.styleDiff[d]=!1)}else"open"===i&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(Ct(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach((e=>this.genAdds(e,t.target))),t.removedNodes.forEach((e=>{var r=this.mirror.getId(e),i=M(t.target)?this.mirror.getId(_.host(t.target)):this.mirror.getId(t.target);Ct(t.target,this.blockClass,this.blockSelector,!1)||Mt(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Pt(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||Tt(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Wt(r,i)]?Pt(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!M(t.target)||!T(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),_.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),a(this,"genAdds",((t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!this.addedSet.has(t)&&!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Mt(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Wt(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Ct(t,this.blockClass,this.blockSelector,!1)||(_.childNodes(t).forEach((t=>this.genAdds(t))),Lt(t)&&_.childNodes(_.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((e=>{this[e]=t[e]})),this.canvasManager.acquire()}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.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function Pt(t,e){t.delete(e),_.childNodes(e).forEach((e=>Pt(t,e)))}function Ut(t,e,r){return 0!==t.size&&function(t,e,r){var i=_.parentNode(e);return!!i&&t.has(i)}(t,e)}function $t(t,e){return 0!==t.size&&jt(t,e)}function jt(t,e){var r=_.parentNode(e);return!!r&&(!!t.has(r)||jt(t,r))}var qt=t=>Bt?function(){try{return t(...arguments)}catch(t){if(Bt&&!0===Bt(t))return;throw t}}:t,Ht=[];function Gt(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function Vt(t,e){var r=new zt;Ht.push(r),r.init(t);var i=new(S())(qt(r.processMutations.bind(r)));return i.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{observer:i,buffer:r}}function Zt(t){var{scrollCb:e,doc:r,mirror:i,blockClass:n,blockSelector:s,sampling:a}=t,o=new Map,u=t=>{var a=Gt(t);if(a&&!Ct(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=kt(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[vt("scroll",qt(yt(qt((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(vt("scrollend",qt(u),r)),()=>l.forEach((t=>t()))}function Jt(t,e){for(var r=Ht.length-1;r>=0;r--){var i=Ht[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Ht.splice(r,1))}}}var Qt=["INPUT","TEXTAREA","SELECT"],Xt=new WeakMap;function Yt(t){return function t(e,r){if(re("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||re("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||re("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||re("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function Kt(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function te(t,e){var r,i,n,s,{mirror:a,stylesheetManager:o}=t;s=a.getId("#document"===e.nodeName?e:_.host(e));var u="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==u?void 0:u.prototype)?Object.getOwnPropertyDescriptor(null==u?void 0:u.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&u&&l?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var t;return null==(t=l.get)?void 0:t.call(this)},set(t){var e,r=null==(e=l.set)?void 0:e.call(this,t);if(null!==s&&-1!==s)try{o.adoptStyleSheets(t,s)}catch(t){}return r}}),qt((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function ee(t,e){void 0===e&&(e={});var i,n,s=t.doc.defaultView;if(!s)return()=>{};if(function(t,e){var{mutationCb:r,mousemoveCb:i,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:a,inputCb:o,mediaInteractionCb:u,styleSheetRuleCb:l,styleDeclarationCb:h,canvasMutationCb:d,fontCb:c,selectionCb:f,customElementCb:v}=t;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),f(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),v(...arguments)}}(t,e),t.recordDOM){var a=Vt(t,t.doc);i=a.observer,n=a.buffer}var o=function(t){var{mousemoveCb:e,sampling:r,doc:i,mirror:n}=t;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],h=yt(qt((t=>{var r=Date.now()-s;e(l.map((t=>(t.timeOffset-=r,t))),t),l=[],s=null})),o),d=qt(yt(qt((t=>{var e=Gt(t),{clientX:r,clientY:i}=Rt(t)?t.changedTouches[0]:t;s||(s=bt()),l.push({x:r,y:i,id:n.getId(e),timeOffset:bt()-s}),h("undefined"!=typeof DragEvent&&t instanceof DragEvent?u.Drag:t instanceof MouseEvent?u.MouseMove:u.TouchMove)})),a,{trailing:!1})),c=[vt("mousemove",d,i),vt("touchmove",d,i),vt("drag",d,i)];return qt((()=>{c.forEach((t=>t()))}))}(t),d=function(t){var{mouseInteractionCb:e,doc:i,mirror:n,blockClass:s,blockSelector:a,sampling:o}=t;if(!1===o.mouseInteraction)return()=>{};var u=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,d=[],c=null;return Object.keys(l).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==u[t])).forEach((t=>{var o=E(t),u=(t=>i=>{var o=Gt(i);if(!Ct(o,s,a,!0)){var u=null,d=t;if("pointerType"in i){switch(i.pointerType){case"mouse":u=h.Mouse;break;case"touch":u=h.Touch;break;case"pen":u=h.Pen}u===h.Touch&&(l[t]===l.MouseDown?d="TouchStart":l[t]===l.MouseUp&&(d="TouchEnd"))}else Rt(i)&&(u=h.Touch);null!==u?(c=u,(d.startsWith("Touch")&&u===h.Touch||d.startsWith("Mouse")&&u===h.Mouse)&&(u=null)):l[t]===l.Click&&(u=c,c=null);var f=Rt(i)?i.changedTouches[0]:i;if(f){var v=n.getId(o),{clientX:p,clientY:m}=f;qt(e)(r({type:l[d],id:v,x:p,y:m},null!==u&&{pointerType:u}))}}})(t);if(window.PointerEvent)switch(l[t]){case l.MouseDown:case l.MouseUp:o=o.replace("mouse","pointer");break;case l.TouchStart:case l.TouchEnd:return}d.push(vt(o,u,i))})),qt((()=>{d.forEach((t=>t()))}))}(t),f=Zt(t),v=function(t,e){var{viewportResizeCb:r}=t,{win:i}=e,n=-1,s=-1;return vt("resize",qt(yt(qt((()=>{var t=St(),e=It();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:s}),p=function(t){var{inputCb:e,doc:i,mirror:n,blockClass:s,blockSelector:a,ignoreClass:o,ignoreSelector:u,maskInputOptions:l,maskInputFn:h,sampling:d,userTriggeredOnInput:c}=t;function f(t){var e=Gt(t),r=t.isTrusted,n=e&&e.tagName;if(e&&"OPTION"===n&&(e=_.parentElement(e)),e&&n&&Qt.indexOf(n)>=0&&!Ct(e,s,a,!0)&&!(e.classList.contains(o)||u&&e.matches(u))){var d=e.value,f=!1,p=F(e)||"";"radio"===p||"checkbox"===p?f=e.checked:(l[n.toLowerCase()]||l[p])&&(d=L({element:e,maskInputOptions:l,tagName:n,type:p,value:d,maskInputFn:h})),v(e,c?{text:d,isChecked:f,userTriggered:r}:{text:d,isChecked:f});var m=e.name;"radio"===p&&m&&f&&i.querySelectorAll('input[type="radio"][name="'+m+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,c?{text:r,isChecked:!f,userTriggered:!1}:{text:r,isChecked:!f})}}))}}function v(t,i){var s=Xt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Xt.set(t,i);var a=n.getId(t);qt(e)(r({},i,{id:a}))}}var p=("last"===d.input?["change"]:["input","change"]).map((t=>vt(t,qt(f),i))),m=i.defaultView;if(!m)return()=>{p.forEach((t=>t()))};var g=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]].map((t=>wt(t[0],t[1],{set(){qt(f)({target:this,isTrusted:!1})}},!1,m)))),qt((()=>{p.forEach((t=>t()))}))}(t),m=function(t){var{mediaInteractionCb:e,blockClass:r,blockSelector:i,mirror:n,sampling:s,doc:a}=t,o=qt((t=>yt(qt((s=>{var a=Gt(s);if(a&&!Ct(a,r,i,!0)){var{currentTime:o,volume:u,muted:l,playbackRate:h,loop:d}=a;e({type:t,id:n.getId(a),currentTime:o,volume:u,muted:l,playbackRate:h,loop:d})}})),s.media||500))),u=[vt("play",o(c.Play),a),vt("pause",o(c.Pause),a),vt("seeked",o(c.Seeked),a),vt("volumechange",o(c.VolumeChange),a),vt("ratechange",o(c.RateChange),a)];return qt((()=>{u.forEach((t=>t()))}))}(t),g=()=>{},y=()=>{},w=()=>{},b=()=>{};t.recordDOM&&(g=function(t,e){var{styleSheetRuleCb:r,mirror:i,stylesheetManager:n}=t,{win:s}=e;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:qt(((t,e,s)=>{var[a,o]=s,{id:u,styleId:l}=Kt(e,i,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,adds:[{rule:a,index:o}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var o,u,l=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,removes:[{index:a}]}),t.apply(e,s)}))}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,replaceSync:a}),t.apply(e,s)}))}));var h={};ie("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(ie("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),ie("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),ie("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var[e,s]=t;d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:qt(((t,e,s)=>{var[a,o]=s,{id:u,styleId:l}=Kt(e.parentStyleSheet,i,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,adds:[{rule:a,index:[...Yt(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:qt(((t,e,s)=>{var[a]=s,{id:o,styleId:u}=Kt(e.parentStyleSheet,i,n.styleMirror);return(o&&-1!==o||u&&-1!==u)&&r({id:o,styleId:u,removes:[{index:[...Yt(e),a]}]}),t.apply(e,s)}))})})),qt((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=l,o&&(s.CSSStyleSheet.prototype.replace=o),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(h).forEach((t=>{var[e,r]=t;r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:s}),y=te(t,t.doc),w=function(t,e){var{styleDeclarationCb:r,mirror:i,ignoreCSSAttributes:n,stylesheetManager:s}=t,{win:a}=e,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:qt(((t,e,a)=>{var u,[l,h,d]=a;if(n.has(l))return o.apply(e,[l,h,d]);var{id:c,styleId:f}=Kt(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror);return(c&&-1!==c||f&&-1!==f)&&r({id:c,styleId:f,set:{property:l,value:h,priority:d},index:Yt(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:qt(((t,e,a)=>{var o,[l]=a;if(n.has(l))return u.apply(e,[l]);var{id:h,styleId:d}=Kt(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror);return(h&&-1!==h||d&&-1!==d)&&r({id:h,styleId:d,remove:{property:l},index:Yt(e.parentRule)}),t.apply(e,a)}))}),qt((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:s}),t.collectFonts&&(b=function(t){var{fontCb:e,doc:r}=t,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=I(r.fonts,"add",(function(t){return function(r){return setTimeout(qt((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),qt((()=>{n.forEach((t=>t()))}))}(t)));var k=function(t){var{doc:e,mirror:r,blockClass:i,blockSelector:n,selectionCb:s}=t,a=!0,o=qt((()=>{var t=e.getSelection();if(!(!t||a&&(null==t?void 0:t.isCollapsed))){a=t.isCollapsed||!1;for(var o=[],u=t.rangeCount||0,l=0;u>l;l++){var h=t.getRangeAt(l),{startContainer:d,startOffset:c,endContainer:f,endOffset:v}=h;Ct(d,i,n,!0)||Ct(f,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(f),endOffset:v})}s({ranges:o})}}));return o(),vt("selectionchange",o)}(t),S=function(t){var{doc:e,customElementCb:r}=t,i=e.defaultView;return i&&i.customElements?I(i.customElements,"define",(function(t){return function(e,i,n){try{r({define:{name:e}})}catch(t){console.warn("Custom element callback failed for "+e)}return t.apply(this,[e,i,n])}})):()=>{}}(t),C=[];for(var M of t.plugins)C.push(M.observer(M.callback,s,M.options));return qt((()=>{if(n){n.destroy(),n.reset();var t=Ht.indexOf(n);-1!==t&&Ht.splice(t,1)}null==i||i.disconnect(),o(),d(),f(),v(),p(),m(),g(),y(),w(),b(),k(),S(),C.forEach((t=>t()))}))}function re(t){return void 0!==window[t]}function ie(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class ne{constructor(t){a(this,"iframeIdToRemoteIdMap",new WeakMap),a(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){var n=r||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t),a=n.get(e);return a||(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i=r||this.getRemoteIdToIdMap(t);return"number"!=typeof e?e:i.get(e)||-1}getRemoteIds(t,e){var r=this.getRemoteIdToIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){var e=this.iframeIdToRemoteIdMap.get(t);return e||this.iframeIdToRemoteIdMap.set(t,e=new Map),e}getRemoteIdToIdMap(t){var e=this.iframeRemoteIdToIdMap.get(t);return e||this.iframeRemoteIdToIdMap.set(t,e=new Map),e}}class se{constructor(t){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new ne(Z)),a(this,"crossOriginIframeStyleMirror"),a(this,"crossOriginIframeRootIdMap",new WeakMap),a(this,"mirror"),a(this,"mutationCb"),a(this,"wrappedEmit"),a(this,"loadListener"),a(this,"pageHideListener"),a(this,"stylesheetManager"),a(this,"recordCrossOriginIframes"),a(this,"messageHandler"),a(this,"nestedIframeListeners",new Map),a(this,"attachedWindows",new WeakMap),a(this,"attachedDocuments",new WeakMap),a(this,"attachedIframes",new Map),a(this,"loadListenerDisposers",new WeakMap),a(this,"iframeElementsById",new Map),a(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ne(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>pt(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{var{win:e,handler:r}=t;pt((()=>e.removeEventListener("pagehide",r)))})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);pt((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}pt((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case o.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:o.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case o.Meta:case o.Load:case o.DomContentLoaded:return!1;case o.Plugin:return e;case o.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case o.IncrementalSnapshot:switch(e.data.source){case u.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),e.data.removes.forEach((e=>{this.replaceIds(e,t,["parentId","id"])})),e.data.attributes.forEach((e=>{this.replaceIds(e,t,["id"])})),e.data.texts.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case u.Drag:case u.TouchMove:case u.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(e.data,t,["id"]),e;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case u.Font:return e;case u.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case u.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach((t=>{this.replaceIdOnNode(t,e)}))}patchRootIdOnNode(t,e){t.type===f.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);if(n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(pt((()=>t.removeEventListener("message",e))),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)){var s=this.nestedIframeListeners.get(i);pt((()=>i.removeEventListener("message",s))),this.nestedIframeListeners.delete(i)}i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var a=this.attachedDocuments.get(r);a&&(a.forEach((t=>{pt((()=>this.mirror.removeNodeFromMap(t)))})),pt((()=>Jt(r,a))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var{content:r}=t;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{pt((()=>e.removeEventListener("message",t)))})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>{var{element:r}=e;return t.add(r)})),t.forEach((t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class ae{constructor(t){a(this,"shadowDoms",new WeakSet),a(this,"mutationCb"),a(this,"scrollCb"),a(this,"bypassOptions"),a(this,"mirror"),a(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){if(T(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var{observer:i,buffer:n}=Vt(r({},this.bypassOptions,{doc:e,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push((()=>{i.disconnect(),n.destroy(),n.releaseCanvasManager();var t=Ht.indexOf(n);-1!==t&&Ht.splice(t,1)})),this.restoreHandlers.push(Zt(r({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout((()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(_.host(t))),this.restoreHandlers.push(te({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))}),0)}}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){var r=this;this.restoreHandlers.push(I(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=_.shadowRoot(this);return s&&Ft(this)&&r.addShadowRoot(s,e),n}})))}reset(){this.restoreHandlers.forEach((t=>{try{t()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue="undefined"==typeof Uint8Array?[]:new Uint8Array(256),le=0;64>le;le++)ue[oe.charCodeAt(le)]=le;var he=new Map,de=(t,e,r)=>{if(t&&(ve(t,e)||"object"==typeof t)){var i=function(t,e){var r=he.get(t);return r||he.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function ce(t,e,r,i){if(t instanceof Array)return t.map((t=>ce(t,e,r,i)));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=oe[r[e]>>2],n+=oe[(3&r[e])<<4|r[e+1]>>4],n+=oe[(15&r[e+1])<<2|r[e+2]>>6],n+=oe[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}if(t instanceof DataView)return{rr_type:t.constructor.name,args:[ce(t.buffer,e,r,i),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){var a=t.constructor.name,{src:o}=t;return{rr_type:a,src:o}}return t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[ce(t.data,e,r,i),t.width,t.height]}:ve(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:de(t,e,r)}:t}var fe=(t,e,r,i)=>t.map((t=>ce(t,e,r,i))),ve=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},pe=["webgl","webgl2"];function me(t){return"nodeType"in t}function ge(t,e,i,n){var s=[];try{if(n){var a=function(t,e,i){var n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return I(n.prototype,"configure",(function(n){return function(s){var a=function(t){var{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!a||me(a)&&Ct(a,e,i,!0))return n.call(this,s);me(a)&&!("__context"in a)&&(a.__context="webgpu");var o=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?r({},s,{usage:"number"==typeof s.usage?s.usage|o:o}):s)}}))}(t,e,i);a&&s.push(a)}var o=I(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(r){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(r),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!Ct(this,e,i,!0)&&("__context"in this||(this.__context=s),n&&pe.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[r,...o])}}));s.push(o)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((t=>t()))}}function ye(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=I(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(de(d,s,this),"tagName"in this.canvas&&!Ct(this.canvas,i,n,!0)){var c=fe(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=wt(t,u,{set(t){r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var we,be,ke,Se='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n function fnv1aHash(buffer) {\n const view = new Uint8Array(buffer);\n let hash = 2166136261;\n for (let i2 = 0; i2 < view.length; i2++) {\n hash ^= view[i2];\n hash = hash * 16777619 | 0;\n }\n return (hash >>> 0).toString(16);\n }\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions } = e.data;\n try {\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d");\n }\n reusableCtx.clearRect(0, 0, width, height);\n reusableCtx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const fingerprint = fnv1aHash(arrayBuffer);\n if (!lastFingerprintMap.has(id)) {\n const base642 = encode(arrayBuffer);\n if (await transparentBase64 === base642) {\n lastFingerprintMap.set(id, fingerprint);\n return worker.postMessage({ id });\n }\n lastFingerprintMap.set(id, fingerprint);\n worker.postMessage({ id, type, base64: base642, displayWidth, displayHeight });\n return;\n }\n if (lastFingerprintMap.get(id) === fingerprint)\n return worker.postMessage({ id });\n const base64 = encode(arrayBuffer);\n worker.postMessage({ id, type, base64, displayWidth, displayHeight });\n lastFingerprintMap.set(id, fingerprint);\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-CSpkoNCs.js.map\n',Ie="undefined"!=typeof self&&self.Blob&&new Blob([Se],{type:"text/javascript;charset=utf-8"});function _e(t){var e;try{if(!(e=Ie&&(self.URL||self.webkitURL).createObjectURL(Ie)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Se),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class Ce{constructor(t){a(this,"pendingCanvasMutations",new Map),a(this,"rafStamps",{latestId:0,invokeId:null}),a(this,"mirror"),a(this,"mutationCb"),a(this,"resetObservers"),a(this,"frozen",!1),a(this,"locked",!1),a(this,"rafIdTimestamp",null),a(this,"rafIdFlush",null),a(this,"refCount",0),a(this,"torndown",!1),a(this,"processMutation",((t,e)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)}));var{sampling:e="all",win:r,blockClass:i,blockSelector:n,recordCanvas:s,dataURLOptions:o,resolutionScale:u}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&"all"===e&&this.initCanvasMutationObserver(r,i,n,o),s&&"number"==typeof e&&this.initCanvasFPSObserver(e,r,i,n,{dataURLOptions:o,resolutionScale:u})}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,i,n,s){var a=this;if("OffscreenCanvas"in r){var o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,u=ge(r,i,n,!0),l=new Map,h=new _e;h.onmessage=t=>{var{id:e}=t.data;if(l.set(e,!1),"base64"in t.data){var{base64:r,type:i,displayWidth:n,displayHeight:s}=t.data;this.mutationCb({id:e,type:d["2D"],commands:[{property:"clearRect",args:[0,0,n,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:i}]},0,0,n,s]}],displayWidth:n,displayHeight:s})}};var c,f=1e3/t,v=0,p=t=>{var u,d;v&&f>t-v||(v=t,(u=[],d=t=>{try{t.querySelectorAll("canvas").forEach((t=>{Ct(t,i,n,!0)||u.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&d(t.shadowRoot)}))}catch(t){}},d(r.document),u).forEach(function(){var t=e((function*(t){var e,r,i=a.mirror.getId(t);if(!l.get(i)&&0!==t.width&&0!==t.height){l.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var n=t.getContext(t.__context);if(null==(e=null==n?void 0:n.isContextLost)?void 0:e.call(n))return void l.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var u=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(u*o)),f=Math.max(1,Math.round(d*o)),v=yield createImageBitmap(t,1>o?{resizeWidth:c,resizeHeight:f,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:f});h.postMessage({id:i,bitmap:v,width:c,height:f,displayWidth:u,displayHeight:d,dataURLOptions:s.dataURLOptions},[v])}catch(t){l.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),c=requestAnimationFrame(p)};c=requestAnimationFrame(p),this.resetObservers=()=>{u(),cancelAnimationFrame(c)}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=ge(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=I(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return Ct(this.canvas,r,i,!0)||setTimeout((()=>{var r=fe(u,e,this,n);t(this.canvas,{type:d["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(r){var u=wt(e.CanvasRenderingContext2D.prototype,a,{set(e){t(this.canvas,{type:d["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...ye(e.WebGLRenderingContext.prototype,d.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...ye(e.WebGL2RenderingContext.prototype,d.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,n))),{type:s}=r[0];this.mutationCb({id:e,type:s,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class Me{constructor(t){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new Et),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;r.styleMirror.has(t)?e=r.styleMirror.getId(t):(e=r.styleMirror.add(t),n.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:x(e,t.href),index:r})))})),i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,st.forEach((t=>t.abort())),st.clear()}trackStylesheetInLinkElement(t){}}class Te{constructor(){a(this,"nodeMap",new WeakMap),a(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).some((t=>t!==e))}add(t,e){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}}var Re=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var xe=document.createElement("iframe");document.body.appendChild(xe),Array.from=(null==(i=xe.contentWindow)?void 0:i.Array.from)||Array.from,document.body.removeChild(xe)}}catch(t){console.debug("Unable to override Array.from",t)}var Oe=new O;function Le(t){void 0===t&&(t={});var{emit:e,checkoutEveryNms:i,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:h=null,maskTextClass:d="rr-mask",maskTextSelector:c=null,inlineStylesheet:f=!0,maskAllInputs:v,maskInputOptions:p,slimDOMOptions:m,maskInputFn:g,maskTextFn:y,hooks:w,packFn:b,sampling:k={},dataURLOptions:S={},canvasResolutionScale:I,mousemoveWait:C,recordDOM:M=!0,recordCanvas:T=!1,recordCrossOriginIframes:R=!1,recordAfter:x=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:L=!1,collectFonts:E=!1,inlineImages:A=!1,plugins:F,keepIframeSrcFn:N=(()=>!1),ignoreCSSAttributes:D=new Set([]),errorHandler:B}=t;Bt=B;var W=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),z=!R||window.parent===window,P=!1;if(!z)try{window.parent.document&&(P=!1)}catch(t){P=!0}if(z&&!e)throw new Error("emit function is required");if(!z&&!P)return()=>{};void 0!==C&&void 0===k.mousemove&&(k.mousemove=C),Oe.reset();var U,j=!0===v?{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}:void 0!==p?p:{password:!0},q=ct(void 0!==m&&m);!function(t){void 0===t&&(t=window),"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();var H,G,V=0,Z=new Map,J=t=>{for(var e of F||[])e.eventProcessor&&(t=e.eventProcessor(t));return b&&!P&&(t=b(t)),t};we=(t,r)=>{var s,a=t;if(a.timestamp=bt(),!(null==(s=Ht[0])?void 0:s.isFrozen())||a.type===o.FullSnapshot||a.type===o.IncrementalSnapshot&&a.data.source===u.Mutation||Ht.forEach((t=>t.unfreeze())),z)null==e||e(J(a),r);else if(P){var l={type:"rrweb",event:J(a),origin:window.location.origin,isCheckout:r};window.parent.postMessage(l,"*")}if(a.type===o.FullSnapshot)U=a,V=0;else if(a.type===o.IncrementalSnapshot){if(a.data.source===u.Mutation&&a.data.isAttachIframe)return;V++,(n&&V>=n||i&&a.timestamp-U.timestamp>i)&&be(!0)}};var Q=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,i=new Set;if(t.adds.length>0)for(var n of t.adds){var s=Oe.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}t.removes.forEach((t=>{var{id:r}=t;if(!e||!e.has(r)){var n=tt.getIframeElementById(r);n&&i.has(n)?tt.forgetIframeId(r):(null==H||H(r),tt.removeIframeById(r))}})),null==G||G(),tt.cleanupDetachedIframes()}we({type:o.IncrementalSnapshot,data:r({source:u.Mutation},t)})},X=t=>we({type:o.IncrementalSnapshot,data:r({source:u.Scroll},t)}),Y=t=>we({type:o.IncrementalSnapshot,data:r({source:u.CanvasMutation},t)}),K=new Me({mutationCb:Q,adoptedStyleSheetCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},t)})}),tt=new se({mirror:Oe,mutationCb:Q,stylesheetManager:K,recordCrossOriginIframes:R,wrappedEmit:we});for(var et of F||[])et.getMirror&&et.getMirror({nodeMirror:Oe,crossOriginIframeMirror:tt.crossOriginIframeMirror,crossOriginIframeStyleMirror:tt.crossOriginIframeStyleMirror});var rt=new Te;ke=new Ce({recordCanvas:T,mutationCb:Y,win:window,blockClass:s,blockSelector:a,mirror:Oe,sampling:k.canvas,dataURLOptions:W,resolutionScale:I});var it=new ae({mutationCb:Q,scrollCb:X,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:c,inlineStylesheet:f,maskInputOptions:j,dataURLOptions:W,maskTextFn:y,maskInputFn:g,recordCanvas:T,inlineImages:A,sampling:k,slimDOMOptions:q,iframeManager:tt,stylesheetManager:K,canvasManager:ke,keepIframeSrcFn:N,processedNodeManager:rt},mirror:Oe});be=function(t){if(void 0===t&&(t=!1),M){we({type:o.Meta,data:{href:window.location.href,width:It(),height:St()}},t),K.reset(),it.init(),Ht.forEach((t=>t.lock()));var e=function(t,e){var{mirror:r=new O,blockClass:i="rr-block",blockSelector:n=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:o=!0,inlineImages:u=!1,recordCanvas:l=!1,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:c,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:p,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:y,onIframeListenerRegistered:w,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:S=(()=>!1),maxDepth:I}=e||{};return dt(t,{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===h?{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}:!1===h?{password:!0}:h,maskTextFn:d,maskInputFn:c,slimDOMOptions:ct(f),dataURLOptions:v,inlineImages:u,recordCanvas:l,preserveWhiteSpace:p,onSerialize:m,onIframeLoad:g,iframeLoadTimeout:y,onIframeListenerRegistered:w,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:S,newlyAddedElement:!1,maxDepth:I})}(document,{mirror:Oe,blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:c,inlineStylesheet:f,maskAllInputs:j,maskTextFn:y,maskInputFn:g,slimDOM:q,dataURLOptions:W,recordCanvas:T,inlineImages:A,onSerialize(t){xt(t,Oe)&&tt.addIframe(t),Ot(t,Oe)&&K.trackLinkElement(t),Lt(t)&&it.addShadowRoot(_.shadowRoot(t),document)},onIframeLoad(t,e){tt.attachIframe(t,e),it.observeAttachShadow(t)},onIframeListenerRegistered(t,e){tt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){K.attachLinkElement(t,e)},keepIframeSrcFn:N});if(!e)return console.warn("Failed to snapshot the document");we({type:o.FullSnapshot,data:{node:e,initialOffset:kt(window)}},t),Ht.forEach((t=>t.unlock())),R&&tt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&K.adoptStyleSheets(document.adoptedStyleSheets,Oe.getId(document))}};try{var nt=[];H=t=>{var e=Z.get(t);e&&(e.forEach((t=>{pt(t);var e=nt.indexOf(t);-1!==e&&nt.splice(e,1)})),Z.delete(t))},G=()=>{for(var[t]of Z){var e=Oe.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==H||H(t)}catch(e){null==H||H(t)}else null==H||H(t)}};var st=t=>{var e;return qt(ee)({mutationCb:Q,mousemoveCb:(t,e)=>we({type:o.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.MouseInteraction},t)}),scrollCb:X,viewportResizeCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.ViewportResize},t)}),inputCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.Input},t)}),mediaInteractionCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.MediaInteraction},t)}),styleSheetRuleCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.StyleSheetRule},t)}),styleDeclarationCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.StyleDeclaration},t)}),canvasMutationCb:Y,fontCb:t=>we({type:o.IncrementalSnapshot,data:r({source:u.Font},t)}),selectionCb(t){we({type:o.IncrementalSnapshot,data:r({source:u.Selection},t)})},customElementCb(t){we({type:o.IncrementalSnapshot,data:r({source:u.CustomElement},t)})},blockClass:s,ignoreClass:l,ignoreSelector:h,maskTextClass:d,maskTextSelector:c,maskInputOptions:j,inlineStylesheet:f,sampling:k,recordDOM:M,recordCanvas:T,inlineImages:A,userTriggeredOnInput:L,collectFonts:E,doc:t,maskInputFn:g,maskTextFn:y,keepIframeSrcFn:N,blockSelector:a,slimDOMOptions:q,dataURLOptions:W,mirror:Oe,iframeManager:tt,stylesheetManager:K,shadowDomManager:it,processedNodeManager:rt,canvasManager:ke,ignoreCSSAttributes:D,plugins:(null==(e=null==F?void 0:F.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>we({type:o.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},w)};tt.addLoadListener((t=>{try{var e=Oe.getId(t),r=st(t.contentDocument);if(nt.push(r),-1!==e){var i=Z.get(e);i||Z.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),tt.addPageHideListener((t=>{var e=Oe.getId(t);null==H||H(e),Jt(t)}));var at=-1,ot=t=>we({type:o.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),ut=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?Oe.getId(s):-1;a!==at&&(-1!==at&&ot({id:at,enter:!1}),at=a,-1!==a&&ot({id:a,enter:!0}))},lt=()=>{be(),nt.push(st(document)),nt.push(vt("fullscreenchange",ut)),nt.push(vt("webkitfullscreenchange",ut)),nt.push(vt("mozfullscreenchange",ut)),nt.push(vt("MSFullscreenChange",ut)),Re=!0};return["interactive","complete"].includes(document.readyState)?lt():(nt.push(vt("DOMContentLoaded",(()=>{we({type:o.DomContentLoaded,data:{}}),"DOMContentLoaded"===x&&lt()}))),nt.push(vt("load",(()=>{we({type:o.Load,data:{}}),"load"===x&&lt()}),window))),()=>{nt.forEach((t=>pt(t))),rt.destroy(),tt.removeLoadListener(),tt.destroy(),Z.clear(),Oe.reset(),Re=!1,Bt=void 0}}catch(t){console.warn(t)}}Le.addCustomEvent=(t,e)=>{if(!Re)throw new Error("please add custom event after start recording");we({type:o.Custom,data:{tag:t,payload:e}})},Le.freezePage=()=>{Ht.forEach((t=>t.freeze()))},Le.takeFullSnapshot=t=>{if(!Re)throw new Error("please take full snapshot after start recording");be(t)},Le.mirror=Oe;var Ee=Object.defineProperty,Ae=(t,e,r)=>((t,e,r)=>e in t?Ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Fe{constructor(t){Ae(this,"fileName"),Ae(this,"functionName"),Ae(this,"lineNumber"),Ae(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Ne=/(^|@)\S+:\d+/,De=/^\s*at .*(\S+:\d+|\(native\))/m,Be=/^(eval@)?(\[native code])?$/,We={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(De)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error("Cannot parse given url: "+t);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter((function(t){return!!t.match(De)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new Fe({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(Be)}),this).map((function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Fe({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Fe({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Fe({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Fe({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Ne)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Fe({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function ze(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function Pe(t){return Array.isArray(t)}function Ue(t){return"object"==typeof t&&null!==t&&!Pe(t)}function $e(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(Ue(t[i])&&$e(t[i],e-1))return!0;return!1}function je(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Ue(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||Ue(a)&&$e(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=Pe(l)?ze(l.length?l[0]:null):l}return o}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e}))}var qe={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function He(t,e,r){var i,n=r?Object.assign({},qe,r):qe,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=We.parse(e.error).map((t=>t.toString())),s=[je(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[je("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[je("Uncaught (in promise)",n.stringifyOptions),je(e.reason,n.stringifyOptions)]);var s=We.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=We.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>je(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[je("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})(l);return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:l}})),e[s]=h,()=>{e[s]=l}}catch(t){return()=>{}}}(e,r):()=>{}}}var Ge="undefined"!=typeof window?window:void 0,Ve="undefined"!=typeof globalThis?globalThis:Ge;"undefined"==typeof self&&(Ve.self=Ve),"undefined"==typeof File&&(Ve.File=function(){});var Ze=null==Ve?void 0:Ve.document;null!=Ve&&Ve.XMLHttpRequest&&new Ve.XMLHttpRequest;var Je,Qe=null!=Ge?Ge:{},Xe="NativeGzipValidationError",Ye=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=Xe,e},Ke=function(){var t=e((function*(t,e){18>t.size&&Ye("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&Ye("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Je)return Je;Je=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;Je[t]=e>>>0}return Je})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&Ye("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&Ye("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function tr(){return tr=e((function*(t,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(t),s=new CompressionStream("gzip"),a=s.writable.getWriter(),o=a.write(n).then((()=>a.close())).catch(function(){var t=e((function*(t){try{yield a.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(s.readable).blob(),[l]=yield Promise.all([u,o]);return yield Ke(l,n),l}catch(t){if(null!=i&&i.rethrow)throw t;return r&&console.error("Failed to gzip compress data",t),null}})),tr.apply(this,arguments)}var er=Object.prototype,rr=er.hasOwnProperty,ir=er.toString,nr=Array.isArray||function(t){return"[object Array]"===ir.call(t)},sr=t=>"function"==typeof t,ar=t=>t===Object(t)&&!nr(t),or=t=>void 0===t,ur=t=>"[object String]"==ir.call(t),lr=t=>null===t,hr=t=>or(t)||lr(t),dr=t=>"[object Number]"==ir.call(t)&&t==t,cr=t=>"[object Boolean]"===ir.call(t),fr=t=>t instanceof FormData;function vr(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),dr(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),vr(n||r,e,r,i))}class pr{constructor(t){this.$t={},this.Gt=t.Gt,this.Zt=vr(t.bucketSize,0,100,t.Qt),this.Jt=vr(t.refillRate,0,this.Zt,t.Qt),this.Kt=vr(t.refillInterval,0,864e5,t.Qt)}Yt(t,e){var r=Math.floor((e-t.lastAccess)/this.Kt);r>0&&(t.tokens=Math.min(t.tokens+r*this.Jt,this.Zt),t.lastAccess=t.lastAccess+r*this.Kt)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.$t[i];return n?this.Yt(n,r):this.$t[i]=n={tokens:this.Zt,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.Gt)||e.call(this,t)),0===n.tokens)}stop(){this.$t={}}}var mr=t=>t instanceof Document,gr={DEBUG:!1,LIB_VERSION:"1.391.7",LIB_NAME:"web"},yr=function(t,e){var{debugEnabled:r}=void 0===e?{}:e,i={k(e){if(Ge&&(Qe.POSTHOG_DEBUG||r)&&!or(Ge.console)&&Ge.console){for(var i=("__rrweb_original__"in Ge.console[e]?Ge.console[e].__rrweb_original__:Ge.console[e]),n=arguments.length,s=new Array(n>1?n-1:0),a=1;n>a;a++)s[a-1]=arguments[a];i(t,...s)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.k("error",...e)},critical(){for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning(t){i.error("You must initialize PostHog before calling "+t)},createLogger:(e,r)=>yr(t+" "+e,r)};return i},wr=yr("[PostHog.js]"),br=wr.createLogger;function kr(t,e){if(!hr(t))if(nr(t))t.forEach(e);else if(fr(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)rr.call(t,r)&&e(t[r],r)}function Sr(t,e,r,i){var{capture:n=!1,passive:s=!0}={};null==t||t.addEventListener(e,r,{capture:n,passive:s})}var Ir=["localhost","127.0.0.1"],_r=t=>{var e=null==Ze?void 0:Ze.createElement("a");return or(e)?null:(e.href=t,e)},Cr=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return kr(t,(function(t,e){or(t)||or(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)};function Mr(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n=r(i);return sr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=n,()=>{t[e]===n&&(t[e]=i)}}catch(t){return()=>{}}}function Tr(t,e){var r,i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var Rr="$session_recording_remote_config",xr="$replay_sample_rate",Or="$replay_override_sampling",Lr="$replay_override_linked_flag",Er="$replay_override_url_trigger",Ar="$replay_override_event_trigger",Fr="$session_is_sampled",Nr="$session_past_minimum_duration",Dr="$session_recording_url_trigger_activated_session",Br="$session_recording_event_trigger_activated_session",Wr="$posthog_sr_group_event_trigger_",zr="$posthog_sr_group_url_trigger_",Pr="$posthog_sr_group_sampling_",Ur="$debug_first_full_snapshot_timestamp",$r="$sess_rec_flush_size",jr="$stored_person_properties",qr="$sdk_debug_replay_remote_trigger_matching_config",Hr=new RegExp("(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})"),Gr=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),Vr="[SessionRecording]",Zr="redacted",Jr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"]},Qr=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Xr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Yr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Kr=t=>{hr(t)||kr(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return Qr.includes(e)||Yr.some((t=>e.includes(t)))})(e)&&(t[e]=Zr)}))},ti=["/s/","/e/","/i/"];function ei(t,e,r,i){if(hr(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ur(n)&&(n=parseInt(n)),n>r?Vr+" "+i+" body too large to record ("+n+" bytes)":t}function ri(t,e){if(hr(t))return t;var r=t;return function(t,e){if(hr(t))return!1;if(ur(t)){if(t=t.trim(),Hr.test((t||"").replace(/[- ]/g,"")))return!1;if(Gr.test(t))return!1}return!0}(r)||(r=Vr+" "+e+" body "+Zr),kr(Xr,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Vr+" "+e+" body "+Zr+" as might contain: "+t)})),r}var ii=br("[Recorder]"),ni=t=>"navigation"===t.entryType,si=t=>"resource"===t.entryType;function ai(t,e){return!!e&&(cr(e)||e[t])}function oi(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var ui=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function li(t){var{type:e,recordBody:r,headers:i,url:n}=t;function s(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!oi(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(ui))return!1;if(cr(r))return!0;if(nr(r))return s(r);var a=r[e];return cr(a)?a:s(a)}function hi(t,e,r,i,n,s){return di.apply(this,arguments)}function di(){return di=e((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return ii.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(si(a=t[s])&&a.initiatorType===e&&(or(i)||a.startTime>=i)&&(or(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),hi(t,e,r,i,n,s+1))})),di.apply(this,arguments)}function ci(t){var{body:e,options:r,url:i}=t;if(hr(e))return null;var{hostname:n,isHostDenied:s}=Tr(i,r);if(s)return n+" is in deny list";if(ur(e))return e;if(mr(e))return e.textContent;if(fr(e))return Cr(e);if(ar(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var fi=t=>!lr(t)&&("navigation"===t.entryType||"resource"===t.entryType);function vi(t){var{entry:e,method:i,status:n,networkRequest:s,isInitial:a,start:o,end:u,url:l,initiatorType:h}=t;o=e?e.startTime:o,u=e?e.responseEnd:u;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(o||0)),f=[r({},e?e.toJSON():{name:l},{startTime:or(o)?void 0:Math.round(o),endTime:or(u)?void 0:Math.round(u),timeOrigin:d,timestamp:c,method:i,initiatorType:h||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:a})];if(fi(e))for(var v of e.serverTiming||[])f.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:v.name,duration:v.duration,entryType:"serverTiming"});return f}var pi=["video/","audio/"];function mi(t){return new Promise((e=>{var r=setTimeout((()=>e("[SessionReplay] Timeout while trying to read body")),500);try{t.clone().text().then((t=>e(t)),(t=>e("[SessionReplay] Failed to read body: "+t))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e("[SessionReplay] Failed to read body")}}))}function gi(){return(gi=e((function*(t){var{r:e,options:r,url:i}=t,{hostname:n,isHostDenied:s}=Tr(i,r);return s?Promise.resolve(n+" is in deny list"):mi(e)}))).apply(this,arguments)}function yi(){return(yi=e((function*(t){var{r:e,options:r,url:i}=t,n=function(t){var e,{r:r,options:i,url:n}=t;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=pi.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var{hostname:o,isHostDenied:u}=Tr(n,i);return u?o+" is in deny list":null}({r:e,options:r,url:i});return lr(n)?mi(e):Promise.resolve(n)}))).apply(this,arguments)}var wi=null;function bi(t,i,n){if(!("performance"in i))return()=>{};if(wi)return ii.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},Jr,n):Jr,a=e=>{var i=[];e.requests.forEach((t=>{var e=s.maskRequestFn(t);e&&i.push(e)})),i.length>0&&t(r({},e,{requests:i}))},o=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>ni(t)||si(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>vi({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>ni(t)||si(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>vi({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(a,i,s),u=()=>{},l=()=>{};return(s.recordHeaders||s.recordBody)&&(u=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=ai("request",r.recordHeaders),n=ai("response",r.recordHeaders),s=Mr(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d,c,f=this,v=new Request(o),p={},m={},g=f.setRequestHeader.bind(f);f.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=f.send.bind(f);f.send=t=>(li({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=ci({body:t,options:r,url:o})),d=e.performance.now(),y(t));var w=()=>{f.removeEventListener("readystatechange",b),f.removeEventListener("error",w),f.removeEventListener("abort",w),f.removeEventListener("timeout",w)},b=()=>{if(f.readyState===f.DONE){w(),c=e.performance.now();var i={};f.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),li({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=ci({body:f.response,options:r,url:o})),hi(e,"xmlhttprequest",v.url,d,c).then((e=>{var r=vi({entry:e,method:a,status:null==f?void 0:f.status,networkRequest:p,start:d,end:c,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};f.addEventListener("readystatechange",b),f.addEventListener("error",w),f.addEventListener("abort",w),f.addEventListener("timeout",w),s.call(f,a,o.toString(),u,l,h)}));return()=>{s()}}(a,i,s),l=function(t,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=ai("request",i.recordHeaders),s=ai("response",i.recordHeaders),a=Mr(r,"fetch",(a=>function(){var o=e((function*(e,o){var u,l,h,d,c=new Request(e,o),f={};try{var v={};c.headers.forEach(((t,e)=>{v[e]=t})),n&&(f.requestHeaders=v),!(ar(d=null==o?void 0:o.body)&&sr(d.getReader)&&sr(d.tee))&&li({type:"request",headers:v,url:e,recordBody:i.recordBody})&&(f.requestBody=yield function(t){return gi.apply(this,arguments)}({r:c,options:i,url:e})),l=r.performance.now(),u=oi(e)?yield a(c):yield a(e,o),h=r.performance.now();var p={};return u.headers.forEach(((t,e)=>{p[e]=t})),s&&(f.responseHeaders=p),li({type:"response",headers:p,url:e,recordBody:i.recordBody})&&(f.responseBody=yield function(t){return yi.apply(this,arguments)}({r:u,options:i,url:e})),u}finally{hi(r,"fetch",c.url,l,h).then((e=>{var r,i=vi({entry:e,method:c.method,status:null==(r=u)?void 0:r.status,networkRequest:f,start:l,end:h,url:c.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return o.apply(this,arguments)}}()));return()=>{a()}}(a,i,s)),wi=()=>{o(),u(),l(),wi=null}}var ki={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},Si={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},Ii="disabled",_i="sampled",Ci="active",Mi="buffering",Ti="paused",Ri="rrweb_error",xi="trigger",Oi=xi+"_activated",Li=xi+"_pending",Ei=xi+"_"+Ii;function Ai(t,e,r,i,n,s){return 0===e?Ei:(null==t?void 0:t.get_property(r?i+r:n))===s?Oi:Li}function Fi(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}class Ni{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(Oi)?Oi:e.includes(Li)?Li:Ei}stop(){this.u.forEach((t=>t.stop()))}}class Di{constructor(t){this.u=t}triggerStatus(t){var e=new Set;for(var r of this.u)e.add(r.triggerStatus(t));switch(e.delete(Ei),e.size){case 0:return Ei;case 1:return Array.from(e)[0];default:return Li}}stop(){this.u.forEach((t=>t.stop()))}}class Bi{triggerStatus(){return Oi}stop(){}}var Wi=t=>"sessionRecording"in t;class zi{constructor(t,e){this.Zu=[],this.Ju=[],this.Qu=new Map,this.Ku=new Map,this.th="",this.urlBlocked=!1,this._instance=t,this.eh=e}onConfig(t){var e,r;this.Zu=(Wi(t)?ar(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Ju=(Wi(t)?ar(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.rh()}rh(){for(var t of(this.Qu.clear(),this.Ku.clear(),this.Zu))if("regex"===t.matching&&!this.Qu.has(t.url))try{this.Qu.set(t.url,new RegExp(t.url))}catch(e){wr.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.Ju)if("regex"===e.matching&&!this.Ku.has(e.url))try{this.Ku.set(e.url,new RegExp(e.url))}catch(t){wr.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}ih(t){return Ai(this._instance,this.Zu.length,this.eh,zr,Dr,t)}triggerStatus(t){var e=this.ih(t),r=e===Oi?Oi:e===Li?Li:Ei;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){if(void 0!==Ge&&Ge.location.href){var r=Ge.location.href;if(r!==this.th){this.th=r;var i=this.urlBlocked,n=Fi(r,this.Ju,this.Ku);i&&n||(n&&!i?t():!n&&i&&e())}}}checkUrlTriggerConditions(t,e,r,i){if(void 0!==Ge&&Ge.location.href){var n=Ge.location.href;if(n!==this.th){this.th=n;var s=this.urlBlocked,a=Fi(n,this.Ju,this.Ku);a&&!s?t():!a&&s&&e();var o=this.ih(i)===Oi,u=Fi(n,this.Zu,this.Qu);!o&&u&&r("url",n)}}}stop(){this.th=""}}class Pi{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.nh=()=>{},this._instance=t}triggerStatus(){var t=Li;return hr(this.linkedFlag)&&(t=Ei),this.linkedFlagSeen&&(t=Oi),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(Wi(t)?ar(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!hr(this.linkedFlag)&&!this.linkedFlagSeen){var i=ur(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ur(this.linkedFlag)?null:this.linkedFlag.variant;this.nh=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(ar(r)&&i in r){var a=r[i];s=cr(a)?!0===a:n?a===n:!!a}this.linkedFlagSeen=s,s&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.nh()}}class Ui{constructor(t,e){this.sh=[],this._instance=t,this.eh=e}onConfig(t){var e;this.sh=(Wi(t)?ar(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}ah(t){return Ai(this._instance,this.sh.length,this.eh,Wr,Br,t)}triggerStatus(t){var e=this.ah(t),r=e===Oi?Oi:e===Li?Li:Ei;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.sh.length){var i=this.ah(r)===Oi,n=this.sh.includes(t);!i&&n&&e("event",t)}}stop(){}}class $i{constructor(t,e,r){if(this._instance=t,this.group=e,this.oh=new zi(t,e.id),this.uh=new Ui(t,e.id),this.lh=new Pi(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.oh.onConfig(n),this.uh.onConfig(n),this.lh.onConfig(n,r);var s=[this.uh,this.oh,this.lh];this.hh="any"===e.conditions.matchType?new Ni(s):new Di(s)}else this.hh=new Bi}triggerStatus(t){return this.hh.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.uh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.oh.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?zr+this.group.id:Wr+this.group.id]:e})}stop(){this.oh.stop(),this.uh.stop(),this.lh.stop()}}function ji(t){if(t.rrwebError)return Ri;if(!t.receivedFlags)return Mi;if(!t.isRecordingEnabled)return Ii;if(t.urlTriggerMatching.urlBlocked)return Ti;var e=!0===t.isSampled,r=new Ni([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?_i:r===Oi?Ci:r===Li?Mi:!1===t.isSampled?Ii:Ci}function qi(t){if(t.rrwebError)return Ri;if(!t.receivedFlags)return Mi;if(!t.isRecordingEnabled)return Ii;if(t.urlTriggerMatching.urlBlocked)return Ti;var e=new Di([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Ei,i=cr(t.isSampled);return r&&e===Li?Mi:r&&e===Ei||i&&!t.isSampled?Ii:!0===t.isSampled?_i:Ci}function Hi(t){var e,r;return(null==(e=JSON.stringify(t,(r=[],function(t,e){if(ar(e)){for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(e)?"[Circular]":(r.push(e),e)}return e})))?void 0:e.length)||0}function Gi(t){if(lr(t))return 4;if(or(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":if(nr(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=or(i)||lr(i)?4:Gi(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];or(u)||(a||(s+=1),a=!1,s+=o.length+3+Gi(u))}return s;default:return 0}}function Vi(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[Vi({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Vi({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var Zi=Uint8Array,Ji=Uint16Array,Qi=Uint32Array,Xi=new Zi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Yi=new Zi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ki=new Zi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tn=function(t,e){for(var r=new Ji(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new Qi(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},en=tn(Xi,2),rn=en[1];en[0][28]=258,rn[258]=28;for(var nn=tn(Yi,0)[1],sn=new Ji(32768),an=0;32768>an;++an){var on=(43690&an)>>>1|(21845&an)<<1;sn[an]=((65280&(on=(61680&(on=(52428&on)>>>2|(13107&on)<<2))>>>4|(3855&on)<<4))>>>8|(255&on)<<8)>>>1}var un=function(t,e,r){for(var i=t.length,n=0,s=new Ji(e);i>n;++n)++s[t[n]-1];var a,o=new Ji(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new Ji(1<<e);var u=15-e;for(n=0;i>n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)a[sn[d]>>>u]=l}else for(a=new Ji(i),n=0;i>n;++n)a[n]=sn[o[t[n]-1]++]>>>15-t[n];return a},ln=new Zi(288);for(an=0;144>an;++an)ln[an]=8;for(an=144;256>an;++an)ln[an]=9;for(an=256;280>an;++an)ln[an]=7;for(an=280;288>an;++an)ln[an]=8;var hn=new Zi(32);for(an=0;32>an;++an)hn[an]=5;var dn=un(ln,9,0),cn=un(hn,5,0),fn=function(t){return(t/8>>0)+(7&t&&1)},vn=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof Ji?Ji:t instanceof Qi?Qi:Zi)(r-e);return i.set(t.subarray(e,r)),i},pn=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},mn=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},gn=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new Zi(0),0];if(1==n){var a=new Zi(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var f=new Ji(c+1),v=yn(r[h-1],f,0);if(v>e){i=0;var p=0,m=v-e,g=1<<m;for(s.sort((function(t,e){return f[e.s]-f[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=f[y])break;p+=g-(1<<v-f[y]),f[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>f[w]?p-=1<<e-f[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;f[b]==e&&(--f[b],++p)}v=e}return[new Zi(f),v]},yn=function(t,e,r){return-1==t.s?Math.max(yn(t.l,e,r+1),yn(t.r,e,r+1)):e[t.s]=r},wn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new Ji(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},bn=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},kn=function(t,e,r){var i=r.length,n=fn(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},Sn=function(t,e,r,i,n,s,a,o,u,l,h){pn(e,h++,r),++n[256];for(var d=gn(n,15),c=d[0],f=d[1],v=gn(s,15),p=v[0],m=v[1],g=wn(c),y=g[0],w=g[1],b=wn(p),k=b[0],S=b[1],I=new Ji(19),_=0;y.length>_;++_)I[31&y[_]]++;for(_=0;k.length>_;++_)I[31&k[_]]++;for(var C=gn(I,7),M=C[0],T=C[1],R=19;R>4&&!M[Ki[R-1]];--R);var x,O,L,E,A=l+5<<3,F=bn(n,ln)+bn(s,hn)+a,N=bn(n,c)+bn(s,p)+a+14+3*R+bn(I,M)+(2*I[16]+3*I[17]+7*I[18]);if(F>=A&&N>=A)return kn(e,h,t.subarray(u,u+l));if(pn(e,h,1+(F>N)),h+=2,F>N){x=un(c,f,0),O=c,L=un(p,m,0),E=p;var D=un(M,T,0);for(pn(e,h,w-257),pn(e,h+5,S-1),pn(e,h+10,R-4),h+=14,_=0;R>_;++_)pn(e,h+3*_,M[Ki[_]]);h+=3*R;for(var B=[y,k],W=0;2>W;++W){var z=B[W];for(_=0;z.length>_;++_)pn(e,h,D[P=31&z[_]]),h+=M[P],P>15&&(pn(e,h,z[_]>>>5&127),h+=z[_]>>>12)}}else x=dn,O=ln,L=cn,E=hn;for(_=0;o>_;++_)if(i[_]>255){var P;mn(e,h,x[257+(P=i[_]>>>18&31)]),h+=O[P+257],P>7&&(pn(e,h,i[_]>>>23&31),h+=Xi[P]);var U=31&i[_];mn(e,h,L[U]),h+=E[U],U>3&&(mn(e,h,i[_]>>>5&8191),h+=Yi[U])}else mn(e,h,x[i[_]]),h+=O[i[_]];return mn(e,h,x[256]),h+O[256]},In=new Qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_n=function(){for(var t=new Qi(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),Cn=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=_n[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},Mn=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new Zi(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=kn(u,l,t.subarray(h,d)):(u[h]=true,l=kn(u,l,t.subarray(h,a)))}else{for(var c=In[e-1],f=c>>>13,v=8191&c,p=(1<<r)-1,m=new Ji(32768),g=new Ji(p+1),y=Math.ceil(r/3),w=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<w)&p},k=new Qi(25e3),S=new Ji(288),I=new Ji(32),_=0,C=0,M=(h=0,0),T=0,R=0;a>h;++h){var x=b(h),O=32767&h,L=g[x];if(m[O]=L,g[x]=O,h>=T){var E=a-h;if((_>7e3||M>24576)&&E>423){l=Sn(t,u,0,k,S,I,C,M,R,h-R,l),M=_=C=0,R=h;for(var A=0;286>A;++A)S[A]=0;for(A=0;30>A;++A)I[A]=0}var F=2,N=0,D=v,B=O-L&32767;if(E>2&&x==b(h-B))for(var W=Math.min(f,E)-1,z=Math.min(32767,h),P=Math.min(258,E);z>=B&&--D&&O!=L;){if(t[h+F]==t[h+F-B]){for(var U=0;P>U&&t[h+U]==t[h+U-B];++U);if(U>F){if(F=U,N=B,U>W)break;var j=Math.min(B,U-2),q=0;for(A=0;j>A;++A){var H=h-B+A+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,L=H)}}}B+=(O=L)-(L=m[O])+32768&32767}if(N){k[M++]=268435456|rn[F]<<18|nn[N];var V=31&rn[F],Z=31&nn[N];C+=Xi[V]+Yi[Z],++S[257+V],++I[Z],T=h+F,++_}else k[M++]=t[h],++S[t[h]]}}l=Sn(t,u,true,k,S,I,C,M,R,h-R,l)}return vn(o,0,i+fn(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Tn=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Rn=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Tn(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},xn=function(t){return 10+(t.filename&&t.filename.length+1||0)};function On(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Ln{constructor(t,e){var r,i;void 0===e&&(e={}),this.dh={},this.fh=t=>{if(!this.dh[t]){var e,r;this.dh[t]=!0;var i=this.ph(t);null==(e=(r=this.mh).onBlockedNode)||e.call(r,t,i)}},this.gh=t=>{var e=this.ph(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.ph=t=>this._rrweb.mirror.getNode(t),this.yh=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this.yh(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var[e]=this.gh(t.id);return!this.ba.consumeRateLimit(e)&&t})));var i=this.yh(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.mh=e,this.ba=new pr({bucketSize:null!==(r=this.mh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.mh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,Gt:this.fh,Qt:wr})}reset(){this.dh={}}stop(){this.ba.stop(),this.reset()}}class En{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.wh=t.get_property.bind(t),this.bh=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.bh($r,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.wh($r);return ar(e=r)&&ur(e.sessionId)&&dr(e.size)&&r.sessionId===t?r.size:0}}function An(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100<vr(100*e,0,100,wr)}var Fn=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Nn={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Fn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Fn(e,t))))),icontains:(t,e)=>e.map(Dn).some((e=>t.map(Dn).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Dn).every((e=>t.map(Dn).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r<parseFloat(t)))}))},Dn=t=>t.toLowerCase(),Bn=new Set(["is_not","not_icontains","not_regex"]);function Wn(t,e,r){return!t||0===t.length||t.every((t=>{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(or(n)||lr(n))return Bn.has(s);var a=Nn[s];return!!a&&!or(t.value)&&!lr(t.value)&&a(nr(t.value)?t.value.map(String):[String(t.value)],nr(n)?n.map(String):[String(n)])}))}var zn=br("[SessionRecording]");function Pn(t,e){return e?t:"!"+t}function Un(t,e){return t===e||t!=="!"+e&&null}class $n{constructor(t,e,r,i,n,s){this.kh=null,this.Sh=qi,this._instance=t,this.oh=e,this.uh=r,this.lh=i,this.Ih=n,this._h=s}onRemoteConfig(t){this.kh=dr(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ch=new Ni([this.uh,this.oh]),this.Sh=ji):(this.Ch=new Di([this.uh,this.oh]),this.Sh=qi),this._instance.register_for_session({[qr]:t.triggerMatchType}),this.oh.onConfig(t),this.uh.onConfig(t),this.lh.onConfig(t,((t,e)=>{this.Ih("linked_flag_matched",{flag:t,variant:e})}))}getStatus(t){return this.Sh({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return dr(r)?r:null}checkUrlTriggers(t,e,r,i){this.oh.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.uh.sh.length&&hr(this.Mh))return this.Mh=t((t=>{try{this.uh.checkEventTriggerConditions(t.event,r,e)}catch(t){zn.error("Could not activate event trigger",t)}})),this.Mh}makeSamplingDecisions(t){var e,r,i,n=this.kh;if(!dr(n))return null==(r=this._instance.persistence)||r.unregister(Fr),void(null==(i=this._instance.persistence)||i.unregister(xr));var s=this._instance.get_property(Fr),a=this._instance.get_property(xr),o=Un(s,t),u=dr(a)&&a!==n,l=or(a)&&s===t,h=u||l||!cr(o),d=h?An(t,n):o;h&&(d?this.Ih("sampled"):zn.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[Fr]:Pn(t,d),[xr]:lr(a)&&s===t?null:n})}ensureSamplingDecision(t){if(dr(this.kh)){var e=this._instance.get_property(Fr);cr(Un(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(Br),null==(e=this._instance.persistence)||e.unregister(Dr),null==(r=this._instance.persistence)||r.unregister(Fr),null==(i=this._instance.persistence)||i.unregister(xr),null==(n=this._instance.persistence)||n.unregister(Nr)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this.Ch)?void 0:e.triggerStatus(t))===Li}stop(){var t;null==(t=this.Mh)||t.call(this),this.Mh=void 0,this.uh.stop(),this.oh.stop(),this.lh.stop()}}class jn{constructor(t,e,r,i){this.Th=[],this.Rh=new Map,this.xh=!1,this._instance=t,this.oh=e,this.Ih=r,this.Oh=i}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Lh(t.triggerGroups),this._instance.register_for_session({[qr]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.oh.onConfig(t)):zn.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Ri;if(t.urlTriggerMatching.urlBlocked)return Ti;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return Ii;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Oi){var o=s.group.id,u=r.get(o);or(u)?wr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Li&&(i=!0)}return n?_i:i?Mi:Ii}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Th,triggerGroupSamplingResults:this.Rh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Th)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;dr(i)&&(lr(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.oh.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Eh(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t))}),t)};for(var a of this.Th)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Mh=t((t=>{var r;if(this.xh)return zn.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Mh)||r.call(this),void(this.Mh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Eh(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(jr);s.some((e=>!e.properties||0===e.properties.length||Wn(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e))}}),e)};for(var s of this.Th)n(s)}catch(t){zn.error("Could not activate event trigger for trigger groups",t)}})),this.Mh}makeSamplingDecisions(t){for(var e of this.Th){var r,i=e.group,n=i.id,s=i.sampleRate,a=Pr+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(ar(o)){var c=o.sessionId,f=o.sampleRate,v=o.sampled;l="string"==typeof c&&c!==t,h=dr(f)&&f!==s,u=c===t&&dr(f)&&f===s&&cr(v)?v:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!cr(u),m=p?An(t+n,s):u;p&&this.Oh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Rh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.xh=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(Fr),null==(e=this._instance.persistence)||e.unregister(xr),null==(r=this._instance.persistence)||r.unregister(Nr),this.Th)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(Wr+o),null==(s=this._instance.persistence)||s.unregister(zr+o),null==(a=this._instance.persistence)||a.unregister(Pr+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Th){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Rh.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Th)if(e.triggerStatus(t)===Li)return!0;return!1}stop(){var t;null==(t=this.Mh)||t.call(this),this.Mh=void 0,this.Th.forEach((t=>t.stop())),this.Th=[],this.Rh.clear(),this.oh.stop()}Eh(t,e){var r=t.group.conditions.properties;return!r||0===r.length||Wn(r,e,this._instance.get_property(jr))}Lh(t){var e=this;this.Th.forEach((t=>t.stop())),this.Th=[],this.Rh.clear();var r=function(t){var r=new $i(e._instance,t,((r,i)=>{e.Ih("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name})}));e.Th.push(r)};for(var i of t)r(i)}}function qn(t){return ar(t)?t.network_timing:t}var Hn,Gn,Vn="[SessionRecording]",Zn=br(Vn),Jn=[Si.MouseMove,Si.MouseInteraction,Si.Scroll,Si.ViewportResize,Si.Input,Si.TouchMove,Si.MediaInteraction,Si.Drag],Qn=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Xn(){var t;return null==Qe||null==(t=Qe.__PosthogExtensions__)?void 0:t.rrweb}function Yn(){var t;return null==(t=Xn())?void 0:t.record}function Kn(t){return On(function(t,e){void 0===e&&(e={});var r=Cn(),i=t.length;r.p(t);var n=Mn(t,e,xn(e),8),s=n.length;return Rn(n,e),Tn(n,s-8,r.d()),Tn(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Zi(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new Zi(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return vn(i,0,n)}(JSON.stringify(t))))}function ts(t){return es.apply(this,arguments)}function es(){return es=e((function*(t){var e=JSON.stringify(t),r=yield function(t,e,r){return tr.apply(this,arguments)}(e,gr.DEBUG,{rethrow:!0});return On(new Uint8Array(yield r.arrayBuffer()))})),es.apply(this,arguments)}var rs="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,is=!1;function ns(t){return nr(t)&&0===t.length?Hn=null!=Hn?Hn:Kn([]):Kn(t)}function ss(t){return as.apply(this,arguments)}function as(){return(as=e((function*(t){return nr(t)&&0===t.length?Hn||(Gn=null!=Gn?Gn:ts([]).then((t=>(Hn=t,t))).catch((t=>{throw Hn=void 0,Gn=void 0,t}))):ts(t)}))).apply(this,arguments)}function os(t){return rs&&!is&&function(t){return t.type===ki.FullSnapshot||t.type===ki.IncrementalSnapshot&&(t.data.source===Si.Mutation||t.data.source===Si.StyleSheetRule)}(t)}function us(t){return{event:t,size:Gi(t)}}function ls(t,e){return r({},t,{data:e,cv:"2024-10"})}function hs(t,e){return r({},t,{cv:"2024-10",data:r({},t.data,e)})}function ds(t){try{if(t.type===ki.FullSnapshot)return us(ls(t,Kn(t.data)));if(t.type===ki.IncrementalSnapshot&&t.data.source===Si.Mutation)return us(hs(t,{texts:ns(t.data.texts),attributes:ns(t.data.attributes),removes:ns(t.data.removes),adds:ns(t.data.adds)}));if(t.type===ki.IncrementalSnapshot&&t.data.source===Si.StyleSheetRule)return us(hs(t,{adds:t.data.adds?Kn(t.data.adds):void 0,removes:t.data.removes?Kn(t.data.removes):void 0}))}catch(t){Zn.error("could not compress event - will use uncompressed event",t)}return{event:t,size:Hi(t)}}function cs(){return(cs=e((function*(t){try{if(t.type===ki.FullSnapshot)return us(ls(t,yield ts(t.data)));if(t.type===ki.IncrementalSnapshot&&t.data.source===Si.Mutation){var[e,r,i,n]=yield Promise.all([ss(t.data.texts),ss(t.data.attributes),ss(t.data.removes),ss(t.data.adds)]);return us(hs(t,{texts:e,attributes:r,removes:i,adds:n}))}if(t.type===ki.IncrementalSnapshot&&t.data.source===Si.StyleSheetRule){var[s,a]=yield Promise.all([t.data.adds?ts(t.data.adds):void 0,t.data.removes?ts(t.data.removes):void 0]);return us(hs(t,{adds:s,removes:a}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===Xe})(e)&&(is=!0),Zn.error("could not compress event asynchronously - trying synchronous compression",e),ds(t)}return{event:t,size:Hi(t)}}))).apply(this,arguments)}function fs(t,e){return t.type===ki.Custom&&t.data.tag===e}function vs(t){return fs(t,"sessionIdle")}function ps(t){return fs(t,"$session_ending")}function ms(t){return fs(t,"$session_starting")}class gs{get sessionId(){return this.un}get Ah(){if(!this._instance.sessionManager)throw new Error(Vn+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Fh(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Nh(){return Un(this._instance.get_property(Fr),this.sessionId)}get kh(){var t,e=null==(t=this.fl)?void 0:t.sampleRate;return dr(e)?e:null}get Dh(){var t,e;return null!==(t=null==(e=this.Bh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.Wh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.zh=void 0,this.Ph=Date.now(),this.Uh=!1,this.$h=[],this.jh="unknown",this.qh=!1,this.Hh=!1,this.Gh=!1,this.Vh=[],this.Zh=[],this.Jh=0,this.Qh=0,this.Xh=!1,this.Yh=void 0,this.Mh=void 0,this.Kh=void 0,this.td=void 0,this.ed=void 0,this.Zi=(t,e,r)=>{var i,n,s;if(r&&(t!==this.un||e!==this.ln)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.un,l=this.ln;o&&this.Oh("$session_ending",{currentSessionId:u,currentWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph,flushed_size:null==(a=this.rd)?void 0:a.currentTrackedSize(u)}),null==(i=this._instance.persistence)||i.unregister(Ur),this.Gh=!1,null==(n=Xn())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.Oh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.nd(),!0!==this.jh&&this.isStarted||(this.jh="unknown",this.stop(),this.start("session_id_changed")),o&&this.Oh("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph}),null==(s=this.Bh)||s.makeSamplingDecisions(t)}},this.sd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[Nr])===this.un},this.ad=()=>{var t,e;if(0===this.R.data.length)return null;var r=null==(t=this.R.data[0])?void 0:t.timestamp,i=null==(e=this.R.data[this.R.data.length-1])?void 0:e.timestamp;return dr(r)&&dr(i)?i-r:null},this.od=()=>{var t,e,r=this.Dh;if(!dr(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.ud;return dr(i)&&i>=0&&r>i}if(this.sd())return!1;var n,s=this.ad();return!!lr(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Nr]:this.un}),!1)},this.ld=()=>{this.status!==Mi?(this.hd(),this.dd()):this.fd()},this.vd=()=>{this.Oh("browser offline",{})},this.pd=()=>{this.Oh("browser online",{})},this.Pt=()=>{null!=Ze&&Ze.visibilityState&&this.Oh("window "+Ze.visibilityState,{})},this._instance=t;var{sessionId:e,windowId:r}=this.Ah.checkAndGetSessionAndWindowId();this.un=e,this.ln=r,this.lh=new Pi(this._instance),this.oh=new zi(this._instance),this.uh=new Ui(this._instance),this.R=this.fd(),this.Ah.sessionTimeoutMs>this.Fh||Zn.warn("session_idle_threshold_ms ("+this.Fh+") is greater than the session timeout ("+this.Ah.sessionTimeoutMs+"). Session will never be detected as idle"),this.rd=new En(this._instance)}get md(){var t,e,r,i,n,s,a,o=null==(t=this.fl)?void 0:t.masking,u={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector},l=null!==(n=null==u?void 0:u.maskAllInputs)&&void 0!==n?n:null==o?void 0:o.maskAllInputs,h=null!==(s=null==u?void 0:u.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,d=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return or(l)&&or(h)&&or(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}get gd(){var t;return vr(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,br("canvas recording resolution scale"),1)}get yd(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.fl)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:vr(h,0,12,br("canvas recording fps"),4),quality:vr(d,0,1,br("canvas recording quality"),.4)}}get wd(){var t,e=!(null==(t=this.fl)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get bd(){var t,e,r,i=null==(t=this.fl)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=qn(this._instance.config.capture_performance),u=qn(null==i?void 0:i.capturePerformance),l=!!(cr(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}kd(){var t,e,i=[],n=null==(t=Qe.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.wd&&i.push(n());var s,a,o,u,l,h,d,c,f,v,p,m=null==(e=Qe.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.bd&&sr(m)&&(!Ir.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(m((l={payloadSizeLimitBytes:Jr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Jr.performanceEntryTypeToObserve],payloadHostDenyList:[...(a=this.bd).payloadHostDenyList||[],...Jr.payloadHostDenyList]},h=!1!==(s=this._instance.config).session_recording.recordHeaders&&a.recordHeaders,d=!1!==s.session_recording.recordBody&&a.recordBody,c=!1!==s.capture_performance&&a.recordPerformance,u=Math.min(1e6,null!==(o=l.payloadSizeLimitBytes)&&void 0!==o?o:1e6),f=t=>(null!=t&&t.requestBody&&(t.requestBody=ei(t.requestBody,t.requestHeaders,u,"Request")),null!=t&&t.responseBody&&(t.responseBody=ei(t.responseBody,t.responseHeaders,u,"Response")),t),v=t=>{return f(((t,e)=>{var r,i=_r(t.name),n=0===e.indexOf("http")?null==(r=_r(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&ti.some((t=>0===s.indexOf(t)))))return t})((Kr((e=t).requestHeaders),Kr(e.responseHeaders),e),s.api_host));var e},(p=sr(s.session_recording.maskNetworkRequestFn))&&sr(s.session_recording.maskCapturedNetworkRequestFn)&&wr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),p&&(s.session_recording.maskCapturedNetworkRequestFn=t=>{var e=s.session_recording.maskNetworkRequestFn({url:t.name});return r({},t,{name:null==e?void 0:e.url})}),l.maskRequestFn=sr(s.session_recording.maskCapturedNetworkRequestFn)?t=>{var e,r=v(t);return r&&null!==(e=null==s.session_recording.maskCapturedNetworkRequestFn?void 0:s.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==e?e:void 0}:t=>function(t){if(!or(t))return t.requestBody=ri(t.requestBody,"Request"),t.responseBody=ri(t.responseBody,"Response"),t}(v(t)),r({},Jr,l,{recordHeaders:h,recordBody:d,recordPerformance:c,recordInitialRequests:c})))):Zn.info("NetworkCapture not started because we are on localhost.")),i}Sd(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}Id(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.$h.length?this.$h.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Zn.warn("could not emit queued rrweb event.",e,t),!1}}Oh(t,e){return this.Id(Qn((()=>Yn().addCustomEvent(t,e))))}_d(){try{if(this._instance.config.capture_pageview||!Ge)return;var t=new URL(Ge.location.href),e=this.Sd(t.origin+t.pathname+t.search);this.Cd!==e&&(this.Cd=e,this.Oh("$url_changed",{href:e}))}catch(t){}}Md(){if(this.$h.length){var t=[...this.$h];this.$h=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Id(t)}))}}_h(){return this.Id(Qn((()=>Yn().takeFullSnapshot())))}get Td(){var t,e,r;return null!=(t=this.Bh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)?6e4:null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Rd(){if(this.xd&&clearInterval(this.xd),!0!==this.jh){var t=this.Td;t&&(this.xd=setInterval((()=>{this._h()}),t))}}Od(){this.oh.urlBlocked||(this.oh.urlBlocked=!0,clearInterval(this.xd),Zn.info("recording paused due to URL blocker"),this.Oh("recording paused",{reason:"url blocker"}))}Ld(){this.oh.urlBlocked&&(this.oh.urlBlocked=!1,this._h(),this.Rd(),this.Oh("recording resumed",{reason:"left blocked url"}),Zn.info("recording resumed"))}Ed(t,e){var r;if(!this.Uh&&null!=(r=this.Bh)&&r.hasPendingTriggers(this.sessionId)){this.Uh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?Dr:Br]:this.sessionId}),null==(n=this.Bh)||n.updateActiveTriggers(this.sessionId),this.dd(),this.Ih(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Uh=!1}}}get isStarted(){return!!this.zh}get fl(){var t=this._instance.get_property(Rr);if(t){var e;try{e=ar(t)?t:JSON.parse(t)}catch(t){return void Zn.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Zn.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(Rr))}return e}}Ad(t,e,r){this._instance.get_property(t)&&(e(),r())}start(t){var e,r,i=this.fl;if(i){this.Xh&&(this.Fd(),this.fd());var{sessionId:n,windowId:s}=this.Ah.checkAndGetSessionAndWindowId();this.un=n,this.ln=s,null==(e=this._instance.persistence)||e.unregister(Ur),null!=i&&i.endpoint&&(this.Wh=null==i?void 0:i.endpoint),this.Bh=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new jn(this._instance,this.oh,this.Ih.bind(this),this.Oh.bind(this)):new $n(this._instance,this.oh,this.uh,this.lh,this.Ih.bind(this),this._h.bind(this)),this.Bh.onRemoteConfig(i),null==(r=this.Mh)||r.call(this),this.Mh=this.Bh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.Ed(t,e))),this.Ad(Or,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Or)})),this.Ad(Lr,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Lr)})),this.Ad(Ar,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Ar)})),this.Ad(Er,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Er)})),this.Bh.makeSamplingDecisions(this.sessionId),this.Nd(),this.qh||(Sr(Ge,"beforeunload",this.ld),Sr(Ge,"offline",this.vd),Sr(Ge,"online",this.pd),Sr(Ge,"visibilitychange",this.Pt),this.Kh||(this.Kh=this.Ah.onSessionId(this.Zi)),this.td||(this.td=this.Ah.on("forcedIdleReset",(()=>{this.nd(),this.jh="unknown",this.stop(),this.ed=this.Ah.onSessionId(((t,e,r)=>{var i;null==(i=this.ed)||i.call(this),this.ed=void 0,this.Zi(t,e,r)}))}))),hr(this.Yh)&&(this.Yh=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Sd(null==t?void 0:t.properties.$current_url):"";if(!e)return;this.Oh("$pageview",{href:e})}}catch(t){Zn.error("Could not add $pageview to rrweb session",t)}}))),this.status===Ci&&this.Ih(t||"recording_initialized"))}else Zn.info("remote config must be stored in persistence before recording can start")}Dd(){var t,e,r,i,n,s;null==Ge||Ge.removeEventListener("beforeunload",this.ld),null==Ge||Ge.removeEventListener("offline",this.vd),null==Ge||Ge.removeEventListener("online",this.pd),null==Ge||Ge.removeEventListener("visibilitychange",this.Pt),clearInterval(this.xd),this.Bd(),null==(t=this.Yh)||t.call(this),this.Yh=void 0,null==(e=this.Mh)||e.call(this),this.Mh=void 0,null==(r=this.Kh)||r.call(this),this.Kh=void 0,null==(i=this.td)||i.call(this),this.td=void 0,null==(n=this.ed)||n.call(this),this.ed=void 0,null==(s=this.Bh)||s.stop(),this.Wd(),this.Fd()}Fd(){this.Qh+=1,this.Zh=[],this.Jh=0,this.zd=void 0,this.Xh=!1}Wd(){var t,e;null==(t=this.Pd)||t.stop(),this.$h=[],null==(e=this.zh)||e.call(this),this.zh=void 0}Ud(){if(!this.zd||0===this.Jh)return!1;if(this.Xh)return!0;this.Xh=!0;var t=this.Qh;return this.Bd(),this.Wd(),this.zd.catch((()=>{})).then((()=>{t===this.Qh&&(this.Xh=!1,this.dd(),this.fd(),this.Dd(),Zn.info("stopped"))})).catch((()=>{this.Xh=!1,this.Dd(),Zn.info("stopped")})),!0}stop(){this.Ud()||(this.dd(),this.fd(),this.Dd(),Zn.info("stopped"))}discard(){this.fd(),this.Dd(),Zn.info("discarded")}$d(t,e,r,i,n){var s,a={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};t.type===ki.FullSnapshot&&null!=(s=Xn())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this.Gh=!0),this.status!==Ii?this.jd(a):this.fd()}qd(t){t.counted&&t.generation===this.Qh&&(this.Jh=Math.max(0,this.Jh-1)),t.counted=!1,this.Zh=this.Zh.filter((e=>e!==t))}Hd(t,e,r){t.processed||t.generation!==this.Qh||(t.processed=!0,this.$d(t.event,e,r,t.targetSessionId,t.targetWindowId))}Gd(t){try{var{event:e,size:r}=t.compressionEnabled?ds(t.event):{event:t.event,size:Hi(t.event)};this.Hd(t,e,r)}finally{this.qd(t)}}hd(){[...this.Zh].forEach((t=>{this.Gd(t)}))}Vd(t,r,i,n){var s=this,a={event:t,compressionEnabled:r,targetSessionId:i,targetWindowId:n,generation:this.Qh,processed:!1,counted:!0};this.Zh.push(a),this.Jh+=1;var o=function(){var i=e((function*(){try{if(a.processed)return;var{event:e,size:i}=r?os(t)?yield function(t){return cs.apply(this,arguments)}(t):ds(t):{event:t,size:Hi(t)};s.Hd(a,e,i)}finally{s.qd(a)}}));return function(){return i.apply(this,arguments)}}();this.zd=this.zd?this.zd.catch((()=>{})).then(o):o()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.Md(),t&&ar(t))){if(t.type===ki.Meta){var u=this.Sd(t.data.href);if(this.Cd=u,!u)return;t.data.href=u}else this._d();if(null==(e=this.Bh)||e.checkUrlTriggers(this.sessionId,(()=>this.Od()),(()=>this.Ld()),((t,e)=>this.Ed(t,e))),!this.oh.urlBlocked||(l=t).type===ki.Custom&&"recording paused"===l.data.tag){var l,h,d;t.type===ki.FullSnapshot&&(this.Rd(),null==(h=this.Pd)||h.reset(),null==(d=this._instance.persistence)||d.register_once({[Ur]:t.timestamp},void 0)),t.type===ki.FullSnapshot&&null!=(r=this.Bh)&&r.hasPendingTriggers(this.sessionId)&&this.Zd();var c=this.Pd?this.Pd.throttleMutations(t):t;if(c){var f=function(t){var e=t;if(e&&ar(e)&&6===e.type&&ar(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(c),v=function(t){return ps(t)?t.data.payload:null}(f),p=function(t){return ms(t)?t.data.payload:null}(f);if(v||p){var m=null!=v?v:p;null!=m&&m.lastActivityTimestamp&&(f.timestamp=m.lastActivityTimestamp)}else this.Jd(f);t.type===ki.FullSnapshot&&(this.Vh.push([this.un,t.timestamp]),this.Vh.length>6&&(this.Vh=this.Vh.slice(-6)));var g=null!==(i=null!==(n=null==v?void 0:v.currentSessionId)&&void 0!==n?n:null==p?void 0:p.nextSessionId)&&void 0!==i?i:this.un,y=null!==(s=null!==(a=null==v?void 0:v.currentWindowId)&&void 0!==a?a:null==p?void 0:p.nextWindowId)&&void 0!==s?s:this.ln;if(!0!==this.jh||function(t){return vs(t)||ps(t)||ms(t)}(f)){if(vs(f)){var w=f.data.payload;w&&(f.timestamp=w.lastActivityTimestamp+w.threshold)}var b=null===(o=this._instance.config.session_recording.compress_events)||void 0===o||o;if(this.Jh>0||b&&os(f))this.Vd(f,b,g,y);else{var{event:k,size:S}=b?ds(f):{event:f,size:Hi(f)};this.$d(f,k,S,g,y)}}}}}}get status(){return this.Bh?this.Bh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Nh,rrwebError:this.qh,urlTriggerMatching:this.oh,eventTriggerMatching:this.uh,linkedFlagMatching:this.lh,remoteConfig:this.fl}):Ii}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.lh.linkedFlagSeen=!0,this._h(),this.Ih("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[Fr]:this.sessionId,[xr]:null}),this._h(),this.Ih("sampling_overridden")}overrideTrigger(t){this.Ed(t)}Bd(){this.Qd&&(clearTimeout(this.Qd),this.Qd=void 0)}dd(){var t;this.Bd(),null==(t=this.Bh)||t.ensureSamplingDecision(this.sessionId);var e,r=this.od();return this.status===Mi||this.status===Ti||this.status===Ii||r?(this.Qd=setTimeout((()=>{this.dd()}),2e3),this.R):(this.R.data.length>0&&(Vi(this.R).forEach((t=>{var e;null==(e=this.rd)||e.trackSize(t.sessionId,t.size),this.Xd({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:gr.LIB_NAME,$lib_version:gr.LIB_VERSION})})),null==(e=this.Bh)||e.onFlushComplete()),this.fd())}jd(t){var e,r=2+((null==(e=this.R)?void 0:e.data.length)||0),i=t.$session_id;this.jh||943718.4>=this.R.size+t.$snapshot_bytes+r&&this.R.sessionId===i||(this.R=this.dd(),this.R.sessionId=i,this.R.windowId=t.$window_id),this.R.size+=t.$snapshot_bytes,this.R.data.push(t.$snapshot_data),this.R.sizes.push(t.$snapshot_bytes),this.Qd||this.jh||(this.Qd=setTimeout((()=>{this.dd()}),2e3))}Xd(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.Wh),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get ud(){var t,e,r=null==(t=this.R)?void 0:t.data[(null==(e=this.R)?void 0:e.data.length)-1],{sessionStartTimestamp:i}=this.Ah.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}Zd(){if(!this.R||0===this.R.data.length)return this.fd();for(var t=-1,e=this.R.data.length-1;e>=0;e--)if(this.R.data[e].type===ki.Meta){t=e;break}return 0>t?this.fd():(this.R.data=this.R.data.slice(t),this.R.sizes=this.R.sizes.slice(t),this.R.size=this.R.sizes.reduce(((t,e)=>t+e),0),this.R)}fd(){return this.R={size:0,data:[],sizes:[],sessionId:this.un,windowId:this.ln},this.R}Ih(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Zn.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Oh("$recording_started",r({reason:t},e))}Yd(t){var e;return 3===t.type&&-1!==Jn.indexOf(null==(e=t.data)?void 0:e.source)}Jd(t){var e=this.Yd(t);e||this.jh||t.timestamp-this.Ph>this.Fh&&(this.jh=!0,clearInterval(this.xd),this.Oh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Ph,threshold:this.Fh,bufferLength:this.R.data.length,bufferSize:this.R.size}),this.dd());var r=!1;if(e&&(this.Ph=t.timestamp,this.jh)){var i="unknown"===this.jh;this.jh=!1,i||(this.Oh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!this.jh){var{windowId:n,sessionId:s}=this.Ah.checkAndGetSessionAndWindowId(!e,t.timestamp),a=this.un!==s,o=this.ln!==n;this.ln=n,this.un=s,a||o?(this.stop(),this.start("session_id_changed")):r&&this.Rd()}}nd(){var t;null==(t=this.Bh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,{sessionStartTimestamp:e}=this.Ah.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.R.data.length,$sdk_debug_replay_internal_buffer_size:this.R.size,$sdk_debug_current_session_duration:this.ud,$sdk_debug_session_start:e,$sdk_debug_replay_flushed_size:null==(t=this.rd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Vh,$snapshot_max_depth_exceeded:this.Gh,$sdk_debug_replay_rrweb_error:this.qh,$sdk_debug_rrweb_attached:!!this.zh,$sdk_debug_rrweb_start_attempted:this.Hh}}Nd(){var t;if(!this.zh){this.Hh=!0;var e,i,n,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this._instance.config.session_recording;for(var[o,u]of Object.entries(a||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=r({password:!0},u):s[o]=u);this.yd&&this.yd.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.yd.fps},s.dataURLOptions={type:"image/webp",quality:this.yd.quality},s.canvasResolutionScale=this.gd),this.md&&(s.maskAllInputs=null===(e=this.md.maskAllInputs)||void 0===e||e,s.maskTextSelector=null!==(i=this.md.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(n=this.md.blockSelector)&&void 0!==n?n:void 0);var l=Yn();if(l){this.Pd=null!==(t=this.Pd)&&void 0!==t?t:new Ln(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Zn.info(r,{node:e}),this.log(Vn+" "+r,"warn")}});var h=this.kd();if(this.zh=l(r({emit:t=>{this.onRRwebEmit(t)},plugins:h},s)),!this.zh)return this.qh=!0,void Zn.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.qh=!1,this.Ph=Date.now(),this.jh=cr(this.jh)?this.jh:"unknown",this.tryAddCustomEvent("$remote_config_received",this.fl),this.Oh("$session_options",{sessionRecordingOptions:s,activePlugins:h.map((t=>null==t?void 0:t.name))}),this.Oh("$posthog_config",{config:this._instance.config})}else Zn.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.Oh(t,e)}}Qe.__PosthogExtensions__=Qe.__PosthogExtensions__||{},Qe.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:He,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:bi,options:t})},Qe.__PosthogExtensions__.rrweb={record:Le,version:"v2",wasMaxDepthReached:()=>ht,resetMaxDepthState(){ht=!1,lt=!1}},Qe.__PosthogExtensions__.initSessionRecording=t=>new gs(t)}();
2
2
  //# sourceMappingURL=posthog-recorder.js.map