!function(){"use strict";function t(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function e(e){return function(){var r=this,i=arguments;return new Promise((function(n,s){var a=e.apply(r,i);function o(e){t(a,n,s,o,u,"next",e)}function u(e){t(a,n,s,o,u,"throw",e)}o(void 0)}))}}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},r.apply(null,arguments)}var i,n=["type"],s=Object.defineProperty,a=(t,e,r)=>((t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r),o=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(o||{}),u=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(u||{}),l=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(l||{}),h=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(h||{}),d=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(d||{}),c=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(c||{}),v=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(v||{});function f(t,e){return-1!==t.indexOf(e)}var p={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},g={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},m={};function y(t){if(m[t])return m[t];var e=function(t){var e,r,i=null==(r=null==(e=null==globalThis?void 0:globalThis.Zone)?void 0:e.__symbol__)?void 0:r.call(e,t);return i&&globalThis[i]?globalThis[i]:void 0}(t)||globalThis[t],r=e.prototype,i=t in p?p[t]:void 0,n=Boolean(i&&i.every((t=>{var e,i;return Boolean(null==(i=null==(e=Object.getOwnPropertyDescriptor(r,t))?void 0:e.get)?void 0:i.toString().includes("[native code]"))}))),s=t in g?g[t]:void 0,a=Boolean(s&&s.every((t=>{var e;return"function"==typeof r[t]&&(null==(e=r[t])?void 0:e.toString().includes("[native code]"))})));if(n&&a)return m[t]=e.prototype,e.prototype;var o=document.createElement("iframe");o.style.display="none";var u,l=!1;try{document.body.appendChild(o);var h=o.contentWindow;if(!h)return e.prototype;var d=h[t].prototype;return d?(f(u=navigator.userAgent,"AppleWebKit")&&!f(u,"Chrome")&&(o.classList.add("rr-block","ph-no-capture"),o.setAttribute("__rrwebUntaintedPrototype",t),l=!0),m[t]=d):r}catch(t){return r}finally{!l&&o.parentNode&&document.body.removeChild(o)}}var b={};function w(t,e,r){var i,n=t+"."+String(r);if(b[n])return b[n].call(e);var s=y(t),a=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return a?(b[n]=a,a.call(e)):e[r]}var k={};function _(t,e,r){var i=t+"."+String(r);if(k[i])return k[i].bind(e);var n=y(t)[r];return"function"!=typeof n?e[r]:(k[i]=n,n.bind(e))}function S(){return y("MutationObserver").constructor}function M(t,e,r){try{if(!(e in t))return()=>{};var i=t[e],n={next:i},s=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return n.next.apply(this,e)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]!==s)for(var r=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0},i=t[e],a=r(i);a;){if(a.next===s)return void(a.next=n.next);a=r(i=a.next)}else t[e]=n.next}}catch(t){return()=>{}}}var C={childNodes:t=>w("Node",t,"childNodes"),parentNode:t=>w("Node",t,"parentNode"),parentElement:t=>w("Node",t,"parentElement"),textContent:t=>w("Node",t,"textContent"),contains:(t,e)=>_("Node",t,"contains")(e),getRootNode:t=>_("Node",t,"getRootNode")(),host:t=>t&&"host"in t?w("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?w("Element",t,"shadowRoot"):null,querySelector:(t,e)=>_("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>_("Element",t,"querySelectorAll")(e),mutationObserver:S,patch:M},I=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0});function A(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var R=0,T=0,x=6e4;function E(){R+=1}function O(){return R}function F(t,e){return(e!==R||t>x)&&(T+=1,!0)}var D=0,L=0,N=0,P=I(),B=null,W=null,z=[],j=0,U=0,H={slowestBatchMs:0},q={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0},G=t=>t&&t>0?t:null;function V(t){(D+=1)>1||(P=I(),z=[],j=0,W=G(t),L=A(),N=R)}function Z(){return 0===D?B||I():(D-=1)>0?P:(P.durationMs=A()-L,P.deferredStylesheetCount=j,q.deferredCount+=j,W=null,F(P.durationMs,N)?P:B=P)}var J=32;function Q(t,e,r){var i=t.length;if(r>=J)return i;for(var n=0;t.length>n;n++){var s=t[n];try{var a=s.cssRules;if(a&&a.length)i+=Q(a,e,r+1);else if(e&&s.styleSheet){var o=s.styleSheet;if(!e.has(o)){e.add(o);var u=o.rules||o.cssRules;u&&(i+=Q(u,e,r+1))}}}catch(t){}}return i}function X(t){if(0!==D){var e=Q(t,null,0);P.cssRuleCount+=e,U>0&&(P.nonDeferrableCssRuleCount+=e)}}function K(t){U+=1;try{return t()}finally{U-=1}}function Y(t){D>0&&(P.stylesheetMs+=t)}function tt(t){if(0===D||null===W)return!1;var e=P.cssRuleCount-P.nonDeferrableCssRuleCount;return e>=W||e+function(t){try{var e=t&&(t.rules||t.cssRules);if(!e)return 0;var r=new WeakSet;return r.add(t),Q(e,r,0)}catch(t){return 0}}(t)>W}function et(){q.failedCount+=1}function rt(t){t>0&&(q.abandonedCount+=t)}function it(t){return t.nodeType===t.ELEMENT_NODE}function nt(t){var e=t&&"host"in t&&"mode"in t&&C.host(t)||null;return Boolean(e&&"shadowRoot"in e&&C.shadowRoot(e)===t)}function st(t){return"[object ShadowRoot]"==={}.toString.call(t)}function at(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function ot(t){var e=t.cssText;if(3>e.split('"').length)return e;var r=["@import","url("+JSON.stringify(t.href)+")"];return""===t.layerName?r.push("layer"):t.layerName&&r.push("layer("+t.layerName+")"),t.supportsText&&r.push("supports("+t.supportsText+")"),t.media.length&&r.push(t.media.mediaText),r.join(" ")+";"}var ut=0;function lt(t){var e=0===ut,r=e?A():0;ut+=1;try{var i=t.rules||t.cssRules;if(!i)return null;X(i);var n=t.href;return!n&&t.ownerNode&&(n=t.ownerNode.baseURI),at(Array.from(i,(t=>ht(t,n))).join(""))}catch(t){return null}finally{ut-=1,e&&Y(A()-r)}}function ht(t,e){var r;if(ct(t)){var i;try{i=lt(t.styleSheet)||ot(t)}catch(e){i=t.cssText}try{if(i&&(null==(r=t.styleSheet)?void 0:r.href))return Rt(i,t.styleSheet.href)}catch(t){}return i}var n=t.cssText;return vt(t)&&t.selectorText.includes(":")&&(n=dt(n)),e?Rt(n,e):n}function dt(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function ct(t){return"styleSheet"in t}function vt(t){return"selectorText"in t}var ft=/^-?[A-Za-z_][\w-]*$/,pt=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function gt(t){var e=[],r=!1,i=null,n=new Map;function s(t){var n=e.pop();if("group"===n.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void s(null)}var o=e[e.length-1];return o.parts.push(t),void(o.index+=1)}if(!n.importRule)return r=!0,void(i=t);a(e[e.length-1],n.importRule,t)}function a(t,e,r){var i;try{var n;try{n=r||ot(e)}catch(t){n=e.cssText}try{n&&(null==(i=e.styleSheet)?void 0:i.href)&&(n=Rt(n,e.styleSheet.href))}catch(t){}n&&t.parts.push(n),t.index+=1}catch(t){s(null)}}function o(t){var r=t.rules[t.index];if("sheet"===t.kind&&ct(r)){var i=n.get(r);return null===i?(t.parts.push(r.cssText),void(t.index+=1)):i?void e.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:r}):void a(t,r,null)}if(!function(t,r){try{var i=function(t){var e,r=t;if(!r.cssRules||0===r.cssRules.length)return null;if(r.media&&"string"==typeof r.media.mediaText)return"@media "+r.media.mediaText+" {";if(vt(t)){if("number"==typeof r.type&&1!==r.type)return null;var i=r.style?r.style.cssText:"";return t.selectorText+" {"+(i?" "+i:"")}if("containerName"in r)return"string"!=typeof r.containerQuery||r.containerName&&!ft.test(r.containerName)?null:"@container "+(r.containerName?r.containerName+" ":"")+r.containerQuery+" {";if("string"==typeof r.conditionText){var n="";try{n=(null==(e=t.constructor)?void 0:e.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?"@supports "+r.conditionText+" {":null}return"string"==typeof r.name?"keyText"in r.cssRules[0]?ft.test(r.name)?"@keyframes "+r.name+" {":null:""===r.name?"@layer {":pt.test(r.name)?"@layer "+r.name+" {":null:null}(t);if(null===i)return!1;var n=r.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:n,index:0,parts:[],prelude:n?Rt(i,n):i,fixColons:"sheet"===r.kind&&vt(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(r,t)){var s=r.cssText;"sheet"===t.kind&&vt(r)&&r.selectorText.includes(":")&&(s=dt(s)),t.parts.push(t.sheetHref?Rt(s,t.sheetHref):s),t.index+=1}}return function(t){try{var r=t.rules||t.cssRules;if(!r)return!1;X(r);var i=t.href;!i&&t.ownerNode&&(i=t.ownerNode.baseURI);var s=Array.from(r);return e.push({kind:"sheet",sheet:t,rules:s,sheetHref:i,index:0,parts:[],importRule:null}),function(t,e){for(var r=[{sheet:e,rules:t,index:0}],i=function(){var t=r[r.length-1];if(t.index>=t.rules.length)return r.pop(),0;var e=t.rules[t.index];if(t.index+=1,!ct(e)||n.has(e))return 0;var i=null;try{i=e.styleSheet}catch(t){return n.set(e,null),0}if(!i||r.some((t=>t.sheet===i)))return 0;try{var s=i.rules||i.cssRules;if(!s)return 0;X(s);var a=i.href;!a&&i.ownerNode&&(a=i.ownerNode.baseURI);var o=Array.from(s);n.set(e,{sheet:i,rules:o,sheetHref:a}),r.push({sheet:i,rules:o,index:0})}catch(t){}};r.length>0;)i()}(s,t),!0}catch(t){return!1}}(t)||(r=!0),{advance(t){if(r)return!0;var n=A(),a=t>0?t:1;try{for(;!r&&a>0;){var u=e[e.length-1];if(u.rules.length>u.index){a-=1;try{o(u)}catch(t){s(null)}}else{var l=null;try{if("group"===u.kind){var h=u.prelude+u.parts.join("")+"}";l=u.fixColons?dt(h):h}else l=at(u.parts.join(""))}catch(t){}s(l)}}}catch(t){r=!0,i=null}finally{Y(A()-n)}return r},text:()=>r?i:null,remainingRules(){if(r)return 0;var t=0;for(var i of e)t+=i.rules.length-i.index;return t}}}class mt{constructor(){a(this,"idNodeMap",new Map),a(this,"nodeMetaMap",new WeakMap)}getId(t){var e;if(!t)return-1;var r=null==(e=this.getMeta(t))?void 0:e.id;return null!=r?r:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){var e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach((t=>this.removeNodeFromMap(t))),it(t)){var r=C.shadowRoot(t);r&&this.removeNodeFromMap(r),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(e,i)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function yt(t){var e=t.element,r=t.maskInputOptions,i=t.tagName,n=t.type,s=t.maskInputFn,a=t.value||"",o=n&&bt(n);return(r[i.toLowerCase()]||o&&r[o])&&(a=s?s(a,e):"*".repeat(a.length)),a}function bt(t){return t.toLowerCase()}var wt=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function kt(t){var e=t.element,r=t.name,i=t.value,n=t.maskAttributeFn,s=t.isGenerated;return i?t.maskAllElementAttributes?void 0!==s&&s&&wt.has(bt(r))?i:"*".repeat(i.length):n?n(r,i,e):i:i}var _t="__rrweb_original__";function St(t){try{var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?bt(e):null}catch(t){return null}}var Mt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ct=/^(?:[a-z+]+:)?\/\//i,It=/^www\..*/i,At=/^(data:)([^,]*),(.*)/i;function Rt(t,e){return(t||"").replace(Mt,((t,r,i,n,s,a)=>{var o,u=i||s||a,l=r||n||"";if(!u)return t;if(Ct.test(u)||It.test(u))return"url("+l+u+l+")";if(At.test(u))return"url("+l+u+l+")";if("/"===u[0])return"url("+l+(((o=e).indexOf("//")>-1?o.split("/").slice(0,3).join("/"):o.split("/")[0]).split("?")[0]+u)+l+")";var h=e.split("/"),d=u.split("/");for(var c of(h.pop(),d))"."!==c&&(".."===c?h.pop():h.push(c));return"url("+l+h.join("/")+l+")"}))}var Tt,xt,Et="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",Ot=4096,Ft=1e5,Dt=10,Lt=new Map,Nt=1,Pt=new RegExp("[^a-z0-9-_:]"),Bt=-2;function $t(){return Nt++}var Wt=/^[^ \t\n\r\u000c]+/,zt=/^[, \t\n\r\u000c]+/,jt=new WeakMap;function Ut(t,e){return e&&""!==e.trim()?Ht(t,e):e}function Ht(t,e){var r=jt.get(t);if(r||(r=t.createElement("a"),jt.set(t,r)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return r.setAttribute("href",e),r.href}function qt(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?Et:t}(t,e.maxBase64ImageLength):t}function Gt(t,e,r,i,n,s){var a;if(!i)return i;if("src"===r||"href"===r&&("use"!==e||"#"!==i[0])){if("link"===e&&n){var o=null==(a=n.sheet)?void 0:a.href;if(o)return o}var u=Ut(t,i);if(u.startsWith("data:")){if("img"===e&&n){var l=u;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(l=function(t,e,r,i){if(Ft>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>Ot||t.naturalHeight>Ot)return e;var n=Lt.get(e);if(n&&n.type===r&&n.quality===i)return n.result;try{var s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;var a=s.getContext("2d");if(!a)return e;a.drawImage(t,0,0);var o=s.toDataURL(r||"image/webp",null!=i?i:.4),u=e.length>o.length?o:e;if(Lt.size>=Dt){var l=Lt.keys().next().value;void 0!==l&&Lt.delete(l)}return Lt.set(e,{type:r,quality:i,result:u}),u}catch(t){return e}}(n,u,s.type,s.quality)),qt(l,s)}if("image"===e)return qt(u,s)}return u}if("xlink:href"===r&&"#"!==i[0]){var h=Ut(t,i);return"image"===e&&h.startsWith("data:")?qt(h,s):h}return"background"!==r||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===r?function(t,e){if(""===e.trim())return e;var r=0;function i(t){var i,n=t.exec(e.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(zt),e.length>r;){var s=i(Wt);if(","===s.slice(-1))s=Ut(t,s.substring(0,s.length-1)),n.push(s);else{var a="";s=Ut(t,s);for(var o=!1;;){var u=e.charAt(r);if(""===u){n.push((s+a).trim());break}if(o)")"===u&&(o=!1);else{if(","===u){r+=1,n.push((s+a).trim());break}"("===u&&(o=!0)}a+=u,r+=1}}}return n.join(", ")}(t,i):"style"===r?Rt(i,Ht(t)):"object"===e&&"data"===r?Ut(t,i):i:Ut(t,i)}function Vt(t,e,r){return("video"===t||"audio"===t)&&"autoplay"===e}function Zt(t,e,r){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!r&&Zt(C.parentNode(t),e,r);for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!r&&Zt(C.parentNode(t),e,r)}function Jt(t,e,r,i){var n;if(it(t)){if(!C.childNodes(n=t).length)return!1}else{if(null===C.parentElement(t))return!1;n=C.parentElement(t)}try{if("string"==typeof e){if(i){if(n.closest("."+e))return!0}else if(n.classList.contains(e))return!0}else if(Zt(n,e,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(t){}return!1}function Qt(t,e,r){var i=t.removeEventListener;"function"==typeof i&&i.call(t,e,r)}var Xt=new Map;function Kt(t,e){return Array.from(t.styleSheets).find((t=>t.href===e))}function Yt(t){return null==t?"":t.toLowerCase()}var te=50,ee=!1,re=!1;function ie(t,e){var r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,a=e.maskTextClass,o=e.maskTextSelector,u=e.skipChild,l=void 0!==u&&u,h=e.inlineStylesheet,d=void 0===h||h,c=e.maskInputOptions,f=void 0===c?{}:c,p=e.maskTextFn,g=e.maskInputFn,m=e.maskAllElementAttributes,y=void 0!==m&&m,b=e.maskAttributeFn,w=e.slimDOMOptions,k=e.dataURLOptions,_=void 0===k?{}:k,S=e.inlineImages,M=void 0!==S&&S,I=e.recordCanvas,A=void 0!==I&&I,R=e.canvasMaskingConfigured,T=e.onSerialize,x=e.onIframeLoad,E=e.iframeLoadTimeout,O=void 0===E?5e3:E,F=e.onIframeListenerRegistered,L=e.onStylesheetLoad,N=e.stylesheetLoadTimeout,B=void 0===N?5e3:N,W=e.keepIframeSrcFn,U=void 0===W?()=>!1:W,H=e.newlyAddedElement,q=void 0!==H&&H,G=e.depth,V=void 0===G?0:G,Z=e.maxDepth,J=void 0===Z?te:Z,Q=e.needsMask,X=e.preserveWhiteSpace,Y=void 0===X||X;if(V>=J)return re=!0,ee||(ee=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+J+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;Q||(Q=Jt(t,a,o,void 0===Q)),D>0&&(P.nodeCount+=1);var et,rt=function(t,e){var r=e.doc,i=e.blockClass,n=e.blockSelector,s=e.needsMask,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskTextFn,h=e.maskInputFn,d=e.maskAllElementAttributes,c=void 0!==d&&d,f=e.maskAttributeFn,p=e.dataURLOptions,g=void 0===p?{}:p,m=e.inlineImages,y=e.recordCanvas,b=e.canvasMaskingConfigured,w=e.keepIframeSrcFn,k=e.newlyAddedElement,_=void 0!==k&&k,S=function(t,e){if(e.hasNode(t)){var r=e.getId(t);return 1===r?void 0:r}}(r,e.mirror);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:v.Document,childNodes:[],compatMode:t.compatMode}:{type:v.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:v.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:S};case t.ELEMENT_NODE:return function(t,e){for(var r,i,n,s=e.doc,a=e.inlineStylesheet,o=e.maskInputOptions,u=void 0===o?{}:o,l=e.maskInputFn,h=e.maskAllElementAttributes,d=void 0!==h&&h,c=e.maskAttributeFn,f=e.dataURLOptions,p=void 0===f?{}:f,g=e.inlineImages,m=e.recordCanvas,y=e.canvasMaskingConfigured,b=e.keepIframeSrcFn,w=e.newlyAddedElement,k=void 0!==w&&w,_=e.rootId,S=function(t,e,r){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(var i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(r)return t.matches(r)}catch(t){}return!1}(t,e.blockClass,e.blockSelector),M=function(t){if(t instanceof HTMLFormElement)return"form";var e=bt(t.tagName);return Pt.test(e)?"div":e}(t),I=new Set,A={},R=t.attributes.length,T=0;R>T;T++){var x=t.attributes[T];Vt(M,x.name)||(A[x.name]=Gt(s,M,bt(x.name),x.value,t,p))}if("link"===M&&a&&!S){var E=t.sheet;if(!E){var O=function(t){return t.href}(t);O&&!(E=Kt(s,O))&&O.includes(".css")&&(E=Kt(s,window.location.origin+"/"+O.replace(window.location.href,"")))}var F=null;E&&(tt(E)?D>0&&(z.push(t),j+=1):F=lt(E)),F&&(delete A.rel,delete A.href,A._cssText=F)}if("style"===M&&t.sheet&&!(t.innerText||C.textContent(t)||"").trim().length){var L=K((()=>lt(t.sheet)));L&&(A._cssText=L)}if("input"===M||"textarea"===M||"select"===M){var N=t.value,P=t.checked;"radio"!==A.type&&"checkbox"!==A.type&&"submit"!==A.type&&"button"!==A.type&&N?A.value=yt({element:t,type:St(t),tagName:M,value:N,maskInputOptions:u,maskInputFn:l}):P&&(A.checked=P)}if("option"===M&&(t.selected&&!u.select?A.selected=!0:delete A.selected),"dialog"===M&&t.open){try{A.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){A.rr_open_mode="modal",A.ph_rr_could_not_detect_modal=!0}I.add("rr_open_mode")}if("canvas"===M&&m&&!(null==y?void 0:y()))if("2d"===t.__context)(function(t){var e=t.getContext("2d");if(!e)return!0;for(var r=0;t.width>r;r+=50)for(var i=0;t.height>i;i+=50){var n=e.getImageData;if(new Uint32Array((_t in n?n[_t]:n).call(e,r,i,Math.min(50,t.width-r),Math.min(50,t.height-i)).data.buffer).some((t=>0!==t)))return!1}return!0})(t)||(A.rr_dataURL=t.toDataURL(p.type,p.quality));else if(!("__context"in t)){var B=t.toDataURL(p.type,p.quality),W=s.createElement("canvas");W.width=t.width,W.height=t.height,B!==W.toDataURL(p.type,p.quality)&&(A.rr_dataURL=B)}var U,H,q=!1;if("img"===M&&g){Tt||(Tt=s.createElement("canvas"),xt=Tt.getContext("2d"));var G=t,V=G.currentSrc||G.getAttribute("src")||"",Z=G.crossOrigin,J=(e,r)=>q?kt({element:t,name:e,value:r,maskAllElementAttributes:d,maskAttributeFn:c}):r,Q=()=>{Qt(G,"load",Q);try{Tt.width=G.naturalWidth,Tt.height=G.naturalHeight,xt.drawImage(G,0,0);var t=Tt.toDataURL(p.type,p.quality);A.rr_dataURL=J("rr_dataURL",t)}catch(t){if("anonymous"!==G.crossOrigin)return G.crossOrigin="anonymous",void(G.complete&&0!==G.naturalWidth?Q():G.addEventListener("load",Q));console.warn("Cannot inline img src="+V+"! Error: "+t)}"anonymous"===G.crossOrigin&&(Z?A.crossOrigin=J("crossOrigin",Z):G.removeAttribute("crossorigin"))};G.complete&&0!==G.naturalWidth?Q():G.addEventListener("load",Q)}if("audio"===M||"video"===M){var X=A;X.rr_mediaState=t.paused?"paused":"played",I.add("rr_mediaState"),X.rr_mediaCurrentTime=t.currentTime,X.rr_mediaPlaybackRate=t.playbackRate,X.rr_mediaMuted=t.muted,X.rr_mediaLoop=t.loop,X.rr_mediaVolume=t.volume}if(k||(t.scrollLeft&&(A.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(A.rr_scrollTop=t.scrollTop)),S){var Y=t.getBoundingClientRect(),et=Y.width,rt=Y.height,it=Y.left,nt=Y.top,st=null==(r=s.defaultView)?void 0:r.getComputedStyle(t);A={class:A.class,rr_width:et+"px",rr_height:rt+"px",rr_left:Math.floor(it+((null==(i=s.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(nt+((null==(n=s.defaultView)?void 0:n.scrollY)||0))+"px"},I.add("rr_width"),I.add("rr_height"),I.add("rr_left"),I.add("rr_top"),st&&(A.rr_position=st.position||"static",I.add("rr_position"),st.transform&&"none"!==st.transform&&(A.rr_transform=st.transform,I.add("rr_transform")),st.display&&st.display.startsWith("inline")&&(A.rr_display=st.display,I.add("rr_display")))}if("iframe"!==M||b(A.src)||(t.contentDocument||(A.rr_src=A.src),delete A.src),d||c)for(var at of Object.entries(A)){var ot=at[0],ut=at[1];"string"!=typeof ut&&null!==ut||(A[ot]=kt({element:t,name:ot,value:ut,maskAllElementAttributes:d,maskAttributeFn:c,isGenerated:I.has(ot)}))}q=!0;try{customElements.get(M)&&(U=!0)}catch(t){}return{type:v.Element,tagName:M,attributes:A,childNodes:[],isSVG:(H=t,Boolean("svg"===H.tagName||H.ownerSVGElement)||void 0),needBlock:S,rootId:_,isCustom:U}}(t,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:a,maskInputOptions:u,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:w,newlyAddedElement:_,rootId:S});case t.TEXT_NODE:return function(t,e){var r,i=e.needsMask,n=e.maskTextFn,s=e.rootId,a=C.parentNode(t),o=a&&a.tagName,u=C.textContent(t),l="STYLE"===o||void 0,h="SCRIPT"===o||void 0;if(l&&u){try{if(t.nextSibling||t.previousSibling);else if(tt(a.sheet));else if(null==(r=a.sheet)?void 0:r.cssRules){var d=lt(a.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(u=d)}}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: "+e,t)}u=Rt(u,Ht(e.doc))}return h&&(u="SCRIPT_PLACEHOLDER"),!l&&!h&&u&&i&&(u=n?n(u,C.parentElement(t)):u.replace(/[\S]/g,"*")),{type:v.Text,textContent:u||"",isStyle:l,rootId:s}}(t,{doc:r,needsMask:s,maskTextFn:l,rootId:S});case t.CDATA_SECTION_NODE:return{type:v.CDATA,textContent:"",rootId:S};case t.COMMENT_NODE:return{type:v.Comment,textContent:C.textContent(t)||"",rootId:S};default:return!1}}(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:Q,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,dataURLOptions:_,inlineImages:M,recordCanvas:A,canvasMaskingConfigured:R,keepIframeSrcFn:U,newlyAddedElement:q});if(!rt)return console.warn(t,"not serialized"),null;et=i.hasNode(t)?i.getId(t):function(t,e){if(e.comment&&t.type===v.Comment)return!0;if(t.type===v.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t,e){var r,i;try{i=new URL(t,window.location.href)}catch(t){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Yt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Yt(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Yt(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Yt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Yt(t.attributes.property).match(/^(og|twitter|fb):/)||Yt(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Yt(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Yt(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Yt(t.attributes.name))||Yt(t.attributes.property).match(/^article:/)||Yt(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Yt(t.attributes.name)))return!0}}return!1}(rt,w)||!Y&&rt.type===v.Text&&!rt.isStyle&&!rt.textContent.replace(/^\s+|\s+$/gm,"").length?Bt:$t();var at=Object.assign(rt,{id:et});if(i.add(t,at),et===Bt)return null;T&&T(t);var ot=!l;if(at.type===v.Element){ot=ot&&!at.needBlock,delete at.needBlock;var ut=C.shadowRoot(t);ut&&st(ut)&&(at.isShadowHost=!0)}if((at.type===v.Document||at.type===v.Element)&&ot){w.headWhitespace&&at.type===v.Element&&"head"===at.tagName&&(Y=!1);var ht={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:Q,maskTextClass:a,maskTextSelector:o,skipChild:l,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOMOptions:w,dataURLOptions:_,inlineImages:M,recordCanvas:A,canvasMaskingConfigured:R,preserveWhiteSpace:Y,onSerialize:T,onIframeLoad:x,iframeLoadTimeout:O,onIframeListenerRegistered:F,onStylesheetLoad:L,stylesheetLoadTimeout:B,keepIframeSrcFn:U,depth:V+1,maxDepth:J};if(at.type===v.Element&&"textarea"===at.tagName&&void 0!==at.attributes.value);else for(var dt of Array.from(C.childNodes(t))){var ct=ie(dt,ht);ct&&at.childNodes.push(ct)}var vt=null;if(it(t)&&(vt=C.shadowRoot(t)))for(var ft of Array.from(C.childNodes(vt))){var pt=ie(ft,ht);pt&&(st(vt)&&(pt.isShadow=!0),at.childNodes.push(pt))}}var gt=C.parentNode(t);if(gt&&nt(gt)&&st(gt)&&(at.isShadow=!0),at.type===v.Element&&"iframe"===at.tagName){var mt=function(t,e,r){var i,n=()=>{},s=t.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(t){return n}var a=()=>e();if("complete"!==i){var o=!1,u=null,l=()=>{o||(o=!0,null!==u&&(clearTimeout(u),u=null),Qt(t,"load",h),t.addEventListener("load",a),e())},h=()=>l();return u=setTimeout(l,r),t.addEventListener("load",h),()=>{null!==u&&(clearTimeout(u),u=null),o?Qt(t,"load",a):(o=!0,Qt(t,"load",h))}}var d,c="about:blank";try{d=s.location.href}catch(t){return n}if(d!==c||t.src===c||""===t.src){var v=setTimeout(e,0);return t.addEventListener("load",a),()=>{clearTimeout(v),Qt(t,"load",a)}}return t.addEventListener("load",a),()=>{Qt(t,"load",a)}}(t,(()=>{var e=t.contentDocument;if(e&&x){var r=ie(e,{doc:e,mirror:i,blockClass:n,blockSelector:s,needsMask:Q,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOMOptions:w,dataURLOptions:_,inlineImages:M,recordCanvas:A,canvasMaskingConfigured:R,preserveWhiteSpace:Y,onSerialize:T,onIframeLoad:x,iframeLoadTimeout:O,onIframeListenerRegistered:F,onStylesheetLoad:L,stylesheetLoadTimeout:B,keepIframeSrcFn:U,depth:V+1,maxDepth:J});r&&x(t,r)}}),O);null==F||F(t,mt)}return at.type===v.Element&&"link"===at.tagName&&"stylesheet"===at.attributes.rel&&function(e,u,l){if(!Xt.has(e)){var h;try{h=e.sheet}catch(t){return}if(!h){var c=new AbortController,v=!1,m=()=>{if(!v){v=!0;try{(()=>{if(L){var e=ie(t,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:Q,maskTextClass:a,maskTextSelector:o,skipChild:!1,inlineStylesheet:d,maskInputOptions:f,maskTextFn:p,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOMOptions:w,dataURLOptions:_,inlineImages:M,recordCanvas:A,canvasMaskingConfigured:R,preserveWhiteSpace:Y,onSerialize:T,onIframeLoad:x,iframeLoadTimeout:O,onStylesheetLoad:L,stylesheetLoadTimeout:B,keepIframeSrcFn:U,depth:V,maxDepth:J});e&&L(t,e)}})()}finally{Xt.delete(e),c.abort()}}},k=setTimeout(m,l);c.signal.addEventListener("abort",(()=>clearTimeout(k)),{once:!0}),e.addEventListener("load",m,{signal:c.signal,once:!0}),Xt.set(e,c)}}}(t,0,B),at}function ne(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}class se{constructor(){a(this,"parentElement",null),a(this,"parentNode",null),a(this,"ownerDocument"),a(this,"firstChild",null),a(this,"lastChild",null),a(this,"previousSibling",null),a(this,"nextSibling",null),a(this,"ELEMENT_NODE",1),a(this,"TEXT_NODE",3),a(this,"nodeType"),a(this,"nodeName"),a(this,"RRNodeType")}get childNodes(){for(var t=[],e=this.firstChild;e;)t.push(e),e=e.nextSibling;return t}contains(t){if(!(t instanceof se))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function ae(t,e,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(t,e,i),()=>oe(r,t,e,i)}function oe(t,e,r,i){ue((()=>{var n=t.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(t,e,r,i):n.call(t,e,r))}))}function ue(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}var le="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.",he={map:{},getId(){return console.error(le),-1},getNode(){return console.error(le),null},removeNodeFromMap(){console.error(le)},has(){return console.error(le),!1},reset(){console.error(le)}};function de(t,e,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,a=new Array(s),o=0;s>o;o++)a[o]=arguments[o];var u=Date.now();n||!1!==r.leading||(n=u);var l=e-(u-n),h=this;0>=l||l>e?(i&&(clearTimeout(i),i=null),n=u,t.apply(h,a)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,t.apply(h,a)}),l))}}function ce(t,e,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(t,e);return n.Object.defineProperty(t,e,i?r:{set(t){if(setTimeout((()=>{try{r.set.call(this,t)}catch(t){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(t){return}s.set.call(this,t)}}}),()=>ce(t,e,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(he=new Proxy(he,{get(t,e,r){return"map"===e&&console.error(le),Reflect.get(t,e,r)}}));var ve=Date.now;function fe(t){var e,r,i,n,s=t.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(e=C.parentElement(s.body))?void 0:e.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=C.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function pe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ge(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function me(t){return t?t.nodeType===t.ELEMENT_NODE?t:C.parentElement(t):null}function ye(t,e,r,i){if(!t)return!1;var n=me(t);if(!n)return!1;try{if("string"==typeof e){if(n.classList.contains(e))return!0;if(i&&null!==n.closest("."+e))return!0}else if(Zt(n,e,i))return!0}catch(t){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function be(t,e,r){return!("TITLE"!==t.tagName||!r.headTitleMutations)||e.getId(t)===Bt}function we(t,e){if(nt(t))return!1;var r=e.getId(t);if(!e.has(r))return!0;var i=C.parentNode(t);return(!i||i.nodeType!==t.DOCUMENT_NODE)&&(!i||we(i,e))}function ke(t){return Boolean(t.changedTouches)}function _e(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Se(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Me(t){return!!t&&(t instanceof se&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(C.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(ve=()=>(new Date).getTime());class Ce{constructor(){a(this,"id",1),a(this,"styleIDMap",new WeakMap),a(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){return this.has(t)?this.getId(t):(r=void 0===e?this.id++:e,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r);var r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Ie(t){var e,r=null;return"getRootNode"in t&&(null==(e=C.getRootNode(t))?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(t))&&(r=C.host(C.getRootNode(t))),r}function Ae(t){var e=t.ownerDocument;return!!e&&(C.contains(e,t)||function(t){var e=t.ownerDocument;if(!e)return!1;var r=function(t){for(var e,r=t;e=Ie(r);)r=e;return r}(t);return C.contains(e,r)}(t))}function Re(t){return"__ln"in t}class Te{constructor(){a(this,"length",0),a(this,"head",null),a(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");for(var e=this.head,r=0;t>r;r++)e=(null==e?void 0:e.next)||null;return e}addNode(t){var e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Re(t.previousSibling)){var r=t.previousSibling.__ln.next;e.next=r,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,r&&(r.previous=e)}else if(t.nextSibling&&Re(t.nextSibling)&&t.nextSibling.__ln.previous){var i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){var e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}var xe,Ee=(t,e)=>t+"@"+e;class Oe{constructor(){a(this,"frozen",!1),a(this,"locked",!1),a(this,"texts",[]),a(this,"attributes",[]),a(this,"attributeMap",new WeakMap),a(this,"generatedAttributes",new WeakMap),a(this,"removes",[]),a(this,"mapRemoves",[]),a(this,"movedMap",{}),a(this,"addedSet",new Set),a(this,"movedSet",new Set),a(this,"droppedSet",new Set),a(this,"removesSubTreeCache",new Set),a(this,"mutationCb"),a(this,"blockClass"),a(this,"blockSelector"),a(this,"maskTextClass"),a(this,"maskTextSelector"),a(this,"inlineStylesheet"),a(this,"maskInputOptions"),a(this,"maskTextFn"),a(this,"maskInputFn"),a(this,"maskAllElementAttributes"),a(this,"maskAttributeFn"),a(this,"keepIframeSrcFn"),a(this,"recordCanvas"),a(this,"canvasMaskingConfigured"),a(this,"inlineImages"),a(this,"slimDOMOptions"),a(this,"dataURLOptions"),a(this,"doc"),a(this,"mirror"),a(this,"iframeManager"),a(this,"stylesheetManager"),a(this,"shadowDomManager"),a(this,"canvasManager"),a(this,"processedNodeManager"),a(this,"unattachedDoc"),a(this,"canvasManagerReleased",!1),a(this,"processMutations",(t=>{t.forEach(this.processMutation),this.emit()})),a(this,"emit",(()=>{if(!this.frozen&&!this.locked){var t,e,r=A(),i=O();try{this.processBufferedMutations()}finally{t=A()-r,e=i,D>0||F(t,null!=e?e:R)||t>H.slowestBatchMs&&(H.slowestBatchMs=t)}}})),a(this,"processBufferedMutations",(()=>{for(var t=[],e=new Set,r=new Te,i=t=>{for(var e=t,r=Bt;r===Bt;)r=(e=e&&e.nextSibling)&&this.mirror.getId(e);return r},n=n=>{var s=C.parentNode(n);if(s&&Ae(n)&&"TEXTAREA"!==s.tagName){var a=nt(s)?this.mirror.getId(Ie(n)):this.mirror.getId(s),o=i(n);if(-1===a||-1===o)return r.addNode(n);var u=ie(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{_e(t,this.mirror)&&this.iframeManager.addIframe(t),Se(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Me(t)&&!ye(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});u&&(t.push({parentId:a,nextId:o,node:u}),e.add(u.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)De(this.removesSubTreeCache,s)&&!this.movedSet.has(C.parentNode(s))||n(s);for(var a of this.addedSet)Le(this.droppedSet,a)||De(this.removesSubTreeCache,a)?Le(this.movedSet,a)?n(a):this.droppedSet.add(a):n(a);for(var o=null;r.length;){var u=null;if(o){var l=this.mirror.getId(C.parentNode(o.value)),h=i(o.value);-1!==l&&-1!==h&&(u=o)}if(!u)for(var d=r.tail;d;){var c=d;if(d=d.previous,c){var v=this.mirror.getId(C.parentNode(c.value));if(-1===i(c.value))continue;if(-1!==v){u=c;break}var f=C.parentNode(c.value);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var p=C.host(f);if(-1!==this.mirror.getId(p)){u=c;break}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}var g={texts:this.texts.map((t=>{var e=t.node,r=C.parentNode(e);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(e),value:t.value}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),attributes:this.attributes.map((t=>{var e,r=t.attributes;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof r.style){var i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);r.style.length>i.length&&(i+n).split("var(").length===r.style.split("var(").length&&(r.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var s of Object.entries(r)){var a=s[0],o=s[1];"string"!=typeof o&&null!==o||(r[a]=kt({element:t.node,name:a,value:o,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null==(e=this.generatedAttributes.get(t.node))?void 0:e.has(a)}))}return{id:this.mirror.getId(t.node),attributes:r}})).filter((t=>!e.has(t.id))).filter((t=>this.mirror.has(t.id))),removes:this.removes,adds:t};(g.texts.length||g.attributes.length||g.removes.length||g.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=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))})),a(this,"bufferBelongsToIframe",(t=>this.doc===t.contentDocument)),a(this,"genTextAreaValueMutation",(t=>{var e=this.attributeMap.get(t);e||(this.attributes.push(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t,e));var r=Array.from(C.childNodes(t),(t=>C.textContent(t)||"")).join("");e.attributes.value=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:St(t),value:r,maskInputFn:this.maskInputFn})})),a(this,"processMutation",(t=>{var e;if(!be(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":var r=C.textContent(t.target);ye(t.target,this.blockClass,this.blockSelector,!1)||r===t.oldValue||this.texts.push({value:Jt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,me(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break;case"attributes":var i,n=t.target,s=t.attributeName,a=null!==(i=t.attributeNamespace)&&void 0!==i?i:null,o=function(t,e,r){if(!r)return e;var i=t.getAttributeNodeNS(r,e);if(i)return i.name;if("http://www.w3.org/1999/xlink"===r)return"xlink:"+e;if("http://www.w3.org/XML/1998/namespace"===r)return"xml:"+e;if("http://www.w3.org/2000/xmlns/"===r)return"xmlns"===e?e:"xmlns:"+e;var n=t.lookupPrefix(r);return n?n+":"+e:e}(n,s,a),u=a?n.getAttributeNS(a,s):t.target.getAttribute(s);if("value"===o){var l=n,h=St(l);u=yt({element:l,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:h,value:u,maskInputFn:this.maskInputFn})}if(ye(t.target,this.blockClass,this.blockSelector,!1)||u===t.oldValue)return;var d=this.attributeMap.get(t.target),c="IFRAME"===n.tagName&&"src"===o;if(c&&!this.keepIframeSrcFn(u)&&n.contentDocument)return;if(d||(this.attributes.push(d={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(t.target,d)),"type"===o&&"INPUT"===n.tagName&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Vt(n.tagName,o)){var v=Gt(this.doc,bt(n.tagName),bt(o),u,n,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(u)&&(o="rr_src"),d.attributes[o]=v,null==(e=this.generatedAttributes.get(t.target))||e.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}var f=this.unattachedDoc.createElement("span"),p=n.style;for(var g of(t.oldValue&&(f.style.cssText=t.oldValue),Array.from(p))){var m=p.getPropertyValue(g),y=p.getPropertyPriority(g);m!==f.style.getPropertyValue(g)||y!==f.style.getPropertyPriority(g)?d.styleDiff[g]=""===y?m:[m,y]:d._unchangedStyles[g]=[m,y]}for(var b of Array.from(f.style))""===p.getPropertyValue(b)&&(d.styleDiff[b]=!1)}else if("open"===o&&"DIALOG"===n.tagName){d.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";var w=this.generatedAttributes.get(t.target);w||this.generatedAttributes.set(t.target,w=new Set),w.add("rr_open_mode")}}break;case"childList":if(ye(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach((e=>this.genAdds(e,t.target))),t.removedNodes.forEach((e=>{var r=this.mirror.getId(e),i=nt(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);ye(t.target,this.blockClass,this.blockSelector,!1)||be(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(Fe(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===r||we(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Ee(r,i)]?Fe(this.movedSet,e):(this.removes.push({parentId:i,id:r,isShadow:!(!nt(t.target)||!st(t.target))||void 0}),function(t,e){for(var r=[t];r.length;){var i=r.pop();e.has(i)||(e.add(i),C.childNodes(i).forEach((t=>r.push(t))))}}(e,this.removesSubTreeCache))),this.mapRemoves.push(e))}))}})),a(this,"genAdds",((t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(be(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);var r=null;e&&this.mirror.hasNode(e)&&(r=this.mirror.getId(e)),r&&-1!==r&&(this.movedMap[Ee(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ye(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach((t=>this.genAdds(t))),Me(t)&&C.childNodes(C.shadowRoot(t)).forEach((e=>{this.processedNodeManager.add(e,this),this.genAdds(e,t)})))}}}))}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((e=>{this[e]=t[e]})),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function Fe(t,e){for(var r=[e];r.length;){var i=r.pop();t.delete(i),C.childNodes(i).forEach((t=>r.push(t)))}}function De(t,e,r){return 0!==t.size&&function(t,e,r){var i=C.parentNode(e);return!!i&&t.has(i)}(t,e)}function Le(t,e){if(0===t.size)return!1;for(var r=C.parentNode(e);r;){if(t.has(r))return!0;r=C.parentNode(r)}return!1}var Ne=function(t,e){return void 0===e&&(e="rrweb"),xe?function(){try{return t(...arguments)}catch(t){if(xe&&!0===xe(t,e))return;throw t}}:t},Pe=[];function Be(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function $e(t,e){var r,i=new Oe;i.init(t);try{r=new(S())(Ne(i.processMutations.bind(i)));var n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(n.attributeFilter=t.attributeFilter),r.observe(e,n),Pe.push(i),{observer:r,buffer:i}}catch(t){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function We(t){var e=t.scrollCb,r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,a=t.sampling,o=new Map,u=t=>{var a=Be(t);if(a&&!ye(a,n,s,!0)){var u,l,h=i.getId(a);if(a===r&&r.defaultView){var d=fe(r.defaultView);u=d.left,l=d.top}else u=a.scrollLeft,l=a.scrollTop;var c=u+","+l;o.get(h)!==c&&(o.set(h,c),e({id:h,x:u,y:l}))}},l=[ae("scroll",Ne(de(Ne((t=>u(t))),a.scroll||100)),r)];return"onscrollend"in r&&l.push(ae("scrollend",Ne(u),r)),()=>l.forEach((t=>t()))}function ze(t,e){for(var r=Pe.length-1;r>=0;r--){var i=Pe[r];if(i){var n=i.bufferBelongsToIframe(t);!n&&e&&e.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Pe.splice(r,1))}}}var je=["INPUT","TEXTAREA","SELECT"],Ue=new WeakMap;function He(t){return function t(e,r){if(Je("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Je("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Je("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Je("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){var i=Array.from(e.parentRule.cssRules).indexOf(e);return r.unshift(i),t(e.parentRule,r)}if(e.parentStyleSheet){var n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(n)}return r}(t,[])}function qe(t,e,r){var i,n;return t?(t.ownerNode?i=e.getId(t.ownerNode):n=r.getId(t),{styleId:n,id:i}):{}}var Ge=5e3;function Ve(t,e){var r,i,n,s,a=t.stylesheetManager;s=t.mirror.getId("#document"===e.nodeName?e:C.host(e));var o="#document"===e.nodeName?null==(r=e.defaultView)?void 0:r.Document:null==(n=null==(i=e.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,u=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&u?(Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var t;return null==(t=u.get)?void 0:t.call(this)},set(t){var e,r;try{r=null==(e=u.set)?void 0:e.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==s&&-1!==s)try{a.adoptStyleSheets(t,s)}catch(t){}return r}}),Ne((()=>{Object.defineProperty(e,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function Ze(t,e){void 0===e&&(e={});var i,n,s=t.doc.defaultView;if(!s)return()=>{};!function(t,e){var r=t.mutationCb,i=t.mousemoveCb,n=t.mouseInteractionCb,s=t.scrollCb,a=t.viewportResizeCb,o=t.inputCb,u=t.mediaInteractionCb,l=t.styleSheetRuleCb,h=t.styleDeclarationCb,d=t.canvasMutationCb,c=t.fontCb,v=t.selectionCb,f=t.customElementCb;t.mutationCb=function(){e.mutation&&e.mutation(...arguments),r(...arguments)},t.mousemoveCb=function(){e.mousemove&&e.mousemove(...arguments),i(...arguments)},t.mouseInteractionCb=function(){e.mouseInteraction&&e.mouseInteraction(...arguments),n(...arguments)},t.scrollCb=function(){e.scroll&&e.scroll(...arguments),s(...arguments)},t.viewportResizeCb=function(){e.viewportResize&&e.viewportResize(...arguments),a(...arguments)},t.inputCb=function(){e.input&&e.input(...arguments),o(...arguments)},t.mediaInteractionCb=function(){e.mediaInteaction&&e.mediaInteaction(...arguments),u(...arguments)},t.styleSheetRuleCb=function(){e.styleSheetRule&&e.styleSheetRule(...arguments),l(...arguments)},t.styleDeclarationCb=function(){e.styleDeclaration&&e.styleDeclaration(...arguments),h(...arguments)},t.canvasMutationCb=function(){e.canvasMutation&&e.canvasMutation(...arguments),d(...arguments)},t.fontCb=function(){e.font&&e.font(...arguments),c(...arguments)},t.selectionCb=function(){e.selection&&e.selection(...arguments),v(...arguments)},t.customElementCb=function(){e.customElement&&e.customElement(...arguments),f(...arguments)}}(t,e);var a,o,d,v,f,p,g,m,y=[],b=Ne((()=>{if(n){n.destroy(),n.reset();var e=Pe.indexOf(n);-1!==e&&Pe.splice(e,1)}t.shadowDomManager.resetForDoc(t.doc),null==i||i.disconnect(),y.forEach((t=>t()))}));try{if(t.recordDOM){var w=$e(t,t.doc);i=w.observer,n=w.buffer}if(y.push(function(t){var e=t.mousemoveCb,r=t.sampling,i=t.doc,n=t.mirror;if(!1===r.mousemove)return()=>{};var s,a="number"==typeof r.mousemove?r.mousemove:50,o="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],h=de(Ne((t=>{var r=Date.now()-s;e(l.map((t=>(t.timeOffset-=r,t))),t),l=[],s=null})),o),d=Ne(de(Ne((t=>{var e=Be(t),r=ke(t)?t.changedTouches[0]:t,i=r.clientX,a=r.clientY;s||(s=ve()),l.push({x:i,y:a,id:n.getId(e),timeOffset:ve()-s}),h("undefined"!=typeof DragEvent&&t instanceof DragEvent?u.Drag:t instanceof MouseEvent?u.MouseMove:u.TouchMove)})),a,{trailing:!1})),c=[ae("mousemove",d,i),ae("touchmove",d,i),ae("drag",d,i)];return Ne((()=>{c.forEach((t=>t()))}))}(t)),y.push(function(t){var e=t.mouseInteractionCb,i=t.doc,n=t.mirror,s=t.blockClass,a=t.blockSelector,o=t.sampling;if(!1===o.mouseInteraction)return()=>{};var u=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,d=[],c=null;return Object.keys(l).filter((t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==u[t])).forEach((t=>{var o=bt(t),u=(t=>i=>{var o=Be(i);if(!ye(o,s,a,!0)){var u=null,d=t;if("pointerType"in i){switch(i.pointerType){case"mouse":u=h.Mouse;break;case"touch":u=h.Touch;break;case"pen":u=h.Pen}u===h.Touch&&(l[t]===l.MouseDown?d="TouchStart":l[t]===l.MouseUp&&(d="TouchEnd"))}else ke(i)&&(u=h.Touch);null!==u?(c=u,(d.startsWith("Touch")&&u===h.Touch||d.startsWith("Mouse")&&u===h.Mouse)&&(u=null)):l[t]===l.Click&&(u=c,c=null);var v=ke(i)?i.changedTouches[0]:i;if(v){var f=n.getId(o),p=v.clientX,g=v.clientY;Ne(e)(r({type:l[d],id:f,x:p,y:g},null!==u&&{pointerType:u}))}}})(t);if(window.PointerEvent)switch(l[t]){case l.MouseDown:case l.MouseUp:o=o.replace("mouse","pointer");break;case l.TouchStart:case l.TouchEnd:return}d.push(ae(o,u,i))})),Ne((()=>{d.forEach((t=>t()))}))}(t)),y.push(We(t)),y.push(function(t,e){var r=t.viewportResizeCb,i=e.win,n=-1,s=-1;return ae("resize",Ne(de(Ne((()=>{var t=pe(),e=ge();n===t&&s===e||(r({width:Number(e),height:Number(t)}),n=t,s=e)})),200)),i)}(t,{win:s})),y.push(function(t){var e=t.inputCb,i=t.doc,n=t.mirror,s=t.blockClass,a=t.blockSelector,o=t.ignoreClass,u=t.ignoreSelector,l=t.maskInputOptions,h=t.maskInputFn,d=t.userTriggeredOnInput;function c(t){var e=Be(t),r=t.isTrusted,n=i.defaultView;if(!e||!n||e instanceof n.HTMLElement){var c=e&&e.tagName;if(e&&"OPTION"===c&&(e=C.parentElement(e)),e&&c&&je.indexOf(c)>=0&&!ye(e,s,a,!0)&&!(e.classList.contains(o)||u&&e.matches(u))){var f=e.value,p=!1,g=St(e)||"";"radio"===g||"checkbox"===g?p=e.checked:(l[c.toLowerCase()]||l[g])&&(f=yt({element:e,maskInputOptions:l,tagName:c,type:g,value:f,maskInputFn:h})),v(e,d?{text:f,isChecked:p,userTriggered:r}:{text:f,isChecked:p});var m=e.name;"radio"===g&&m&&p&&i.querySelectorAll('input[type="radio"][name="'+m+'"]').forEach((t=>{if(t!==e){var r=t.value;v(t,d?{text:r,isChecked:!p,userTriggered:!1}:{text:r,isChecked:!p})}}))}}}function v(t,i){var s=Ue.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Ue.set(t,i);var a=n.getId(t);Ne(e)(r({},i,{id:a}))}}var f=("last"===t.sampling.input?["change"]:["input","change"]).map((t=>ae(t,Ne(c),i))),p=i.defaultView;if(!p)return()=>{f.forEach((t=>t()))};var g=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value");return g&&g.set&&f.push(...[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]].map((t=>ce(t[0],t[1],{set(){Ne(c)({target:this,isTrusted:!1})}},!1,p)))),Ne((()=>{f.forEach((t=>t()))}))}(t)),y.push(function(t){var e=t.mediaInteractionCb,r=t.blockClass,i=t.blockSelector,n=t.mirror,s=t.sampling,a=t.doc,o=Ne((t=>de(Ne((s=>{var a=Be(s);if(a&&!ye(a,r,i,!0)){var o=a.currentTime,u=a.volume,l=a.muted,h=a.playbackRate,d=a.loop;e({type:t,id:n.getId(a),currentTime:o,volume:u,muted:l,playbackRate:h,loop:d})}})),s.media||500))),u=[ae("play",o(c.Play),a),ae("pause",o(c.Pause),a),ae("seeked",o(c.Seeked),a),ae("volumechange",o(c.VolumeChange),a),ae("ratechange",o(c.RateChange),a)];return Ne((()=>{u.forEach((t=>t()))}))}(t)),t.recordDOM){var k=function(t){var e=new Map,r=new Set,i=!0,n=t=>{if(i)try{t()}catch(t){}},s=t=>{var r,i=e.get(t);if(i){for(;null==(r=i[0])?void 0:r.ready;){var s=i.shift();(null==s?void 0:s.emit)&&n(s.emit)}0===i.length&&e.delete(t)}};return{queueMutation(t,r){if(t){var i=e.get(t);i?(i.push({emit:r,ready:!0}),s(t)):n(r)}else n(r)},queuePendingMutation(a,o,u){if(!i)return()=>{};var l=e.get(a);l||e.set(a,l=[]);var h={emit:o,ready:!1};l.push(h);var d,c=!1,v=!1,f=()=>{c||v||(c=!0,void 0!==d&&r.delete(d),h.ready=!0,h.emit=void 0,s(a))};try{d=t.setTimeout(f,Ge),c||v?t.clearTimeout(d):r.add(d)}catch(t){f()}return e=>{!v&&i&&(v=!0,void 0!==d&&(t.clearTimeout(d),r.delete(d)),c?e&&n(u):(h.ready=!0,e||(h.emit=void 0),s(a)))}},reset(){i=!1,r.forEach((e=>t.clearTimeout(e))),r.clear(),e.clear()}}}(s);y.push(k.reset),y.push(function(t,e){var r=t.styleSheetRuleCb,i=t.mirror,n=t.stylesheetManager,s=e.win,a=e.mutationQueue;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var o=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:Ne(((t,e,s)=>{var o=s[0],u=t.apply(e,s);n.onCssomSheetMutation(e);var l=qe(e,i,n.styleMirror),h=l.id,d=l.styleId;return(h&&-1!==h||d&&-1!==d)&&a.queueMutation(e,(()=>r({id:h,styleId:d,adds:[{rule:o,index:u}]}))),u}),"host")}),s.CSSStyleSheet.prototype.addRule=function(t,e,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[t+" { "+e+" }",r])};var u,l,h=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(h,{apply:Ne(((t,e,s)=>{var o=s[0],u=t.apply(e,s);n.onCssomSheetMutation(e);var l=qe(e,i,n.styleMirror),h=l.id,d=l.styleId;return(h&&-1!==h||d&&-1!==d)&&a.queueMutation(e,(()=>r({id:h,styleId:d,removes:[{index:o}]}))),u}),"host")}),s.CSSStyleSheet.prototype.removeRule=function(t){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},s.CSSStyleSheet.prototype.replace&&(u=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(u,{apply:Ne(((t,e,s)=>{var o=s[0],u=t.apply(e,s);try{var l=null==u?void 0:u.then;if(e.ownerNode||!u||"function"!=typeof l)return u;n.onCssomSheetMutation(e);var h=qe(e,i,n.styleMirror),d=h.id,c=h.styleId;if(!(d&&-1!==d||c&&-1!==c))return u;var v=a.queuePendingMutation(e,(()=>r({id:d,styleId:c,replace:o})),(()=>{var t=lt(e);null!==t&&r({id:d,styleId:c,replace:t})}));try{l.call(u,(()=>v(!0)),(()=>v(!1)))}catch(t){v(!1)}}catch(t){}return u}),"host")})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Ne(((t,e,s)=>{var o=s[0],u=t.apply(e,s);n.onCssomSheetMutation(e);var l=qe(e,i,n.styleMirror),h=l.id,d=l.styleId;return(h&&-1!==h||d&&-1!==d)&&a.queueMutation(e,(()=>r({id:h,styleId:d,replaceSync:o}))),u}),"host")}));var d={};Qe("CSSGroupingRule")?d.CSSGroupingRule=s.CSSGroupingRule:(Qe("CSSMediaRule")&&(d.CSSMediaRule=s.CSSMediaRule),Qe("CSSConditionRule")&&(d.CSSConditionRule=s.CSSConditionRule),Qe("CSSSupportsRule")&&(d.CSSSupportsRule=s.CSSSupportsRule));var c={};return Object.entries(d).forEach((t=>{var e=t[0],s=t[1];c[e]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(c[e].insertRule,{apply:Ne(((t,e,s)=>{var o=s[0],u=t.apply(e,s);n.onCssomSheetMutation(e.parentStyleSheet);var l=qe(e.parentStyleSheet,i,n.styleMirror),h=l.id,d=l.styleId;if(e.parentStyleSheet&&(h&&-1!==h||d&&-1!==d)){var c=[...He(e),u];a.queueMutation(e.parentStyleSheet,(()=>r({id:h,styleId:d,adds:[{rule:o,index:c}]})))}return u}),"host")}),s.prototype.deleteRule=new Proxy(c[e].deleteRule,{apply:Ne(((t,e,s)=>{var o=s[0],u=t.apply(e,s);n.onCssomSheetMutation(e.parentStyleSheet);var l=qe(e.parentStyleSheet,i,n.styleMirror),h=l.id,d=l.styleId;if(e.parentStyleSheet&&(h&&-1!==h||d&&-1!==d)){var c=[...He(e),o];a.queueMutation(e.parentStyleSheet,(()=>r({id:h,styleId:d,removes:[{index:c}]})))}return u}),"host")})})),Ne((()=>{s.CSSStyleSheet.prototype.insertRule=o,s.CSSStyleSheet.prototype.deleteRule=h,u&&(s.CSSStyleSheet.prototype.replace=u),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(d).forEach((t=>{var e=t[0],r=t[1];r.prototype.insertRule=c[e].insertRule,r.prototype.deleteRule=c[e].deleteRule}))}))}(t,{win:s,mutationQueue:k})),y.push(Ve(t,t.doc)),y.push(function(t,e){var r=t.styleDeclarationCb,i=t.mirror,n=t.ignoreCSSAttributes,s=t.stylesheetManager,a=e.win,o=e.mutationQueue,u=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(u,{apply:Ne(((t,e,a)=>{var u,l=a[0],h=a[1],d=a[2],c=t.apply(e,a);if(n.has(l))return c;var v=null==(u=e.parentRule)?void 0:u.parentStyleSheet;s.onCssomSheetMutation(v);var f=qe(v,i,s.styleMirror),p=f.id,g=f.styleId;if(p&&-1!==p||g&&-1!==g){var m=He(e.parentRule);o.queueMutation(v,(()=>r({id:p,styleId:g,set:{property:l,value:h,priority:d},index:m})))}return c}),"host")});var l=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(l,{apply:Ne(((t,e,a)=>{var u,l=a[0],h=t.apply(e,a);if(n.has(l))return h;var d=null==(u=e.parentRule)?void 0:u.parentStyleSheet;s.onCssomSheetMutation(d);var c=qe(d,i,s.styleMirror),v=c.id,f=c.styleId;if(v&&-1!==v||f&&-1!==f){var p=He(e.parentRule);o.queueMutation(d,(()=>r({id:v,styleId:f,remove:{property:l},index:p})))}return h}),"host")}),Ne((()=>{a.CSSStyleDeclaration.prototype.setProperty=u,a.CSSStyleDeclaration.prototype.removeProperty=l}))}(t,{win:s,mutationQueue:k})),t.collectFonts&&y.push(function(t){var e=t.fontCb,r=t.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,a=i.FontFace;i.FontFace=function(t,e,r){var i=new a(t,e,r);return s.set(i,{family:t,buffer:"string"!=typeof e,descriptors:r,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),i};var o=M(r.fonts,"add",(function(t){return function(r){return setTimeout(Ne((()=>{var t=s.get(r);t&&(e(t),s.delete(r))})),0),t.apply(this,[r])}}));return n.push((()=>{i.FontFace=a})),n.push(o),Ne((()=>{n.forEach((t=>t()))}))}(t))}for(var _ of(y.push((o=(a=t).doc,d=a.mirror,v=a.blockClass,f=a.blockSelector,p=a.selectionCb,g=!0,(m=Ne((()=>{var t=o.getSelection();if(!(!t||g&&(null==t?void 0:t.isCollapsed))){g=t.isCollapsed||!1;for(var e=[],r=t.rangeCount||0,i=0;r>i;i++){var n=t.getRangeAt(i),s=n.startContainer,a=n.startOffset,u=n.endContainer,l=n.endOffset;ye(s,v,f,!0)||ye(u,v,f,!0)||e.push({start:d.getId(s),startOffset:a,end:d.getId(u),endOffset:l})}p({ranges:e})}})))(),ae("selectionchange",m))),y.push(function(t){var e=t.customElementCb,r=t.doc.defaultView;return r&&r.customElements?M(r.customElements,"define",(function(t){return function(r,i,n){try{e({define:{name:r}})}catch(t){console.warn("Custom element callback failed for "+r)}return t.apply(this,[r,i,n])}})):()=>{}}(t)),t.plugins))y.push(_.observer(_.callback,s,_.options))}catch(t){try{b()}catch(t){}throw t}return b}function Je(t){return void 0!==window[t]}function Qe(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class Xe{constructor(t){a(this,"iframeRemoteIdToLocalIdMap",new WeakMap),a(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,r,i){if(0>e)return e;var n=r||this.getRemoteIdToLocalIdMap(t),s=i||this.getLocalIdToRemoteIdMap(t),a=n.get(e);return void 0===a&&(a=this.generateIdFn(),n.set(e,a),s.set(a,e)),a}getIds(t,e){var r=this.getRemoteIdToLocalIdMap(t),i=this.getLocalIdToRemoteIdMap(t);return e.map((e=>this.getId(t,e,r,i)))}getRemoteId(t,e,r){var i;return"number"!=typeof e||0>e?e:null!==(i=(r||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==i?i:-1}getRemoteIds(t,e){var r=this.getLocalIdToRemoteIdMap(t);return e.map((e=>this.getRemoteId(t,e,r)))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){var e=this.iframeRemoteIdToLocalIdMap.get(t);return e||this.iframeRemoteIdToLocalIdMap.set(t,e=new Map),e}getLocalIdToRemoteIdMap(t){var e=this.iframeLocalIdToRemoteIdMap.get(t);return e||this.iframeLocalIdToRemoteIdMap.set(t,e=new Map),e}}class Ke{constructor(t){a(this,"iframes",new WeakMap),a(this,"crossOriginIframeMap",new WeakMap),a(this,"crossOriginIframeMirror",new Xe($t)),a(this,"crossOriginIframeStyleMirror"),a(this,"crossOriginIframeRootIdMap",new WeakMap),a(this,"mirror"),a(this,"mutationCb"),a(this,"wrappedEmit"),a(this,"loadListener"),a(this,"pageHideListener"),a(this,"stylesheetManager"),a(this,"recordCrossOriginIframes"),a(this,"messageHandler"),a(this,"nestedIframeListeners",new Map),a(this,"attachedWindows",new WeakMap),a(this,"attachedDocuments",new WeakMap),a(this,"attachedIframes",new Map),a(this,"loadListenerDisposers",new WeakMap),a(this,"iframeElementsById",new Map),a(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Xe(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){var r=this.loadListenerDisposers.get(t);r||this.loadListenerDisposers.set(t,r=new Set),r.add(e);var i=this.mirror.getId(t);-1!==i&&this.iframeElementsById.set(i,t)}getIframeElementById(t){var e,r,i;return null!==(e=null!==(r=null==(i=this.attachedIframes.get(t))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){var e=this.loadListenerDisposers.get(t);e&&(e.forEach((t=>ue(t))),this.loadListenerDisposers.delete(t))}removePageHideListener(t){var e=this.pageHideHandlers.get(t);e&&(e.forEach((t=>{oe(t.win,"pagehide",t.handler)})),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){var r=this.mirror.getId(t);return this.attachedIframes.set(r,{element:t,content:e}),r}attachIframe(t,e){var r,i=this.trackIframeContent(t,e);if(t.contentDocument){var n=this.attachedDocuments.get(t);n||this.attachedDocuments.set(t,n=new Set),n.add(t.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var a=this.handleMessage.bind(this);ue((()=>{s.addEventListener("message",a),this.nestedIframeListeners.set(s,a);var e=this.attachedWindows.get(t);e||this.attachedWindows.set(t,e=new Set),e.add(s)}))}ue((()=>{var e=t.contentWindow;if(e){var r=this.pageHideHandlers.get(t);if(r)for(var i of r)if(i.win===e)return;var n=()=>{var e;null==(e=this.pageHideListener)||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument),t.contentWindow&&this.crossOriginIframeMap.delete(t.contentWindow)};e.addEventListener("pagehide",n),r||this.pageHideHandlers.set(t,r=new Set),r.add({win:e,handler:n})}})),null==(r=this.loadListener)||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){var e=t;if("rrweb"===e.data.type&&e.origin===e.data.origin&&t.source){var r=this.crossOriginIframeMap.get(t.source);if(r){var i=this.transformCrossOriginEvent(r,e.data.event);i&&this.wrappedEmit(i,e.data.isCheckout)}}}transformCrossOriginEvent(t,e){var r;switch(e.type){case o.FullSnapshot:this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);var i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:o.IncrementalSnapshot,data:{source:u.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case o.Meta:case o.Load:case o.DomContentLoaded:return!1;case o.Plugin:return e;case o.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case o.IncrementalSnapshot:switch(e.data.source){case u.Mutation:return e.data.adds.forEach((e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);var r=this.crossOriginIframeRootIdMap.get(t);r&&this.patchRootIdOnNode(e.node,r)})),e.data.removes.forEach((e=>{this.replaceIds(e,t,["parentId","id"])})),e.data.attributes.forEach((e=>{this.replaceIds(e,t,["id"])})),e.data.texts.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case u.Drag:case u.TouchMove:case u.MouseMove:return e.data.positions.forEach((e=>{this.replaceIds(e,t,["id"])})),e;case u.ViewportResize:return!1;case u.MediaInteraction:case u.MouseInteraction:case u.Scroll:case u.CanvasMutation:case u.Input:return this.replaceIds(e.data,t,["id"]),e;case u.StyleSheetRule:case u.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case u.Font:return e;case u.Selection:return e.data.ranges.forEach((e=>{this.replaceIds(e,t,["start","end"])})),e;case u.AdoptedStyleSheet:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null==(r=e.data.styles)||r.forEach((e=>{this.replaceStyleIds(e,t,["styleId"])})),e}}return!1}replace(t,e,r,i){for(var n of i)(Array.isArray(e[n])||"number"==typeof e[n])&&(e[n]=Array.isArray(e[n])?t.getIds(r,e[n]):t.getId(r,e[n]));return e}replaceIds(t,e,r){return this.replace(this.crossOriginIframeMirror,t,e,r)}replaceStyleIds(t,e,r){return this.replace(this.crossOriginIframeStyleMirror,t,e,r)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach((t=>{this.replaceIdOnNode(t,e)}))}patchRootIdOnNode(t,e){t.type===v.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach((t=>{this.patchRootIdOnNode(t,e)}))}removeIframeById(t){var e=this.attachedIframes.get(t),r=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((t=>{var e=this.nestedIframeListeners.get(t);e&&(oe(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(oe(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((t=>{ue((()=>this.mirror.removeNodeFromMap(t)))})),ue((()=>ze(r,s))),this.attachedDocuments.delete(r))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var t=[];this.attachedIframes.forEach(((e,r)=>{this.mirror.has(r)||t.push(r)})),t.forEach((t=>this.removeIframeById(t)))}}reattachIframes(){this.attachedIframes.forEach(((t,e)=>{var r=t.content;this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)}))}destroy(){this.recordCrossOriginIframes&&oe(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((t,e)=>{oe(e,"message",t)})),this.nestedIframeListeners.clear();var t=new Set;this.iframeElementsById.forEach((e=>t.add(e))),this.attachedIframes.forEach((e=>t.add(e.element))),t.forEach((t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class Ye{constructor(t){a(this,"shadowDoms",new WeakSet),a(this,"mutationCb"),a(this,"scrollCb"),a(this,"bypassOptions"),a(this,"mirror"),a(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(st(t)&&!this.shadowDoms.has(t)){this.shadowDoms.add(t);var s=null!==(i=null==(n=C.host(t))?void 0:n.ownerDocument)&&void 0!==i?i:e,a=$e(r({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),o=a.observer,u=a.buffer;this.restoreHandlers.push({doc:s,handler(){o.disconnect(),u.destroy(),u.releaseCanvasManager();var t=Pe.indexOf(u);-1!==t&&Pe.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:We(r({},this.bypassOptions,{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout((()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(C.host(t))),this.restoreHandlers.push({doc:s,handler:Ve({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})}),0)}}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){var r=this;this.restoreHandlers.push({doc:e,handler:M(t.prototype,"attachShadow",(function(t){return function(i){var n=t.call(this,i),s=C.shadowRoot(this);return s&&Ae(this)&&r.addShadowRoot(s,e),n}}))})}reset(){this.restoreHandlers.forEach((t=>{var e=t.handler;try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){var e=[];for(var r of this.restoreHandlers)if(r.doc===t)try{r.handler()}catch(t){}else e.push(r);this.restoreHandlers=e}}var tr="skip-frame";function er(t){if("object"!=typeof t||null===t)return!1;var e=t.y,r=t.width,i=t.height;return Number.isFinite(t.x)&&Number.isFinite(e)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var rr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ir="undefined"==typeof Uint8Array?[]:new Uint8Array(256),nr=0;64>nr;nr++)ir[rr.charCodeAt(nr)]=nr;var sr=new Map,ar=(t,e,r)=>{if(t&&(lr(t,e)||"object"==typeof t)){var i=function(t,e){var r=sr.get(t);return r||sr.set(t,r=new Map),r.has(e)||r.set(e,[]),r.get(e)}(r,t.constructor.name),n=i.indexOf(t);return-1===n&&(n=i.length,i.push(t)),n}};function or(t,e,r,i){if(t instanceof Array)return t.map((t=>or(t,e,r,i)));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){var n=t.constructor.name,s=function(t){var e,r=new Uint8Array(t),i=r.length,n="";for(e=0;i>e;e+=3)n+=rr[r[e]>>2],n+=rr[(3&r[e])<<4|r[e+1]>>4],n+=rr[(15&r[e+1])<<2|r[e+2]>>6],n+=rr[63&r[e+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(t);return{rr_type:n,base64:s}}return t instanceof DataView?{rr_type:t.constructor.name,args:[or(t.buffer,e,r,i),t.byteOffset,t.byteLength]}:t instanceof HTMLImageElement?{rr_type:t.constructor.name,src:t.src}:t instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:t.toDataURL(i.type,i.quality)}:t instanceof ImageData?{rr_type:t.constructor.name,args:[or(t.data,e,r,i),t.width,t.height]}:lr(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:ar(t,e,r)}:t}var ur=(t,e,r,i)=>t.map((t=>or(t,e,r,i))),lr=(t,e)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((t=>"function"==typeof e[t]));return Boolean(r.find((r=>t instanceof e[r])))},hr=["webgl","webgl2"];function dr(t){return"nodeType"in t}function cr(t,e,i,n){var s=[];try{if(n){var a=function(t,e,i){var n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return M(n.prototype,"configure",(function(n){return function(s){var a=function(t){var e=t.canvas;return e&&"object"==typeof e?e:null}(this);if(!a||dr(a)&&ye(a,e,i,!0))return n.call(this,s);dr(a)&&!("__context"in a)&&(a.__context="webgpu");var o=function(t){var e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?r({},s,{usage:"number"==typeof s.usage?s.usage|o:o}):s)}}))}(t,e,i);a&&s.push(a)}var o=M(t.HTMLCanvasElement.prototype,"getContext",(function(t){return function(r){for(var s=function(t){return"experimental-webgl"===t?"webgl":t}(r),a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];if(!ye(this,e,i,!0)&&("__context"in this||(this.__context=s),n&&hr.includes(s)))if(o[0]&&"object"==typeof o[0]){var l=o[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[r,...o])}}));s.push(o)}catch(t){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((t=>t()))}}function vr(t,e,r,i,n,s,a){var o=[],u=Object.getOwnPropertyNames(t),l=function(u){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))return 0;try{if("function"!=typeof t[u])return 0;var l=M(t,u,(function(t){return function(){for(var o=arguments.length,l=new Array(o),h=0;o>h;h++)l[h]=arguments[h];var d=t.apply(this,l);if(ar(d,s,this),this.canvas&&"tagName"in this.canvas&&!ye(this.canvas,i,n,!0)){var c=ur(l,s,this,a);r(this.canvas,{type:e,property:u,args:c})}return d}}));o.push(l)}catch(s){var h=ce(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!ye(this.canvas,i,n,!0)&&r(this.canvas,{type:e,property:u,args:[t],setter:!0})}});o.push(h)}};for(var h of u)l(h);return o}var fr,pr,gr,mr='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\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',yr="undefined"!=typeof self&&self.Blob&&new Blob([mr],{type:"text/javascript;charset=utf-8"});function br(t){var e;try{if(!(e=yr&&(self.URL||self.webkitURL).createObjectURL(yr)))throw"";var r=new Worker(e,{name:null==t?void 0:t.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),r}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(mr),{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class wr{constructor(t){a(this,"pendingCanvasMutations",new Map),a(this,"rafStamps",{latestId:0,invokeId:null}),a(this,"mirror"),a(this,"mutationCb"),a(this,"resetObservers"),a(this,"frozen",!1),a(this,"locked",!1),a(this,"rafIdTimestamp",null),a(this,"rafIdFlush",null),a(this,"refCount",0),a(this,"torndown",!1),a(this,"resetFrameDedup",null),a(this,"processMutation",((t,e)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)}));var e=t.sampling,r=void 0===e?"all":e,i=t.win,n=t.blockClass,s=t.blockSelector,o=t.recordCanvas,u=t.dataURLOptions,l=t.resolutionScale,h=t.canvasMasking;this.mutationCb=t.mutationCb,this.mirror=t.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,u),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:u,resolutionScale:l,canvasMasking:h})}onFullSnapshot(){var t;null==(t=this.resetFrameDedup)||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,i,n,s){var a=this;if("OffscreenCanvas"in r){var o,u="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=cr(r,i,n,!0),h=new Map;try{o=new br}catch(t){return}var c=!1;o.onerror=()=>{var t;c=!0,cancelAnimationFrame(v),null==(t=o.terminate)||t.call(o),this.resetFrameDedup=null},this.resetFrameDedup=()=>{o.postMessage({resetFrameDedup:!0})},o.onmessage=t=>{var e=t.data.id;if(h.set(e,!1),"base64"in t.data){var r=t.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:e,type:d["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var v,f=1e3/t,p=0,g=t=>{var l,d;c||(p&&f>t-p||(p=t,(l=[],d=t=>{try{t.querySelectorAll("canvas").forEach((t=>{ye(t,i,n,!0)||l.push(t)})),t.querySelectorAll("*").forEach((t=>{t.shadowRoot&&d(t.shadowRoot)}))}catch(t){}},d(r.document),l).forEach(function(){var t=e((function*(t){var e,r,i=a.mirror.getId(t);if(!h.get(i)&&0!==t.width&&0!==t.height){h.set(i,!0);try{if(["webgl","webgl2"].includes(t.__context)){var n=t.getContext(t.__context);if(null==(e=null==n?void 0:n.isContextLost)?void 0:e.call(n))return void h.set(i,!1);!1===(null==(r=null==n?void 0:n.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}var l=t.clientWidth||t.width,d=t.clientHeight||t.height,c=Math.max(1,Math.round(l*u)),v=Math.max(1,Math.round(d*u)),f=function(t,e,r,i,n,s){if(t&&"function"==typeof t.regionsFn){var a;try{a=t.regionsFn(e)}catch(t){return tr}if(void 0!==a){if(!Array.isArray(a)||!a.every(er))return tr;var o=r/n,u=i/s;return a.filter((t=>t.width>0&&t.height>0)).map((t=>{var e=Math.floor(t.x*o),r=Math.floor(t.y*u);return{x:e,y:r,width:Math.ceil((t.x+t.width)*o)-e,height:Math.ceil((t.y+t.height)*u)-r}}))}}}(s.canvasMasking,t,c,v,l,d);if(f===tr)return void h.set(i,!1);var p=yield createImageBitmap(t,1>u?{resizeWidth:c,resizeHeight:v,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:v});o.postMessage({id:i,bitmap:p,width:c,height:v,displayWidth:l,displayHeight:d,dataURLOptions:s.dataURLOptions,maskRegions:f},[p])}catch(t){h.set(i,!1)}}}));return function(e){return t.apply(this,arguments)}}())),v=requestAnimationFrame(g))};v=requestAnimationFrame(g),this.resetObservers=()=>{var t;l(),cancelAnimationFrame(v),null==(t=o.terminate)||t.call(o),this.resetFrameDedup=null}}}initCanvasMutationObserver(t,e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=cr(t,e,r,!1),s=function(t,e,r,i,n){var s=[],a=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),o=function(a){try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])return 1;var o=M(e.CanvasRenderingContext2D.prototype,a,(function(s){return function(){for(var o=arguments.length,u=new Array(o),l=0;o>l;l++)u[l]=arguments[l];return ye(this.canvas,r,i,!0)||setTimeout((()=>{var r=ur(u,e,this,n);t(this.canvas,{type:d["2D"],property:a,args:r})}),0),s.apply(this,u)}}));s.push(o)}catch(n){var u=ce(e.CanvasRenderingContext2D.prototype,a,{set(e){ye(this.canvas,r,i,!0)||t(this.canvas,{type:d["2D"],property:a,args:[e],setter:!0})}});s.push(u)}};for(var u of a)o(u);return()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i),a=function(t,e,r,i,n){var s=[];return void 0!==e.WebGLRenderingContext&&s.push(...vr(e.WebGLRenderingContext.prototype,d.WebGL,t,r,i,e,n)),void 0!==e.WebGL2RenderingContext&&s.push(...vr(e.WebGL2RenderingContext.prototype,d.WebGL2,t,r,i,e,n)),()=>{s.forEach((t=>t()))}}(this.processMutation.bind(this),t,e,r,i);this.resetObservers=()=>{n(),s(),a()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((t,e)=>{var r=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(t,e){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(t);if(r&&-1!==e){var i=r.map((t=>function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,n)));this.mutationCb({id:e,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(t)}}}}class kr{constructor(t){var e;a(this,"trackedLinkElements",new WeakSet),a(this,"pendingDeferredSheets",new Set),a(this,"mutationCb"),a(this,"adoptedStyleSheetCb"),a(this,"maskAllElementAttributes"),a(this,"maskAttributeFn"),a(this,"styleMirror",new Ce),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;var r=null,i=null;try{(i=t.sheet)&&(r=gt(i))}catch(t){}if(!r||!i)return et(),null;var n=r,s=!1,a={sheet:i,invalidate(){s=!0}};this.pendingDeferredSheets.add(a);var o=!1;return{advance:r=>{if(o)return!0;var u,l,h=A(),d=O(),c=!0;try{if(s)return o=!0,et(),!0;if(!n.advance(r))return c=!1,!1;o=!0;var v=n.text();if(!t.isConnected)return!0;var f=null;try{f=t.sheet}catch(t){}return f!==i?(et(),!0):v?(this.emitCssTextMutation(t,e,v),!0):(et(),!0)}finally{c&&this.pendingDeferredSheets.delete(a),F(u=A()-h,null!=(l=d)?l:R)||(q.totalMs+=u,u>q.slowestSliceMs&&(q.slowestSliceMs=u))}},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(a)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(var e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var r;null==(r=this.beginDeferredLinkInlining(t,e))||r.advance(1/0)}emitCssTextMutation(t,e,r){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:kt({element:t,name:"_cssText",value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){var r=this;if(0!==t.length){var i={id:e,styleIds:[]},n=[],s=function(t){var e;if(r.styleMirror.has(t))e=r.styleMirror.getId(t);else{var s=r.styleMirror.add(t);e=s;var a=A();try{K((()=>{try{var e=t.rules||t.cssRules;e&&X(e)}catch(t){}n.push({styleId:s,rules:Array.from(t.rules||CSSRule,((e,r)=>({rule:ht(e,t.href),index:r})))})}))}finally{Y(A()-a)}}i.styleIds.push(e)};for(var a of t)s(a);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Xt.forEach((t=>t.abort())),Xt.clear()}trackStylesheetInLinkElement(t){}}class _r{constructor(){a(this,"nodeMap",new WeakMap),a(this,"active",!1)}inOtherBuffer(t,e){var r=this.nodeMap.get(t);return r&&Array.from(r).some((t=>t!==e))}add(t,e){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}}var Sr=!1;try{if(2!==Array.from([1],(t=>2*t))[0]){var Mr=document.createElement("iframe");document.body.appendChild(Mr),Array.from=(null==(i=Mr.contentWindow)?void 0:i.Array.from)||Array.from,document.body.removeChild(Mr)}}catch(t){console.debug("Unable to override Array.from",t)}var Cr=new mt,Ir=new Set([u.Mutation,u.MediaInteraction,u.StyleSheetRule,u.CanvasMutation,u.Font,u.Log,u.StyleDeclaration,u.AdoptedStyleSheet]);function Ar(t){var e=window;if("function"==typeof e.requestIdleCallback){var r=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null==(t=e.cancelIdleCallback)?void 0:t.call(e,r)}}}var i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function Rr(t){var e;void 0===t&&(t={});var i=t,n=i.emit,s=i.checkoutEveryNms,a=i.checkoutEveryNth,l=i.blockClass,h=void 0===l?"rr-block":l,d=i.blockSelector,c=void 0===d?null:d,v=i.ignoreClass,f=void 0===v?"rr-ignore":v,p=i.ignoreSelector,g=void 0===p?null:p,m=i.maskTextClass,y=void 0===m?"rr-mask":m,b=i.maskTextSelector,w=void 0===b?null:b,k=i.inlineStylesheet,_=void 0===k||k,S=i.inlineStylesheetBudgetRules,M=i.maskAllInputs,I=i.maskInputOptions,A=i.slimDOMOptions,R=i.maskInputFn,T=i.maskTextFn,x=i.maskAllElementAttributes,O=void 0!==x&&x,F=i.maskAttributeFn,D=i.hooks,L=i.packFn,N=i.sampling,P=void 0===N?{}:N,B=i.dataURLOptions,W=void 0===B?{}:B,j=i.canvasResolutionScale,U=i.canvasMasking,H=i.mousemoveWait,q=i.recordDOM,G=void 0===q||q,J=i.recordCanvas,Q=void 0!==J&&J,X=i.recordCrossOriginIframes,K=void 0!==X&&X,Y=i.recordAfter,tt=void 0===Y?"DOMContentLoaded"===t.recordAfter?t.recordAfter:"load":Y,et=i.userTriggeredOnInput,it=void 0!==et&&et,nt=i.collectFonts,st=void 0!==nt&&nt,at=i.inlineImages,ot=void 0!==at&&at,ut=i.plugins,lt=i.keepIframeSrcFn,ht=void 0===lt?()=>!1:lt,dt=i.ignoreCSSAttributes,ct=void 0===dt?new Set([]):dt,vt=i.attributeFilter;xe=i.errorHandler;var ft=r({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},W),pt=!K||window.parent===window,gt=!1;if(!pt)try{window.parent.document&&(gt=!1)}catch(t){gt=!0}if(pt&&!n)throw new Error("emit function is required");if(!pt&&!gt)return()=>{};void 0!==H&&void 0===P.mousemove&&(P.mousemove=H),Cr.reset();var yt,bt=!0===M?{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!==I?I:{password:!0},wt=ne(void 0!==A&&A);!function(t){void 0===t&&(t=window),"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();var kt,_t,St=0,Mt=new Map,Ct=t=>{for(var e of ut||[])e.eventProcessor&&(t=e.eventProcessor(t));return L&&!gt&&(t=L(t)),t};fr=(t,e)=>{var r,i=t;if(i.timestamp=ve(),!(null==(r=Pe[0])?void 0:r.isFrozen())||i.type===o.FullSnapshot||i.type===o.IncrementalSnapshot&&Ir.has(i.data.source)||Pe.forEach((t=>t.unfreeze())),pt)null==n||n(Ct(i),e);else if(gt){var l={type:"rrweb",event:Ct(i),origin:window.location.origin,isCheckout:e};window.parent.postMessage(l,"*")}if(i.type===o.FullSnapshot)yt=i,St=0;else if(i.type===o.IncrementalSnapshot){if(i.data.source===u.Mutation&&i.data.isAttachIframe)return;St++,(a&&St>=a||s&&i.timestamp-yt.timestamp>s)&&pr(!0)}};var It=t=>{if(t.removes&&t.removes.length>0){var e=t.adds.length>0?new Set(t.adds.map((t=>t.node.id))):null,i=new Set;if(t.adds.length>0)for(var n of t.adds){var s=Cr.getNode(n.node.id);s&&"IFRAME"===s.nodeName&&i.add(s)}t.removes.forEach((t=>{var r=t.id;if(!e||!e.has(r)){var n=xt.getIframeElementById(r);n&&i.has(n)?xt.forgetIframeId(r):(null==kt||kt(r),xt.removeIframeById(r))}})),null==_t||_t(),xt.cleanupDetachedIframes()}fr({type:o.IncrementalSnapshot,data:r({source:u.Mutation},t)})},At=t=>fr({type:o.IncrementalSnapshot,data:r({source:u.Scroll},t)}),Rt=t=>fr({type:o.IncrementalSnapshot,data:r({source:u.CanvasMutation},t)}),Tt=new kr({mutationCb:It,adoptedStyleSheetCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.AdoptedStyleSheet},t)}),maskAllElementAttributes:O,maskAttributeFn:F}),xt=new Ke({mirror:Cr,mutationCb:It,stylesheetManager:Tt,recordCrossOriginIframes:K,wrappedEmit:fr});for(var Et of ut||[])Et.getMirror&&Et.getMirror({nodeMirror:Cr,crossOriginIframeMirror:xt.crossOriginIframeMirror,crossOriginIframeStyleMirror:xt.crossOriginIframeStyleMirror});var Ot=new _r,Ft=null==U?void 0:U.configured;gr=new wr({recordCanvas:Q,mutationCb:Rt,win:window,blockClass:h,blockSelector:c,mirror:Cr,sampling:P.canvas,dataURLOptions:ft,resolutionScale:j,canvasMasking:U});var Dt=new Ye({mutationCb:It,scrollCb:At,bypassOptions:{blockClass:h,blockSelector:c,maskTextClass:y,maskTextSelector:w,inlineStylesheet:_,maskInputOptions:bt,dataURLOptions:ft,maskTextFn:T,maskInputFn:R,maskAllElementAttributes:O,maskAttributeFn:F,recordCanvas:Q,canvasMaskingConfigured:Ft,inlineImages:ot,sampling:P,slimDOMOptions:wt,iframeManager:xt,stylesheetManager:Tt,canvasManager:gr,keepIframeSrcFn:ht,processedNodeManager:Ot,attributeFilter:vt},mirror:Cr});pr=function(t){if(void 0===t&&(t=!1),G){V(S);try{fr({type:o.Meta,data:{href:window.location.href,width:ge(),height:pe()}},t),null==e||e.cancel(),e=void 0,Tt.reset(),Dt.init(),Pe.forEach((t=>t.lock()));var r,i=null;try{i=function(t,e){var r=e||{},i=r.mirror,n=void 0===i?new mt:i,s=r.blockClass,a=void 0===s?"rr-block":s,o=r.blockSelector,u=void 0===o?null:o,l=r.maskTextClass,h=void 0===l?"rr-mask":l,d=r.maskTextSelector,c=void 0===d?null:d,v=r.inlineStylesheet,f=void 0===v||v,p=r.inlineImages,g=void 0!==p&&p,m=r.recordCanvas,y=void 0!==m&&m,b=r.canvasMaskingConfigured,w=r.maskAllInputs,k=void 0!==w&&w,_=r.maskTextFn,S=r.maskInputFn,M=r.maskAllElementAttributes,C=void 0!==M&&M,I=r.maskAttributeFn,A=r.slimDOM,R=r.dataURLOptions,T=r.preserveWhiteSpace,x=r.onSerialize,E=r.onIframeLoad,O=r.iframeLoadTimeout,F=r.onIframeListenerRegistered,D=r.onStylesheetLoad,L=r.stylesheetLoadTimeout,N=r.keepIframeSrcFn,P=void 0===N?()=>!1:N,B=r.maxDepth,W=r.inlineStylesheetBudgetRules,z=!0===k?{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===k?{password:!0}:k,j=ne(void 0!==A&&A);V(W);try{return ie(t,{doc:t,mirror:n,blockClass:a,blockSelector:u,maskTextClass:h,maskTextSelector:c,skipChild:!1,inlineStylesheet:f,maskInputOptions:z,maskTextFn:_,maskInputFn:S,maskAllElementAttributes:C,maskAttributeFn:I,slimDOMOptions:j,dataURLOptions:R,inlineImages:g,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:T,onSerialize:x,onIframeLoad:E,iframeLoadTimeout:O,onIframeListenerRegistered:F,onStylesheetLoad:D,stylesheetLoadTimeout:L,keepIframeSrcFn:P,newlyAddedElement:!1,maxDepth:B})}finally{Z()}}(document,{mirror:Cr,blockClass:h,blockSelector:c,maskTextClass:y,maskTextSelector:w,inlineStylesheet:_,maskAllInputs:bt,inlineStylesheetBudgetRules:S,maskTextFn:T,maskInputFn:R,maskAllElementAttributes:O,maskAttributeFn:F,slimDOM:wt,dataURLOptions:ft,recordCanvas:Q,canvasMaskingConfigured:Ft,inlineImages:ot,onSerialize(t){_e(t,Cr)&&xt.addIframe(t),Se(t,Cr)&&Tt.trackLinkElement(t),Me(t)&&Dt.addShadowRoot(C.shadowRoot(t),document)},onIframeLoad(t,e){xt.attachIframe(t,e),Dt.observeAttachShadow(t)},onIframeListenerRegistered(t,e){xt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){Tt.attachLinkElement(t,e)},keepIframeSrcFn:ht})}finally{s=z,z=[],r=s}if(!i)return console.warn("Failed to snapshot the document");if(fr({type:o.FullSnapshot,data:{node:i,initialOffset:fe(window)}},t),Pe.forEach((t=>t.unlock())),gr.onFullSnapshot(),r.length){var n=function(t,e,r){var i=!1,n=null,s=0,a=null,o=()=>null!==a||t.length>s,u=()=>{var r=t[s];t[s]=null,s+=1,r&&ue((()=>{a=e.beginDeferredLinkInlining(r,Cr.getId(r))}))},l=()=>{if(a){var t=a,e=!0;ue((()=>{e=t.advance(200)})),e&&(a=null)}},h=t=>{if(n=null,!i){var e=0;do{try{a||u(),l()}catch(t){null==a||a.discard(),a=null,rt(1)}e+=1}while(!i&&o()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));i||(o()?n=Ar(h):r())}};return n=Ar(h),{cancel(){i=!0,null==a||a.discard(),a=null,null==n||n.cancel(),n=null},flush(){if(!i){i=!0,null==n||n.cancel(),n=null;for(var e=0,h=0;o()&&50>e;){a||u();var d=a;if(d)if(Math.floor(d.remainingRules()/200)+1>50-e)d.discard(),a=null,h+=1;else{try{l()}catch(t){null==a||a.discard(),a=null,h+=1}e+=1}}if(o()||h>0){for(var c=h+(null!==a?1:0),v=s;t.length>v;v++)null!==t[v]&&(c+=1);rt(c),null==a||a.discard(),a=null}r()}}}}(r,Tt,(()=>{e===n&&(e=void 0)}));e=n}K&&xt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Tt.adoptStyleSheets(document.adoptedStyleSheets,Cr.getId(document))}finally{Z()}var s}};try{var Lt=[];for(var Nt of(Lt.push(ae("pagehide",(()=>{try{null==e||e.flush()}catch(t){}e=void 0}),window)),["visibilitychange","freeze","resume"]))Lt.push(ae(Nt,E,document));kt=t=>{var e=Mt.get(t);e&&(e.forEach((t=>{ue(t);var e=Lt.indexOf(t);-1!==e&&Lt.splice(e,1)})),Mt.delete(t))},_t=()=>{for(var t of Mt){var e=t[0],r=Cr.getNode(e);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==kt||kt(e)}catch(t){null==kt||kt(e)}else null==kt||kt(e)}};var Pt=t=>{var e;return Ne(Ze)({mutationCb:It,mousemoveCb:(t,e)=>fr({type:o.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.MouseInteraction},t)}),scrollCb:At,viewportResizeCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.ViewportResize},t)}),inputCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.Input},t)}),mediaInteractionCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.MediaInteraction},t)}),styleSheetRuleCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.StyleSheetRule},t)}),styleDeclarationCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.StyleDeclaration},t)}),canvasMutationCb:Rt,fontCb:t=>fr({type:o.IncrementalSnapshot,data:r({source:u.Font},t)}),selectionCb(t){fr({type:o.IncrementalSnapshot,data:r({source:u.Selection},t)})},customElementCb(t){fr({type:o.IncrementalSnapshot,data:r({source:u.CustomElement},t)})},blockClass:h,ignoreClass:f,ignoreSelector:g,maskTextClass:y,maskTextSelector:w,maskInputOptions:bt,inlineStylesheet:_,sampling:P,recordDOM:G,recordCanvas:Q,canvasMaskingConfigured:Ft,inlineImages:ot,userTriggeredOnInput:it,collectFonts:st,doc:t,maskInputFn:R,maskTextFn:T,maskAllElementAttributes:O,maskAttributeFn:F,keepIframeSrcFn:ht,blockSelector:c,slimDOMOptions:wt,dataURLOptions:ft,mirror:Cr,iframeManager:xt,stylesheetManager:Tt,shadowDomManager:Dt,processedNodeManager:Ot,canvasManager:gr,ignoreCSSAttributes:ct,attributeFilter:vt,plugins:(null==(e=null==ut?void 0:ut.filter((t=>t.observer)))?void 0:e.map((t=>({observer:t.observer,options:t.options,callback:e=>fr({type:o.Plugin,data:{plugin:t.name,payload:e}})}))))||[]},D)};xt.addLoadListener((t=>{try{var e=Cr.getId(t),r=Pt(t.contentDocument);if("function"==typeof r&&(Lt.push(r),-1!==e)){var i=Mt.get(e);i||Mt.set(e,i=new Set),i.add(r)}}catch(t){console.warn(t)}})),xt.addPageHideListener((t=>{var e=Cr.getId(t);null==kt||kt(e),ze(t)}));var Bt=-1,$t=t=>fr({type:o.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),Wt=()=>{var t,e,r,i,n=document,s=null!==(t=null!==(e=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==e?e:n.msFullscreenElement)&&void 0!==t?t:null,a=s?Cr.getId(s):-1;a!==Bt&&(-1!==Bt&&$t({id:Bt,enter:!1}),Bt=a,-1!==a&&$t({id:a,enter:!0}))},zt=()=>{pr();var t=Pt(document);"function"==typeof t&&Lt.push(t),Lt.push(ae("fullscreenchange",Wt)),Lt.push(ae("webkitfullscreenchange",Wt)),Lt.push(ae("mozfullscreenchange",Wt)),Lt.push(ae("MSFullscreenChange",Wt)),Sr=!0};return["interactive","complete"].includes(document.readyState)?zt():(Lt.push(ae("DOMContentLoaded",(()=>{fr({type:o.DomContentLoaded,data:{}}),"DOMContentLoaded"===tt&&zt()}))),Lt.push(ae("load",(()=>{fr({type:o.Load,data:{}}),"load"===tt&&zt()}),window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Lt.forEach((t=>ue(t))),Ot.destroy(),xt.removeLoadListener(),xt.destroy(),Mt.clear(),Dt.reset(),Cr.reset(),Sr=!1,xe=void 0}}catch(t){console.warn(t)}}Rr.addCustomEvent=(t,e)=>{if(!Sr)throw new Error("please add custom event after start recording");fr({type:o.Custom,data:{tag:t,payload:e}})},Rr.freezePage=()=>{Pe.forEach((t=>t.freeze()))},Rr.takeFullSnapshot=t=>{if(!Sr)throw new Error("please take full snapshot after start recording");pr(t)},Rr.mirror=Cr;var Tr=Object.defineProperty,xr=(t,e,r)=>((t,e,r)=>e in t?Tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class Er{constructor(t){xr(this,"fileName"),xr(this,"functionName"),xr(this,"lineNumber"),xr(this,"columnNumber"),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){var t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+t+":"+e+")":this.fileName+":"+t+":"+e}}var Or=/(^|@)\S+:\d+/,Fr=/^\s*at .*(\S+:\d+|\(native\))/m,Dr=/^(eval@)?(\[native code])?$/,Lr={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(Fr)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error("Cannot parse given url: "+t);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter((function(t){return!!t.match(Fr)}),this).map((function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var e=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=e.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(e=r?e.replace(r[0],""):e).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,a=["eval",""].indexOf(n[0])>-1?void 0:n[0];return new Er({functionName:s,fileName:a,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(t){return t.stack.split("\n").filter((function(t){return!t.match(Dr)}),this).map((function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new Er({functionName:t});var e=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=t.match(e),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(t.replace(e,""));return new Er({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){for(var e=/Line (\d+).*script (?:in )?(\S+)/i,r=t.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Er({fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera10(t){for(var e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=t.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var a=e.exec(r[n]);a&&i.push(new Er({functionName:a[3]||void 0,fileName:a[2],lineNumber:parseFloat(a[1])}))}return i},parseOpera11(t){return t.stack.split("\n").filter((function(t){return!!t.match(Or)&&!t.match(/^Error created at/)}),this).map((function(t){var e=t.split("@"),r=this.extractLocation(e.pop()),i=(e.shift()||"").replace(//,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Er({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function Nr(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var r=t.localName;if(!r)break;r=r.toLowerCase();var i=t.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var a=i.children[s];a.localName&&a.localName.toLowerCase&&a.localName.toLowerCase()===r&&n.push(a)}n.length>1&&(r+=":eq("+n.indexOf(t)+")"),e=r+(e?">"+e:""),t=i}return e}function Pr(t){return Array.isArray(t)}function Br(t){return"object"==typeof t&&null!==t&&!Pr(t)}function $r(t,e){if(0===e)return!0;var r=Object.keys(t);for(var i of r)if(Br(t[i])&&$r(t[i],e-1))return!0;return!1}function Wr(t,e){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,e);var i=[],n=[];return JSON.stringify(t,(function(t,e){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,t):n.push(t),~i.indexOf(e)&&(e=i[0]===e?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(e)).join(".")+"]")}else i.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(Br(a=e)&&Object.keys(a).length>r.numOfKeysLimit||"function"==typeof a||Br(a)&&$r(a,r.depthOfLimit))return function(t){var e=t.toString();return r.stringLengthLimit&&e.length>r.stringLengthLimit&&(e=e.slice(0,r.stringLengthLimit)+"..."),e}(e);var a;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){var o={};for(var u in e){var l=e[u];o[u]=Pr(l)?Nr(l.length?l[0]:null):l}return o}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e}))}var zr={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 jr(t,e,r){var i,n=r?Object.assign({},zr,r):zr,s=n.logger;if(!s)return()=>{};i="string"==typeof s?e[s]:s;var a=0,o=!1,u=[];if(n.level.includes("error")){var l=e=>{var r=e.message,i=Lr.parse(e.error).map((t=>t.toString())),s=[Wr(r,n.stringifyOptions)];t({level:"error",trace:i,payload:s})};e.addEventListener("error",l),u.push((()=>{e.removeEventListener("error",l)}));var h=e=>{var r,i;e.reason instanceof Error?i=[Wr("Uncaught (in promise) "+(r=e.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Wr("Uncaught (in promise)",n.stringifyOptions),Wr(e.reason,n.stringifyOptions)]);var s=Lr.parse(r).map((t=>t.toString()));t({level:"error",trace:s,payload:i})};e.addEventListener("unhandledrejection",h),u.push((()=>{e.removeEventListener("unhandledrejection",h)}))}for(var d of n.level)u.push(c(i,d));return()=>{u.forEach((t=>t()))};function c(e,r){var i=this;return e[r]?function(e,s,u){try{if(!(s in e))return()=>{};var l=e[s],h={next:l},d=(e=>function(){for(var s=arguments.length,u=new Array(s),l=0;s>l;l++)u[l]=arguments[l];if(e.apply(i,u),!("assert"===r&&u[0]||o)){o=!0;try{var h=Lr.parse(new Error).map((t=>t.toString())).splice(1),d=("assert"===r?u.slice(1):u).map((t=>Wr(t,n.stringifyOptions)));a++,n.lengthThreshold>a?t({level:r,trace:h,payload:d}):a===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Wr("The number of log records reached the threshold.")]})}catch(t){e("rrweb logger error:",t,...u)}finally{o=!1}}})((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return h.next.apply(this,e)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:h}})),e[s]=d,()=>{if(e[s]!==d)for(var t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0},r=e[s],i=t(r);i;){if(i.next===d)return void(i.next=h.next);i=t(r=i.next)}else e[s]=h.next}}catch(t){return()=>{}}}(e,r):()=>{}}}var Ur="undefined"!=typeof window?window:void 0,Hr="undefined"!=typeof globalThis?globalThis:Ur,qr=null==Hr?void 0:Hr.document,Gr=null==Hr?void 0:Hr.location;null!=Hr&&Hr.XMLHttpRequest&&new Hr.XMLHttpRequest;var Vr="undefined"!=typeof globalThis?globalThis:Ur;Vr&&"undefined"==typeof self&&(Vr.self=Vr),Vr&&"undefined"==typeof File&&(Vr.File=function(){});var Zr=null!=Ur?Ur:{},Jr=function(t){return t.trim()},Qr=Object.prototype,Xr=Qr.hasOwnProperty,Kr=Qr.toString,Yr=Array.isArray||function(t){return"[object Array]"===Kr.call(t)},ti=t=>"function"==typeof t,ei=t=>t===Object(t)&&!Yr(t),ri=t=>void 0===t,ii=t=>"[object String]"==Kr.call(t),ni=t=>null===t,si=t=>ri(t)||ni(t),ai=t=>"[object Number]"==Kr.call(t)&&t==t,oi=t=>"[object Boolean]"===Kr.call(t),ui=t=>t instanceof FormData;function li(t,e,r,i,n){return e>r&&(i.warn("min cannot be greater than max."),e=r),ai(t)?t>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e>t?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),li(n||r,e,r,i))}class hi{constructor(t){this.k={},this.S=t.S,this.C=li(t.bucketSize,0,100,t.I),this.R=li(t.refillRate,0,this.C,t.I),this.A=li(t.refillInterval,0,864e5,t.I)}O(t,e){var r=Math.floor((e-t.lastAccess)/this.A);r>0&&(t.tokens=Math.min(t.tokens+r*this.R,this.C),t.lastAccess=t.lastAccess+r*this.A)}consumeRateLimit(t){var e,r=Date.now(),i=String(t),n=this.k[i];return n?this.O(n,r):this.k[i]=n={tokens:this.C,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(e=this.S)||e.call(this,t)),0===n.tokens)}stop(){this.k={}}}function di(t){return t?t.split("#")[0]:t}var ci,vi="NativeGzipValidationError",fi=t=>{throw function(t,e){var r=new Error(e);try{Object.defineProperty(r,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return r}(vi,"Native gzip produced invalid output: "+t)},pi=function(){var t=e((function*(t,e){18>t.size&&fi("too-short");var r,i=new Uint8Array(yield t.slice(0,10).arrayBuffer());(2>(r=i).length||31!==r[0]||139!==r[1]||8!==i[2])&&fi("invalid-header");var n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(ci)return ci;ci=[];for(var t=0;256>t;t++){for(var e=t,r=0;8>r;r++)e=1&e?3988292384^e>>>1:e>>>1;ci[t]=e>>>0}return ci})(),r=4294967295,i=0;t.length>i;i++)r=e[255&(r^t[i])]^r>>>8;return(4294967295^r)>>>0})(e)&&fi("invalid-crc");var s=e.length>>>0;n.getUint32(4,!0)!==s&&fi("invalid-size")}));return function(e,r){return t.apply(this,arguments)}}();function gi(){return gi=e((function*(t,r,i){void 0===r&&(r=!0);try{var n=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),a=s.writable.getWriter(),o=a.write(n).then((()=>a.close())).catch(function(){var t=e((function*(t){try{yield a.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),u=new Response(s.readable).blob(),l=(yield Promise.all([u,o]))[0];return yield pi(l,n),l}catch(t){if(null!=i&&i.rethrow)throw t;return r&&console.error("Failed to gzip compress data",t),null}})),gi.apply(this,arguments)}var mi=t=>"undefined"!=typeof Document&&t instanceof Document,yi={DEBUG:!1,LIB_VERSION:"0.6.1",LIB_NAME:"browser-common"},bi=function(t,e){var r=(void 0===e?{}:e).debugEnabled,i={P(e){if(Ur&&(yi.DEBUG||Ur.POSTHOG_DEBUG||r)&&!ri(Ur.console)&&Ur.console){for(var i=("__rrweb_original__"in Ur.console[e]?Ur.console[e].__rrweb_original__:Ur.console[e]),n=arguments.length,s=new Array(n>1?n-1:0),a=1;n>a;a++)s[a-1]=arguments[a];i(t,...s)}},debug(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.P("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.P("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.P("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];i.P("error",...e)},critical(){for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning(t){i.error("You must initialize PostHog before calling "+t)},createLogger:(e,r)=>bi(t+" "+e,r)};return i},wi=bi("[PostHog.js]"),ki=wi.createLogger;function _i(t,e){if(!si(t))if(Yr(t))t.forEach(e);else if(ui(t))t.forEach(((t,r)=>e(t,r)));else for(var r in t)Xr.call(t,r)&&e(t[r],r)}function Si(t,e,r,i){var n={},s=n.capture,a=n.passive;null==t||t.addEventListener(e,r,{capture:void 0!==s&&s,passive:void 0===a||a})}var Mi=["localhost","127.0.0.1"],Ci=t=>{var e=null==qr?void 0:qr.createElement("a");return ri(e)?null:(e.href=t,e)},Ii=function(t,e){var r,i;void 0===e&&(e="&");var n=[];return _i(t,(function(t,e){ri(t)||ri(e)||"undefined"===e||(r=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),i=encodeURIComponent(e),n[n.length]=i+"="+r)})),n.join(e)},Ai=()=>{},Ri=t=>{var e;if(ti(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Ti(t,e,r){try{if(!(e in t))return Ai;var i={next:t[e]},n=r((function(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];return i.next.apply(this,e)}));return ti(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),t[e]=n,()=>{if(t[e]!==n)for(var r=t[e],s=Ri(r);s;){if(s.next===n)return void(s.next=i.next);s=Ri(r=s.next)}else t[e]=i.next}}catch(t){return Ai}}function xi(t,e){var r,i=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),n={hostname:i,isHostDenied:!1};if(null==(r=e.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of e.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}function Ei(t){var e,r=null==Ur||null==(e=Ur.location)?void 0:e.href;return ri(r)?void 0:function(t,e){var r,i=null==t||null==(r=t.config)?void 0:r.get_current_url;if(!ti(i))return e;try{var n=i(e);return ii(n)&&n?n:e}catch(t){return wi.error("Error in get_current_url, falling back to window.location.href",t),e}}(t,r)}var Oi=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}))$"),Fi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Di=[16,15,14,13],Li=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Ni=/[0-9A-Za-z_]/;function Pi(t){for(var e=0,r=!1,i=t.length-1;i>=0;i--){var n=t.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),e+=n,r=!r}return e%10==0}var Bi="[SessionRecording]",$i="redacted",Wi=1e6;function zi(t){var e;return Math.min(Wi,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Wi)}var ji={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Wi,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},Ui=["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"],Hi=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],qi=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Gi=t=>{si(t)||_i(Object.keys(t),(e=>{(t=>{var e=t.toLowerCase();return Ui.includes(e)||qi.some((t=>e.includes(t)))})(e)&&(t[e]=$i)}))},Vi=["/s/","/e/","/i/"];function Zi(t,e,r,i){if(si(t))return t;var n=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return ii(n)&&(n=parseInt(n)),n>r?Bi+" "+i+" body too large to record ("+n+" bytes)":t}function Ji(t,e){if(si(t))return t;var r=t;return function(t,e){if(si(t))return!1;if(ii(t)){if(function(t){var e;for(Fi.lastIndex=0;e=Fi.exec(t);){var r=e[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of Di){var a=n+s;if(i.length>=a){var o=i.slice(n,a);if(Oi.test(o)&&Pi(o))return!0}}}return!1}(t=Jr(t)))return!1;var r=function(t){var e;for(Li.lastIndex=0;e=Li.exec(t);){var r=e[1],i=e[3];if(!(r&&i&&Ni.test(r)&&Ni.test(i)))return!0}return!1}(t);if(r)return!1}return!0}(r)||(r=Bi+" "+e+" body "+$i),_i(Hi,(t=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(t))&&(r=Bi+" "+e+" body "+$i+" as might contain: "+t)})),r}var Qi=new WeakSet,Xi=ki("[Recorder]"),Ki=t=>"navigation"===t.entryType,Yi=t=>"resource"===t.entryType;function tn(t,e){return!!e&&(oi(e)||e[t])}function en(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}var rn=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function nn(t){var e=t.type,r=t.recordBody,i=t.headers;function n(t){var e=Object.keys(i).find((t=>"content-type"===t.toLowerCase())),r=e&&i[e];return t.some((t=>null==r?void 0:r.toLowerCase().includes(t)))}if(!r)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!en(e)&&t(e.url)}catch(t){return!1}}(t.url))return!1;if(n(rn))return!1;if(oi(r))return!0;if(Yr(r))return n(r);var s=r[e];return oi(s)?s:n(s)}function sn(t,e,r,i,n,s){return an.apply(this,arguments)}function an(){return an=e((function*(t,e,r,i,n,s){if(void 0===s&&(s=0),s>10)return Xi.warn("Failed to get performance entry for request",{url:r,initiatorType:e}),null;var a=function(t,r){for(var s=t.length-1;s>=0;s-=1)if(Yi(a=t[s])&&a.initiatorType===e&&(ri(i)||a.startTime>=i)&&(ri(n)||n>=a.startTime))return t[s];var a}(t.performance.getEntriesByName(r));return a||(yield new Promise((t=>setTimeout(t,50*s))),sn(t,e,r,i,n,s+1))})),an.apply(this,arguments)}function on(t){var e=t.body,r=t.options,i=t.url;if(si(e))return null;var n=xi(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(ii(e))return e;if(mi(e))return e.textContent;if(ui(e))return Ii(e);if(ei(e))try{return JSON.stringify(e)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}var un=t=>!ni(t)&&("navigation"===t.entryType||"resource"===t.entryType);function ln(t){var e=t.entry,i=t.method,n=t.status,s=t.networkRequest,a=t.isInitial,o=t.start,u=t.end,l=t.url,h=t.initiatorType;o=e?e.startTime:o,u=e?e.responseEnd:u;var d=Math.floor(Date.now()-performance.now()),c=Math.floor(d+(o||0)),v=[r({},e?e.toJSON():{name:l},{startTime:ri(o)?void 0:Math.round(o),endTime:ri(u)?void 0:Math.round(u),timeOrigin:d,timestamp:c,method:i,initiatorType:h||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:a})];if(un(e))for(var f of e.serverTiming||[])v.push({timeOrigin:d,timestamp:c,startTime:Math.round(e.startTime),name:f.name,duration:f.duration,entryType:"serverTiming"});return v}var hn=["video/","audio/"];function dn(t){return ei(t)&&ti(t.getReader)&&ti(t.tee)}var cn=500,vn="[SessionReplay] Timeout while trying to read body",fn="[SessionReplay] Failed to read body";function pn(t){return fn+": "+t}function gn(t){return"[SessionReplay] Body too large to record (> "+t+" bytes)"}function mn(t,e){if(!e.streamNetworkBody)return function(t){return new Promise((e=>{var r=setTimeout((()=>e(vn)),cn);try{t.clone().text().then((t=>e(t)),(t=>e(pn(t)))).finally((()=>clearTimeout(r)))}catch(t){clearTimeout(r),e(fn)}}))}(t);var r=zi(e);return function(t,e){try{var r,i=null==(r=t.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>e}catch(t){return!1}}(t,r)?Promise.resolve(gn(r)):function(t,e){return new Promise((r=>{var i,n=!1;function s(){try{var t;null==(t=i)||t.cancel()}catch(t){}}function a(t){n||(n=!0,clearTimeout(u),s(),r(t))}var o,u=setTimeout((()=>a(vn)),cn);try{o=t.clone()}catch(t){return void a(fn)}var l=o.body;if(dn(l)&&"undefined"!=typeof TextDecoder){try{i=l.getReader()}catch(t){return void a(fn)}var h=[],d=0;!function t(){i.read().then((r=>{var i=r.done,o=r.value;if(n)s();else if(i)a((new TextDecoder).decode(function(t,e){var r=new Uint8Array(e),i=0;for(var n of t)r.set(n,i),i+=n.byteLength;return r}(h,d)));else{if(o){if(d+o.byteLength>e)return void a(gn(e));d+=o.byteLength,h.push(o)}t()}}),(t=>a(pn(t))))}()}else try{o.text().then((t=>a(t)),(t=>a(pn(t))))}catch(t){a(fn)}}))}(t,r)}function yn(){return(yn=e((function*(t){var e=t.r,r=t.options,i=xi(t.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):mn(e,r)}))).apply(this,arguments)}function bn(){return(bn=e((function*(t){var e=t.r,r=t.options,i=function(t){var e,r=t.r,i=t.options,n=t.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(e=r.headers.get("Content-Type"))?void 0:e.toLowerCase(),a=hn.some((t=>null==s?void 0:s.startsWith(t)));if(s&&a)return"Content-Type "+s+" is not supported";var o=xi(n,i);return o.isHostDenied?o.hostname+" is in deny list":null}({r:e,options:r,url:t.url});return ni(i)?mn(e,r):Promise.resolve(i)}))).apply(this,arguments)}var wn=null;function kn(t,i,n){if(!("performance"in i))return()=>{};if(wn)return Xi.warn("Network observer already initialised, doing nothing"),()=>{};var s=n?Object.assign({},ji,n):ji,a=e=>{var i=[],n=!1;e.requests.forEach((t=>{var e="serverTiming"===t.entryType;if(!e||!n){var r=s.maskRequestFn(t);e||(n=!r||(t=>!!t&&Qi.has(t))(r)),r&&i.push(r)}})),i.length>0&&t(r({},e,{requests:i}))},o=function(t,e,r){if(r.recordInitialRequests){var i=e.performance.getEntries().filter((t=>Ki(t)||Yi(t)&&r.initiatorTypes.includes(t.initiatorType)));t({requests:i.flatMap((t=>ln({entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new e.PerformanceObserver((e=>{var i=e.getEntries().filter((t=>Ki(t)||Yi(t)&&r.initiatorTypes.includes(t.initiatorType)&&(t=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)));t({requests:i.flatMap((t=>ln({entry:t,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((t=>r.performanceEntryTypeToObserve.includes(t)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(a,i,s),u=()=>{},l=()=>{};return(s.recordHeaders||s.recordBody)&&(u=function(t,e,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=tn("request",r.recordHeaders),n=tn("response",r.recordHeaders),s=Ti(e.XMLHttpRequest.prototype,"open",(s=>function(a,o,u,l,h){void 0===u&&(u=!0);var d=this;try{var c,v,f=new Request(o),p={},g={},m=d.setRequestHeader.bind(d);d.setRequestHeader=(t,e)=>(g[t]=e,m(t,e)),i&&(p.requestHeaders=g);var y=d.send.bind(d);d.send=t=>(nn({type:"request",headers:g,url:o,recordBody:r.recordBody})&&(p.requestBody=on({body:t,options:r,url:o})),c=e.performance.now(),y(t));var b=()=>{d.removeEventListener("readystatechange",w),d.removeEventListener("error",b),d.removeEventListener("abort",b),d.removeEventListener("timeout",b)},w=()=>{if(d.readyState===d.DONE){b(),v=e.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{var e=t.split(": "),r=e.shift(),n=e.join(": ");r&&(i[r]=n)})),n&&(p.responseHeaders=i),nn({type:"response",headers:i,url:o,recordBody:r.recordBody})&&(p.responseBody=on({body:d.response,options:r,url:o})),sn(e,"xmlhttprequest",f.url,c,v).then((e=>{var r=ln({entry:e,method:a,status:null==d?void 0:d.status,networkRequest:p,start:c,end:v,url:o.toString(),initiatorType:"xmlhttprequest"});t({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",w),d.addEventListener("error",b),d.addEventListener("abort",b),d.addEventListener("timeout",b)}catch(t){Xi.error("Failed to instrument XHR for network capture",t)}s.call(d,a,o.toString(),u,l,h)}));return()=>{s()}}(a,i,s),l=function(t,r,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};var n=tn("request",i.recordHeaders),s=tn("response",i.recordHeaders),a=Ti(r,"fetch",(a=>function(){var o=e((function*(e,o){var u,l;try{u=new Request(e,o)}catch(t){return Xi.error("Failed to instrument fetch for network capture",t),a(e,o)}var h,d,c={};try{try{var v={};u.headers.forEach(((t,e)=>{v[e]=t})),n&&(c.requestHeaders=v),!dn(null==o?void 0:o.body)&&nn({type:"request",headers:v,url:e,recordBody:i.recordBody})&&(c.requestBody=yield function(t){return yn.apply(this,arguments)}({r:u,options:i,url:e}))}catch(t){Xi.error("Failed to record fetch request for network capture",t)}h=r.performance.now(),l=en(e)?yield a(u):yield a(e,o),d=r.performance.now();var f={};return l.headers.forEach(((t,e)=>{f[e]=t})),s&&(c.responseHeaders=f),nn({type:"response",headers:f,url:e,recordBody:i.recordBody})&&(c.responseBody=yield function(t){return bn.apply(this,arguments)}({r:l,options:i,url:e})),l}finally{sn(r,"fetch",u.url,h,d).then((e=>{var r,i=ln({entry:e,method:u.method,status:null==(r=l)?void 0:r.status,networkRequest:c,start:h,end:d,url:u.url,initiatorType:"fetch"});t({requests:i})})).catch((()=>{}))}}));return function(t,e){return o.apply(this,arguments)}}()));return()=>{a()}}(a,i,s)),wn=()=>{o(),u(),l(),wn=null}}var _n={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},Sn={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},Mn="$session_recording_remote_config",Cn="$replay_sample_rate",In="$replay_override_sampling",An="$replay_override_linked_flag",Rn="$replay_override_url_trigger",Tn="$replay_override_event_trigger",xn="$session_is_sampled",En="$session_past_minimum_duration",On="$session_recording_url_trigger_activated_session",Fn="$session_recording_event_trigger_activated_session",Dn="$posthog_sr_group_event_trigger_",Ln="$posthog_sr_group_url_trigger_",Nn="$posthog_sr_group_sampling_",Pn="$debug_first_full_snapshot_timestamp",Bn="$sess_rec_flush_size",$n="$stored_person_properties",Wn="$sdk_debug_replay_pending_trigger_conditions",zn="$sdk_debug_replay_remote_trigger_matching_config",jn="disabled",Un="sampled",Hn="active",qn="buffering",Gn="paused",Vn="rrweb_error",Zn="trigger",Jn=Zn+"_activated",Qn=Zn+"_pending",Xn=Zn+"_"+jn;function Kn(t,e,r,i,n,s){return 0===e?Xn:(null==t?void 0:t.get_property(r?i+r:n))===s?Jn:Qn}function Yn(t,e,r){return e.some((e=>{var i;return"regex"===e.matching&&(null!==(i=null==r?void 0:r.get(e.url))&&void 0!==i?i:new RegExp(e.url)).test(t)}))}function ts(t){return t.includes(Jn)?Jn:t.includes(Qn)?Qn:Xn}function es(t){var e=new Set(t);switch(e.delete(Xn),e.size){case 0:return Xn;case 1:return Array.from(e)[0];default:return Qn}}class rs{constructor(t){this.F=t}triggerStatus(t){return ts(this.F.map((e=>e.triggerStatus(t))))}triggerStatusNoSideEffects(t){return ts(this.F.map((e=>e.triggerStatusNoSideEffects(t))))}stop(){this.F.forEach((t=>t.stop()))}}class is{constructor(t){this.F=t}triggerStatus(t){return es(this.F.map((e=>e.triggerStatus(t))))}triggerStatusNoSideEffects(t){return es(this.F.map((e=>e.triggerStatusNoSideEffects(t))))}stop(){this.F.forEach((t=>t.stop()))}}class ns{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return Jn}stop(){}}var ss=t=>"sessionRecording"in t;class as{constructor(t,e){this.N=[],this.q=[],this.j=new Map,this.B=new Map,this.H="",this.urlBlocked=!1,this._instance=t,this.$=e}onConfig(t){var e,r;this.N=(ss(t)?ei(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.q=(ss(t)?ei(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.U()}U(){for(var t of(this.j.clear(),this.B.clear(),this.N))if("regex"===t.matching&&!this.j.has(t.url))try{this.j.set(t.url,new RegExp(t.url))}catch(e){wi.error("Invalid URL trigger regex pattern:",t.url,e)}for(var e of this.q)if("regex"===e.matching&&!this.B.has(e.url))try{this.B.set(e.url,new RegExp(e.url))}catch(t){wi.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(t){this.onConfig(t)}W(t){return Kn(this._instance,this.N.length,this.$,Ln,On,t)}triggerStatus(t){var e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:e}),e}triggerStatusNoSideEffects(t){return this.W(t)}isCurrentUrlBlocked(){var t=Ei(this._instance);if(!t)return!1;try{return Yn(t,this.q,this.B)}catch(t){return!0}}checkUrlBlocklist(t,e){var r=Ei(this._instance);if(r&&r!==this.H){this.H=r;var i=this.urlBlocked,n=Yn(r,this.q,this.B);i&&n||(n&&!i?t():!n&&i&&e())}}checkUrlTriggerConditions(t,e,r,i){var n=Ei(this._instance);if(n&&n!==this.H){this.H=n;var s=this.urlBlocked,a=Yn(n,this.q,this.B);a&&!s?t():!a&&s&&e();var o=this.W(i)===Jn,u=Yn(n,this.N,this.j);!o&&u&&r("url",n)}}stop(){this.H=""}}class os{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.V=()=>{},this._instance=t}triggerStatus(){var t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}triggerStatusNoSideEffects(){var t=Qn;return si(this.linkedFlag)&&(t=Xn),this.linkedFlagSeen&&(t=Jn),t}onConfig(t,e){var r;if(this.linkedFlag=(ss(t)?ei(t.sessionRecording)?null==(r=t.sessionRecording)?void 0:r.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!si(this.linkedFlag)&&!this.linkedFlagSeen){var i=ii(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=ii(this.linkedFlag)?null:this.linkedFlag.variant;this.V=this._instance.onFeatureFlags(((t,r)=>{var s=!1;if(ei(r)&&i in r){var a=r[i];s=oi(a)?!0===a:n?a===n:!!a}var o=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,o&&e(i,n)}))}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.V()}}class us{constructor(t,e){this.Z=[],this._instance=t,this.$=e}onConfig(t){var e;this.Z=(ss(t)?ei(t.sessionRecording)?null==(e=t.sessionRecording)?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}G(t){return Kn(this._instance,this.Z.length,this.$,Dn,Fn,t)}triggerStatus(t){var e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}checkEventTriggerConditions(t,e,r){if(0!==this.Z.length){var i=this.G(r)===Jn,n=this.Z.includes(t);!i&&n&&e("event",t)}}stop(){}}class ls{constructor(t,e,r){if(this._instance=t,this.group=e,this.J=new as(t,e.id),this.Y=new us(t,e.id),this.K=new os(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){var i=(e.conditions.events||[]).map((t=>t.name)),n={urlTriggers:e.conditions.urls||[],eventTriggers:i,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.J.onConfig(n),this.Y.onConfig(n),this.K.onConfig(n,r);var s=[this.Y,this.J,this.K];this.X="any"===e.conditions.matchType?new rs(s):new is(s)}else this.X=new ns}triggerStatus(t){return this.X.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.X.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return this.triggerStatusNoSideEffects(t)!==Qn?[]:[{label:"URL condition not matched",status:this.J.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.K.triggerStatusNoSideEffects()}].filter((t=>t.status===Qn)).map((t=>t.label))}checkEventTriggerConditions(t,e,r){this.Y.checkEventTriggerConditions(t,e,r)}checkUrlTriggerConditions(t,e,r,i){this.J.checkUrlTriggerConditions(t,e,r,i)}activateTrigger(t,e){var r;null==(r=this._instance.persistence)||r.register({["url"===t?Ln+this.group.id:Dn+this.group.id]:e})}stop(){this.J.stop(),this.Y.stop(),this.K.stop()}}function hs(t){if(t.rrwebError)return Vn;if(!t.receivedFlags)return qn;if(!t.isRecordingEnabled)return jn;if(t.urlTriggerMatching.urlBlocked)return Gn;var e=!0===t.isSampled,r=new rs([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Un:r===Jn?Hn:r===Qn?qn:!1===t.isSampled?jn:Hn}function ds(t){if(t.rrwebError)return Vn;if(!t.receivedFlags)return qn;if(!t.isRecordingEnabled)return jn;if(t.urlTriggerMatching.urlBlocked)return Gn;var e=new is([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),r=e!==Xn,i=oi(t.isSampled);return r&&e===Qn?qn:r&&e===Xn||i&&!t.isSampled?jn:!0===t.isSampled?Un:Hn}function cs(){var t=[];return function(e,r){if(ei(r)||Yr(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r}}function vs(t){var e=JSON.stringify(t,cs());return e?new Blob([e]).size:0}function fs(t){if(ni(t))return 4;if(ri(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":if(Yr(t)){for(var e=2,r=0;t.length>r;r++){r>0&&(e+=1);var i=t[r];e+=ri(i)||ni(i)?4:fs(i)}return e}var n=t,s=2,a=!0;for(var o in n)if({}.hasOwnProperty.call(n,o)){var u=n[o];ri(u)||(a||(s+=1),a=!1,s+=o.length+3+fs(u))}return s;default:return 0}}function ps(t,e){if(void 0===e&&(e=6606028.8),t.size>=e&&t.data.length>1){var r=Math.floor(t.data.length/2),i=t.sizes.slice(0,r),n=t.sizes.slice(r);return[ps({size:i.reduce(((t,e)=>t+e),0),data:t.data.slice(0,r),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),ps({size:n.reduce(((t,e)=>t+e),0),data:t.data.slice(r),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap((t=>t))}return[t]}var gs=Uint8Array,ms=Uint16Array,ys=Uint32Array,bs=new gs([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]),ws=new gs([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]),ks=new gs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_s=function(t,e){for(var r=new ms(31),i=0;31>i;++i)r[i]=e+=1<i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Ss=_s(bs,2),Ms=Ss[1];Ss[0][28]=258,Ms[258]=28;for(var Cs=_s(ws,0)[1],Is=new ms(32768),As=0;32768>As;++As){var Rs=(43690&As)>>>1|(21845&As)<<1;Is[As]=((65280&(Rs=(61680&(Rs=(52428&Rs)>>>2|(13107&Rs)<<2))>>>4|(3855&Rs)<<4))>>>8|(255&Rs)<<8)>>>1}var Ts=function(t,e,r){for(var i=t.length,n=0,s=new ms(e);i>n;++n)++s[t[n]-1];var a,o=new ms(e);for(n=0;e>n;++n)o[n]=o[n-1]+s[n-1]<<1;if(r){a=new ms(1<n;++n)if(t[n])for(var l=n<<4|t[n],h=e-t[n],d=o[t[n]-1]++<=d;++d)a[Is[d]>>>u]=l}else for(a=new ms(i),n=0;i>n;++n)a[n]=Is[o[t[n]-1]++]>>>15-t[n];return a},xs=new gs(288);for(As=0;144>As;++As)xs[As]=8;for(As=144;256>As;++As)xs[As]=9;for(As=256;280>As;++As)xs[As]=7;for(As=280;288>As;++As)xs[As]=8;var Es=new gs(32);for(As=0;32>As;++As)Es[As]=5;var Os=Ts(xs,9,0),Fs=Ts(Es,5,0),Ds=function(t){return(t/8>>0)+(7&t&&1)},Ls=function(t,e,r){(null==r||r>t.length)&&(r=t.length);var i=new(t instanceof ms?ms:t instanceof ys?ys:gs)(r-e);return i.set(t.subarray(e,r)),i},Ns=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8},Ps=function(t,e,r){var i=e/8>>0;t[i]|=r<<=7&e,t[i+1]|=r>>>8,t[i+2]|=r>>>16},Bs=function(t,e){for(var r=[],i=0;t.length>i;++i)t[i]&&r.push({s:i,f:t[i]});var n=r.length,s=r.slice();if(!n)return[new gs(0),0];if(1==n){var a=new gs(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort((function(t,e){return t.f-e.f})),r.push({s:-1,f:25001});var o=r[0],u=r[1],l=0,h=1,d=2;for(r[0]={s:-1,f:o.f+u.f,l:o,r:u};h!=n-1;)o=r[r[d].f>r[l].f?l++:d++],u=r[l!=h&&r[d].f>r[l].f?l++:d++],r[h++]={s:-1,f:o.f+u.f,l:o,r:u};var c=s[0].s;for(i=1;n>i;++i)s[i].s>c&&(c=s[i].s);var v=new ms(c+1),f=$s(r[h-1],v,0);if(f>e){i=0;var p=0,g=f-e,m=1<i;++i){var y=s[i].s;if(e>=v[y])break;p+=m-(1<>>=g;p>0;){var b=s[i].s;e>v[b]?p-=1<=0&&p;--i){var w=s[i].s;v[w]==e&&(--v[w],++p)}f=e}return[new gs(v),f]},$s=function(t,e,r){return-1==t.s?Math.max($s(t.l,e,r+1),$s(t.r,e,r+1)):e[t.s]=r},Ws=function(t){for(var e=t.length;e&&!t[--e];);for(var r=new ms(++e),i=0,n=t[0],s=1,a=function(t){r[i++]=t},o=1;e>=o;++o)if(t[o]==n&&o!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(n),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(n);s=1,n=t[o]}return[r.subarray(0,i),e]},zs=function(t,e){for(var r=0,i=0;e.length>i;++i)r+=t[i]*e[i];return r},js=function(t,e,r){var i=r.length,n=Ds(e+2);t[n]=255&i,t[n+1]=i>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var s=0;i>s;++s)t[n+s+4]=r[s];return 8*(n+4+i)},Us=function(t,e,r,i,n,s,a,o,u,l,h){Ns(e,h++,r),++n[256];for(var d=Bs(n,15),c=d[0],v=d[1],f=Bs(s,15),p=f[0],g=f[1],m=Ws(c),y=m[0],b=m[1],w=Ws(p),k=w[0],_=w[1],S=new ms(19),M=0;y.length>M;++M)S[31&y[M]]++;for(M=0;k.length>M;++M)S[31&k[M]]++;for(var C=Bs(S,7),I=C[0],A=C[1],R=19;R>4&&!I[ks[R-1]];--R);var T,x,E,O,F=l+5<<3,D=zs(n,xs)+zs(s,Es)+a,L=zs(n,c)+zs(s,p)+a+14+3*R+zs(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(D>=F&&L>=F)return js(e,h,t.subarray(u,u+l));if(Ns(e,h,1+(D>L)),h+=2,D>L){T=Ts(c,v,0),x=c,E=Ts(p,g,0),O=p;var N=Ts(I,A,0);for(Ns(e,h,b-257),Ns(e,h+5,_-1),Ns(e,h+10,R-4),h+=14,M=0;R>M;++M)Ns(e,h+3*M,I[ks[M]]);h+=3*R;for(var P=[y,k],B=0;2>B;++B){var W=P[B];for(M=0;W.length>M;++M)Ns(e,h,N[z=31&W[M]]),h+=I[z],z>15&&(Ns(e,h,W[M]>>>5&127),h+=W[M]>>>12)}}else T=Os,x=xs,E=Fs,O=Es;for(M=0;o>M;++M)if(i[M]>255){var z;Ps(e,h,T[257+(z=i[M]>>>18&31)]),h+=x[z+257],z>7&&(Ns(e,h,i[M]>>>23&31),h+=bs[z]);var j=31&i[M];Ps(e,h,E[j]),h+=O[j],j>3&&(Ps(e,h,i[M]>>>5&8191),h+=ws[j])}else Ps(e,h,T[i[M]]),h+=x[i[M]];return Ps(e,h,T[256]),h+x[256]},Hs=new ys([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qs=function(){for(var t=new ys(256),e=0;256>e;++e){for(var r=e,i=9;--i;)r=(1&r&&3988292384)^r>>>1;t[e]=r}return t}(),Gs=function(){var t=4294967295;return{p(e){for(var r=t,i=0;e.length>i;++i)r=qs[255&r^e[i]]^r>>>8;t=r},d:()=>4294967295^t}},Vs=function(t,e,r,i,n){return function(t,e,r,i,n,s){var a=t.length,o=new gs(i+a+5*(1+Math.floor(a/7e3))+n),u=o.subarray(i,o.length-n),l=0;if(!e||8>a)for(var h=0;a>=h;h+=65535){var d=h+65535;a>d?l=js(u,l,t.subarray(h,d)):(u[h]=true,l=js(u,l,t.subarray(h,a)))}else{for(var c=Hs[e-1],v=c>>>13,f=8191&c,p=(1<h;++h){var T=w(h),x=32767&h,E=m[T];if(g[x]=E,m[T]=x,h>=A){var O=a-h;if((M>7e3||I>24576)&&O>423){l=Us(t,u,0,k,_,S,C,I,R,h-R,l),I=M=C=0,R=h;for(var F=0;286>F;++F)_[F]=0;for(F=0;30>F;++F)S[F]=0}var D=2,L=0,N=f,P=x-E&32767;if(O>2&&T==w(h-P))for(var B=Math.min(v,O)-1,W=Math.min(32767,h),z=Math.min(258,O);W>=P&&--N&&x!=E;){if(t[h+D]==t[h+D-P]){for(var j=0;z>j&&t[h+j]==t[h+j-P];++j);if(j>D){if(D=j,L=P,j>B)break;var U=Math.min(P,j-2),H=0;for(F=0;U>F;++F){var q=h-P+F+32768&32767,G=q-g[q]+32768&32767;G>H&&(H=G,E=q)}}}P+=(x=E)-(E=g[x])+32768&32767}if(L){k[I++]=268435456|Ms[D]<<18|Cs[L];var V=31&Ms[D],Z=31&Cs[L];C+=bs[V]+ws[Z],++_[257+V],++S[Z],A=h+D,++M}else k[I++]=t[h],++_[t[h]]}}l=Us(t,u,true,k,_,S,C,I,R,h-R,l)}return Ls(o,0,i+Ds(l)+n)}(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,r,i)},Zs=function(t,e,r){for(;r;++e)t[e]=r,r>>>=8},Js=function(t,e){var r=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Zs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),r){t[3]=8;for(var i=0;r.length>=i;++i)t[i+10]=r.charCodeAt(i)}},Qs=function(t){return 10+(t.filename&&t.filename.length+1||0)};function Xs(t,e){for(var r="",i=0;t.length>i;){var n=t[i++];r+=String.fromCharCode(n)}return r}class Ks{constructor(t,e){var r,i,n,s;void 0===e&&(e={}),this.ee={},this.te=Date.now(),this.re=-1/0,this.ie=()=>{var t=Date.now(),e=t-this.te;e>0?(this.ne=Math.min(this.ae,this.ne+e/1e3*this.oe),this.te=t):this.te=t},this.se=t=>{if(!this.ee[t]){var e,r;this.ee[t]=!0;var i=this.ue(t);null==(e=(r=this.le).onBlockedNode)||e.call(r,t,i)}},this.he=t=>{var e=this.ue(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){var r=e.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[t,e]},this.ue=t=>this._rrweb.mirror.getNode(t),this.ce=t=>{var e,r,i,n,s,a,o,u;return(null!==(e=null==(r=t.removes)?void 0:r.length)&&void 0!==e?e:0)+(null!==(i=null==(n=t.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(a=t.texts)?void 0:a.length)&&void 0!==s?s:0)+(null!==(o=null==(u=t.adds)?void 0:u.length)&&void 0!==o?o:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;var e=t.data,r=this.ce(e);if(e.attributes){var i=e.attributes.length;e.attributes=e.attributes.filter((t=>{var e=this.he(t.id);return!this.de.consumeRateLimit(e[0])&&t}));var n,s,a=i-e.attributes.length;a>0&&(null==(n=(s=this.le).onDroppedAttributeMutations)||n.call(s,a))}var o=this.ce(e);if(0!==o||r===o){if(this.ve)return t;this.ie();var u,l,h=fs(t);return h>this.ne?(null==(u=(l=this.le).onDroppedOversizedMutation)||u.call(l,h),void this.fe()):(this.ne-=h,t)}},this.fe=()=>{if(!this.pe){var t=Math.max(0,this.ge-(Date.now()-this.re));this.pe=setTimeout((()=>{var t,e;this.pe=void 0,this.re=Date.now(),null==(t=(e=this.le).requestFullSnapshot)||t.call(e)}),t)}},this._rrweb=t,this.le=e,this.de=new hi({bucketSize:null!==(r=this.le.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this.le.refillRate)&&void 0!==i?i:10,refillInterval:1e3,S:this.se,I:wi}),this.ae=null!==(n=this.le.bytesBucketSize)&&void 0!==n?n:0,this.oe=null!==(s=this.le.bytesRefillRate)&&void 0!==s?s:25600,this.ve=!Number.isFinite(this.ae)||0>=this.ae,this.ne=this.ae;var a=this.le.resyncIntervalMs;this.ge=ai(a)&&Number.isFinite(a)&&a>0?a:3e5}reset(){this.ee={},this.pe&&(clearTimeout(this.pe),this.pe=void 0),this.re=Date.now()}stop(){this.de.stop(),this.reset(),this.ne=this.ae,this.te=Date.now(),this.re=-1/0}}yi.DEBUG=!1,yi.LIB_VERSION="1.422.2",yi.LIB_NAME="web";class Ys{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.me=t.get_property.bind(t),this.ye=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.ye(Bn,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){var e,r=this.me(Bn);return ei(e=r)&&ii(e.sessionId)&&ai(e.size)&&r.sessionId===t?r.size:0}}function ta(t,e){return function(t){for(var e=0,r=0;t.length>r;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)}(t)%100{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},ra=t=>t.toLowerCase(),ia={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>ea(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!ea(e,t))))),icontains:(t,e)=>e.map(ra).some((e=>t.map(ra).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(ra).every((e=>t.map(ra).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var r=parseFloat(e);return!isNaN(r)&&t.some((t=>r{var i="person"===t.type?r:e,n=null==i?void 0:i[t.key],s=t.operator||"exact";if(ri(n)||ni(n))return na.has(s);var a=ia[s];return!!a&&!ri(t.value)&&!ni(t.value)&&a(Yr(t.value)?t.value.map(String):[String(t.value)],Yr(n)?n.map(String):[String(n)])}))}var aa=ki("[SessionRecording]");function oa(t,e){return e?t:"!"+t}function ua(t,e){return t===e||t!=="!"+e&&null}class la{constructor(t,e,r,i,n,s,a){this.be=null,this.we=ds,this._instance=t,this.J=e,this.Y=r,this.K=i,this.ke=n,this._e=s,this.Se=a}onRemoteConfig(t){this.be=ai(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.xe=new rs([this.Y,this.J]),this.we=hs):(this.xe=new is([this.Y,this.J]),this.we=ds),this._instance.register_for_session({[zn]:t.triggerMatchType}),this.J.onConfig(t),this.Y.onConfig(t),this.K.onConfig(t,((t,e)=>{this.ke("linked_flag_matched",{flag:t,variant:e}),this.Se()}))}getStatus(t){return this.we({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){var e=this._instance.get_property("$session_recording_remote_config"),r=null==e?void 0:e.minimumDurationMilliseconds;return ai(r)?r:null}checkUrlTriggers(t,e,r,i){this.J.checkUrlTriggerConditions(e,r,i,t)}setupEventTriggerListeners(t,e,r){if(0!==this.Y.Z.length&&si(this.Ce))return this.Ce=t((t=>{try{this.Y.checkEventTriggerConditions(t.event,r,e)}catch(t){aa.error("Could not activate event trigger",t)}})),this.Ce}makeSamplingDecisions(t){var e,r,i,n=this.be;if(!ai(n))return null==(r=this._instance.persistence)||r.unregister(xn),void(null==(i=this._instance.persistence)||i.unregister(Cn));var s=this._instance.get_property(xn),a=this._instance.get_property(Cn),o=ua(s,t),u=ai(a)&&a!==n,l=ri(a)&&s===t,h=u||l||!oi(o),d=h?ta(t,n):o;h&&(d?this.ke("sampled"):aa.warn("Sample rate ("+n+") has determined that this sessionId ("+t+") will not be sent to the server.")),null==(e=this._instance.persistence)||e.register({[xn]:oa(t,d),[Cn]:ni(a)&&s===t?null:n})}ensureSamplingDecision(t){if(ai(this.be)){var e=this._instance.get_property(xn);oi(ua(e,t))||this.makeSamplingDecisions(t)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,r,i,n;null==(t=this._instance.persistence)||t.unregister(Fn),null==(e=this._instance.persistence)||e.unregister(On),null==(r=this._instance.persistence)||r.unregister(xn),null==(i=this._instance.persistence)||i.unregister(Cn),null==(n=this._instance.persistence)||n.unregister(En)}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null==(e=this.xe)?void 0:e.triggerStatus(t))===Qn}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.J.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.K.triggerStatusNoSideEffects()}].filter((t=>t.status===Qn)).map((t=>t.label))}stop(){var t;null==(t=this.Ce)||t.call(this),this.Ce=void 0,this.Y.stop(),this.J.stop(),this.K.stop()}}class ha{constructor(t,e,r,i,n){this.Me=[],this.Te=new Map,this.Ie=!1,this._instance=t,this.J=e,this.ke=r,this.Ee=i,this.Se=n}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Re(t.triggerGroups),this._instance.register_for_session({[zn]:"v2_trigger_groups",$sdk_debug_replay_trigger_groups_count:t.triggerGroups.length}),this.J.onConfig(t)):aa.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return Vn;if(t.urlTriggerMatching.urlBlocked)return Gn;var e=t.triggerGroupMatchers,r=t.triggerGroupSamplingResults;if(0===e.length)return jn;var i=!1,n=!1;for(var s of e){var a=s.triggerStatus(t.sessionId);if(a===Jn){var o=s.group.id,u=r.get(o);ri(u)?wi.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:o}):!0===u&&(n=!0)}else a===Qn&&(i=!0)}return n?Un:i?qn:jn}({isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Me,triggerGroupSamplingResults:this.Te,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){var e=null;for(var r of this.Me)if("trigger_activated"===r.triggerStatus(t)){var i=r.group.minDurationMs;ai(i)&&(ni(e)||e>i)&&(e=i)}return e}checkUrlTriggers(t,e,r,i){var n=this;this.J.checkUrlBlocklist(e,r);var s=function(i){i.checkUrlTriggerConditions(e,r,(e=>{n.Ae(i,void 0)&&(i.activateTrigger(e,t),n.updateActiveTriggers(t),n.Se(e))}),t)};for(var a of this.Me)s(a)}setupEventTriggerListeners(t,e,r){var i=this;return this.Ce=t((t=>{var r;if(this.Ie)return aa.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this.Ce)||r.call(this),void(this.Ce=void 0);try{var n=function(r){r.checkEventTriggerConditions(t.event,(n=>{if(i.Ae(r,t.properties)){var s=(r.group.conditions.events||[]).filter((e=>e.name===t.event)),a=i._instance.get_property($n);s.some((e=>!e.properties||0===e.properties.length||sa(e.properties,t.properties,a)))&&(r.activateTrigger(n,e),i.updateActiveTriggers(e),i.Se(n))}}),e)};for(var s of this.Me)n(s)}catch(t){aa.error("Could not activate event trigger for trigger groups",t)}})),this.Ce}makeSamplingDecisions(t){for(var e of this.Me){var r,i=e.group,n=i.id,s=i.sampleRate,a=Nn+n,o=this._instance.get_property(a),u=null,l=!1,h=!1,d=!1;if(ei(o)){var c=o.sessionId,v=o.sampleRate,f=o.sampled;l="string"==typeof c&&c!==t,h=ai(v)&&v!==s,u=c===t&&ai(v)&&v===s&&oi(f)?f:null}else u=o===t||null,l="string"==typeof o&&o!==t,d=o===t;var p=l||h||d||!oi(u),g=p?ta(t+n,s):u;p&&this.Ee("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:g}),this.Te.set(n,g),null==(r=this._instance.persistence)||r.register({[a]:{sessionId:t,sampleRate:s,sampled:g}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Ie=!0}clearConditionalRecordingPersistence(){var t,e,r;for(var i of(null==(t=this._instance.persistence)||t.unregister(xn),null==(e=this._instance.persistence)||e.unregister(Cn),null==(r=this._instance.persistence)||r.unregister(En),this.Me)){var n,s,a,o=i.group.id;null==(n=this._instance.persistence)||n.unregister(Dn+o),null==(s=this._instance.persistence)||s.unregister(Ln+o),null==(a=this._instance.persistence)||a.unregister(Nn+o)}}updateActiveTriggers(t){var e=[];for(var r of this.Me){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(t),a=!0===this.Te.get(n);s&&e.push({id:n,name:i.name,matched:!0,sampled:a})}this._instance.register_for_session({$sdk_debug_replay_matched_recording_trigger_groups:e})}hasPendingTriggers(t){for(var e of this.Me)if(e.triggerStatus(t)===Qn)return!0;return!1}getPendingTriggerConditions(t){return this.Me.flatMap((e=>e.triggerStatusNoSideEffects(t)!==Qn?[]:e.getPendingTriggerConditions(t).map((t=>'trigger group "'+e.group.name+'": '+t))))}stop(){var t;null==(t=this.Ce)||t.call(this),this.Ce=void 0,this.Me.forEach((t=>t.stop())),this.Me=[],this.Te.clear(),this.J.stop()}Ae(t,e){var r=t.group.conditions.properties;return!r||0===r.length||sa(r,e,this._instance.get_property($n))}Re(t){var e=this;this.Me.forEach((t=>t.stop())),this.Me=[],this.Te.clear();var r=function(t){var r=new ls(e._instance,t,((r,i)=>{e.ke("linked_flag_matched",{flag:r,variant:i,group_id:t.id,group_name:t.name}),e.Se()}));e.Me.push(r)};for(var i of t)r(i)}}var da=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ca=1e5,va="https://schema.org",fa=[],pa="actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),ga="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ma="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),ya="Accommodation AdministrativeArea Country Place State".split(" "),ba={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:ga,publisher:ma},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:fa},Offer:{seller:ma},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Person:{},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:ma,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ma,areaServed:ya,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:fa}},wa={},ka=[[ga,wa],["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),ba.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),ba.Event],[ma,ba.Organization],[ya,ba.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),ba.Product],["AggregateRating EmployerAggregateRating Rating".split(" "),wa]],_a="AlignmentObject BedDetails Certification ContactPoint CreditCard DefinedRegion EducationalOccupationalCredential EntryPoint GeoCoordinates GeoShape InteractionCounter JobPosting LocationFeatureSpecification MathSolver MemberProgram MemberProgramTier MerchantReturnPolicy MerchantReturnPolicySeasonalOverride MonetaryAmount NutritionInformation OccupationalExperienceRequirements OfferShippingDetails OpeningHoursSpecification PeopleAudience PostalAddress PriceSpecification PropertyValue QuantitativeValue ServicePeriod ShippingConditions ShippingDeliveryTime ShippingRateSettings ShippingService SpeakableSpecification Thing UnitPriceSpecification".split(" ");function Sa(t,e){return Xr.call(t,e)?t[e]:void 0}function Ma(t){var e=typeof t;return ni(t)||"string"===e||"number"===e||"boolean"===e}function Ca(t){return Ma(t)||Yr(t)&&t.every(Ma)?t:void 0}function Ia(t){if(Xr.call(ba,t))return ba[t];for(var e of ka){var r=e[1];if(e[0].includes(t))return r}return _a.includes(t)?wa:void 0}function Aa(t,e){if(!ei(t))return null;var r=Sa(t,"@type"),i=function(t){return("string"==typeof t?[t]:Yr(t)?t:[]).filter((t=>"string"==typeof t)).map((t=>t.replace(/^https?:\/\/schema\.org\//,""))).filter((t=>!!Ia(t)))}(r).filter((t=>!e||!e.length||e.includes(t)));if(!i.length)return null;var n={"@type":"string"==typeof r?i[0]:i},s=Ca(Sa(t,"@id"));for(var a of(ri(s)||(n["@id"]=s),pa)){var o=Ca(Sa(t,a));ri(o)||(n[a]=o)}for(var u of i){var l=Ia(u),h=function(){var e=Sa(t,d),r=l[d];if(!0===r){var i=Ca(e);ri(i)||(n[d]=i)}else if(Yr(e)){var s=e.map((t=>Aa(t,r))).filter(ei);s.length&&(n[d]=s)}else{var a=Aa(e,r);a&&(n[d]=a)}};for(var d of Object.keys(l))h()}return n}function Ra(t){if(!ei(t))return null;var e=Sa(t,"@context");if("string"!=typeof e||!/^https?:\/\/schema\.org\/?$/.test(e))return null;var i=Aa(t);if(i)return r({"@context":va},i);var n=Sa(t,"@graph");if(!Yr(n))return null;var s=n.map((t=>Aa(t))).filter(ei);return s.length?{"@context":va,"@graph":s}:null}function Ta(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null==(e=t.getAttribute("type"))?void 0:e.trim().toLowerCase())}function xa(t,e,r){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some((t=>(e.lastIndex=0,e.test(t)))))return!0;try{return!!r&&t.matches(r)}catch(t){return!1}}function Ea(t){return Ta(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(Ta)}function Oa(t){return ri(t)?void 0:Math.round(t)}function Fa(t){return ei(t)?t.network_timing:t}var Da,La,Na=943718.4,Pa="[SessionRecording]",Ba=ki(Pa),$a=[Sn.MouseMove,Sn.MouseInteraction,Sn.Scroll,Sn.ViewportResize,Sn.Input,Sn.TouchMove,Sn.MediaInteraction,Sn.Drag],Wa=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function za(){var t;return null==Zr||null==(t=Zr.__PosthogExtensions__)?void 0:t.rrweb}function ja(){var t;return null==(t=za())?void 0:t.record}function Ua(t){try{return JSON.stringify(t)}catch(e){return JSON.stringify(t,cs())}}function Ha(t){return Xs(function(t,e){void 0===e&&(e={});var r=Gs(),i=t.length;r.p(t);var n=Vs(t,e,Qs(e),8),s=n.length;return Js(n,e),Zs(n,s-8,r.d()),Zs(n,s-4,i),n}(function(t,e){var r=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new gs(t.length+(t.length>>>1)),n=0,s=function(t){i[n++]=t},a=0;r>a;++a){if(n+5>i.length){var o=new gs(n+8+(r-a<<1));o.set(i),i=o}var u=t.charCodeAt(a);128>u?s(u):2048>u?(s(192|u>>>6),s(128|63&u)):u>55295&&57344>u?(s(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++a))>>>18),s(128|u>>>12&63),s(128|u>>>6&63),s(128|63&u)):(s(224|u>>>12),s(128|u>>>6&63),s(128|63&u))}return Ls(i,0,n)}(Ua(t))))}function qa(t){return Ga.apply(this,arguments)}function Ga(){return Ga=e((function*(t){var e=Ua(t),r=yield function(t,e,r){return gi.apply(this,arguments)}(e,yi.DEBUG,{rethrow:!0});return Xs(new Uint8Array(yield r.arrayBuffer()))})),Ga.apply(this,arguments)}var Va="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Za=!1;function Ja(t){return Yr(t)&&0===t.length?Da=null!=Da?Da:Ha([]):Ha(t)}function Qa(t){return Xa.apply(this,arguments)}function Xa(){return(Xa=e((function*(t){return Yr(t)&&0===t.length?Da||(La=null!=La?La:qa([]).then((t=>(Da=t,t))).catch((t=>{throw Da=void 0,La=void 0,t}))):qa(t)}))).apply(this,arguments)}function Ka(t){return Va&&!Za&&function(t){return t.type===_n.FullSnapshot||t.type===_n.IncrementalSnapshot&&(t.data.source===Sn.Mutation||t.data.source===Sn.StyleSheetRule)}(t)}function Ya(t){return{event:t,size:fs(t)}}function to(t,e){return r({},t,{data:e,cv:"2024-10"})}function eo(t,e){return r({},t,{cv:"2024-10",data:r({},t.data,e)})}function ro(t){try{if(t.type===_n.FullSnapshot)return Ya(to(t,Ha(t.data)));if(t.type===_n.IncrementalSnapshot&&t.data.source===Sn.Mutation)return Ya(eo(t,{texts:Ja(t.data.texts),attributes:Ja(t.data.attributes),removes:Ja(t.data.removes),adds:Ja(t.data.adds)}));if(t.type===_n.IncrementalSnapshot&&t.data.source===Sn.StyleSheetRule)return Ya(eo(t,{adds:t.data.adds?Ha(t.data.adds):void 0,removes:t.data.removes?Ha(t.data.removes):void 0}))}catch(t){Ba.error("could not compress event - will use uncompressed event",t)}return{event:t,size:vs(t)}}function io(){return(io=e((function*(t){try{if(t.type===_n.FullSnapshot)return Ya(to(t,yield qa(t.data)));if(t.type===_n.IncrementalSnapshot&&t.data.source===Sn.Mutation){var e=yield Promise.all([Qa(t.data.texts),Qa(t.data.attributes),Qa(t.data.removes),Qa(t.data.adds)]);return Ya(eo(t,{texts:e[0],attributes:e[1],removes:e[2],adds:e[3]}))}if(t.type===_n.IncrementalSnapshot&&t.data.source===Sn.StyleSheetRule){var r=yield Promise.all([t.data.adds?qa(t.data.adds):void 0,t.data.removes?qa(t.data.removes):void 0]);return Ya(eo(t,{adds:r[0],removes:r[1]}))}}catch(e){return(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return(t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(t)||e===vi})(e)&&(Za=!0),Ba.error("could not compress event asynchronously - trying synchronous compression",e),ro(t)}return{event:t,size:vs(t)}}))).apply(this,arguments)}function no(t,e){return t.type===_n.Custom&&t.data.tag===e}function so(t){return no(t,"sessionIdle")}function ao(t){return no(t,"$session_ending")}function oo(t){return no(t,"$session_starting")}class uo{get sessionId(){return this.Le}get Oe(){if(!this._instance.sessionManager)throw new Error(Pa+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Pe(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get De(){return ua(this._instance.get_property(xn),this.sessionId)}get be(){var t,e=null==(t=this.Fe)?void 0:t.sampleRate;return ai(e)?e:null}get Ne(){var t,e;return null!==(t=null==(e=this.qe)?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this.je="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.Be=void 0,this.He=!1,this.$e=Date.now(),this.Ue=!1,this.We=[],this.ze="unknown",this.Ve=0,this.Ze=0,this.Ge=0,this.Qe=0,this.Je=!1,this.Ye=!1,this.Ke=!1,this.Xe=!1,this.et=!1,this.tt=!1,this.rt=!1,this.it=!1,this.nt=!1,this.ot=!1,this.st=!1,this.ut=!1,this.ht=[],this.ct=void 0,this.dt=void 0,this.vt=[],this.ft=0,this.yt=0,this.bt=!1,this.wt=void 0,this.Ce=void 0,this.kt=void 0,this._t=void 0,this.St=void 0,this.xt=(t,e,r)=>{var i,n,s;if(r&&(t!==this.Le||e!==this.Ct)){var a,o=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),u=this.Le,l=this.Ct;if(o&&this.Ee("$session_ending",{currentSessionId:u,currentWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.$e,flushed_size:null==(a=this.Mt)?void 0:a.currentTrackedSize(u)}),null==(i=this._instance.persistence)||i.unregister(Pn),this.rt=!1,null==(n=za())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this.Ee("$session_id_change",{sessionId:t,windowId:e,changeReason:r}),this.Tt(),!(!1===this.ze&&this.isStarted||this.Le===t&&this.Ct===e)){var h=this.Le!==t&&!1!==this.ze;this.ze="unknown",this.It(h)}o&&this.Ee("$session_starting",{previousSessionId:u,previousWindowId:l,nextSessionId:t,nextWindowId:e,changeReason:r,lastActivityTimestamp:this.$e}),null==(s=this.qe)||s.makeSamplingDecisions(t)}},this.Et=()=>{var t;return(null==(t=this._instance.persistence)?void 0:t.props[En])===this.Le},this.Rt=()=>{var t,e;if(0===this.At.data.length)return null;var r=null==(t=this.At.data[0])?void 0:t.timestamp,i=null==(e=this.At.data[this.At.data.length-1])?void 0:e.timestamp;return ai(r)&&ai(i)?i-r:null},this.Lt=()=>{var t,e,r=this.Ne;if(!ai(r))return!1;if(null===(t=null==(e=this._instance.config.session_recording)?void 0:e.strictMinimumDuration)||void 0===t||!t){var i=this.Ot;return ai(i)&&i>=0&&r>i}if(this.Et())return!1;var n,s=this.Rt();return!!ni(s)||r>s||(null==(n=this._instance.persistence)||n.register({[En]:this.Le}),!1)},this.Pt=()=>{this.status!==qn?(this.Je&&this.Ye&&this.Dt&&!this.Ke&&(this.Je=!1),this.Ft(),this.Nt()):this.qt()},this.jt=()=>{this.Pt()},this.Bt=()=>{this.Ee("browser offline",{})},this.Ht=()=>{this.Ee("browser online",{})},this.$t=()=>{null!=qr&&qr.visibilityState&&("visible"===qr.visibilityState&&(this.Dt=!0),this.Ee("window "+qr.visibilityState,{}))},this._instance=t,this.Dt=null==e||e;var r=this.Oe.checkAndGetSessionAndWindowId(),i=r.windowId;this.Le=r.sessionId,this.Ct=i,this.K=new os(this._instance),this.J=new as(this._instance),this.Y=new us(this._instance),this.At=this.qt(),this.Oe.sessionTimeoutMs>this.Pe||Ba.warn("session_idle_threshold_ms ("+this.Pe+") is greater than the session timeout ("+this.Oe.sessionTimeoutMs+"). Session will never be detected as idle"),this.Mt=new Ys(this._instance)}setDocumentWasEverVisible(t){t&&(this.Dt=!0)}get Ut(){var t,e,r,i,n,s,a,o,u,l=null==(t=this.Fe)?void 0:t.masking,h={maskAllInputs:null==(e=this._instance.config.session_recording)?void 0:e.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector,maskAllElementAttributes:null==(n=this._instance.config.session_recording)?void 0:n.maskAllElementAttributes},d=null!==(s=null==h?void 0:h.maskAllInputs)&&void 0!==s?s:null==l?void 0:l.maskAllInputs,c=null!==(a=null==h?void 0:h.maskTextSelector)&&void 0!==a?a:null==l?void 0:l.maskTextSelector,v=null!==(o=null==h?void 0:h.blockSelector)&&void 0!==o?o:null==l?void 0:l.blockSelector,f=null!==(u=null==h?void 0:h.maskAllElementAttributes)&&void 0!==u?u:null==l?void 0:l.maskAllElementAttributes;return ri(d)&&ri(c)&&ri(v)&&ri(f)?void 0:{maskAllInputs:null==d||d,maskTextSelector:c,blockSelector:v,maskAllElementAttributes:f}}Wt(){var t;if(!this.nt){var e=null==(t=this.Fe)?void 0:t.masking;if(!si(e)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter((t=>{var i=null==r?void 0:r[t],n=e[t];return!ri(i)&&i!==n}));0!==i.length&&(this.nt=!0,Ba.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector,maskAllElementAttributes:null==r?void 0:r.maskAllElementAttributes},project:e}))}}}get zt(){var t;return li(null==(t=this._instance.config.session_recording.canvasCapture)?void 0:t.resolutionScale,.1,1,ki("canvas recording resolution scale"),1)}get Vt(){var t,e,r,i,n,s,a,o=this._instance.config.session_recording.captureCanvas,u=null==(t=this.Fe)?void 0:t.canvasRecording,l=null!==(e=null!==(r=null==o?void 0:o.recordCanvas)&&void 0!==r?r:null==u?void 0:u.enabled)&&void 0!==e&&e,h=null!==(i=null!==(n=null==o?void 0:o.canvasFps)&&void 0!==n?n:null==u?void 0:u.fps)&&void 0!==i?i:4,d=null!==(s=null!==(a=null==o?void 0:o.canvasQuality)&&void 0!==a?a:null==u?void 0:u.quality)&&void 0!==s?s:.4;if("string"==typeof d){var c=parseFloat(d);d=isNaN(c)?.4:c}return{enabled:l,fps:li(h,0,12,ki("canvas recording fps"),4),quality:li(d,0,1,ki("canvas recording quality"),.4)}}get Zt(){var t,e=!(null==(t=this.Fe)||!t.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:e}get Gt(){var t,e,r,i=null==(t=this.Fe)?void 0:t.networkPayloadCapture,n={recordHeaders:null==(e=this._instance.config.session_recording)?void 0:e.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),a=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),o=Fa(this._instance.config.capture_performance),u=Fa(null==i?void 0:i.capturePerformance),l=!!(oi(o)?o:u);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}Qt(){var t,e,i=[],n=null==(t=Zr.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordConsolePlugin;n&&this.Zt&&i.push(n());var s=null==(e=Zr.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordNetworkPlugin;if(this.Gt&&ti(s))if(!Mi.includes(Gr.hostname)||this._forceAllowLocalhostNetworkCapture){var a=ti(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(s(((t,e,i)=>{var n,s={payloadSizeLimitBytes:ji.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ji.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ji.payloadHostDenyList]},a=!1!==t.session_recording.recordHeaders&&e.recordHeaders,o=!1!==t.session_recording.recordBody&&e.recordBody,u=!1!==t.capture_performance&&e.recordPerformance,l=(n=zi(s),t=>(null!=t&&t.requestBody&&(t.requestBody=Zi(t.requestBody,t.requestHeaders,n,"Request")),null!=t&&t.responseBody&&(t.responseBody=Zi(t.responseBody,t.responseHeaders,n,"Response")),t)),h=e=>{return l(((t,e,r)=>{var i;if(null==r||!r(t.name)){var n=Ci(t.name),s=0===e.indexOf("http")?null==(i=Ci(e))?void 0:i.pathname:e;"/"===s&&(s="");var a=null==n?void 0:n.pathname.replace(s||"","");if(!(n&&a&&Vi.some((t=>0===a.indexOf(t)))))return t}})((Gi((r=e).requestHeaders),Gi(r.responseHeaders),r),t.api_host,i));var r},d=ti(t.session_recording.maskNetworkRequestFn);return d&&ti(t.session_recording.maskCapturedNetworkRequestFn)&&wi.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{var i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:r({},e,{name:null==i?void 0:i.url})}),s.maskRequestFn=ti(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var r=h(e);if(r){var i=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,n=null==t.session_recording.maskCapturedNetworkRequestFn?void 0:t.session_recording.maskCapturedNetworkRequestFn(r);return si(n)&&i?(Qi.add(i),i):null!=n?n:void 0}}:t=>function(t){if(!ri(t))return t.requestBody=Ji(t.requestBody,"Request"),t.responseBody=Ji(t.responseBody,"Response"),t}(h(t)),r({},ji,s,{recordHeaders:a,recordBody:o,recordPerformance:u,recordInitialRequests:u,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.Gt,a)))}else Ba.info("NetworkCapture not started because we are on localhost.");return i}Jt(t){return this._instance.config.disable_capture_url_hashes?di(t):t}Yt(t,e){void 0===e&&(e=!1);var r=e?di(t):this.Jt(t),i=this._instance.config.mask_personal_data_properties?[...da,...this._instance.config.custom_personal_data_properties||[]]:[];return this.Kt(function(t,e,r){if(!t||!e||!e.length)return t;for(var i=t.split("#"),n=i[1],s=(i[0]||"").split("?"),a=s[1],o=s[0],u=(a||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");Yr(d)&&(e.includes(d[0])?l.push(d[0]+"="):l.push(u[h]))}var c=o;return null!=a&&(c+="?"+l.join("&")),null!=n&&(c+="#"+n),c}(r,i))}Kt(t){var e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var r,i=e.maskCapturedNetworkRequestFn({name:t});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(e.maskNetworkRequestFn){var n=e.maskNetworkRequestFn({url:t});return null==n?void 0:n.url}return t}Xt(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.We.length?this.We.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):Ba.warn("could not emit queued rrweb event.",e,t),!1}}Ee(t,e){return this.Xt(Wa((()=>ja().addCustomEvent(t,e))))}er(){var t;return this.He&&!0===(null==(t=this._instance.config.session_recording)?void 0:t.captureJsonLd)&&!this.J.urlBlocked&&!0!==this.ze}tr(t){if(!this.er())return!1;try{var e=ja();return!!e&&(e.addCustomEvent("$json_ld",t),this.er())}catch(t){return!1}}rr(t){void 0===t&&(t=!1),Promise.resolve().then((()=>{var e;return null==(e=this.ir)?void 0:e.scan(t)}))}nr(){try{if(this._instance.config.capture_pageview||!Ur)return;var t=new URL(Ur.location.href),e=this.Yt(t.origin+t.pathname+t.search);this.ar!==e&&(this.ar=e,this.Ee("$url_changed",{href:e}))}catch(t){}}sr(){if(this.We.length){var t=[...this.We];this.We=[],t.forEach((t=>{Date.now()-t.enqueuedAt>2e3||this.Xt(t)}))}}_e(){return this.Xt(Wa((()=>ja().takeFullSnapshot())))}get ur(){var t,e,r;if(null!=(t=this.qe)&&t.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return ai(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(e=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==e?e:3e5}lr(){if(this.hr&&clearInterval(this.hr),!0!==this.ze){var t=this.ur;t&&(this.hr=setInterval((()=>{this._e()}),t))}}Se(t){"event"===t&&this.cr(),!this.J.urlBlocked&&["sampled","active"].includes(this.status)&&this.lr()}dr(){var t;this.J.urlBlocked||(this.J.urlBlocked=!0,null==(t=this.ir)||t.scan(),clearInterval(this.hr),Ba.info("recording paused due to URL blocker"),this.Ee("recording paused",{reason:"url blocker"}))}vr(){var t;this.J.urlBlocked&&(null==(t=this.ir)||t.scan(),this.J.urlBlocked=!1,this._e(),this.rr(),this.lr(),this.Ee("recording resumed",{reason:"left blocked url"}),Ba.info("recording resumed"))}pr(t,e){var r;if("event"===t&&this.cr(),!this.Ue&&null!=(r=this.qe)&&r.hasPendingTriggers(this.sessionId)){this.Ue=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===t?On:Fn]:this.sessionId}),null==(n=this.qe)||n.updateActiveTriggers(this.sessionId),this.Se(),this.Nt(),this.ke(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.Ue=!1}}}get isStarted(){return!!this.Be}get Fe(){var t=this._instance.get_property(Mn);if(t){var e;try{e=ei(t)?t:JSON.parse(t)}catch(t){return void Ba.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted){var r,i,n=null!==(r=e.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>36e5)return Ba.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t}),void(null==(i=this._instance.persistence)||i.unregister(Mn))}return e}}gr(t,e,r){this._instance.get_property(t)&&(e(),r())}start(t){var e,r,i=this.Fe;if(i){this.isStarted||(this.Je=!1!==this.ze&&!this.Xe,this.Xe=!1,this.Ye=this.Je,this.Ke=!1),this.bt&&(this.mr(),this.qt());var n=this.Oe.checkAndGetSessionAndWindowId(),s=n.windowId;this.Le=n.sessionId,this.Ct=s,null==(e=this._instance.persistence)||e.unregister(Pn),null!=i&&i.endpoint&&(this.je=null==i?void 0:i.endpoint),this.qe=2===(null==i?void 0:i.version)&&(null==i?void 0:i.triggerGroups)&&i.triggerGroups.length>0?new ha(this._instance,this.J,this.ke.bind(this),this.Ee.bind(this),this.Se.bind(this)):new la(this._instance,this.J,this.Y,this.K,this.ke.bind(this),this._e.bind(this),this.Se.bind(this)),this.qe.onRemoteConfig(i),null==(r=this.Ce)||r.call(this),this.Ce=this.qe.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((t,e)=>this.pr(t,e))),this.gr(In,(()=>{this.overrideSampling()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(In)})),this.gr(An,(()=>{this.overrideLinkedFlag()}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(An)})),this.gr(Tn,(()=>{this.overrideTrigger("event")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Tn)})),this.gr(Rn,(()=>{this.overrideTrigger("url")}),(()=>{var t;return null==(t=this._instance.persistence)?void 0:t.unregister(Rn)})),this.qe.makeSamplingDecisions(this.sessionId),this.yr(),this.et||(Si(Ur,"beforeunload",this.Pt),Si(Ur,"pagehide",this.jt),Si(Ur,"offline",this.Bt),Si(Ur,"online",this.Ht),Si(qr,"visibilitychange",this.$t),!this.kt&&ti(this.Oe.onSessionId)&&(this.kt=this.Oe.onSessionId(this.xt)),!this._t&&ti(this.Oe.on)?this._t=this.Oe.on("forcedIdleReset",(()=>{this.Tt(),this.ze="unknown",this.stop(),this.St=this.Oe.onSessionId(((t,e,r)=>{var i;null==(i=this.St)||i.call(this),this.St=void 0,this.xt(t,e,r)}))})):ti(this.Oe.on)||Ba.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),si(this.wt)&&(this.wt=this._instance.on("eventCaptured",(t=>{try{if("$pageview"===t.event){var e=null!=t&&t.properties.$current_url?this.Yt(t.properties.$current_url):"";if(!e)return;this.Ee("$pageview",{href:e})}}catch(t){Ba.error("Could not add $pageview to rrweb session",t)}}))),this.status===Hn&&this.ke(t||"recording_initialized"))}else Ba.info("remote config must be stored in persistence before recording can start")}br(){var t,e,r,i,n,s;null==Ur||Ur.removeEventListener("beforeunload",this.Pt),null==Ur||Ur.removeEventListener("pagehide",this.jt),null==Ur||Ur.removeEventListener("offline",this.Bt),null==Ur||Ur.removeEventListener("online",this.Ht),null==qr||qr.removeEventListener("visibilitychange",this.$t),clearInterval(this.hr),this.wr(),null==(t=this.wt)||t.call(this),this.wt=void 0,null==(e=this.Ce)||e.call(this),this.Ce=void 0,null==(r=this.kt)||r.call(this),this.kt=void 0,null==(i=this._t)||i.call(this),this._t=void 0,null==(n=this.St)||n.call(this),this.St=void 0,null==(s=this.qe)||s.stop(),this.kr(),this.mr()}mr(){this.yt+=1,this.vt=[],this.ft=0,this._r=void 0,this.bt=!1}kr(){var t,e,r;null==(t=this.Sr)||t.stop(),this.We=[],null==(e=this.ir)||e.stop(),this.ir=void 0,this.He=!1,null==(r=this.Be)||r.call(this),this.Be=void 0}Cr(){if(!this._r||0===this.ft)return!1;if(this.bt)return!0;this.bt=!0;var t=this.yt;return this.wr(),this.kr(),this._r.catch((()=>{})).then((()=>{t===this.yt&&(this.bt=!1,this.Nt(),this.qt(),this.br(),Ba.info("stopped"))})).catch((()=>{this.bt=!1,this.br(),Ba.info("stopped")})),!0}stop(){this.kr(),this.Cr()||(this.Nt(),this.qt(),this.br(),Ba.info("stopped"))}It(t){var e;this.stop(),this.Mr=void 0,this.Tr=void 0,this.Ze=0,this.Ge=0,this.Qe=0,null==(e=za())||null==e.resetSnapshotCostState||e.resetSnapshotCostState(),this.start("session_id_changed"),this.Je=t,this.Ye=!1}cr(){this.isStarted||(this.Xe=!0),this.Je&&(this.Je=!1,this.Ye=!1,this.Ke&&(this.Ke=!1,this._e()),this.Ir())}discard(){this.qt(),this.br(),Ba.info("discarded")}Er(t,e,r,i,n){var s={$snapshot_bytes:r,$snapshot_data:e,$session_id:i,$window_id:n};this.status!==jn?(this.Rr(t,i),this.Ar(s)):this.qt()}Lr(){try{this.Or()}catch(t){this.it||(this.it=!0,Ba.error("could not track full snapshot cost",t))}}Or(){var t,e=null==(t=za())||null==t.getLastSnapshotCost?void 0:t.getLastSnapshotCost();e&&e!==this.Tr&&(this.Tr=e,this.Mr&&this.Mr.durationMs>=e.durationMs||(this.Mr=e),500>e.durationMs||Ba.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(e.durationMs),stylesheetMs:Math.round(e.stylesheetMs),nodeCount:e.nodeCount,cssRuleCount:e.cssRuleCount,nonDeferrableCssRuleCount:e.nonDeferrableCssRuleCount,deferredStylesheetCount:e.deferredStylesheetCount}))}Rr(t,e){t.type!==_n.FullSnapshot?t.type===_n.IncrementalSnapshot&&(ri(this.ct)||this.ct===e||this.dt===e||(this.dt=e,Ba.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this._e())):this.ct=e}Pr(t){t.counted&&t.generation===this.yt&&(this.ft=Math.max(0,this.ft-1)),t.counted=!1,this.vt=this.vt.filter((e=>e!==t))}Dr(t,e,r){t.processed||t.generation!==this.yt||(t.processed=!0,this.Er(t.event,e,r,t.targetSessionId,t.targetWindowId))}Fr(t){try{var e=t.compressionEnabled?ro(t.event):{event:t.event,size:vs(t.event)};this.Dr(t,e.event,e.size)}finally{this.Pr(t)}}Ft(){[...this.vt].forEach((t=>{this.Fr(t)}))}Nr(t,r,i,n){var s=this,a={event:t,compressionEnabled:r,targetSessionId:i,targetWindowId:n,generation:this.yt,processed:!1,counted:!0};this.vt.push(a),this.ft+=1;var o=function(){var i=e((function*(){try{if(a.processed)return;var e,i;try{var n=r?Ka(t)?yield function(t){return io.apply(this,arguments)}(t):ro(t):{event:t,size:vs(t)};e=n.event,i=n.size}catch(r){Ba.error("could not process queued compression event - will use uncompressed event",r),e=t,i=vs(t)}s.Dr(a,e,i)}finally{s.Pr(a)}}));return function(){return i.apply(this,arguments)}}();this._r=this._r?this._r.catch((()=>{})).then(o):o()}onRRwebEmit(t){var e,r,i,n,s,a,o,u,l;if(this._instance.sessionManager&&(this.sr(),t&&ei(t))){if(t.type===_n.Meta){var h=this.Yt(t.data.href);if(this.ar=h,!h)return;t.data.href=h}else this.nr();if(null==(e=this.qe)||e.checkUrlTriggers(this.sessionId,(()=>this.dr()),(()=>this.vr()),((t,e)=>this.pr(t,e))),!this.J.urlBlocked||(d=t).type===_n.Custom&&"recording paused"===d.data.tag){var d,c,v,f;t.type===_n.FullSnapshot&&(null!=(c=za())&&null!=c.wasMaxDepthReached&&c.wasMaxDepthReached()&&(this.rt=!0),this.Lr(),Promise.resolve().then((()=>this.Lr())),this.lr(),null==(v=this.Sr)||v.reset(),null==(f=this._instance.persistence)||f.register_once({[Pn]:t.timestamp},void 0));var p=t.type===_n.FullSnapshot&&(null==(r=this.qe)?void 0:r.hasPendingTriggers(this.sessionId));p&&this.qr();var g=this.Sr?this.Sr.throttleMutations(t):t;if(g){var m=function(t){var e=t;if(e&&ei(e)&&6===e.type&&ei(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;e.data.payload.payload.length>i;i++)r.push(e.data.payload.payload[i]&&e.data.payload.payload[i].length>2e3?e.data.payload.payload[i].slice(0,2e3)+"...[truncated]":e.data.payload.payload[i]);return e.data.payload.payload=r,t}return t}(g),y=function(t){return ao(t)?t.data.payload:null}(m),b=function(t){return oo(t)?t.data.payload:null}(m),w=function(t){return so(t)?t.data.payload:null}(m);y||b?null!=y&&y.lastActivityTimestamp&&(m.timestamp=y.lastActivityTimestamp):null!=w&&w.sessionId||this.jr(m),t.type===_n.FullSnapshot&&(this.ht.push([this.Le,t.timestamp]),this.ht.length>6&&(this.ht=this.ht.slice(-6)));var k=null!==(i=null!==(n=null!==(s=null==y?void 0:y.currentSessionId)&&void 0!==s?s:null==b?void 0:b.nextSessionId)&&void 0!==n?n:null==w?void 0:w.sessionId)&&void 0!==i?i:this.Le,_=null!==(a=null!==(o=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==b?void 0:b.nextWindowId)&&void 0!==o?o:null==w?void 0:w.windowId)&&void 0!==a?a:this.Ct;if(!0!==this.ze||function(t){return so(t)||ao(t)||oo(t)}(m)){m.type===_n.FullSnapshot&&(this.Ve=0),w&&(m.timestamp=w.lastActivityTimestamp+w.threshold);var S=this.He;this.He=!0,p?this.rr(!0):S||this.rr();var M=null===(l=this._instance.config.session_recording.compress_events)||void 0===l||l;if(this.ft>0||M&&Ka(m))this.Nr(m,M,k,_);else{var C=M?ro(m):{event:m,size:vs(m)};this.Er(m,C.event,C.size,k,_)}}else(function(t){return t.type===_n.FullSnapshot||t.type===_n.Meta||t.type===_n.IncrementalSnapshot&&t.data.source!==Sn.CanvasMutation})(m)&&this.Ve++}else!0===this.ze&&this.Ve++}}}get status(){return this.qe?this.qe.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.De,rrwebError:this.et,urlTriggerMatching:this.J,eventTriggerMatching:this.Y,linkedFlagMatching:this.K,remoteConfig:this.Fe}):jn}log(t,e){var r;void 0===e&&(e="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.K.linkedFlagSeen=!0,this._e(),this.cr(),this.ke("linked_flag_overridden")}overrideSampling(){var t;null==(t=this._instance.persistence)||t.register({[xn]:this.sessionId,[Cn]:null}),this._e(),this.cr(),this.ke("sampling_overridden")}overrideTrigger(t){this.pr(t),this.cr()}Br(){try{var t,e=null==Ur||null==(t=Ur.location)?void 0:t.href;if(!e)return;var r=this.Yt(e);if(!r)return;return new URL(r).hostname||void 0}catch(t){return}}wr(){this.Hr&&(clearTimeout(this.Hr),this.Hr=void 0)}Ir(){this.Hr||(this.Hr=setTimeout((()=>{this.Nt()}),2e3))}$r(){return this.ct!==this.At.sessionId&&0!==this.At.data.length&&this.At.data.every((t=>(null==t?void 0:t.type)===_n.Custom&&!ao(t)&&!oo(t)))}Ur(){var t,e;return null!==(t=null==(e=this.qe)?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}Wr(t){if(t!==qn)return ri(this.zr)||this._instance.register_for_session({[Wn]:[]}),void(this.zr=void 0);var e=this.Ur();if(0===e.length)return ri(this.zr)||this._instance.register_for_session({[Wn]:[]}),void(this.zr=void 0);var r=e.join(", "),i=this.sessionId+":"+r;i!==this.zr&&(this.zr=i,this._instance.register_for_session({[Wn]:e}),Ba.info("buffering: "+r))}Nt(){var t;if(this.wr(),this.Je)return this.At;if(this.$r())return this.At.size>Na?this.qt():this.At;var e=this.At;null==(t=this.qe)||t.ensureSamplingDecision(this.sessionId);var r=this.Lt(),i=this.status;if(this.Wr(i),i===qn||i===Gn||i===jn||r)return this.Ir(),this.At;if(this.At!==e)return this.At;if(e.data.length>0){var n,s=this.Br();ps(e).forEach((t=>{var e;null==(e=this.Mt)||e.trackSize(t.sessionId,t.size),this.Vr({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:yi.LIB_NAME,$lib_version:yi.LIB_VERSION,$snapshot_host:s})})),null==(n=this.qe)||n.onFlushComplete()}return this.qt()}Ar(t){var e,r=2+((null==(e=this.At)?void 0:e.data.length)||0),i=t.$session_id,n=this.At.sessionId!==i;if(n||!0!==this.ze&&!this.Je&&this.At.size+t.$snapshot_bytes+r>Na){var s=this.Le;if(this.At=this.Nt(),this.Le!==s)return;n&&this.At.data.length>0&&(this.At=this.qt()),this.At.sessionId=i,this.At.windowId=t.$window_id}this.Je&&(this.Ke||this.At.size+t.$snapshot_bytes+r>Na)?this.Ke||(this.Ke=!0,this.At=this.qt()):(this.At.size+=t.$snapshot_bytes,this.At.data.push(t.$snapshot_data),this.At.sizes.push(t.$snapshot_bytes),!0===this.ze||this.Je||this.Ir())}Vr(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.je),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Ot(){var t,e,r=null==(t=this.At)?void 0:t.data[(null==(e=this.At)?void 0:e.data.length)-1],i=this.Oe.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}qr(){if(!this.At||0===this.At.data.length)return this.qt();for(var t=-1,e=this.At.data.length-1;e>=0;e--)if(this.At.data[e].type===_n.Meta){t=e;break}return 0>t?this.qt():(this.At.data=this.At.data.slice(t),this.At.sizes=this.At.sizes.slice(t),this.At.size=this.At.sizes.reduce(((t,e)=>t+e),0),this.At)}qt(){return this.At={size:0,data:[],sizes:[],sessionId:this.Le,windowId:this.Ct},this.At}ke(t,e){this._instance.register_for_session({$session_recording_start_reason:t}),Ba.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Ee("$recording_started",r({reason:t},e))}Zr(t){var e;return 3===t.type&&-1!==$a.indexOf(null==(e=t.data)?void 0:e.source)}jr(t){var e=this.Zr(t);e||!0===this.ze||t.timestamp-this.$e>this.Pe&&(this.ze=!0,clearInterval(this.hr),this.Ee("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.$e,threshold:this.Pe,bufferLength:this.At.data.length,bufferSize:this.At.size,sessionId:this.Le,windowId:this.Ct}),this.Nt());var r=!1;if(e&&(this.$e=t.timestamp,this.ze)){var i="unknown"===this.ze;this.ze=!1,i||(this.Ee("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}var n=this.Oe.checkAndGetSessionAndWindowId(!e,t.timestamp),s=n.windowId,a=n.sessionId,o=this.Le!==a,u=this.Ct!==s;if(this.Ct=s,this.Le=a,o||u){var l=o&&!1!==this.ze;l&&(this.ze="unknown"),this.It(l)}else if(e&&this.cr(),r){var h,d=["sampled","active"].includes(this.status)||(null==(h=this.qe)?void 0:h.hasPendingTriggers(this.sessionId));this.Ve>0&&d&&this._e(),this.rr(),this.lr()}}Tt(){var t;null==(t=this.qe)||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,r,i,n,s,a,o,u,l=this.Oe.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp,h=null==(t=za())||null==t.getDeferredStylesheetStats?void 0:t.getDeferredStylesheetStats();return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.At.data.length,$sdk_debug_replay_internal_buffer_size:this.At.size,$sdk_debug_current_session_duration:this.Ot,$sdk_debug_session_start:l,$sdk_debug_replay_flushed_size:null==(e=this.Mt)?void 0:e.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.ht,$snapshot_max_depth_exceeded:this.rt,$sdk_debug_replay_slowest_full_snapshot_ms:Oa(null==(r=this.Mr)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Oa(null==(i=this.Mr)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(n=this.Mr)?void 0:n.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(s=this.Mr)?void 0:s.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null==(a=this.Mr)?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==h?void 0:h.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==h?void 0:h.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==h?void 0:h.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Oa(null==h?void 0:h.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Oa(null==h?void 0:h.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Oa(null==(o=za())||null==o.getMutationCost||null==(o=o.getMutationCost())?void 0:o.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(u=za())||null==u.getDiscardedDurationSamples?void 0:u.getDiscardedDurationSamples(),$sdk_debug_replay_throttled_mutations_dropped:this.Ze,$sdk_debug_replay_oversized_mutations_dropped:this.Ge,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.Qe,$sdk_debug_replay_rrweb_error:this.et,$sdk_debug_rrweb_attached:!!this.Be,$sdk_debug_rrweb_start_attempted:this.tt}}yr(){var t;if(!this.Be){this.tt=!0;var e,i,n,s,a={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,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},o=this._instance.config.session_recording;for(var u of Object.entries(o||{})){var l=u[0],h=u[1];if(l in a)if("maskInputOptions"===l)a.maskInputOptions=r({password:!0},h);else if("sampling"===l){var d=null!=h?h:{},c={};ri(d.mousemove)||(c.mousemove=d.mousemove),ri(d.mouseInteraction)||(c.mouseInteraction=d.mouseInteraction),a.sampling=c}else a[l]=h}!0===(null==o?void 0:o.captureJsonLd)&&!0!==a.slimDOMOptions&&"all"!==a.slimDOMOptions&&(a.slimDOMOptions=r({},a.slimDOMOptions,{script:!0})),this.Vt&&this.Vt.enabled&&(a.recordCanvas=!0,a.sampling=r({},a.sampling,{canvas:this.Vt.fps}),a.dataURLOptions={type:"image/webp",quality:this.Vt.quality},a.canvasResolutionScale=this.zt,a.canvasMasking={configured:()=>{var t;return ti(null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn)},regionsFn:t=>{var e,r=null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn;if(ti(r))try{var i;return null!==(i=r(t))&&void 0!==i?i:null}catch(t){return this.st||(this.st=!0,Ba.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.Ut&&(a.maskAllInputs=null===(e=this.Ut.maskAllInputs)||void 0===e||e,a.maskTextSelector=null!==(i=this.Ut.maskTextSelector)&&void 0!==i?i:void 0,a.blockSelector=null!==(n=this.Ut.blockSelector)&&void 0!==n?n:void 0,a.maskAllElementAttributes=null!==(s=this.Ut.maskAllElementAttributes)&&void 0!==s&&s),a.maskAllElementAttributes&&a.maskAttributeFn&&(a.maskAttributeFn=void 0,this.ot||(this.ot=!0,Ba.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.Wt();var v=ja();if(v){this.Sr=null!==(t=this.Sr)&&void 0!==t?t:new Ks(v,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{var r="Too many mutations on node '"+t+"'. Rate limiting. This could be due to SVG animations or something similar";Ba.info(r,{node:e}),this.log(Pa+" "+r,"warn")},onDroppedAttributeMutations:t=>this.Ze+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.ur,onDroppedOversizedMutation:t=>{0===this.Ge&&this.log(Pa+" Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.Ge+=1,this.Qe+=t},requestFullSnapshot:()=>this._e()});var f=this.Qt();if(this.Be=v(r({emit:t=>{this.onRRwebEmit(t)},plugins:f,errorHandler:(t,e)=>"rrweb"===e&&(this.ut||(this.ut=!0,Ba.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},a)),!this.Be)return this.et=!0,void Ba.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.et=!1,!0===(null==o?void 0:o.captureJsonLd)&&qr&&null!=Ur&&Ur.MutationObserver&&!this.ir&&(this.ir=function(t,e,r){var i=new WeakMap,n=r.getCaptureState||(()=>!0),s=ca,a=e=>{try{var a=n();if(!s||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){for(var r=t;r;){if(xa(r,e.blockClass,e.blockSelector)||xa(r,e.maskTextClass,e.maskTextSelector))return!0;var i=r.parentNode;r=r.parentElement||(i&&i.nodeType===i.DOCUMENT_FRAGMENT_NODE?i.host:null)}return!1}(e,r))return;var o=function(t){if(!t||t.length>ca)return null;try{var e=JSON.parse(t),r=Yr(e)?e.map(Ra):Ra(e);if(ni(r)||Yr(r)&&(!r.length||r.some(ni)))return null;var i=JSON.stringify(r);return i.length>2e4?null:[r,i]}catch(t){return null}}(e.text);if(!o)return void i.delete(e);var u=o[0],l=o[1];if(ni(a))return void i.set(e,l);if(i.get(e)!==l){if(l.length>s)return void(s=0);r.emit(u)&&(i.set(e,l),s-=l.length)}}catch(t){return}};try{var o=new e((t=>{try{if(!s||!1===n())return;var e=t=>{for(var e of Ea(t))a(e)};for(var r of t)if("childList"===r.type)Ta(r.target)&&a(r.target),r.addedNodes.forEach(e);else if("characterData"===r.type){var i=r.target.parentNode;i&&Ta(i)&&a(i)}else"attributes"===r.type&&Ta(r.target)&&a(r.target)}catch(t){return}}));return o.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e){void 0===e&&(e=!1),s&&!1!==n()&&Ea(t.documentElement).forEach((t=>{e&&i.delete(t),a(t)}))},stop(){return o.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(qr,Ur.MutationObserver,{blockClass:a.blockClass,blockSelector:a.blockSelector,maskTextClass:a.maskTextClass,maskTextSelector:a.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null==(t=this._instance.config.session_recording)?void 0:t.captureJsonLd)||this.J.urlBlocked||this.J.isCurrentUrlBlocked()?null:this.er()},emit:t=>this.tr(t)}),this.J.isCurrentUrlBlocked()&&this.ir.scan()),this.$e=Date.now(),this.ze=oi(this.ze)?this.ze:"unknown",this.tryAddCustomEvent("$remote_config_received",this.Fe),this.Ee("$session_options",{sessionRecordingOptions:a,activePlugins:f.map((t=>null==t?void 0:t.name))}),this.Ee("$posthog_config",{config:this._instance.config})}else Ba.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(t,e){return this.Ee(t,e)}}Zr.__PosthogExtensions__=Zr.__PosthogExtensions__||{},Zr.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:t=>({name:"rrweb/console@1",observer:jr,options:t}),getRecordNetworkPlugin:t=>({name:"rrweb/network@1",observer:kn,options:t})},Zr.__PosthogExtensions__.rrweb={record:Rr,version:"v2",wasMaxDepthReached:()=>re,resetMaxDepthState(){re=!1,ee=!1},getLastSnapshotCost:()=>B,getMutationCost:()=>r({},H),getDeferredStylesheetStats:()=>r({},q),getDiscardedDurationSamples:()=>T,resetSnapshotCostState(){D=0,L=0,N=0,R=0,T=0,P=I(),B=null,W=null,z=[],j=0,U=0,H={slowestBatchMs:0},q={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},Zr.__PosthogExtensions__.initSessionRecording=(t,e)=>new uo(t,e)}(); //# sourceMappingURL=posthog-recorder.js.map