posthog-js 1.407.7 → 1.407.8

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||{}),v=(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))(v||{}),f={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 f?f[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");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?((u=navigator.userAgent).includes("Safari")&&!u.includes("Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),m[t]=d):r}catch(t){return r}finally{!l&&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 _(){return g("MutationObserver").constructor}function S(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t[e];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else t[e]=n.next}}catch(t){return()=>{}}}var I={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:_,patch:S};function M(t){return t.nodeType===t.ELEMENT_NODE}function C(t){var e=t&&"host"in t&&"mode"in t&&I.host(t)||null;return Boolean(e&&"shadowRoot"in e&&I.shadowRoot(e)===t)}function x(t){return"[object ShadowRoot]"==={}.toString.call(t)}function T(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=>R(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 R(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=T(t.styleSheet)||function(t){var e=t.cssText;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 B(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?B(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))),M(t)){var r=I.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 A(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&E(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function E(t){return t.toLowerCase()}var N="__rrweb_original__";function L(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?E(e):null}catch(t){return null}}var F=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,D=/^(?:[a-z+]+:)?\/\//i,P=/^www\..*/i,W=/^(data:)([^,]*),(.*)/i;function B(t,e){return(t||"").replace(F,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(D.test(u)||P.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 U,z,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?B(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(I.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&it(I.parentNode(t),e,r)}function nt(t,e,r,i){var n;if(M(t)){if(!I.childNodes(n=t).length)return!1}else{if(null===I.parentElement(t))return!1;n=I.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}function st(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var at=new Map;function ot(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function ut(t){return null==t?"":t.toLowerCase()}var lt=50,ht=!1,dt=!1;function ct(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,f=void 0===c?{}:c,p=e.maskTextFn,m=e.maskInputFn,g=e.slimDOMOptions,y=e.dataURLOptions,w=void 0===y?{}:y,b=e.inlineImages,k=void 0!==b&&b,_=e.recordCanvas,S=void 0!==_&&_,R=e.onSerialize,O=e.onIframeLoad,F=e.iframeLoadTimeout,D=void 0===F?5e3:F,P=e.onIframeListenerRegistered,W=e.onStylesheetLoad,j=e.stylesheetLoadTimeout,q=void 0===j?5e3:j,H=e.keepIframeSrcFn,J=void 0===H?()=>!1:H,Q=e.newlyAddedElement,X=void 0!==Q&&Q,Y=e.depth,tt=void 0===Y?0:Y,it=e.maxDepth,vt=void 0===it?lt:it,ft=e.needsMask,pt=e.preserveWhiteSpace,mt=void 0===pt||pt;if(tt>=vt)return dt=!0,ht||(ht=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+vt+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;ft||(ft=nt(t,a,o,void 0===ft));var gt,yt=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,f=e.inlineImages,p=e.recordCanvas,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:v.Document,childNodes:[],compatMode:t.compatMode}:{type:v.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:v.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,a=e.doc,o=e.inlineStylesheet,u=e.maskInputOptions,l=void 0===u?{}:u,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,f=e.inlineImages,p=e.recordCanvas,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=e.rootId,b=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,e.blockClass,e.blockSelector),k=function(t){if(t instanceof HTMLFormElement)return"form";var e=E(t.tagName);return G.test(e)?"div":e}(t),_={},S=t.attributes.length,M=0;S>M;M++){var C=t.attributes[M];rt(k,C.name)||(_[C.name]=et(a,k,E(C.name),C.value,t,c))}if("link"===k&&o){var x=t.sheet;if(!x){var R=function(t){return t.href}(t);R&&!(x=ot(a,R))&&R.includes(".css")&&(x=ot(a,window.location.origin+"/"+R.replace(window.location.href,"")))}var O=null;x&&(O=T(x)),O&&(delete _.rel,delete _.href,_._cssText=O)}if("style"===k&&t.sheet&&!(t.innerText||I.textContent(t)||"").trim().length){var F=T(t.sheet);F&&(_._cssText=F)}if("input"===k||"textarea"===k||"select"===k){var D=t.value,P=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&D?_.value=A({element:t,type:L(t),tagName:k,value:D,maskInputOptions:l,maskInputFn:h}):P&&(_.checked=P)}if("option"===k&&(t.selected&&!l.select?_.selected=!0:delete _.selected),"dialog"===k&&t.open)try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}if("canvas"===k&&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((N in n?n[N]: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)||(_.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){var W=t.toDataURL(c.type,c.quality),B=a.createElement("canvas");B.width=t.width,B.height=t.height,W!==B.toDataURL(c.type,c.quality)&&(_.rr_dataURL=W)}if("img"===k&&f){U||(U=a.createElement("canvas"),z=U.getContext("2d"));var j=t,q=j.currentSrc||j.getAttribute("src")||"<unknown-src>",H=j.crossOrigin,V=()=>{st(j,"load",V);try{U.width=j.naturalWidth,U.height=j.naturalHeight,z.drawImage(j,0,0),_.rr_dataURL=U.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==j.crossOrigin)return j.crossOrigin="anonymous",void(j.complete&&0!==j.naturalWidth?V():j.addEventListener("load",V));console.warn("Cannot inline img src="+q+"! Error: "+t)}"anonymous"===j.crossOrigin&&(H?_.crossOrigin=H:j.removeAttribute("crossorigin"))};j.complete&&0!==j.naturalWidth?V():j.addEventListener("load",V)}if("audio"===k||"video"===k){var Z=_;Z.rr_mediaState=t.paused?"paused":"played",Z.rr_mediaCurrentTime=t.currentTime,Z.rr_mediaPlaybackRate=t.playbackRate,Z.rr_mediaMuted=t.muted,Z.rr_mediaLoop=t.loop,Z.rr_mediaVolume=t.volume}if(y||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),b){var J=t.getBoundingClientRect(),Q=J.width,X=J.height,Y=J.left,K=J.top,tt=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);_={class:_.class,rr_width:Q+"px",rr_height:X+"px",rr_left:Math.floor(Y+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(K+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},tt&&(_.rr_position=tt.position||"static",tt.transform&&"none"!==tt.transform&&(_.rr_transform=tt.transform),tt.display&&tt.display.startsWith("inline")&&(_.rr_display=tt.display))}"iframe"!==k||m(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src);try{customElements.get(k)&&(s=!0)}catch(t){}return{type:v.Element,tagName:k,attributes:_,childNodes:[],isSVG:(it=t,Boolean("svg"===it.tagName||it.ownerSVGElement)||void 0),needBlock:b,rootId:w,isCustom:s};var it}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:c,inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:y,rootId:w});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=I.parentNode(t),o=a&&a.tagName,u=I.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=T(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=B(u,K(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,I.parentElement(t)):u.replace(/[\S]/g,"*")),{type:v.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:w});case t.CDATA_SECTION_NODE:return{type:v.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:v.Comment,textContent:I.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,dataURLOptions:w,inlineImages:k,recordCanvas:S,keepIframeSrcFn:J,newlyAddedElement:X});if(!yt)return console.warn(t,"not serialized"),null;gt=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===v.Comment)return!0;if(t.type===v.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&&(ut(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ut(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ut(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&ut(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ut(t.attributes.property).match(/^(og|twitter|fb):/)||ut(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===ut(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(ut(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(ut(t.attributes.name))||ut(t.attributes.property).match(/^article:/)||ut(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(ut(t.attributes.name)))return!0}}return!1}(yt,g)||!mt&&yt.type===v.Text&&!yt.isStyle&&!yt.textContent.replace(/^\s+|\s+$/gm,"").length?V:Z();var wt=Object.assign(yt,{id:gt});if(i.add(t,wt),gt===V)return null;R&&R(t);var bt=!l;if(wt.type===v.Element){bt=bt&&!wt.needBlock,delete wt.needBlock;var kt=I.shadowRoot(t);kt&&x(kt)&&(wt.isShadowHost=!0)}if((wt.type===v.Document||wt.type===v.Element)&&bt){g.headWhitespace&&wt.type===v.Element&&"head"===wt.tagName&&(mt=!1);var _t={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:g,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:mt,onSerialize:R,onIframeLoad:O,iframeLoadTimeout:D,onIframeListenerRegistered:P,onStylesheetLoad:W,stylesheetLoadTimeout:q,keepIframeSrcFn:J,depth:tt+1,maxDepth:vt};if(wt.type===v.Element&&"textarea"===wt.tagName&&void 0!==wt.attributes.value);else for(var St of Array.from(I.childNodes(t))){var It=ct(St,_t);It&&wt.childNodes.push(It)}var Mt=null;if(M(t)&&(Mt=I.shadowRoot(t)))for(var Ct of Array.from(I.childNodes(Mt))){var xt=ct(Ct,_t);xt&&(x(Mt)&&(xt.isShadow=!0),wt.childNodes.push(xt))}}var Tt=I.parentNode(t);if(Tt&&C(Tt)&&x(Tt)&&(wt.isShadow=!0),wt.type===v.Element&&"iframe"===wt.tagName){var Rt=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),st(t,"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?st(t,"load",a):(o=!0,st(t,"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 v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),st(t,"load",a)}}return t.addEventListener("load",a),()=>{st(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&O){var r=ct(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:g,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:mt,onSerialize:R,onIframeLoad:O,iframeLoadTimeout:D,onIframeListenerRegistered:P,onStylesheetLoad:W,stylesheetLoadTimeout:q,keepIframeSrcFn:J,depth:tt+1,maxDepth:vt});r&&O(t,r)}}),D);null==P||P(t,Rt)}return wt.type===v.Element&&"link"===wt.tagName&&"stylesheet"===wt.attributes.rel&&function(e,u,l){if(!at.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,v=!1,y=()=>{if(!v){v=!0;try{(()=>{if(W){var e=ct(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:g,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:mt,onSerialize:R,onIframeLoad:O,iframeLoadTimeout:D,onStylesheetLoad:W,stylesheetLoadTimeout:q,keepIframeSrcFn:J,depth:tt,maxDepth:vt});e&&W(t,e)}})()}finally{at.delete(e),c.abort()}}},b=setTimeout(y,l);c.signal.addEventListener("abort",(()=>clearTimeout(b)),{once:!0}),e.addEventListener("load",y,{signal:c.signal,once:!0}),at.set(e,c)}}}(t,0,q),wt}function vt(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 pt(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>mt(r,t,e,i)}function mt(t,e,r,i){gt((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function gt(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var yt="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.",wt={map:{},getId(){return console.error(yt),-1},getNode(){return console.error(yt),null},removeNodeFromMap(){console.error(yt)},has(){return console.error(yt),!1},reset(){console.error(yt)}};function bt(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 kt(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){if(setTimeout((()=>{try{r.set.call(this,t)}catch(t){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>kt(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(wt=new Proxy(wt,{get(t,e,r){return"map"===e&&console.error(yt),Reflect.get(t,e,r)}}));var _t=Date.now;function St(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=I.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=I.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function It(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Mt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ct(t){return t?t.nodeType===t.ELEMENT_NODE?t:I.parentElement(t):null}function xt(t,e,r,i){if(!t)return!1;var n=Ct(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 Tt(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===V}function Rt(t,e){if(C(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=I.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||Rt(i,e))}function Ot(t){return Boolean(t.changedTouches)}function At(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Et(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Nt(t){return!!t&&(t instanceof ft&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(I.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(_t=()=>(new Date).getTime());class Lt{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 Ft(t){var e,r=null;return"getRootNode"in t&&(null==(e=I.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(t))&&(r=I.host(I.getRootNode(t))),r}function Dt(t){var e=t.ownerDocument;return!!e&&(I.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=Ft(r);)r=e;return r}(t);return I.contains(e,r)}(t))}function Pt(t){return"__ln"in t}class Wt{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&&Pt(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&&Pt(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,$t=(t,e)=>t+"@"+e;class Ut{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 Wt,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=I.parentNode(n);if(s&&Dt(n)&&"TEXTAREA"!==s.tagName){var a=C(s)?this.mirror.getId(Ft(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=ct(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=>{At(t,this.mirror)&&this.iframeManager.addIframe(t),Et(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Nt(n)&&this.shadowDomManager.addShadowRoot(I.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)jt(this.removesSubTreeCache,s)&&!this.movedSet.has(I.parentNode(s))||n(s);for(var a of this.addedSet)qt(this.droppedSet,a)||jt(this.removesSubTreeCache,a)?qt(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(I.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 v=this.mirror.getId(I.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=I.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=I.host(f);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=I.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 e=t.attributes;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(I.childNodes(t),(t=>I.textContent(t)||"")).join("");e.attributes.value=A({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:L(t),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(t=>{if(!Tt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=I.textContent(t.target);xt(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,Ct(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=L(r);n=A({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(xt(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(xt(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=C(t.target)?this.mirror.getId(I.host(t.target)):this.mirror.getId(t.target);xt(t.target,this.blockClass,this.blockSelector,!1)||Tt(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(zt(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||Rt(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[$t(r,i)]?zt(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!C(t.target)||!x(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),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)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Tt(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[$t(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);xt(t,this.blockClass,this.blockSelector,!1)||(I.childNodes(t).forEach((t=>this.genAdds(t))),Nt(t)&&I.childNodes(I.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.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 zt(t,e){t.delete(e),I.childNodes(e).forEach((e=>zt(t,e)))}function jt(t,e,r){return 0!==t.size&&function(t,e,r){var i=I.parentNode(e);return!!i&&t.has(i)}(t,e)}function qt(t,e){return 0!==t.size&&Ht(t,e)}function Ht(t,e){var r=I.parentNode(e);return!!r&&(!!t.has(r)||Ht(t,r))}var Gt=t=>Bt?function(){try{return t(...arguments)}catch(t){if(Bt&&!0===Bt(t))return;throw t}}:t,Vt=[];function Zt(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 Jt(t,e){var r=new Ut;Vt.push(r),r.init(t);var i=new(_())(Gt(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),i.observe(e,n),{observer:i,buffer:r}}function Qt(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=Zt(t);if(a&&!xt(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=St(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=[pt("scroll",Gt(bt(Gt((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(pt("scrollend",Gt(u),r)),()=>l.forEach((t=>t()))}function Xt(t,e){for(var r=Vt.length-1;r>=0;r--){var i=Vt[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Vt.splice(r,1))}}}var Yt=["INPUT","TEXTAREA","SELECT"],Kt=new WeakMap;function te(t){return function t(e,r){if(ne("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ne("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ne("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ne("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 ee(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function re(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:I.host(e));var o="#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,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),Gt((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function ie(t,e){void 0===e&&(e={});var i,n,s=t.doc.defaultView;if(!s)return()=>{};if(function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;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),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e),t.recordDOM){var a=Jt(t,t.doc);i=a.observer,n=a.buffer}var o,d,v,f,p,m,g,y,w,b=function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;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=bt(Gt((t=>{var r=Date.now()-s;e(l.map((t=>(t.timeOffset-=r,t))),t),l=[],s=null})),o),d=Gt(bt(Gt((t=>{var e=Zt(t),r=Ot(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=_t()),l.push({x:i,y:a,id:n.getId(e),timeOffset:_t()-s}),h("undefined"!=typeof DragEvent&&t instanceof DragEvent?u.Drag:t instanceof MouseEvent?u.MouseMove:u.TouchMove)})),a,{trailing:!1})),c=[pt("mousemove",d,i),pt("touchmove",d,i),pt("drag",d,i)];return Gt((()=>{c.forEach((t=>t()))}))}(t),k=function(t){var e=t.mouseInteractionCb,i=t.doc,n=t.mirror,s=t.blockClass,a=t.blockSelector,o=t.sampling;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=Zt(i);if(!xt(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 Ot(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 v=Ot(i)?i.changedTouches[0]:i;if(v){var f=n.getId(o),p=v.clientX,m=v.clientY;Gt(e)(r({type:l[d],id:f,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(pt(o,u,i))})),Gt((()=>{d.forEach((t=>t()))}))}(t),_=Qt(t),M=function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return pt("resize",Gt(bt(Gt((()=>{var t=It(),e=Mt();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:s}),C=function(t){var e=t.inputCb,i=t.doc,n=t.mirror,s=t.blockClass,a=t.blockSelector,o=t.ignoreClass,u=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=Zt(t),r=t.isTrusted,n=i.defaultView;if(!e||!n||e instanceof n.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=I.parentElement(e)),e&&c&&Yt.indexOf(c)>=0&&!xt(e,s,a,!0)&&!(e.classList.contains(o)||u&&e.matches(u))){var f=e.value,p=!1,m=L(e)||"";"radio"===m||"checkbox"===m?p=e.checked:(l[c.toLowerCase()]||l[m])&&(f=A({element:e,maskInputOptions:l,tagName:c,type:m,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:r}:{text:f,isChecked:p});var g=e.name;"radio"===m&&g&&p&&i.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,i){var s=Kt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Kt.set(t,i);var a=n.getId(t);Gt(e)(r({},i,{id:a}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>pt(t,Gt(c),i))),p=i.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&f.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map((t=>kt(t[0],t[1],{set(){Gt(c)({target:this,isTrusted:!1})}},!1,p)))),Gt((()=>{f.forEach((t=>t()))}))}(t),x=(d=(o=t).mediaInteractionCb,v=o.blockClass,f=o.blockSelector,p=o.mirror,m=o.sampling,g=o.doc,y=Gt((t=>bt(Gt((e=>{var r=Zt(e);if(r&&!xt(r,v,f,!0)){var i=r.currentTime,n=r.volume,s=r.muted,a=r.playbackRate,o=r.loop;d({type:t,id:p.getId(r),currentTime:i,volume:n,muted:s,playbackRate:a,loop:o})}})),m.media||500))),w=[pt("play",y(c.Play),g),pt("pause",y(c.Pause),g),pt("seeked",y(c.Seeked),g),pt("volumechange",y(c.VolumeChange),g),pt("ratechange",y(c.RateChange),g)],Gt((()=>{w.forEach((t=>t()))}))),T=()=>{},R=()=>{},O=()=>{},N=()=>{};t.recordDOM&&(T=function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Gt(((t,e,s)=>{var a=s[0],o=s[1],u=ee(e,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,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:Gt(((t,e,s)=>{var a=s[0],o=ee(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,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:Gt(((t,e,s)=>{var a=s[0],o=ee(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Gt(((t,e,s)=>{var a=s[0],o=ee(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replaceSync:a}),t.apply(e,s)}))}));var h={};se("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(se("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),se("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),se("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var e=t[0],s=t[1];d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:Gt(((t,e,s)=>{var a=s[0],o=s[1],u=ee(e.parentStyleSheet,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:[...te(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:Gt(((t,e,s)=>{var a=s[0],o=ee(e.parentStyleSheet,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:[...te(e),a]}]}),t.apply(e,s)}))})})),Gt((()=>{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=t[0],r=t[1];r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:s}),R=re(t,t.doc),O=function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Gt(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2];if(n.has(l))return o.apply(e,[l,h,d]);var c=ee(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror),v=c.id,f=c.styleId;return(v&&-1!==v||f&&-1!==f)&&r({id:v,styleId:f,set:{property:l,value:h,priority:d},index:te(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:Gt(((t,e,a)=>{var o,l=a[0];if(n.has(l))return u.apply(e,[l]);var h=ee(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror),d=h.id,c=h.styleId;return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:l},index:te(e.parentRule)}),t.apply(e,a)}))}),Gt((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:s}),t.collectFonts&&(N=function(t){var e=t.fontCb,r=t.doc,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=S(r.fonts,"add",(function(t){return function(r){return setTimeout(Gt((()=>{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),Gt((()=>{n.forEach((t=>t()))}))}(t)));var F=function(t){var e=t.doc,r=t.mirror,i=t.blockClass,n=t.blockSelector,s=t.selectionCb,a=!0,o=Gt((()=>{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),d=h.startContainer,c=h.startOffset,v=h.endContainer,f=h.endOffset;xt(d,i,n,!0)||xt(v,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(v),endOffset:f})}s({ranges:o})}}));return o(),pt("selectionchange",o)}(t),D=function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?S(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t),P=[];for(var W of t.plugins)P.push(W.observer(W.callback,s,W.options));return Gt((()=>{if(n){n.destroy(),n.reset();var e=Vt.indexOf(n);-1!==e&&Vt.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==i||i.disconnect(),b(),k(),_(),M(),C(),x(),T(),R(),O(),N(),F(),D(),P.forEach((t=>t()))}))}function ne(t){return void 0!==window[t]}function se(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class ae{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 oe{constructor(t){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new ae(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 ae(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=>gt(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{mt(t.win,"pagehide",t.handler)})),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);gt((()=>{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)}))}gt((()=>{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===v.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);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(mt(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(mt(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{gt((()=>this.mirror.removeNodeFromMap(t)))})),gt((()=>Xt(r,s))),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 r=t.content;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&&mt(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{mt(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),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 ue{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){var i,n;if(x(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var s=null!==(i=null==(n=I.host(t))?void 0:n.ownerDocument)&&void 0!==i?i:e,a=Jt(r({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),o=a.observer,u=a.buffer;this.restoreHandlers.push({doc:s,handler(){o.disconnect(),u.destroy(),u.releaseCanvasManager();var t=Vt.indexOf(u);-1!==t&&Vt.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:Qt(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(I.host(t))),this.restoreHandlers.push({doc:s,handler:re({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({doc:e,handler:S(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=I.shadowRoot(this);return s&&Dt(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}for(var le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",he="undefined"==typeof Uint8Array?[]:new Uint8Array(256),de=0;64>de;de++)he[le.charCodeAt(de)]=de;var ce=new Map,ve=(t,e,r)=>{if(t&&(me(t,e)||"object"==typeof t)){var i=function(t,e){var r=ce.get(t);return r||ce.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 fe(t,e,r,i){if(t instanceof Array)return t.map((t=>fe(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+=le[r[e]>>2],n+=le[(3&r[e])<<4|r[e+1]>>4],n+=le[(15&r[e+1])<<2|r[e+2]>>6],n+=le[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}}return t instanceof DataView?{rr_type:t.constructor.name,args:[fe(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[fe(t.data,e,r,i),t.width,t.height]}:me(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ve(t,e,r)}:t}var pe=(t,e,r,i)=>t.map((t=>fe(t,e,r,i))),me=(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])))},ge=["webgl","webgl2"];function ye(t){return"nodeType"in t}function we(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 S(n.prototype,"configure",(function(n){return function(s){var a=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!a||ye(a)&&xt(a,e,i,!0))return n.call(this,s);ye(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=S(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(!xt(this,e,i,!0)&&("__context"in this||(this.__context=s),n&&ge.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 be(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=S(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(ve(d,s,this),"tagName"in this.canvas&&!xt(this.canvas,i,n,!0)){var c=pe(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=kt(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 ke,_e,Se,Ie='(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 transparentFingerprintMap = /* @__PURE__ */ new Map();\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\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 {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n return worker.postMessage({ id });\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\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-CZCeNtwG.js.map\n',Me="undefined"!=typeof self&&self.Blob&&new Blob([Ie],{type:"text/javascript;charset=utf-8"});function Ce(t){var e;try{if(!(e=Me&&(self.URL||self.webkitURL).createObjectURL(Me)))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(Ie),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class xe{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 e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,o=t.recordCanvas,u=t.dataURLOptions,l=t.resolutionScale;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,u),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:u,resolutionScale:l})}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,u="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=we(r,i,n,!0),h=new Map;try{o=new Ce}catch(t){return}var c=!1;o.onerror=()=>{var t;c=!0,cancelAnimationFrame(v),null==(t=o.terminate)||t.call(o)},o.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:d["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var v,f=1e3/t,p=0,m=t=>{var l,d;c||(p&&f>t-p||(p=t,(l=[],d=t=>{try{t.querySelectorAll("canvas").forEach((t=>{xt(t,i,n,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&d(t.shadowRoot)}))}catch(t){}},d(r.document),l).forEach(function(){var t=e((function*(t){var e,r,i=a.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.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 h.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});o.postMessage({id:i,bitmap:f,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:s.dataURLOptions},[f])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),v=requestAnimationFrame(m))};v=requestAnimationFrame(m),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(v),null==(t=o.terminate)||t.call(o)}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=we(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=S(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 xt(this.canvas,r,i,!0)||setTimeout((()=>{var r=pe(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=kt(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(...be(e.WebGLRenderingContext.prototype,d.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...be(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)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class Te{constructor(t){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new Lt),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:R(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,at.forEach((t=>t.abort())),at.clear()}trackStylesheetInLinkElement(t){}}class Re{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 Oe=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var Ae=document.createElement("iframe");document.body.appendChild(Ae),Array.from=(null==(i=Ae.contentWindow)?void 0:i.Array.from)||Array.from,document.body.removeChild(Ae)}}catch(t){console.debug("Unable to override Array.from",t)}var Ee=new O,Ne=new Set([u.Mutation,u.MediaInteraction,u.StyleSheetRule,u.CanvasMutation,u.Font,u.Log,u.StyleDeclaration,u.AdoptedStyleSheet]);function Le(t){void 0===t&&(t={});var e=t,i=e.emit,n=e.checkoutEveryNms,s=e.checkoutEveryNth,a=e.blockClass,l=void 0===a?"rr-block":a,h=e.blockSelector,d=void 0===h?null:h,c=e.ignoreClass,v=void 0===c?"rr-ignore":c,f=e.ignoreSelector,p=void 0===f?null:f,m=e.maskTextClass,g=void 0===m?"rr-mask":m,y=e.maskTextSelector,w=void 0===y?null:y,b=e.inlineStylesheet,k=void 0===b||b,_=e.maskAllInputs,S=e.maskInputOptions,M=e.slimDOMOptions,C=e.maskInputFn,x=e.maskTextFn,T=e.hooks,R=e.packFn,A=e.sampling,E=void 0===A?{}:A,N=e.dataURLOptions,L=void 0===N?{}:N,F=e.canvasResolutionScale,D=e.mousemoveWait,P=e.recordDOM,W=void 0===P||P,B=e.recordCanvas,U=void 0!==B&&B,z=e.recordCrossOriginIframes,j=void 0!==z&&z,q=e.recordAfter,H=void 0===q?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":q,G=e.userTriggeredOnInput,V=void 0!==G&&G,Z=e.collectFonts,J=void 0!==Z&&Z,Q=e.inlineImages,X=void 0!==Q&&Q,Y=e.plugins,K=e.keepIframeSrcFn,tt=void 0===K?()=>!1:K,et=e.ignoreCSSAttributes,rt=void 0===et?new Set([]):et,it=e.attributeFilter;Bt=e.errorHandler;var nt=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},L),st=!j||window.parent===window,at=!1;if(!st)try{window.parent.document&&(at=!1)}catch(t){at=!0}if(st&&!i)throw new Error("emit function is required");if(!st&&!at)return()=>{};void 0!==D&&void 0===E.mousemove&&(E.mousemove=D),Ee.reset();var ot,ut=!0===_?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==S?S:{password:!0},lt=vt(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 ht,dt,ft=0,mt=new Map,yt=t=>{for(var e of Y||[])e.eventProcessor&&(t=e.eventProcessor(t));return R&&!at&&(t=R(t)),t};ke=(t,e)=>{var r,a=t;if(a.timestamp=_t(),!(null==(r=Vt[0])?void 0:r.isFrozen())||a.type===o.FullSnapshot||a.type===o.IncrementalSnapshot&&Ne.has(a.data.source)||Vt.forEach((t=>t.unfreeze())),st)null==i||i(yt(a),e);else if(at){var l={type:"rrweb",event:yt(a),origin:window.location.origin,isCheckout:e};window.parent.postMessage(l,"*")}if(a.type===o.FullSnapshot)ot=a,ft=0;else if(a.type===o.IncrementalSnapshot){if(a.data.source===u.Mutation&&a.data.isAttachIframe)return;ft++,(s&&ft>=s||n&&a.timestamp-ot.timestamp>n)&&_e(!0)}};var wt=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=Ee.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}t.removes.forEach((t=>{var r=t.id;if(!e||!e.has(r)){var n=xt.getIframeElementById(r);n&&i.has(n)?xt.forgetIframeId(r):(null==ht||ht(r),xt.removeIframeById(r))}})),null==dt||dt(),xt.cleanupDetachedIframes()}ke({type:o.IncrementalSnapshot,data:r({source:u.Mutation},t)})},bt=t=>ke({type:o.IncrementalSnapshot,data:r({source:u.Scroll},t)}),kt=t=>ke({type:o.IncrementalSnapshot,data:r({source:u.CanvasMutation},t)}),Ct=new Te({mutationCb:wt,adoptedStyleSheetCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},t)})}),xt=new oe({mirror:Ee,mutationCb:wt,stylesheetManager:Ct,recordCrossOriginIframes:j,wrappedEmit:ke});for(var Tt of Y||[])Tt.getMirror&&Tt.getMirror({nodeMirror:Ee,crossOriginIframeMirror:xt.crossOriginIframeMirror,crossOriginIframeStyleMirror:xt.crossOriginIframeStyleMirror});var Rt=new Re;Se=new xe({recordCanvas:U,mutationCb:kt,win:window,blockClass:l,blockSelector:d,mirror:Ee,sampling:E.canvas,dataURLOptions:nt,resolutionScale:F});var Ot=new ue({mutationCb:wt,scrollCb:bt,bypassOptions:{blockClass:l,blockSelector:d,maskTextClass:g,maskTextSelector:w,inlineStylesheet:k,maskInputOptions:ut,dataURLOptions:nt,maskTextFn:x,maskInputFn:C,recordCanvas:U,inlineImages:X,sampling:E,slimDOMOptions:lt,iframeManager:xt,stylesheetManager:Ct,canvasManager:Se,keepIframeSrcFn:tt,processedNodeManager:Rt,attributeFilter:it},mirror:Ee});_e=function(t){if(void 0===t&&(t=!1),W){ke({type:o.Meta,data:{href:window.location.href,width:Mt(),height:It()}},t),Ct.reset(),Ot.init(),Vt.forEach((t=>t.lock()));var e=function(t,e){var r=e||{},i=r.mirror,n=void 0===i?new O:i,s=r.blockClass,a=r.blockSelector,o=r.maskTextClass,u=r.maskTextSelector,l=r.inlineStylesheet,h=r.inlineImages,d=void 0!==h&&h,c=r.recordCanvas,v=void 0!==c&&c,f=r.maskAllInputs,p=void 0!==f&&f,m=r.slimDOM,g=r.dataURLOptions,y=r.preserveWhiteSpace,w=r.onSerialize,b=r.onIframeLoad,k=r.iframeLoadTimeout,_=r.onIframeListenerRegistered,S=r.onStylesheetLoad,I=r.stylesheetLoadTimeout,M=r.keepIframeSrcFn,C=void 0===M?()=>!1:M,x=r.maxDepth;return ct(t,{doc:t,mirror:n,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===a?null:a,maskTextClass:void 0===o?"rr-mask":o,maskTextSelector:void 0===u?null:u,skipChild:!1,inlineStylesheet:void 0===l||l,maskInputOptions:!0===p?{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===p?{password:!0}:p,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:vt(void 0!==m&&m),dataURLOptions:g,inlineImages:d,recordCanvas:v,preserveWhiteSpace:y,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:x})}(document,{mirror:Ee,blockClass:l,blockSelector:d,maskTextClass:g,maskTextSelector:w,inlineStylesheet:k,maskAllInputs:ut,maskTextFn:x,maskInputFn:C,slimDOM:lt,dataURLOptions:nt,recordCanvas:U,inlineImages:X,onSerialize(t){At(t,Ee)&&xt.addIframe(t),Et(t,Ee)&&Ct.trackLinkElement(t),Nt(t)&&Ot.addShadowRoot(I.shadowRoot(t),document)},onIframeLoad(t,e){xt.attachIframe(t,e),Ot.observeAttachShadow(t)},onIframeListenerRegistered(t,e){xt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){Ct.attachLinkElement(t,e)},keepIframeSrcFn:tt});if(!e)return console.warn("Failed to snapshot the document");ke({type:o.FullSnapshot,data:{node:e,initialOffset:St(window)}},t),Vt.forEach((t=>t.unlock())),j&&xt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ct.adoptStyleSheets(document.adoptedStyleSheets,Ee.getId(document))}};try{var Lt=[];ht=t=>{var e=mt.get(t);e&&(e.forEach((t=>{gt(t);var e=Lt.indexOf(t);-1!==e&&Lt.splice(e,1)})),mt.delete(t))},dt=()=>{for(var t of mt){var e=t[0],r=Ee.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==ht||ht(e)}catch(t){null==ht||ht(e)}else null==ht||ht(e)}};var Ft=t=>{var e;return Gt(ie)({mutationCb:wt,mousemoveCb:(t,e)=>ke({type:o.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.MouseInteraction},t)}),scrollCb:bt,viewportResizeCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.ViewportResize},t)}),inputCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.Input},t)}),mediaInteractionCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.MediaInteraction},t)}),styleSheetRuleCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.StyleSheetRule},t)}),styleDeclarationCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.StyleDeclaration},t)}),canvasMutationCb:kt,fontCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.Font},t)}),selectionCb(t){ke({type:o.IncrementalSnapshot,data:r({source:u.Selection},t)})},customElementCb(t){ke({type:o.IncrementalSnapshot,data:r({source:u.CustomElement},t)})},blockClass:l,ignoreClass:v,ignoreSelector:p,maskTextClass:g,maskTextSelector:w,maskInputOptions:ut,inlineStylesheet:k,sampling:E,recordDOM:W,recordCanvas:U,inlineImages:X,userTriggeredOnInput:V,collectFonts:J,doc:t,maskInputFn:C,maskTextFn:x,keepIframeSrcFn:tt,blockSelector:d,slimDOMOptions:lt,dataURLOptions:nt,mirror:Ee,iframeManager:xt,stylesheetManager:Ct,shadowDomManager:Ot,processedNodeManager:Rt,canvasManager:Se,ignoreCSSAttributes:rt,attributeFilter:it,plugins:(null==(e=null==Y?void 0:Y.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>ke({type:o.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},T)};xt.addLoadListener((t=>{try{var e=Ee.getId(t),r=Ft(t.contentDocument);if(Lt.push(r),-1!==e){var i=mt.get(e);i||mt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),xt.addPageHideListener((t=>{var e=Ee.getId(t);null==ht||ht(e),Xt(t)}));var Dt=-1,Pt=t=>ke({type:o.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),Wt=()=>{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?Ee.getId(s):-1;a!==Dt&&(-1!==Dt&&Pt({id:Dt,enter:!1}),Dt=a,-1!==a&&Pt({id:a,enter:!0}))},$t=()=>{_e(),Lt.push(Ft(document)),Lt.push(pt("fullscreenchange",Wt)),Lt.push(pt("webkitfullscreenchange",Wt)),Lt.push(pt("mozfullscreenchange",Wt)),Lt.push(pt("MSFullscreenChange",Wt)),Oe=!0};return["interactive","complete"].includes(document.readyState)?$t():(Lt.push(pt("DOMContentLoaded",(()=>{ke({type:o.DomContentLoaded,data:{}}),"DOMContentLoaded"===H&&$t()}))),Lt.push(pt("load",(()=>{ke({type:o.Load,data:{}}),"load"===H&&$t()}),window))),()=>{Lt.forEach((t=>gt(t))),Rt.destroy(),xt.removeLoadListener(),xt.destroy(),mt.clear(),Ot.reset(),Ee.reset(),Oe=!1,Bt=void 0}}catch(t){console.warn(t)}}Le.addCustomEvent=(t,e)=>{if(!Oe)throw new Error("please add custom event after start recording");ke({type:o.Custom,data:{tag:t,payload:e}})},Le.freezePage=()=>{Vt.forEach((t=>t.freeze()))},Le.takeFullSnapshot=t=>{if(!Oe)throw new Error("please take full snapshot after start recording");_e(t)},Le.mirror=Ee;var Fe=Object.defineProperty,De=(t,e,r)=>((t,e,r)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Pe{constructor(t){De(this,"fileName"),De(this,"functionName"),De(this,"lineNumber"),De(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 We=/(^|@)\S+:\d+/,Be=/^\s*at .*(\S+:\d+|\(native\))/m,$e=/^(eval@)?(\[native code])?$/,Ue={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Be)?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(Be)}),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 Pe({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match($e)}),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 Pe({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Pe({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 Pe({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 Pe({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(We)&&!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 Pe({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 je(t){return Array.isArray(t)}function qe(t){return"object"==typeof t&&null!==t&&!je(t)}function He(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(qe(t[i])&&He(t[i],e-1))return!0;return!1}function Ge(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(qe(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||qe(a)&&He(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]=je(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 Ve={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 Ze(t,e,r){var i,n=r?Object.assign({},Ve,r):Ve,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=Ue.parse(e.error).map((t=>t.toString())),s=[Ge(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=[Ge("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Ge("Uncaught (in promise)",n.stringifyOptions),Ge(e.reason,n.stringifyOptions)]);var s=Ue.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={next:l},d=(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=Ue.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>Ge(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Ge("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=e[s];"function"==typeof t&&t.__rrweb_layer__;){var r=t.__rrweb_layer__;if(r.next===d)return void(r.next=h.next);t=r.next}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var Je="undefined"!=typeof window?window:void 0,Qe="undefined"!=typeof globalThis?globalThis:Je,Xe=null==Qe?void 0:Qe.document,Ye=null==Qe?void 0:Qe.location;null!=Qe&&Qe.XMLHttpRequest&&new Qe.XMLHttpRequest;var Ke="undefined"!=typeof globalThis?globalThis:Je;Ke&&"undefined"==typeof self&&(Ke.self=Ke),Ke&&"undefined"==typeof File&&(Ke.File=function(){});var tr,er=null!=Je?Je:{},rr="NativeGzipValidationError",ir=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=rr,e},nr=function(){var t=e((function*(t,e){18>t.size&&ir("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])&&ir("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(tr)return tr;tr=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;tr[t]=e>>>0}return tr})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&ir("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&ir("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function sr(){return sr=e((function*(t,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(t),s=new globalThis.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]))[0];return yield nr(l,n),l}catch(t){if(null!=i&&i.rethrow)throw t;return r&&console.error("Failed to gzip compress data",t),null}})),sr.apply(this,arguments)}var ar=Object.prototype,or=ar.hasOwnProperty,ur=ar.toString,lr=Array.isArray||function(t){return"[object Array]"===ur.call(t)},hr=t=>"function"==typeof t,dr=t=>t===Object(t)&&!lr(t),cr=t=>void 0===t,vr=t=>"[object String]"==ur.call(t),fr=t=>null===t,pr=t=>cr(t)||fr(t),mr=t=>"[object Number]"==ur.call(t)&&t==t,gr=t=>"[object Boolean]"===ur.call(t),yr=t=>t instanceof FormData;function wr(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),mr(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),wr(n||r,e,r,i))}class br{constructor(t){this.$e={},this.ze=t.ze,this.Ze=wr(t.bucketSize,0,100,t.Ge),this.Qe=wr(t.refillRate,0,this.Ze,t.Ge),this.Je=wr(t.refillInterval,0,864e5,t.Ge)}Ke(t,e){var r=Math.floor((e-t.lastAccess)/this.Je);r>0&&(t.tokens=Math.min(t.tokens+r*this.Qe,this.Ze),t.lastAccess=t.lastAccess+r*this.Je)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.$e[i];return n?this.Ke(n,r):this.$e[i]=n={tokens:this.Ze,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.ze)||e.call(this,t)),0===n.tokens)}stop(){this.$e={}}}function kr(t){return t?t.split("#")[0]:t}var _r=t=>"undefined"!=typeof Document&&t instanceof Document,Sr={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"},Ir=function(t,e){var r=(void 0===e?{}:e).debugEnabled,i={k(e){if(Je&&(Sr.DEBUG||Je.POSTHOG_DEBUG||r)&&!cr(Je.console)&&Je.console){for(var i=("__rrweb_original__"in Je.console[e]?Je.console[e].__rrweb_original__:Je.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)=>Ir(t+" "+e,r)};return i},Mr=Ir("[PostHog.js]"),Cr=Mr.createLogger;function xr(t,e){if(!pr(t))if(lr(t))t.forEach(e);else if(yr(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)or.call(t,r)&&e(t[r],r)}function Tr(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var Rr=["localhost","127.0.0.1"],Or=t=>{var e=null==Xe?void 0:Xe.createElement("a");return cr(e)?null:(e.href=t,e)},Ar=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return xr(t,(function(t,e){cr(t)||cr(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)},Er=()=>{};function Nr(t,e,r){try{if(!(e in t))return Er;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return hr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e];hr(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else t[e]=i.next}}catch(t){return Er}}function Lr(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}function Fr(t){var e,r=null==Je||null==(e=Je.location)?void 0:e.href;return cr(r)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!hr(i))return e;try{var n=i(e);return vr(n)&&n?n:e}catch(t){return Mr.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,r)}var Dr=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})"),Pr=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),Wr="[SessionRecording]",Br="redacted",$r=1e6;function Ur(t){var e;return Math.min($r,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:$r)}var zr={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:$r,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"],streamNetworkBody:!1},jr=["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"],qr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Hr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Gr=t=>{pr(t)||xr(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return jr.includes(e)||Hr.some((t=>e.includes(t)))})(e)&&(t[e]=Br)}))},Vr=["/s/","/e/","/i/"];function Zr(t,e,r,i){if(pr(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return vr(n)&&(n=parseInt(n)),n>r?Wr+" "+i+" body too large to record ("+n+" bytes)":t}function Jr(t,e){if(pr(t))return t;var r=t;return function(t,e){if(pr(t))return!1;if(vr(t)){if(t=t.trim(),Dr.test((t||"").replace(/[- ]/g,"")))return!1;if(Pr.test(t))return!1}return!0}(r)||(r=Wr+" "+e+" body "+Br),xr(qr,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Wr+" "+e+" body "+Br+" as might contain: "+t)})),r}var Qr=Cr("[Recorder]"),Xr=t=>"navigation"===t.entryType,Yr=t=>"resource"===t.entryType;function Kr(t,e){return!!e&&(gr(e)||e[t])}function ti(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 ei=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function ri(t){var e=t.type,r=t.recordBody,i=t.headers;function n(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:!!ti(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(ei))return!1;if(gr(r))return!0;if(lr(r))return n(r);var s=r[e];return gr(s)?s:n(s)}function ii(t,e,r,i,n,s){return ni.apply(this,arguments)}function ni(){return ni=e((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return Qr.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(Yr(a=t[s])&&a.initiatorType===e&&(cr(i)||a.startTime>=i)&&(cr(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),ii(t,e,r,i,n,s+1))})),ni.apply(this,arguments)}function si(t){var e=t.body,r=t.options,i=t.url;if(pr(e))return null;var n=Lr(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(vr(e))return e;if(_r(e))return e.textContent;if(yr(e))return Ar(e);if(dr(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 ai=t=>!fr(t)&&("navigation"===t.entryType||"resource"===t.entryType);function oi(t){var e=t.entry,i=t.method,n=t.status,s=t.networkRequest,a=t.isInitial,o=t.start,u=t.end,l=t.url,h=t.initiatorType;o=e?e.startTime:o,u=e?e.responseEnd:u;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(o||0)),v=[r({},e?e.toJSON():{name:l},{startTime:cr(o)?void 0:Math.round(o),endTime:cr(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(ai(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var ui=["video/","audio/"];function li(t){return dr(t)&&hr(t.getReader)&&hr(t.tee)}var hi=500,di="[SessionReplay] Timeout while trying to read body",ci="[SessionReplay] Failed to read body";function vi(t){return ci+": "+t}function fi(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function pi(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(di)),hi);try{t.clone().text().then((t=>e(t)),(t=>e(vi(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(ci)}}))}(t);var r=Ur(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(fi(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(di)),hi);try{o=t.clone()}catch(t){return void a(ci)}var l=o.body;if(li(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(ci)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(fi(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(vi(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(vi(t))))}catch(t){a(ci)}}))}(t,r)}function mi(){return(mi=e((function*(t){var e=t.r,r=t.options,i=Lr(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):pi(e,r)}))).apply(this,arguments)}function gi(){return(gi=e((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;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=ui.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=Lr(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return fr(i)?pi(e,r):Promise.resolve(i)}))).apply(this,arguments)}var yi=null;function wi(t,i,n){if(!("performance"in i))return()=>{};if(yi)return Qr.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},zr,n):zr,a=e=>{var i=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var r=s.maskRequestFn(t);e||(n=!r),r&&i.push(r)}})),i.length>0&&t(r({},e,{requests:i}))},o=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>Xr(t)||Yr(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>oi({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=>Xr(t)||Yr(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>oi({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=Kr("request",r.recordHeaders),n=Kr("response",r.recordHeaders),s=Nr(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},m={},g=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=d.send.bind(d);d.send=t=>(ri({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=si({body:t,options:r,url:o})),c=e.performance.now(),y(t));var w=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",w),d.removeEventListener("abort",w),d.removeEventListener("timeout",w)},b=()=>{if(d.readyState===d.DONE){w(),v=e.performance.now();var i={};d.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),ri({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=si({body:d.response,options:r,url:o})),ii(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=oi({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",w),d.addEventListener("abort",w),d.addEventListener("timeout",w)}catch(t){Qr.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(a,i,s),l=function(t,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=Kr("request",i.recordHeaders),s=Kr("response",i.recordHeaders),a=Nr(r,"fetch",(a=>function(){var o=e((function*(e,o){var u,l;try{u=new Request(e,o)}catch(t){return Qr.error("Failed to instrument fetch for network capture",t),a(e,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),n&&(c.requestHeaders=v),!li(null==o?void 0:o.body)&&ri({type:"request",headers:v,url:e,recordBody:i.recordBody})&&(c.requestBody=yield function(t){return mi.apply(this,arguments)}({r:u,options:i,url:e}))}catch(t){Qr.error("Failed to record fetch request for network capture",t)}h=r.performance.now(),l=ti(e)?yield a(u):yield a(e,o),d=r.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),s&&(c.responseHeaders=f),ri({type:"response",headers:f,url:e,recordBody:i.recordBody})&&(c.responseBody=yield function(t){return gi.apply(this,arguments)}({r:l,options:i,url:e})),l}finally{ii(r,"fetch",u.url,h,d).then((e=>{var r,i=oi({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return o.apply(this,arguments)}}()));return()=>{a()}}(a,i,s)),yi=()=>{o(),u(),l(),yi=null}}var bi={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},ki={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},_i="$session_recording_remote_config",Si="$replay_sample_rate",Ii="$replay_override_sampling",Mi="$replay_override_linked_flag",Ci="$replay_override_url_trigger",xi="$replay_override_event_trigger",Ti="$session_is_sampled",Ri="$session_past_minimum_duration",Oi="$session_recording_url_trigger_activated_session",Ai="$session_recording_event_trigger_activated_session",Ei="$posthog_sr_group_event_trigger_",Ni="$posthog_sr_group_url_trigger_",Li="$posthog_sr_group_sampling_",Fi="$debug_first_full_snapshot_timestamp",Di="$sess_rec_flush_size",Pi="$stored_person_properties",Wi="$sdk_debug_replay_remote_trigger_matching_config",Bi="disabled",$i="sampled",Ui="active",zi="buffering",ji="paused",qi="rrweb_error",Hi="trigger",Gi=Hi+"_activated",Vi=Hi+"_pending",Zi=Hi+"_"+Bi;function Ji(t,e,r,i,n,s){return 0===e?Zi:(null==t?void 0:t.get_property(r?i+r:n))===s?Gi:Vi}function Qi(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 Xi{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(Gi)?Gi:e.includes(Vi)?Vi:Zi}stop(){this.u.forEach((t=>t.stop()))}}class Yi{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(Zi),e.size){case 0:return Zi;case 1:return Array.from(e)[0];default:return Vi}}stop(){this.u.forEach((t=>t.stop()))}}class Ki{triggerStatus(){return Gi}stop(){}}var tn=t=>"sessionRecording"in t;class en{constructor(t,e){this.Gu=[],this.Vu=[],this.Zu=new Map,this.Ju=new Map,this.Qu="",this.urlBlocked=!1,this._instance=t,this.Xu=e}onConfig(t){var e,r;this.Gu=(tn(t)?dr(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Vu=(tn(t)?dr(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Yu()}Yu(){for(var t of(this.Zu.clear(),this.Ju.clear(),this.Gu))if("regex"===t.matching&&!this.Zu.has(t.url))try{this.Zu.set(t.url,new RegExp(t.url))}catch(e){Mr.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.Vu)if("regex"===e.matching&&!this.Ju.has(e.url))try{this.Ju.set(e.url,new RegExp(e.url))}catch(t){Mr.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}Ku(t){return Ji(this._instance,this.Gu.length,this.Xu,Ni,Oi,t)}triggerStatus(t){var e=this.Ku(t),r=e===Gi?Gi:e===Vi?Vi:Zi;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){var r=Fr(this._instance);if(r&&r!==this.Qu){this.Qu=r;var i=this.urlBlocked,n=Qi(r,this.Vu,this.Ju);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=Fr(this._instance);if(n&&n!==this.Qu){this.Qu=n;var s=this.urlBlocked,a=Qi(n,this.Vu,this.Ju);a&&!s?t():!a&&s&&e();var o=this.Ku(i)===Gi,u=Qi(n,this.Gu,this.Zu);!o&&u&&r("url",n)}}stop(){this.Qu=""}}class rn{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.th=()=>{},this._instance=t}triggerStatus(){var t=Vi;return pr(this.linkedFlag)&&(t=Zi),this.linkedFlagSeen&&(t=Gi),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(tn(t)?dr(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!pr(this.linkedFlag)&&!this.linkedFlagSeen){var i=vr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=vr(this.linkedFlag)?null:this.linkedFlag.variant;this.th=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(dr(r)&&i in r){var a=r[i];s=gr(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.th()}}class nn{constructor(t,e){this.eh=[],this._instance=t,this.Xu=e}onConfig(t){var e;this.eh=(tn(t)?dr(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}rh(t){return Ji(this._instance,this.eh.length,this.Xu,Ei,Ai,t)}triggerStatus(t){var e=this.rh(t),r=e===Gi?Gi:e===Vi?Vi:Zi;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.eh.length){var i=this.rh(r)===Gi,n=this.eh.includes(t);!i&&n&&e("event",t)}}stop(){}}class sn{constructor(t,e,r){if(this._instance=t,this.group=e,this.ih=new en(t,e.id),this.nh=new nn(t,e.id),this.sh=new rn(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.ih.onConfig(n),this.nh.onConfig(n),this.sh.onConfig(n,r);var s=[this.nh,this.ih,this.sh];this.ah="any"===e.conditions.matchType?new Xi(s):new Yi(s)}else this.ah=new Ki}triggerStatus(t){return this.ah.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.nh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.ih.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?Ni+this.group.id:Ei+this.group.id]:e})}stop(){this.ih.stop(),this.nh.stop(),this.sh.stop()}}function an(t){if(t.rrwebError)return qi;if(!t.receivedFlags)return zi;if(!t.isRecordingEnabled)return Bi;if(t.urlTriggerMatching.urlBlocked)return ji;var e=!0===t.isSampled,r=new Xi([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?$i:r===Gi?Ui:r===Vi?zi:!1===t.isSampled?Bi:Ui}function on(t){if(t.rrwebError)return qi;if(!t.receivedFlags)return zi;if(!t.isRecordingEnabled)return Bi;if(t.urlTriggerMatching.urlBlocked)return ji;var e=new Yi([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Zi,i=gr(t.isSampled);return r&&e===Vi?zi:r&&e===Zi||i&&!t.isSampled?Bi:!0===t.isSampled?$i:Ui}function un(){var t=[];return function(e,r){if(dr(r)||lr(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function ln(t){var e=JSON.stringify(t,un());return e?new Blob([e]).size:0}function hn(t){if(fr(t))return 4;if(cr(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(lr(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=cr(i)||fr(i)?4:hn(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];cr(u)||(a||(s+=1),a=!1,s+=o.length+3+hn(u))}return s;default:return 0}}function dn(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[dn({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),dn({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 cn=Uint8Array,vn=Uint16Array,fn=Uint32Array,pn=new cn([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]),mn=new cn([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]),gn=new cn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yn=function(t,e){for(var r=new vn(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new fn(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]},wn=yn(pn,2),bn=wn[1];wn[0][28]=258,bn[258]=28;for(var kn=yn(mn,0)[1],_n=new vn(32768),Sn=0;32768>Sn;++Sn){var In=(43690&Sn)>>>1|(21845&Sn)<<1;_n[Sn]=((65280&(In=(61680&(In=(52428&In)>>>2|(13107&In)<<2))>>>4|(3855&In)<<4))>>>8|(255&In)<<8)>>>1}var Mn=function(t,e,r){for(var i=t.length,n=0,s=new vn(e);i>n;++n)++s[t[n]-1];var a,o=new vn(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new vn(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[_n[d]>>>u]=l}else for(a=new vn(i),n=0;i>n;++n)a[n]=_n[o[t[n]-1]++]>>>15-t[n];return a},Cn=new cn(288);for(Sn=0;144>Sn;++Sn)Cn[Sn]=8;for(Sn=144;256>Sn;++Sn)Cn[Sn]=9;for(Sn=256;280>Sn;++Sn)Cn[Sn]=7;for(Sn=280;288>Sn;++Sn)Cn[Sn]=8;var xn=new cn(32);for(Sn=0;32>Sn;++Sn)xn[Sn]=5;var Tn=Mn(Cn,9,0),Rn=Mn(xn,5,0),On=function(t){return(t/8>>0)+(7&t&&1)},An=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof vn?vn:t instanceof fn?fn:cn)(r-e);return i.set(t.subarray(e,r)),i},En=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},Nn=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},Ln=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 cn(0),0];if(1==n){var a=new cn(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 v=new vn(c+1),f=Fn(r[h-1],v,0);if(f>e){i=0;var p=0,m=f-e,g=1<<m;for(s.sort((function(t,e){return v[e.s]-v[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=v[y])break;p+=g-(1<<f-v[y]),v[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>v[w]?p-=1<<e-v[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;v[b]==e&&(--v[b],++p)}f=e}return[new cn(v),f]},Fn=function(t,e,r){return-1==t.s?Math.max(Fn(t.l,e,r+1),Fn(t.r,e,r+1)):e[t.s]=r},Dn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new vn(++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]},Pn=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=On(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){En(e,h++,r),++n[256];for(var d=Ln(n,15),c=d[0],v=d[1],f=Ln(s,15),p=f[0],m=f[1],g=Dn(c),y=g[0],w=g[1],b=Dn(p),k=b[0],_=b[1],S=new vn(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;k.length>I;++I)S[31&k[I]]++;for(var M=Ln(S,7),C=M[0],x=M[1],T=19;T>4&&!C[gn[T-1]];--T);var R,O,A,E,N=l+5<<3,L=Pn(n,Cn)+Pn(s,xn)+a,F=Pn(n,c)+Pn(s,p)+a+14+3*T+Pn(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(L>=N&&F>=N)return Wn(e,h,t.subarray(u,u+l));if(En(e,h,1+(L>F)),h+=2,L>F){R=Mn(c,v,0),O=c,A=Mn(p,m,0),E=p;var D=Mn(C,x,0);for(En(e,h,w-257),En(e,h+5,_-1),En(e,h+10,T-4),h+=14,I=0;T>I;++I)En(e,h+3*I,C[gn[I]]);h+=3*T;for(var P=[y,k],W=0;2>W;++W){var B=P[W];for(I=0;B.length>I;++I)En(e,h,D[U=31&B[I]]),h+=C[U],U>15&&(En(e,h,B[I]>>>5&127),h+=B[I]>>>12)}}else R=Tn,O=Cn,A=Rn,E=xn;for(I=0;o>I;++I)if(i[I]>255){var U;Nn(e,h,R[257+(U=i[I]>>>18&31)]),h+=O[U+257],U>7&&(En(e,h,i[I]>>>23&31),h+=pn[U]);var z=31&i[I];Nn(e,h,A[z]),h+=E[z],z>3&&(Nn(e,h,i[I]>>>5&8191),h+=mn[z])}else Nn(e,h,R[i[I]]),h+=O[i[I]];return Nn(e,h,R[256]),h+O[256]},$n=new fn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Un=function(){for(var t=new fn(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),zn=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=Un[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},jn=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new cn(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=$n[e-1],v=c>>>13,f=8191&c,p=(1<<r)-1,m=new vn(32768),g=new vn(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 fn(25e3),_=new vn(288),S=new vn(32),I=0,M=0,C=(h=0,0),x=0,T=0;a>h;++h){var R=b(h),O=32767&h,A=g[R];if(m[O]=A,g[R]=O,h>=x){var E=a-h;if((I>7e3||C>24576)&&E>423){l=Bn(t,u,0,k,_,S,M,C,T,h-T,l),C=I=M=0,T=h;for(var N=0;286>N;++N)_[N]=0;for(N=0;30>N;++N)S[N]=0}var L=2,F=0,D=f,P=O-A&32767;if(E>2&&R==b(h-P))for(var W=Math.min(v,E)-1,B=Math.min(32767,h),U=Math.min(258,E);B>=P&&--D&&O!=A;){if(t[h+L]==t[h+L-P]){for(var z=0;U>z&&t[h+z]==t[h+z-P];++z);if(z>L){if(L=z,F=P,z>W)break;var j=Math.min(P,z-2),q=0;for(N=0;j>N;++N){var H=h-P+N+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,A=H)}}}P+=(O=A)-(A=m[O])+32768&32767}if(F){k[C++]=268435456|bn[L]<<18|kn[F];var V=31&bn[L],Z=31&kn[F];M+=pn[V]+mn[Z],++_[257+V],++S[Z],x=h+L,++I}else k[C++]=t[h],++_[t[h]]}}l=Bn(t,u,true,k,_,S,M,C,T,h-T,l)}return An(o,0,i+On(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)},qn=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Hn=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&&qn(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)}},Gn=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Vn(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Zn{constructor(t,e){var r,i;void 0===e&&(e={}),this.oh={},this.uh=t=>{if(!this.oh[t]){var e,r;this.oh[t]=!0;var i=this.lh(t);null==(e=(r=this.hh).onBlockedNode)||e.call(r,t,i)}},this.dh=t=>{var e=this.lh(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.lh=t=>this._rrweb.mirror.getNode(t),this.fh=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.fh(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var e=this.dh(t.id);return!this.Xo.consumeRateLimit(e[0])&&t})));var i=this.fh(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.hh=e,this.Xo=new br({bucketSize:null!==(r=this.hh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.hh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,ze:this.uh,Ge:Mr})}reset(){this.oh={}}stop(){this.Xo.stop(),this.reset()}}Sr.DEBUG=!1,Sr.LIB_VERSION="1.407.7",Sr.LIB_NAME="web";class Jn{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.ph=t.get_property.bind(t),this.mh=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.mh(Di,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.ph(Di);return dr(e=r)&&vr(e.sessionId)&&mr(e.size)&&r.sessionId===t?r.size:0}}function Qn(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<wr(100*e,0,100,Mr)}var Xn=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}},Yn={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=>Xn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Xn(e,t))))),icontains:(t,e)=>e.map(Kn).some((e=>t.map(Kn).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Kn).every((e=>t.map(Kn).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)))}))},Kn=t=>t.toLowerCase(),ts=new Set(["is_not","not_icontains","not_regex"]);function es(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(cr(n)||fr(n))return ts.has(s);var a=Yn[s];return!!a&&!cr(t.value)&&!fr(t.value)&&a(lr(t.value)?t.value.map(String):[String(t.value)],lr(n)?n.map(String):[String(n)])}))}var rs=Cr("[SessionRecording]");function is(t,e){return e?t:"!"+t}function ns(t,e){return t===e||t!=="!"+e&&null}class ss{constructor(t,e,r,i,n,s,a){this.gh=null,this.yh=on,this._instance=t,this.ih=e,this.nh=r,this.sh=i,this.wh=n,this.bh=s,this.kh=a}onRemoteConfig(t){this.gh=mr(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this._h=new Xi([this.nh,this.ih]),this.yh=an):(this._h=new Yi([this.nh,this.ih]),this.yh=on),this._instance.register_for_session({[Wi]:t.triggerMatchType}),this.ih.onConfig(t),this.nh.onConfig(t),this.sh.onConfig(t,((t,e)=>{this.wh("linked_flag_matched",{flag:t,variant:e}),this.kh()}))}getStatus(t){return this.yh({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 mr(r)?r:null}checkUrlTriggers(t,e,r,i){this.ih.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.nh.eh.length&&pr(this.Sh))return this.Sh=t((t=>{try{this.nh.checkEventTriggerConditions(t.event,r,e)}catch(t){rs.error("Could not activate event trigger",t)}})),this.Sh}makeSamplingDecisions(t){var e,r,i,n=this.gh;if(!mr(n))return null==(r=this._instance.persistence)||r.unregister(Ti),void(null==(i=this._instance.persistence)||i.unregister(Si));var s=this._instance.get_property(Ti),a=this._instance.get_property(Si),o=ns(s,t),u=mr(a)&&a!==n,l=cr(a)&&s===t,h=u||l||!gr(o),d=h?Qn(t,n):o;h&&(d?this.wh("sampled"):rs.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[Ti]:is(t,d),[Si]:fr(a)&&s===t?null:n})}ensureSamplingDecision(t){if(mr(this.gh)){var e=this._instance.get_property(Ti);gr(ns(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(Ai),null==(e=this._instance.persistence)||e.unregister(Oi),null==(r=this._instance.persistence)||r.unregister(Ti),null==(i=this._instance.persistence)||i.unregister(Si),null==(n=this._instance.persistence)||n.unregister(Ri)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this._h)?void 0:e.triggerStatus(t))===Vi}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.nh.stop(),this.ih.stop(),this.sh.stop()}}class as{constructor(t,e,r,i,n){this.Ih=[],this.Mh=new Map,this.Ch=!1,this._instance=t,this.ih=e,this.wh=r,this.xh=i,this.kh=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Rh(t.triggerGroups),this._instance.register_for_session({[Wi]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.ih.onConfig(t)):rs.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return qi;if(t.urlTriggerMatching.urlBlocked)return ji;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return Bi;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Gi){var o=s.group.id,u=r.get(o);cr(u)?Mr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Vi&&(i=!0)}return n?$i:i?zi:Bi}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Ih,triggerGroupSamplingResults:this.Mh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Ih)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;mr(i)&&(fr(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.ih.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Th(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.kh())}),t)};for(var a of this.Ih)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Sh=t((t=>{var r;if(this.Ch)return rs.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Sh)||r.call(this),void(this.Sh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Th(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(Pi);s.some((e=>!e.properties||0===e.properties.length||es(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.kh())}}),e)};for(var s of this.Ih)n(s)}catch(t){rs.error("Could not activate event trigger for trigger groups",t)}})),this.Sh}makeSamplingDecisions(t){for(var e of this.Ih){var r,i=e.group,n=i.id,s=i.sampleRate,a=Li+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(dr(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=mr(v)&&v!==s,u=c===t&&mr(v)&&v===s&&gr(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!gr(u),m=p?Qn(t+n,s):u;p&&this.xh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Mh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Ch=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(Ti),null==(e=this._instance.persistence)||e.unregister(Si),null==(r=this._instance.persistence)||r.unregister(Ri),this.Ih)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(Ei+o),null==(s=this._instance.persistence)||s.unregister(Ni+o),null==(a=this._instance.persistence)||a.unregister(Li+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Ih){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Mh.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.Ih)if(e.triggerStatus(t)===Vi)return!0;return!1}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear(),this.ih.stop()}Th(t,e){var r=t.group.conditions.properties;return!r||0===r.length||es(r,e,this._instance.get_property(Pi))}Rh(t){var e=this;this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear();var r=function(t){var r=new sn(e._instance,t,((r,i)=>{e.wh("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.kh()}));e.Ih.push(r)};for(var i of t)r(i)}}var os=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"];function us(t){return dr(t)?t.network_timing:t}var ls,hs,ds="[SessionRecording]",cs=Cr(ds),vs=[ki.MouseMove,ki.MouseInteraction,ki.Scroll,ki.ViewportResize,ki.Input,ki.TouchMove,ki.MediaInteraction,ki.Drag],fs=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function ps(){var t;return null==er||null==(t=er.__PosthogExtensions__)?void 0:t.rrweb}function ms(){var t;return null==(t=ps())?void 0:t.record}function gs(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,un())}}function ys(t){return Vn(function(t,e){void 0===e&&(e={});var r=zn(),i=t.length;r.p(t);var n=jn(t,e,Gn(e),8),s=n.length;return Hn(n,e),qn(n,s-8,r.d()),qn(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 cn(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 cn(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 An(i,0,n)}(gs(t))))}function ws(t){return bs.apply(this,arguments)}function bs(){return bs=e((function*(t){var e=gs(t),r=yield function(t,e,r){return sr.apply(this,arguments)}(e,Sr.DEBUG,{rethrow:!0});return Vn(new Uint8Array(yield r.arrayBuffer()))})),bs.apply(this,arguments)}var ks="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,_s=!1;function Ss(t){return lr(t)&&0===t.length?ls=null!=ls?ls:ys([]):ys(t)}function Is(t){return Ms.apply(this,arguments)}function Ms(){return(Ms=e((function*(t){return lr(t)&&0===t.length?ls||(hs=null!=hs?hs:ws([]).then((t=>(ls=t,t))).catch((t=>{throw ls=void 0,hs=void 0,t}))):ws(t)}))).apply(this,arguments)}function Cs(t){return ks&&!_s&&function(t){return t.type===bi.FullSnapshot||t.type===bi.IncrementalSnapshot&&(t.data.source===ki.Mutation||t.data.source===ki.StyleSheetRule)}(t)}function xs(t){return{event:t,size:hn(t)}}function Ts(t,e){return r({},t,{data:e,cv:"2024-10"})}function Rs(t,e){return r({},t,{cv:"2024-10",data:r({},t.data,e)})}function Os(t){try{if(t.type===bi.FullSnapshot)return xs(Ts(t,ys(t.data)));if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.Mutation)return xs(Rs(t,{texts:Ss(t.data.texts),attributes:Ss(t.data.attributes),removes:Ss(t.data.removes),adds:Ss(t.data.adds)}));if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.StyleSheetRule)return xs(Rs(t,{adds:t.data.adds?ys(t.data.adds):void 0,removes:t.data.removes?ys(t.data.removes):void 0}))}catch(t){cs.error("could not compress event - will use uncompressed event",t)}return{event:t,size:ln(t)}}function As(){return(As=e((function*(t){try{if(t.type===bi.FullSnapshot)return xs(Ts(t,yield ws(t.data)));if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.Mutation){var e=yield Promise.all([Is(t.data.texts),Is(t.data.attributes),Is(t.data.removes),Is(t.data.adds)]);return xs(Rs(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.StyleSheetRule){var r=yield Promise.all([t.data.adds?ws(t.data.adds):void 0,t.data.removes?ws(t.data.removes):void 0]);return xs(Rs(t,{adds:r[0],removes:r[1]}))}}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===rr})(e)&&(_s=!0),cs.error("could not compress event asynchronously - trying synchronous compression",e),Os(t)}return{event:t,size:ln(t)}}))).apply(this,arguments)}function Es(t,e){return t.type===bi.Custom&&t.data.tag===e}function Ns(t){return Es(t,"sessionIdle")}function Ls(t){return Es(t,"$session_ending")}function Fs(t){return Es(t,"$session_starting")}class Ds{get sessionId(){return this.Mi}get Oh(){if(!this._instance.sessionManager)throw new Error(ds+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Ah(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Eh(){return ns(this._instance.get_property(Ti),this.sessionId)}get gh(){var t,e=null==(t=this.Xa)?void 0:t.sampleRate;return mr(e)?e:null}get Nh(){var t,e;return null!==(t=null==(e=this.Lh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.Fh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.Dh=void 0,this.Ph=Date.now(),this.Wh=!1,this.Bh=[],this.$h="unknown",this.Uh=!1,this.zh=!1,this.jh=!1,this.qh=!1,this.Hh=[],this.Gh=void 0,this.Vh=void 0,this.Zh=[],this.Jh=0,this.Qh=0,this.Xh=!1,this.Yh=void 0,this.Sh=void 0,this.Kh=void 0,this.td=void 0,this.ed=void 0,this.fi=(t,e,r)=>{var i,n,s;if(r&&(t!==this.Mi||e!==this.Ii)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.Mi,l=this.Ii;o&&this.xh("$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(Fi),this.jh=!1,null==(n=ps())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.xh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.nd(),!1===this.$h&&this.isStarted||this.Mi===t&&this.Ii===e||(this.$h="unknown",this.stop(),this.start("session_id_changed")),o&&this.xh("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph}),null==(s=this.Lh)||s.makeSamplingDecisions(t)}},this.sd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[Ri])===this.Mi},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 mr(r)&&mr(i)?i-r:null},this.od=()=>{var t,e,r=this.Nh;if(!mr(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 mr(i)&&i>=0&&r>i}if(this.sd())return!1;var n,s=this.ad();return!!fr(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Ri]:this.Mi}),!1)},this.ld=()=>{this.status!==zi?(this.hd(),this.dd()):this.vd()},this.fd=()=>{this.xh("browser offline",{})},this.Bs=()=>{this.xh("browser online",{})},this.ke=()=>{null!=Xe&&Xe.visibilityState&&this.xh("window "+Xe.visibilityState,{})},this._instance=t;var e=this.Oh.checkAndGetSessionAndWindowId(),r=e.windowId;this.Mi=e.sessionId,this.Ii=r,this.sh=new rn(this._instance),this.ih=new en(this._instance),this.nh=new nn(this._instance),this.R=this.vd(),this.Oh.sessionTimeoutMs>this.Ah||cs.warn("session_idle_threshold_ms ("+this.Ah+") is greater than the session timeout ("+this.Oh.sessionTimeoutMs+"). Session will never be detected as idle"),this.rd=new Jn(this._instance)}get pd(){var t,e,r,i,n,s,a,o=null==(t=this.Xa)?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 cr(l)&&cr(h)&&cr(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}md(){var t;if(!this.qh){var e=null==(t=this.Xa)?void 0:t.masking;if(!pr(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!cr(i)&&i!==n}));0!==i.length&&(this.qh=!0,cs.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:e}))}}}get gd(){var t;return wr(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,Cr("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.Xa)?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:wr(h,0,12,Cr("canvas recording fps"),4),quality:wr(d,0,1,Cr("canvas recording quality"),.4)}}get wd(){var t,e=!(null==(t=this.Xa)||!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.Xa)?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=us(this._instance.config.capture_performance),u=us(null==i?void 0:i.capturePerformance),l=!!(gr(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}kd(){var t,e,i=[],n=null==(t=er.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.wd&&i.push(n());var s=null==(e=er.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.bd&&hr(s)&&(!Rr.includes(Ye.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(s(((t,e)=>{var i,n={payloadSizeLimitBytes:zr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...zr.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...zr.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,a=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,u=(i=Ur(n),t=>(null!=t&&t.requestBody&&(t.requestBody=Zr(t.requestBody,t.requestHeaders,i,"Request")),null!=t&&t.responseBody&&(t.responseBody=Zr(t.responseBody,t.responseHeaders,i,"Response")),t)),l=e=>{return u(((t,e)=>{var r,i=Or(t.name),n=0===e.indexOf("http")?null==(r=Or(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Vr.some((t=>0===s.indexOf(t)))))return t})((Gr((r=e).requestHeaders),Gr(r.responseHeaders),r),t.api_host));var r},h=hr(t.session_recording.maskNetworkRequestFn);return h&&hr(t.session_recording.maskCapturedNetworkRequestFn)&&Mr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var i=t.session_recording.maskNetworkRequestFn({url:e.name});return r({},e,{name:null==i?void 0:i.url})}),n.maskRequestFn=hr(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r,i=l(e);return i&&null!==(r=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:t=>function(t){if(!cr(t))return t.requestBody=Jr(t.requestBody,"Request"),t.responseBody=Jr(t.responseBody,"Response"),t}(l(t)),r({},zr,n,{recordHeaders:s,recordBody:a,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.bd))):cs.info("NetworkCapture not started because we are on localhost.")),i}_d(t){return this._instance.config.disable_capture_url_hashes?kr(t):t}Sd(t,e){void 0===e&&(e=!1);var r=e?kr(t):this._d(t),i=this._instance.config.mask_personal_data_properties?[...os,...this._instance.config.custom_personal_data_properties||[]]:[];return this.Id(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");lr(d)&&(e.includes(d[0])?l.push(d[0]+"=<masked>"):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}Id(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}Md(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.Bh.length?this.Bh.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):cs.warn("could not emit queued rrweb event.",e,t),!1}}xh(t,e){return this.Md(fs((()=>ms().addCustomEvent(t,e))))}Cd(){try{if(this._instance.config.capture_pageview||!Je)return;var t=new URL(Je.location.href),e=this.Sd(t.origin+t.pathname+t.search);this.xd!==e&&(this.xd=e,this.xh("$url_changed",{href:e}))}catch(t){}}Rd(){if(this.Bh.length){var t=[...this.Bh];this.Bh=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Md(t)}))}}bh(){return this.Md(fs((()=>ms().takeFullSnapshot())))}get Td(){var t,e,r;if(null!=(t=this.Lh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return mr(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Od(){if(this.Ad&&clearInterval(this.Ad),!0!==this.$h){var t=this.Td;t&&(this.Ad=setInterval((()=>{this.bh()}),t))}}kh(){!this.ih.urlBlocked&&["sampled","active"].includes(this.status)&&this.Od()}Ed(){this.ih.urlBlocked||(this.ih.urlBlocked=!0,clearInterval(this.Ad),cs.info("recording paused due to URL blocker"),this.xh("recording paused",{reason:"url blocker"}))}Nd(){this.ih.urlBlocked&&(this.ih.urlBlocked=!1,this.bh(),this.Od(),this.xh("recording resumed",{reason:"left blocked url"}),cs.info("recording resumed"))}Ld(t,e){var r;if(!this.Wh&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)){this.Wh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?Oi:Ai]:this.sessionId}),null==(n=this.Lh)||n.updateActiveTriggers(this.sessionId),this.kh(),this.dd(),this.wh(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Wh=!1}}}get isStarted(){return!!this.Dh}get Xa(){var t=this._instance.get_property(_i);if(t){var e;try{e=dr(t)?t:JSON.parse(t)}catch(t){return void cs.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 cs.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(_i))}return e}}Fd(t,e,r){this._instance.get_property(t)&&(e(),r())}start(t){var e,r,i=this.Xa;if(i){this.Xh&&(this.Dd(),this.vd());var n=this.Oh.checkAndGetSessionAndWindowId(),s=n.windowId;this.Mi=n.sessionId,this.Ii=s,null==(e=this._instance.persistence)||e.unregister(Fi),null!=i&&i.endpoint&&(this.Fh=null==i?void 0:i.endpoint),this.Lh=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new as(this._instance,this.ih,this.wh.bind(this),this.xh.bind(this),this.kh.bind(this)):new ss(this._instance,this.ih,this.nh,this.sh,this.wh.bind(this),this.bh.bind(this),this.kh.bind(this)),this.Lh.onRemoteConfig(i),null==(r=this.Sh)||r.call(this),this.Sh=this.Lh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.Ld(t,e))),this.Fd(Ii,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Ii)})),this.Fd(Mi,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Mi)})),this.Fd(xi,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(xi)})),this.Fd(Ci,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Ci)})),this.Lh.makeSamplingDecisions(this.sessionId),this.Pd(),this.Uh||(Tr(Je,"beforeunload",this.ld),Tr(Je,"offline",this.fd),Tr(Je,"online",this.Bs),Tr(Je,"visibilitychange",this.ke),!this.Kh&&hr(this.Oh.onSessionId)&&(this.Kh=this.Oh.onSessionId(this.fi)),!this.td&&hr(this.Oh.on)?this.td=this.Oh.on("forcedIdleReset",(()=>{this.nd(),this.$h="unknown",this.stop(),this.ed=this.Oh.onSessionId(((t,e,r)=>{var i;null==(i=this.ed)||i.call(this),this.ed=void 0,this.fi(t,e,r)}))})):hr(this.Oh.on)||cs.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),pr(this.Yh)&&(this.Yh=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Sd(t.properties.$current_url):"";if(!e)return;this.xh("$pageview",{href:e})}}catch(t){cs.error("Could not add $pageview to rrweb session",t)}}))),this.status===Ui&&this.wh(t||"recording_initialized"))}else cs.info("remote config must be stored in persistence before recording can start")}Wd(){var t,e,r,i,n,s;null==Je||Je.removeEventListener("beforeunload",this.ld),null==Je||Je.removeEventListener("offline",this.fd),null==Je||Je.removeEventListener("online",this.Bs),null==Je||Je.removeEventListener("visibilitychange",this.ke),clearInterval(this.Ad),this.Bd(),null==(t=this.Yh)||t.call(this),this.Yh=void 0,null==(e=this.Sh)||e.call(this),this.Sh=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.Lh)||s.stop(),this.$d(),this.Dd()}Dd(){this.Qh+=1,this.Zh=[],this.Jh=0,this.Ud=void 0,this.Xh=!1}$d(){var t,e;null==(t=this.zd)||t.stop(),this.Bh=[],null==(e=this.Dh)||e.call(this),this.Dh=void 0}jd(){if(!this.Ud||0===this.Jh)return!1;if(this.Xh)return!0;this.Xh=!0;var t=this.Qh;return this.Bd(),this.$d(),this.Ud.catch((()=>{})).then((()=>{t===this.Qh&&(this.Xh=!1,this.dd(),this.vd(),this.Wd(),cs.info("stopped"))})).catch((()=>{this.Xh=!1,this.Wd(),cs.info("stopped")})),!0}stop(){this.jd()||(this.dd(),this.vd(),this.Wd(),cs.info("stopped"))}discard(){this.vd(),this.Wd(),cs.info("discarded")}qd(t,e,r,i,n){var s,a={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};t.type===bi.FullSnapshot&&null!=(s=ps())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this.jh=!0),this.status!==Bi?(this.Hd(t,i),this.Gd(a)):this.vd()}Hd(t,e){t.type!==bi.FullSnapshot?t.type===bi.IncrementalSnapshot&&(cr(this.Gh)||this.Gh===e||this.Vh===e||(this.Vh=e,cs.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.bh())):this.Gh=e}Vd(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))}Zd(t,e,r){t.processed||t.generation!==this.Qh||(t.processed=!0,this.qd(t.event,e,r,t.targetSessionId,t.targetWindowId))}Jd(t){try{var e=t.compressionEnabled?Os(t.event):{event:t.event,size:ln(t.event)};this.Zd(t,e.event,e.size)}finally{this.Vd(t)}}hd(){[...this.Zh].forEach((t=>{this.Jd(t)}))}Qd(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 e,i;try{var n=r?Cs(t)?yield function(t){return As.apply(this,arguments)}(t):Os(t):{event:t,size:ln(t)};e=n.event,i=n.size}catch(r){cs.error("could not process queued compression event - will use uncompressed event",r),e=t,i=ln(t)}s.Zd(a,e,i)}finally{s.Vd(a)}}));return function(){return i.apply(this,arguments)}}();this.Ud=this.Ud?this.Ud.catch((()=>{})).then(o):o()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.Rd(),t&&dr(t))){if(t.type===bi.Meta){var u=this.Sd(t.data.href);if(this.xd=u,!u)return;t.data.href=u}else this.Cd();if(null==(e=this.Lh)||e.checkUrlTriggers(this.sessionId,(()=>this.Ed()),(()=>this.Nd()),((t,e)=>this.Ld(t,e))),!this.ih.urlBlocked||(l=t).type===bi.Custom&&"recording paused"===l.data.tag){var l,h,d;t.type===bi.FullSnapshot&&(this.Od(),null==(h=this.zd)||h.reset(),null==(d=this._instance.persistence)||d.register_once({[Fi]:t.timestamp},void 0)),t.type===bi.FullSnapshot&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)&&this.Xd();var c=this.zd?this.zd.throttleMutations(t):t;if(c){var v=function(t){var e=t;if(e&&dr(e)&&6===e.type&&dr(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),f=function(t){return Ls(t)?t.data.payload:null}(v),p=function(t){return Fs(t)?t.data.payload:null}(v);if(f||p){var m=null!=f?f:p;null!=m&&m.lastActivityTimestamp&&(v.timestamp=m.lastActivityTimestamp)}else this.Yd(v);t.type===bi.FullSnapshot&&(this.Hh.push([this.Mi,t.timestamp]),this.Hh.length>6&&(this.Hh=this.Hh.slice(-6)));var g=null!==(i=null!==(n=null==f?void 0:f.currentSessionId)&&void 0!==n?n:null==p?void 0:p.nextSessionId)&&void 0!==i?i:this.Mi,y=null!==(s=null!==(a=null==f?void 0:f.currentWindowId)&&void 0!==a?a:null==p?void 0:p.nextWindowId)&&void 0!==s?s:this.Ii;if(!0!==this.$h||function(t){return Ns(t)||Ls(t)||Fs(t)}(v)){if(Ns(v)){var w=v.data.payload;w&&(v.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&&Cs(v))this.Qd(v,b,g,y);else{var k=b?Os(v):{event:v,size:ln(v)};this.qd(v,k.event,k.size,g,y)}}}}}}get status(){return this.Lh?this.Lh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Eh,rrwebError:this.Uh,urlTriggerMatching:this.ih,eventTriggerMatching:this.nh,linkedFlagMatching:this.sh,remoteConfig:this.Xa}):Bi}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.sh.linkedFlagSeen=!0,this.bh(),this.wh("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[Ti]:this.sessionId,[Si]:null}),this.bh(),this.wh("sampling_overridden")}overrideTrigger(t){this.Ld(t)}Kd(){try{var t,e=null==Je||null==(t=Je.location)?void 0:t.href;if(!e)return;var r=this.Sd(e);if(!r)return;return new URL(r).hostname||void 0}catch(t){return}}Bd(){this.tc&&(clearTimeout(this.tc),this.tc=void 0)}dd(){var t;this.Bd(),null==(t=this.Lh)||t.ensureSamplingDecision(this.sessionId);var e=this.od();if(this.status===zi||this.status===ji||this.status===Bi||e)return this.tc=setTimeout((()=>{this.dd()}),2e3),this.R;if(this.R.data.length>0){var r,i=this.Kd();dn(this.R).forEach((t=>{var e;null==(e=this.rd)||e.trackSize(t.sessionId,t.size),this.ec({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Sr.LIB_NAME,$lib_version:Sr.LIB_VERSION,$snapshot_host:i})})),null==(r=this.Lh)||r.onFlushComplete()}return this.vd()}Gd(t){var e,r=2+((null==(e=this.R)?void 0:e.data.length)||0),i=t.$session_id,n=this.R.sessionId!==i;(n||!0!==this.$h&&this.R.size+t.$snapshot_bytes+r>943718.4)&&(this.R=this.dd(),n&&this.R.data.length>0&&(this.R=this.vd()),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.tc||!0===this.$h||(this.tc=setTimeout((()=>{this.dd()}),2e3))}ec(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.Fh),_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],i=this.Oh.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}Xd(){if(!this.R||0===this.R.data.length)return this.vd();for(var t=-1,e=this.R.data.length-1;e>=0;e--)if(this.R.data[e].type===bi.Meta){t=e;break}return 0>t?this.vd():(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)}vd(){return this.R={size:0,data:[],sizes:[],sessionId:this.Mi,windowId:this.Ii},this.R}wh(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),cs.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.xh("$recording_started",r({reason:t},e))}rc(t){var e;return 3===t.type&&-1!==vs.indexOf(null==(e=t.data)?void 0:e.source)}Yd(t){var e=this.rc(t);e||this.$h||t.timestamp-this.Ph>this.Ah&&(this.$h=!0,clearInterval(this.Ad),this.xh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Ph,threshold:this.Ah,bufferLength:this.R.data.length,bufferSize:this.R.size}),this.dd());var r=!1;if(e&&(this.Ph=t.timestamp,this.$h)){var i="unknown"===this.$h;this.$h=!1,i||(this.xh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!0!==this.$h){var n=this.Oh.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.Mi!==a,u=this.Ii!==s;this.Ii=s,this.Mi=a,o||u?(this.stop(),this.start("session_id_changed")):r&&this.Od()}}nd(){var t;null==(t=this.Lh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e=this.Oh.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.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this.rd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Hh,$snapshot_max_depth_exceeded:this.jh,$sdk_debug_replay_rrweb_error:this.Uh,$sdk_debug_rrweb_attached:!!this.Dh,$sdk_debug_rrweb_start_attempted:this.zh}}Pd(){var t;if(!this.Dh){this.zh=!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,attributeFilter:void 0},a=this._instance.config.session_recording;for(var o of Object.entries(a||{})){var u=o[0],l=o[1];u in s&&("maskInputOptions"===u?s.maskInputOptions=r({password:!0},l):s[u]=l)}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.pd&&(s.maskAllInputs=null===(e=this.pd.maskAllInputs)||void 0===e||e,s.maskTextSelector=null!==(i=this.pd.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(n=this.pd.blockSelector)&&void 0!==n?n:void 0),this.md();var h=ms();if(h){this.zd=null!==(t=this.zd)&&void 0!==t?t:new Zn(h,{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";cs.info(r,{node:e}),this.log(ds+" "+r,"warn")}});var d=this.kd();if(this.Dh=h(r({emit:t=>{this.onRRwebEmit(t)},plugins:d},s)),!this.Dh)return this.Uh=!0,void cs.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.Uh=!1,this.Ph=Date.now(),this.$h=gr(this.$h)?this.$h:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Xa),this.xh("$session_options",{sessionRecordingOptions:s,activePlugins:d.map((t=>null==t?void 0:t.name))}),this.xh("$posthog_config",{config:this._instance.config})}else cs.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.xh(t,e)}}er.__PosthogExtensions__=er.__PosthogExtensions__||{},er.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:Ze,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:wi,options:t})},er.__PosthogExtensions__.rrweb={record:Le,version:"v2",wasMaxDepthReached:()=>dt,resetMaxDepthState(){dt=!1,ht=!1}},er.__PosthogExtensions__.initSessionRecording=t=>new Ds(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||{}),v=(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))(v||{}),f={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 f?f[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");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?((u=navigator.userAgent).includes("Safari")&&!u.includes("Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),m[t]=d):r}catch(t){return r}finally{!l&&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 _(){return g("MutationObserver").constructor}function S(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t[e];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else t[e]=n.next}}catch(t){return()=>{}}}var I={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:_,patch:S};function M(t){return t.nodeType===t.ELEMENT_NODE}function C(t){var e=t&&"host"in t&&"mode"in t&&I.host(t)||null;return Boolean(e&&"shadowRoot"in e&&I.shadowRoot(e)===t)}function x(t){return"[object ShadowRoot]"==={}.toString.call(t)}function T(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=>R(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 R(t,e){var r;if(function(t){return"styleSheet"in t}(t)){var i;try{i=T(t.styleSheet)||function(t){var e=t.cssText;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 B(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?B(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))),M(t)){var r=I.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 A(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&E(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function E(t){return t.toLowerCase()}var N="__rrweb_original__";function L(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?E(e):null}catch(t){return null}}var F=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,D=/^(?:[a-z+]+:)?\/\//i,P=/^www\..*/i,W=/^(data:)([^,]*),(.*)/i;function B(t,e){return(t||"").replace(F,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(D.test(u)||P.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 U,z,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?B(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(I.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&it(I.parentNode(t),e,r)}function nt(t,e,r,i){var n;if(M(t)){if(!I.childNodes(n=t).length)return!1}else{if(null===I.parentElement(t))return!1;n=I.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}function st(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var at=new Map;function ot(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function ut(t){return null==t?"":t.toLowerCase()}var lt=50,ht=!1,dt=!1;function ct(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,f=void 0===c?{}:c,p=e.maskTextFn,m=e.maskInputFn,g=e.slimDOMOptions,y=e.dataURLOptions,w=void 0===y?{}:y,b=e.inlineImages,k=void 0!==b&&b,_=e.recordCanvas,S=void 0!==_&&_,R=e.onSerialize,O=e.onIframeLoad,F=e.iframeLoadTimeout,D=void 0===F?5e3:F,P=e.onIframeListenerRegistered,W=e.onStylesheetLoad,j=e.stylesheetLoadTimeout,q=void 0===j?5e3:j,H=e.keepIframeSrcFn,J=void 0===H?()=>!1:H,Q=e.newlyAddedElement,X=void 0!==Q&&Q,Y=e.depth,tt=void 0===Y?0:Y,it=e.maxDepth,vt=void 0===it?lt:it,ft=e.needsMask,pt=e.preserveWhiteSpace,mt=void 0===pt||pt;if(tt>=vt)return dt=!0,ht||(ht=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+vt+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;ft||(ft=nt(t,a,o,void 0===ft));var gt,yt=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,f=e.inlineImages,p=e.recordCanvas,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:v.Document,childNodes:[],compatMode:t.compatMode}:{type:v.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:v.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:w};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s,a=e.doc,o=e.inlineStylesheet,u=e.maskInputOptions,l=void 0===u?{}:u,h=e.maskInputFn,d=e.dataURLOptions,c=void 0===d?{}:d,f=e.inlineImages,p=e.recordCanvas,m=e.keepIframeSrcFn,g=e.newlyAddedElement,y=void 0!==g&&g,w=e.rootId,b=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,e.blockClass,e.blockSelector),k=function(t){if(t instanceof HTMLFormElement)return"form";var e=E(t.tagName);return G.test(e)?"div":e}(t),_={},S=t.attributes.length,M=0;S>M;M++){var C=t.attributes[M];rt(k,C.name)||(_[C.name]=et(a,k,E(C.name),C.value,t,c))}if("link"===k&&o){var x=t.sheet;if(!x){var R=function(t){return t.href}(t);R&&!(x=ot(a,R))&&R.includes(".css")&&(x=ot(a,window.location.origin+"/"+R.replace(window.location.href,"")))}var O=null;x&&(O=T(x)),O&&(delete _.rel,delete _.href,_._cssText=O)}if("style"===k&&t.sheet&&!(t.innerText||I.textContent(t)||"").trim().length){var F=T(t.sheet);F&&(_._cssText=F)}if("input"===k||"textarea"===k||"select"===k){var D=t.value,P=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&D?_.value=A({element:t,type:L(t),tagName:k,value:D,maskInputOptions:l,maskInputFn:h}):P&&(_.checked=P)}if("option"===k&&(t.selected&&!l.select?_.selected=!0:delete _.selected),"dialog"===k&&t.open)try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}if("canvas"===k&&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((N in n?n[N]: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)||(_.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){var W=t.toDataURL(c.type,c.quality),B=a.createElement("canvas");B.width=t.width,B.height=t.height,W!==B.toDataURL(c.type,c.quality)&&(_.rr_dataURL=W)}if("img"===k&&f){U||(U=a.createElement("canvas"),z=U.getContext("2d"));var j=t,q=j.currentSrc||j.getAttribute("src")||"<unknown-src>",H=j.crossOrigin,V=()=>{st(j,"load",V);try{U.width=j.naturalWidth,U.height=j.naturalHeight,z.drawImage(j,0,0),_.rr_dataURL=U.toDataURL(c.type,c.quality)}catch(t){if("anonymous"!==j.crossOrigin)return j.crossOrigin="anonymous",void(j.complete&&0!==j.naturalWidth?V():j.addEventListener("load",V));console.warn("Cannot inline img src="+q+"! Error: "+t)}"anonymous"===j.crossOrigin&&(H?_.crossOrigin=H:j.removeAttribute("crossorigin"))};j.complete&&0!==j.naturalWidth?V():j.addEventListener("load",V)}if("audio"===k||"video"===k){var Z=_;Z.rr_mediaState=t.paused?"paused":"played",Z.rr_mediaCurrentTime=t.currentTime,Z.rr_mediaPlaybackRate=t.playbackRate,Z.rr_mediaMuted=t.muted,Z.rr_mediaLoop=t.loop,Z.rr_mediaVolume=t.volume}if(y||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),b){var J=t.getBoundingClientRect(),Q=J.width,X=J.height,Y=J.left,K=J.top,tt=null==(r=a.defaultView)?void 0:r.getComputedStyle(t);_={class:_.class,rr_width:Q+"px",rr_height:X+"px",rr_left:Math.floor(Y+((null==(i=a.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(K+((null==(n=a.defaultView)?void 0:n.scrollY)||0))+"px"},tt&&(_.rr_position=tt.position||"static",tt.transform&&"none"!==tt.transform&&(_.rr_transform=tt.transform),tt.display&&tt.display.startsWith("inline")&&(_.rr_display=tt.display))}"iframe"!==k||m(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src);try{customElements.get(k)&&(s=!0)}catch(t){}return{type:v.Element,tagName:k,attributes:_,childNodes:[],isSVG:(it=t,Boolean("svg"===it.tagName||it.ownerSVGElement)||void 0),needBlock:b,rootId:w,isCustom:s};var it}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,dataURLOptions:c,inlineImages:f,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:y,rootId:w});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=I.parentNode(t),o=a&&a.tagName,u=I.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=T(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=B(u,K(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,I.parentElement(t)):u.replace(/[\S]/g,"*")),{type:v.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:w});case t.CDATA_SECTION_NODE:return{type:v.CDATA,textContent:"",rootId:w};case t.COMMENT_NODE:return{type:v.Comment,textContent:I.textContent(t)||"",rootId:w};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,dataURLOptions:w,inlineImages:k,recordCanvas:S,keepIframeSrcFn:J,newlyAddedElement:X});if(!yt)return console.warn(t,"not serialized"),null;gt=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===v.Comment)return!0;if(t.type===v.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&&(ut(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===ut(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(ut(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&ut(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(ut(t.attributes.property).match(/^(og|twitter|fb):/)||ut(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===ut(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(ut(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(ut(t.attributes.name))||ut(t.attributes.property).match(/^article:/)||ut(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(ut(t.attributes.name)))return!0}}return!1}(yt,g)||!mt&&yt.type===v.Text&&!yt.isStyle&&!yt.textContent.replace(/^\s+|\s+$/gm,"").length?V:Z();var wt=Object.assign(yt,{id:gt});if(i.add(t,wt),gt===V)return null;R&&R(t);var bt=!l;if(wt.type===v.Element){bt=bt&&!wt.needBlock,delete wt.needBlock;var kt=I.shadowRoot(t);kt&&x(kt)&&(wt.isShadowHost=!0)}if((wt.type===v.Document||wt.type===v.Element)&&bt){g.headWhitespace&&wt.type===v.Element&&"head"===wt.tagName&&(mt=!1);var _t={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:g,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:mt,onSerialize:R,onIframeLoad:O,iframeLoadTimeout:D,onIframeListenerRegistered:P,onStylesheetLoad:W,stylesheetLoadTimeout:q,keepIframeSrcFn:J,depth:tt+1,maxDepth:vt};if(wt.type===v.Element&&"textarea"===wt.tagName&&void 0!==wt.attributes.value);else for(var St of Array.from(I.childNodes(t))){var It=ct(St,_t);It&&wt.childNodes.push(It)}var Mt=null;if(M(t)&&(Mt=I.shadowRoot(t)))for(var Ct of Array.from(I.childNodes(Mt))){var xt=ct(Ct,_t);xt&&(x(Mt)&&(xt.isShadow=!0),wt.childNodes.push(xt))}}var Tt=I.parentNode(t);if(Tt&&C(Tt)&&x(Tt)&&(wt.isShadow=!0),wt.type===v.Element&&"iframe"===wt.tagName){var Rt=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),st(t,"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?st(t,"load",a):(o=!0,st(t,"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 v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),st(t,"load",a)}}return t.addEventListener("load",a),()=>{st(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&O){var r=ct(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:g,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:mt,onSerialize:R,onIframeLoad:O,iframeLoadTimeout:D,onIframeListenerRegistered:P,onStylesheetLoad:W,stylesheetLoadTimeout:q,keepIframeSrcFn:J,depth:tt+1,maxDepth:vt});r&&O(t,r)}}),D);null==P||P(t,Rt)}return wt.type===v.Element&&"link"===wt.tagName&&"stylesheet"===wt.attributes.rel&&function(e,u,l){if(!at.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,v=!1,y=()=>{if(!v){v=!0;try{(()=>{if(W){var e=ct(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:ft,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:g,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:mt,onSerialize:R,onIframeLoad:O,iframeLoadTimeout:D,onStylesheetLoad:W,stylesheetLoadTimeout:q,keepIframeSrcFn:J,depth:tt,maxDepth:vt});e&&W(t,e)}})()}finally{at.delete(e),c.abort()}}},b=setTimeout(y,l);c.signal.addEventListener("abort",(()=>clearTimeout(b)),{once:!0}),e.addEventListener("load",y,{signal:c.signal,once:!0}),at.set(e,c)}}}(t,0,q),wt}function vt(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 pt(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>mt(r,t,e,i)}function mt(t,e,r,i){gt((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function gt(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var yt="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.",wt={map:{},getId(){return console.error(yt),-1},getNode(){return console.error(yt),null},removeNodeFromMap(){console.error(yt)},has(){return console.error(yt),!1},reset(){console.error(yt)}};function bt(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 kt(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){if(setTimeout((()=>{try{r.set.call(this,t)}catch(t){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>kt(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(wt=new Proxy(wt,{get(t,e,r){return"map"===e&&console.error(yt),Reflect.get(t,e,r)}}));var _t=Date.now;function St(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=I.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=I.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function It(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Mt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ct(t){return t?t.nodeType===t.ELEMENT_NODE?t:I.parentElement(t):null}function xt(t,e,r,i){if(!t)return!1;var n=Ct(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 Tt(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===V}function Rt(t,e){if(C(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=I.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||Rt(i,e))}function Ot(t){return Boolean(t.changedTouches)}function At(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Et(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Nt(t){return!!t&&(t instanceof ft&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(I.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(_t=()=>(new Date).getTime());class Lt{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 Ft(t){var e,r=null;return"getRootNode"in t&&(null==(e=I.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(t))&&(r=I.host(I.getRootNode(t))),r}function Dt(t){var e=t.ownerDocument;return!!e&&(I.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=Ft(r);)r=e;return r}(t);return I.contains(e,r)}(t))}function Pt(t){return"__ln"in t}class Wt{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&&Pt(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&&Pt(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,$t=(t,e)=>t+"@"+e;class Ut{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 Wt,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=I.parentNode(n);if(s&&Dt(n)&&"TEXTAREA"!==s.tagName){var a=C(s)?this.mirror.getId(Ft(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=ct(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=>{At(t,this.mirror)&&this.iframeManager.addIframe(t),Et(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Nt(n)&&this.shadowDomManager.addShadowRoot(I.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)jt(this.removesSubTreeCache,s)&&!this.movedSet.has(I.parentNode(s))||n(s);for(var a of this.addedSet)qt(this.droppedSet,a)||jt(this.removesSubTreeCache,a)?qt(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(I.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 v=this.mirror.getId(I.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=I.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=I.host(f);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=I.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 e=t.attributes;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(I.childNodes(t),(t=>I.textContent(t)||"")).join("");e.attributes.value=A({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:L(t),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(t=>{if(!Tt(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var e=I.textContent(t.target);xt(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,Ct(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=L(r);n=A({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:n,maskInputFn:this.maskInputFn})}if(xt(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(xt(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=C(t.target)?this.mirror.getId(I.host(t.target)):this.mirror.getId(t.target);xt(t.target,this.blockClass,this.blockSelector,!1)||Tt(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(zt(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||Rt(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[$t(r,i)]?zt(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!C(t.target)||!x(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),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)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Tt(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[$t(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);xt(t,this.blockClass,this.blockSelector,!1)||(I.childNodes(t).forEach((t=>this.genAdds(t))),Nt(t)&&I.childNodes(I.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.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 zt(t,e){t.delete(e),I.childNodes(e).forEach((e=>zt(t,e)))}function jt(t,e,r){return 0!==t.size&&function(t,e,r){var i=I.parentNode(e);return!!i&&t.has(i)}(t,e)}function qt(t,e){return 0!==t.size&&Ht(t,e)}function Ht(t,e){var r=I.parentNode(e);return!!r&&(!!t.has(r)||Ht(t,r))}var Gt=t=>Bt?function(){try{return t(...arguments)}catch(t){if(Bt&&!0===Bt(t))return;throw t}}:t,Vt=[];function Zt(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 Jt(t,e){var r=new Ut;Vt.push(r),r.init(t);var i=new(_())(Gt(r.processMutations.bind(r))),n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),i.observe(e,n),{observer:i,buffer:r}}function Qt(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=Zt(t);if(a&&!xt(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=St(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=[pt("scroll",Gt(bt(Gt((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(pt("scrollend",Gt(u),r)),()=>l.forEach((t=>t()))}function Xt(t,e){for(var r=Vt.length-1;r>=0;r--){var i=Vt[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Vt.splice(r,1))}}}var Yt=["INPUT","TEXTAREA","SELECT"],Kt=new WeakMap;function te(t){return function t(e,r){if(ne("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ne("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ne("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ne("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 ee(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}function re(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:I.host(e));var o="#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,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),Gt((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function ie(t,e){void 0===e&&(e={});var i,n,s=t.doc.defaultView;if(!s)return()=>{};if(function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;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),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e),t.recordDOM){var a=Jt(t,t.doc);i=a.observer,n=a.buffer}var o,d,v,f,p,m,g,y,w,b=function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;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=bt(Gt((t=>{var r=Date.now()-s;e(l.map((t=>(t.timeOffset-=r,t))),t),l=[],s=null})),o),d=Gt(bt(Gt((t=>{var e=Zt(t),r=Ot(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=_t()),l.push({x:i,y:a,id:n.getId(e),timeOffset:_t()-s}),h("undefined"!=typeof DragEvent&&t instanceof DragEvent?u.Drag:t instanceof MouseEvent?u.MouseMove:u.TouchMove)})),a,{trailing:!1})),c=[pt("mousemove",d,i),pt("touchmove",d,i),pt("drag",d,i)];return Gt((()=>{c.forEach((t=>t()))}))}(t),k=function(t){var e=t.mouseInteractionCb,i=t.doc,n=t.mirror,s=t.blockClass,a=t.blockSelector,o=t.sampling;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=Zt(i);if(!xt(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 Ot(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 v=Ot(i)?i.changedTouches[0]:i;if(v){var f=n.getId(o),p=v.clientX,m=v.clientY;Gt(e)(r({type:l[d],id:f,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(pt(o,u,i))})),Gt((()=>{d.forEach((t=>t()))}))}(t),_=Qt(t),M=function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return pt("resize",Gt(bt(Gt((()=>{var t=It(),e=Mt();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:s}),C=function(t){var e=t.inputCb,i=t.doc,n=t.mirror,s=t.blockClass,a=t.blockSelector,o=t.ignoreClass,u=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=Zt(t),r=t.isTrusted,n=i.defaultView;if(!e||!n||e instanceof n.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=I.parentElement(e)),e&&c&&Yt.indexOf(c)>=0&&!xt(e,s,a,!0)&&!(e.classList.contains(o)||u&&e.matches(u))){var f=e.value,p=!1,m=L(e)||"";"radio"===m||"checkbox"===m?p=e.checked:(l[c.toLowerCase()]||l[m])&&(f=A({element:e,maskInputOptions:l,tagName:c,type:m,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:r}:{text:f,isChecked:p});var g=e.name;"radio"===m&&g&&p&&i.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,i){var s=Kt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Kt.set(t,i);var a=n.getId(t);Gt(e)(r({},i,{id:a}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>pt(t,Gt(c),i))),p=i.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var m=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return m&&m.set&&f.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map((t=>kt(t[0],t[1],{set(){Gt(c)({target:this,isTrusted:!1})}},!1,p)))),Gt((()=>{f.forEach((t=>t()))}))}(t),x=(d=(o=t).mediaInteractionCb,v=o.blockClass,f=o.blockSelector,p=o.mirror,m=o.sampling,g=o.doc,y=Gt((t=>bt(Gt((e=>{var r=Zt(e);if(r&&!xt(r,v,f,!0)){var i=r.currentTime,n=r.volume,s=r.muted,a=r.playbackRate,o=r.loop;d({type:t,id:p.getId(r),currentTime:i,volume:n,muted:s,playbackRate:a,loop:o})}})),m.media||500))),w=[pt("play",y(c.Play),g),pt("pause",y(c.Pause),g),pt("seeked",y(c.Seeked),g),pt("volumechange",y(c.VolumeChange),g),pt("ratechange",y(c.RateChange),g)],Gt((()=>{w.forEach((t=>t()))}))),T=()=>{},R=()=>{},O=()=>{},N=()=>{};t.recordDOM&&(T=function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Gt(((t,e,s)=>{var a=s[0],o=s[1],u=ee(e,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,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:Gt(((t,e,s)=>{var a=s[0],o=ee(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,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:Gt(((t,e,s)=>{var a=s[0],o=ee(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replace:a}),t.apply(e,s)}))})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Gt(((t,e,s)=>{var a=s[0],o=ee(e,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,replaceSync:a}),t.apply(e,s)}))}));var h={};se("CSSGroupingRule")?h.CSSGroupingRule=s.CSSGroupingRule:(se("CSSMediaRule")&&(h.CSSMediaRule=s.CSSMediaRule),se("CSSConditionRule")&&(h.CSSConditionRule=s.CSSConditionRule),se("CSSSupportsRule")&&(h.CSSSupportsRule=s.CSSSupportsRule));var d={};return Object.entries(h).forEach((t=>{var e=t[0],s=t[1];d[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(d[e].insertRule,{apply:Gt(((t,e,s)=>{var a=s[0],o=s[1],u=ee(e.parentStyleSheet,i,n.styleMirror),l=u.id,h=u.styleId;return(l&&-1!==l||h&&-1!==h)&&r({id:l,styleId:h,adds:[{rule:a,index:[...te(e),o||0]}]}),t.apply(e,s)}))}),s.prototype.deleteRule=new Proxy(d[e].deleteRule,{apply:Gt(((t,e,s)=>{var a=s[0],o=ee(e.parentStyleSheet,i,n.styleMirror),u=o.id,l=o.styleId;return(u&&-1!==u||l&&-1!==l)&&r({id:u,styleId:l,removes:[{index:[...te(e),a]}]}),t.apply(e,s)}))})})),Gt((()=>{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=t[0],r=t[1];r.prototype.insertRule=d[e].insertRule,r.prototype.deleteRule=d[e].deleteRule}))}))}(t,{win:s}),R=re(t,t.doc),O=function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Gt(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2];if(n.has(l))return o.apply(e,[l,h,d]);var c=ee(null==(u=e.parentRule)?void 0:u.parentStyleSheet,i,s.styleMirror),v=c.id,f=c.styleId;return(v&&-1!==v||f&&-1!==f)&&r({id:v,styleId:f,set:{property:l,value:h,priority:d},index:te(e.parentRule)}),t.apply(e,a)}))});var u=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:Gt(((t,e,a)=>{var o,l=a[0];if(n.has(l))return u.apply(e,[l]);var h=ee(null==(o=e.parentRule)?void 0:o.parentStyleSheet,i,s.styleMirror),d=h.id,c=h.styleId;return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:l},index:te(e.parentRule)}),t.apply(e,a)}))}),Gt((()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=u}))}(t,{win:s}),t.collectFonts&&(N=function(t){var e=t.fontCb,r=t.doc,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=S(r.fonts,"add",(function(t){return function(r){return setTimeout(Gt((()=>{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),Gt((()=>{n.forEach((t=>t()))}))}(t)));var F=function(t){var e=t.doc,r=t.mirror,i=t.blockClass,n=t.blockSelector,s=t.selectionCb,a=!0,o=Gt((()=>{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),d=h.startContainer,c=h.startOffset,v=h.endContainer,f=h.endOffset;xt(d,i,n,!0)||xt(v,i,n,!0)||o.push({start:r.getId(d),startOffset:c,end:r.getId(v),endOffset:f})}s({ranges:o})}}));return o(),pt("selectionchange",o)}(t),D=function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?S(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t),P=[];for(var W of t.plugins)P.push(W.observer(W.callback,s,W.options));return Gt((()=>{if(n){n.destroy(),n.reset();var e=Vt.indexOf(n);-1!==e&&Vt.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==i||i.disconnect(),b(),k(),_(),M(),C(),x(),T(),R(),O(),N(),F(),D(),P.forEach((t=>t()))}))}function ne(t){return void 0!==window[t]}function se(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class ae{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 oe{constructor(t){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new ae(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 ae(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=>gt(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{mt(t.win,"pagehide",t.handler)})),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);gt((()=>{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)}))}gt((()=>{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===v.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);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(mt(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(mt(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{gt((()=>this.mirror.removeNodeFromMap(t)))})),gt((()=>Xt(r,s))),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 r=t.content;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&&mt(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{mt(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),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 ue{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){var i,n;if(x(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var s=null!==(i=null==(n=I.host(t))?void 0:n.ownerDocument)&&void 0!==i?i:e,a=Jt(r({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),o=a.observer,u=a.buffer;this.restoreHandlers.push({doc:s,handler(){o.disconnect(),u.destroy(),u.releaseCanvasManager();var t=Vt.indexOf(u);-1!==t&&Vt.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:Qt(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(I.host(t))),this.restoreHandlers.push({doc:s,handler:re({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({doc:e,handler:S(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=I.shadowRoot(this);return s&&Dt(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}for(var le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",he="undefined"==typeof Uint8Array?[]:new Uint8Array(256),de=0;64>de;de++)he[le.charCodeAt(de)]=de;var ce=new Map,ve=(t,e,r)=>{if(t&&(me(t,e)||"object"==typeof t)){var i=function(t,e){var r=ce.get(t);return r||ce.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 fe(t,e,r,i){if(t instanceof Array)return t.map((t=>fe(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+=le[r[e]>>2],n+=le[(3&r[e])<<4|r[e+1]>>4],n+=le[(15&r[e+1])<<2|r[e+2]>>6],n+=le[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}}return t instanceof DataView?{rr_type:t.constructor.name,args:[fe(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[fe(t.data,e,r,i),t.width,t.height]}:me(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ve(t,e,r)}:t}var pe=(t,e,r,i)=>t.map((t=>fe(t,e,r,i))),me=(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])))},ge=["webgl","webgl2"];function ye(t){return"nodeType"in t}function we(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 S(n.prototype,"configure",(function(n){return function(s){var a=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!a||ye(a)&&xt(a,e,i,!0))return n.call(this,s);ye(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=S(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(!xt(this,e,i,!0)&&("__context"in this||(this.__context=s),n&&ge.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 be(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=S(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(ve(d,s,this),"tagName"in this.canvas&&!xt(this.canvas,i,n,!0)){var c=pe(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(i){var h=kt(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 ke,_e,Se,Ie='(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 transparentFingerprintMap = /* @__PURE__ */ new Map();\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\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 {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n return worker.postMessage({ id });\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\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-CZCeNtwG.js.map\n',Me="undefined"!=typeof self&&self.Blob&&new Blob([Ie],{type:"text/javascript;charset=utf-8"});function Ce(t){var e;try{if(!(e=Me&&(self.URL||self.webkitURL).createObjectURL(Me)))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(Ie),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class xe{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 e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,o=t.recordCanvas,u=t.dataURLOptions,l=t.resolutionScale;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,u),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:u,resolutionScale:l})}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,u="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=we(r,i,n,!0),h=new Map;try{o=new Ce}catch(t){return}var c=!1;o.onerror=()=>{var t;c=!0,cancelAnimationFrame(v),null==(t=o.terminate)||t.call(o)},o.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:d["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var v,f=1e3/t,p=0,m=t=>{var l,d;c||(p&&f>t-p||(p=t,(l=[],d=t=>{try{t.querySelectorAll("canvas").forEach((t=>{xt(t,i,n,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&d(t.shadowRoot)}))}catch(t){}},d(r.document),l).forEach(function(){var t=e((function*(t){var e,r,i=a.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.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 h.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});o.postMessage({id:i,bitmap:f,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:s.dataURLOptions},[f])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),v=requestAnimationFrame(m))};v=requestAnimationFrame(m),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(v),null==(t=o.terminate)||t.call(o)}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=we(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=S(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 xt(this.canvas,r,i,!0)||setTimeout((()=>{var r=pe(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=kt(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(...be(e.WebGLRenderingContext.prototype,d.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...be(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)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class Te{constructor(t){a(this,"trackedLinkElements",new WeakSet),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"styleMirror",new Lt),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:R(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,at.forEach((t=>t.abort())),at.clear()}trackStylesheetInLinkElement(t){}}class Re{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 Oe=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var Ae=document.createElement("iframe");document.body.appendChild(Ae),Array.from=(null==(i=Ae.contentWindow)?void 0:i.Array.from)||Array.from,document.body.removeChild(Ae)}}catch(t){console.debug("Unable to override Array.from",t)}var Ee=new O,Ne=new Set([u.Mutation,u.MediaInteraction,u.StyleSheetRule,u.CanvasMutation,u.Font,u.Log,u.StyleDeclaration,u.AdoptedStyleSheet]);function Le(t){void 0===t&&(t={});var e=t,i=e.emit,n=e.checkoutEveryNms,s=e.checkoutEveryNth,a=e.blockClass,l=void 0===a?"rr-block":a,h=e.blockSelector,d=void 0===h?null:h,c=e.ignoreClass,v=void 0===c?"rr-ignore":c,f=e.ignoreSelector,p=void 0===f?null:f,m=e.maskTextClass,g=void 0===m?"rr-mask":m,y=e.maskTextSelector,w=void 0===y?null:y,b=e.inlineStylesheet,k=void 0===b||b,_=e.maskAllInputs,S=e.maskInputOptions,M=e.slimDOMOptions,C=e.maskInputFn,x=e.maskTextFn,T=e.hooks,R=e.packFn,A=e.sampling,E=void 0===A?{}:A,N=e.dataURLOptions,L=void 0===N?{}:N,F=e.canvasResolutionScale,D=e.mousemoveWait,P=e.recordDOM,W=void 0===P||P,B=e.recordCanvas,U=void 0!==B&&B,z=e.recordCrossOriginIframes,j=void 0!==z&&z,q=e.recordAfter,H=void 0===q?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":q,G=e.userTriggeredOnInput,V=void 0!==G&&G,Z=e.collectFonts,J=void 0!==Z&&Z,Q=e.inlineImages,X=void 0!==Q&&Q,Y=e.plugins,K=e.keepIframeSrcFn,tt=void 0===K?()=>!1:K,et=e.ignoreCSSAttributes,rt=void 0===et?new Set([]):et,it=e.attributeFilter;Bt=e.errorHandler;var nt=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},L),st=!j||window.parent===window,at=!1;if(!st)try{window.parent.document&&(at=!1)}catch(t){at=!0}if(st&&!i)throw new Error("emit function is required");if(!st&&!at)return()=>{};void 0!==D&&void 0===E.mousemove&&(E.mousemove=D),Ee.reset();var ot,ut=!0===_?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==S?S:{password:!0},lt=vt(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 ht,dt,ft=0,mt=new Map,yt=t=>{for(var e of Y||[])e.eventProcessor&&(t=e.eventProcessor(t));return R&&!at&&(t=R(t)),t};ke=(t,e)=>{var r,a=t;if(a.timestamp=_t(),!(null==(r=Vt[0])?void 0:r.isFrozen())||a.type===o.FullSnapshot||a.type===o.IncrementalSnapshot&&Ne.has(a.data.source)||Vt.forEach((t=>t.unfreeze())),st)null==i||i(yt(a),e);else if(at){var l={type:"rrweb",event:yt(a),origin:window.location.origin,isCheckout:e};window.parent.postMessage(l,"*")}if(a.type===o.FullSnapshot)ot=a,ft=0;else if(a.type===o.IncrementalSnapshot){if(a.data.source===u.Mutation&&a.data.isAttachIframe)return;ft++,(s&&ft>=s||n&&a.timestamp-ot.timestamp>n)&&_e(!0)}};var wt=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=Ee.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}t.removes.forEach((t=>{var r=t.id;if(!e||!e.has(r)){var n=xt.getIframeElementById(r);n&&i.has(n)?xt.forgetIframeId(r):(null==ht||ht(r),xt.removeIframeById(r))}})),null==dt||dt(),xt.cleanupDetachedIframes()}ke({type:o.IncrementalSnapshot,data:r({source:u.Mutation},t)})},bt=t=>ke({type:o.IncrementalSnapshot,data:r({source:u.Scroll},t)}),kt=t=>ke({type:o.IncrementalSnapshot,data:r({source:u.CanvasMutation},t)}),Ct=new Te({mutationCb:wt,adoptedStyleSheetCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},t)})}),xt=new oe({mirror:Ee,mutationCb:wt,stylesheetManager:Ct,recordCrossOriginIframes:j,wrappedEmit:ke});for(var Tt of Y||[])Tt.getMirror&&Tt.getMirror({nodeMirror:Ee,crossOriginIframeMirror:xt.crossOriginIframeMirror,crossOriginIframeStyleMirror:xt.crossOriginIframeStyleMirror});var Rt=new Re;Se=new xe({recordCanvas:U,mutationCb:kt,win:window,blockClass:l,blockSelector:d,mirror:Ee,sampling:E.canvas,dataURLOptions:nt,resolutionScale:F});var Ot=new ue({mutationCb:wt,scrollCb:bt,bypassOptions:{blockClass:l,blockSelector:d,maskTextClass:g,maskTextSelector:w,inlineStylesheet:k,maskInputOptions:ut,dataURLOptions:nt,maskTextFn:x,maskInputFn:C,recordCanvas:U,inlineImages:X,sampling:E,slimDOMOptions:lt,iframeManager:xt,stylesheetManager:Ct,canvasManager:Se,keepIframeSrcFn:tt,processedNodeManager:Rt,attributeFilter:it},mirror:Ee});_e=function(t){if(void 0===t&&(t=!1),W){ke({type:o.Meta,data:{href:window.location.href,width:Mt(),height:It()}},t),Ct.reset(),Ot.init(),Vt.forEach((t=>t.lock()));var e=function(t,e){var r=e||{},i=r.mirror,n=void 0===i?new O:i,s=r.blockClass,a=r.blockSelector,o=r.maskTextClass,u=r.maskTextSelector,l=r.inlineStylesheet,h=r.inlineImages,d=void 0!==h&&h,c=r.recordCanvas,v=void 0!==c&&c,f=r.maskAllInputs,p=void 0!==f&&f,m=r.slimDOM,g=r.dataURLOptions,y=r.preserveWhiteSpace,w=r.onSerialize,b=r.onIframeLoad,k=r.iframeLoadTimeout,_=r.onIframeListenerRegistered,S=r.onStylesheetLoad,I=r.stylesheetLoadTimeout,M=r.keepIframeSrcFn,C=void 0===M?()=>!1:M,x=r.maxDepth;return ct(t,{doc:t,mirror:n,blockClass:void 0===s?"rr-block":s,blockSelector:void 0===a?null:a,maskTextClass:void 0===o?"rr-mask":o,maskTextSelector:void 0===u?null:u,skipChild:!1,inlineStylesheet:void 0===l||l,maskInputOptions:!0===p?{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===p?{password:!0}:p,maskTextFn:r.maskTextFn,maskInputFn:r.maskInputFn,slimDOMOptions:vt(void 0!==m&&m),dataURLOptions:g,inlineImages:d,recordCanvas:v,preserveWhiteSpace:y,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:k,onIframeListenerRegistered:_,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:x})}(document,{mirror:Ee,blockClass:l,blockSelector:d,maskTextClass:g,maskTextSelector:w,inlineStylesheet:k,maskAllInputs:ut,maskTextFn:x,maskInputFn:C,slimDOM:lt,dataURLOptions:nt,recordCanvas:U,inlineImages:X,onSerialize(t){At(t,Ee)&&xt.addIframe(t),Et(t,Ee)&&Ct.trackLinkElement(t),Nt(t)&&Ot.addShadowRoot(I.shadowRoot(t),document)},onIframeLoad(t,e){xt.attachIframe(t,e),Ot.observeAttachShadow(t)},onIframeListenerRegistered(t,e){xt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){Ct.attachLinkElement(t,e)},keepIframeSrcFn:tt});if(!e)return console.warn("Failed to snapshot the document");ke({type:o.FullSnapshot,data:{node:e,initialOffset:St(window)}},t),Vt.forEach((t=>t.unlock())),j&&xt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ct.adoptStyleSheets(document.adoptedStyleSheets,Ee.getId(document))}};try{var Lt=[];ht=t=>{var e=mt.get(t);e&&(e.forEach((t=>{gt(t);var e=Lt.indexOf(t);-1!==e&&Lt.splice(e,1)})),mt.delete(t))},dt=()=>{for(var t of mt){var e=t[0],r=Ee.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==ht||ht(e)}catch(t){null==ht||ht(e)}else null==ht||ht(e)}};var Ft=t=>{var e;return Gt(ie)({mutationCb:wt,mousemoveCb:(t,e)=>ke({type:o.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.MouseInteraction},t)}),scrollCb:bt,viewportResizeCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.ViewportResize},t)}),inputCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.Input},t)}),mediaInteractionCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.MediaInteraction},t)}),styleSheetRuleCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.StyleSheetRule},t)}),styleDeclarationCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.StyleDeclaration},t)}),canvasMutationCb:kt,fontCb:t=>ke({type:o.IncrementalSnapshot,data:r({source:u.Font},t)}),selectionCb(t){ke({type:o.IncrementalSnapshot,data:r({source:u.Selection},t)})},customElementCb(t){ke({type:o.IncrementalSnapshot,data:r({source:u.CustomElement},t)})},blockClass:l,ignoreClass:v,ignoreSelector:p,maskTextClass:g,maskTextSelector:w,maskInputOptions:ut,inlineStylesheet:k,sampling:E,recordDOM:W,recordCanvas:U,inlineImages:X,userTriggeredOnInput:V,collectFonts:J,doc:t,maskInputFn:C,maskTextFn:x,keepIframeSrcFn:tt,blockSelector:d,slimDOMOptions:lt,dataURLOptions:nt,mirror:Ee,iframeManager:xt,stylesheetManager:Ct,shadowDomManager:Ot,processedNodeManager:Rt,canvasManager:Se,ignoreCSSAttributes:rt,attributeFilter:it,plugins:(null==(e=null==Y?void 0:Y.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>ke({type:o.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},T)};xt.addLoadListener((t=>{try{var e=Ee.getId(t),r=Ft(t.contentDocument);if(Lt.push(r),-1!==e){var i=mt.get(e);i||mt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),xt.addPageHideListener((t=>{var e=Ee.getId(t);null==ht||ht(e),Xt(t)}));var Dt=-1,Pt=t=>ke({type:o.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),Wt=()=>{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?Ee.getId(s):-1;a!==Dt&&(-1!==Dt&&Pt({id:Dt,enter:!1}),Dt=a,-1!==a&&Pt({id:a,enter:!0}))},$t=()=>{_e(),Lt.push(Ft(document)),Lt.push(pt("fullscreenchange",Wt)),Lt.push(pt("webkitfullscreenchange",Wt)),Lt.push(pt("mozfullscreenchange",Wt)),Lt.push(pt("MSFullscreenChange",Wt)),Oe=!0};return["interactive","complete"].includes(document.readyState)?$t():(Lt.push(pt("DOMContentLoaded",(()=>{ke({type:o.DomContentLoaded,data:{}}),"DOMContentLoaded"===H&&$t()}))),Lt.push(pt("load",(()=>{ke({type:o.Load,data:{}}),"load"===H&&$t()}),window))),()=>{Lt.forEach((t=>gt(t))),Rt.destroy(),xt.removeLoadListener(),xt.destroy(),mt.clear(),Ot.reset(),Ee.reset(),Oe=!1,Bt=void 0}}catch(t){console.warn(t)}}Le.addCustomEvent=(t,e)=>{if(!Oe)throw new Error("please add custom event after start recording");ke({type:o.Custom,data:{tag:t,payload:e}})},Le.freezePage=()=>{Vt.forEach((t=>t.freeze()))},Le.takeFullSnapshot=t=>{if(!Oe)throw new Error("please take full snapshot after start recording");_e(t)},Le.mirror=Ee;var Fe=Object.defineProperty,De=(t,e,r)=>((t,e,r)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Pe{constructor(t){De(this,"fileName"),De(this,"functionName"),De(this,"lineNumber"),De(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 We=/(^|@)\S+:\d+/,Be=/^\s*at .*(\S+:\d+|\(native\))/m,$e=/^(eval@)?(\[native code])?$/,Ue={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Be)?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(Be)}),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 Pe({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match($e)}),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 Pe({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Pe({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 Pe({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 Pe({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(We)&&!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 Pe({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 je(t){return Array.isArray(t)}function qe(t){return"object"==typeof t&&null!==t&&!je(t)}function He(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(qe(t[i])&&He(t[i],e-1))return!0;return!1}function Ge(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(qe(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||qe(a)&&He(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]=je(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 Ve={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 Ze(t,e,r){var i,n=r?Object.assign({},Ve,r):Ve,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=Ue.parse(e.error).map((t=>t.toString())),s=[Ge(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=[Ge("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Ge("Uncaught (in promise)",n.stringifyOptions),Ge(e.reason,n.stringifyOptions)]);var s=Ue.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={next:l},d=(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=Ue.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>Ge(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Ge("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=e[s];"function"==typeof t&&t.__rrweb_layer__;){var r=t.__rrweb_layer__;if(r.next===d)return void(r.next=h.next);t=r.next}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var Je="undefined"!=typeof window?window:void 0,Qe="undefined"!=typeof globalThis?globalThis:Je,Xe=null==Qe?void 0:Qe.document,Ye=null==Qe?void 0:Qe.location;null!=Qe&&Qe.XMLHttpRequest&&new Qe.XMLHttpRequest;var Ke="undefined"!=typeof globalThis?globalThis:Je;Ke&&"undefined"==typeof self&&(Ke.self=Ke),Ke&&"undefined"==typeof File&&(Ke.File=function(){});var tr,er=null!=Je?Je:{},rr="NativeGzipValidationError",ir=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=rr,e},nr=function(){var t=e((function*(t,e){18>t.size&&ir("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])&&ir("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(tr)return tr;tr=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;tr[t]=e>>>0}return tr})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&ir("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&ir("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function sr(){return sr=e((function*(t,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(t),s=new globalThis.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]))[0];return yield nr(l,n),l}catch(t){if(null!=i&&i.rethrow)throw t;return r&&console.error("Failed to gzip compress data",t),null}})),sr.apply(this,arguments)}var ar=Object.prototype,or=ar.hasOwnProperty,ur=ar.toString,lr=Array.isArray||function(t){return"[object Array]"===ur.call(t)},hr=t=>"function"==typeof t,dr=t=>t===Object(t)&&!lr(t),cr=t=>void 0===t,vr=t=>"[object String]"==ur.call(t),fr=t=>null===t,pr=t=>cr(t)||fr(t),mr=t=>"[object Number]"==ur.call(t)&&t==t,gr=t=>"[object Boolean]"===ur.call(t),yr=t=>t instanceof FormData;function wr(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),mr(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),wr(n||r,e,r,i))}class br{constructor(t){this.$e={},this.ze=t.ze,this.Ze=wr(t.bucketSize,0,100,t.Ge),this.Qe=wr(t.refillRate,0,this.Ze,t.Ge),this.Je=wr(t.refillInterval,0,864e5,t.Ge)}Ke(t,e){var r=Math.floor((e-t.lastAccess)/this.Je);r>0&&(t.tokens=Math.min(t.tokens+r*this.Qe,this.Ze),t.lastAccess=t.lastAccess+r*this.Je)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.$e[i];return n?this.Ke(n,r):this.$e[i]=n={tokens:this.Ze,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.ze)||e.call(this,t)),0===n.tokens)}stop(){this.$e={}}}function kr(t){return t?t.split("#")[0]:t}var _r=t=>"undefined"!=typeof Document&&t instanceof Document,Sr={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"},Ir=function(t,e){var r=(void 0===e?{}:e).debugEnabled,i={k(e){if(Je&&(Sr.DEBUG||Je.POSTHOG_DEBUG||r)&&!cr(Je.console)&&Je.console){for(var i=("__rrweb_original__"in Je.console[e]?Je.console[e].__rrweb_original__:Je.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)=>Ir(t+" "+e,r)};return i},Mr=Ir("[PostHog.js]"),Cr=Mr.createLogger;function xr(t,e){if(!pr(t))if(lr(t))t.forEach(e);else if(yr(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)or.call(t,r)&&e(t[r],r)}function Tr(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var Rr=["localhost","127.0.0.1"],Or=t=>{var e=null==Xe?void 0:Xe.createElement("a");return cr(e)?null:(e.href=t,e)},Ar=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return xr(t,(function(t,e){cr(t)||cr(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)},Er=()=>{};function Nr(t,e,r){try{if(!(e in t))return Er;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return hr(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e];hr(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else t[e]=i.next}}catch(t){return Er}}function Lr(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}function Fr(t){var e,r=null==Je||null==(e=Je.location)?void 0:e.href;return cr(r)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!hr(i))return e;try{var n=i(e);return vr(n)&&n?n:e}catch(t){return Mr.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,r)}var Dr=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})"),Pr=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),Wr="[SessionRecording]",Br="redacted",$r=1e6;function Ur(t){var e;return Math.min($r,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:$r)}var zr={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:$r,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"],streamNetworkBody:!1},jr=["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"],qr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Hr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Gr=t=>{pr(t)||xr(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return jr.includes(e)||Hr.some((t=>e.includes(t)))})(e)&&(t[e]=Br)}))},Vr=["/s/","/e/","/i/"];function Zr(t,e,r,i){if(pr(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return vr(n)&&(n=parseInt(n)),n>r?Wr+" "+i+" body too large to record ("+n+" bytes)":t}function Jr(t,e){if(pr(t))return t;var r=t;return function(t,e){if(pr(t))return!1;if(vr(t)){if(t=t.trim(),Dr.test((t||"").replace(/[- ]/g,"")))return!1;if(Pr.test(t))return!1}return!0}(r)||(r=Wr+" "+e+" body "+Br),xr(qr,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Wr+" "+e+" body "+Br+" as might contain: "+t)})),r}var Qr=Cr("[Recorder]"),Xr=t=>"navigation"===t.entryType,Yr=t=>"resource"===t.entryType;function Kr(t,e){return!!e&&(gr(e)||e[t])}function ti(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 ei=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function ri(t){var e=t.type,r=t.recordBody,i=t.headers;function n(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:!!ti(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(ei))return!1;if(gr(r))return!0;if(lr(r))return n(r);var s=r[e];return gr(s)?s:n(s)}function ii(t,e,r,i,n,s){return ni.apply(this,arguments)}function ni(){return ni=e((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return Qr.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(Yr(a=t[s])&&a.initiatorType===e&&(cr(i)||a.startTime>=i)&&(cr(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),ii(t,e,r,i,n,s+1))})),ni.apply(this,arguments)}function si(t){var e=t.body,r=t.options,i=t.url;if(pr(e))return null;var n=Lr(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(vr(e))return e;if(_r(e))return e.textContent;if(yr(e))return Ar(e);if(dr(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 ai=t=>!fr(t)&&("navigation"===t.entryType||"resource"===t.entryType);function oi(t){var e=t.entry,i=t.method,n=t.status,s=t.networkRequest,a=t.isInitial,o=t.start,u=t.end,l=t.url,h=t.initiatorType;o=e?e.startTime:o,u=e?e.responseEnd:u;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(o||0)),v=[r({},e?e.toJSON():{name:l},{startTime:cr(o)?void 0:Math.round(o),endTime:cr(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(ai(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var ui=["video/","audio/"];function li(t){return dr(t)&&hr(t.getReader)&&hr(t.tee)}var hi=500,di="[SessionReplay] Timeout while trying to read body",ci="[SessionReplay] Failed to read body";function vi(t){return ci+": "+t}function fi(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function pi(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(di)),hi);try{t.clone().text().then((t=>e(t)),(t=>e(vi(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(ci)}}))}(t);var r=Ur(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(fi(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(di)),hi);try{o=t.clone()}catch(t){return void a(ci)}var l=o.body;if(li(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(ci)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(fi(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(vi(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(vi(t))))}catch(t){a(ci)}}))}(t,r)}function mi(){return(mi=e((function*(t){var e=t.r,r=t.options,i=Lr(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):pi(e,r)}))).apply(this,arguments)}function gi(){return(gi=e((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;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=ui.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=Lr(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return fr(i)?pi(e,r):Promise.resolve(i)}))).apply(this,arguments)}var yi=null;function wi(t,i,n){if(!("performance"in i))return()=>{};if(yi)return Qr.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},zr,n):zr,a=e=>{var i=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var r=s.maskRequestFn(t);e||(n=!r),r&&i.push(r)}})),i.length>0&&t(r({},e,{requests:i}))},o=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>Xr(t)||Yr(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>oi({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=>Xr(t)||Yr(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>oi({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=Kr("request",r.recordHeaders),n=Kr("response",r.recordHeaders),s=Nr(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},m={},g=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(m[t]=e,g(t,e)),i&&(p.requestHeaders=m);var y=d.send.bind(d);d.send=t=>(ri({type:"request",headers:m,url:o,recordBody:r.recordBody})&&(p.requestBody=si({body:t,options:r,url:o})),c=e.performance.now(),y(t));var w=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",w),d.removeEventListener("abort",w),d.removeEventListener("timeout",w)},b=()=>{if(d.readyState===d.DONE){w(),v=e.performance.now();var i={};d.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),ri({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=si({body:d.response,options:r,url:o})),ii(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=oi({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",w),d.addEventListener("abort",w),d.addEventListener("timeout",w)}catch(t){Qr.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(a,i,s),l=function(t,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=Kr("request",i.recordHeaders),s=Kr("response",i.recordHeaders),a=Nr(r,"fetch",(a=>function(){var o=e((function*(e,o){var u,l;try{u=new Request(e,o)}catch(t){return Qr.error("Failed to instrument fetch for network capture",t),a(e,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),n&&(c.requestHeaders=v),!li(null==o?void 0:o.body)&&ri({type:"request",headers:v,url:e,recordBody:i.recordBody})&&(c.requestBody=yield function(t){return mi.apply(this,arguments)}({r:u,options:i,url:e}))}catch(t){Qr.error("Failed to record fetch request for network capture",t)}h=r.performance.now(),l=ti(e)?yield a(u):yield a(e,o),d=r.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),s&&(c.responseHeaders=f),ri({type:"response",headers:f,url:e,recordBody:i.recordBody})&&(c.responseBody=yield function(t){return gi.apply(this,arguments)}({r:l,options:i,url:e})),l}finally{ii(r,"fetch",u.url,h,d).then((e=>{var r,i=oi({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return o.apply(this,arguments)}}()));return()=>{a()}}(a,i,s)),yi=()=>{o(),u(),l(),yi=null}}var bi={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},ki={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},_i="$session_recording_remote_config",Si="$replay_sample_rate",Ii="$replay_override_sampling",Mi="$replay_override_linked_flag",Ci="$replay_override_url_trigger",xi="$replay_override_event_trigger",Ti="$session_is_sampled",Ri="$session_past_minimum_duration",Oi="$session_recording_url_trigger_activated_session",Ai="$session_recording_event_trigger_activated_session",Ei="$posthog_sr_group_event_trigger_",Ni="$posthog_sr_group_url_trigger_",Li="$posthog_sr_group_sampling_",Fi="$debug_first_full_snapshot_timestamp",Di="$sess_rec_flush_size",Pi="$stored_person_properties",Wi="$sdk_debug_replay_remote_trigger_matching_config",Bi="disabled",$i="sampled",Ui="active",zi="buffering",ji="paused",qi="rrweb_error",Hi="trigger",Gi=Hi+"_activated",Vi=Hi+"_pending",Zi=Hi+"_"+Bi;function Ji(t,e,r,i,n,s){return 0===e?Zi:(null==t?void 0:t.get_property(r?i+r:n))===s?Gi:Vi}function Qi(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 Xi{constructor(t){this.u=t}triggerStatus(t){var e=this.u.map((e=>e.triggerStatus(t)));return e.includes(Gi)?Gi:e.includes(Vi)?Vi:Zi}stop(){this.u.forEach((t=>t.stop()))}}class Yi{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(Zi),e.size){case 0:return Zi;case 1:return Array.from(e)[0];default:return Vi}}stop(){this.u.forEach((t=>t.stop()))}}class Ki{triggerStatus(){return Gi}stop(){}}var tn=t=>"sessionRecording"in t;class en{constructor(t,e){this.Gu=[],this.Vu=[],this.Zu=new Map,this.Ju=new Map,this.Qu="",this.urlBlocked=!1,this._instance=t,this.Xu=e}onConfig(t){var e,r;this.Gu=(tn(t)?dr(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.Vu=(tn(t)?dr(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Yu()}Yu(){for(var t of(this.Zu.clear(),this.Ju.clear(),this.Gu))if("regex"===t.matching&&!this.Zu.has(t.url))try{this.Zu.set(t.url,new RegExp(t.url))}catch(e){Mr.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.Vu)if("regex"===e.matching&&!this.Ju.has(e.url))try{this.Ju.set(e.url,new RegExp(e.url))}catch(t){Mr.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}Ku(t){return Ji(this._instance,this.Gu.length,this.Xu,Ni,Oi,t)}triggerStatus(t){var e=this.Ku(t),r=e===Gi?Gi:e===Vi?Vi:Zi;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(t,e){var r=Fr(this._instance);if(r&&r!==this.Qu){this.Qu=r;var i=this.urlBlocked,n=Qi(r,this.Vu,this.Ju);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=Fr(this._instance);if(n&&n!==this.Qu){this.Qu=n;var s=this.urlBlocked,a=Qi(n,this.Vu,this.Ju);a&&!s?t():!a&&s&&e();var o=this.Ku(i)===Gi,u=Qi(n,this.Gu,this.Zu);!o&&u&&r("url",n)}}stop(){this.Qu=""}}class rn{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.th=()=>{},this._instance=t}triggerStatus(){var t=Vi;return pr(this.linkedFlag)&&(t=Zi),this.linkedFlagSeen&&(t=Gi),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onConfig(t,e){var r;if(this.linkedFlag=(tn(t)?dr(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!pr(this.linkedFlag)&&!this.linkedFlagSeen){var i=vr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=vr(this.linkedFlag)?null:this.linkedFlag.variant;this.th=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(dr(r)&&i in r){var a=r[i];s=gr(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.th()}}class nn{constructor(t,e){this.eh=[],this._instance=t,this.Xu=e}onConfig(t){var e;this.eh=(tn(t)?dr(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}rh(t){return Ji(this._instance,this.eh.length,this.Xu,Ei,Ai,t)}triggerStatus(t){var e=this.rh(t),r=e===Gi?Gi:e===Vi?Vi:Zi;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(t,e,r){if(0!==this.eh.length){var i=this.rh(r)===Gi,n=this.eh.includes(t);!i&&n&&e("event",t)}}stop(){}}class sn{constructor(t,e,r){if(this._instance=t,this.group=e,this.ih=new en(t,e.id),this.nh=new nn(t,e.id),this.sh=new rn(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.ih.onConfig(n),this.nh.onConfig(n),this.sh.onConfig(n,r);var s=[this.nh,this.ih,this.sh];this.ah="any"===e.conditions.matchType?new Xi(s):new Yi(s)}else this.ah=new Ki}triggerStatus(t){return this.ah.triggerStatus(t)}checkEventTriggerConditions(t,e,r){this.nh.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.ih.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?Ni+this.group.id:Ei+this.group.id]:e})}stop(){this.ih.stop(),this.nh.stop(),this.sh.stop()}}function an(t){if(t.rrwebError)return qi;if(!t.receivedFlags)return zi;if(!t.isRecordingEnabled)return Bi;if(t.urlTriggerMatching.urlBlocked)return ji;var e=!0===t.isSampled,r=new Xi([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?$i:r===Gi?Ui:r===Vi?zi:!1===t.isSampled?Bi:Ui}function on(t){if(t.rrwebError)return qi;if(!t.receivedFlags)return zi;if(!t.isRecordingEnabled)return Bi;if(t.urlTriggerMatching.urlBlocked)return ji;var e=new Yi([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Zi,i=gr(t.isSampled);return r&&e===Vi?zi:r&&e===Zi||i&&!t.isSampled?Bi:!0===t.isSampled?$i:Ui}function un(){var t=[];return function(e,r){if(dr(r)||lr(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function ln(t){var e=JSON.stringify(t,un());return e?new Blob([e]).size:0}function hn(t){if(fr(t))return 4;if(cr(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(lr(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=cr(i)||fr(i)?4:hn(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];cr(u)||(a||(s+=1),a=!1,s+=o.length+3+hn(u))}return s;default:return 0}}function dn(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[dn({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),dn({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 cn=Uint8Array,vn=Uint16Array,fn=Uint32Array,pn=new cn([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]),mn=new cn([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]),gn=new cn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yn=function(t,e){for(var r=new vn(31),i=0;31>i;++i)r[i]=e+=1<<t[i-1];var n=new fn(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]},wn=yn(pn,2),bn=wn[1];wn[0][28]=258,bn[258]=28;for(var kn=yn(mn,0)[1],_n=new vn(32768),Sn=0;32768>Sn;++Sn){var In=(43690&Sn)>>>1|(21845&Sn)<<1;_n[Sn]=((65280&(In=(61680&(In=(52428&In)>>>2|(13107&In)<<2))>>>4|(3855&In)<<4))>>>8|(255&In)<<8)>>>1}var Mn=function(t,e,r){for(var i=t.length,n=0,s=new vn(e);i>n;++n)++s[t[n]-1];var a,o=new vn(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new vn(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[_n[d]>>>u]=l}else for(a=new vn(i),n=0;i>n;++n)a[n]=_n[o[t[n]-1]++]>>>15-t[n];return a},Cn=new cn(288);for(Sn=0;144>Sn;++Sn)Cn[Sn]=8;for(Sn=144;256>Sn;++Sn)Cn[Sn]=9;for(Sn=256;280>Sn;++Sn)Cn[Sn]=7;for(Sn=280;288>Sn;++Sn)Cn[Sn]=8;var xn=new cn(32);for(Sn=0;32>Sn;++Sn)xn[Sn]=5;var Tn=Mn(Cn,9,0),Rn=Mn(xn,5,0),On=function(t){return(t/8>>0)+(7&t&&1)},An=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof vn?vn:t instanceof fn?fn:cn)(r-e);return i.set(t.subarray(e,r)),i},En=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},Nn=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},Ln=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 cn(0),0];if(1==n){var a=new cn(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 v=new vn(c+1),f=Fn(r[h-1],v,0);if(f>e){i=0;var p=0,m=f-e,g=1<<m;for(s.sort((function(t,e){return v[e.s]-v[t.s]||t.f-e.f}));n>i;++i){var y=s[i].s;if(e>=v[y])break;p+=g-(1<<f-v[y]),v[y]=e}for(p>>>=m;p>0;){var w=s[i].s;e>v[w]?p-=1<<e-v[w]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;v[b]==e&&(--v[b],++p)}f=e}return[new cn(v),f]},Fn=function(t,e,r){return-1==t.s?Math.max(Fn(t.l,e,r+1),Fn(t.r,e,r+1)):e[t.s]=r},Dn=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new vn(++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]},Pn=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=On(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){En(e,h++,r),++n[256];for(var d=Ln(n,15),c=d[0],v=d[1],f=Ln(s,15),p=f[0],m=f[1],g=Dn(c),y=g[0],w=g[1],b=Dn(p),k=b[0],_=b[1],S=new vn(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;k.length>I;++I)S[31&k[I]]++;for(var M=Ln(S,7),C=M[0],x=M[1],T=19;T>4&&!C[gn[T-1]];--T);var R,O,A,E,N=l+5<<3,L=Pn(n,Cn)+Pn(s,xn)+a,F=Pn(n,c)+Pn(s,p)+a+14+3*T+Pn(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(L>=N&&F>=N)return Wn(e,h,t.subarray(u,u+l));if(En(e,h,1+(L>F)),h+=2,L>F){R=Mn(c,v,0),O=c,A=Mn(p,m,0),E=p;var D=Mn(C,x,0);for(En(e,h,w-257),En(e,h+5,_-1),En(e,h+10,T-4),h+=14,I=0;T>I;++I)En(e,h+3*I,C[gn[I]]);h+=3*T;for(var P=[y,k],W=0;2>W;++W){var B=P[W];for(I=0;B.length>I;++I)En(e,h,D[U=31&B[I]]),h+=C[U],U>15&&(En(e,h,B[I]>>>5&127),h+=B[I]>>>12)}}else R=Tn,O=Cn,A=Rn,E=xn;for(I=0;o>I;++I)if(i[I]>255){var U;Nn(e,h,R[257+(U=i[I]>>>18&31)]),h+=O[U+257],U>7&&(En(e,h,i[I]>>>23&31),h+=pn[U]);var z=31&i[I];Nn(e,h,A[z]),h+=E[z],z>3&&(Nn(e,h,i[I]>>>5&8191),h+=mn[z])}else Nn(e,h,R[i[I]]),h+=O[i[I]];return Nn(e,h,R[256]),h+O[256]},$n=new fn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Un=function(){for(var t=new fn(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),zn=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=Un[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},jn=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new cn(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=$n[e-1],v=c>>>13,f=8191&c,p=(1<<r)-1,m=new vn(32768),g=new vn(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 fn(25e3),_=new vn(288),S=new vn(32),I=0,M=0,C=(h=0,0),x=0,T=0;a>h;++h){var R=b(h),O=32767&h,A=g[R];if(m[O]=A,g[R]=O,h>=x){var E=a-h;if((I>7e3||C>24576)&&E>423){l=Bn(t,u,0,k,_,S,M,C,T,h-T,l),C=I=M=0,T=h;for(var N=0;286>N;++N)_[N]=0;for(N=0;30>N;++N)S[N]=0}var L=2,F=0,D=f,P=O-A&32767;if(E>2&&R==b(h-P))for(var W=Math.min(v,E)-1,B=Math.min(32767,h),U=Math.min(258,E);B>=P&&--D&&O!=A;){if(t[h+L]==t[h+L-P]){for(var z=0;U>z&&t[h+z]==t[h+z-P];++z);if(z>L){if(L=z,F=P,z>W)break;var j=Math.min(P,z-2),q=0;for(N=0;j>N;++N){var H=h-P+N+32768&32767,G=H-m[H]+32768&32767;G>q&&(q=G,A=H)}}}P+=(O=A)-(A=m[O])+32768&32767}if(F){k[C++]=268435456|bn[L]<<18|kn[F];var V=31&bn[L],Z=31&kn[F];M+=pn[V]+mn[Z],++_[257+V],++S[Z],x=h+L,++I}else k[C++]=t[h],++_[t[h]]}}l=Bn(t,u,true,k,_,S,M,C,T,h-T,l)}return An(o,0,i+On(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)},qn=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Hn=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&&qn(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)}},Gn=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Vn(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Zn{constructor(t,e){var r,i;void 0===e&&(e={}),this.oh={},this.uh=t=>{if(!this.oh[t]){var e,r;this.oh[t]=!0;var i=this.lh(t);null==(e=(r=this.hh).onBlockedNode)||e.call(r,t,i)}},this.dh=t=>{var e=this.lh(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.lh=t=>this._rrweb.mirror.getNode(t),this.fh=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.fh(e);e.attributes&&(e.attributes=e.attributes.filter((t=>{var e=this.dh(t.id);return!this.Xo.consumeRateLimit(e[0])&&t})));var i=this.fh(e);return 0!==i||r===i?t:void 0},this._rrweb=t,this.hh=e,this.Xo=new br({bucketSize:null!==(r=this.hh.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.hh.refillRate)&&void 0!==i?i:10,refillInterval:1e3,ze:this.uh,Ge:Mr})}reset(){this.oh={}}stop(){this.Xo.stop(),this.reset()}}Sr.DEBUG=!1,Sr.LIB_VERSION="1.407.8",Sr.LIB_NAME="web";class Jn{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.ph=t.get_property.bind(t),this.mh=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.mh(Di,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.ph(Di);return dr(e=r)&&vr(e.sessionId)&&mr(e.size)&&r.sessionId===t?r.size:0}}function Qn(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<wr(100*e,0,100,Mr)}var Xn=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}},Yn={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=>Xn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Xn(e,t))))),icontains:(t,e)=>e.map(Kn).some((e=>t.map(Kn).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Kn).every((e=>t.map(Kn).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)))}))},Kn=t=>t.toLowerCase(),ts=new Set(["is_not","not_icontains","not_regex"]);function es(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(cr(n)||fr(n))return ts.has(s);var a=Yn[s];return!!a&&!cr(t.value)&&!fr(t.value)&&a(lr(t.value)?t.value.map(String):[String(t.value)],lr(n)?n.map(String):[String(n)])}))}var rs=Cr("[SessionRecording]");function is(t,e){return e?t:"!"+t}function ns(t,e){return t===e||t!=="!"+e&&null}class ss{constructor(t,e,r,i,n,s,a){this.gh=null,this.yh=on,this._instance=t,this.ih=e,this.nh=r,this.sh=i,this.wh=n,this.bh=s,this.kh=a}onRemoteConfig(t){this.gh=mr(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this._h=new Xi([this.nh,this.ih]),this.yh=an):(this._h=new Yi([this.nh,this.ih]),this.yh=on),this._instance.register_for_session({[Wi]:t.triggerMatchType}),this.ih.onConfig(t),this.nh.onConfig(t),this.sh.onConfig(t,((t,e)=>{this.wh("linked_flag_matched",{flag:t,variant:e}),this.kh()}))}getStatus(t){return this.yh({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 mr(r)?r:null}checkUrlTriggers(t,e,r,i){this.ih.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.nh.eh.length&&pr(this.Sh))return this.Sh=t((t=>{try{this.nh.checkEventTriggerConditions(t.event,r,e)}catch(t){rs.error("Could not activate event trigger",t)}})),this.Sh}makeSamplingDecisions(t){var e,r,i,n=this.gh;if(!mr(n))return null==(r=this._instance.persistence)||r.unregister(Ti),void(null==(i=this._instance.persistence)||i.unregister(Si));var s=this._instance.get_property(Ti),a=this._instance.get_property(Si),o=ns(s,t),u=mr(a)&&a!==n,l=cr(a)&&s===t,h=u||l||!gr(o),d=h?Qn(t,n):o;h&&(d?this.wh("sampled"):rs.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[Ti]:is(t,d),[Si]:fr(a)&&s===t?null:n})}ensureSamplingDecision(t){if(mr(this.gh)){var e=this._instance.get_property(Ti);gr(ns(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(Ai),null==(e=this._instance.persistence)||e.unregister(Oi),null==(r=this._instance.persistence)||r.unregister(Ti),null==(i=this._instance.persistence)||i.unregister(Si),null==(n=this._instance.persistence)||n.unregister(Ri)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this._h)?void 0:e.triggerStatus(t))===Vi}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.nh.stop(),this.ih.stop(),this.sh.stop()}}class as{constructor(t,e,r,i,n){this.Ih=[],this.Mh=new Map,this.Ch=!1,this._instance=t,this.ih=e,this.wh=r,this.xh=i,this.kh=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Rh(t.triggerGroups),this._instance.register_for_session({[Wi]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.ih.onConfig(t)):rs.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return qi;if(t.urlTriggerMatching.urlBlocked)return ji;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return Bi;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Gi){var o=s.group.id,u=r.get(o);cr(u)?Mr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Vi&&(i=!0)}return n?$i:i?zi:Bi}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Ih,triggerGroupSamplingResults:this.Mh,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Ih)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;mr(i)&&(fr(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.ih.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Th(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.kh())}),t)};for(var a of this.Ih)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Sh=t((t=>{var r;if(this.Ch)return rs.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Sh)||r.call(this),void(this.Sh=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Th(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property(Pi);s.some((e=>!e.properties||0===e.properties.length||es(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.kh())}}),e)};for(var s of this.Ih)n(s)}catch(t){rs.error("Could not activate event trigger for trigger groups",t)}})),this.Sh}makeSamplingDecisions(t){for(var e of this.Ih){var r,i=e.group,n=i.id,s=i.sampleRate,a=Li+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(dr(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=mr(v)&&v!==s,u=c===t&&mr(v)&&v===s&&gr(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!gr(u),m=p?Qn(t+n,s):u;p&&this.xh("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:m}),this.Mh.set(n,m),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:m}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Ch=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(Ti),null==(e=this._instance.persistence)||e.unregister(Si),null==(r=this._instance.persistence)||r.unregister(Ri),this.Ih)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(Ei+o),null==(s=this._instance.persistence)||s.unregister(Ni+o),null==(a=this._instance.persistence)||a.unregister(Li+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Ih){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Mh.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.Ih)if(e.triggerStatus(t)===Vi)return!0;return!1}stop(){var t;null==(t=this.Sh)||t.call(this),this.Sh=void 0,this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear(),this.ih.stop()}Th(t,e){var r=t.group.conditions.properties;return!r||0===r.length||es(r,e,this._instance.get_property(Pi))}Rh(t){var e=this;this.Ih.forEach((t=>t.stop())),this.Ih=[],this.Mh.clear();var r=function(t){var r=new sn(e._instance,t,((r,i)=>{e.wh("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.kh()}));e.Ih.push(r)};for(var i of t)r(i)}}var os=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"];function us(t){return dr(t)?t.network_timing:t}var ls,hs,ds="[SessionRecording]",cs=Cr(ds),vs=[ki.MouseMove,ki.MouseInteraction,ki.Scroll,ki.ViewportResize,ki.Input,ki.TouchMove,ki.MediaInteraction,ki.Drag],fs=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function ps(){var t;return null==er||null==(t=er.__PosthogExtensions__)?void 0:t.rrweb}function ms(){var t;return null==(t=ps())?void 0:t.record}function gs(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,un())}}function ys(t){return Vn(function(t,e){void 0===e&&(e={});var r=zn(),i=t.length;r.p(t);var n=jn(t,e,Gn(e),8),s=n.length;return Hn(n,e),qn(n,s-8,r.d()),qn(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 cn(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 cn(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 An(i,0,n)}(gs(t))))}function ws(t){return bs.apply(this,arguments)}function bs(){return bs=e((function*(t){var e=gs(t),r=yield function(t,e,r){return sr.apply(this,arguments)}(e,Sr.DEBUG,{rethrow:!0});return Vn(new Uint8Array(yield r.arrayBuffer()))})),bs.apply(this,arguments)}var ks="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,_s=!1;function Ss(t){return lr(t)&&0===t.length?ls=null!=ls?ls:ys([]):ys(t)}function Is(t){return Ms.apply(this,arguments)}function Ms(){return(Ms=e((function*(t){return lr(t)&&0===t.length?ls||(hs=null!=hs?hs:ws([]).then((t=>(ls=t,t))).catch((t=>{throw ls=void 0,hs=void 0,t}))):ws(t)}))).apply(this,arguments)}function Cs(t){return ks&&!_s&&function(t){return t.type===bi.FullSnapshot||t.type===bi.IncrementalSnapshot&&(t.data.source===ki.Mutation||t.data.source===ki.StyleSheetRule)}(t)}function xs(t){return{event:t,size:hn(t)}}function Ts(t,e){return r({},t,{data:e,cv:"2024-10"})}function Rs(t,e){return r({},t,{cv:"2024-10",data:r({},t.data,e)})}function Os(t){try{if(t.type===bi.FullSnapshot)return xs(Ts(t,ys(t.data)));if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.Mutation)return xs(Rs(t,{texts:Ss(t.data.texts),attributes:Ss(t.data.attributes),removes:Ss(t.data.removes),adds:Ss(t.data.adds)}));if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.StyleSheetRule)return xs(Rs(t,{adds:t.data.adds?ys(t.data.adds):void 0,removes:t.data.removes?ys(t.data.removes):void 0}))}catch(t){cs.error("could not compress event - will use uncompressed event",t)}return{event:t,size:ln(t)}}function As(){return(As=e((function*(t){try{if(t.type===bi.FullSnapshot)return xs(Ts(t,yield ws(t.data)));if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.Mutation){var e=yield Promise.all([Is(t.data.texts),Is(t.data.attributes),Is(t.data.removes),Is(t.data.adds)]);return xs(Rs(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===bi.IncrementalSnapshot&&t.data.source===ki.StyleSheetRule){var r=yield Promise.all([t.data.adds?ws(t.data.adds):void 0,t.data.removes?ws(t.data.removes):void 0]);return xs(Rs(t,{adds:r[0],removes:r[1]}))}}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===rr})(e)&&(_s=!0),cs.error("could not compress event asynchronously - trying synchronous compression",e),Os(t)}return{event:t,size:ln(t)}}))).apply(this,arguments)}function Es(t,e){return t.type===bi.Custom&&t.data.tag===e}function Ns(t){return Es(t,"sessionIdle")}function Ls(t){return Es(t,"$session_ending")}function Fs(t){return Es(t,"$session_starting")}class Ds{get sessionId(){return this.Mi}get Oh(){if(!this._instance.sessionManager)throw new Error(ds+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Ah(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Eh(){return ns(this._instance.get_property(Ti),this.sessionId)}get gh(){var t,e=null==(t=this.Xa)?void 0:t.sampleRate;return mr(e)?e:null}get Nh(){var t,e;return null!==(t=null==(e=this.Lh)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t){this.Fh="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.Dh=void 0,this.Ph=Date.now(),this.Wh=!1,this.Bh=[],this.$h="unknown",this.Uh=!1,this.zh=!1,this.jh=!1,this.qh=!1,this.Hh=[],this.Gh=void 0,this.Vh=void 0,this.Zh=[],this.Jh=0,this.Qh=0,this.Xh=!1,this.Yh=void 0,this.Sh=void 0,this.Kh=void 0,this.td=void 0,this.ed=void 0,this.fi=(t,e,r)=>{var i,n,s;if(r&&(t!==this.Mi||e!==this.Ii)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.Mi,l=this.Ii;o&&this.xh("$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(Fi),this.jh=!1,null==(n=ps())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.xh("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.nd(),!1===this.$h&&this.isStarted||this.Mi===t&&this.Ii===e||(this.$h="unknown",this.stop(),this.start("session_id_changed")),o&&this.xh("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.Ph}),null==(s=this.Lh)||s.makeSamplingDecisions(t)}},this.sd=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[Ri])===this.Mi},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 mr(r)&&mr(i)?i-r:null},this.od=()=>{var t,e,r=this.Nh;if(!mr(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 mr(i)&&i>=0&&r>i}if(this.sd())return!1;var n,s=this.ad();return!!fr(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Ri]:this.Mi}),!1)},this.ld=()=>{this.status!==zi?(this.hd(),this.dd()):this.vd()},this.fd=()=>{this.xh("browser offline",{})},this.Bs=()=>{this.xh("browser online",{})},this.ke=()=>{null!=Xe&&Xe.visibilityState&&this.xh("window "+Xe.visibilityState,{})},this._instance=t;var e=this.Oh.checkAndGetSessionAndWindowId(),r=e.windowId;this.Mi=e.sessionId,this.Ii=r,this.sh=new rn(this._instance),this.ih=new en(this._instance),this.nh=new nn(this._instance),this.R=this.vd(),this.Oh.sessionTimeoutMs>this.Ah||cs.warn("session_idle_threshold_ms ("+this.Ah+") is greater than the session timeout ("+this.Oh.sessionTimeoutMs+"). Session will never be detected as idle"),this.rd=new Jn(this._instance)}get pd(){var t,e,r,i,n,s,a,o=null==(t=this.Xa)?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 cr(l)&&cr(h)&&cr(d)?void 0:{maskAllInputs:null==l||l,maskTextSelector:h,blockSelector:d}}md(){var t;if(!this.qh){var e=null==(t=this.Xa)?void 0:t.masking;if(!pr(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!cr(i)&&i!==n}));0!==i.length&&(this.qh=!0,cs.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector},project:e}))}}}get gd(){var t;return wr(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,Cr("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.Xa)?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:wr(h,0,12,Cr("canvas recording fps"),4),quality:wr(d,0,1,Cr("canvas recording quality"),.4)}}get wd(){var t,e=!(null==(t=this.Xa)||!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.Xa)?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=us(this._instance.config.capture_performance),u=us(null==i?void 0:i.capturePerformance),l=!!(gr(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}kd(){var t,e,i=[],n=null==(t=er.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.wd&&i.push(n());var s=null==(e=er.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;return this.bd&&hr(s)&&(!Rr.includes(Ye.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(s(((t,e)=>{var i,n={payloadSizeLimitBytes:zr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...zr.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...zr.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,a=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,u=(i=Ur(n),t=>(null!=t&&t.requestBody&&(t.requestBody=Zr(t.requestBody,t.requestHeaders,i,"Request")),null!=t&&t.responseBody&&(t.responseBody=Zr(t.responseBody,t.responseHeaders,i,"Response")),t)),l=e=>{return u(((t,e)=>{var r,i=Or(t.name),n=0===e.indexOf("http")?null==(r=Or(e))?void 0:r.pathname:e;"/"===n&&(n="");var s=null==i?void 0:i.pathname.replace(n||"","");if(!(i&&s&&Vr.some((t=>0===s.indexOf(t)))))return t})((Gr((r=e).requestHeaders),Gr(r.responseHeaders),r),t.api_host));var r},h=hr(t.session_recording.maskNetworkRequestFn);return h&&hr(t.session_recording.maskCapturedNetworkRequestFn)&&Mr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var i=t.session_recording.maskNetworkRequestFn({url:e.name});return r({},e,{name:null==i?void 0:i.url})}),n.maskRequestFn=hr(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r,i=l(e);return i&&null!==(r=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(i))&&void 0!==r?r:void 0}:t=>function(t){if(!cr(t))return t.requestBody=Jr(t.requestBody,"Request"),t.responseBody=Jr(t.responseBody,"Response"),t}(l(t)),r({},zr,n,{recordHeaders:s,recordBody:a,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.bd))):cs.info("NetworkCapture not started because we are on localhost.")),i}_d(t){return this._instance.config.disable_capture_url_hashes?kr(t):t}Sd(t,e){void 0===e&&(e=!1);var r=e?kr(t):this._d(t),i=this._instance.config.mask_personal_data_properties?[...os,...this._instance.config.custom_personal_data_properties||[]]:[];return this.Id(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");lr(d)&&(e.includes(d[0])?l.push(d[0]+"=<masked>"):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}Id(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}Md(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.Bh.length?this.Bh.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):cs.warn("could not emit queued rrweb event.",e,t),!1}}xh(t,e){return this.Md(fs((()=>ms().addCustomEvent(t,e))))}Cd(){try{if(this._instance.config.capture_pageview||!Je)return;var t=new URL(Je.location.href),e=this.Sd(t.origin+t.pathname+t.search);this.xd!==e&&(this.xd=e,this.xh("$url_changed",{href:e}))}catch(t){}}Rd(){if(this.Bh.length){var t=[...this.Bh];this.Bh=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Md(t)}))}}bh(){return this.Md(fs((()=>ms().takeFullSnapshot())))}get Td(){var t,e,r;if(null!=(t=this.Lh)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return mr(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Od(){if(this.Ad&&clearInterval(this.Ad),!0!==this.$h){var t=this.Td;t&&(this.Ad=setInterval((()=>{this.bh()}),t))}}kh(){!this.ih.urlBlocked&&["sampled","active"].includes(this.status)&&this.Od()}Ed(){this.ih.urlBlocked||(this.ih.urlBlocked=!0,clearInterval(this.Ad),cs.info("recording paused due to URL blocker"),this.xh("recording paused",{reason:"url blocker"}))}Nd(){this.ih.urlBlocked&&(this.ih.urlBlocked=!1,this.bh(),this.Od(),this.xh("recording resumed",{reason:"left blocked url"}),cs.info("recording resumed"))}Ld(t,e){var r;if(!this.Wh&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)){this.Wh=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?Oi:Ai]:this.sessionId}),null==(n=this.Lh)||n.updateActiveTriggers(this.sessionId),this.kh(),this.dd(),this.wh(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Wh=!1}}}get isStarted(){return!!this.Dh}get Xa(){var t=this._instance.get_property(_i);if(t){var e;try{e=dr(t)?t:JSON.parse(t)}catch(t){return void cs.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 cs.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(_i))}return e}}Fd(t,e,r){this._instance.get_property(t)&&(e(),r())}start(t){var e,r,i=this.Xa;if(i){this.Xh&&(this.Dd(),this.vd());var n=this.Oh.checkAndGetSessionAndWindowId(),s=n.windowId;this.Mi=n.sessionId,this.Ii=s,null==(e=this._instance.persistence)||e.unregister(Fi),null!=i&&i.endpoint&&(this.Fh=null==i?void 0:i.endpoint),this.Lh=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new as(this._instance,this.ih,this.wh.bind(this),this.xh.bind(this),this.kh.bind(this)):new ss(this._instance,this.ih,this.nh,this.sh,this.wh.bind(this),this.bh.bind(this),this.kh.bind(this)),this.Lh.onRemoteConfig(i),null==(r=this.Sh)||r.call(this),this.Sh=this.Lh.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.Ld(t,e))),this.Fd(Ii,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Ii)})),this.Fd(Mi,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Mi)})),this.Fd(xi,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(xi)})),this.Fd(Ci,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Ci)})),this.Lh.makeSamplingDecisions(this.sessionId),this.Pd(),this.Uh||(Tr(Je,"beforeunload",this.ld),Tr(Je,"offline",this.fd),Tr(Je,"online",this.Bs),Tr(Je,"visibilitychange",this.ke),!this.Kh&&hr(this.Oh.onSessionId)&&(this.Kh=this.Oh.onSessionId(this.fi)),!this.td&&hr(this.Oh.on)?this.td=this.Oh.on("forcedIdleReset",(()=>{this.nd(),this.$h="unknown",this.stop(),this.ed=this.Oh.onSessionId(((t,e,r)=>{var i;null==(i=this.ed)||i.call(this),this.ed=void 0,this.fi(t,e,r)}))})):hr(this.Oh.on)||cs.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),pr(this.Yh)&&(this.Yh=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Sd(t.properties.$current_url):"";if(!e)return;this.xh("$pageview",{href:e})}}catch(t){cs.error("Could not add $pageview to rrweb session",t)}}))),this.status===Ui&&this.wh(t||"recording_initialized"))}else cs.info("remote config must be stored in persistence before recording can start")}Wd(){var t,e,r,i,n,s;null==Je||Je.removeEventListener("beforeunload",this.ld),null==Je||Je.removeEventListener("offline",this.fd),null==Je||Je.removeEventListener("online",this.Bs),null==Je||Je.removeEventListener("visibilitychange",this.ke),clearInterval(this.Ad),this.Bd(),null==(t=this.Yh)||t.call(this),this.Yh=void 0,null==(e=this.Sh)||e.call(this),this.Sh=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.Lh)||s.stop(),this.$d(),this.Dd()}Dd(){this.Qh+=1,this.Zh=[],this.Jh=0,this.Ud=void 0,this.Xh=!1}$d(){var t,e;null==(t=this.zd)||t.stop(),this.Bh=[],null==(e=this.Dh)||e.call(this),this.Dh=void 0}jd(){if(!this.Ud||0===this.Jh)return!1;if(this.Xh)return!0;this.Xh=!0;var t=this.Qh;return this.Bd(),this.$d(),this.Ud.catch((()=>{})).then((()=>{t===this.Qh&&(this.Xh=!1,this.dd(),this.vd(),this.Wd(),cs.info("stopped"))})).catch((()=>{this.Xh=!1,this.Wd(),cs.info("stopped")})),!0}stop(){this.jd()||(this.dd(),this.vd(),this.Wd(),cs.info("stopped"))}discard(){this.vd(),this.Wd(),cs.info("discarded")}qd(t,e,r,i,n){var s,a={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};t.type===bi.FullSnapshot&&null!=(s=ps())&&null!=s.wasMaxDepthReached&&s.wasMaxDepthReached()&&(this.jh=!0),this.status!==Bi?(this.Hd(t,i),this.Gd(a)):this.vd()}Hd(t,e){t.type!==bi.FullSnapshot?t.type===bi.IncrementalSnapshot&&(cr(this.Gh)||this.Gh===e||this.Vh===e||(this.Vh=e,cs.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.bh())):this.Gh=e}Vd(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))}Zd(t,e,r){t.processed||t.generation!==this.Qh||(t.processed=!0,this.qd(t.event,e,r,t.targetSessionId,t.targetWindowId))}Jd(t){try{var e=t.compressionEnabled?Os(t.event):{event:t.event,size:ln(t.event)};this.Zd(t,e.event,e.size)}finally{this.Vd(t)}}hd(){[...this.Zh].forEach((t=>{this.Jd(t)}))}Qd(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 e,i;try{var n=r?Cs(t)?yield function(t){return As.apply(this,arguments)}(t):Os(t):{event:t,size:ln(t)};e=n.event,i=n.size}catch(r){cs.error("could not process queued compression event - will use uncompressed event",r),e=t,i=ln(t)}s.Zd(a,e,i)}finally{s.Vd(a)}}));return function(){return i.apply(this,arguments)}}();this.Ud=this.Ud?this.Ud.catch((()=>{})).then(o):o()}onRRwebEmit(t){var e,r,i,n,s,a,o;if(this._instance.sessionManager&&(this.Rd(),t&&dr(t))){if(t.type===bi.Meta){var u=this.Sd(t.data.href);if(this.xd=u,!u)return;t.data.href=u}else this.Cd();if(null==(e=this.Lh)||e.checkUrlTriggers(this.sessionId,(()=>this.Ed()),(()=>this.Nd()),((t,e)=>this.Ld(t,e))),!this.ih.urlBlocked||(l=t).type===bi.Custom&&"recording paused"===l.data.tag){var l,h,d;t.type===bi.FullSnapshot&&(this.Od(),null==(h=this.zd)||h.reset(),null==(d=this._instance.persistence)||d.register_once({[Fi]:t.timestamp},void 0)),t.type===bi.FullSnapshot&&null!=(r=this.Lh)&&r.hasPendingTriggers(this.sessionId)&&this.Xd();var c=this.zd?this.zd.throttleMutations(t):t;if(c){var v=function(t){var e=t;if(e&&dr(e)&&6===e.type&&dr(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),f=function(t){return Ls(t)?t.data.payload:null}(v),p=function(t){return Fs(t)?t.data.payload:null}(v);if(f||p){var m=null!=f?f:p;null!=m&&m.lastActivityTimestamp&&(v.timestamp=m.lastActivityTimestamp)}else this.Yd(v);t.type===bi.FullSnapshot&&(this.Hh.push([this.Mi,t.timestamp]),this.Hh.length>6&&(this.Hh=this.Hh.slice(-6)));var g=null!==(i=null!==(n=null==f?void 0:f.currentSessionId)&&void 0!==n?n:null==p?void 0:p.nextSessionId)&&void 0!==i?i:this.Mi,y=null!==(s=null!==(a=null==f?void 0:f.currentWindowId)&&void 0!==a?a:null==p?void 0:p.nextWindowId)&&void 0!==s?s:this.Ii;if(!0!==this.$h||function(t){return Ns(t)||Ls(t)||Fs(t)}(v)){if(Ns(v)){var w=v.data.payload;w&&(v.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&&Cs(v))this.Qd(v,b,g,y);else{var k=b?Os(v):{event:v,size:ln(v)};this.qd(v,k.event,k.size,g,y)}}}}}}get status(){return this.Lh?this.Lh.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Eh,rrwebError:this.Uh,urlTriggerMatching:this.ih,eventTriggerMatching:this.nh,linkedFlagMatching:this.sh,remoteConfig:this.Xa}):Bi}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.sh.linkedFlagSeen=!0,this.bh(),this.wh("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[Ti]:this.sessionId,[Si]:null}),this.bh(),this.wh("sampling_overridden")}overrideTrigger(t){this.Ld(t)}Kd(){try{var t,e=null==Je||null==(t=Je.location)?void 0:t.href;if(!e)return;var r=this.Sd(e);if(!r)return;return new URL(r).hostname||void 0}catch(t){return}}Bd(){this.tc&&(clearTimeout(this.tc),this.tc=void 0)}dd(){var t;this.Bd(),null==(t=this.Lh)||t.ensureSamplingDecision(this.sessionId);var e=this.od();if(this.status===zi||this.status===ji||this.status===Bi||e)return this.tc=setTimeout((()=>{this.dd()}),2e3),this.R;if(this.R.data.length>0){var r,i=this.Kd();dn(this.R).forEach((t=>{var e;null==(e=this.rd)||e.trackSize(t.sessionId,t.size),this.ec({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Sr.LIB_NAME,$lib_version:Sr.LIB_VERSION,$snapshot_host:i})})),null==(r=this.Lh)||r.onFlushComplete()}return this.vd()}Gd(t){var e,r=2+((null==(e=this.R)?void 0:e.data.length)||0),i=t.$session_id,n=this.R.sessionId!==i;(n||!0!==this.$h&&this.R.size+t.$snapshot_bytes+r>943718.4)&&(this.R=this.dd(),n&&this.R.data.length>0&&(this.R=this.vd()),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.tc||!0===this.$h||(this.tc=setTimeout((()=>{this.dd()}),2e3))}ec(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.Fh),_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],i=this.Oh.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}Xd(){if(!this.R||0===this.R.data.length)return this.vd();for(var t=-1,e=this.R.data.length-1;e>=0;e--)if(this.R.data[e].type===bi.Meta){t=e;break}return 0>t?this.vd():(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)}vd(){return this.R={size:0,data:[],sizes:[],sessionId:this.Mi,windowId:this.Ii},this.R}wh(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),cs.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.xh("$recording_started",r({reason:t},e))}rc(t){var e;return 3===t.type&&-1!==vs.indexOf(null==(e=t.data)?void 0:e.source)}Yd(t){var e=this.rc(t);e||this.$h||t.timestamp-this.Ph>this.Ah&&(this.$h=!0,clearInterval(this.Ad),this.xh("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.Ph,threshold:this.Ah,bufferLength:this.R.data.length,bufferSize:this.R.size}),this.dd());var r=!1;if(e&&(this.Ph=t.timestamp,this.$h)){var i="unknown"===this.$h;this.$h=!1,i||(this.xh("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!0!==this.$h){var n=this.Oh.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.Mi!==a,u=this.Ii!==s;this.Ii=s,this.Mi=a,o||u?(this.stop(),this.start("session_id_changed")):r&&this.Od()}}nd(){var t;null==(t=this.Lh)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e=this.Oh.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.sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this.rd)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Hh,$snapshot_max_depth_exceeded:this.jh,$sdk_debug_replay_rrweb_error:this.Uh,$sdk_debug_rrweb_attached:!!this.Dh,$sdk_debug_rrweb_start_attempted:this.zh}}Pd(){var t;if(!this.Dh){this.zh=!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,attributeFilter:void 0},a=this._instance.config.session_recording;for(var o of Object.entries(a||{})){var u=o[0],l=o[1];u in s&&("maskInputOptions"===u?s.maskInputOptions=r({password:!0},l):s[u]=l)}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.pd&&(s.maskAllInputs=null===(e=this.pd.maskAllInputs)||void 0===e||e,s.maskTextSelector=null!==(i=this.pd.maskTextSelector)&&void 0!==i?i:void 0,s.blockSelector=null!==(n=this.pd.blockSelector)&&void 0!==n?n:void 0),this.md();var h=ms();if(h){this.zd=null!==(t=this.zd)&&void 0!==t?t:new Zn(h,{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";cs.info(r,{node:e}),this.log(ds+" "+r,"warn")}});var d=this.kd();if(this.Dh=h(r({emit:t=>{this.onRRwebEmit(t)},plugins:d},s)),!this.Dh)return this.Uh=!0,void cs.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.Uh=!1,this.Ph=Date.now(),this.$h=gr(this.$h)?this.$h:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Xa),this.xh("$session_options",{sessionRecordingOptions:s,activePlugins:d.map((t=>null==t?void 0:t.name))}),this.xh("$posthog_config",{config:this._instance.config})}else cs.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.xh(t,e)}}er.__PosthogExtensions__=er.__PosthogExtensions__||{},er.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:Ze,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:wi,options:t})},er.__PosthogExtensions__.rrweb={record:Le,version:"v2",wasMaxDepthReached:()=>dt,resetMaxDepthState(){dt=!1,ht=!1}},er.__PosthogExtensions__.initSessionRecording=t=>new Ds(t)}();
2
2
  //# sourceMappingURL=posthog-recorder.js.map