@mcpjam/inspector 3.5.3 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"3.5.3"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e06f55b6-f7d4-42cf-a9cd-0e5606fd8e60",e._sentryDebugIdIdentifier="sentry-dbid-e06f55b6-f7d4-42cf-a9cd-0e5606fd8e60")}catch(r){}}(),function(){function e(e,t,r,n,i,s,a){try{var o=e[s](a),l=o.value}catch(u){return void r(u)}o.done?t(l):Promise.resolve(l).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,s){var a=t.apply(r,n);function o(t){e(a,i,s,o,l,"next",t)}function l(t){e(a,i,s,o,l,"throw",t)}o(void 0)})}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(null,arguments)}var n,i,s=["type"],a=Object.defineProperty,o=(e,t,r)=>{return s=r,(i="symbol"!=typeof t?t+"":t)in(n=e)?a(n,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[i]=s;var n,i,s},l=((i=l||{})[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i),u=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(u||{}),d=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(d||{}),c=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(c||{}),h=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(h||{}),p=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(p||{}),f=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(f||{}),m={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},g={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},v={};function y(e){if(v[e])return v[e];var t,r,n,i,s=(t=e,((i=null==(n=null==(r=null==globalThis?void 0:globalThis.Zone)?void 0:r.__symbol__)?void 0:n.call(r,t))&&globalThis[i]?globalThis[i]:void 0)||globalThis[e]),a=s.prototype,o=e in m?m[e]:void 0,l=Boolean(o&&o.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(a,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),u=e in g?g[e]:void 0,d=Boolean(u&&u.every(e=>{var t;return"function"==typeof a[e]&&(null==(t=a[e])?void 0:t.toString().includes("[native code]"))}));if(l&&d)return v[e]=s.prototype,s.prototype;var c=document.createElement("iframe");try{document.body.appendChild(c);var h=c.contentWindow;if(!h)return s.prototype;var p=h[e].prototype;return p?v[e]=p:a}catch(t){return a}finally{c.parentNode&&document.body.removeChild(c)}}var b={};function S(e,t,r){var n,i=e+"."+String(r);if(b[i])return b[i].call(t);var s=y(e),a=null==(n=Object.getOwnPropertyDescriptor(s,r))?void 0:n.get;return a?(b[i]=a,a.call(t)):t[r]}var w={};function k(e,t,r){var n=e+"."+String(r);if(w[n])return w[n].bind(t);var i=y(e)[r];return"function"!=typeof i?t[r]:(w[n]=i,i.bind(t))}function I(){return y("MutationObserver").constructor}function _(e,t,r){try{if(!(t in e))return()=>{};var n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch(s){return()=>{}}}var C=e=>S("Node",e,"childNodes"),M=e=>S("Node",e,"parentNode"),T=e=>S("Node",e,"parentElement"),R=e=>S("Node",e,"textContent"),E=(e,t)=>k("Node",e,"contains")(t),x=e=>k("Node",e,"getRootNode")(),O=e=>e&&"host"in e?S("ShadowRoot",e,"host"):null,L=e=>e&&"shadowRoot"in e?S("Element",e,"shadowRoot"):null;function N(e){return e.nodeType===e.ELEMENT_NODE}function D(e){var t=e&&"host"in e&&"mode"in e&&O(e)||null;return Boolean(t&&"shadowRoot"in t&&L(t)===e)}function F(e){return"[object ShadowRoot]"==={}.toString.call(e)}function A(e){try{var t=e.rules||e.cssRules;if(!t)return null;var r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),(n=Array.from(t,e=>P(e,r)).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),n}catch(i){return null}var n}function P(e,t){var r;if("styleSheet"in e){var n;try{n=A(e.styleSheet)||function(e){var{cssText:t}=e;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(s){n=e.cssText}try{if(n&&(null==(r=e.styleSheet)?void 0:r.href))return Z(n,e.styleSheet.href)}catch(a){}return n}var i=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(i=i.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?Z(i,t):i}class B{constructor(){o(this,"idNodeMap",new Map),o(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),N(e)){var r=L(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function U(e){var{element:t,maskInputOptions:r,tagName:n,type:i,value:s,maskInputFn:a}=e,o=s||"",l=i&&W(i);return(r[n.toLowerCase()]||l&&r[l])&&(o=a?a(o,t):"*".repeat(o.length)),o}function W(e){return e.toLowerCase()}var H="__rrweb_original__";function q(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?W(t):null}function z(e,t){var r,n;try{n=new URL(e,null!=t?t:window.location.href)}catch(s){return null}var i=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==i?void 0:i[1])&&void 0!==r?r:null}var $=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,j=/^(?:[a-z+]+:)?\/\//i,G=/^www\..*/i,V=/^(data:)([^,]*),(.*)/i;function Z(e,t){return(e||"").replace($,(e,r,n,i,s,a)=>{var o,l=n||s||a,u=r||i||"";if(!l)return e;if(j.test(l)||G.test(l))return"url("+u+l+u+")";if(V.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((o=t).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+l)+u+")";var d=t.split("/"),c=l.split("/");for(var h of(d.pop(),c))"."!==h&&(".."===h?d.pop():d.push(h));return"url("+u+d.join("/")+u+")"})}var J,Y,X=1,K=new RegExp("[^a-z0-9-_:]");function Q(){return X++}var ee=/^[^ \t\n\r\u000c]+/,te=/^[, \t\n\r\u000c]+/,re=new WeakMap;function ne(e,t){return t&&""!==t.trim()?ie(e,t):t}function ie(e,t){var r=re.get(e);if(r||(r=e.createElement("a"),re.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function se(e,t,r,n,i,s){if(!n)return n;if("src"===r||"href"===r&&("use"!==t||"#"!==n[0])){var a=ne(e,n);if("img"===t&&a.startsWith("data:")&&i){var o=a;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(o=function(e,t,r,n){if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;try{var i=document.createElement("canvas");i.width=e.naturalWidth,i.height=e.naturalHeight;var s=i.getContext("2d");return s?(s.drawImage(e,0,0),i.toDataURL(r||"image/webp",null!=n?n:.4)):t}catch(a){return t}}(i,a,s.type,s.quality)),(null==s?void 0:s.maxBase64ImageLength)&&(l=o,o=(u=s.maxBase64ImageLength)&&l.length>u?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":l),o}return a}return"xlink:href"===r&&"#"!==n[0]?ne(e,n):"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,i=e.exec(t.substring(r));return i?(r+=(n=i[0]).length,n):""}for(var i=[];n(te),t.length>r;){var s=n(ee);if(","===s.slice(-1))s=ne(e,s.substring(0,s.length-1)),i.push(s);else{var a="";s=ne(e,s);for(var o=!1;;){var l=t.charAt(r);if(""===l){i.push((s+a).trim());break}if(o)")"===l&&(o=!1);else{if(","===l){r+=1,i.push((s+a).trim());break}"("===l&&(o=!0)}a+=l,r+=1}}}return i.join(", ")}(e,n):"style"===r?Z(n,ie(e)):"object"===t&&"data"===r?ne(e,n):n:ne(e,n);var l,u}function ae(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function oe(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&oe(M(e),t,r);for(var n=e.classList.length;n--;)if(t.test(e.classList[n]))return!0;return!!r&&oe(M(e),t,r)}function le(e,t,r,n){var i;if(N(e)){if(!C(i=e).length)return!1}else{if(null===T(e))return!1;i=T(e)}try{if("string"==typeof t){if(n){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if(oe(i,t,n))return!0;if(r)if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}catch(s){}return!1}function ue(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function de(e){return null==e?"":e.toLowerCase()}var ce=50,he=!1,pe=!1;function fe(e,t){var{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:d={},maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m={},inlineImages:g=!1,recordCanvas:v=!1,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:_=!1,depth:E=0,maxDepth:x=ce}=t,{needsMask:O}=t,{preserveWhiteSpace:P=!0}=t;if(E>=x)return pe=!0,he||(he=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+x+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;O||(O=le(e,a,o,void 0===O));var B,$=function(e,t){var{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:a,inlineStylesheet:o,maskInputOptions:l={},maskTextFn:u,maskInputFn:d,dataURLOptions:c={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1}=t,v=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:f.Document,childNodes:[],compatMode:e.compatMode}:{type:f.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return function(e,t){for(var r,n,i,{doc:s,blockClass:a,blockSelector:o,inlineStylesheet:l,maskInputOptions:u={},maskInputFn:d,dataURLOptions:c={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1,rootId:v}=t,y=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;)if(t.test(e.classList[n]))return!0;if(r)return e.matches(r)}catch(i){}return!1}(e,a,o),b=function(e){if(e instanceof HTMLFormElement)return"form";var t=W(e.tagName);return K.test(t)?"div":t}(e),S={},w=e.attributes.length,k=0;w>k;k++){var I=e.attributes[k];ae(b,I.name)||(S[I.name]=se(s,b,W(I.name),I.value,e,c))}if("link"===b&&l){var _=e.href;if(_){var C=ue(s,_);!C&&_.includes(".css")&&(C=ue(s,window.location.origin+"/"+_.replace(window.location.href,"")));var M=null;C&&(M=A(C)),M&&(delete S.rel,delete S.href,S._cssText=M)}}var T;if("style"===b&&e.sheet&&!(e.innerText||R(e)||"").trim().length){var E=A(e.sheet);E&&(S._cssText=E)}if("input"===b||"textarea"===b||"select"===b){var x=e.value,O=e.checked;"radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&x?S.value=U({element:e,type:q(e),tagName:b,value:x,maskInputOptions:u,maskInputFn:d}):O&&(S.checked=O)}if("option"===b&&(e.selected&&!u.select?S.selected=!0:delete S.selected),"dialog"===b&&e.open)try{S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(Z){S.rr_open_mode="modal",S.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&p)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var n=0;e.height>n;n+=50){var i=t.getImageData;if(new Uint32Array((H in i?i[H]:i).call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(S.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var L=e.toDataURL(c.type,c.quality),N=s.createElement("canvas");N.width=e.width,N.height=e.height,L!==N.toDataURL(c.type,c.quality)&&(S.rr_dataURL=L)}if("img"===b&&h){J||(J=s.createElement("canvas"),Y=J.getContext("2d"));var D=e,F=D.currentSrc||D.getAttribute("src")||"<unknown-src>",P=D.crossOrigin,B=()=>{D.removeEventListener("load",B);try{J.width=D.naturalWidth,J.height=D.naturalHeight,Y.drawImage(D,0,0),S.rr_dataURL=J.toDataURL(c.type,c.quality)}catch(Z){if("anonymous"!==D.crossOrigin)return D.crossOrigin="anonymous",void(D.complete&&0!==D.naturalWidth?B():D.addEventListener("load",B));console.warn("Cannot inline img src="+F+"! Error: "+Z)}"anonymous"===D.crossOrigin&&(P?S.crossOrigin=P:D.removeAttribute("crossorigin"))};D.complete&&0!==D.naturalWidth?B():D.addEventListener("load",B)}if("audio"===b||"video"===b){var z=S;z.rr_mediaState=e.paused?"paused":"played",z.rr_mediaCurrentTime=e.currentTime,z.rr_mediaPlaybackRate=e.playbackRate,z.rr_mediaMuted=e.muted,z.rr_mediaLoop=e.loop,z.rr_mediaVolume=e.volume}if(g||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),y){var{width:$,height:j,left:G,top:V}=e.getBoundingClientRect();S={class:S.class,rr_width:$+"px",rr_height:j+"px",rr_left:Math.floor(G+((null==(r=s.defaultView)?void 0:r.scrollX)||0))+"px",rr_top:Math.floor(V+((null==(n=s.defaultView)?void 0:n.scrollY)||0))+"px"}}"iframe"!==b||m(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);try{customElements.get(b)&&(i=!0)}catch(Z){}return{type:f.Element,tagName:b,attributes:S,childNodes:[],isSVG:(T=e,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:y,rootId:v,isCustom:i}}(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:l,maskInputFn:d,dataURLOptions:c,inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g,rootId:v});case e.TEXT_NODE:return function(e,t){var r,{needsMask:n,maskTextFn:i,rootId:s}=t,a=M(e),o=a&&a.tagName,l=R(e),u="STYLE"===o||void 0,d="SCRIPT"===o||void 0;if(u&&l){try{e.nextSibling||e.previousSibling||(null==(r=a.sheet)?void 0:r.cssRules)&&(l=A(a.sheet))}catch(c){console.warn("Cannot get CSS styles from text's parentNode. Error: "+c,e)}l=Z(l,ie(t.doc))}return d&&(l="SCRIPT_PLACEHOLDER"),!u&&!d&&l&&n&&(l=i?i(l,T(e)):l.replace(/[\S]/g,"*")),{type:f.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:a,maskTextFn:u,rootId:v});case e.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:f.Comment,textContent:R(e)||"",rootId:v};default:return!1}}(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:O,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,dataURLOptions:m,inlineImages:g,recordCanvas:v,keepIframeSrcFn:I,newlyAddedElement:_});if(!$)return console.warn(e,"not serialized"),null;B=n.hasNode(e)?n.getId(e):!function(e,t){if(t.comment&&e.type===f.Comment)return!0;if(e.type===f.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===z(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(de(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===de(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(de(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&de(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(de(e.attributes.property).match(/^(og|twitter|fb):/)||de(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===de(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(de(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(de(e.attributes.name))||de(e.attributes.property).match(/^article:/)||de(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(de(e.attributes.name)))return!0}}return!1}($,p)&&(P||$.type!==f.Text||$.isStyle||$.textContent.replace(/^\s+|\s+$/gm,"").length)?Q():-2;var j=Object.assign($,{id:B});if(n.add(e,j),-2===B)return null;y&&y(e);var G=!l;if(j.type===f.Element){G=G&&!j.needBlock,delete j.needBlock;var V=L(e);V&&F(V)&&(j.isShadowHost=!0)}if((j.type===f.Document||j.type===f.Element)&&G){p.headWhitespace&&j.type===f.Element&&"head"===j.tagName&&(P=!1);var X={doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:O,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:v,preserveWhiteSpace:P,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:I,depth:E+1,maxDepth:x};if(j.type===f.Element&&"textarea"===j.tagName&&void 0!==j.attributes.value);else for(var ee of Array.from(C(e))){var te=fe(ee,X);te&&j.childNodes.push(te)}var re=null;if(N(e)&&(re=L(e)))for(var ne of Array.from(C(re))){var oe=fe(ne,X);oe&&(F(re)&&(oe.isShadow=!0),j.childNodes.push(oe))}}var me=M(e);return me&&D(me)&&F(me)&&(j.isShadow=!0),j.type===f.Element&&"iframe"===j.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var i,s=!1;try{i=n.document.readyState}catch(l){return}if("complete"===i){var a="about:blank";if(n.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var o=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),s=!0,t()})}}}(e,()=>{var t=e.contentDocument;if(t&&b){var r=fe(t,{doc:t,mirror:n,blockClass:i,blockSelector:s,needsMask:O,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:v,preserveWhiteSpace:P,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:I,depth:E+1,maxDepth:x});r&&b(e,r)}},S),j.type===f.Element&&"link"===j.tagName&&"string"==typeof j.attributes.rel&&("stylesheet"===j.attributes.rel||"preload"===j.attributes.rel&&"string"==typeof j.attributes.href&&"css"===z(j.attributes.href))&&function(e,t,r){var n,i=!1;try{n=e.sheet}catch(a){return}if(!n){var s=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),i=!0,t()})}}(e,()=>{if(w){var t=fe(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:O,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:v,preserveWhiteSpace:P,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:I,depth:E,maxDepth:x});t&&w(e,t)}},k),j}function me(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}class ge{constructor(){o(this,"parentElement",null),o(this,"parentNode",null),o(this,"ownerDocument"),o(this,"firstChild",null),o(this,"lastChild",null),o(this,"previousSibling",null),o(this,"nextSibling",null),o(this,"ELEMENT_NODE",1),o(this,"TEXT_NODE",3),o(this,"nodeType"),o(this,"nodeName"),o(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof ge))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function ve(e,t,r){void 0===r&&(r=document);var n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function ye(e){try{e()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var be="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.",Se={map:{},getId:()=>(console.error(be),-1),getNode:()=>(console.error(be),null),removeNodeFromMap(){console.error(be)},has:()=>(console.error(be),!1),reset(){console.error(be)}};function we(e,t,r){void 0===r&&(r={});var n=null,i=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var l=Date.now();i||!1!==r.leading||(i=l);var u=t-(l-i),d=this;0>=u||u>t?(n&&(clearTimeout(n),n=null),i=l,e.apply(d,a)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(d,a)},u))}}function ke(e,t,r,n,i){void 0===i&&(i=window);var s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>ke(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Se=new Proxy(Se,{get:(e,t,r)=>("map"===t&&console.error(be),Reflect.get(e,t,r))}));var Ie=Date.now;function _e(e){var t,r,n,i,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=T(s.body))?void 0:t.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(n=T(s.body))?void 0:n.scrollTop)||(null==(i=null==s?void 0:s.body)?void 0:i.scrollTop)||0}}function Ce(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Me(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Te(e){return e?e.nodeType===e.ELEMENT_NODE?e:T(e):null}function Re(e,t,r,n){if(!e)return!1;var i=Te(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(oe(i,t,n))return!0}catch(s){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function Ee(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function xe(e,t){if(D(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var n=M(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||xe(n,t))}function Oe(e){return Boolean(e.changedTouches)}function Le(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ne(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function De(e){return!!e&&(e instanceof ge&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(L(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Ie=()=>(new Date).getTime());class Fe{constructor(){o(this,"id",1),o(this,"styleIDMap",new WeakMap),o(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ae(e){var t,r=null;return"getRootNode"in e&&(null==(t=x(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&O(x(e))&&(r=O(x(e))),r}function Pe(e){var t=e.ownerDocument;return!!t&&(E(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Ae(r);)r=t;return r}(e);return E(t,r)}(e))}function Be(e){return"__ln"in e}class Ue{constructor(){o(this,"length",0),o(this,"head",null),o(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Be(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Be(e.nextSibling)&&e.nextSibling.__ln.previous){var n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}var We,He=(e,t)=>e+"@"+t;class qe{constructor(){o(this,"frozen",!1),o(this,"locked",!1),o(this,"texts",[]),o(this,"attributes",[]),o(this,"attributeMap",new WeakMap),o(this,"removes",[]),o(this,"mapRemoves",[]),o(this,"movedMap",{}),o(this,"addedSet",new Set),o(this,"movedSet",new Set),o(this,"droppedSet",new Set),o(this,"removesSubTreeCache",new Set),o(this,"mutationCb"),o(this,"blockClass"),o(this,"blockSelector"),o(this,"maskTextClass"),o(this,"maskTextSelector"),o(this,"inlineStylesheet"),o(this,"maskInputOptions"),o(this,"maskTextFn"),o(this,"maskInputFn"),o(this,"keepIframeSrcFn"),o(this,"recordCanvas"),o(this,"inlineImages"),o(this,"slimDOMOptions"),o(this,"dataURLOptions"),o(this,"doc"),o(this,"mirror"),o(this,"iframeManager"),o(this,"stylesheetManager"),o(this,"shadowDomManager"),o(this,"canvasManager"),o(this,"processedNodeManager"),o(this,"unattachedDoc"),o(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),o(this,"emit",()=>{if(!this.frozen&&!this.locked){for(var e=[],t=new Set,r=new Ue,n=e=>{for(var t=e,r=-2;-2===r;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},i=i=>{var s=M(i);if(s&&Pe(i)&&"TEXTAREA"!==s.tagName){var a=D(s)?this.mirror.getId(Ae(i)):this.mirror.getId(s),o=n(i);if(-1===a||-1===o)return r.addNode(i);var l=fe(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Le(e,this.mirror)&&this.iframeManager.addIframe(e),Ne(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),De(i)&&this.shadowDomManager.addShadowRoot(L(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:a,nextId:o,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)$e(this.removesSubTreeCache,s)&&!this.movedSet.has(M(s))||i(s);for(var a of this.addedSet)je(this.droppedSet,a)||$e(this.removesSubTreeCache,a)?je(this.movedSet,a)?i(a):this.droppedSet.add(a):i(a);for(var o=null;r.length;){var l=null;if(o){var u=this.mirror.getId(M(o.value)),d=n(o.value);-1!==u&&-1!==d&&(l=o)}if(!l)for(var c=r.tail;c;){var h=c;if(c=c.previous,h){var p=this.mirror.getId(M(h.value));if(-1===n(h.value))continue;if(-1!==p){l=h;break}var f=M(h.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var m=O(f);if(-1!==this.mirror.getId(m)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}o=l.previous,r.removeNode(l.value),i(l.value)}var g={texts:this.texts.map(e=>{var t=e.node,r=M(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{var{attributes:t}=e;if("string"==typeof t.style){var r=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);t.style.length>r.length&&(r+n).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(g.texts.length||g.attributes.length||g.removes.length||g.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(g))}}),o(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),o(this,"genTextAreaValueMutation",e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(C(e),e=>R(e)||"").join("");t.attributes.value=U({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:q(e),value:r,maskInputFn:this.maskInputFn})}),o(this,"processMutation",e=>{if(!Ee(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=R(e.target);Re(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:le(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Te(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var r=e.target,n=e.attributeName,i=e.target.getAttribute(n);if("value"===n){var s=q(r);i=U({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(Re(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;var a=this.attributeMap.get(e.target);if("IFRAME"===r.tagName&&"src"===n&&!this.keepIframeSrcFn(i)){if(r.contentDocument)return;n="rr_src"}if(a||(this.attributes.push(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,a)),"type"===n&&"INPUT"===r.tagName&&"password"===(e.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!ae(r.tagName,n))if(a.attributes[n]=se(this.doc,W(r.tagName),W(n),i,r,this.dataURLOptions),"style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(h){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var l of(e.oldValue&&o.setAttribute("style",e.oldValue),Array.from(r.style))){var u=r.style.getPropertyValue(l),d=r.style.getPropertyPriority(l);u!==o.style.getPropertyValue(l)||d!==o.style.getPropertyPriority(l)?a.styleDiff[l]=""===d?u:[u,d]:a._unchangedStyles[l]=[u,d]}for(var c of Array.from(o.style))""===r.style.getPropertyValue(c)&&(a.styleDiff[c]=!1)}else"open"===n&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(Re(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{var r,n=this.mirror.getId(t),i=D(e.target)?this.mirror.getId(O(e.target)):this.mirror.getId(e.target);Re(e.target,this.blockClass,this.blockSelector,!1)||Ee(t,this.mirror,this.slimDOMOptions)||(r=t,-1===this.mirror.getId(r))||(this.addedSet.has(t)?(ze(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||xe(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[He(n,i)]?ze(this.movedSet,t):(this.removes.push({parentId:i,id:n,isShadow:!(!D(e.target)||!F(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var n=r.pop();t.has(n)||(t.add(n),C(n).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),o(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ee(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[He(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Re(e,this.blockClass,this.blockSelector,!1)||(C(e).forEach(e=>this.genAdds(e)),De(e)&&C(L(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function ze(e,t){e.delete(t),C(t).forEach(t=>ze(e,t))}function $e(e,t,r){return 0!==e.size&&(n=e,!!(i=M(t))&&n.has(i));var n,i}function je(e,t){return 0!==e.size&&Ge(e,t)}function Ge(e,t){var r=M(t);return!!r&&(!!e.has(r)||Ge(e,r))}var Ve=e=>We?function(){try{return e(...arguments)}catch(t){if(We&&!0===We(t))return;throw t}}:e,Ze=[];function Je(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(r){}return e&&e.target}function Ye(e,t){var r=new qe;Ze.push(r),r.init(e);var n=new(I())(Ve(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{observer:n,buffer:r}}function Xe(e){var{scrollCb:t,doc:r,mirror:n,blockClass:i,blockSelector:s,sampling:a}=e;return ve("scroll",Ve(we(Ve(e=>{var a=Je(e);if(a&&!Re(a,i,s,!0)){var o=n.getId(a);if(a===r&&r.defaultView){var l=_e(r.defaultView);t({id:o,x:l.left,y:l.top})}else t({id:o,x:a.scrollLeft,y:a.scrollTop})}}),a.scroll||100)),r)}var Ke=["INPUT","TEXTAREA","SELECT"],Qe=new WeakMap;function et(e){return function e(t,r){if(it("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||it("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||it("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||it("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var n=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(n),e(t.parentRule,r)}if(t.parentStyleSheet){var i=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(i)}return r}(e,[])}function tt(e,t,r){var n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function rt(e,t){var r,n,i,s,{mirror:a,stylesheetManager:o}=e;s=a.getId("#document"===t.nodeName?t:O(t));var l="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(i=null==(n=t.ownerDocument)?void 0:n.defaultView)?void 0:i.ShadowRoot,u=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&l&&u?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null==(e=u.get)?void 0:e.call(this)},set(e){var t,r=null==(t=u.set)?void 0:t.call(this,e);if(null!==s&&-1!==s)try{o.adoptStyleSheets(e,s)}catch(n){}return r}}),Ve(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})})):()=>{}}function nt(e,t){void 0===t&&(t={});var n,i,s=e.doc.defaultView;if(!s)return()=>{};if(function(e,t){var{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:a,inputCb:o,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:d,canvasMutationCb:c,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),n(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),i(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),a(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),o(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),d(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),c(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),f(...arguments)}}(e,t),e.recordDOM){var a=Ye(e,e.doc);n=a.observer,i=a.buffer}var o=function(e){var{mousemoveCb:t,sampling:r,doc:n,mirror:i}=e;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],d=we(Ve(e=>{var r=Date.now()-s;t(l.map(e=>(e.timeOffset-=r,e)),e),l=[],s=null}),o),c=Ve(we(Ve(e=>{var t=Je(e),{clientX:r,clientY:n}=Oe(e)?e.changedTouches[0]:e;s||(s=Ie()),l.push({x:r,y:n,id:i.getId(t),timeOffset:Ie()-s}),d("undefined"!=typeof DragEvent&&e instanceof DragEvent?u.Drag:e instanceof MouseEvent?u.MouseMove:u.TouchMove)}),a,{trailing:!1})),h=[ve("mousemove",c,n),ve("touchmove",c,n),ve("drag",c,n)];return Ve(()=>{h.forEach(e=>e())})}(e),l=function(e){var{mouseInteractionCb:t,doc:n,mirror:i,blockClass:s,blockSelector:a,sampling:o}=e;if(!1===o.mouseInteraction)return()=>{};var l=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,u=[],h=null;return Object.keys(d).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e]).forEach(e=>{var o=W(e),l=(e=>n=>{var o=Je(n);if(!Re(o,s,a,!0)){var l=null,u=e;if("pointerType"in n){switch(n.pointerType){case"mouse":l=c.Mouse;break;case"touch":l=c.Touch;break;case"pen":l=c.Pen}l===c.Touch&&(d[e]===d.MouseDown?u="TouchStart":d[e]===d.MouseUp&&(u="TouchEnd"))}else Oe(n)&&(l=c.Touch);null!==l?(h=l,(u.startsWith("Touch")&&l===c.Touch||u.startsWith("Mouse")&&l===c.Mouse)&&(l=null)):d[e]===d.Click&&(l=h,h=null);var p=Oe(n)?n.changedTouches[0]:n;if(p){var f=i.getId(o),{clientX:m,clientY:g}=p;Ve(t)(r({type:d[u],id:f,x:m,y:g},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(d[e]){case d.MouseDown:case d.MouseUp:o=o.replace("mouse","pointer");break;case d.TouchStart:case d.TouchEnd:return}u.push(ve(o,l,n))}),Ve(()=>{u.forEach(e=>e())})}(e),h=Xe(e),f=function(e,t){var{viewportResizeCb:r}=e,{win:n}=t,i=-1,s=-1;return ve("resize",Ve(we(Ve(()=>{var e=Ce(),t=Me();i===e&&s===t||(r({width:Number(t),height:Number(e)}),i=e,s=t)}),200)),n)}(e,{win:s}),m=function(e){var{inputCb:t,doc:n,mirror:i,blockClass:s,blockSelector:a,ignoreClass:o,ignoreSelector:l,maskInputOptions:u,maskInputFn:d,sampling:c,userTriggeredOnInput:h}=e;function p(e){var t=Je(e),r=e.isTrusted,i=t&&t.tagName;if(t&&"OPTION"===i&&(t=T(t)),t&&i&&Ke.indexOf(i)>=0&&!Re(t,s,a,!0)&&!(t.classList.contains(o)||l&&t.matches(l))){var c=t.value,p=!1,m=q(t)||"";"radio"===m||"checkbox"===m?p=t.checked:(u[i.toLowerCase()]||u[m])&&(c=U({element:t,maskInputOptions:u,tagName:i,type:m,value:c,maskInputFn:d})),f(t,h?{text:c,isChecked:p,userTriggered:r}:{text:c,isChecked:p});var g=t.name;"radio"===m&&g&&p&&n.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach(e=>{if(e!==t){var r=e.value;f(e,h?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}})}}function f(e,n){var s=Qe.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){Qe.set(e,n);var a=i.getId(e);Ve(t)(r({},n,{id:a}))}}var m=("last"===c.input?["change"]:["input","change"]).map(e=>ve(e,Ve(p),n)),g=n.defaultView;if(!g)return()=>{m.forEach(e=>e())};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&m.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map(e=>ke(e[0],e[1],{set(){Ve(p)({target:this,isTrusted:!1})}},!1,g))),Ve(()=>{m.forEach(e=>e())})}(e),g=function(e){var{mediaInteractionCb:t,blockClass:r,blockSelector:n,mirror:i,sampling:s,doc:a}=e,o=Ve(e=>we(Ve(s=>{var a=Je(s);if(a&&!Re(a,r,n,!0)){var{currentTime:o,volume:l,muted:u,playbackRate:d,loop:c}=a;t({type:e,id:i.getId(a),currentTime:o,volume:l,muted:u,playbackRate:d,loop:c})}}),s.media||500)),l=[ve("play",o(p.Play),a),ve("pause",o(p.Pause),a),ve("seeked",o(p.Seeked),a),ve("volumechange",o(p.VolumeChange),a),ve("ratechange",o(p.RateChange),a)];return Ve(()=>{l.forEach(e=>e())})}(e),v=()=>{},y=()=>{},b=()=>{},S=()=>{};e.recordDOM&&(v=function(e,t){var{styleSheetRuleCb:r,mirror:n,stylesheetManager:i}=e,{win:s}=t;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Ve((e,t,s)=>{var[a,o]=s,{id:l,styleId:u}=tt(t,n,i.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:a,index:o}]}),e.apply(t,s)})}),s.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var o,l,u=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(u,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,removes:[{index:a}]}),e.apply(t,s)})}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,replace:a}),e.apply(t,s)})})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,replaceSync:a}),e.apply(t,s)})}));var d={};st("CSSGroupingRule")?d.CSSGroupingRule=s.CSSGroupingRule:(st("CSSMediaRule")&&(d.CSSMediaRule=s.CSSMediaRule),st("CSSConditionRule")&&(d.CSSConditionRule=s.CSSConditionRule),st("CSSSupportsRule")&&(d.CSSSupportsRule=s.CSSSupportsRule));var c={};return Object.entries(d).forEach(e=>{var[t,s]=e;c[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(c[t].insertRule,{apply:Ve((e,t,s)=>{var[a,o]=s,{id:l,styleId:u}=tt(t.parentStyleSheet,n,i.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:a,index:[...et(t),o||0]}]}),e.apply(t,s)})}),s.prototype.deleteRule=new Proxy(c[t].deleteRule,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t.parentStyleSheet,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,removes:[{index:[...et(t),a]}]}),e.apply(t,s)})})}),Ve(()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=u,o&&(s.CSSStyleSheet.prototype.replace=o),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach(e=>{var[t,r]=e;r.prototype.insertRule=c[t].insertRule,r.prototype.deleteRule=c[t].deleteRule})})}(e,{win:s}),y=rt(e,e.doc),b=function(e,t){var{styleDeclarationCb:r,mirror:n,ignoreCSSAttributes:i,stylesheetManager:s}=e,{win:a}=t,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Ve((e,t,a)=>{var l,[u,d,c]=a;if(i.has(u))return o.apply(t,[u,d,c]);var{id:h,styleId:p}=tt(null==(l=t.parentRule)?void 0:l.parentStyleSheet,n,s.styleMirror);return(h&&-1!==h||p&&-1!==p)&&r({id:h,styleId:p,set:{property:u,value:d,priority:c},index:et(t.parentRule)}),e.apply(t,a)})});var l=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ve((e,t,a)=>{var o,[u]=a;if(i.has(u))return l.apply(t,[u]);var{id:d,styleId:c}=tt(null==(o=t.parentRule)?void 0:o.parentStyleSheet,n,s.styleMirror);return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:u},index:et(t.parentRule)}),e.apply(t,a)})}),Ve(()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=l})}(e,{win:s}),e.collectFonts&&(S=function(e){var{fontCb:t,doc:r}=e,n=r.defaultView;if(!n)return()=>{};var i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function(e,t,r){var n=new a(e,t,r);return s.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};var o=_(r.fonts,"add",function(e){return function(r){return setTimeout(Ve(()=>{var e=s.get(r);e&&(t(e),s.delete(r))}),0),e.apply(this,[r])}});return i.push(()=>{n.FontFace=a}),i.push(o),Ve(()=>{i.forEach(e=>e())})}(e)));var w=function(e){var{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e,a=!0,o=Ve(()=>{var e=t.getSelection();if(!(!e||a&&(null==e?void 0:e.isCollapsed))){a=e.isCollapsed||!1;for(var o=[],l=e.rangeCount||0,u=0;l>u;u++){var d=e.getRangeAt(u),{startContainer:c,startOffset:h,endContainer:p,endOffset:f}=d;Re(c,n,i,!0)||Re(p,n,i,!0)||o.push({start:r.getId(c),startOffset:h,end:r.getId(p),endOffset:f})}s({ranges:o})}});return o(),ve("selectionchange",o)}(e),k=function(e){var{doc:t,customElementCb:r}=e,n=t.defaultView;return n&&n.customElements?_(n.customElements,"define",function(e){return function(t,n,i){try{r({define:{name:t}})}catch(s){console.warn("Custom element callback failed for "+t)}return e.apply(this,[t,n,i])}}):()=>{}}(e),I=[];for(var C of e.plugins)I.push(C.observer(C.callback,s,C.options));return Ve(()=>{if(i){i.destroy(),i.reset();var e=Ze.indexOf(i);-1!==e&&Ze.splice(e,1)}null==n||n.disconnect(),o(),l(),h(),f(),m(),g(),v(),y(),b(),S(),w(),k(),I.forEach(e=>e())})}function it(e){return void 0!==window[e]}function st(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class at{constructor(e){o(this,"iframeIdToRemoteIdMap",new WeakMap),o(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){var i=r||this.getIdToRemoteIdMap(e),s=n||this.getRemoteIdToIdMap(e),a=i.get(t);return a||(a=this.generateIdFn(),i.set(t,a),s.set(a,t)),a}getIds(e,t){var r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){var n=r||this.getRemoteIdToIdMap(e);return"number"!=typeof t?t:n.get(t)||-1}getRemoteIds(e,t){var r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){var t=this.iframeIdToRemoteIdMap.get(e);return t||this.iframeIdToRemoteIdMap.set(e,t=new Map),t}getRemoteIdToIdMap(e){var t=this.iframeRemoteIdToIdMap.get(e);return t||this.iframeRemoteIdToIdMap.set(e,t=new Map),t}}class ot{constructor(e){o(this,"iframes",new WeakMap),o(this,"crossOriginIframeMap",new WeakMap),o(this,"crossOriginIframeMirror",new at(Q)),o(this,"crossOriginIframeStyleMirror"),o(this,"crossOriginIframeRootIdMap",new WeakMap),o(this,"mirror"),o(this,"mutationCb"),o(this,"wrappedEmit"),o(this,"loadListener"),o(this,"pageHideListener"),o(this,"stylesheetManager"),o(this,"recordCrossOriginIframes"),o(this,"messageHandler"),o(this,"nestedIframeListeners",new Map),o(this,"attachedIframes",new Map),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new at(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,n,i=this.trackIframeContent(e,t);this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);this.nestedIframeListeners.set(s,a),s.addEventListener("message",a)}null==(r=e.contentWindow)||r.addEventListener("pagehide",()=>{var t;null==(t=this.pageHideListener)||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument),e.contentWindow&&this.crossOriginIframeMap.delete(e.contentWindow)}),null==(n=this.loadListener)||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var r;switch(t.type){case l.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:l.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case l.Meta:case l.Load:case l.DomContentLoaded:return!1;case l.Plugin:return t;case l.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case l.IncrementalSnapshot:switch(t.data.source){case u.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case u.Drag:case u.TouchMove:case u.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(t.data,e,["id"]),t;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case u.Font:return t;case u.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case u.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(var i of n)(Array.isArray(t[i])||"number"==typeof t[i])&&(t[i]=Array.isArray(t[i])?e.getIds(r,t[i]):e.getId(r,t[i]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===f.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.mirror.getNode(e);if(r){var n=r.contentWindow;if(n&&this.nestedIframeListeners.has(n)){var i=this.nestedIframeListeners.get(n);ye(()=>n.removeEventListener("message",i)),this.nestedIframeListeners.delete(n)}n&&this.crossOriginIframeMap.delete(n),this.iframes.delete(r)}t&&this.attachedIframes.delete(e)}reattachIframes(){this.attachedIframes.forEach((e,t)=>{var{content:r}=e;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{ye(()=>t.removeEventListener("message",e))}),this.nestedIframeListeners.clear(),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap}}class lt{constructor(e){o(this,"shadowDoms",new WeakSet),o(this,"mutationCb"),o(this,"scrollCb"),o(this,"bypassOptions"),o(this,"mirror"),o(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(F(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var{observer:n,buffer:i}=Ye(r({},this.bypassOptions,{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>{n.disconnect(),i.destroy();var e=Ze.indexOf(i);-1!==e&&Ze.splice(e,1)}),this.restoreHandlers.push(Xe(r({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(O(e))),this.restoreHandlers.push(rt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var r=this;this.restoreHandlers.push(_(e.prototype,"attachShadow",function(e){return function(n){var i=e.call(this,n),s=L(this);return s&&Pe(this)&&r.addShadowRoot(s,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ct=0;64>ct;ct++)dt[ut.charCodeAt(ct)]=ct;var ht=new Map,pt=(e,t,r)=>{if(e&&(gt(e,t)||"object"==typeof e)){var n=(s=r,a=e.constructor.name,(o=ht.get(s))||ht.set(s,o=new Map),o.has(a)||o.set(a,[]),o.get(a)),i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i}var s,a,o};function ft(e,t,r,n){if(e instanceof Array)return e.map(e=>ft(e,t,r,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;n>t;t+=3)i+=ut[r[t]>>2],i+=ut[(3&r[t])<<4|r[t+1]>>4],i+=ut[(15&r[t+1])<<2|r[t+2]>>6],i+=ut[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ft(e.buffer,t,r,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){var i=e.constructor.name,{src:s}=e;return{rr_type:i,src:s}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(n.type,n.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[ft(e.data,t,r,n),e.width,e.height]}:gt(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:pt(e,t,r)}:e}var mt=(e,t,r,n)=>e.map(e=>ft(e,t,r,n)),gt=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function vt(e,t,r,n){var i=[];try{var s=_(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];if(!Re(this,t,r,!0)){var l=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=l),n&&["webgl","webgl2"].includes(l))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...a])}});i.push(s)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function yt(e,t,r,n,i,s,a){var o=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=_(e,l,function(e){return function(){for(var o=arguments.length,u=new Array(o),d=0;o>d;d++)u[d]=arguments[d];var c=e.apply(this,u);if(pt(c,s,this),"tagName"in this.canvas&&!Re(this.canvas,n,i,!0)){var h=mt(u,s,this,a);r(this.canvas,{type:t,property:l,args:h})}return c}});o.push(u)}catch(c){var d=ke(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});o.push(d)}};for(var d of l)u(d);return o}var bt,St,wt,kt='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n function fnv1aHash(buffer) {\n const view = new Uint8Array(buffer);\n let hash = 2166136261;\n for (let i2 = 0; i2 < view.length; i2++) {\n hash ^= view[i2];\n hash = hash * 16777619 | 0;\n }\n return (hash >>> 0).toString(16);\n }\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n try {\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d");\n }\n reusableCtx.clearRect(0, 0, width, height);\n reusableCtx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const fingerprint = fnv1aHash(arrayBuffer);\n if (!lastFingerprintMap.has(id)) {\n const base642 = encode(arrayBuffer);\n if (await transparentBase64 === base642) {\n lastFingerprintMap.set(id, fingerprint);\n return worker.postMessage({ id });\n }\n lastFingerprintMap.set(id, fingerprint);\n worker.postMessage({ id, type, base64: base642, width, height });\n return;\n }\n if (lastFingerprintMap.get(id) === fingerprint)\n return worker.postMessage({ id });\n const base64 = encode(arrayBuffer);\n worker.postMessage({ id, type, base64, width, height });\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-Ca9A-vl6.js.map\n',It="undefined"!=typeof self&&self.Blob&&new Blob([kt],{type:"text/javascript;charset=utf-8"});function _t(e){var t;try{if(!(t=It&&(self.URL||self.webkitURL).createObjectURL(It)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(kt),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Ct{constructor(e){o(this,"pendingCanvasMutations",new Map),o(this,"rafStamps",{latestId:0,invokeId:null}),o(this,"mirror"),o(this,"mutationCb"),o(this,"resetObservers"),o(this,"frozen",!1),o(this,"locked",!1),o(this,"rafIdTimestamp",null),o(this,"rafIdFlush",null),o(this,"processMutation",(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});var{sampling:t="all",win:r,blockClass:n,blockSelector:i,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(r,n,i,a),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,i,{dataURLOptions:a})}reset(){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(e,r,n,i,s){var a=this;if("OffscreenCanvas"in r){var o=vt(r,n,i,!0),l=new Map,u=new _t;u.onmessage=e=>{var{id:t}=e.data;if(l.set(t,!1),"base64"in e.data){var{base64:r,type:n,width:i,height:s}=e.data;this.mutationCb({id:t,type:h["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}],displayWidth:i,displayHeight:s})}};var d,c=1e3/e,p=0,f=e=>{var o,h,m;p&&c>e-p||(p=e,(o=[],h=e=>{e.querySelectorAll("canvas").forEach(e=>{Re(e,n,i,!0)||o.push(e)}),e.querySelectorAll("*").forEach(e=>{e.shadowRoot&&h(e.shadowRoot)})},h(r.document),o).forEach((m=t(function*(e){var t,r=a.mirror.getId(e);if(!l.get(r)&&0!==e.width&&0!==e.height){l.set(r,!0);try{if(["webgl","webgl2"].includes(e.__context)){var n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var i=e.clientWidth||e.width,o=e.clientHeight||e.height,d=yield createImageBitmap(e,{resizeWidth:i,resizeHeight:o});u.postMessage({id:r,bitmap:d,width:i,height:o,dataURLOptions:s.dataURLOptions},[d])}catch(c){l.set(r,!1)}}}),function(e){return m.apply(this,arguments)}))),d=requestAnimationFrame(f)};d=requestAnimationFrame(f),this.resetObservers=()=>{o(),cancelAnimationFrame(d)}}}initCanvasMutationObserver(e,t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var i,s,a,o,l,u,d=vt(e,t,r,!1),c=function(e,t,r,n,i){var s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])return 1;var o=_(t.CanvasRenderingContext2D.prototype,a,function(s){return function(){for(var o=arguments.length,l=new Array(o),u=0;o>u;u++)l[u]=arguments[u];return Re(this.canvas,r,n,!0)||setTimeout(()=>{var r=mt(l,t,this,i);e(this.canvas,{type:h["2D"],property:a,args:r})},0),s.apply(this,l)}});s.push(o)}catch(u){var l=ke(t.CanvasRenderingContext2D.prototype,a,{set(t){e(this.canvas,{type:h["2D"],property:a,args:[t],setter:!0})}});s.push(l)}};for(var l of a)o(l);return()=>{s.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,n),p=(i=this.processMutation.bind(this),a=t,o=r,l=n,u=[],void 0!==(s=e).WebGLRenderingContext&&u.push(...yt(s.WebGLRenderingContext.prototype,h.WebGL,i,a,o,s,l)),void 0!==s.WebGL2RenderingContext&&u.push(...yt(s.WebGL2RenderingContext.prototype,h.WebGL2,i,a,o,s,l)),()=>{u.forEach(e=>e())});this.resetObservers=()=>{d(),c(),p()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var n=r.map(e=>function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,s)),{type:i}=r[0];this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}}}class Mt{constructor(e){o(this,"trackedLinkElements",new WeakSet),o(this,"mutationCb"),o(this,"adoptedStyleSheetCb"),o(this,"styleMirror",new Fe),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var r=this;if(0!==e.length){var n={id:t,styleIds:[]},i=[],s=function(e){var t;r.styleMirror.has(e)?t=r.styleMirror.getId(e):(t=r.styleMirror.add(e),i.push({styleId:t,rules:Array.from(e.rules||CSSRule,(t,r)=>({rule:P(t,e.href),index:r}))})),n.styleIds.push(t)};for(var a of e)s(a);i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Tt{constructor(){o(this,"nodeMap",new WeakMap),o(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}var Rt=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Et=document.createElement("iframe");document.body.appendChild(Et),Array.from=(null==(n=Et.contentWindow)?void 0:n.Array.from)||Array.from,document.body.removeChild(Et)}}catch(i){console.debug("Unable to override Array.from",i)}var xt=new B;function Ot(e){void 0===e&&(e={});var{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:o="rr-ignore",ignoreSelector:d=null,maskTextClass:c="rr-mask",maskTextSelector:h=null,inlineStylesheet:p=!0,maskAllInputs:f,maskInputOptions:m,slimDOMOptions:g,maskInputFn:v,maskTextFn:y,hooks:b,packFn:S,sampling:w={},dataURLOptions:k={},mousemoveWait:I,recordDOM:_=!0,recordCanvas:C=!1,recordCrossOriginIframes:M=!1,recordAfter:T=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:E=!1,inlineImages:x=!1,plugins:O,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:D=new Set([]),errorHandler:F}=e;We=F;var A=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},k),P=!M||window.parent===window,U=!1;if(!P)try{window.parent.document&&(U=!1)}catch(H){U=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!U)return()=>{};void 0!==I&&void 0===w.mousemove&&(w.mousemove=I),xt.reset();var W,H,q=!0===f?{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!==m?m:{password:!0},z=me(void 0!==g&&g);void 0===H&&(H=window),"NodeList"in H&&!H.NodeList.prototype.forEach&&(H.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in H&&!H.DOMTokenList.prototype.forEach&&(H.DOMTokenList.prototype.forEach=[].forEach);var $=0,j=new Map,G=e=>{for(var t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!U&&(e=S(e)),e};bt=(e,r)=>{var s,a=e;if(a.timestamp=Ie(),!(null==(s=Ze[0])?void 0:s.isFrozen())||a.type===l.FullSnapshot||a.type===l.IncrementalSnapshot&&a.data.source===u.Mutation||Ze.forEach(e=>e.unfreeze()),P)null==t||t(G(a),r);else if(U){var o={type:"rrweb",event:G(a),origin:window.location.origin,isCheckout:r};window.parent.postMessage(o,"*")}if(a.type===l.FullSnapshot)W=a,$=0;else if(a.type===l.IncrementalSnapshot){if(a.data.source===u.Mutation&&a.data.isAttachIframe)return;$++,(i&&$>=i||n&&a.timestamp-W.timestamp>n)&&St(!0)}};var V=e=>{if(M&&e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null;e.removes.forEach(e=>{var{id:r}=e;if(!t||!t.has(r)){var n=j.get(r);n&&(n(),j.delete(r)),X.removeIframeById(r)}}),function(){for(var[e,t]of j){var r=xt.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||(t(),j.delete(e))}catch(n){t(),j.delete(e)}else t(),j.delete(e)}}()}bt({type:l.IncrementalSnapshot,data:r({source:u.Mutation},e)})},Z=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Scroll},e)}),J=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.CanvasMutation},e)}),Y=new Mt({mutationCb:V,adoptedStyleSheetCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},e)})}),X=new ot({mirror:xt,mutationCb:V,stylesheetManager:Y,recordCrossOriginIframes:M,wrappedEmit:bt});for(var K of O||[])K.getMirror&&K.getMirror({nodeMirror:xt,crossOriginIframeMirror:X.crossOriginIframeMirror,crossOriginIframeStyleMirror:X.crossOriginIframeStyleMirror});var Q=new Tt;wt=new Ct({recordCanvas:C,mutationCb:J,win:window,blockClass:s,blockSelector:a,mirror:xt,sampling:w.canvas,dataURLOptions:A});var ee=new lt({mutationCb:V,scrollCb:Z,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:h,inlineStylesheet:p,maskInputOptions:q,dataURLOptions:A,maskTextFn:y,maskInputFn:v,recordCanvas:C,inlineImages:x,sampling:w,slimDOMOptions:z,iframeManager:X,stylesheetManager:Y,canvasManager:wt,keepIframeSrcFn:N,processedNodeManager:Q},mirror:xt});St=function(e){if(void 0===e&&(e=!1),_){bt({type:l.Meta,data:{href:window.location.href,width:Me(),height:Ce()}},e),Y.reset(),ee.init(),Ze.forEach(e=>e.lock());var t=function(e,t){var{mirror:r=new B,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:o=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:c,maskInputFn:h,slimDOM:p=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w=()=>!1,maxDepth:k}=t||{};return fe(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===d?{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===d?{password:!0}:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:me(p),dataURLOptions:f,inlineImages:l,recordCanvas:u,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w,newlyAddedElement:!1,maxDepth:k})}(document,{mirror:xt,blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:h,inlineStylesheet:p,maskAllInputs:q,maskTextFn:y,maskInputFn:v,slimDOM:z,dataURLOptions:A,recordCanvas:C,inlineImages:x,onSerialize(e){Le(e,xt)&&X.addIframe(e),Ne(e,xt)&&Y.trackLinkElement(e),De(e)&&ee.addShadowRoot(L(e),document)},onIframeLoad(e,t){X.attachIframe(e,t),ee.observeAttachShadow(e)},onStylesheetLoad(e,t){Y.attachLinkElement(e,t)},keepIframeSrcFn:N});if(!t)return console.warn("Failed to snapshot the document");bt({type:l.FullSnapshot,data:{node:t,initialOffset:_e(window)}},e),Ze.forEach(e=>e.unlock()),M&&X.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Y.adoptStyleSheets(document.adoptedStyleSheets,xt.getId(document))}};try{var te=[],re=e=>{var t;return Ve(nt)({mutationCb:V,mousemoveCb:(e,t)=>bt({type:l.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MouseInteraction},e)}),scrollCb:Z,viewportResizeCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.ViewportResize},e)}),inputCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Input},e)}),mediaInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MediaInteraction},e)}),styleSheetRuleCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleSheetRule},e)}),styleDeclarationCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleDeclaration},e)}),canvasMutationCb:J,fontCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Font},e)}),selectionCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.Selection},e)})},customElementCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.CustomElement},e)})},blockClass:s,ignoreClass:o,ignoreSelector:d,maskTextClass:c,maskTextSelector:h,maskInputOptions:q,inlineStylesheet:p,sampling:w,recordDOM:_,recordCanvas:C,inlineImages:x,userTriggeredOnInput:R,collectFonts:E,doc:e,maskInputFn:v,maskTextFn:y,keepIframeSrcFn:N,blockSelector:a,slimDOMOptions:z,dataURLOptions:A,mirror:xt,iframeManager:X,stylesheetManager:Y,shadowDomManager:ee,processedNodeManager:Q,canvasManager:wt,ignoreCSSAttributes:D,plugins:(null==(t=null==O?void 0:O.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>bt({type:l.Plugin,data:{plugin:e.name,payload:t}})})))||[]},b)};X.addLoadListener(e=>{try{var t=xt.getId(e),r=re(e.contentDocument);te.push(r),-1!==t&&j.set(t,r)}catch(n){console.warn(n)}}),X.addPageHideListener(e=>{var t=xt.getId(e),r=j.get(t);r&&(r(),j.delete(t)),function(e){for(var t=Ze.length-1;t>=0;t--){var r=Ze[t];r.bufferBelongsToIframe(e)&&(r.reset(),Ze.splice(t,1))}}(e)});var ne=()=>{St(),te.push(re(document)),Rt=!0};return["interactive","complete"].includes(document.readyState)?ne():(te.push(ve("DOMContentLoaded",()=>{bt({type:l.DomContentLoaded,data:{}}),"DOMContentLoaded"===T&&ne()})),te.push(ve("load",()=>{bt({type:l.Load,data:{}}),"load"===T&&ne()},window))),()=>{te.forEach(e=>ye(e)),Q.destroy(),X.removeLoadListener(),X.destroy(),j.clear(),xt.reset(),Rt=!1,We=void 0}}catch(H){console.warn(H)}}Ot.addCustomEvent=(e,t)=>{if(!Rt)throw new Error("please add custom event after start recording");bt({type:l.Custom,data:{tag:e,payload:t}})},Ot.freezePage=()=>{Ze.forEach(e=>e.freeze())},Ot.takeFullSnapshot=e=>{if(!Rt)throw new Error("please take full snapshot after start recording");St(e)},Ot.mirror=xt;var Lt=Object.defineProperty,Nt=(e,t,r)=>{return s=r,(i="symbol"!=typeof t?t+"":t)in(n=e)?Lt(n,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[i]=s;var n,i,s};class Dt{constructor(e){Nt(this,"fileName"),Nt(this,"functionName"),Nt(this,"lineNumber"),Nt(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}var Ft=/(^|@)\S+:\d+/,At=/^\s*at .*(\S+:\d+|\(native\))/m,Pt=/^(eval@)?(\[native code])?$/,Bt={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(At)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(At)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),s=n.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Dt({functionName:s,fileName:a,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(Pt)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Dt({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Dt({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[],i=2,s=r.length;s>i;i+=2){var a=t.exec(r[i]);a&&n.push(new Dt({fileName:a[2],lineNumber:parseFloat(a[1])}))}return n},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[],i=0,s=r.length;s>i;i+=2){var a=t.exec(r[i]);a&&n.push(new Dt({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return n},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(Ft)&&!e.match(/^Error created at/)},this).map(function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Dt({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Ut(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(var s=0;n.children.length>s;s++){var a=n.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&i.push(a)}i.length>1&&(r+=":eq("+i.indexOf(e)+")"),t=r+(t?">"+t:""),e=n}return t}function Wt(e){return Array.isArray(e)}function Ht(e){return"object"==typeof e&&null!==e&&!Wt(e)}function qt(e,t){if(0===t)return!0;var r=Object.keys(e);for(var n of r)if(Ht(e[n])&&qt(e[n],t-1))return!0;return!1}function zt(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Ht(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Ht(o)&&qt(o,r.depthOfLimit))return a=t.toString(),r.stringLengthLimit&&a.length>r.stringLengthLimit&&(a=a.slice(0,r.stringLengthLimit)+"..."),a;var a,o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var l={};for(var u in t){var d=t[u];l[u]=Wt(d)?Ut(d.length?d[0]:null):d}return l}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var $t={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 jt(e,t,r){var n,i=r?Object.assign({},$t,r):$t,s=i.logger;if(!s)return()=>{};n="string"==typeof s?t[s]:s;var a=0,o=!1,l=[];if(i.level.includes("error")){var u=t=>{var r=t.message,n=Bt.parse(t.error).map(e=>e.toString()),s=[zt(r,i.stringifyOptions)];e({level:"error",trace:n,payload:s})};t.addEventListener("error",u),l.push(()=>{t.removeEventListener("error",u)});var d=t=>{var r,n;t.reason instanceof Error?n=[zt("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,i.stringifyOptions)]:(r=new Error,n=[zt("Uncaught (in promise)",i.stringifyOptions),zt(t.reason,i.stringifyOptions)]);var s=Bt.parse(r).map(e=>e.toString());e({level:"error",trace:s,payload:n})};t.addEventListener("unhandledrejection",d),l.push(()=>{t.removeEventListener("unhandledrejection",d)})}for(var c of i.level)l.push(h(n,c));return()=>{l.forEach(e=>e())};function h(t,r){var n=this;return t[r]?function(t,s){try{if(!(s in t))return()=>{};var l=t[s],u=(t=>function(){for(var s=arguments.length,l=new Array(s),u=0;s>u;u++)l[u]=arguments[u];if(t.apply(n,l),!("assert"===r&&l[0]||o)){o=!0;try{var d=Bt.parse(new Error).map(e=>e.toString()).splice(1),c=("assert"===r?l.slice(1):l).map(e=>zt(e,i.stringifyOptions));a++,i.lengthThreshold>a?e({level:r,trace:d,payload:c}):a===i.lengthThreshold&&e({level:"warn",trace:[],payload:[zt("The number of log records reached the threshold.")]})}catch(h){t("rrweb logger error:",h,...l)}finally{o=!1}}})(l);return"function"==typeof u&&(u.prototype=u.prototype||{},Object.defineProperties(u,{__rrweb_original__:{enumerable:!1,value:l}})),t[s]=u,()=>{t[s]=l}}catch(d){return()=>{}}}(t,r):()=>{}}}var Gt="undefined"!=typeof window?window:void 0,Vt="undefined"!=typeof globalThis?globalThis:Gt;"undefined"==typeof self&&(Vt.self=Vt),"undefined"==typeof File&&(Vt.File=function(){});var Zt=null==Vt?void 0:Vt.document;null!=Vt&&Vt.XMLHttpRequest&&new Vt.XMLHttpRequest;var Jt=null!=Gt?Gt:{},Yt=Object.prototype,Xt=Yt.hasOwnProperty,Kt=Yt.toString,Qt=Array.isArray||function(e){return"[object Array]"===Kt.call(e)},er=e=>"function"==typeof e,tr=e=>e===Object(e)&&!Qt(e),rr=e=>void 0===e,nr=e=>"[object String]"==Kt.call(e),ir=e=>null===e,sr=e=>rr(e)||ir(e),ar=e=>"[object Number]"==Kt.call(e)&&e==e,or=e=>"[object Boolean]"===Kt.call(e),lr=e=>e instanceof FormData;function ur(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),ar(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),ur(i||r,t,r,n))}class dr{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=ur(e.bucketSize,0,100,e.qt),this.$t=ur(e.refillRate,0,this.jt,e.qt),this.Vt=ur(e.refillInterval,0,864e5,e.qt)}Ht(e,t){var r=Math.floor((t-e.lastAccess)/this.Vt);r>0&&(e.tokens=Math.min(e.tokens+r*this.$t,this.jt),e.lastAccess=e.lastAccess+r*this.Vt)}consumeRateLimit(e){var t,r=Date.now(),n=String(e),i=this.Pt[n];return i?this.Ht(i,r):this.Pt[n]=i={tokens:this.jt,lastAccess:r},0===i.tokens||(i.tokens--,0===i.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===i.tokens)}stop(){this.Pt={}}}var cr=function(e,t){var{debugEnabled:r}=void 0===t?{}:t,n={C(t){if(Gt&&(Jt.POSTHOG_DEBUG||r)&&!rr(Gt.console)&&Gt.console){for(var n=("__rrweb_original__"in Gt.console[t]?Gt.console[t].__rrweb_original__:Gt.console[t]),i=arguments.length,s=new Array(i>1?i-1:0),a=1;i>a;a++)s[a-1]=arguments[a];n(e,...s)}},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n.C("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n.C("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n.C("error",...t)},critical(){for(var t=arguments.length,r=new Array(t),n=0;t>n;n++)r[n]=arguments[n];console.error(e,...r)},uninitializedWarning(e){n.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>cr(e+" "+t,r)};return n},hr=cr("[PostHog.js]"),pr=hr.createLogger;function fr(e,t){if(!sr(e))if(Qt(e))e.forEach(t);else if(lr(e))e.forEach((e,r)=>t(e,r));else for(var r in e)Xt.call(e,r)&&t(e[r],r)}function mr(e,t,r,n){var{capture:i=!1,passive:s=!0}={};null==e||e.addEventListener(t,r,{capture:i,passive:s})}var gr=["localhost","127.0.0.1"],vr=e=>{var t=null==Zt?void 0:Zt.createElement("a");return rr(t)?null:(t.href=e,t)};function yr(e,t,r){try{if(!(t in e))return()=>{};var n=e[t],i=r(n);return er(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=n}}catch(s){return()=>{}}}function br(e,t){var r,n=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(t){return null}}(e),i={hostname:n,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==n||!n.trim().length)return i;for(var s of t.payloadHostDenyList)if(n.endsWith(s))return{hostname:n,isHostDenied:!0};return i}var Sr="$session_recording_remote_config",wr="$session_is_sampled",kr="$session_past_minimum_duration",Ir="$session_recording_url_trigger_activated_session",_r="$session_recording_event_trigger_activated_session",Cr="$posthog_sr_group_event_trigger_",Mr="$posthog_sr_group_url_trigger_",Tr="$posthog_sr_group_sampling_",Rr="$debug_first_full_snapshot_timestamp",Er="$stored_person_properties",xr=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})"),Or=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),Lr="[SessionRecording]",Nr="redacted",Dr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},Fr=["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"],Ar=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Pr=["/s/","/e/","/i/"];function Br(e,t,r,n){if(sr(e))return e;var i=(null==t?void 0:t["content-length"])||new Blob([e]).size;return nr(i)&&(i=parseInt(i)),i>r?Lr+" "+n+" body too large to record ("+i+" bytes)":e}function Ur(e,t){if(sr(e))return e;var r=e;return function(e){if(sr(e))return!1;if(nr(e)){if(e=e.trim(),xr.test((e||"").replace(/[- ]/g,"")))return!1;if(Or.test(e))return!1}return!0}(r)||(r=Lr+" "+t+" body "+Nr),fr(Ar,e=>{var n,i;null!=(n=r)&&n.length&&-1!==(null==(i=r)?void 0:i.indexOf(e))&&(r=Lr+" "+t+" body "+Nr+" as might contain: "+e)}),r}var Wr=pr("[Recorder]"),Hr=e=>"navigation"===e.entryType,qr=e=>"resource"===e.entryType;function zr(e,t){return!!t&&(or(t)||t[e])}function $r(e){var{type:t,recordBody:r,headers:n,url:i}=e;function s(e){var t=Object.keys(n).find(e=>"content-type"===e.toLowerCase()),r=t&&n[t];return e.some(e=>null==r?void 0:r.includes(e))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:t instanceof Request&&e(t.url)}catch(r){return!1}}(i))return!1;if(or(r))return!0;if(Qt(r))return s(r);var a=r[t];return or(a)?a:s(a)}function jr(e,t,r,n,i,s){return Gr.apply(this,arguments)}function Gr(){return Gr=t(function*(e,t,r,n,i,s){return void 0===s&&(s=0),s>10?(Wr.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null):function(e){for(var r=e.length-1;r>=0;r-=1)if(qr(s=e[r])&&s.initiatorType===t&&(rr(n)||s.startTime>=n)&&(rr(i)||i>=s.startTime))return e[r];var s}(e.performance.getEntriesByName(r))||(yield new Promise(e=>setTimeout(e,50*s)),jr(e,t,r,n,i,s+1))}),Gr.apply(this,arguments)}function Vr(e){var{body:t,options:r,url:n}=e;if(sr(t))return null;var{hostname:i,isHostDenied:s}=br(n,r);if(s)return i+" is in deny list";if(nr(t))return t;if((e=>e instanceof Document)(t))return t.textContent;if(lr(t))return function(e,t){var r,n;void 0===t&&(t="&");var i=[];return fr(e,function(e,t){rr(e)||rr(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),i[i.length]=n+"="+r)}),i.join(t)}(t);if(tr(t))try{return JSON.stringify(t)}catch(a){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}function Zr(e){var{entry:t,method:n,status:i,networkRequest:s,isInitial:a,start:o,end:l,url:u,initiatorType:d}=e;o=t?t.startTime:o,l=t?t.responseEnd:l;var c=Math.floor(Date.now()-performance.now()),h=Math.floor(c+(o||0)),p=[r({},t?t.toJSON():{name:u},{startTime:rr(o)?void 0:Math.round(o),endTime:rr(l)?void 0:Math.round(l),timeOrigin:c,timestamp:h,method:n,initiatorType:d||(t?t.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:a})];if((e=>!ir(e)&&("navigation"===e.entryType||"resource"===e.entryType))(t))for(var f of t.serverTiming||[])p.push({timeOrigin:c,timestamp:h,startTime:Math.round(t.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return p}var Jr=["video/","audio/"];function Yr(e){return new Promise(t=>{var r=setTimeout(()=>t("[SessionReplay] Timeout while trying to read body"),500);try{e.clone().text().then(e=>t(e),e=>t("[SessionReplay] Failed to read body: "+e)).finally(()=>clearTimeout(r))}catch(n){clearTimeout(r),t("[SessionReplay] Failed to read body")}})}function Xr(){return(Xr=t(function*(e){var{r:t,options:r,url:n}=e,{hostname:i,isHostDenied:s}=br(n,r);return s?Promise.resolve(i+" is in deny list"):Yr(t)})).apply(this,arguments)}function Kr(){return(Kr=t(function*(e){var{r:t,options:r,url:n}=e,i=function(e){var t,{r:r,options:n,url:i}=e;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),a=Jr.some(e=>null==s?void 0:s.startsWith(e));if(s&&a)return"Content-Type "+s+" is not supported";var{hostname:o,isHostDenied:l}=br(i,n);return l?o+" is in deny list":null}({r:t,options:r,url:n});return ir(i)?Yr(t):Promise.resolve(i)})).apply(this,arguments)}var Qr=null;function en(e,n,i){if(!("performance"in n))return()=>{};if(Qr)return Wr.warn("Network observer already initialised, doing nothing"),()=>{};var s=i?Object.assign({},Dr,i):Dr,a=t=>{var n=[];t.requests.forEach(e=>{var t=s.maskRequestFn(e);t&&n.push(t)}),n.length>0&&e(r({},t,{requests:n}))},o=function(e,t,r){if(r.recordInitialRequests){var n=t.performance.getEntries().filter(e=>Hr(e)||qr(e)&&r.initiatorTypes.includes(e.initiatorType));e({requests:n.flatMap(e=>Zr({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}var i=new t.PerformanceObserver(t=>{var n=t.getEntries().filter(e=>{return Hr(e)||qr(e)&&r.initiatorTypes.includes(e.initiatorType)&&(t=e,!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType);var t});e({requests:n.flatMap(e=>Zr({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(e=>r.performanceEntryTypeToObserve.includes(e));return i.observe({entryTypes:s}),()=>{i.disconnect()}}(a,n,s),l=()=>{},u=()=>{};return(s.recordHeaders||s.recordBody)&&(l=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var n=zr("request",r.recordHeaders),i=zr("response",r.recordHeaders),s=yr(t.XMLHttpRequest.prototype,"open",s=>function(a,o,l,u,d){void 0===l&&(l=!0);var c,h,p=this,f=new Request(o),m={},g={},v=p.setRequestHeader.bind(p);p.setRequestHeader=(e,t)=>(g[e]=t,v(e,t)),n&&(m.requestHeaders=g);var y=p.send.bind(p);p.send=e=>($r({type:"request",headers:g,url:o,recordBody:r.recordBody})&&(m.requestBody=Vr({body:e,options:r,url:o})),c=t.performance.now(),y(e));var b=()=>{p.removeEventListener("readystatechange",S),p.removeEventListener("error",b),p.removeEventListener("abort",b),p.removeEventListener("timeout",b)},S=()=>{if(p.readyState===p.DONE){b(),h=t.performance.now();var n={};p.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{var t=e.split(": "),r=t.shift(),i=t.join(": ");r&&(n[r]=i)}),i&&(m.responseHeaders=n),$r({type:"response",headers:n,url:o,recordBody:r.recordBody})&&(m.responseBody=Vr({body:p.response,options:r,url:o})),jr(t,"xmlhttprequest",f.url,c,h).then(t=>{var r=Zr({entry:t,method:a,status:null==p?void 0:p.status,networkRequest:m,start:c,end:h,url:o.toString(),initiatorType:"xmlhttprequest"});e({requests:r})}).catch(()=>{})}};p.addEventListener("readystatechange",S),p.addEventListener("error",b),p.addEventListener("abort",b),p.addEventListener("timeout",b),s.call(p,a,o.toString(),l,u,d)});return()=>{s()}}(a,n,s),u=function(e,r,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};var i=zr("request",n.recordHeaders),s=zr("response",n.recordHeaders),a=yr(r,"fetch",a=>{return o=t(function*(t,o){var l,u,d,c=new Request(t,o),h={};try{var p={};c.headers.forEach((e,t)=>{p[t]=e}),i&&(h.requestHeaders=p),$r({type:"request",headers:p,url:t,recordBody:n.recordBody})&&(h.requestBody=yield function(e){return Xr.apply(this,arguments)}({r:c,options:n,url:t})),u=r.performance.now(),l=yield a(c),d=r.performance.now();var f={};return l.headers.forEach((e,t)=>{f[t]=e}),s&&(h.responseHeaders=f),$r({type:"response",headers:f,url:t,recordBody:n.recordBody})&&(h.responseBody=yield function(e){return Kr.apply(this,arguments)}({r:l,options:n,url:t})),l}finally{jr(r,"fetch",c.url,u,d).then(t=>{var r,n=Zr({entry:t,method:c.method,status:null==(r=l)?void 0:r.status,networkRequest:h,start:u,end:d,url:c.url,initiatorType:"fetch"});e({requests:n})}).catch(()=>{})}}),function(e,t){return o.apply(this,arguments)};var o});return()=>{a()}}(a,n,s)),Qr=()=>{o(),l(),u(),Qr=null}}var tn=2,rn=3,nn=4,sn=5,an="disabled",on="sampled",ln="active",un="buffering",dn="paused",cn="rrweb_error",hn="trigger",pn=hn+"_activated",fn=hn+"_pending",mn=hn+"_"+an;function gn(e,t,r){return t.some(t=>{var n;return"regex"===t.matching&&(null!==(n=null==r?void 0:r.get(t.url))&&void 0!==n?n:new RegExp(t.url)).test(e)})}class vn{constructor(e){this.t=e}triggerStatus(e){var t=this.t.map(t=>t.triggerStatus(e));return t.includes(pn)?pn:t.includes(fn)?fn:mn}stop(){this.t.forEach(e=>e.stop())}}class yn{constructor(e){this.t=e}triggerStatus(e){var t=new Set;for(var r of this.t)t.add(r.triggerStatus(e));switch(t.delete(mn),t.size){case 0:return mn;case 1:return Array.from(t)[0];default:return fn}}stop(){this.t.forEach(e=>e.stop())}}class bn{triggerStatus(){return pn}stop(){}}var Sn=e=>"sessionRecording"in e;class wn{constructor(e,t){this.u=[],this.ha=[],this.ca=new Map,this.va=new Map,this.fa="",this.urlBlocked=!1,this._instance=e,this.ga=t}onConfig(e){var t,r;this.u=(Sn(e)?tr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this.ha=(Sn(e)?tr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this.ma()}ma(){for(var e of(this.ca.clear(),this.va.clear(),this.u))if("regex"===e.matching&&!this.ca.has(e.url))try{this.ca.set(e.url,new RegExp(e.url))}catch(r){hr.error("Invalid URL trigger regex pattern:",e.url,r)}for(var t of this.ha)if("regex"===t.matching&&!this.va.has(t.url))try{this.va.set(t.url,new RegExp(t.url))}catch(n){hr.error("Invalid URL blocklist regex pattern:",t.url,n)}}onRemoteConfig(e){this.onConfig(e)}pa(e){var t;return 0===this.u.length?mn:(null==(t=this._instance)?void 0:t.get_property(this.ga?Mr+this.ga:Ir))===e?pn:fn}triggerStatus(e){var t=this.pa(e),r=t===pn?pn:t===fn?fn:mn;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(e,t){if(void 0!==Gt&&Gt.location.href){var r=Gt.location.href;if(r!==this.fa){this.fa=r;var n=this.urlBlocked,i=gn(r,this.ha,this.va);n&&i||(i&&!n?e():!i&&n&&t())}}}checkUrlTriggerConditions(e,t,r,n){if(void 0!==Gt&&Gt.location.href){var i=Gt.location.href;if(i!==this.fa){this.fa=i;var s=this.urlBlocked,a=gn(i,this.ha,this.va);a&&!s?e():!a&&s&&t();var o=this.pa(n)===pn,l=gn(i,this.u,this.ca);!o&&l&&r("url",i)}}}stop(){this.fa=""}}class kn{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ia=()=>{},this._instance=e}triggerStatus(){var e=fn;return sr(this.linkedFlag)&&(e=mn),this.linkedFlagSeen&&(e=pn),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onConfig(e,t){var r;if(this.linkedFlag=(Sn(e)?tr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!sr(this.linkedFlag)&&!this.linkedFlagSeen){var n=nr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=nr(this.linkedFlag)?null:this.linkedFlag.variant;this.Ia=this._instance.onFeatureFlags((e,r)=>{var s=!1;if(tr(r)&&n in r){var a=r[n];s=or(a)?!0===a:i?a===i:!!a}this.linkedFlagSeen=s,s&&t(n,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this.Ia()}}class In{constructor(e,t){this.ya=[],this._instance=e,this.ga=t}onConfig(e){var t;this.ya=(Sn(e)?tr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}ba(e){var t;return 0===this.ya.length?mn:(null==(t=this._instance)?void 0:t.get_property(this.ga?Cr+this.ga:_r))===e?pn:fn}triggerStatus(e){var t=this.ba(e),r=t===pn?pn:t===fn?fn:mn;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(e,t,r){if(0!==this.ya.length){var n=this.ba(r)===pn,i=this.ya.includes(e);!n&&i&&t("event",e)}}stop(){}}class _n{constructor(e,t,r){if(this._instance=e,this.group=t,this.Ca=new wn(e,t.id),this.wa=new In(e,t.id),this.Sa=new kn(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var n=(t.conditions.events||[]).map(e=>e.name),i={urlTriggers:t.conditions.urls||[],eventTriggers:n,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this.Ca.onConfig(i),this.wa.onConfig(i),this.Sa.onConfig(i,r);var s=[this.wa,this.Ca,this.Sa];this.ka="any"===t.conditions.matchType?new vn(s):new yn(s)}else this.ka=new bn}triggerStatus(e){return this.ka.triggerStatus(e)}checkEventTriggerConditions(e,t,r){this.wa.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,n){this.Ca.checkUrlTriggerConditions(e,t,r,n)}activateTrigger(e,t){var r;null==(r=this._instance.persistence)||r.register({["url"===e?Mr+this.group.id:Cr+this.group.id]:t})}stop(){this.Ca.stop(),this.wa.stop(),this.Sa.stop()}}function Cn(e){if(e.rrwebError)return cn;if(!e.receivedFlags)return un;if(!e.isRecordingEnabled)return an;if(e.urlTriggerMatching.urlBlocked)return dn;var t=!0===e.isSampled,r=new vn([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?on:r===pn?ln:r===fn?un:!1===e.isSampled?an:ln}function Mn(e){if(e.rrwebError)return cn;if(!e.receivedFlags)return un;if(!e.isRecordingEnabled)return an;if(e.urlTriggerMatching.urlBlocked)return dn;var t=new yn([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==mn,n=or(e.isSampled);return r&&t===fn?un:r&&t===mn||n&&!e.isSampled?an:!0===e.isSampled?on:ln}function Tn(e){var t,r;return(null==(t=JSON.stringify(e,(r=[],function(e,t){if(tr(t)){for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(t)?"[Circular]":(r.push(t),t)}return t})))?void 0:t.length)||0}function Rn(e){if(ir(e))return 4;if(rr(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(Qt(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var n=e[r];t+=rr(n)||ir(n)?4:Rn(n)}return t}var i=e,s=2,a=!0;for(var o in i)if({}.hasOwnProperty.call(i,o)){var l=i[o];rr(l)||(a||(s+=1),a=!1,s+=o.length+3+Rn(l))}return s;default:return 0}}var En=Uint8Array,xn=Uint16Array,On=Uint32Array,Ln=new En([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]),Nn=new En([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]),Dn=new En([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fn=function(e,t){for(var r=new xn(31),n=0;31>n;++n)r[n]=t+=1<<e[n-1];var i=new On(r[30]);for(n=1;30>n;++n)for(var s=r[n];r[n+1]>s;++s)i[s]=s-r[n]<<5|n;return[r,i]},An=Fn(Ln,2),Pn=An[1];An[0][28]=258,Pn[258]=28;for(var Bn=Fn(Nn,0)[1],Un=new xn(32768),Wn=0;32768>Wn;++Wn){var Hn=(43690&Wn)>>>1|(21845&Wn)<<1;Un[Wn]=((65280&(Hn=(61680&(Hn=(52428&Hn)>>>2|(13107&Hn)<<2))>>>4|(3855&Hn)<<4))>>>8|(255&Hn)<<8)>>>1}var qn=function(e,t,r){for(var n=e.length,i=0,s=new xn(t);n>i;++i)++s[e[i]-1];var a,o=new xn(t);for(i=0;t>i;++i)o[i]=o[i-1]+s[i-1]<<1;for(a=new xn(n),i=0;n>i;++i)a[i]=Un[o[e[i]-1]++]>>>15-e[i];return a},zn=new En(288);for(Wn=0;144>Wn;++Wn)zn[Wn]=8;for(Wn=144;256>Wn;++Wn)zn[Wn]=9;for(Wn=256;280>Wn;++Wn)zn[Wn]=7;for(Wn=280;288>Wn;++Wn)zn[Wn]=8;var $n=new En(32);for(Wn=0;32>Wn;++Wn)$n[Wn]=5;var jn=qn(zn,9),Gn=qn($n,5),Vn=function(e){return(e/8|0)+(7&e&&1)},Zn=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof xn?xn:e instanceof On?On:En)(r-t);return n.set(e.subarray(t,r)),n},Jn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8},Yn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8,e[n+2]|=r>>>16},Xn=function(e,t){for(var r=[],n=0;e.length>n;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return[new En(0),0];if(1==i){var a=new En(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var o=r[0],l=r[1],u=0,d=1,c=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=i-1;)o=r[r[c].f>r[u].f?u++:c++],l=r[u!=d&&r[c].f>r[u].f?u++:c++],r[d++]={s:-1,f:o.f+l.f,l:o,r:l};var h=s[0].s;for(n=1;i>n;++n)s[n].s>h&&(h=s[n].s);var p=new xn(h+1),f=Kn(r[d-1],p,0);if(f>t){n=0;var m=0,g=f-t,v=1<<g;for(s.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});i>n;++n){var y=s[n].s;if(t>=p[y])break;m+=v-(1<<f-p[y]),p[y]=t}for(m>>>=g;m>0;){var b=s[n].s;t>p[b]?m-=1<<t-p[b]++-1:++n}for(;n>=0&&m;--n){var S=s[n].s;p[S]==t&&(--p[S],++m)}f=t}return[new En(p),f]},Kn=function(e,t,r){return-1==e.s?Math.max(Kn(e.l,t,r+1),Kn(e.r,t,r+1)):t[e.s]=r},Qn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new xn(++t),n=0,i=e[0],s=1,a=function(e){r[n++]=e},o=1;t>=o;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&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(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return[r.subarray(0,n),t]},ei=function(e,t){for(var r=0,n=0;t.length>n;++n)r+=e[n]*t[n];return r},ti=function(e,t,r){var n=r.length,i=Vn(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;n>s;++s)e[i+s+4]=r[s];return 8*(i+4+n)},ri=function(e,t,r,n,i,s,a,o,l,u,d){Jn(t,d++,r),++i[256];for(var c=Xn(i,15),h=c[0],p=c[1],f=Xn(s,15),m=f[0],g=f[1],v=Qn(h),y=v[0],b=v[1],S=Qn(m),w=S[0],k=S[1],I=new xn(19),_=0;y.length>_;++_)I[31&y[_]]++;for(_=0;w.length>_;++_)I[31&w[_]]++;for(var C=Xn(I,7),M=C[0],T=C[1],R=19;R>4&&!M[Dn[R-1]];--R);var E,x,O,L,N=u+5<<3,D=ei(i,zn)+ei(s,$n)+a,F=ei(i,h)+ei(s,m)+a+14+3*R+ei(I,M)+(2*I[16]+3*I[17]+7*I[18]);if(D>=N&&F>=N)return ti(t,d,e.subarray(l,l+u));if(Jn(t,d,1+(D>F)),d+=2,D>F){E=qn(h,p),x=h,O=qn(m,g),L=m;var A=qn(M,T);for(Jn(t,d,b-257),Jn(t,d+5,k-1),Jn(t,d+10,R-4),d+=14,_=0;R>_;++_)Jn(t,d+3*_,M[Dn[_]]);d+=3*R;for(var P=[y,w],B=0;2>B;++B){var U=P[B];for(_=0;U.length>_;++_)Jn(t,d,A[W=31&U[_]]),d+=M[W],W>15&&(Jn(t,d,U[_]>>>5&127),d+=U[_]>>>12)}}else E=jn,x=zn,O=Gn,L=$n;for(_=0;o>_;++_)if(n[_]>255){var W;Yn(t,d,E[257+(W=n[_]>>>18&31)]),d+=x[W+257],W>7&&(Jn(t,d,n[_]>>>23&31),d+=Ln[W]);var H=31&n[_];Yn(t,d,O[H]),d+=L[H],H>3&&(Yn(t,d,n[_]>>>5&8191),d+=Nn[H])}else Yn(t,d,E[n[_]]),d+=x[n[_]];return Yn(t,d,E[256]),d+x[256]},ni=new On([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ii=function(){for(var e=new On(256),t=0;256>t;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),si=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};class ai{constructor(e,t){var r,n;void 0===t&&(t={}),this.Aa={},this._a=e=>{if(!this.Aa[e]){var t,r;this.Aa[e]=!0;var n=this.Ra(e);null==(t=(r=this.Na).onBlockedNode)||t.call(r,e,n)}},this.Ta=e=>{var t=this.Ra(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this.Ra=e=>this._rrweb.mirror.getNode(e),this.Ma=e=>{var t,r,n,i,s,a,o,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(n=null==(i=e.attributes)?void 0:i.length)&&void 0!==n?n:0)+(null!==(s=null==(a=e.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(l=e.adds)?void 0:l.length)&&void 0!==o?o:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this.Ma(t);t.attributes&&(t.attributes=t.attributes.filter(e=>{var[t]=this.Ta(e.id);return!this.io.consumeRateLimit(t)&&e}));var n=this.Ma(t);return 0!==n||r===n?e:void 0},this._rrweb=e,this.Na=t,this.io=new dr({bucketSize:null!==(r=this.Na.bucketSize)&&void 0!==r?r:100,refillRate:null!==(n=this.Na.refillRate)&&void 0!==n?n:10,refillInterval:1e3,Dt:this._a,qt:hr})}reset(){this.Aa={}}stop(){this.io.stop(),this.reset()}}var oi="$sess_rec_flush_size";class li{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Fa=e.get_property.bind(e),this.xa=e.persistence.set_property.bind(e.persistence)}trackSize(e){var t=Number(this.Fa(oi))||0;this.xa(oi,t+e)}reset(){return this.xa(oi,0)}get currentTrackedSize(){return Number(this.Fa(oi))||0}}function ui(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<ur(100*t,0,100,hr)}var di=function(e,t){if(!function(e){try{new RegExp(e)}catch(t){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(r){return!1}},ci={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>di(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!di(t,e))),icontains:(e,t)=>t.map(hi).some(t=>e.map(hi).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(hi).every(t=>e.map(hi).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})},hi=e=>e.toLowerCase(),pi=new Set(["is_not","not_icontains","not_regex"]);function fi(e,t,r){return!e||0===e.length||e.every(e=>{var n="person"===e.type?r:t,i=null==n?void 0:n[e.key],s=e.operator||"exact";if(rr(i)||ir(i))return pi.has(s);var a=ci[s];return!!a&&!rr(e.value)&&!ir(e.value)&&a(Qt(e.value)?e.value.map(String):[String(e.value)],Qt(i)?i.map(String):[String(i)])})}var mi=pr("[SessionRecording]");class gi{constructor(e,t,r,n,i,s){this.Ba=null,this.Oa=Mn,this._instance=e,this.Ca=t,this.wa=r,this.Sa=n,this.Za=i,this.Ya=s}onRemoteConfig(e){this.Ba=ar(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this.Ea=new vn([this.wa,this.Ca]),this.Oa=Cn):(this.Ea=new yn([this.wa,this.Ca]),this.Oa=Mn),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:e.triggerMatchType}),this.Ca.onConfig(e),this.wa.onConfig(e),this.Sa.onConfig(e,(e,t)=>{this.Za("linked_flag_matched",{flag:e,variant:t})})}getStatus(e){return this.Oa({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t=this._instance.get_property("$session_recording_remote_config"),r=null==t?void 0:t.minimumDurationMilliseconds;return ar(r)?r:null}checkUrlTriggers(e,t,r,n){this.Ca.checkUrlTriggerConditions(t,r,n,e)}setupEventTriggerListeners(e,t,r){if(0!==this.wa.ya.length&&sr(this.Ga))return this.Ga=e(e=>{try{this.wa.checkEventTriggerConditions(e.event,r,t)}catch(n){mi.error("Could not activate event trigger",n)}}),this.Ga}makeSamplingDecisions(e){var t,r=this.Ba;if(ar(r)){var n=this._instance.get_property(wr),i=n===e||!1!==n&&null,s="string"==typeof n&&n!==e||!or(i),a=s?ui(e,r):i;s&&(a?this.Za("sampled"):mi.warn("Sample rate ("+r+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[wr]:!!a&&e})}else{var o;null==(o=this._instance.persistence)||o.unregister(wr)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,n;null==(e=this._instance.persistence)||e.unregister(_r),null==(t=this._instance.persistence)||t.unregister(Ir),null==(r=this._instance.persistence)||r.unregister(wr),null==(n=this._instance.persistence)||n.unregister(kr)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this.Ea)?void 0:t.triggerStatus(e))===fn}stop(){var e;null==(e=this.Ga)||e.call(this),this.Ga=void 0,this.wa.stop(),this.Ca.stop(),this.Sa.stop()}}class vi{constructor(e,t,r,n){this.La=[],this.Da=new Map,this.Wa=!1,this._instance=e,this.Ca=t,this.Za=r,this.Va=n}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this.Xa(e.triggerGroups),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:e.triggerGroups.length}),this.Ca.onConfig(e)):mi.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return cn;if(e.urlTriggerMatching.urlBlocked)return dn;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return an;var n=!1,i=!1;for(var s of t){var a=s.triggerStatus(e.sessionId);if(a===pn){var o=s.group.id,l=r.get(o);rr(l)?hr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===l&&(i=!0)}else a===fn&&(n=!0)}return i?on:n?un:an}({isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this.La,triggerGroupSamplingResults:this.Da,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this.La)if("trigger_activated"===r.triggerStatus(e)){var n=r.group.minDurationMs;ar(n)&&(ir(t)||t>n)&&(t=n)}return t}checkUrlTriggers(e,t,r,n){var i=this;this.Ca.checkUrlBlocklist(t,r);var s=function(n){n.checkUrlTriggerConditions(t,r,t=>{i.za(n,void 0)&&(n.activateTrigger(t,e),i.updateActiveTriggers(e))},e)};for(var a of this.La)s(a)}setupEventTriggerListeners(e,t,r){var n=this;return this.Ga=e(e=>{var r;if(this.Wa)return mi.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Ga)||r.call(this),void(this.Ga=void 0);try{var i=function(r){r.checkEventTriggerConditions(e.event,i=>{if(n.za(r,e.properties)){var s=(r.group.conditions.events||[]).filter(t=>t.name===e.event),a=n._instance.get_property(Er);s.some(t=>!t.properties||0===t.properties.length||fi(t.properties,e.properties,a))&&(r.activateTrigger(i,t),n.updateActiveTriggers(t))}},t)};for(var s of this.La)i(s)}catch(a){mi.error("Could not activate event trigger for trigger groups",a)}}),this.Ga}makeSamplingDecisions(e){for(var t of this.La){var r,n=t.group,i=n.id,s=n.sampleRate,a=Tr+i,o=this._instance.get_property(a),l=o===e||!1!==o&&null,u="string"==typeof o&&o!==e||!or(l),d=u?ui(e+i,s):l;u&&this.Va("triggerGroupSamplingDecisionMade",{group_id:i,group_name:n.name,sampleRate:s,isSampled:d}),this.Da.set(i,d),null==(r=this._instance.persistence)||r.register({[a]:!!d&&e})}this.updateActiveTriggers(e)}onFlushComplete(){this.Wa=!0}clearConditionalRecordingPersistence(){var e,t;for(var r of(null==(e=this._instance.persistence)||e.unregister(wr),null==(t=this._instance.persistence)||t.unregister(kr),this.La)){var n,i,s,a=r.group.id;null==(n=this._instance.persistence)||n.unregister(Cr+a),null==(i=this._instance.persistence)||i.unregister(Mr+a),null==(s=this._instance.persistence)||s.unregister(Tr+a)}}updateActiveTriggers(e){var t=[];for(var r of this.La){var n=r.group,i=n.id,s="trigger_activated"===r.triggerStatus(e),a=!0===this.Da.get(i);s&&t.push({id:i,name:n.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:t})}hasPendingTriggers(e){for(var t of this.La)if(t.triggerStatus(e)===fn)return!0;return!1}stop(){var e;null==(e=this.Ga)||e.call(this),this.Ga=void 0,this.La.forEach(e=>e.stop()),this.La=[],this.Da.clear(),this.Ca.stop()}za(e,t){var r=e.group.conditions.properties;return!r||0===r.length||fi(r,t,this._instance.get_property(Er))}Xa(e){var t=this;this.La.forEach(e=>e.stop()),this.La=[],this.Da.clear();var r=function(e){var r=new _n(t._instance,e,(r,n)=>{t.Za("linked_flag_matched",{flag:r,variant:n,group_id:e.id,group_name:e.name})});t.La.push(r)};for(var n of e)r(n)}}function yi(e){return tr(e)?e.network_timing:e}var bi,Si="[SessionRecording]",wi=pr(Si),ki=[1,2,3,4,5,6,7,12],Ii=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function _i(){var e;return null==Jt||null==(e=Jt.__PosthogExtensions__)?void 0:e.rrweb}function Ci(){var e;return null==(e=_i())?void 0:e.record}function Mi(e){return function(e){for(var t="",r=0;e.length>r;){var n=e[r++];t+=String.fromCharCode(n)}return t}(function(e,t){void 0===t&&(t={});var r=function(){var e=4294967295;return{p(t){for(var r=e,n=0;t.length>n;++n)r=ii[255&r^t[n]]^r>>>8;e=r},d:()=>4294967295^e}}(),n=e.length;r.p(e);var i=function(e,t,r,n){return function(e,t,r,n,i){var s=e.length,a=new En(n+s+5*(1+Math.floor(s/7e3))+i),o=a.subarray(n,a.length-i),l=0;if(!t||8>s)for(var u=0;s>=u;u+=65535){var d=u+65535;s>d?l=ti(o,l,e.subarray(u,d)):(o[u]=!0,l=ti(o,l,e.subarray(u,s)))}else{for(var c=ni[t-1],h=c>>>13,p=8191&c,f=(1<<r)-1,m=new xn(32768),g=new xn(f+1),v=Math.ceil(r/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&f},S=new On(25e3),w=new xn(288),k=new xn(32),I=0,_=0,C=(u=0,0),M=0,T=0;s>u;++u){var R=b(u),E=32767&u,x=g[R];if(m[E]=x,g[R]=E,u>=M){var O=s-u;if((I>7e3||C>24576)&&O>423){l=ri(e,o,0,S,w,k,_,C,T,u-T,l),C=I=_=0,T=u;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var N=2,D=0,F=p,A=E-x&32767;if(O>2&&R==b(u-A))for(var P=Math.min(h,O)-1,B=Math.min(32767,u),U=Math.min(258,O);B>=A&&--F&&E!=x;){if(e[u+N]==e[u+N-A]){for(var W=0;U>W&&e[u+W]==e[u+W-A];++W);if(W>N){if(N=W,D=A,W>P)break;var H=Math.min(A,W-2),q=0;for(L=0;H>L;++L){var z=u-A+L+32768&32767,$=z-m[z]+32768&32767;$>q&&(q=$,x=z)}}}A+=(E=x)-(x=m[E])+32768&32767}if(D){S[C++]=268435456|Pn[N]<<18|Bn[D];var j=31&Pn[N],G=31&Bn[D];_+=Ln[j]+Nn[G],++w[257+j],++k[G],M=u+N,++I}else S[C++]=e[u],++w[e[u]]}}l=ri(e,o,!0,S,w,k,_,C,T,u-T,l)}return Zn(a,0,n+Vn(l)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n)}(e,t,function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),8),s=i.length;return function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&si(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;r.length>=n;++n)e[n+10]=r.charCodeAt(n)}}(i,t),si(i,s-8,r.d()),si(i,s-4,n),i}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new En(e.length+(e.length>>>1)),n=0,i=function(e){r[n++]=e},s=0;t>s;++s){if(n+5>r.length){var a=new En(n+8+(t-s<<1));a.set(r),r=a}var o=e.charCodeAt(s);128>o?i(o):2048>o?(i(192|o>>>6),i(128|63&o)):o>55295&&57344>o?(i(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++s))>>>18),i(128|o>>>12&63),i(128|o>>>6&63),i(128|63&o)):(i(224|o>>>12),i(128|o>>>6&63),i(128|63&o))}return Zn(r,0,n)}(JSON.stringify(e))))}function Ti(e){return Qt(e)&&0===e.length?bi=null!=bi?bi:Mi([]):Mi(e)}function Ri(e,t){return e.type===sn&&e.data.tag===t}function Ei(e){return Ri(e,"sessionIdle")}function xi(e){return Ri(e,"$session_ending")}function Oi(e){return Ri(e,"$session_starting")}function Li(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),n=e.sizes.slice(0,r),i=e.sizes.slice(r);return[Li({size:n.reduce((e,t)=>e+t,0),data:e.data.slice(0,r),sizes:n,sessionId:e.sessionId,windowId:e.windowId}),Li({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(r),sizes:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}class Ni{get sessionId(){return this.nr}get Ja(){if(!this._instance.sessionManager)throw new Error(Si+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Ka(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Ha(){var e=this._instance.get_property(wr);return!0===e?null:!1!==e&&(nr(e)?e===this.sessionId:null)}get Ba(){var e,t=null==(e=this.Do)?void 0:e.sampleRate;return ar(t)?t:null}get ja(){var e,t;return null!==(e=null==(t=this.Ua)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e){this.Pa="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.qa=void 0,this.Qa=Date.now(),this.$a=!1,this.tu=[],this.eu="unknown",this.ru=!1,this.iu=!1,this.nu=[],this.su=void 0,this.Ga=void 0,this.ou=void 0,this.au=void 0,this.lu=void 0,this.uu=void 0,this.Yi=(e,t,r)=>{var n,i;if(r&&(e!==this.nr||t!==this.rr)){var s,a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this.nr,u=this.rr;o&&this.Va("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this.Qa,flushed_size:null==(s=this.hu)?void 0:s.currentTrackedSize}),this.hu&&this.hu.reset(),null==(n=this._instance.persistence)||n.unregister(Rr),this.iu=!1,null==(i=_i())||null==i.resetMaxDepthState||i.resetMaxDepthState(),this.Va("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this.du(),!0===this.eu&&(this.eu="unknown",this.stop(),this.start("session_id_changed")),o&&this.Va("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this.Qa}),ar(this.Ba)&&sr(this.lu)&&(null==(a=this.Ua)||a.makeSamplingDecisions(e))}},this.cu=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[kr])===this.nr},this.vu=()=>{var e,t;if(0===this.T.data.length)return null;var r=null==(e=this.T.data[0])?void 0:e.timestamp,n=null==(t=this.T.data[this.T.data.length-1])?void 0:t.timestamp;return ar(r)&&ar(n)?n-r:null},this.fu=()=>{var e,t,r=this.ja;if(!ar(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var n=this.gu;return ar(n)&&n>=0&&r>n}if(this.cu())return!1;var i,s=this.vu();return!!ir(s)||r>s||(null==(i=this._instance.persistence)||i.register({[kr]:this.nr}),!1)},this.mu=()=>{this.status!==un?this.pu():this.Iu()},this.yu=()=>{this.Va("browser offline",{})},this.bu=()=>{this.Va("browser online",{})},this.Tt=()=>{null!=Zt&&Zt.visibilityState&&this.Va("window "+Zt.visibilityState,{})},this._instance=e;var{sessionId:t,windowId:r}=this.Ja.checkAndGetSessionAndWindowId();this.nr=t,this.rr=r,this.Sa=new kn(this._instance),this.Ca=new wn(this._instance),this.wa=new In(this._instance),this.T=this.Iu(),this.Ja.sessionTimeoutMs>this.Ka||wi.warn("session_idle_threshold_ms ("+this.Ka+") is greater than the session timeout ("+this.Ja.sessionTimeoutMs+"). Session will never be detected as idle"),this.hu=new li(this._instance)}get Cu(){var e,t,r,n,i,s,a,o=null==(e=this.Do)?void 0:e.masking,l={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(n=this._instance.config.session_recording)?void 0:n.blockSelector},u=null!==(i=null==l?void 0:l.maskAllInputs)&&void 0!==i?i:null==o?void 0:o.maskAllInputs,d=null!==(s=null==l?void 0:l.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,c=null!==(a=null==l?void 0:l.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return rr(u)&&rr(d)&&rr(c)?void 0:{maskAllInputs:null==u||u,maskTextSelector:d,blockSelector:c}}get wu(){var e,t,r,n,i,s,a,o=this._instance.config.session_recording.captureCanvas,l=null==(e=this.Do)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,d=null!==(n=null!==(i=null==o?void 0:o.canvasFps)&&void 0!==i?i:null==l?void 0:l.fps)&&void 0!==n?n:4,c=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof c){var h=parseFloat(c);c=isNaN(h)?.4:h}return{enabled:u,fps:ur(d,0,12,pr("canvas recording fps"),4),quality:ur(c,0,1,pr("canvas recording quality"),.4)}}get Su(){var e,t=!(null==(e=this.Do)||!e.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:t}get ku(){var e,t,r,n=null==(e=this.Do)?void 0:e.networkPayloadCapture,i={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==i?void 0:i.recordHeaders)||(null==n?void 0:n.recordHeaders),a=(null==i?void 0:i.recordBody)||(null==n?void 0:n.recordBody),o=yi(this._instance.config.capture_performance),l=yi(null==n?void 0:n.capturePerformance),u=!!(or(o)?o:l);return s||a||u?{recordHeaders:s,recordBody:a,recordPerformance:u}:void 0}Au(){var e,t,n=[],i=null==(e=Jt.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;i&&this.Su&&n.push(i());var s,a,o,l,u,d,c,h,p,f,m,g=null==(t=Jt.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;return this.ku&&er(g)&&(!gr.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(g((u={payloadSizeLimitBytes:Dr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Dr.performanceEntryTypeToObserve],payloadHostDenyList:[...(a=this.ku).payloadHostDenyList||[],...Dr.payloadHostDenyList]},d=!1!==(s=this._instance.config).session_recording.recordHeaders&&a.recordHeaders,c=!1!==s.session_recording.recordBody&&a.recordBody,h=!1!==s.capture_performance&&a.recordPerformance,l=Math.min(1e6,null!==(o=u.payloadSizeLimitBytes)&&void 0!==o?o:1e6),p=e=>(null!=e&&e.requestBody&&(e.requestBody=Br(e.requestBody,e.requestHeaders,l,"Request")),null!=e&&e.responseBody&&(e.responseBody=Br(e.responseBody,e.responseHeaders,l,"Response")),e),f=e=>{return p(((e,t)=>{var r,n=vr(e.name),i=0===t.indexOf("http")?null==(r=vr(t))?void 0:r.pathname:t;"/"===i&&(i="");var s=null==n?void 0:n.pathname.replace(i||"","");if(!(n&&s&&Pr.some(e=>0===s.indexOf(e))))return e})((sr(r=(t=e).requestHeaders)||fr(Object.keys(null!=r?r:{}),e=>{Fr.includes(e.toLowerCase())&&(r[e]=Nr)}),t),s.api_host));var t,r},(m=er(s.session_recording.maskNetworkRequestFn))&&er(s.session_recording.maskCapturedNetworkRequestFn)&&hr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),m&&(s.session_recording.maskCapturedNetworkRequestFn=e=>{var t=s.session_recording.maskNetworkRequestFn({url:e.name});return r({},e,{name:null==t?void 0:t.url})}),u.maskRequestFn=er(s.session_recording.maskCapturedNetworkRequestFn)?e=>{var t,r=f(e);return r&&null!==(t=null==s.session_recording.maskCapturedNetworkRequestFn?void 0:s.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==t?t:void 0}:e=>function(e){if(!rr(e))return e.requestBody=Ur(e.requestBody,"Request"),e.responseBody=Ur(e.responseBody,"Response"),e}(f(e)),r({},Dr,u,{recordHeaders:d,recordBody:c,recordPerformance:h,recordInitialRequests:h})))):wi.info("NetworkCapture not started because we are on localhost.")),n}_u(e){var t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var r,n=t.maskCapturedNetworkRequestFn({name:e});return null!==(r=null==n?void 0:n.name)&&void 0!==r?r:null==n?void 0:n.url}if(t.maskNetworkRequestFn){var i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return e}Ru(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this.tu.length?this.tu.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):wi.warn("could not emit queued rrweb event.",t,e),!1}}Va(e,t){return this.Ru(Ii(()=>Ci().addCustomEvent(e,t)))}Nu(){try{if(this._instance.config.capture_pageview||!Gt)return;var e=new URL(Gt.location.href),t=this._u(e.origin+e.pathname+e.search);this.Tu!==t&&(this.Tu=t,this.Va("$url_changed",{href:t}))}catch(r){}}Mu(){if(this.tu.length){var e=[...this.tu];this.tu=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this.Ru(e)})}}Ya(){return this.Ru(Ii(()=>Ci().takeFullSnapshot()))}get Fu(){var e,t,r;return null!=(e=this.Ua)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)?6e4:null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}xu(){if(this.Bu&&clearInterval(this.Bu),!0!==this.eu){var e=this.Fu;e&&(this.Bu=setInterval(()=>{this.Ya()},e))}}Ou(){this.Ca.urlBlocked||(this.Ca.urlBlocked=!0,clearInterval(this.Bu),wi.info("recording paused due to URL blocker"),this.Va("recording paused",{reason:"url blocker"}))}Zu(){this.Ca.urlBlocked&&(this.Ca.urlBlocked=!1,this.Ya(),this.xu(),this.Va("recording resumed",{reason:"left blocked url"}),wi.info("recording resumed"))}Yu(e,t){var r;if(!this.$a&&null!=(r=this.Ua)&&r.hasPendingTriggers(this.sessionId)){this.$a=!0;try{var n,i;null==(n=this._instance.persistence)||n.register({["url"===e?Ir:_r]:this.sessionId}),null==(i=this.Ua)||i.updateActiveTriggers(this.sessionId),this.pu(),this.Za(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this.$a=!1}}}get isStarted(){return!!this.qa}get Do(){var e=this._instance.get_property(Sr);if(e){var t=tr(e)?e:JSON.parse(e);if(!this.isStarted){var r,n,i=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-i>36e5)return wi.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:e}),void(null==(n=this._instance.persistence)||n.unregister(Sr))}return t}}Eu(e,t){var r;this._instance.get_property(e)&&(t(),null==(r=this._instance.persistence)||r.unregister(e))}start(e){var t,r,n=this.Do;if(n){var{sessionId:i,windowId:s}=this.Ja.checkAndGetSessionAndWindowId();this.nr=i,this.rr=s,null==(t=this._instance.persistence)||t.unregister(Rr),null!=n&&n.endpoint&&(this.Pa=null==n?void 0:n.endpoint),this.Ua=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new vi(this._instance,this.Ca,this.Za.bind(this),this.Va.bind(this)):new gi(this._instance,this.Ca,this.wa,this.Sa,this.Za.bind(this),this.Ya.bind(this)),this.Ua.onRemoteConfig(n),null==(r=this.Ga)||r.call(this),this.Ga=this.Ua.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this.Yu(e,t)),this.Eu("$replay_override_sampling",()=>{this.overrideSampling()}),this.Eu("$replay_override_linked_flag",()=>{this.overrideLinkedFlag()}),this.Eu("$replay_override_event_trigger",()=>{this.overrideTrigger("event")}),this.Eu("$replay_override_url_trigger",()=>{this.overrideTrigger("url")}),this.Ua.makeSamplingDecisions(this.sessionId),this.Gu(),this.ru||(mr(Gt,"beforeunload",this.mu),mr(Gt,"offline",this.yu),mr(Gt,"online",this.bu),mr(Gt,"visibilitychange",this.Tt),this.ou||(this.ou=this.Ja.onSessionId(this.Yi)),this.au||(this.au=this.Ja.on("forcedIdleReset",()=>{this.du(),this.eu="unknown",this.stop(),this.uu=this.Ja.onSessionId((e,t,r)=>{var n;null==(n=this.uu)||n.call(this),this.uu=void 0,this.Yi(e,t,r)})})),sr(this.su)&&(this.su=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._u(null==e?void 0:e.properties.$current_url):"";if(!t)return;this.Va("$pageview",{href:t})}}catch(r){wi.error("Could not add $pageview to rrweb session",r)}})),this.status===ln&&this.Za(e||"recording_initialized"))}else wi.info("remote config must be stored in persistence before recording can start")}Lu(){var e,t,r,n,i,s,a,o,l;null==Gt||Gt.removeEventListener("beforeunload",this.mu),null==Gt||Gt.removeEventListener("offline",this.yu),null==Gt||Gt.removeEventListener("online",this.bu),null==Gt||Gt.removeEventListener("visibilitychange",this.Tt),clearInterval(this.Bu),this.Du(),null==(e=this.su)||e.call(this),this.su=void 0,null==(t=this.Ga)||t.call(this),this.Ga=void 0,null==(r=this.ou)||r.call(this),this.ou=void 0,null==(n=this.au)||n.call(this),this.au=void 0,null==(i=this.lu)||i.call(this),this.lu=void 0,null==(s=this.uu)||s.call(this),this.uu=void 0,null==(a=this.Ua)||a.stop(),null==(o=this.Wu)||o.stop(),this.tu=[],null==(l=this.qa)||l.call(this),this.qa=void 0}stop(){this.pu(),this.Iu(),this.Lu(),wi.info("stopped")}discard(){this.Iu(),this.Lu(),wi.info("discarded")}onRRwebEmit(e){var t,n,i,s,a,o,l,u,d;if(this.Mu(),e&&tr(e)){if(e.type===nn){var c=this._u(e.data.href);if(this.Tu=c,!c)return;e.data.href=c}else this.Nu();if(null==(t=this.Ua)||t.checkUrlTriggers(this.sessionId,()=>this.Ou(),()=>this.Zu(),(e,t)=>this.Yu(e,t)),!this.Ca.urlBlocked||(h=e).type===sn&&"recording paused"===h.data.tag){var h,p,f;e.type===tn&&(this.xu(),null==(p=this.Wu)||p.reset(),null==(f=this._instance.persistence)||f.register_once({[Rr]:e.timestamp},void 0)),e.type===tn&&null!=(n=this.Ua)&&n.hasPendingTriggers(this.sessionId)&&this.Vu();var m=this.Wu?this.Wu.throttleMutations(e):e;if(m){var g=function(e){var t=e;if(t&&tr(t)&&6===t.type&&tr(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var r=[],n=0;t.data.payload.payload.length>n;n++)r.push(t.data.payload.payload[n]&&t.data.payload.payload[n].length>2e3?t.data.payload.payload[n].slice(0,2e3)+"...[truncated]":t.data.payload.payload[n]);return t.data.payload.payload=r,e}return e}(m),v=xi(d=g)?d.data.payload:null,y=function(e){return Oi(e)?e.data.payload:null}(g);if(v||y){var b=null!=v?v:y;null!=b&&b.lastActivityTimestamp&&(g.timestamp=b.lastActivityTimestamp)}else this.Xu(g);e.type===tn&&(this.nu.push([this.nr,e.timestamp]),this.nu.length>6&&(this.nu=this.nu.slice(-6)));var S=null!==(i=null!==(s=null==v?void 0:v.currentSessionId)&&void 0!==s?s:null==y?void 0:y.nextSessionId)&&void 0!==i?i:this.nr,w=null!==(a=null!==(o=null==v?void 0:v.currentWindowId)&&void 0!==o?o:null==y?void 0:y.nextWindowId)&&void 0!==a?a:this.rr;if(!0!==this.eu||function(e){return Ei(e)||xi(e)||Oi(e)}(g)){if(Ei(g)){var k=g.data.payload;k&&(g.timestamp=k.lastActivityTimestamp+k.threshold)}var{event:I,size:_}=null===(l=this._instance.config.session_recording.compress_events)||void 0===l||l?function(e){try{if(e.type===tn){var t=r({},e,{data:Mi(e.data),cv:"2024-10"});return{event:t,size:Rn(t)}}if(e.type===rn&&0===e.data.source){var n=r({},e,{cv:"2024-10",data:r({},e.data,{texts:Ti(e.data.texts),attributes:Ti(e.data.attributes),removes:Ti(e.data.removes),adds:Ti(e.data.adds)})});return{event:n,size:Rn(n)}}if(e.type===rn&&8===e.data.source){var i=r({},e,{cv:"2024-10",data:r({},e.data,{adds:e.data.adds?Mi(e.data.adds):void 0,removes:e.data.removes?Mi(e.data.removes):void 0})});return{event:i,size:Rn(i)}}}catch(s){wi.error("could not compress event - will use uncompressed event",s)}return{event:e,size:Tn(e)}}(g):{event:g,size:Tn(g)},C={$snapshot_bytes:_,$snapshot_data:I,$session_id:S,$window_id:w};g.type===tn&&null!=(u=_i())&&null!=u.wasMaxDepthReached&&u.wasMaxDepthReached()&&(this.iu=!0),this.status!==an?this.zu(C):this.Iu()}}}}}get status(){return this.Ua?this.Ua.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Ha,rrwebError:this.ru,urlTriggerMatching:this.Ca,eventTriggerMatching:this.wa,linkedFlagMatching:this.Sa,remoteConfig:this.Do}):an}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.Sa.linkedFlagSeen=!0,this.Ya(),this.Za("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[wr]:this.sessionId}),this.Ya(),this.Za("sampling_overridden")}overrideTrigger(e){this.Yu(e)}Du(){this.Ju&&(clearTimeout(this.Ju),this.Ju=void 0)}pu(){this.Du();var e,t=this.fu();return this.status===un||this.status===dn||this.status===an||t?(this.Ju=setTimeout(()=>{this.pu()},2e3),this.T):(this.T.data.length>0&&(Li(this.T).forEach(e=>{var t;null==(t=this.hu)||t.trackSize(e.size),this.Ku({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:"web",$lib_version:"1.369.0"})}),null==(e=this.Ua)||e.onFlushComplete()),this.Iu())}zu(e){var t,r=2+((null==(t=this.T)?void 0:t.data.length)||0),n=e.$session_id;this.eu||943718.4>=this.T.size+e.$snapshot_bytes+r&&this.T.sessionId===n||(this.T=this.pu(),this.T.sessionId=n,this.T.windowId=e.$window_id),this.T.size+=e.$snapshot_bytes,this.T.data.push(e.$snapshot_data),this.T.sizes.push(e.$snapshot_bytes),this.Ju||this.eu||(this.Ju=setTimeout(()=>{this.pu()},2e3))}Ku(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.Pa),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get gu(){var e,t,r=null==(e=this.T)?void 0:e.data[(null==(t=this.T)?void 0:t.data.length)-1],{sessionStartTimestamp:n}=this.Ja.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-n:null}Vu(){if(!this.T||0===this.T.data.length)return this.Iu();for(var e=-1,t=this.T.data.length-1;t>=0;t--)if(this.T.data[t].type===nn){e=t;break}return 0>e?this.Iu():(this.T.data=this.T.data.slice(e),this.T.sizes=this.T.sizes.slice(e),this.T.size=this.T.sizes.reduce((e,t)=>e+t,0),this.T)}Iu(){return this.T={size:0,data:[],sizes:[],sessionId:this.nr,windowId:this.rr},this.T}Za(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),wi.info(e.replace("_"," "),t),"session_id_changed"!==e&&this.Va("$recording_started",r({reason:e},t))}Hu(e){var t;return 3===e.type&&-1!==ki.indexOf(null==(t=e.data)?void 0:t.source)}Xu(e){var t=this.Hu(e);t||this.eu||e.timestamp-this.Qa>this.Ka&&(this.eu=!0,clearInterval(this.Bu),this.Va("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.Qa,threshold:this.Ka,bufferLength:this.T.data.length,bufferSize:this.T.size}),this.pu());var r=!1;if(t&&(this.Qa=e.timestamp,this.eu)){var n="unknown"===this.eu;this.eu=!1,n||(this.Va("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!this.eu){var{windowId:i,sessionId:s}=this.Ja.checkAndGetSessionAndWindowId(!t,e.timestamp),a=this.nr!==s,o=this.rr!==i;this.rr=i,this.nr=s,a||o?(this.stop(),this.start("session_id_changed")):r&&this.xu()}}du(){var e;null==(e=this.Ua)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,{sessionStartTimestamp:t}=this.Ja.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.T.data.length,$sdk_debug_replay_internal_buffer_size:this.T.size,$sdk_debug_current_session_duration:this.gu,$sdk_debug_session_start:t,$sdk_debug_replay_flushed_size:null==(e=this.hu)?void 0:e.currentTrackedSize,$sdk_debug_replay_full_snapshots:this.nu,$snapshot_max_depth_exceeded:this.iu,$sdk_debug_replay_rrweb_error:this.ru}}Gu(){var e;if(!this.qa){var t,n,i,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this._instance.config.session_recording;for(var[o,l]of Object.entries(a||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=r({password:!0},l):s[o]=l);this.wu&&this.wu.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.wu.fps},s.dataURLOptions={type:"image/webp",quality:this.wu.quality}),this.Cu&&(s.maskAllInputs=null===(t=this.Cu.maskAllInputs)||void 0===t||t,s.maskTextSelector=null!==(n=this.Cu.maskTextSelector)&&void 0!==n?n:void 0,s.blockSelector=null!==(i=this.Cu.blockSelector)&&void 0!==i?i:void 0);var u=Ci();if(u){this.Wu=null!==(e=this.Wu)&&void 0!==e?e:new ai(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";wi.info(r,{node:t}),this.log(Si+" "+r,"warn")}});var d=this.Au();if(this.qa=u(r({emit:e=>{this.onRRwebEmit(e)},plugins:d},s)),!this.qa)return this.ru=!0,void wi.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ru=!1,this.Qa=Date.now(),this.eu=or(this.eu)?this.eu:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Do),this.Va("$session_options",{sessionRecordingOptions:s,activePlugins:d.map(e=>null==e?void 0:e.name)}),this.Va("$posthog_config",{config:this._instance.config})}else wi.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this.Va(e,t)}}Jt.__PosthogExtensions__=Jt.__PosthogExtensions__||{},Jt.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:e=>({name:"rrweb/console@1",observer:jt,options:e}),getRecordNetworkPlugin:e=>({name:"rrweb/network@1",observer:en,options:e})},Jt.__PosthogExtensions__.rrweb={record:Ot,version:"v2",wasMaxDepthReached:()=>pe,resetMaxDepthState(){pe=!1,he=!1}},Jt.__PosthogExtensions__.initSessionRecording=e=>new Ni(e)}();
2
- //# sourceMappingURL=posthog-recorder-AYS1fM5l.js.map
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"3.6.0"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e06f55b6-f7d4-42cf-a9cd-0e5606fd8e60",e._sentryDebugIdIdentifier="sentry-dbid-e06f55b6-f7d4-42cf-a9cd-0e5606fd8e60")}catch(r){}}(),function(){function e(e,t,r,n,i,s,a){try{var o=e[s](a),l=o.value}catch(u){return void r(u)}o.done?t(l):Promise.resolve(l).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,s){var a=t.apply(r,n);function o(t){e(a,i,s,o,l,"next",t)}function l(t){e(a,i,s,o,l,"throw",t)}o(void 0)})}}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(null,arguments)}var n,i,s=["type"],a=Object.defineProperty,o=(e,t,r)=>{return s=r,(i="symbol"!=typeof t?t+"":t)in(n=e)?a(n,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[i]=s;var n,i,s},l=((i=l||{})[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i),u=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(u||{}),d=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(d||{}),c=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(c||{}),h=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(h||{}),p=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(p||{}),f=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(f||{}),m={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},g={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},v={};function y(e){if(v[e])return v[e];var t,r,n,i,s=(t=e,((i=null==(n=null==(r=null==globalThis?void 0:globalThis.Zone)?void 0:r.__symbol__)?void 0:n.call(r,t))&&globalThis[i]?globalThis[i]:void 0)||globalThis[e]),a=s.prototype,o=e in m?m[e]:void 0,l=Boolean(o&&o.every(e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(a,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))})),u=e in g?g[e]:void 0,d=Boolean(u&&u.every(e=>{var t;return"function"==typeof a[e]&&(null==(t=a[e])?void 0:t.toString().includes("[native code]"))}));if(l&&d)return v[e]=s.prototype,s.prototype;var c=document.createElement("iframe");try{document.body.appendChild(c);var h=c.contentWindow;if(!h)return s.prototype;var p=h[e].prototype;return p?v[e]=p:a}catch(t){return a}finally{c.parentNode&&document.body.removeChild(c)}}var b={};function S(e,t,r){var n,i=e+"."+String(r);if(b[i])return b[i].call(t);var s=y(e),a=null==(n=Object.getOwnPropertyDescriptor(s,r))?void 0:n.get;return a?(b[i]=a,a.call(t)):t[r]}var w={};function k(e,t,r){var n=e+"."+String(r);if(w[n])return w[n].bind(t);var i=y(e)[r];return"function"!=typeof i?t[r]:(w[n]=i,i.bind(t))}function I(){return y("MutationObserver").constructor}function _(e,t,r){try{if(!(t in e))return()=>{};var n=e[t],i=r(n);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch(s){return()=>{}}}var C=e=>S("Node",e,"childNodes"),M=e=>S("Node",e,"parentNode"),T=e=>S("Node",e,"parentElement"),R=e=>S("Node",e,"textContent"),E=(e,t)=>k("Node",e,"contains")(t),x=e=>k("Node",e,"getRootNode")(),O=e=>e&&"host"in e?S("ShadowRoot",e,"host"):null,L=e=>e&&"shadowRoot"in e?S("Element",e,"shadowRoot"):null;function N(e){return e.nodeType===e.ELEMENT_NODE}function D(e){var t=e&&"host"in e&&"mode"in e&&O(e)||null;return Boolean(t&&"shadowRoot"in t&&L(t)===e)}function F(e){return"[object ShadowRoot]"==={}.toString.call(e)}function A(e){try{var t=e.rules||e.cssRules;if(!t)return null;var r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),(n=Array.from(t,e=>P(e,r)).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),n}catch(i){return null}var n}function P(e,t){var r;if("styleSheet"in e){var n;try{n=A(e.styleSheet)||function(e){var{cssText:t}=e;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(s){n=e.cssText}try{if(n&&(null==(r=e.styleSheet)?void 0:r.href))return Z(n,e.styleSheet.href)}catch(a){}return n}var i=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(i=i.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?Z(i,t):i}class B{constructor(){o(this,"idNodeMap",new Map),o(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),N(e)){var r=L(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function U(e){var{element:t,maskInputOptions:r,tagName:n,type:i,value:s,maskInputFn:a}=e,o=s||"",l=i&&W(i);return(r[n.toLowerCase()]||l&&r[l])&&(o=a?a(o,t):"*".repeat(o.length)),o}function W(e){return e.toLowerCase()}var H="__rrweb_original__";function q(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?W(t):null}function z(e,t){var r,n;try{n=new URL(e,null!=t?t:window.location.href)}catch(s){return null}var i=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==i?void 0:i[1])&&void 0!==r?r:null}var $=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,j=/^(?:[a-z+]+:)?\/\//i,G=/^www\..*/i,V=/^(data:)([^,]*),(.*)/i;function Z(e,t){return(e||"").replace($,(e,r,n,i,s,a)=>{var o,l=n||s||a,u=r||i||"";if(!l)return e;if(j.test(l)||G.test(l))return"url("+u+l+u+")";if(V.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((o=t).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+l)+u+")";var d=t.split("/"),c=l.split("/");for(var h of(d.pop(),c))"."!==h&&(".."===h?d.pop():d.push(h));return"url("+u+d.join("/")+u+")"})}var J,Y,X=1,K=new RegExp("[^a-z0-9-_:]");function Q(){return X++}var ee=/^[^ \t\n\r\u000c]+/,te=/^[, \t\n\r\u000c]+/,re=new WeakMap;function ne(e,t){return t&&""!==t.trim()?ie(e,t):t}function ie(e,t){var r=re.get(e);if(r||(r=e.createElement("a"),re.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function se(e,t,r,n,i,s){if(!n)return n;if("src"===r||"href"===r&&("use"!==t||"#"!==n[0])){var a=ne(e,n);if("img"===t&&a.startsWith("data:")&&i){var o=a;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(o=function(e,t,r,n){if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;try{var i=document.createElement("canvas");i.width=e.naturalWidth,i.height=e.naturalHeight;var s=i.getContext("2d");return s?(s.drawImage(e,0,0),i.toDataURL(r||"image/webp",null!=n?n:.4)):t}catch(a){return t}}(i,a,s.type,s.quality)),(null==s?void 0:s.maxBase64ImageLength)&&(l=o,o=(u=s.maxBase64ImageLength)&&l.length>u?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":l),o}return a}return"xlink:href"===r&&"#"!==n[0]?ne(e,n):"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function n(e){var n,i=e.exec(t.substring(r));return i?(r+=(n=i[0]).length,n):""}for(var i=[];n(te),t.length>r;){var s=n(ee);if(","===s.slice(-1))s=ne(e,s.substring(0,s.length-1)),i.push(s);else{var a="";s=ne(e,s);for(var o=!1;;){var l=t.charAt(r);if(""===l){i.push((s+a).trim());break}if(o)")"===l&&(o=!1);else{if(","===l){r+=1,i.push((s+a).trim());break}"("===l&&(o=!0)}a+=l,r+=1}}}return i.join(", ")}(e,n):"style"===r?Z(n,ie(e)):"object"===t&&"data"===r?ne(e,n):n:ne(e,n);var l,u}function ae(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function oe(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&oe(M(e),t,r);for(var n=e.classList.length;n--;)if(t.test(e.classList[n]))return!0;return!!r&&oe(M(e),t,r)}function le(e,t,r,n){var i;if(N(e)){if(!C(i=e).length)return!1}else{if(null===T(e))return!1;i=T(e)}try{if("string"==typeof t){if(n){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if(oe(i,t,n))return!0;if(r)if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}catch(s){}return!1}function ue(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function de(e){return null==e?"":e.toLowerCase()}var ce=50,he=!1,pe=!1;function fe(e,t){var{doc:r,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:o,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:d={},maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m={},inlineImages:g=!1,recordCanvas:v=!1,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:_=!1,depth:E=0,maxDepth:x=ce}=t,{needsMask:O}=t,{preserveWhiteSpace:P=!0}=t;if(E>=x)return pe=!0,he||(he=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+x+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;O||(O=le(e,a,o,void 0===O));var B,$=function(e,t){var{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:a,inlineStylesheet:o,maskInputOptions:l={},maskTextFn:u,maskInputFn:d,dataURLOptions:c={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1}=t,v=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:f.Document,childNodes:[],compatMode:e.compatMode}:{type:f.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:f.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return function(e,t){for(var r,n,i,{doc:s,blockClass:a,blockSelector:o,inlineStylesheet:l,maskInputOptions:u={},maskInputFn:d,dataURLOptions:c={},inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g=!1,rootId:v}=t,y=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var n=e.classList.length;n--;)if(t.test(e.classList[n]))return!0;if(r)return e.matches(r)}catch(i){}return!1}(e,a,o),b=function(e){if(e instanceof HTMLFormElement)return"form";var t=W(e.tagName);return K.test(t)?"div":t}(e),S={},w=e.attributes.length,k=0;w>k;k++){var I=e.attributes[k];ae(b,I.name)||(S[I.name]=se(s,b,W(I.name),I.value,e,c))}if("link"===b&&l){var _=e.href;if(_){var C=ue(s,_);!C&&_.includes(".css")&&(C=ue(s,window.location.origin+"/"+_.replace(window.location.href,"")));var M=null;C&&(M=A(C)),M&&(delete S.rel,delete S.href,S._cssText=M)}}var T;if("style"===b&&e.sheet&&!(e.innerText||R(e)||"").trim().length){var E=A(e.sheet);E&&(S._cssText=E)}if("input"===b||"textarea"===b||"select"===b){var x=e.value,O=e.checked;"radio"!==S.type&&"checkbox"!==S.type&&"submit"!==S.type&&"button"!==S.type&&x?S.value=U({element:e,type:q(e),tagName:b,value:x,maskInputOptions:u,maskInputFn:d}):O&&(S.checked=O)}if("option"===b&&(e.selected&&!u.select?S.selected=!0:delete S.selected),"dialog"===b&&e.open)try{S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(Z){S.rr_open_mode="modal",S.ph_rr_could_not_detect_modal=!0}if("canvas"===b&&p)if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var n=0;e.height>n;n+=50){var i=t.getImageData;if(new Uint32Array((H in i?i[H]:i).call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(S.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var L=e.toDataURL(c.type,c.quality),N=s.createElement("canvas");N.width=e.width,N.height=e.height,L!==N.toDataURL(c.type,c.quality)&&(S.rr_dataURL=L)}if("img"===b&&h){J||(J=s.createElement("canvas"),Y=J.getContext("2d"));var D=e,F=D.currentSrc||D.getAttribute("src")||"<unknown-src>",P=D.crossOrigin,B=()=>{D.removeEventListener("load",B);try{J.width=D.naturalWidth,J.height=D.naturalHeight,Y.drawImage(D,0,0),S.rr_dataURL=J.toDataURL(c.type,c.quality)}catch(Z){if("anonymous"!==D.crossOrigin)return D.crossOrigin="anonymous",void(D.complete&&0!==D.naturalWidth?B():D.addEventListener("load",B));console.warn("Cannot inline img src="+F+"! Error: "+Z)}"anonymous"===D.crossOrigin&&(P?S.crossOrigin=P:D.removeAttribute("crossorigin"))};D.complete&&0!==D.naturalWidth?B():D.addEventListener("load",B)}if("audio"===b||"video"===b){var z=S;z.rr_mediaState=e.paused?"paused":"played",z.rr_mediaCurrentTime=e.currentTime,z.rr_mediaPlaybackRate=e.playbackRate,z.rr_mediaMuted=e.muted,z.rr_mediaLoop=e.loop,z.rr_mediaVolume=e.volume}if(g||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),y){var{width:$,height:j,left:G,top:V}=e.getBoundingClientRect();S={class:S.class,rr_width:$+"px",rr_height:j+"px",rr_left:Math.floor(G+((null==(r=s.defaultView)?void 0:r.scrollX)||0))+"px",rr_top:Math.floor(V+((null==(n=s.defaultView)?void 0:n.scrollY)||0))+"px"}}"iframe"!==b||m(S.src)||(e.contentDocument||(S.rr_src=S.src),delete S.src);try{customElements.get(b)&&(i=!0)}catch(Z){}return{type:f.Element,tagName:b,attributes:S,childNodes:[],isSVG:(T=e,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:y,rootId:v,isCustom:i}}(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:l,maskInputFn:d,dataURLOptions:c,inlineImages:h,recordCanvas:p,keepIframeSrcFn:m,newlyAddedElement:g,rootId:v});case e.TEXT_NODE:return function(e,t){var r,{needsMask:n,maskTextFn:i,rootId:s}=t,a=M(e),o=a&&a.tagName,l=R(e),u="STYLE"===o||void 0,d="SCRIPT"===o||void 0;if(u&&l){try{e.nextSibling||e.previousSibling||(null==(r=a.sheet)?void 0:r.cssRules)&&(l=A(a.sheet))}catch(c){console.warn("Cannot get CSS styles from text's parentNode. Error: "+c,e)}l=Z(l,ie(t.doc))}return d&&(l="SCRIPT_PLACEHOLDER"),!u&&!d&&l&&n&&(l=i?i(l,T(e)):l.replace(/[\S]/g,"*")),{type:f.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:a,maskTextFn:u,rootId:v});case e.CDATA_SECTION_NODE:return{type:f.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:f.Comment,textContent:R(e)||"",rootId:v};default:return!1}}(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:O,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,dataURLOptions:m,inlineImages:g,recordCanvas:v,keepIframeSrcFn:I,newlyAddedElement:_});if(!$)return console.warn(e,"not serialized"),null;B=n.hasNode(e)?n.getId(e):!function(e,t){if(t.comment&&e.type===f.Comment)return!0;if(e.type===f.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===z(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(de(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===de(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(de(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&de(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(de(e.attributes.property).match(/^(og|twitter|fb):/)||de(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===de(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(de(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(de(e.attributes.name))||de(e.attributes.property).match(/^article:/)||de(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(de(e.attributes.name)))return!0}}return!1}($,p)&&(P||$.type!==f.Text||$.isStyle||$.textContent.replace(/^\s+|\s+$/gm,"").length)?Q():-2;var j=Object.assign($,{id:B});if(n.add(e,j),-2===B)return null;y&&y(e);var G=!l;if(j.type===f.Element){G=G&&!j.needBlock,delete j.needBlock;var V=L(e);V&&F(V)&&(j.isShadowHost=!0)}if((j.type===f.Document||j.type===f.Element)&&G){p.headWhitespace&&j.type===f.Element&&"head"===j.tagName&&(P=!1);var X={doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:O,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:v,preserveWhiteSpace:P,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:I,depth:E+1,maxDepth:x};if(j.type===f.Element&&"textarea"===j.tagName&&void 0!==j.attributes.value);else for(var ee of Array.from(C(e))){var te=fe(ee,X);te&&j.childNodes.push(te)}var re=null;if(N(e)&&(re=L(e)))for(var ne of Array.from(C(re))){var oe=fe(ne,X);oe&&(F(re)&&(oe.isShadow=!0),j.childNodes.push(oe))}}var me=M(e);return me&&D(me)&&F(me)&&(j.isShadow=!0),j.type===f.Element&&"iframe"===j.tagName&&function(e,t,r){var n=e.contentWindow;if(n){var i,s=!1;try{i=n.document.readyState}catch(l){return}if("complete"===i){var a="about:blank";if(n.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var o=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),s=!0,t()})}}}(e,()=>{var t=e.contentDocument;if(t&&b){var r=fe(t,{doc:t,mirror:n,blockClass:i,blockSelector:s,needsMask:O,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:v,preserveWhiteSpace:P,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:I,depth:E+1,maxDepth:x});r&&b(e,r)}},S),j.type===f.Element&&"link"===j.tagName&&"string"==typeof j.attributes.rel&&("stylesheet"===j.attributes.rel||"preload"===j.attributes.rel&&"string"==typeof j.attributes.href&&"css"===z(j.attributes.href))&&function(e,t,r){var n,i=!1;try{n=e.sheet}catch(a){return}if(!n){var s=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),i=!0,t()})}}(e,()=>{if(w){var t=fe(e,{doc:r,mirror:n,blockClass:i,blockSelector:s,needsMask:O,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:p,dataURLOptions:m,inlineImages:g,recordCanvas:v,preserveWhiteSpace:P,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:k,keepIframeSrcFn:I,depth:E,maxDepth:x});t&&w(e,t)}},k),j}function me(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}class ge{constructor(){o(this,"parentElement",null),o(this,"parentNode",null),o(this,"ownerDocument"),o(this,"firstChild",null),o(this,"lastChild",null),o(this,"previousSibling",null),o(this,"nextSibling",null),o(this,"ELEMENT_NODE",1),o(this,"TEXT_NODE",3),o(this,"nodeType"),o(this,"nodeName"),o(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof ge))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function ve(e,t,r){void 0===r&&(r=document);var n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}function ye(e){try{e()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var be="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.",Se={map:{},getId:()=>(console.error(be),-1),getNode:()=>(console.error(be),null),removeNodeFromMap(){console.error(be)},has:()=>(console.error(be),!1),reset(){console.error(be)}};function we(e,t,r){void 0===r&&(r={});var n=null,i=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var l=Date.now();i||!1!==r.leading||(i=l);var u=t-(l-i),d=this;0>=u||u>t?(n&&(clearTimeout(n),n=null),i=l,e.apply(d,a)):n||!1===r.trailing||(n=setTimeout(()=>{i=!1===r.leading?0:Date.now(),n=null,e.apply(d,a)},u))}}function ke(e,t,r,n,i){void 0===i&&(i=window);var s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),s&&s.set&&s.set.call(this,e)}}),()=>ke(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Se=new Proxy(Se,{get:(e,t,r)=>("map"===t&&console.error(be),Reflect.get(e,t,r))}));var Ie=Date.now;function _e(e){var t,r,n,i,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=T(s.body))?void 0:t.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(n=T(s.body))?void 0:n.scrollTop)||(null==(i=null==s?void 0:s.body)?void 0:i.scrollTop)||0}}function Ce(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Me(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Te(e){return e?e.nodeType===e.ELEMENT_NODE?e:T(e):null}function Re(e,t,r,n){if(!e)return!1;var i=Te(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(n&&null!==i.closest("."+t))return!0}else if(oe(i,t,n))return!0}catch(s){}if(r){if(i.matches(r))return!0;if(n&&null!==i.closest(r))return!0}return!1}function Ee(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function xe(e,t){if(D(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var n=M(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||xe(n,t))}function Oe(e){return Boolean(e.changedTouches)}function Le(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ne(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function De(e){return!!e&&(e instanceof ge&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(L(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Ie=()=>(new Date).getTime());class Fe{constructor(){o(this,"id",1),o(this,"styleIDMap",new WeakMap),o(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ae(e){var t,r=null;return"getRootNode"in e&&(null==(t=x(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&O(x(e))&&(r=O(x(e))),r}function Pe(e){var t=e.ownerDocument;return!!t&&(E(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Ae(r);)r=t;return r}(e);return E(t,r)}(e))}function Be(e){return"__ln"in e}class Ue{constructor(){o(this,"length",0),o(this,"head",null),o(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Be(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Be(e.nextSibling)&&e.nextSibling.__ln.previous){var n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}var We,He=(e,t)=>e+"@"+t;class qe{constructor(){o(this,"frozen",!1),o(this,"locked",!1),o(this,"texts",[]),o(this,"attributes",[]),o(this,"attributeMap",new WeakMap),o(this,"removes",[]),o(this,"mapRemoves",[]),o(this,"movedMap",{}),o(this,"addedSet",new Set),o(this,"movedSet",new Set),o(this,"droppedSet",new Set),o(this,"removesSubTreeCache",new Set),o(this,"mutationCb"),o(this,"blockClass"),o(this,"blockSelector"),o(this,"maskTextClass"),o(this,"maskTextSelector"),o(this,"inlineStylesheet"),o(this,"maskInputOptions"),o(this,"maskTextFn"),o(this,"maskInputFn"),o(this,"keepIframeSrcFn"),o(this,"recordCanvas"),o(this,"inlineImages"),o(this,"slimDOMOptions"),o(this,"dataURLOptions"),o(this,"doc"),o(this,"mirror"),o(this,"iframeManager"),o(this,"stylesheetManager"),o(this,"shadowDomManager"),o(this,"canvasManager"),o(this,"processedNodeManager"),o(this,"unattachedDoc"),o(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),o(this,"emit",()=>{if(!this.frozen&&!this.locked){for(var e=[],t=new Set,r=new Ue,n=e=>{for(var t=e,r=-2;-2===r;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},i=i=>{var s=M(i);if(s&&Pe(i)&&"TEXTAREA"!==s.tagName){var a=D(s)?this.mirror.getId(Ae(i)):this.mirror.getId(s),o=n(i);if(-1===a||-1===o)return r.addNode(i);var l=fe(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{Le(e,this.mirror)&&this.iframeManager.addIframe(e),Ne(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),De(i)&&this.shadowDomManager.addShadowRoot(L(i),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:a,nextId:o,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)$e(this.removesSubTreeCache,s)&&!this.movedSet.has(M(s))||i(s);for(var a of this.addedSet)je(this.droppedSet,a)||$e(this.removesSubTreeCache,a)?je(this.movedSet,a)?i(a):this.droppedSet.add(a):i(a);for(var o=null;r.length;){var l=null;if(o){var u=this.mirror.getId(M(o.value)),d=n(o.value);-1!==u&&-1!==d&&(l=o)}if(!l)for(var c=r.tail;c;){var h=c;if(c=c.previous,h){var p=this.mirror.getId(M(h.value));if(-1===n(h.value))continue;if(-1!==p){l=h;break}var f=M(h.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var m=O(f);if(-1!==this.mirror.getId(m)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}o=l.previous,r.removeNode(l.value),i(l.value)}var g={texts:this.texts.map(e=>{var t=e.node,r=M(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.map(e=>{var{attributes:t}=e;if("string"==typeof t.style){var r=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);t.style.length>r.length&&(r+n).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};(g.texts.length||g.attributes.length||g.removes.length||g.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(g))}}),o(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),o(this,"genTextAreaValueMutation",e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(C(e),e=>R(e)||"").join("");t.attributes.value=U({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:q(e),value:r,maskInputFn:this.maskInputFn})}),o(this,"processMutation",e=>{if(!Ee(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=R(e.target);Re(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:le(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Te(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var r=e.target,n=e.attributeName,i=e.target.getAttribute(n);if("value"===n){var s=q(r);i=U({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(Re(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;var a=this.attributeMap.get(e.target);if("IFRAME"===r.tagName&&"src"===n&&!this.keepIframeSrcFn(i)){if(r.contentDocument)return;n="rr_src"}if(a||(this.attributes.push(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,a)),"type"===n&&"INPUT"===r.tagName&&"password"===(e.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!ae(r.tagName,n))if(a.attributes[n]=se(this.doc,W(r.tagName),W(n),i,r,this.dataURLOptions),"style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(h){this.unattachedDoc=this.doc}var o=this.unattachedDoc.createElement("span");for(var l of(e.oldValue&&o.setAttribute("style",e.oldValue),Array.from(r.style))){var u=r.style.getPropertyValue(l),d=r.style.getPropertyPriority(l);u!==o.style.getPropertyValue(l)||d!==o.style.getPropertyPriority(l)?a.styleDiff[l]=""===d?u:[u,d]:a._unchangedStyles[l]=[u,d]}for(var c of Array.from(o.style))""===r.style.getPropertyValue(c)&&(a.styleDiff[c]=!1)}else"open"===n&&"DIALOG"===r.tagName&&(a.attributes.rr_open_mode=r.matches("dialog:modal")?"modal":"non-modal");break;case"childList":if(Re(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{var r,n=this.mirror.getId(t),i=D(e.target)?this.mirror.getId(O(e.target)):this.mirror.getId(e.target);Re(e.target,this.blockClass,this.blockSelector,!1)||Ee(t,this.mirror,this.slimDOMOptions)||(r=t,-1===this.mirror.getId(r))||(this.addedSet.has(t)?(ze(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||xe(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[He(n,i)]?ze(this.movedSet,t):(this.removes.push({parentId:i,id:n,isShadow:!(!D(e.target)||!F(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var n=r.pop();t.has(n)||(t.add(n),C(n).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),o(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ee(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[He(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Re(e,this.blockClass,this.blockSelector,!1)||(C(e).forEach(e=>this.genAdds(e)),De(e)&&C(L(e)).forEach(t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function ze(e,t){e.delete(t),C(t).forEach(t=>ze(e,t))}function $e(e,t,r){return 0!==e.size&&(n=e,!!(i=M(t))&&n.has(i));var n,i}function je(e,t){return 0!==e.size&&Ge(e,t)}function Ge(e,t){var r=M(t);return!!r&&(!!e.has(r)||Ge(e,r))}var Ve=e=>We?function(){try{return e(...arguments)}catch(t){if(We&&!0===We(t))return;throw t}}:e,Ze=[];function Je(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(r){}return e&&e.target}function Ye(e,t){var r=new qe;Ze.push(r),r.init(e);var n=new(I())(Ve(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),{observer:n,buffer:r}}function Xe(e){var{scrollCb:t,doc:r,mirror:n,blockClass:i,blockSelector:s,sampling:a}=e;return ve("scroll",Ve(we(Ve(e=>{var a=Je(e);if(a&&!Re(a,i,s,!0)){var o=n.getId(a);if(a===r&&r.defaultView){var l=_e(r.defaultView);t({id:o,x:l.left,y:l.top})}else t({id:o,x:a.scrollLeft,y:a.scrollTop})}}),a.scroll||100)),r)}var Ke=["INPUT","TEXTAREA","SELECT"],Qe=new WeakMap;function et(e){return function e(t,r){if(it("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||it("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||it("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||it("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var n=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(n),e(t.parentRule,r)}if(t.parentStyleSheet){var i=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(i)}return r}(e,[])}function tt(e,t,r){var n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function rt(e,t){var r,n,i,s,{mirror:a,stylesheetManager:o}=e;s=a.getId("#document"===t.nodeName?t:O(t));var l="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(i=null==(n=t.ownerDocument)?void 0:n.defaultView)?void 0:i.ShadowRoot,u=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&l&&u?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null==(e=u.get)?void 0:e.call(this)},set(e){var t,r=null==(t=u.set)?void 0:t.call(this,e);if(null!==s&&-1!==s)try{o.adoptStyleSheets(e,s)}catch(n){}return r}}),Ve(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})})):()=>{}}function nt(e,t){void 0===t&&(t={});var n,i,s=e.doc.defaultView;if(!s)return()=>{};if(function(e,t){var{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:s,viewportResizeCb:a,inputCb:o,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:d,canvasMutationCb:c,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),n(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),i(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),a(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),o(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),d(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),c(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),f(...arguments)}}(e,t),e.recordDOM){var a=Ye(e,e.doc);n=a.observer,i=a.buffer}var o=function(e){var{mousemoveCb:t,sampling:r,doc:n,mirror:i}=e;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],d=we(Ve(e=>{var r=Date.now()-s;t(l.map(e=>(e.timeOffset-=r,e)),e),l=[],s=null}),o),c=Ve(we(Ve(e=>{var t=Je(e),{clientX:r,clientY:n}=Oe(e)?e.changedTouches[0]:e;s||(s=Ie()),l.push({x:r,y:n,id:i.getId(t),timeOffset:Ie()-s}),d("undefined"!=typeof DragEvent&&e instanceof DragEvent?u.Drag:e instanceof MouseEvent?u.MouseMove:u.TouchMove)}),a,{trailing:!1})),h=[ve("mousemove",c,n),ve("touchmove",c,n),ve("drag",c,n)];return Ve(()=>{h.forEach(e=>e())})}(e),l=function(e){var{mouseInteractionCb:t,doc:n,mirror:i,blockClass:s,blockSelector:a,sampling:o}=e;if(!1===o.mouseInteraction)return()=>{};var l=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,u=[],h=null;return Object.keys(d).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e]).forEach(e=>{var o=W(e),l=(e=>n=>{var o=Je(n);if(!Re(o,s,a,!0)){var l=null,u=e;if("pointerType"in n){switch(n.pointerType){case"mouse":l=c.Mouse;break;case"touch":l=c.Touch;break;case"pen":l=c.Pen}l===c.Touch&&(d[e]===d.MouseDown?u="TouchStart":d[e]===d.MouseUp&&(u="TouchEnd"))}else Oe(n)&&(l=c.Touch);null!==l?(h=l,(u.startsWith("Touch")&&l===c.Touch||u.startsWith("Mouse")&&l===c.Mouse)&&(l=null)):d[e]===d.Click&&(l=h,h=null);var p=Oe(n)?n.changedTouches[0]:n;if(p){var f=i.getId(o),{clientX:m,clientY:g}=p;Ve(t)(r({type:d[u],id:f,x:m,y:g},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(d[e]){case d.MouseDown:case d.MouseUp:o=o.replace("mouse","pointer");break;case d.TouchStart:case d.TouchEnd:return}u.push(ve(o,l,n))}),Ve(()=>{u.forEach(e=>e())})}(e),h=Xe(e),f=function(e,t){var{viewportResizeCb:r}=e,{win:n}=t,i=-1,s=-1;return ve("resize",Ve(we(Ve(()=>{var e=Ce(),t=Me();i===e&&s===t||(r({width:Number(t),height:Number(e)}),i=e,s=t)}),200)),n)}(e,{win:s}),m=function(e){var{inputCb:t,doc:n,mirror:i,blockClass:s,blockSelector:a,ignoreClass:o,ignoreSelector:l,maskInputOptions:u,maskInputFn:d,sampling:c,userTriggeredOnInput:h}=e;function p(e){var t=Je(e),r=e.isTrusted,i=t&&t.tagName;if(t&&"OPTION"===i&&(t=T(t)),t&&i&&Ke.indexOf(i)>=0&&!Re(t,s,a,!0)&&!(t.classList.contains(o)||l&&t.matches(l))){var c=t.value,p=!1,m=q(t)||"";"radio"===m||"checkbox"===m?p=t.checked:(u[i.toLowerCase()]||u[m])&&(c=U({element:t,maskInputOptions:u,tagName:i,type:m,value:c,maskInputFn:d})),f(t,h?{text:c,isChecked:p,userTriggered:r}:{text:c,isChecked:p});var g=t.name;"radio"===m&&g&&p&&n.querySelectorAll('input[type="radio"][name="'+g+'"]').forEach(e=>{if(e!==t){var r=e.value;f(e,h?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}})}}function f(e,n){var s=Qe.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){Qe.set(e,n);var a=i.getId(e);Ve(t)(r({},n,{id:a}))}}var m=("last"===c.input?["change"]:["input","change"]).map(e=>ve(e,Ve(p),n)),g=n.defaultView;if(!g)return()=>{m.forEach(e=>e())};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&m.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map(e=>ke(e[0],e[1],{set(){Ve(p)({target:this,isTrusted:!1})}},!1,g))),Ve(()=>{m.forEach(e=>e())})}(e),g=function(e){var{mediaInteractionCb:t,blockClass:r,blockSelector:n,mirror:i,sampling:s,doc:a}=e,o=Ve(e=>we(Ve(s=>{var a=Je(s);if(a&&!Re(a,r,n,!0)){var{currentTime:o,volume:l,muted:u,playbackRate:d,loop:c}=a;t({type:e,id:i.getId(a),currentTime:o,volume:l,muted:u,playbackRate:d,loop:c})}}),s.media||500)),l=[ve("play",o(p.Play),a),ve("pause",o(p.Pause),a),ve("seeked",o(p.Seeked),a),ve("volumechange",o(p.VolumeChange),a),ve("ratechange",o(p.RateChange),a)];return Ve(()=>{l.forEach(e=>e())})}(e),v=()=>{},y=()=>{},b=()=>{},S=()=>{};e.recordDOM&&(v=function(e,t){var{styleSheetRuleCb:r,mirror:n,stylesheetManager:i}=e,{win:s}=t;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Ve((e,t,s)=>{var[a,o]=s,{id:l,styleId:u}=tt(t,n,i.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:a,index:o}]}),e.apply(t,s)})}),s.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var o,l,u=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(u,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,removes:[{index:a}]}),e.apply(t,s)})}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(o=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,replace:a}),e.apply(t,s)})})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,replaceSync:a}),e.apply(t,s)})}));var d={};st("CSSGroupingRule")?d.CSSGroupingRule=s.CSSGroupingRule:(st("CSSMediaRule")&&(d.CSSMediaRule=s.CSSMediaRule),st("CSSConditionRule")&&(d.CSSConditionRule=s.CSSConditionRule),st("CSSSupportsRule")&&(d.CSSSupportsRule=s.CSSSupportsRule));var c={};return Object.entries(d).forEach(e=>{var[t,s]=e;c[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(c[t].insertRule,{apply:Ve((e,t,s)=>{var[a,o]=s,{id:l,styleId:u}=tt(t.parentStyleSheet,n,i.styleMirror);return(l&&-1!==l||u&&-1!==u)&&r({id:l,styleId:u,adds:[{rule:a,index:[...et(t),o||0]}]}),e.apply(t,s)})}),s.prototype.deleteRule=new Proxy(c[t].deleteRule,{apply:Ve((e,t,s)=>{var[a]=s,{id:o,styleId:l}=tt(t.parentStyleSheet,n,i.styleMirror);return(o&&-1!==o||l&&-1!==l)&&r({id:o,styleId:l,removes:[{index:[...et(t),a]}]}),e.apply(t,s)})})}),Ve(()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=u,o&&(s.CSSStyleSheet.prototype.replace=o),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach(e=>{var[t,r]=e;r.prototype.insertRule=c[t].insertRule,r.prototype.deleteRule=c[t].deleteRule})})}(e,{win:s}),y=rt(e,e.doc),b=function(e,t){var{styleDeclarationCb:r,mirror:n,ignoreCSSAttributes:i,stylesheetManager:s}=e,{win:a}=t,o=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Ve((e,t,a)=>{var l,[u,d,c]=a;if(i.has(u))return o.apply(t,[u,d,c]);var{id:h,styleId:p}=tt(null==(l=t.parentRule)?void 0:l.parentStyleSheet,n,s.styleMirror);return(h&&-1!==h||p&&-1!==p)&&r({id:h,styleId:p,set:{property:u,value:d,priority:c},index:et(t.parentRule)}),e.apply(t,a)})});var l=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ve((e,t,a)=>{var o,[u]=a;if(i.has(u))return l.apply(t,[u]);var{id:d,styleId:c}=tt(null==(o=t.parentRule)?void 0:o.parentStyleSheet,n,s.styleMirror);return(d&&-1!==d||c&&-1!==c)&&r({id:d,styleId:c,remove:{property:u},index:et(t.parentRule)}),e.apply(t,a)})}),Ve(()=>{a.CSSStyleDeclaration.prototype.setProperty=o,a.CSSStyleDeclaration.prototype.removeProperty=l})}(e,{win:s}),e.collectFonts&&(S=function(e){var{fontCb:t,doc:r}=e,n=r.defaultView;if(!n)return()=>{};var i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function(e,t,r){var n=new a(e,t,r);return s.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};var o=_(r.fonts,"add",function(e){return function(r){return setTimeout(Ve(()=>{var e=s.get(r);e&&(t(e),s.delete(r))}),0),e.apply(this,[r])}});return i.push(()=>{n.FontFace=a}),i.push(o),Ve(()=>{i.forEach(e=>e())})}(e)));var w=function(e){var{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:s}=e,a=!0,o=Ve(()=>{var e=t.getSelection();if(!(!e||a&&(null==e?void 0:e.isCollapsed))){a=e.isCollapsed||!1;for(var o=[],l=e.rangeCount||0,u=0;l>u;u++){var d=e.getRangeAt(u),{startContainer:c,startOffset:h,endContainer:p,endOffset:f}=d;Re(c,n,i,!0)||Re(p,n,i,!0)||o.push({start:r.getId(c),startOffset:h,end:r.getId(p),endOffset:f})}s({ranges:o})}});return o(),ve("selectionchange",o)}(e),k=function(e){var{doc:t,customElementCb:r}=e,n=t.defaultView;return n&&n.customElements?_(n.customElements,"define",function(e){return function(t,n,i){try{r({define:{name:t}})}catch(s){console.warn("Custom element callback failed for "+t)}return e.apply(this,[t,n,i])}}):()=>{}}(e),I=[];for(var C of e.plugins)I.push(C.observer(C.callback,s,C.options));return Ve(()=>{if(i){i.destroy(),i.reset();var e=Ze.indexOf(i);-1!==e&&Ze.splice(e,1)}null==n||n.disconnect(),o(),l(),h(),f(),m(),g(),v(),y(),b(),S(),w(),k(),I.forEach(e=>e())})}function it(e){return void 0!==window[e]}function st(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class at{constructor(e){o(this,"iframeIdToRemoteIdMap",new WeakMap),o(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,n){var i=r||this.getIdToRemoteIdMap(e),s=n||this.getRemoteIdToIdMap(e),a=i.get(t);return a||(a=this.generateIdFn(),i.set(t,a),s.set(a,t)),a}getIds(e,t){var r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){var n=r||this.getRemoteIdToIdMap(e);return"number"!=typeof t?t:n.get(t)||-1}getRemoteIds(e,t){var r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){var t=this.iframeIdToRemoteIdMap.get(e);return t||this.iframeIdToRemoteIdMap.set(e,t=new Map),t}getRemoteIdToIdMap(e){var t=this.iframeRemoteIdToIdMap.get(e);return t||this.iframeRemoteIdToIdMap.set(e,t=new Map),t}}class ot{constructor(e){o(this,"iframes",new WeakMap),o(this,"crossOriginIframeMap",new WeakMap),o(this,"crossOriginIframeMirror",new at(Q)),o(this,"crossOriginIframeStyleMirror"),o(this,"crossOriginIframeRootIdMap",new WeakMap),o(this,"mirror"),o(this,"mutationCb"),o(this,"wrappedEmit"),o(this,"loadListener"),o(this,"pageHideListener"),o(this,"stylesheetManager"),o(this,"recordCrossOriginIframes"),o(this,"messageHandler"),o(this,"nestedIframeListeners",new Map),o(this,"attachedIframes",new Map),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new at(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,n,i=this.trackIframeContent(e,t);this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);this.nestedIframeListeners.set(s,a),s.addEventListener("message",a)}null==(r=e.contentWindow)||r.addEventListener("pagehide",()=>{var t;null==(t=this.pageHideListener)||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument),e.contentWindow&&this.crossOriginIframeMap.delete(e.contentWindow)}),null==(n=this.loadListener)||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var r;switch(t.type){case l.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:l.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case l.Meta:case l.Load:case l.DomContentLoaded:return!1;case l.Plugin:return t;case l.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case l.IncrementalSnapshot:switch(t.data.source){case u.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case u.Drag:case u.TouchMove:case u.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(t.data,e,["id"]),t;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case u.Font:return t;case u.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case u.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(var i of n)(Array.isArray(t[i])||"number"==typeof t[i])&&(t[i]=Array.isArray(t[i])?e.getIds(r,t[i]):e.getId(r,t[i]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===f.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.mirror.getNode(e);if(r){var n=r.contentWindow;if(n&&this.nestedIframeListeners.has(n)){var i=this.nestedIframeListeners.get(n);ye(()=>n.removeEventListener("message",i)),this.nestedIframeListeners.delete(n)}n&&this.crossOriginIframeMap.delete(n),this.iframes.delete(r)}t&&this.attachedIframes.delete(e)}reattachIframes(){this.attachedIframes.forEach((e,t)=>{var{content:r}=e;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&window.removeEventListener("message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{ye(()=>t.removeEventListener("message",e))}),this.nestedIframeListeners.clear(),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap}}class lt{constructor(e){o(this,"shadowDoms",new WeakSet),o(this,"mutationCb"),o(this,"scrollCb"),o(this,"bypassOptions"),o(this,"mirror"),o(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(F(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var{observer:n,buffer:i}=Ye(r({},this.bypassOptions,{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>{n.disconnect(),i.destroy();var e=Ze.indexOf(i);-1!==e&&Ze.splice(e,1)}),this.restoreHandlers.push(Xe(r({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(O(e))),this.restoreHandlers.push(rt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var r=this;this.restoreHandlers.push(_(e.prototype,"attachShadow",function(e){return function(n){var i=e.call(this,n),s=L(this);return s&&Pe(this)&&r.addShadowRoot(s,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dt="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ct=0;64>ct;ct++)dt[ut.charCodeAt(ct)]=ct;var ht=new Map,pt=(e,t,r)=>{if(e&&(gt(e,t)||"object"==typeof e)){var n=(s=r,a=e.constructor.name,(o=ht.get(s))||ht.set(s,o=new Map),o.has(a)||o.set(a,[]),o.get(a)),i=n.indexOf(e);return-1===i&&(i=n.length,n.push(e)),i}var s,a,o};function ft(e,t,r,n){if(e instanceof Array)return e.map(e=>ft(e,t,r,n));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:function(e){var t,r=new Uint8Array(e),n=r.length,i="";for(t=0;n>t;t+=3)i+=ut[r[t]>>2],i+=ut[(3&r[t])<<4|r[t+1]>>4],i+=ut[(15&r[t+1])<<2|r[t+2]>>6],i+=ut[63&r[t+2]];return n%3==2?i=i.substring(0,i.length-1)+"=":n%3==1&&(i=i.substring(0,i.length-2)+"=="),i}(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ft(e.buffer,t,r,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){var i=e.constructor.name,{src:s}=e;return{rr_type:i,src:s}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(n.type,n.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[ft(e.data,t,r,n),e.width,e.height]}:gt(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:pt(e,t,r)}:e}var mt=(e,t,r,n)=>e.map(e=>ft(e,t,r,n)),gt=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function vt(e,t,r,n){var i=[];try{var s=_(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i){for(var s=arguments.length,a=new Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];if(!Re(this,t,r,!0)){var l=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=l),n&&["webgl","webgl2"].includes(l))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...a])}});i.push(s)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(e=>e())}}function yt(e,t,r,n,i,s,a){var o=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=_(e,l,function(e){return function(){for(var o=arguments.length,u=new Array(o),d=0;o>d;d++)u[d]=arguments[d];var c=e.apply(this,u);if(pt(c,s,this),"tagName"in this.canvas&&!Re(this.canvas,n,i,!0)){var h=mt(u,s,this,a);r(this.canvas,{type:t,property:l,args:h})}return c}});o.push(u)}catch(c){var d=ke(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});o.push(d)}};for(var d of l)u(d);return o}var bt,St,wt,kt='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n function fnv1aHash(buffer) {\n const view = new Uint8Array(buffer);\n let hash = 2166136261;\n for (let i2 = 0; i2 < view.length; i2++) {\n hash ^= view[i2];\n hash = hash * 16777619 | 0;\n }\n return (hash >>> 0).toString(16);\n }\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n try {\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d");\n }\n reusableCtx.clearRect(0, 0, width, height);\n reusableCtx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const fingerprint = fnv1aHash(arrayBuffer);\n if (!lastFingerprintMap.has(id)) {\n const base642 = encode(arrayBuffer);\n if (await transparentBase64 === base642) {\n lastFingerprintMap.set(id, fingerprint);\n return worker.postMessage({ id });\n }\n lastFingerprintMap.set(id, fingerprint);\n worker.postMessage({ id, type, base64: base642, width, height });\n return;\n }\n if (lastFingerprintMap.get(id) === fingerprint)\n return worker.postMessage({ id });\n const base64 = encode(arrayBuffer);\n worker.postMessage({ id, type, base64, width, height });\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-Ca9A-vl6.js.map\n',It="undefined"!=typeof self&&self.Blob&&new Blob([kt],{type:"text/javascript;charset=utf-8"});function _t(e){var t;try{if(!(t=It&&(self.URL||self.webkitURL).createObjectURL(It)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(n){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(kt),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class Ct{constructor(e){o(this,"pendingCanvasMutations",new Map),o(this,"rafStamps",{latestId:0,invokeId:null}),o(this,"mirror"),o(this,"mutationCb"),o(this,"resetObservers"),o(this,"frozen",!1),o(this,"locked",!1),o(this,"rafIdTimestamp",null),o(this,"rafIdFlush",null),o(this,"processMutation",(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});var{sampling:t="all",win:r,blockClass:n,blockSelector:i,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&"all"===t&&this.initCanvasMutationObserver(r,n,i,a),s&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,i,{dataURLOptions:a})}reset(){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(e,r,n,i,s){var a=this;if("OffscreenCanvas"in r){var o=vt(r,n,i,!0),l=new Map,u=new _t;u.onmessage=e=>{var{id:t}=e.data;if(l.set(t,!1),"base64"in e.data){var{base64:r,type:n,width:i,height:s}=e.data;this.mutationCb({id:t,type:h["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}],displayWidth:i,displayHeight:s})}};var d,c=1e3/e,p=0,f=e=>{var o,h,m;p&&c>e-p||(p=e,(o=[],h=e=>{e.querySelectorAll("canvas").forEach(e=>{Re(e,n,i,!0)||o.push(e)}),e.querySelectorAll("*").forEach(e=>{e.shadowRoot&&h(e.shadowRoot)})},h(r.document),o).forEach((m=t(function*(e){var t,r=a.mirror.getId(e);if(!l.get(r)&&0!==e.width&&0!==e.height){l.set(r,!0);try{if(["webgl","webgl2"].includes(e.__context)){var n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var i=e.clientWidth||e.width,o=e.clientHeight||e.height,d=yield createImageBitmap(e,{resizeWidth:i,resizeHeight:o});u.postMessage({id:r,bitmap:d,width:i,height:o,dataURLOptions:s.dataURLOptions},[d])}catch(c){l.set(r,!1)}}}),function(e){return m.apply(this,arguments)}))),d=requestAnimationFrame(f)};d=requestAnimationFrame(f),this.resetObservers=()=>{o(),cancelAnimationFrame(d)}}}initCanvasMutationObserver(e,t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var i,s,a,o,l,u,d=vt(e,t,r,!1),c=function(e,t,r,n,i){var s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])return 1;var o=_(t.CanvasRenderingContext2D.prototype,a,function(s){return function(){for(var o=arguments.length,l=new Array(o),u=0;o>u;u++)l[u]=arguments[u];return Re(this.canvas,r,n,!0)||setTimeout(()=>{var r=mt(l,t,this,i);e(this.canvas,{type:h["2D"],property:a,args:r})},0),s.apply(this,l)}});s.push(o)}catch(u){var l=ke(t.CanvasRenderingContext2D.prototype,a,{set(t){e(this.canvas,{type:h["2D"],property:a,args:[t],setter:!0})}});s.push(l)}};for(var l of a)o(l);return()=>{s.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,n),p=(i=this.processMutation.bind(this),a=t,o=r,l=n,u=[],void 0!==(s=e).WebGLRenderingContext&&u.push(...yt(s.WebGLRenderingContext.prototype,h.WebGL,i,a,o,s,l)),void 0!==s.WebGL2RenderingContext&&u.push(...yt(s.WebGL2RenderingContext.prototype,h.WebGL2,i,a,o,s,l)),()=>{u.forEach(e=>e())});this.resetObservers=()=>{d(),c(),p()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var n=r.map(e=>function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,s)),{type:i}=r[0];this.mutationCb({id:t,type:i,commands:n}),this.pendingCanvasMutations.delete(e)}}}}class Mt{constructor(e){o(this,"trackedLinkElements",new WeakSet),o(this,"mutationCb"),o(this,"adoptedStyleSheetCb"),o(this,"styleMirror",new Fe),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var r=this;if(0!==e.length){var n={id:t,styleIds:[]},i=[],s=function(e){var t;r.styleMirror.has(e)?t=r.styleMirror.getId(e):(t=r.styleMirror.add(e),i.push({styleId:t,rules:Array.from(e.rules||CSSRule,(t,r)=>({rule:P(t,e.href),index:r}))})),n.styleIds.push(t)};for(var a of e)s(a);i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Tt{constructor(){o(this,"nodeMap",new WeakMap),o(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}var Rt=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Et=document.createElement("iframe");document.body.appendChild(Et),Array.from=(null==(n=Et.contentWindow)?void 0:n.Array.from)||Array.from,document.body.removeChild(Et)}}catch(i){console.debug("Unable to override Array.from",i)}var xt=new B;function Ot(e){void 0===e&&(e={});var{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:o="rr-ignore",ignoreSelector:d=null,maskTextClass:c="rr-mask",maskTextSelector:h=null,inlineStylesheet:p=!0,maskAllInputs:f,maskInputOptions:m,slimDOMOptions:g,maskInputFn:v,maskTextFn:y,hooks:b,packFn:S,sampling:w={},dataURLOptions:k={},mousemoveWait:I,recordDOM:_=!0,recordCanvas:C=!1,recordCrossOriginIframes:M=!1,recordAfter:T=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:E=!1,inlineImages:x=!1,plugins:O,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:D=new Set([]),errorHandler:F}=e;We=F;var A=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},k),P=!M||window.parent===window,U=!1;if(!P)try{window.parent.document&&(U=!1)}catch(H){U=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!U)return()=>{};void 0!==I&&void 0===w.mousemove&&(w.mousemove=I),xt.reset();var W,H,q=!0===f?{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!==m?m:{password:!0},z=me(void 0!==g&&g);void 0===H&&(H=window),"NodeList"in H&&!H.NodeList.prototype.forEach&&(H.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in H&&!H.DOMTokenList.prototype.forEach&&(H.DOMTokenList.prototype.forEach=[].forEach);var $=0,j=new Map,G=e=>{for(var t of O||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!U&&(e=S(e)),e};bt=(e,r)=>{var s,a=e;if(a.timestamp=Ie(),!(null==(s=Ze[0])?void 0:s.isFrozen())||a.type===l.FullSnapshot||a.type===l.IncrementalSnapshot&&a.data.source===u.Mutation||Ze.forEach(e=>e.unfreeze()),P)null==t||t(G(a),r);else if(U){var o={type:"rrweb",event:G(a),origin:window.location.origin,isCheckout:r};window.parent.postMessage(o,"*")}if(a.type===l.FullSnapshot)W=a,$=0;else if(a.type===l.IncrementalSnapshot){if(a.data.source===u.Mutation&&a.data.isAttachIframe)return;$++,(i&&$>=i||n&&a.timestamp-W.timestamp>n)&&St(!0)}};var V=e=>{if(M&&e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null;e.removes.forEach(e=>{var{id:r}=e;if(!t||!t.has(r)){var n=j.get(r);n&&(n(),j.delete(r)),X.removeIframeById(r)}}),function(){for(var[e,t]of j){var r=xt.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||(t(),j.delete(e))}catch(n){t(),j.delete(e)}else t(),j.delete(e)}}()}bt({type:l.IncrementalSnapshot,data:r({source:u.Mutation},e)})},Z=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Scroll},e)}),J=e=>bt({type:l.IncrementalSnapshot,data:r({source:u.CanvasMutation},e)}),Y=new Mt({mutationCb:V,adoptedStyleSheetCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},e)})}),X=new ot({mirror:xt,mutationCb:V,stylesheetManager:Y,recordCrossOriginIframes:M,wrappedEmit:bt});for(var K of O||[])K.getMirror&&K.getMirror({nodeMirror:xt,crossOriginIframeMirror:X.crossOriginIframeMirror,crossOriginIframeStyleMirror:X.crossOriginIframeStyleMirror});var Q=new Tt;wt=new Ct({recordCanvas:C,mutationCb:J,win:window,blockClass:s,blockSelector:a,mirror:xt,sampling:w.canvas,dataURLOptions:A});var ee=new lt({mutationCb:V,scrollCb:Z,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:h,inlineStylesheet:p,maskInputOptions:q,dataURLOptions:A,maskTextFn:y,maskInputFn:v,recordCanvas:C,inlineImages:x,sampling:w,slimDOMOptions:z,iframeManager:X,stylesheetManager:Y,canvasManager:wt,keepIframeSrcFn:N,processedNodeManager:Q},mirror:xt});St=function(e){if(void 0===e&&(e=!1),_){bt({type:l.Meta,data:{href:window.location.href,width:Me(),height:Ce()}},e),Y.reset(),ee.init(),Ze.forEach(e=>e.lock());var t=function(e,t){var{mirror:r=new B,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:o=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:c,maskInputFn:h,slimDOM:p=!1,dataURLOptions:f,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w=()=>!1,maxDepth:k}=t||{};return fe(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:o,maskInputOptions:!0===d?{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===d?{password:!0}:d,maskTextFn:c,maskInputFn:h,slimDOMOptions:me(p),dataURLOptions:f,inlineImages:l,recordCanvas:u,preserveWhiteSpace:m,onSerialize:g,onIframeLoad:v,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:S,keepIframeSrcFn:w,newlyAddedElement:!1,maxDepth:k})}(document,{mirror:xt,blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:h,inlineStylesheet:p,maskAllInputs:q,maskTextFn:y,maskInputFn:v,slimDOM:z,dataURLOptions:A,recordCanvas:C,inlineImages:x,onSerialize(e){Le(e,xt)&&X.addIframe(e),Ne(e,xt)&&Y.trackLinkElement(e),De(e)&&ee.addShadowRoot(L(e),document)},onIframeLoad(e,t){X.attachIframe(e,t),ee.observeAttachShadow(e)},onStylesheetLoad(e,t){Y.attachLinkElement(e,t)},keepIframeSrcFn:N});if(!t)return console.warn("Failed to snapshot the document");bt({type:l.FullSnapshot,data:{node:t,initialOffset:_e(window)}},e),Ze.forEach(e=>e.unlock()),M&&X.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Y.adoptStyleSheets(document.adoptedStyleSheets,xt.getId(document))}};try{var te=[],re=e=>{var t;return Ve(nt)({mutationCb:V,mousemoveCb:(e,t)=>bt({type:l.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MouseInteraction},e)}),scrollCb:Z,viewportResizeCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.ViewportResize},e)}),inputCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Input},e)}),mediaInteractionCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.MediaInteraction},e)}),styleSheetRuleCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleSheetRule},e)}),styleDeclarationCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.StyleDeclaration},e)}),canvasMutationCb:J,fontCb:e=>bt({type:l.IncrementalSnapshot,data:r({source:u.Font},e)}),selectionCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.Selection},e)})},customElementCb(e){bt({type:l.IncrementalSnapshot,data:r({source:u.CustomElement},e)})},blockClass:s,ignoreClass:o,ignoreSelector:d,maskTextClass:c,maskTextSelector:h,maskInputOptions:q,inlineStylesheet:p,sampling:w,recordDOM:_,recordCanvas:C,inlineImages:x,userTriggeredOnInput:R,collectFonts:E,doc:e,maskInputFn:v,maskTextFn:y,keepIframeSrcFn:N,blockSelector:a,slimDOMOptions:z,dataURLOptions:A,mirror:xt,iframeManager:X,stylesheetManager:Y,shadowDomManager:ee,processedNodeManager:Q,canvasManager:wt,ignoreCSSAttributes:D,plugins:(null==(t=null==O?void 0:O.filter(e=>e.observer))?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>bt({type:l.Plugin,data:{plugin:e.name,payload:t}})})))||[]},b)};X.addLoadListener(e=>{try{var t=xt.getId(e),r=re(e.contentDocument);te.push(r),-1!==t&&j.set(t,r)}catch(n){console.warn(n)}}),X.addPageHideListener(e=>{var t=xt.getId(e),r=j.get(t);r&&(r(),j.delete(t)),function(e){for(var t=Ze.length-1;t>=0;t--){var r=Ze[t];r.bufferBelongsToIframe(e)&&(r.reset(),Ze.splice(t,1))}}(e)});var ne=()=>{St(),te.push(re(document)),Rt=!0};return["interactive","complete"].includes(document.readyState)?ne():(te.push(ve("DOMContentLoaded",()=>{bt({type:l.DomContentLoaded,data:{}}),"DOMContentLoaded"===T&&ne()})),te.push(ve("load",()=>{bt({type:l.Load,data:{}}),"load"===T&&ne()},window))),()=>{te.forEach(e=>ye(e)),Q.destroy(),X.removeLoadListener(),X.destroy(),j.clear(),xt.reset(),Rt=!1,We=void 0}}catch(H){console.warn(H)}}Ot.addCustomEvent=(e,t)=>{if(!Rt)throw new Error("please add custom event after start recording");bt({type:l.Custom,data:{tag:e,payload:t}})},Ot.freezePage=()=>{Ze.forEach(e=>e.freeze())},Ot.takeFullSnapshot=e=>{if(!Rt)throw new Error("please take full snapshot after start recording");St(e)},Ot.mirror=xt;var Lt=Object.defineProperty,Nt=(e,t,r)=>{return s=r,(i="symbol"!=typeof t?t+"":t)in(n=e)?Lt(n,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[i]=s;var n,i,s};class Dt{constructor(e){Nt(this,"fileName"),Nt(this,"functionName"),Nt(this,"lineNumber"),Nt(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}var Ft=/(^|@)\S+:\d+/,At=/^\s*at .*(\S+:\d+|\(native\))/m,Pt=/^(eval@)?(\[native code])?$/,Bt={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(At)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(At)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),i=this.extractLocation(r?r[1]:n.pop()),s=n.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(i[0])>-1?void 0:i[0];return new Dt({functionName:s,fileName:a,lineNumber:i[1],columnNumber:i[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(Pt)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Dt({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),n=r&&r[1]?r[1]:void 0,i=this.extractLocation(e.replace(t,""));return new Dt({functionName:n,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),n=[],i=2,s=r.length;s>i;i+=2){var a=t.exec(r[i]);a&&n.push(new Dt({fileName:a[2],lineNumber:parseFloat(a[1])}))}return n},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),n=[],i=0,s=r.length;s>i;i+=2){var a=t.exec(r[i]);a&&n.push(new Dt({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return n},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(Ft)&&!e.match(/^Error created at/)},this).map(function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),n=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Dt({functionName:n,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Ut(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var n=e.parentElement,i=[];if(n.children&&n.children.length>0)for(var s=0;n.children.length>s;s++){var a=n.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&i.push(a)}i.length>1&&(r+=":eq("+i.indexOf(e)+")"),t=r+(t?">"+t:""),e=n}return t}function Wt(e){return Array.isArray(e)}function Ht(e){return"object"==typeof e&&null!==e&&!Wt(e)}function qt(e,t){if(0===t)return!0;var r=Object.keys(e);for(var n of r)if(Ht(e[n])&&qt(e[n],t-1))return!0;return!1}function zt(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var n=[],i=[];return JSON.stringify(e,function(e,t){if(n.length>0){var s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?i.splice(s,1/0,e):i.push(e),~n.indexOf(t)&&(t=n[0]===t?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(t)).join(".")+"]")}else n.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Ht(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Ht(o)&&qt(o,r.depthOfLimit))return a=t.toString(),r.stringLengthLimit&&a.length>r.stringLengthLimit&&(a=a.slice(0,r.stringLengthLimit)+"..."),a;var a,o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var l={};for(var u in t){var d=t[u];l[u]=Wt(d)?Ut(d.length?d[0]:null):d}return l}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var $t={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 jt(e,t,r){var n,i=r?Object.assign({},$t,r):$t,s=i.logger;if(!s)return()=>{};n="string"==typeof s?t[s]:s;var a=0,o=!1,l=[];if(i.level.includes("error")){var u=t=>{var r=t.message,n=Bt.parse(t.error).map(e=>e.toString()),s=[zt(r,i.stringifyOptions)];e({level:"error",trace:n,payload:s})};t.addEventListener("error",u),l.push(()=>{t.removeEventListener("error",u)});var d=t=>{var r,n;t.reason instanceof Error?n=[zt("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,i.stringifyOptions)]:(r=new Error,n=[zt("Uncaught (in promise)",i.stringifyOptions),zt(t.reason,i.stringifyOptions)]);var s=Bt.parse(r).map(e=>e.toString());e({level:"error",trace:s,payload:n})};t.addEventListener("unhandledrejection",d),l.push(()=>{t.removeEventListener("unhandledrejection",d)})}for(var c of i.level)l.push(h(n,c));return()=>{l.forEach(e=>e())};function h(t,r){var n=this;return t[r]?function(t,s){try{if(!(s in t))return()=>{};var l=t[s],u=(t=>function(){for(var s=arguments.length,l=new Array(s),u=0;s>u;u++)l[u]=arguments[u];if(t.apply(n,l),!("assert"===r&&l[0]||o)){o=!0;try{var d=Bt.parse(new Error).map(e=>e.toString()).splice(1),c=("assert"===r?l.slice(1):l).map(e=>zt(e,i.stringifyOptions));a++,i.lengthThreshold>a?e({level:r,trace:d,payload:c}):a===i.lengthThreshold&&e({level:"warn",trace:[],payload:[zt("The number of log records reached the threshold.")]})}catch(h){t("rrweb logger error:",h,...l)}finally{o=!1}}})(l);return"function"==typeof u&&(u.prototype=u.prototype||{},Object.defineProperties(u,{__rrweb_original__:{enumerable:!1,value:l}})),t[s]=u,()=>{t[s]=l}}catch(d){return()=>{}}}(t,r):()=>{}}}var Gt="undefined"!=typeof window?window:void 0,Vt="undefined"!=typeof globalThis?globalThis:Gt;"undefined"==typeof self&&(Vt.self=Vt),"undefined"==typeof File&&(Vt.File=function(){});var Zt=null==Vt?void 0:Vt.document;null!=Vt&&Vt.XMLHttpRequest&&new Vt.XMLHttpRequest;var Jt=null!=Gt?Gt:{},Yt=Object.prototype,Xt=Yt.hasOwnProperty,Kt=Yt.toString,Qt=Array.isArray||function(e){return"[object Array]"===Kt.call(e)},er=e=>"function"==typeof e,tr=e=>e===Object(e)&&!Qt(e),rr=e=>void 0===e,nr=e=>"[object String]"==Kt.call(e),ir=e=>null===e,sr=e=>rr(e)||ir(e),ar=e=>"[object Number]"==Kt.call(e)&&e==e,or=e=>"[object Boolean]"===Kt.call(e),lr=e=>e instanceof FormData;function ur(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),ar(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),ur(i||r,t,r,n))}class dr{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=ur(e.bucketSize,0,100,e.qt),this.$t=ur(e.refillRate,0,this.jt,e.qt),this.Vt=ur(e.refillInterval,0,864e5,e.qt)}Ht(e,t){var r=Math.floor((t-e.lastAccess)/this.Vt);r>0&&(e.tokens=Math.min(e.tokens+r*this.$t,this.jt),e.lastAccess=e.lastAccess+r*this.Vt)}consumeRateLimit(e){var t,r=Date.now(),n=String(e),i=this.Pt[n];return i?this.Ht(i,r):this.Pt[n]=i={tokens:this.jt,lastAccess:r},0===i.tokens||(i.tokens--,0===i.tokens&&(null==(t=this.Dt)||t.call(this,e)),0===i.tokens)}stop(){this.Pt={}}}var cr=function(e,t){var{debugEnabled:r}=void 0===t?{}:t,n={C(t){if(Gt&&(Jt.POSTHOG_DEBUG||r)&&!rr(Gt.console)&&Gt.console){for(var n=("__rrweb_original__"in Gt.console[t]?Gt.console[t].__rrweb_original__:Gt.console[t]),i=arguments.length,s=new Array(i>1?i-1:0),a=1;i>a;a++)s[a-1]=arguments[a];n(e,...s)}},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n.C("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n.C("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n.C("error",...t)},critical(){for(var t=arguments.length,r=new Array(t),n=0;t>n;n++)r[n]=arguments[n];console.error(e,...r)},uninitializedWarning(e){n.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>cr(e+" "+t,r)};return n},hr=cr("[PostHog.js]"),pr=hr.createLogger;function fr(e,t){if(!sr(e))if(Qt(e))e.forEach(t);else if(lr(e))e.forEach((e,r)=>t(e,r));else for(var r in e)Xt.call(e,r)&&t(e[r],r)}function mr(e,t,r,n){var{capture:i=!1,passive:s=!0}={};null==e||e.addEventListener(t,r,{capture:i,passive:s})}var gr=["localhost","127.0.0.1"],vr=e=>{var t=null==Zt?void 0:Zt.createElement("a");return rr(t)?null:(t.href=e,t)};function yr(e,t,r){try{if(!(t in e))return()=>{};var n=e[t],i=r(n);return er(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=n}}catch(s){return()=>{}}}function br(e,t){var r,n=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(t){return null}}(e),i={hostname:n,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==n||!n.trim().length)return i;for(var s of t.payloadHostDenyList)if(n.endsWith(s))return{hostname:n,isHostDenied:!0};return i}var Sr="$session_recording_remote_config",wr="$session_is_sampled",kr="$session_past_minimum_duration",Ir="$session_recording_url_trigger_activated_session",_r="$session_recording_event_trigger_activated_session",Cr="$posthog_sr_group_event_trigger_",Mr="$posthog_sr_group_url_trigger_",Tr="$posthog_sr_group_sampling_",Rr="$debug_first_full_snapshot_timestamp",Er="$stored_person_properties",xr=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})"),Or=new RegExp("(\\d{3}-?\\d{2}-?\\d{4})"),Lr="[SessionRecording]",Nr="redacted",Dr={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},Fr=["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"],Ar=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Pr=["/s/","/e/","/i/"];function Br(e,t,r,n){if(sr(e))return e;var i=(null==t?void 0:t["content-length"])||new Blob([e]).size;return nr(i)&&(i=parseInt(i)),i>r?Lr+" "+n+" body too large to record ("+i+" bytes)":e}function Ur(e,t){if(sr(e))return e;var r=e;return function(e){if(sr(e))return!1;if(nr(e)){if(e=e.trim(),xr.test((e||"").replace(/[- ]/g,"")))return!1;if(Or.test(e))return!1}return!0}(r)||(r=Lr+" "+t+" body "+Nr),fr(Ar,e=>{var n,i;null!=(n=r)&&n.length&&-1!==(null==(i=r)?void 0:i.indexOf(e))&&(r=Lr+" "+t+" body "+Nr+" as might contain: "+e)}),r}var Wr=pr("[Recorder]"),Hr=e=>"navigation"===e.entryType,qr=e=>"resource"===e.entryType;function zr(e,t){return!!t&&(or(t)||t[e])}function $r(e){var{type:t,recordBody:r,headers:n,url:i}=e;function s(e){var t=Object.keys(n).find(e=>"content-type"===e.toLowerCase()),r=t&&n[t];return e.some(e=>null==r?void 0:r.includes(e))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:t instanceof Request&&e(t.url)}catch(r){return!1}}(i))return!1;if(or(r))return!0;if(Qt(r))return s(r);var a=r[t];return or(a)?a:s(a)}function jr(e,t,r,n,i,s){return Gr.apply(this,arguments)}function Gr(){return Gr=t(function*(e,t,r,n,i,s){return void 0===s&&(s=0),s>10?(Wr.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null):function(e){for(var r=e.length-1;r>=0;r-=1)if(qr(s=e[r])&&s.initiatorType===t&&(rr(n)||s.startTime>=n)&&(rr(i)||i>=s.startTime))return e[r];var s}(e.performance.getEntriesByName(r))||(yield new Promise(e=>setTimeout(e,50*s)),jr(e,t,r,n,i,s+1))}),Gr.apply(this,arguments)}function Vr(e){var{body:t,options:r,url:n}=e;if(sr(t))return null;var{hostname:i,isHostDenied:s}=br(n,r);if(s)return i+" is in deny list";if(nr(t))return t;if((e=>e instanceof Document)(t))return t.textContent;if(lr(t))return function(e,t){var r,n;void 0===t&&(t="&");var i=[];return fr(e,function(e,t){rr(e)||rr(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),i[i.length]=n+"="+r)}),i.join(t)}(t);if(tr(t))try{return JSON.stringify(t)}catch(a){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}function Zr(e){var{entry:t,method:n,status:i,networkRequest:s,isInitial:a,start:o,end:l,url:u,initiatorType:d}=e;o=t?t.startTime:o,l=t?t.responseEnd:l;var c=Math.floor(Date.now()-performance.now()),h=Math.floor(c+(o||0)),p=[r({},t?t.toJSON():{name:u},{startTime:rr(o)?void 0:Math.round(o),endTime:rr(l)?void 0:Math.round(l),timeOrigin:c,timestamp:h,method:n,initiatorType:d||(t?t.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:a})];if((e=>!ir(e)&&("navigation"===e.entryType||"resource"===e.entryType))(t))for(var f of t.serverTiming||[])p.push({timeOrigin:c,timestamp:h,startTime:Math.round(t.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return p}var Jr=["video/","audio/"];function Yr(e){return new Promise(t=>{var r=setTimeout(()=>t("[SessionReplay] Timeout while trying to read body"),500);try{e.clone().text().then(e=>t(e),e=>t("[SessionReplay] Failed to read body: "+e)).finally(()=>clearTimeout(r))}catch(n){clearTimeout(r),t("[SessionReplay] Failed to read body")}})}function Xr(){return(Xr=t(function*(e){var{r:t,options:r,url:n}=e,{hostname:i,isHostDenied:s}=br(n,r);return s?Promise.resolve(i+" is in deny list"):Yr(t)})).apply(this,arguments)}function Kr(){return(Kr=t(function*(e){var{r:t,options:r,url:n}=e,i=function(e){var t,{r:r,options:n,url:i}=e;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),a=Jr.some(e=>null==s?void 0:s.startsWith(e));if(s&&a)return"Content-Type "+s+" is not supported";var{hostname:o,isHostDenied:l}=br(i,n);return l?o+" is in deny list":null}({r:t,options:r,url:n});return ir(i)?Yr(t):Promise.resolve(i)})).apply(this,arguments)}var Qr=null;function en(e,n,i){if(!("performance"in n))return()=>{};if(Qr)return Wr.warn("Network observer already initialised, doing nothing"),()=>{};var s=i?Object.assign({},Dr,i):Dr,a=t=>{var n=[];t.requests.forEach(e=>{var t=s.maskRequestFn(e);t&&n.push(t)}),n.length>0&&e(r({},t,{requests:n}))},o=function(e,t,r){if(r.recordInitialRequests){var n=t.performance.getEntries().filter(e=>Hr(e)||qr(e)&&r.initiatorTypes.includes(e.initiatorType));e({requests:n.flatMap(e=>Zr({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}var i=new t.PerformanceObserver(t=>{var n=t.getEntries().filter(e=>{return Hr(e)||qr(e)&&r.initiatorTypes.includes(e.initiatorType)&&(t=e,!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType);var t});e({requests:n.flatMap(e=>Zr({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(e=>r.performanceEntryTypeToObserve.includes(e));return i.observe({entryTypes:s}),()=>{i.disconnect()}}(a,n,s),l=()=>{},u=()=>{};return(s.recordHeaders||s.recordBody)&&(l=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var n=zr("request",r.recordHeaders),i=zr("response",r.recordHeaders),s=yr(t.XMLHttpRequest.prototype,"open",s=>function(a,o,l,u,d){void 0===l&&(l=!0);var c,h,p=this,f=new Request(o),m={},g={},v=p.setRequestHeader.bind(p);p.setRequestHeader=(e,t)=>(g[e]=t,v(e,t)),n&&(m.requestHeaders=g);var y=p.send.bind(p);p.send=e=>($r({type:"request",headers:g,url:o,recordBody:r.recordBody})&&(m.requestBody=Vr({body:e,options:r,url:o})),c=t.performance.now(),y(e));var b=()=>{p.removeEventListener("readystatechange",S),p.removeEventListener("error",b),p.removeEventListener("abort",b),p.removeEventListener("timeout",b)},S=()=>{if(p.readyState===p.DONE){b(),h=t.performance.now();var n={};p.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{var t=e.split(": "),r=t.shift(),i=t.join(": ");r&&(n[r]=i)}),i&&(m.responseHeaders=n),$r({type:"response",headers:n,url:o,recordBody:r.recordBody})&&(m.responseBody=Vr({body:p.response,options:r,url:o})),jr(t,"xmlhttprequest",f.url,c,h).then(t=>{var r=Zr({entry:t,method:a,status:null==p?void 0:p.status,networkRequest:m,start:c,end:h,url:o.toString(),initiatorType:"xmlhttprequest"});e({requests:r})}).catch(()=>{})}};p.addEventListener("readystatechange",S),p.addEventListener("error",b),p.addEventListener("abort",b),p.addEventListener("timeout",b),s.call(p,a,o.toString(),l,u,d)});return()=>{s()}}(a,n,s),u=function(e,r,n){if(!n.initiatorTypes.includes("fetch"))return()=>{};var i=zr("request",n.recordHeaders),s=zr("response",n.recordHeaders),a=yr(r,"fetch",a=>{return o=t(function*(t,o){var l,u,d,c=new Request(t,o),h={};try{var p={};c.headers.forEach((e,t)=>{p[t]=e}),i&&(h.requestHeaders=p),$r({type:"request",headers:p,url:t,recordBody:n.recordBody})&&(h.requestBody=yield function(e){return Xr.apply(this,arguments)}({r:c,options:n,url:t})),u=r.performance.now(),l=yield a(c),d=r.performance.now();var f={};return l.headers.forEach((e,t)=>{f[t]=e}),s&&(h.responseHeaders=f),$r({type:"response",headers:f,url:t,recordBody:n.recordBody})&&(h.responseBody=yield function(e){return Kr.apply(this,arguments)}({r:l,options:n,url:t})),l}finally{jr(r,"fetch",c.url,u,d).then(t=>{var r,n=Zr({entry:t,method:c.method,status:null==(r=l)?void 0:r.status,networkRequest:h,start:u,end:d,url:c.url,initiatorType:"fetch"});e({requests:n})}).catch(()=>{})}}),function(e,t){return o.apply(this,arguments)};var o});return()=>{a()}}(a,n,s)),Qr=()=>{o(),l(),u(),Qr=null}}var tn=2,rn=3,nn=4,sn=5,an="disabled",on="sampled",ln="active",un="buffering",dn="paused",cn="rrweb_error",hn="trigger",pn=hn+"_activated",fn=hn+"_pending",mn=hn+"_"+an;function gn(e,t,r){return t.some(t=>{var n;return"regex"===t.matching&&(null!==(n=null==r?void 0:r.get(t.url))&&void 0!==n?n:new RegExp(t.url)).test(e)})}class vn{constructor(e){this.t=e}triggerStatus(e){var t=this.t.map(t=>t.triggerStatus(e));return t.includes(pn)?pn:t.includes(fn)?fn:mn}stop(){this.t.forEach(e=>e.stop())}}class yn{constructor(e){this.t=e}triggerStatus(e){var t=new Set;for(var r of this.t)t.add(r.triggerStatus(e));switch(t.delete(mn),t.size){case 0:return mn;case 1:return Array.from(t)[0];default:return fn}}stop(){this.t.forEach(e=>e.stop())}}class bn{triggerStatus(){return pn}stop(){}}var Sn=e=>"sessionRecording"in e;class wn{constructor(e,t){this.u=[],this.ha=[],this.ca=new Map,this.va=new Map,this.fa="",this.urlBlocked=!1,this._instance=e,this.ga=t}onConfig(e){var t,r;this.u=(Sn(e)?tr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this.ha=(Sn(e)?tr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this.ma()}ma(){for(var e of(this.ca.clear(),this.va.clear(),this.u))if("regex"===e.matching&&!this.ca.has(e.url))try{this.ca.set(e.url,new RegExp(e.url))}catch(r){hr.error("Invalid URL trigger regex pattern:",e.url,r)}for(var t of this.ha)if("regex"===t.matching&&!this.va.has(t.url))try{this.va.set(t.url,new RegExp(t.url))}catch(n){hr.error("Invalid URL blocklist regex pattern:",t.url,n)}}onRemoteConfig(e){this.onConfig(e)}pa(e){var t;return 0===this.u.length?mn:(null==(t=this._instance)?void 0:t.get_property(this.ga?Mr+this.ga:Ir))===e?pn:fn}triggerStatus(e){var t=this.pa(e),r=t===pn?pn:t===fn?fn:mn;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlBlocklist(e,t){if(void 0!==Gt&&Gt.location.href){var r=Gt.location.href;if(r!==this.fa){this.fa=r;var n=this.urlBlocked,i=gn(r,this.ha,this.va);n&&i||(i&&!n?e():!i&&n&&t())}}}checkUrlTriggerConditions(e,t,r,n){if(void 0!==Gt&&Gt.location.href){var i=Gt.location.href;if(i!==this.fa){this.fa=i;var s=this.urlBlocked,a=gn(i,this.ha,this.va);a&&!s?e():!a&&s&&t();var o=this.pa(n)===pn,l=gn(i,this.u,this.ca);!o&&l&&r("url",i)}}}stop(){this.fa=""}}class kn{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ia=()=>{},this._instance=e}triggerStatus(){var e=fn;return sr(this.linkedFlag)&&(e=mn),this.linkedFlagSeen&&(e=pn),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onConfig(e,t){var r;if(this.linkedFlag=(Sn(e)?tr(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!sr(this.linkedFlag)&&!this.linkedFlagSeen){var n=nr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=nr(this.linkedFlag)?null:this.linkedFlag.variant;this.Ia=this._instance.onFeatureFlags((e,r)=>{var s=!1;if(tr(r)&&n in r){var a=r[n];s=or(a)?!0===a:i?a===i:!!a}this.linkedFlagSeen=s,s&&t(n,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this.Ia()}}class In{constructor(e,t){this.ya=[],this._instance=e,this.ga=t}onConfig(e){var t;this.ya=(Sn(e)?tr(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}ba(e){var t;return 0===this.ya.length?mn:(null==(t=this._instance)?void 0:t.get_property(this.ga?Cr+this.ga:_r))===e?pn:fn}triggerStatus(e){var t=this.ba(e),r=t===pn?pn:t===fn?fn:mn;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}checkEventTriggerConditions(e,t,r){if(0!==this.ya.length){var n=this.ba(r)===pn,i=this.ya.includes(e);!n&&i&&t("event",e)}}stop(){}}class _n{constructor(e,t,r){if(this._instance=e,this.group=t,this.Ca=new wn(e,t.id),this.wa=new In(e,t.id),this.Sa=new kn(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var n=(t.conditions.events||[]).map(e=>e.name),i={urlTriggers:t.conditions.urls||[],eventTriggers:n,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this.Ca.onConfig(i),this.wa.onConfig(i),this.Sa.onConfig(i,r);var s=[this.wa,this.Ca,this.Sa];this.ka="any"===t.conditions.matchType?new vn(s):new yn(s)}else this.ka=new bn}triggerStatus(e){return this.ka.triggerStatus(e)}checkEventTriggerConditions(e,t,r){this.wa.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,n){this.Ca.checkUrlTriggerConditions(e,t,r,n)}activateTrigger(e,t){var r;null==(r=this._instance.persistence)||r.register({["url"===e?Mr+this.group.id:Cr+this.group.id]:t})}stop(){this.Ca.stop(),this.wa.stop(),this.Sa.stop()}}function Cn(e){if(e.rrwebError)return cn;if(!e.receivedFlags)return un;if(!e.isRecordingEnabled)return an;if(e.urlTriggerMatching.urlBlocked)return dn;var t=!0===e.isSampled,r=new vn([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?on:r===pn?ln:r===fn?un:!1===e.isSampled?an:ln}function Mn(e){if(e.rrwebError)return cn;if(!e.receivedFlags)return un;if(!e.isRecordingEnabled)return an;if(e.urlTriggerMatching.urlBlocked)return dn;var t=new yn([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==mn,n=or(e.isSampled);return r&&t===fn?un:r&&t===mn||n&&!e.isSampled?an:!0===e.isSampled?on:ln}function Tn(e){var t,r;return(null==(t=JSON.stringify(e,(r=[],function(e,t){if(tr(t)){for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(t)?"[Circular]":(r.push(t),t)}return t})))?void 0:t.length)||0}function Rn(e){if(ir(e))return 4;if(rr(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(Qt(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var n=e[r];t+=rr(n)||ir(n)?4:Rn(n)}return t}var i=e,s=2,a=!0;for(var o in i)if({}.hasOwnProperty.call(i,o)){var l=i[o];rr(l)||(a||(s+=1),a=!1,s+=o.length+3+Rn(l))}return s;default:return 0}}var En=Uint8Array,xn=Uint16Array,On=Uint32Array,Ln=new En([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]),Nn=new En([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]),Dn=new En([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fn=function(e,t){for(var r=new xn(31),n=0;31>n;++n)r[n]=t+=1<<e[n-1];var i=new On(r[30]);for(n=1;30>n;++n)for(var s=r[n];r[n+1]>s;++s)i[s]=s-r[n]<<5|n;return[r,i]},An=Fn(Ln,2),Pn=An[1];An[0][28]=258,Pn[258]=28;for(var Bn=Fn(Nn,0)[1],Un=new xn(32768),Wn=0;32768>Wn;++Wn){var Hn=(43690&Wn)>>>1|(21845&Wn)<<1;Un[Wn]=((65280&(Hn=(61680&(Hn=(52428&Hn)>>>2|(13107&Hn)<<2))>>>4|(3855&Hn)<<4))>>>8|(255&Hn)<<8)>>>1}var qn=function(e,t,r){for(var n=e.length,i=0,s=new xn(t);n>i;++i)++s[e[i]-1];var a,o=new xn(t);for(i=0;t>i;++i)o[i]=o[i-1]+s[i-1]<<1;for(a=new xn(n),i=0;n>i;++i)a[i]=Un[o[e[i]-1]++]>>>15-e[i];return a},zn=new En(288);for(Wn=0;144>Wn;++Wn)zn[Wn]=8;for(Wn=144;256>Wn;++Wn)zn[Wn]=9;for(Wn=256;280>Wn;++Wn)zn[Wn]=7;for(Wn=280;288>Wn;++Wn)zn[Wn]=8;var $n=new En(32);for(Wn=0;32>Wn;++Wn)$n[Wn]=5;var jn=qn(zn,9),Gn=qn($n,5),Vn=function(e){return(e/8|0)+(7&e&&1)},Zn=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof xn?xn:e instanceof On?On:En)(r-t);return n.set(e.subarray(t,r)),n},Jn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8},Yn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8,e[n+2]|=r>>>16},Xn=function(e,t){for(var r=[],n=0;e.length>n;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return[new En(0),0];if(1==i){var a=new En(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var o=r[0],l=r[1],u=0,d=1,c=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=i-1;)o=r[r[c].f>r[u].f?u++:c++],l=r[u!=d&&r[c].f>r[u].f?u++:c++],r[d++]={s:-1,f:o.f+l.f,l:o,r:l};var h=s[0].s;for(n=1;i>n;++n)s[n].s>h&&(h=s[n].s);var p=new xn(h+1),f=Kn(r[d-1],p,0);if(f>t){n=0;var m=0,g=f-t,v=1<<g;for(s.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});i>n;++n){var y=s[n].s;if(t>=p[y])break;m+=v-(1<<f-p[y]),p[y]=t}for(m>>>=g;m>0;){var b=s[n].s;t>p[b]?m-=1<<t-p[b]++-1:++n}for(;n>=0&&m;--n){var S=s[n].s;p[S]==t&&(--p[S],++m)}f=t}return[new En(p),f]},Kn=function(e,t,r){return-1==e.s?Math.max(Kn(e.l,t,r+1),Kn(e.r,t,r+1)):t[e.s]=r},Qn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new xn(++t),n=0,i=e[0],s=1,a=function(e){r[n++]=e},o=1;t>=o;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&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(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return[r.subarray(0,n),t]},ei=function(e,t){for(var r=0,n=0;t.length>n;++n)r+=e[n]*t[n];return r},ti=function(e,t,r){var n=r.length,i=Vn(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;n>s;++s)e[i+s+4]=r[s];return 8*(i+4+n)},ri=function(e,t,r,n,i,s,a,o,l,u,d){Jn(t,d++,r),++i[256];for(var c=Xn(i,15),h=c[0],p=c[1],f=Xn(s,15),m=f[0],g=f[1],v=Qn(h),y=v[0],b=v[1],S=Qn(m),w=S[0],k=S[1],I=new xn(19),_=0;y.length>_;++_)I[31&y[_]]++;for(_=0;w.length>_;++_)I[31&w[_]]++;for(var C=Xn(I,7),M=C[0],T=C[1],R=19;R>4&&!M[Dn[R-1]];--R);var E,x,O,L,N=u+5<<3,D=ei(i,zn)+ei(s,$n)+a,F=ei(i,h)+ei(s,m)+a+14+3*R+ei(I,M)+(2*I[16]+3*I[17]+7*I[18]);if(D>=N&&F>=N)return ti(t,d,e.subarray(l,l+u));if(Jn(t,d,1+(D>F)),d+=2,D>F){E=qn(h,p),x=h,O=qn(m,g),L=m;var A=qn(M,T);for(Jn(t,d,b-257),Jn(t,d+5,k-1),Jn(t,d+10,R-4),d+=14,_=0;R>_;++_)Jn(t,d+3*_,M[Dn[_]]);d+=3*R;for(var P=[y,w],B=0;2>B;++B){var U=P[B];for(_=0;U.length>_;++_)Jn(t,d,A[W=31&U[_]]),d+=M[W],W>15&&(Jn(t,d,U[_]>>>5&127),d+=U[_]>>>12)}}else E=jn,x=zn,O=Gn,L=$n;for(_=0;o>_;++_)if(n[_]>255){var W;Yn(t,d,E[257+(W=n[_]>>>18&31)]),d+=x[W+257],W>7&&(Jn(t,d,n[_]>>>23&31),d+=Ln[W]);var H=31&n[_];Yn(t,d,O[H]),d+=L[H],H>3&&(Yn(t,d,n[_]>>>5&8191),d+=Nn[H])}else Yn(t,d,E[n[_]]),d+=x[n[_]];return Yn(t,d,E[256]),d+x[256]},ni=new On([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ii=function(){for(var e=new On(256),t=0;256>t;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),si=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};class ai{constructor(e,t){var r,n;void 0===t&&(t={}),this.Aa={},this._a=e=>{if(!this.Aa[e]){var t,r;this.Aa[e]=!0;var n=this.Ra(e);null==(t=(r=this.Na).onBlockedNode)||t.call(r,e,n)}},this.Ta=e=>{var t=this.Ra(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this.Ra=e=>this._rrweb.mirror.getNode(e),this.Ma=e=>{var t,r,n,i,s,a,o,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(n=null==(i=e.attributes)?void 0:i.length)&&void 0!==n?n:0)+(null!==(s=null==(a=e.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(l=e.adds)?void 0:l.length)&&void 0!==o?o:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this.Ma(t);t.attributes&&(t.attributes=t.attributes.filter(e=>{var[t]=this.Ta(e.id);return!this.io.consumeRateLimit(t)&&e}));var n=this.Ma(t);return 0!==n||r===n?e:void 0},this._rrweb=e,this.Na=t,this.io=new dr({bucketSize:null!==(r=this.Na.bucketSize)&&void 0!==r?r:100,refillRate:null!==(n=this.Na.refillRate)&&void 0!==n?n:10,refillInterval:1e3,Dt:this._a,qt:hr})}reset(){this.Aa={}}stop(){this.io.stop(),this.reset()}}var oi="$sess_rec_flush_size";class li{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Fa=e.get_property.bind(e),this.xa=e.persistence.set_property.bind(e.persistence)}trackSize(e){var t=Number(this.Fa(oi))||0;this.xa(oi,t+e)}reset(){return this.xa(oi,0)}get currentTrackedSize(){return Number(this.Fa(oi))||0}}function ui(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<ur(100*t,0,100,hr)}var di=function(e,t){if(!function(e){try{new RegExp(e)}catch(t){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(r){return!1}},ci={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>di(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!di(t,e))),icontains:(e,t)=>t.map(hi).some(t=>e.map(hi).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(hi).every(t=>e.map(hi).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})},hi=e=>e.toLowerCase(),pi=new Set(["is_not","not_icontains","not_regex"]);function fi(e,t,r){return!e||0===e.length||e.every(e=>{var n="person"===e.type?r:t,i=null==n?void 0:n[e.key],s=e.operator||"exact";if(rr(i)||ir(i))return pi.has(s);var a=ci[s];return!!a&&!rr(e.value)&&!ir(e.value)&&a(Qt(e.value)?e.value.map(String):[String(e.value)],Qt(i)?i.map(String):[String(i)])})}var mi=pr("[SessionRecording]");class gi{constructor(e,t,r,n,i,s){this.Ba=null,this.Oa=Mn,this._instance=e,this.Ca=t,this.wa=r,this.Sa=n,this.Za=i,this.Ya=s}onRemoteConfig(e){this.Ba=ar(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this.Ea=new vn([this.wa,this.Ca]),this.Oa=Cn):(this.Ea=new yn([this.wa,this.Ca]),this.Oa=Mn),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:e.triggerMatchType}),this.Ca.onConfig(e),this.wa.onConfig(e),this.Sa.onConfig(e,(e,t)=>{this.Za("linked_flag_matched",{flag:e,variant:t})})}getStatus(e){return this.Oa({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t=this._instance.get_property("$session_recording_remote_config"),r=null==t?void 0:t.minimumDurationMilliseconds;return ar(r)?r:null}checkUrlTriggers(e,t,r,n){this.Ca.checkUrlTriggerConditions(t,r,n,e)}setupEventTriggerListeners(e,t,r){if(0!==this.wa.ya.length&&sr(this.Ga))return this.Ga=e(e=>{try{this.wa.checkEventTriggerConditions(e.event,r,t)}catch(n){mi.error("Could not activate event trigger",n)}}),this.Ga}makeSamplingDecisions(e){var t,r=this.Ba;if(ar(r)){var n=this._instance.get_property(wr),i=n===e||!1!==n&&null,s="string"==typeof n&&n!==e||!or(i),a=s?ui(e,r):i;s&&(a?this.Za("sampled"):mi.warn("Sample rate ("+r+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[wr]:!!a&&e})}else{var o;null==(o=this._instance.persistence)||o.unregister(wr)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,n;null==(e=this._instance.persistence)||e.unregister(_r),null==(t=this._instance.persistence)||t.unregister(Ir),null==(r=this._instance.persistence)||r.unregister(wr),null==(n=this._instance.persistence)||n.unregister(kr)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this.Ea)?void 0:t.triggerStatus(e))===fn}stop(){var e;null==(e=this.Ga)||e.call(this),this.Ga=void 0,this.wa.stop(),this.Ca.stop(),this.Sa.stop()}}class vi{constructor(e,t,r,n){this.La=[],this.Da=new Map,this.Wa=!1,this._instance=e,this.Ca=t,this.Za=r,this.Va=n}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this.Xa(e.triggerGroups),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:e.triggerGroups.length}),this.Ca.onConfig(e)):mi.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return cn;if(e.urlTriggerMatching.urlBlocked)return dn;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return an;var n=!1,i=!1;for(var s of t){var a=s.triggerStatus(e.sessionId);if(a===pn){var o=s.group.id,l=r.get(o);rr(l)?hr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===l&&(i=!0)}else a===fn&&(n=!0)}return i?on:n?un:an}({isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this.La,triggerGroupSamplingResults:this.Da,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this.La)if("trigger_activated"===r.triggerStatus(e)){var n=r.group.minDurationMs;ar(n)&&(ir(t)||t>n)&&(t=n)}return t}checkUrlTriggers(e,t,r,n){var i=this;this.Ca.checkUrlBlocklist(t,r);var s=function(n){n.checkUrlTriggerConditions(t,r,t=>{i.za(n,void 0)&&(n.activateTrigger(t,e),i.updateActiveTriggers(e))},e)};for(var a of this.La)s(a)}setupEventTriggerListeners(e,t,r){var n=this;return this.Ga=e(e=>{var r;if(this.Wa)return mi.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Ga)||r.call(this),void(this.Ga=void 0);try{var i=function(r){r.checkEventTriggerConditions(e.event,i=>{if(n.za(r,e.properties)){var s=(r.group.conditions.events||[]).filter(t=>t.name===e.event),a=n._instance.get_property(Er);s.some(t=>!t.properties||0===t.properties.length||fi(t.properties,e.properties,a))&&(r.activateTrigger(i,t),n.updateActiveTriggers(t))}},t)};for(var s of this.La)i(s)}catch(a){mi.error("Could not activate event trigger for trigger groups",a)}}),this.Ga}makeSamplingDecisions(e){for(var t of this.La){var r,n=t.group,i=n.id,s=n.sampleRate,a=Tr+i,o=this._instance.get_property(a),l=o===e||!1!==o&&null,u="string"==typeof o&&o!==e||!or(l),d=u?ui(e+i,s):l;u&&this.Va("triggerGroupSamplingDecisionMade",{group_id:i,group_name:n.name,sampleRate:s,isSampled:d}),this.Da.set(i,d),null==(r=this._instance.persistence)||r.register({[a]:!!d&&e})}this.updateActiveTriggers(e)}onFlushComplete(){this.Wa=!0}clearConditionalRecordingPersistence(){var e,t;for(var r of(null==(e=this._instance.persistence)||e.unregister(wr),null==(t=this._instance.persistence)||t.unregister(kr),this.La)){var n,i,s,a=r.group.id;null==(n=this._instance.persistence)||n.unregister(Cr+a),null==(i=this._instance.persistence)||i.unregister(Mr+a),null==(s=this._instance.persistence)||s.unregister(Tr+a)}}updateActiveTriggers(e){var t=[];for(var r of this.La){var n=r.group,i=n.id,s="trigger_activated"===r.triggerStatus(e),a=!0===this.Da.get(i);s&&t.push({id:i,name:n.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:t})}hasPendingTriggers(e){for(var t of this.La)if(t.triggerStatus(e)===fn)return!0;return!1}stop(){var e;null==(e=this.Ga)||e.call(this),this.Ga=void 0,this.La.forEach(e=>e.stop()),this.La=[],this.Da.clear(),this.Ca.stop()}za(e,t){var r=e.group.conditions.properties;return!r||0===r.length||fi(r,t,this._instance.get_property(Er))}Xa(e){var t=this;this.La.forEach(e=>e.stop()),this.La=[],this.Da.clear();var r=function(e){var r=new _n(t._instance,e,(r,n)=>{t.Za("linked_flag_matched",{flag:r,variant:n,group_id:e.id,group_name:e.name})});t.La.push(r)};for(var n of e)r(n)}}function yi(e){return tr(e)?e.network_timing:e}var bi,Si="[SessionRecording]",wi=pr(Si),ki=[1,2,3,4,5,6,7,12],Ii=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function _i(){var e;return null==Jt||null==(e=Jt.__PosthogExtensions__)?void 0:e.rrweb}function Ci(){var e;return null==(e=_i())?void 0:e.record}function Mi(e){return function(e){for(var t="",r=0;e.length>r;){var n=e[r++];t+=String.fromCharCode(n)}return t}(function(e,t){void 0===t&&(t={});var r=function(){var e=4294967295;return{p(t){for(var r=e,n=0;t.length>n;++n)r=ii[255&r^t[n]]^r>>>8;e=r},d:()=>4294967295^e}}(),n=e.length;r.p(e);var i=function(e,t,r,n){return function(e,t,r,n,i){var s=e.length,a=new En(n+s+5*(1+Math.floor(s/7e3))+i),o=a.subarray(n,a.length-i),l=0;if(!t||8>s)for(var u=0;s>=u;u+=65535){var d=u+65535;s>d?l=ti(o,l,e.subarray(u,d)):(o[u]=!0,l=ti(o,l,e.subarray(u,s)))}else{for(var c=ni[t-1],h=c>>>13,p=8191&c,f=(1<<r)-1,m=new xn(32768),g=new xn(f+1),v=Math.ceil(r/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&f},S=new On(25e3),w=new xn(288),k=new xn(32),I=0,_=0,C=(u=0,0),M=0,T=0;s>u;++u){var R=b(u),E=32767&u,x=g[R];if(m[E]=x,g[R]=E,u>=M){var O=s-u;if((I>7e3||C>24576)&&O>423){l=ri(e,o,0,S,w,k,_,C,T,u-T,l),C=I=_=0,T=u;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var N=2,D=0,F=p,A=E-x&32767;if(O>2&&R==b(u-A))for(var P=Math.min(h,O)-1,B=Math.min(32767,u),U=Math.min(258,O);B>=A&&--F&&E!=x;){if(e[u+N]==e[u+N-A]){for(var W=0;U>W&&e[u+W]==e[u+W-A];++W);if(W>N){if(N=W,D=A,W>P)break;var H=Math.min(A,W-2),q=0;for(L=0;H>L;++L){var z=u-A+L+32768&32767,$=z-m[z]+32768&32767;$>q&&(q=$,x=z)}}}A+=(E=x)-(x=m[E])+32768&32767}if(D){S[C++]=268435456|Pn[N]<<18|Bn[D];var j=31&Pn[N],G=31&Bn[D];_+=Ln[j]+Nn[G],++w[257+j],++k[G],M=u+N,++I}else S[C++]=e[u],++w[e[u]]}}l=ri(e,o,!0,S,w,k,_,C,T,u-T,l)}return Zn(a,0,n+Vn(l)+i)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n)}(e,t,function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),8),s=i.length;return function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&si(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;r.length>=n;++n)e[n+10]=r.charCodeAt(n)}}(i,t),si(i,s-8,r.d()),si(i,s-4,n),i}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new En(e.length+(e.length>>>1)),n=0,i=function(e){r[n++]=e},s=0;t>s;++s){if(n+5>r.length){var a=new En(n+8+(t-s<<1));a.set(r),r=a}var o=e.charCodeAt(s);128>o?i(o):2048>o?(i(192|o>>>6),i(128|63&o)):o>55295&&57344>o?(i(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++s))>>>18),i(128|o>>>12&63),i(128|o>>>6&63),i(128|63&o)):(i(224|o>>>12),i(128|o>>>6&63),i(128|63&o))}return Zn(r,0,n)}(JSON.stringify(e))))}function Ti(e){return Qt(e)&&0===e.length?bi=null!=bi?bi:Mi([]):Mi(e)}function Ri(e,t){return e.type===sn&&e.data.tag===t}function Ei(e){return Ri(e,"sessionIdle")}function xi(e){return Ri(e,"$session_ending")}function Oi(e){return Ri(e,"$session_starting")}function Li(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),n=e.sizes.slice(0,r),i=e.sizes.slice(r);return[Li({size:n.reduce((e,t)=>e+t,0),data:e.data.slice(0,r),sizes:n,sessionId:e.sessionId,windowId:e.windowId}),Li({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(r),sizes:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}class Ni{get sessionId(){return this.nr}get Ja(){if(!this._instance.sessionManager)throw new Error(Si+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Ka(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get Ha(){var e=this._instance.get_property(wr);return!0===e?null:!1!==e&&(nr(e)?e===this.sessionId:null)}get Ba(){var e,t=null==(e=this.Do)?void 0:e.sampleRate;return ar(t)?t:null}get ja(){var e,t;return null!==(e=null==(t=this.Ua)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e){this.Pa="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.qa=void 0,this.Qa=Date.now(),this.$a=!1,this.tu=[],this.eu="unknown",this.ru=!1,this.iu=!1,this.nu=[],this.su=void 0,this.Ga=void 0,this.ou=void 0,this.au=void 0,this.lu=void 0,this.uu=void 0,this.Yi=(e,t,r)=>{var n,i;if(r&&(e!==this.nr||t!==this.rr)){var s,a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this.nr,u=this.rr;o&&this.Va("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this.Qa,flushed_size:null==(s=this.hu)?void 0:s.currentTrackedSize}),this.hu&&this.hu.reset(),null==(n=this._instance.persistence)||n.unregister(Rr),this.iu=!1,null==(i=_i())||null==i.resetMaxDepthState||i.resetMaxDepthState(),this.Va("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this.du(),!0===this.eu&&(this.eu="unknown",this.stop(),this.start("session_id_changed")),o&&this.Va("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this.Qa}),ar(this.Ba)&&sr(this.lu)&&(null==(a=this.Ua)||a.makeSamplingDecisions(e))}},this.cu=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[kr])===this.nr},this.vu=()=>{var e,t;if(0===this.T.data.length)return null;var r=null==(e=this.T.data[0])?void 0:e.timestamp,n=null==(t=this.T.data[this.T.data.length-1])?void 0:t.timestamp;return ar(r)&&ar(n)?n-r:null},this.fu=()=>{var e,t,r=this.ja;if(!ar(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var n=this.gu;return ar(n)&&n>=0&&r>n}if(this.cu())return!1;var i,s=this.vu();return!!ir(s)||r>s||(null==(i=this._instance.persistence)||i.register({[kr]:this.nr}),!1)},this.mu=()=>{this.status!==un?this.pu():this.Iu()},this.yu=()=>{this.Va("browser offline",{})},this.bu=()=>{this.Va("browser online",{})},this.Tt=()=>{null!=Zt&&Zt.visibilityState&&this.Va("window "+Zt.visibilityState,{})},this._instance=e;var{sessionId:t,windowId:r}=this.Ja.checkAndGetSessionAndWindowId();this.nr=t,this.rr=r,this.Sa=new kn(this._instance),this.Ca=new wn(this._instance),this.wa=new In(this._instance),this.T=this.Iu(),this.Ja.sessionTimeoutMs>this.Ka||wi.warn("session_idle_threshold_ms ("+this.Ka+") is greater than the session timeout ("+this.Ja.sessionTimeoutMs+"). Session will never be detected as idle"),this.hu=new li(this._instance)}get Cu(){var e,t,r,n,i,s,a,o=null==(e=this.Do)?void 0:e.masking,l={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(n=this._instance.config.session_recording)?void 0:n.blockSelector},u=null!==(i=null==l?void 0:l.maskAllInputs)&&void 0!==i?i:null==o?void 0:o.maskAllInputs,d=null!==(s=null==l?void 0:l.maskTextSelector)&&void 0!==s?s:null==o?void 0:o.maskTextSelector,c=null!==(a=null==l?void 0:l.blockSelector)&&void 0!==a?a:null==o?void 0:o.blockSelector;return rr(u)&&rr(d)&&rr(c)?void 0:{maskAllInputs:null==u||u,maskTextSelector:d,blockSelector:c}}get wu(){var e,t,r,n,i,s,a,o=this._instance.config.session_recording.captureCanvas,l=null==(e=this.Do)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,d=null!==(n=null!==(i=null==o?void 0:o.canvasFps)&&void 0!==i?i:null==l?void 0:l.fps)&&void 0!==n?n:4,c=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof c){var h=parseFloat(c);c=isNaN(h)?.4:h}return{enabled:u,fps:ur(d,0,12,pr("canvas recording fps"),4),quality:ur(c,0,1,pr("canvas recording quality"),.4)}}get Su(){var e,t=!(null==(e=this.Do)||!e.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:t}get ku(){var e,t,r,n=null==(e=this.Do)?void 0:e.networkPayloadCapture,i={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==i?void 0:i.recordHeaders)||(null==n?void 0:n.recordHeaders),a=(null==i?void 0:i.recordBody)||(null==n?void 0:n.recordBody),o=yi(this._instance.config.capture_performance),l=yi(null==n?void 0:n.capturePerformance),u=!!(or(o)?o:l);return s||a||u?{recordHeaders:s,recordBody:a,recordPerformance:u}:void 0}Au(){var e,t,n=[],i=null==(e=Jt.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;i&&this.Su&&n.push(i());var s,a,o,l,u,d,c,h,p,f,m,g=null==(t=Jt.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;return this.ku&&er(g)&&(!gr.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(g((u={payloadSizeLimitBytes:Dr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Dr.performanceEntryTypeToObserve],payloadHostDenyList:[...(a=this.ku).payloadHostDenyList||[],...Dr.payloadHostDenyList]},d=!1!==(s=this._instance.config).session_recording.recordHeaders&&a.recordHeaders,c=!1!==s.session_recording.recordBody&&a.recordBody,h=!1!==s.capture_performance&&a.recordPerformance,l=Math.min(1e6,null!==(o=u.payloadSizeLimitBytes)&&void 0!==o?o:1e6),p=e=>(null!=e&&e.requestBody&&(e.requestBody=Br(e.requestBody,e.requestHeaders,l,"Request")),null!=e&&e.responseBody&&(e.responseBody=Br(e.responseBody,e.responseHeaders,l,"Response")),e),f=e=>{return p(((e,t)=>{var r,n=vr(e.name),i=0===t.indexOf("http")?null==(r=vr(t))?void 0:r.pathname:t;"/"===i&&(i="");var s=null==n?void 0:n.pathname.replace(i||"","");if(!(n&&s&&Pr.some(e=>0===s.indexOf(e))))return e})((sr(r=(t=e).requestHeaders)||fr(Object.keys(null!=r?r:{}),e=>{Fr.includes(e.toLowerCase())&&(r[e]=Nr)}),t),s.api_host));var t,r},(m=er(s.session_recording.maskNetworkRequestFn))&&er(s.session_recording.maskCapturedNetworkRequestFn)&&hr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),m&&(s.session_recording.maskCapturedNetworkRequestFn=e=>{var t=s.session_recording.maskNetworkRequestFn({url:e.name});return r({},e,{name:null==t?void 0:t.url})}),u.maskRequestFn=er(s.session_recording.maskCapturedNetworkRequestFn)?e=>{var t,r=f(e);return r&&null!==(t=null==s.session_recording.maskCapturedNetworkRequestFn?void 0:s.session_recording.maskCapturedNetworkRequestFn(r))&&void 0!==t?t:void 0}:e=>function(e){if(!rr(e))return e.requestBody=Ur(e.requestBody,"Request"),e.responseBody=Ur(e.responseBody,"Response"),e}(f(e)),r({},Dr,u,{recordHeaders:d,recordBody:c,recordPerformance:h,recordInitialRequests:h})))):wi.info("NetworkCapture not started because we are on localhost.")),n}_u(e){var t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var r,n=t.maskCapturedNetworkRequestFn({name:e});return null!==(r=null==n?void 0:n.name)&&void 0!==r?r:null==n?void 0:n.url}if(t.maskNetworkRequestFn){var i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return e}Ru(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this.tu.length?this.tu.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):wi.warn("could not emit queued rrweb event.",t,e),!1}}Va(e,t){return this.Ru(Ii(()=>Ci().addCustomEvent(e,t)))}Nu(){try{if(this._instance.config.capture_pageview||!Gt)return;var e=new URL(Gt.location.href),t=this._u(e.origin+e.pathname+e.search);this.Tu!==t&&(this.Tu=t,this.Va("$url_changed",{href:t}))}catch(r){}}Mu(){if(this.tu.length){var e=[...this.tu];this.tu=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this.Ru(e)})}}Ya(){return this.Ru(Ii(()=>Ci().takeFullSnapshot()))}get Fu(){var e,t,r;return null!=(e=this.Ua)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)?6e4:null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}xu(){if(this.Bu&&clearInterval(this.Bu),!0!==this.eu){var e=this.Fu;e&&(this.Bu=setInterval(()=>{this.Ya()},e))}}Ou(){this.Ca.urlBlocked||(this.Ca.urlBlocked=!0,clearInterval(this.Bu),wi.info("recording paused due to URL blocker"),this.Va("recording paused",{reason:"url blocker"}))}Zu(){this.Ca.urlBlocked&&(this.Ca.urlBlocked=!1,this.Ya(),this.xu(),this.Va("recording resumed",{reason:"left blocked url"}),wi.info("recording resumed"))}Yu(e,t){var r;if(!this.$a&&null!=(r=this.Ua)&&r.hasPendingTriggers(this.sessionId)){this.$a=!0;try{var n,i;null==(n=this._instance.persistence)||n.register({["url"===e?Ir:_r]:this.sessionId}),null==(i=this.Ua)||i.updateActiveTriggers(this.sessionId),this.pu(),this.Za(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this.$a=!1}}}get isStarted(){return!!this.qa}get Do(){var e=this._instance.get_property(Sr);if(e){var t=tr(e)?e:JSON.parse(e);if(!this.isStarted){var r,n,i=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-i>36e5)return wi.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:i,persistedConfig:e}),void(null==(n=this._instance.persistence)||n.unregister(Sr))}return t}}Eu(e,t){var r;this._instance.get_property(e)&&(t(),null==(r=this._instance.persistence)||r.unregister(e))}start(e){var t,r,n=this.Do;if(n){var{sessionId:i,windowId:s}=this.Ja.checkAndGetSessionAndWindowId();this.nr=i,this.rr=s,null==(t=this._instance.persistence)||t.unregister(Rr),null!=n&&n.endpoint&&(this.Pa=null==n?void 0:n.endpoint),this.Ua=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new vi(this._instance,this.Ca,this.Za.bind(this),this.Va.bind(this)):new gi(this._instance,this.Ca,this.wa,this.Sa,this.Za.bind(this),this.Ya.bind(this)),this.Ua.onRemoteConfig(n),null==(r=this.Ga)||r.call(this),this.Ga=this.Ua.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this.Yu(e,t)),this.Eu("$replay_override_sampling",()=>{this.overrideSampling()}),this.Eu("$replay_override_linked_flag",()=>{this.overrideLinkedFlag()}),this.Eu("$replay_override_event_trigger",()=>{this.overrideTrigger("event")}),this.Eu("$replay_override_url_trigger",()=>{this.overrideTrigger("url")}),this.Ua.makeSamplingDecisions(this.sessionId),this.Gu(),this.ru||(mr(Gt,"beforeunload",this.mu),mr(Gt,"offline",this.yu),mr(Gt,"online",this.bu),mr(Gt,"visibilitychange",this.Tt),this.ou||(this.ou=this.Ja.onSessionId(this.Yi)),this.au||(this.au=this.Ja.on("forcedIdleReset",()=>{this.du(),this.eu="unknown",this.stop(),this.uu=this.Ja.onSessionId((e,t,r)=>{var n;null==(n=this.uu)||n.call(this),this.uu=void 0,this.Yi(e,t,r)})})),sr(this.su)&&(this.su=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._u(null==e?void 0:e.properties.$current_url):"";if(!t)return;this.Va("$pageview",{href:t})}}catch(r){wi.error("Could not add $pageview to rrweb session",r)}})),this.status===ln&&this.Za(e||"recording_initialized"))}else wi.info("remote config must be stored in persistence before recording can start")}Lu(){var e,t,r,n,i,s,a,o,l;null==Gt||Gt.removeEventListener("beforeunload",this.mu),null==Gt||Gt.removeEventListener("offline",this.yu),null==Gt||Gt.removeEventListener("online",this.bu),null==Gt||Gt.removeEventListener("visibilitychange",this.Tt),clearInterval(this.Bu),this.Du(),null==(e=this.su)||e.call(this),this.su=void 0,null==(t=this.Ga)||t.call(this),this.Ga=void 0,null==(r=this.ou)||r.call(this),this.ou=void 0,null==(n=this.au)||n.call(this),this.au=void 0,null==(i=this.lu)||i.call(this),this.lu=void 0,null==(s=this.uu)||s.call(this),this.uu=void 0,null==(a=this.Ua)||a.stop(),null==(o=this.Wu)||o.stop(),this.tu=[],null==(l=this.qa)||l.call(this),this.qa=void 0}stop(){this.pu(),this.Iu(),this.Lu(),wi.info("stopped")}discard(){this.Iu(),this.Lu(),wi.info("discarded")}onRRwebEmit(e){var t,n,i,s,a,o,l,u,d;if(this.Mu(),e&&tr(e)){if(e.type===nn){var c=this._u(e.data.href);if(this.Tu=c,!c)return;e.data.href=c}else this.Nu();if(null==(t=this.Ua)||t.checkUrlTriggers(this.sessionId,()=>this.Ou(),()=>this.Zu(),(e,t)=>this.Yu(e,t)),!this.Ca.urlBlocked||(h=e).type===sn&&"recording paused"===h.data.tag){var h,p,f;e.type===tn&&(this.xu(),null==(p=this.Wu)||p.reset(),null==(f=this._instance.persistence)||f.register_once({[Rr]:e.timestamp},void 0)),e.type===tn&&null!=(n=this.Ua)&&n.hasPendingTriggers(this.sessionId)&&this.Vu();var m=this.Wu?this.Wu.throttleMutations(e):e;if(m){var g=function(e){var t=e;if(t&&tr(t)&&6===t.type&&tr(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var r=[],n=0;t.data.payload.payload.length>n;n++)r.push(t.data.payload.payload[n]&&t.data.payload.payload[n].length>2e3?t.data.payload.payload[n].slice(0,2e3)+"...[truncated]":t.data.payload.payload[n]);return t.data.payload.payload=r,e}return e}(m),v=xi(d=g)?d.data.payload:null,y=function(e){return Oi(e)?e.data.payload:null}(g);if(v||y){var b=null!=v?v:y;null!=b&&b.lastActivityTimestamp&&(g.timestamp=b.lastActivityTimestamp)}else this.Xu(g);e.type===tn&&(this.nu.push([this.nr,e.timestamp]),this.nu.length>6&&(this.nu=this.nu.slice(-6)));var S=null!==(i=null!==(s=null==v?void 0:v.currentSessionId)&&void 0!==s?s:null==y?void 0:y.nextSessionId)&&void 0!==i?i:this.nr,w=null!==(a=null!==(o=null==v?void 0:v.currentWindowId)&&void 0!==o?o:null==y?void 0:y.nextWindowId)&&void 0!==a?a:this.rr;if(!0!==this.eu||function(e){return Ei(e)||xi(e)||Oi(e)}(g)){if(Ei(g)){var k=g.data.payload;k&&(g.timestamp=k.lastActivityTimestamp+k.threshold)}var{event:I,size:_}=null===(l=this._instance.config.session_recording.compress_events)||void 0===l||l?function(e){try{if(e.type===tn){var t=r({},e,{data:Mi(e.data),cv:"2024-10"});return{event:t,size:Rn(t)}}if(e.type===rn&&0===e.data.source){var n=r({},e,{cv:"2024-10",data:r({},e.data,{texts:Ti(e.data.texts),attributes:Ti(e.data.attributes),removes:Ti(e.data.removes),adds:Ti(e.data.adds)})});return{event:n,size:Rn(n)}}if(e.type===rn&&8===e.data.source){var i=r({},e,{cv:"2024-10",data:r({},e.data,{adds:e.data.adds?Mi(e.data.adds):void 0,removes:e.data.removes?Mi(e.data.removes):void 0})});return{event:i,size:Rn(i)}}}catch(s){wi.error("could not compress event - will use uncompressed event",s)}return{event:e,size:Tn(e)}}(g):{event:g,size:Tn(g)},C={$snapshot_bytes:_,$snapshot_data:I,$session_id:S,$window_id:w};g.type===tn&&null!=(u=_i())&&null!=u.wasMaxDepthReached&&u.wasMaxDepthReached()&&(this.iu=!0),this.status!==an?this.zu(C):this.Iu()}}}}}get status(){return this.Ua?this.Ua.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.Ha,rrwebError:this.ru,urlTriggerMatching:this.Ca,eventTriggerMatching:this.wa,linkedFlagMatching:this.Sa,remoteConfig:this.Do}):an}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.Sa.linkedFlagSeen=!0,this.Ya(),this.Za("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[wr]:this.sessionId}),this.Ya(),this.Za("sampling_overridden")}overrideTrigger(e){this.Yu(e)}Du(){this.Ju&&(clearTimeout(this.Ju),this.Ju=void 0)}pu(){this.Du();var e,t=this.fu();return this.status===un||this.status===dn||this.status===an||t?(this.Ju=setTimeout(()=>{this.pu()},2e3),this.T):(this.T.data.length>0&&(Li(this.T).forEach(e=>{var t;null==(t=this.hu)||t.trackSize(e.size),this.Ku({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:"web",$lib_version:"1.369.0"})}),null==(e=this.Ua)||e.onFlushComplete()),this.Iu())}zu(e){var t,r=2+((null==(t=this.T)?void 0:t.data.length)||0),n=e.$session_id;this.eu||943718.4>=this.T.size+e.$snapshot_bytes+r&&this.T.sessionId===n||(this.T=this.pu(),this.T.sessionId=n,this.T.windowId=e.$window_id),this.T.size+=e.$snapshot_bytes,this.T.data.push(e.$snapshot_data),this.T.sizes.push(e.$snapshot_bytes),this.Ju||this.eu||(this.Ju=setTimeout(()=>{this.pu()},2e3))}Ku(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.Pa),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get gu(){var e,t,r=null==(e=this.T)?void 0:e.data[(null==(t=this.T)?void 0:t.data.length)-1],{sessionStartTimestamp:n}=this.Ja.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-n:null}Vu(){if(!this.T||0===this.T.data.length)return this.Iu();for(var e=-1,t=this.T.data.length-1;t>=0;t--)if(this.T.data[t].type===nn){e=t;break}return 0>e?this.Iu():(this.T.data=this.T.data.slice(e),this.T.sizes=this.T.sizes.slice(e),this.T.size=this.T.sizes.reduce((e,t)=>e+t,0),this.T)}Iu(){return this.T={size:0,data:[],sizes:[],sessionId:this.nr,windowId:this.rr},this.T}Za(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),wi.info(e.replace("_"," "),t),"session_id_changed"!==e&&this.Va("$recording_started",r({reason:e},t))}Hu(e){var t;return 3===e.type&&-1!==ki.indexOf(null==(t=e.data)?void 0:t.source)}Xu(e){var t=this.Hu(e);t||this.eu||e.timestamp-this.Qa>this.Ka&&(this.eu=!0,clearInterval(this.Bu),this.Va("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.Qa,threshold:this.Ka,bufferLength:this.T.data.length,bufferSize:this.T.size}),this.pu());var r=!1;if(t&&(this.Qa=e.timestamp,this.eu)){var n="unknown"===this.eu;this.eu=!1,n||(this.Va("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!this.eu){var{windowId:i,sessionId:s}=this.Ja.checkAndGetSessionAndWindowId(!t,e.timestamp),a=this.nr!==s,o=this.rr!==i;this.rr=i,this.nr=s,a||o?(this.stop(),this.start("session_id_changed")):r&&this.xu()}}du(){var e;null==(e=this.Ua)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,{sessionStartTimestamp:t}=this.Ja.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.T.data.length,$sdk_debug_replay_internal_buffer_size:this.T.size,$sdk_debug_current_session_duration:this.gu,$sdk_debug_session_start:t,$sdk_debug_replay_flushed_size:null==(e=this.hu)?void 0:e.currentTrackedSize,$sdk_debug_replay_full_snapshots:this.nu,$snapshot_max_depth_exceeded:this.iu,$sdk_debug_replay_rrweb_error:this.ru}}Gu(){var e;if(!this.qa){var t,n,i,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this._instance.config.session_recording;for(var[o,l]of Object.entries(a||{}))o in s&&("maskInputOptions"===o?s.maskInputOptions=r({password:!0},l):s[o]=l);this.wu&&this.wu.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.wu.fps},s.dataURLOptions={type:"image/webp",quality:this.wu.quality}),this.Cu&&(s.maskAllInputs=null===(t=this.Cu.maskAllInputs)||void 0===t||t,s.maskTextSelector=null!==(n=this.Cu.maskTextSelector)&&void 0!==n?n:void 0,s.blockSelector=null!==(i=this.Cu.blockSelector)&&void 0!==i?i:void 0);var u=Ci();if(u){this.Wu=null!==(e=this.Wu)&&void 0!==e?e:new ai(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";wi.info(r,{node:t}),this.log(Si+" "+r,"warn")}});var d=this.Au();if(this.qa=u(r({emit:e=>{this.onRRwebEmit(e)},plugins:d},s)),!this.qa)return this.ru=!0,void wi.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ru=!1,this.Qa=Date.now(),this.eu=or(this.eu)?this.eu:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Do),this.Va("$session_options",{sessionRecordingOptions:s,activePlugins:d.map(e=>null==e?void 0:e.name)}),this.Va("$posthog_config",{config:this._instance.config})}else wi.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this.Va(e,t)}}Jt.__PosthogExtensions__=Jt.__PosthogExtensions__||{},Jt.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:e=>({name:"rrweb/console@1",observer:jt,options:e}),getRecordNetworkPlugin:e=>({name:"rrweb/network@1",observer:en,options:e})},Jt.__PosthogExtensions__.rrweb={record:Ot,version:"v2",wasMaxDepthReached:()=>pe,resetMaxDepthState(){pe=!1,he=!1}},Jt.__PosthogExtensions__.initSessionRecording=e=>new Ni(e)}();
2
+ //# sourceMappingURL=posthog-recorder-RyHcazD-.js.map