(function(r){function e(n,s){var l=Object.keys(n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(n);s&&(c=c.filter(function(h){return Object.getOwnPropertyDescriptor(n,h).enumerable})),l.push.apply(l,c)}return l}function t(n){for(var s=1;s<arguments.length;s++){var l=arguments[s]!=null?arguments[s]:{};s%2?e(Object(l),!0).forEach(function(c){a(n,c,l[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(l)):e(Object(l)).forEach(function(c){Object.defineProperty(n,c,Object.getOwnPropertyDescriptor(l,c))})}return n}function i(n,s,l,c,h,f,_){try{var w=n[f](_),S=w.value}catch(I){return void l(I)}w.done?s(S):Promise.resolve(S).then(c,h)}function o(n){return function(){var s=this,l=arguments;return new Promise(function(c,h){var f=n.apply(s,l);function _(S){i(f,c,h,_,w,"next",S)}function w(S){i(f,c,h,_,w,"throw",S)}_(void 0)})}}function a(n,s,l){return s in n?Object.defineProperty(n,s,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[s]=l,n}function u(n,s){if(n==null)return{};var l,c,h=function(_,w){if(_==null)return{};var S,I,E={},F=Object.keys(_);for(I=0;I<F.length;I++)S=F[I],w.indexOf(S)>=0||(E[S]=_[S]);return E}(n,s);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(n);for(c=0;c<f.length;c++)l=f[c],s.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(n,l)&&(h[l]=n[l])}return h}var d,p=["type"],m=Object.defineProperty,g=(n,s,l)=>((c,h,f)=>h in c?m(c,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[h]=f)(n,typeof s!="symbol"?s+"":s,l),v=Object.defineProperty,b=(n,s,l)=>((c,h,f)=>h in c?v(c,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[h]=f)(n,typeof s!="symbol"?s+"":s,l),y=(n=>(n[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment",n))(y||{}),k={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},R={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},W=n=>!!(s=>typeof s=="function")(n)&&Object.getOwnPropertyNames(n.prototype||{}).some(s=>s.indexOf("__zone")),B={};function q(n){if(B[n])return B[n];var s=globalThis[n],l=s.prototype,c=n in k?k[n]:void 0,h=!!(c&&c.every(E=>{var F,Z;return!!((Z=(F=Object.getOwnPropertyDescriptor(l,E))==null?void 0:F.get)!=null&&Z.toString().includes("[native code]"))})),f=n in R?R[n]:void 0,_=!!(f&&f.every(E=>{var F;return typeof l[E]=="function"&&((F=l[E])==null?void 0:F.toString().includes("[native code]"))}));if(h&&_&&!W(s))return B[n]=s.prototype,s.prototype;try{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow;if(!S)return s.prototype;var I=S[n].prototype;return document.body.removeChild(w),I?B[n]=I:l}catch{return l}}var le={};function ue(n,s,l){var c,h="".concat(n,".").concat(String(l));if(le[h])return le[h].call(s);var f=q(n),_=(c=Object.getOwnPropertyDescriptor(f,l))==null?void 0:c.get;return _?(le[h]=_,_.call(s)):s[l]}var Ee={};function Ge(n,s,l){var c="".concat(n,".").concat(String(l));if(Ee[c])return Ee[c].bind(s);var h=q(n)[l];return typeof h!="function"?s[l]:(Ee[c]=h,h.bind(s))}var we={childNodes:function(n){return ue("Node",n,"childNodes")},parentNode:function(n){return ue("Node",n,"parentNode")},parentElement:function(n){return ue("Node",n,"parentElement")},textContent:function(n){return ue("Node",n,"textContent")},contains:function(n,s){return Ge("Node",n,"contains")(s)},getRootNode:function(n){return Ge("Node",n,"getRootNode")()},host:function(n){return n&&"host"in n?ue("ShadowRoot",n,"host"):null},styleSheets:function(n){return n.styleSheets},shadowRoot:function(n){return n&&"shadowRoot"in n?ue("Element",n,"shadowRoot"):null},querySelector:function(n,s){return ue("Element",n,"querySelector")(s)},querySelectorAll:function(n,s){return ue("Element",n,"querySelectorAll")(s)},mutationObserver:function(){return q("MutationObserver").constructor}};function _e(n){return n.nodeType===n.ELEMENT_NODE}function Ne(n){var s=n&&"host"in n&&"mode"in n&&we.host(n)||null;return!!(s&&"shadowRoot"in s&&we.shadowRoot(s)===n)}function qe(n){return Object.prototype.toString.call(n)==="[object ShadowRoot]"}function Ze(n){try{var s=n.rules||n.cssRules;if(!s)return null;var l=Array.from(s,h=>st(h,n.href)).join("");return(c=l).includes(" background-clip: text;")&&!c.includes(" -webkit-background-clip: text;")&&(c=c.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),c}catch{return null}var c}function st(n,s){if(function(f){return"styleSheet"in f}(n)){var l;try{l=Ze(n.styleSheet)||function(f){var{cssText:_}=f;if(_.split('"').length<3)return _;var w=["@import","url(".concat(JSON.stringify(f.href),")")];return f.layerName===""?w.push("layer"):f.layerName&&w.push("layer(".concat(f.layerName,")")),f.supportsText&&w.push("supports(".concat(f.supportsText,")")),f.media.length&&w.push(f.media.mediaText),w.join(" ")+";"}(n)}catch{l=n.cssText}return n.styleSheet.href?ze(l,n.styleSheet.href):l}var c,h=n.cssText;return function(f){return"selectorText"in f}(n)&&n.selectorText.includes(":")&&(c=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,h=h.replace(c,"$1\\$2")),s?ze(h,s):h}function It(n,s){return Array.from(n.styleSheets).find(l=>l.href===s)}let _t=class{constructor(){b(this,"idNodeMap",new Map),b(this,"nodeMetaMap",new WeakMap)}getId(n){var s;if(!n)return-1;var l=(s=this.getMeta(n))==null?void 0:s.id;return l??-1}getNode(n){return this.idNodeMap.get(n)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(n){return this.nodeMetaMap.get(n)||null}removeNodeFromMap(n){var s=this.getId(n);this.idNodeMap.delete(s),n.childNodes&&n.childNodes.forEach(l=>this.removeNodeFromMap(l))}has(n){return this.idNodeMap.has(n)}hasNode(n){return this.nodeMetaMap.has(n)}add(n,s){var l=s.id;this.idNodeMap.set(l,n),this.nodeMetaMap.set(n,s)}replace(n,s){var l=this.getNode(n);if(l){var c=this.nodeMetaMap.get(l);c&&this.nodeMetaMap.set(s,c)}this.idNodeMap.set(n,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function lt(n){var{element:s,maskInputOptions:l,tagName:c,type:h,value:f,maskInputFn:_}=n,w=f||"",S=h&&ht(h);return(l[c.toLowerCase()]||S&&l[S])&&(w=_?_(w,s):"*".repeat(w.length)),w}function ht(n){return n.toLowerCase()}var kt="__rrweb_original__";function Tt(n){var s=n.type;return n.hasAttribute("data-rr-is-password")?"password":s?ht(s):null}function pt(n,s){var l,c;try{c=new URL(n,s??window.location.href)}catch{return null}var h=c.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(l=h==null?void 0:h[1])!==null&&l!==void 0?l:null}var yt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zt=/^(?:[a-z+]+:)?\/\//i,Qe=/^www\..*/i,Ve=/^(data:)([^,]*),(.*)/i;function ze(n,s){return(n||"").replace(yt,(l,c,h,f,_,w)=>{var S,I=h||_||w,E=c||f||"";if(!I)return l;if(zt.test(I)||Qe.test(I)||Ve.test(I))return"url(".concat(E).concat(I).concat(E,")");if(I[0]==="/")return"url(".concat(E).concat((S=s,(S.indexOf("//")>-1?S.split("/").slice(0,3).join("/"):S.split("/")[0]).split("?")[0]+I)).concat(E,")");var F=s.split("/"),Z=I.split("/");for(var H of(F.pop(),Z))H!=="."&&(H===".."?F.pop():F.push(H));return"url(".concat(E).concat(F.join("/")).concat(E,")")})}var ot,Rt,er=1,Dr=new RegExp("[^a-z0-9-_:]"),jt=-2;function M(){return er++}var T=/^[^ \t\n\r\u000c]+/,L=/^[, \t\n\r\u000c]+/,U=new WeakMap;function de(n,s){return s&&s.trim()!==""?Fe(n,s):s}function Se(n){return!!(n.tagName==="svg"||n.ownerSVGElement)}function Fe(n,s){var l=U.get(n);if(l||(l=n.createElement("a"),U.set(n,l)),s){if(s.startsWith("blob:")||s.startsWith("data:"))return s}else s="";return l.setAttribute("href",s),l.href}function Ue(n,s,l,c){return c&&(l==="src"||l==="href"&&(s!=="use"||c[0]!=="#")||l==="xlink:href"&&c[0]!=="#"?de(n,c):l!=="background"||s!=="table"&&s!=="td"&&s!=="th"?l==="srcset"?function(h,f){if(f.trim()==="")return f;var _=0;function w(H){var ie,he=H.exec(f.substring(_));return he?(ie=he[0],_+=ie.length,ie):""}for(var S=[];w(L),!(_>=f.length);){var I=w(T);if(I.slice(-1)===",")I=de(h,I.substring(0,I.length-1)),S.push(I);else{var E="";I=de(h,I);for(var F=!1;;){var Z=f.charAt(_);if(Z===""){S.push((I+E).trim());break}if(F)Z===")"&&(F=!1);else{if(Z===","){_+=1,S.push((I+E).trim());break}Z==="("&&(F=!0)}E+=Z,_+=1}}}return S.join(", ")}(n,c):l==="style"?ze(c,Fe(n)):s==="object"&&l==="data"?de(n,c):c:de(n,c))}function Le(n,s,l){return(n==="video"||n==="audio")&&s==="autoplay"}function rt(n,s,l){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return!!l&&rt(we.parentNode(n),s,l);for(var c=n.classList.length;c--;){var h=n.classList[c];if(s.test(h))return!0}return!!l&&rt(we.parentNode(n),s,l)}function Pt(n,s,l,c){var h;if(_e(n)){if(h=n,!we.childNodes(h).length)return!1}else{if(we.parentElement(n)===null)return!1;h=we.parentElement(n)}try{if(typeof s=="string"){if(c){if(h.closest(".".concat(s)))return!0}else if(h.classList.contains(s))return!0}else if(rt(h,s,c))return!0;if(l){if(c){if(h.closest(l))return!0}else if(h.matches(l))return!0}}catch{}return!1}function Yt(n,s){var{doc:l,mirror:c,blockClass:h,blockSelector:f,needsMask:_,inlineStylesheet:w,maskInputOptions:S={},maskTextFn:I,maskInputFn:E,dataURLOptions:F={},inlineImages:Z,recordCanvas:H,keepIframeSrcFn:ie,newlyAddedElement:he=!1}=s,oe=function(P,N){if(N.hasNode(P)){var A=N.getId(P);return A===1?void 0:A}}(l,c);switch(n.nodeType){case n.DOCUMENT_NODE:return n.compatMode!=="CSS1Compat"?{type:y.Document,childNodes:[],compatMode:n.compatMode}:{type:y.Document,childNodes:[]};case n.DOCUMENT_TYPE_NODE:return{type:y.DocumentType,name:n.name,publicId:n.publicId,systemId:n.systemId,rootId:oe};case n.ELEMENT_NODE:return function(P,N){for(var A,{doc:j,blockClass:X,blockSelector:K,inlineStylesheet:Q,maskInputOptions:re={},maskInputFn:ce,dataURLOptions:ge={},inlineImages:Ie,recordCanvas:z,keepIframeSrcFn:Ce,newlyAddedElement:ve=!1,rootId:me}=N,fe=function(Oe,Bt,rr){try{if(typeof Bt=="string"){if(Oe.classList.contains(Bt))return!0}else for(var nr=Oe.classList.length;nr--;){var gr=Oe.classList[nr];if(Bt.test(gr))return!0}if(rr)return Oe.matches(rr)}catch{}return!1}(P,X,K),ae=function(Oe){if(Oe instanceof HTMLFormElement)return"form";var Bt=ht(Oe.tagName);return Dr.test(Bt)?"div":Bt}(P),se={},Be=P.attributes.length,He=0;He<Be;He++){var xe=P.attributes[He];Le(ae,xe.name,xe.value)||(se[xe.name]=Ue(j,ae,ht(xe.name),xe.value))}if(ae==="link"&&Q){var V=P.href,Te=It(j,V);!Te&&V.includes(".css")&&(Te=It(j,window.location.origin+"/"+V.replace(window.location.href,"")));var At=null;Te&&(At=Ze(Te)),At&&(delete se.rel,delete se.href,se._cssText=At)}if(ae==="style"&&P.sheet&&!(P.innerText||we.textContent(P)||"").trim().length){var ft=Ze(P.sheet);ft&&(se._cssText=ft)}if(ae==="input"||ae==="textarea"||ae==="select"){var et=P.value,vt=P.checked;se.type!=="radio"&&se.type!=="checkbox"&&se.type!=="submit"&&se.type!=="button"&&et?se.value=lt({element:P,type:Tt(P),tagName:ae,value:et,maskInputOptions:re,maskInputFn:ce}):vt&&(se.checked=vt)}if(ae==="option"&&(P.selected&&!re.select?se.selected=!0:delete se.selected),ae==="dialog"&&P.open&&(se.rr_open_mode=P.matches("dialog:modal")?"modal":"non-modal"),ae==="canvas"&&z){if(P.__context==="2d")(function(Oe){var Bt=Oe.getContext("2d");if(!Bt)return!0;for(var rr=0;rr<Oe.width;rr+=50)for(var nr=0;nr<Oe.height;nr+=50){var gr=Bt.getImageData,ni=kt in gr?gr[kt]:gr;if(new Uint32Array(ni.call(Bt,rr,nr,Math.min(50,Oe.width-rr),Math.min(50,Oe.height-nr)).data.buffer).some(us=>us!==0))return!1}return!0})(P)||(se.rr_dataURL=P.toDataURL(ge.type,ge.quality));else if(!("__context"in P)){var qt=P.toDataURL(ge.type,ge.quality),Xt=j.createElement("canvas");Xt.width=P.width,Xt.height=P.height,qt!==Xt.toDataURL(ge.type,ge.quality)&&(se.rr_dataURL=qt)}}if(ae==="img"&&Ie){ot||(ot=j.createElement("canvas"),Rt=ot.getContext("2d"));var tt=P,Wr=tt.currentSrc||tt.getAttribute("src")||"<unknown-src>",Sn=tt.crossOrigin,pr=()=>{tt.removeEventListener("load",pr);try{ot.width=tt.naturalWidth,ot.height=tt.naturalHeight,Rt.drawImage(tt,0,0),se.rr_dataURL=ot.toDataURL(ge.type,ge.quality)}catch(Oe){if(tt.crossOrigin!=="anonymous")return tt.crossOrigin="anonymous",void(tt.complete&&tt.naturalWidth!==0?pr():tt.addEventListener("load",pr));console.warn("Cannot inline img src=".concat(Wr,"! Error: ").concat(Oe))}tt.crossOrigin==="anonymous"&&(Sn?se.crossOrigin=Sn:tt.removeAttribute("crossorigin"))};tt.complete&&tt.naturalWidth!==0?pr():tt.addEventListener("load",pr)}if(ae==="audio"||ae==="video"){var Re=se;Re.rr_mediaState=P.paused?"paused":"played",Re.rr_mediaCurrentTime=P.currentTime,Re.rr_mediaPlaybackRate=P.playbackRate,Re.rr_mediaMuted=P.muted,Re.rr_mediaLoop=P.loop,Re.rr_mediaVolume=P.volume}if(ve||(P.scrollLeft&&(se.rr_scrollLeft=P.scrollLeft),P.scrollTop&&(se.rr_scrollTop=P.scrollTop)),fe){var{width:Ot,height:be}=P.getBoundingClientRect();se={class:se.class,rr_width:"".concat(Ot,"px"),rr_height:"".concat(be,"px")}}ae!=="iframe"||Ce(se.src)||(P.contentDocument||(se.rr_src=se.src),delete se.src);try{customElements.get(ae)&&(A=!0)}catch{}return{type:y.Element,tagName:ae,attributes:se,childNodes:[],isSVG:Se(P)||void 0,needBlock:fe,rootId:me,isCustom:A}}(n,{doc:l,blockClass:h,blockSelector:f,inlineStylesheet:w,maskInputOptions:S,maskInputFn:E,dataURLOptions:F,inlineImages:Z,recordCanvas:H,keepIframeSrcFn:ie,newlyAddedElement:he,rootId:oe});case n.TEXT_NODE:return function(P,N){var A,{needsMask:j,maskTextFn:X,rootId:K}=N,Q=we.parentNode(P),re=Q&&Q.tagName,ce=we.textContent(P),ge=re==="STYLE"||void 0,Ie=re==="SCRIPT"||void 0;if(ge&&ce){try{P.nextSibling||P.previousSibling||(A=Q.sheet)!=null&&A.cssRules&&(ce=Ze(Q.sheet))}catch(z){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(z),P)}ce=ze(ce,Fe(N.doc))}return Ie&&(ce="SCRIPT_PLACEHOLDER"),!ge&&!Ie&&ce&&j&&(ce=X?X(ce,we.parentElement(P)):ce.replace(/[\S]/g,"*")),{type:y.Text,textContent:ce||"",isStyle:ge,rootId:K}}(n,{doc:l,needsMask:_,maskTextFn:I,rootId:oe});case n.CDATA_SECTION_NODE:return{type:y.CDATA,textContent:"",rootId:oe};case n.COMMENT_NODE:return{type:y.Comment,textContent:we.textContent(n)||"",rootId:oe};default:return!1}}function ye(n){return n==null?"":n.toLowerCase()}function at(n,s){var{doc:l,mirror:c,blockClass:h,blockSelector:f,maskTextClass:_,maskTextSelector:w,skipChild:S=!1,inlineStylesheet:I=!0,maskInputOptions:E={},maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:ie={},inlineImages:he=!1,recordCanvas:oe=!1,onSerialize:P,onIframeLoad:N,iframeLoadTimeout:A=5e3,onStylesheetLoad:j,stylesheetLoadTimeout:X=5e3,keepIframeSrcFn:K=()=>!1,newlyAddedElement:Q=!1}=s,{needsMask:re}=s,{preserveWhiteSpace:ce=!0}=s;re||(re=Pt(n,_,w,re===void 0));var ge,Ie=Yt(n,{doc:l,mirror:c,blockClass:h,blockSelector:f,needsMask:re,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,dataURLOptions:ie,inlineImages:he,recordCanvas:oe,keepIframeSrcFn:K,newlyAddedElement:Q});if(!Ie)return console.warn(n,"not serialized"),null;ge=c.hasNode(n)?c.getId(n):!function(V,Te){return!!(Te.comment&&V.type===y.Comment||V.type===y.Element&&(Te.script&&(V.tagName==="script"||V.tagName==="link"&&(V.attributes.rel==="preload"||V.attributes.rel==="modulepreload")&&V.attributes.as==="script"||V.tagName==="link"&&V.attributes.rel==="prefetch"&&typeof V.attributes.href=="string"&&pt(V.attributes.href)==="js")||Te.headFavicon&&(V.tagName==="link"&&V.attributes.rel==="shortcut icon"||V.tagName==="meta"&&(ye(V.attributes.name).match(/^msapplication-tile(image|color)$/)||ye(V.attributes.name)==="application-name"||ye(V.attributes.rel)==="icon"||ye(V.attributes.rel)==="apple-touch-icon"||ye(V.attributes.rel)==="shortcut icon"))||V.tagName==="meta"&&(Te.headMetaDescKeywords&&ye(V.attributes.name).match(/^description|keywords$/)||Te.headMetaSocial&&(ye(V.attributes.property).match(/^(og|twitter|fb):/)||ye(V.attributes.name).match(/^(og|twitter):/)||ye(V.attributes.name)==="pinterest")||Te.headMetaRobots&&(ye(V.attributes.name)==="robots"||ye(V.attributes.name)==="googlebot"||ye(V.attributes.name)==="bingbot")||Te.headMetaHttpEquiv&&V.attributes["http-equiv"]!==void 0||Te.headMetaAuthorship&&(ye(V.attributes.name)==="author"||ye(V.attributes.name)==="generator"||ye(V.attributes.name)==="framework"||ye(V.attributes.name)==="publisher"||ye(V.attributes.name)==="progid"||ye(V.attributes.property).match(/^article:/)||ye(V.attributes.property).match(/^product:/))||Te.headMetaVerification&&(ye(V.attributes.name)==="google-site-verification"||ye(V.attributes.name)==="yandex-verification"||ye(V.attributes.name)==="csrf-token"||ye(V.attributes.name)==="p:domain_verify"||ye(V.attributes.name)==="verify-v1"||ye(V.attributes.name)==="verification"||ye(V.attributes.name)==="shopify-checkout-api-token"))))}(Ie,H)&&(ce||Ie.type!==y.Text||Ie.isStyle||Ie.textContent.replace(/^\s+|\s+$/gm,"").length)?M():jt;var z=Object.assign(Ie,{id:ge});if(c.add(n,z),ge===jt)return null;P&&P(n);var Ce=!S;if(z.type===y.Element){Ce=Ce&&!z.needBlock,delete z.needBlock;var ve=we.shadowRoot(n);ve&&qe(ve)&&(z.isShadowHost=!0)}if((z.type===y.Document||z.type===y.Element)&&Ce){H.headWhitespace&&z.type===y.Element&&z.tagName==="head"&&(ce=!1);var me={doc:l,mirror:c,blockClass:h,blockSelector:f,needsMask:re,maskTextClass:_,maskTextSelector:w,skipChild:S,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:ie,inlineImages:he,recordCanvas:oe,preserveWhiteSpace:ce,onSerialize:P,onIframeLoad:N,iframeLoadTimeout:A,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:K};if(!(z.type===y.Element&&z.tagName==="textarea"&&z.attributes.value!==void 0))for(var fe of Array.from(we.childNodes(n))){var ae=at(fe,me);ae&&z.childNodes.push(ae)}var se=null;if(_e(n)&&(se=we.shadowRoot(n)))for(var Be of Array.from(we.childNodes(se))){var He=at(Be,me);He&&(qe(se)&&(He.isShadow=!0),z.childNodes.push(He))}}var xe=we.parentNode(n);return xe&&Ne(xe)&&qe(xe)&&(z.isShadow=!0),z.type===y.Element&&z.tagName==="iframe"&&function(V,Te,At){var ft=V.contentWindow;if(ft){var et,vt=!1;try{et=ft.document.readyState}catch{return}if(et==="complete"){var qt="about:blank";if(ft.location.href!==qt||V.src===qt||V.src==="")return setTimeout(Te,0),V.addEventListener("load",Te);V.addEventListener("load",Te)}else{var Xt=setTimeout(()=>{vt||(Te(),vt=!0)},At);V.addEventListener("load",()=>{clearTimeout(Xt),vt=!0,Te()})}}}(n,()=>{var V=n.contentDocument;if(V&&N){var Te=at(V,{doc:V,mirror:c,blockClass:h,blockSelector:f,needsMask:re,maskTextClass:_,maskTextSelector:w,skipChild:!1,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:ie,inlineImages:he,recordCanvas:oe,preserveWhiteSpace:ce,onSerialize:P,onIframeLoad:N,iframeLoadTimeout:A,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:K});Te&&N(n,Te)}},A),z.type===y.Element&&z.tagName==="link"&&typeof z.attributes.rel=="string"&&(z.attributes.rel==="stylesheet"||z.attributes.rel==="preload"&&typeof z.attributes.href=="string"&&pt(z.attributes.href)==="css")&&function(V,Te,At){var ft,et=!1;try{ft=V.sheet}catch{return}if(!ft){var vt=setTimeout(()=>{et||(Te(),et=!0)},At);V.addEventListener("load",()=>{clearTimeout(vt),et=!0,Te()})}}(n,()=>{if(j){var V=at(n,{doc:l,mirror:c,blockClass:h,blockSelector:f,needsMask:re,maskTextClass:_,maskTextSelector:w,skipChild:!1,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:ie,inlineImages:he,recordCanvas:oe,preserveWhiteSpace:ce,onSerialize:P,onIframeLoad:N,iframeLoadTimeout:A,onStylesheetLoad:j,stylesheetLoadTimeout:X,keepIframeSrcFn:K});V&&j(n,V)}},X),z}let gt=class hl{constructor(){__publicField2(this,"parentElement",null),__publicField2(this,"parentNode",null),__publicField2(this,"ownerDocument"),__publicField2(this,"firstChild",null),__publicField2(this,"lastChild",null),__publicField2(this,"previousSibling",null),__publicField2(this,"nextSibling",null),__publicField2(this,"ELEMENT_NODE",1),__publicField2(this,"TEXT_NODE",3),__publicField2(this,"nodeType"),__publicField2(this,"nodeName"),__publicField2(this,"RRNodeType")}get childNodes(){for(var s=[],l=this.firstChild;l;)s.push(l),l=l.nextSibling;return s}contains(s){if(!(s instanceof hl)||s.ownerDocument!==this.ownerDocument)return!1;if(s===this)return!0;for(;s.parentNode;){if(s.parentNode===this)return!0;s=s.parentNode}return!1}appendChild(s){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(s,l){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(s){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var bt={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},x={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},D={};function Y(n){if(D[n])return D[n];var s=globalThis[n],l=s.prototype,c=n in bt?bt[n]:void 0,h=!!(c&&c.every(E=>{var F,Z;return!!((Z=(F=Object.getOwnPropertyDescriptor(l,E))==null?void 0:F.get)!=null&&Z.toString().includes("[native code]"))})),f=n in x?x[n]:void 0,_=!!(f&&f.every(E=>{var F;return typeof l[E]=="function"&&((F=l[E])==null?void 0:F.toString().includes("[native code]"))}));if(h&&_&&!W(s))return D[n]=s.prototype,s.prototype;try{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow;if(!S)return s.prototype;var I=S[n].prototype;return document.body.removeChild(w),I?D[n]=I:l}catch{return l}}var ee={};function $(n,s,l){var c,h="".concat(n,".").concat(String(l));if(ee[h])return ee[h].call(s);var f=Y(n),_=(c=Object.getOwnPropertyDescriptor(f,l))==null?void 0:c.get;return _?(ee[h]=_,_.call(s)):s[l]}var ke={};function Ye(n,s,l){var c="".concat(n,".").concat(String(l));if(ke[c])return ke[c].bind(s);var h=Y(n)[l];return typeof h!="function"?s[l]:(ke[c]=h,h.bind(s))}function $e(){return Y("MutationObserver").constructor}var te={childNodes:function(n){return $("Node",n,"childNodes")},parentNode:function(n){return $("Node",n,"parentNode")},parentElement:function(n){return $("Node",n,"parentElement")},textContent:function(n){return $("Node",n,"textContent")},contains:function(n,s){return Ye("Node",n,"contains")(s)},getRootNode:function(n){return Ye("Node",n,"getRootNode")()},host:function(n){return n&&"host"in n?$("ShadowRoot",n,"host"):null},styleSheets:function(n){return n.styleSheets},shadowRoot:function(n){return n&&"shadowRoot"in n?$("Element",n,"shadowRoot"):null},querySelector:function(n,s){return $("Element",n,"querySelector")(s)},querySelectorAll:function(n,s){return $("Element",n,"querySelectorAll")(s)},mutationObserver:$e};function Me(n,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:document,c={capture:!0,passive:!0};return l.addEventListener(n,s,c),()=>l.removeEventListener(n,s,c)}var Gt=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`,ar={map:{},getId:()=>(console.error(Gt),-1),getNode:()=>(console.error(Gt),null),removeNodeFromMap(){console.error(Gt)},has:()=>(console.error(Gt),!1),reset(){console.error(Gt)}};function Sr(n,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=null,h=0;return function(){for(var f=arguments.length,_=new Array(f),w=0;w<f;w++)_[w]=arguments[w];var S=Date.now();h||l.leading!==!1||(h=S);var I=s-(S-h),E=this;I<=0||I>s?(c&&(clearTimeout(c),c=null),h=S,n.apply(E,_)):c||l.trailing===!1||(c=setTimeout(()=>{h=l.leading===!1?0:Date.now(),c=null,n.apply(E,_)},I))}}function Xr(n,s,l,c){var h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:window,f=h.Object.getOwnPropertyDescriptor(n,s);return h.Object.defineProperty(n,s,c?l:{set(_){setTimeout(()=>{l.set.call(this,_)},0),f&&f.set&&f.set.call(this,_)}}),()=>Xr(n,s,f||{},!0)}function ur(n,s,l){try{if(!(s in n))return()=>{};var c=n[s],h=l(c);return typeof h=="function"&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:c}})),n[s]=h,()=>{n[s]=c}}catch{return()=>{}}}typeof window<"u"&&window.Proxy&&window.Reflect&&(ar=new Proxy(ar,{get:(n,s,l)=>(s==="map"&&console.error(Gt),Reflect.get(n,s,l))}));var Jr=Date.now;function cr(n){var s,l,c,h,f=n.document;return{left:f.scrollingElement?f.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:f.documentElement.scrollLeft||(f==null?void 0:f.body)&&((s=te.parentElement(f.body))==null?void 0:s.scrollLeft)||((l=f==null?void 0:f.body)==null?void 0:l.scrollLeft)||0,top:f.scrollingElement?f.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(f==null?void 0:f.documentElement.scrollTop)||(f==null?void 0:f.body)&&((c=te.parentElement(f.body))==null?void 0:c.scrollTop)||((h=f==null?void 0:f.body)==null?void 0:h.scrollTop)||0}}function Wn(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function oo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ao(n){return n?n.nodeType===n.ELEMENT_NODE?n:te.parentElement(n):null}function Mt(n,s,l,c){if(!n)return!1;var h=ao(n);if(!h)return!1;try{if(typeof s=="string"){if(h.classList.contains(s)||c&&h.closest("."+s)!==null)return!0}else if(rt(h,s,c))return!0}catch{}return!!(l&&(h.matches(l)||c&&h.closest(l)!==null))}function Pi(n,s,l){return!(n.tagName!=="TITLE"||!l.headTitleMutations)||s.getId(n)===jt}function lo(n,s){if(Ne(n))return!1;var l=s.getId(n);if(!s.has(l))return!0;var c=te.parentNode(n);return(!c||c.nodeType!==n.DOCUMENT_NODE)&&(!c||lo(c,s))}function Li(n){return!!n.changedTouches}function uo(n,s){return!!(n.nodeName==="IFRAME"&&s.getMeta(n))}function co(n,s){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&s.getMeta(n))}function Di(n){return!!n&&(n instanceof gt&&"shadowRoot"in n?!!n.shadowRoot:!!te.shadowRoot(n))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Jr=()=>new Date().getTime());let vu=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(n){var s;return(s=this.styleIDMap.get(n))!==null&&s!==void 0?s:-1}has(n){return this.styleIDMap.has(n)}add(n,s){return this.has(n)?this.getId(n):(l=s===void 0?this.id++:s,this.styleIDMap.set(n,l),this.idStyleMap.set(l,n),l);var l}getStyle(n){return this.idStyleMap.get(n)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function ho(n){var s,l=null;return"getRootNode"in n&&((s=te.getRootNode(n))==null?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&te.host(te.getRootNode(n))&&(l=te.host(te.getRootNode(n))),l}function mu(n){var s=n.ownerDocument;if(!s)return!1;var l=function(c){for(var h,f=c;h=ho(f);)f=h;return f}(n);return te.contains(s,l)}function po(n){var s=n.ownerDocument;return!!s&&(te.contains(s,n)||mu(n))}var je=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(je||{}),De=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(De||{}),Lt=(n=>(n[n.MouseUp=0]="MouseUp",n[n.MouseDown=1]="MouseDown",n[n.Click=2]="Click",n[n.ContextMenu=3]="ContextMenu",n[n.DblClick=4]="DblClick",n[n.Focus=5]="Focus",n[n.Blur=6]="Blur",n[n.TouchStart=7]="TouchStart",n[n.TouchMove_Departed=8]="TouchMove_Departed",n[n.TouchEnd=9]="TouchEnd",n[n.TouchCancel=10]="TouchCancel",n))(Lt||{}),dr=(n=>(n[n.Mouse=0]="Mouse",n[n.Pen=1]="Pen",n[n.Touch=2]="Touch",n))(dr||{}),Kr=(n=>(n[n["2D"]=0]="2D",n[n.WebGL=1]="WebGL",n[n.WebGL2=2]="WebGL2",n))(Kr||{}),Qr=(n=>(n[n.Play=0]="Play",n[n.Pause=1]="Pause",n[n.Seeked=2]="Seeked",n[n.VolumeChange=3]="VolumeChange",n[n.RateChange=4]="RateChange",n))(Qr||{});function go(n){return"__ln"in n}class _u{constructor(){g(this,"length",0),g(this,"head",null),g(this,"tail",null)}get(s){if(s>=this.length)throw new Error("Position outside of list range");for(var l=this.head,c=0;c<s;c++)l=(l==null?void 0:l.next)||null;return l}addNode(s){var l={value:s,previous:null,next:null};if(s.__ln=l,s.previousSibling&&go(s.previousSibling)){var c=s.previousSibling.__ln.next;l.next=c,l.previous=s.previousSibling.__ln,s.previousSibling.__ln.next=l,c&&(c.previous=l)}else if(s.nextSibling&&go(s.nextSibling)&&s.nextSibling.__ln.previous){var h=s.nextSibling.__ln.previous;l.previous=h,l.next=s.nextSibling.__ln,s.nextSibling.__ln.previous=l,h&&(h.next=l)}else this.head&&(this.head.previous=l),l.next=this.head,this.head=l;l.next===null&&(this.tail=l),this.length++}removeNode(s){var l=s.__ln;this.head&&(l.previous?(l.previous.next=l.next,l.next?l.next.previous=l.previous:this.tail=l.previous):(this.head=l.next,this.head?this.head.previous=null:this.tail=null),s.__ln&&delete s.__ln,this.length--)}}var yn,fo=(n,s)=>"".concat(n,"@").concat(s);class yu{constructor(){g(this,"frozen",!1),g(this,"locked",!1),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",s=>{s.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(!this.frozen&&!this.locked){for(var s=[],l=new Set,c=new _u,h=A=>{for(var j=A,X=jt;X===jt;)X=(j=j&&j.nextSibling)&&this.mirror.getId(j);return X},f=A=>{var j=te.parentNode(A);if(j&&po(A)&&j.tagName!=="TEXTAREA"){var X=Ne(j)?this.mirror.getId(ho(A)):this.mirror.getId(j),K=h(A);if(X===-1||K===-1)return c.addNode(A);var Q=at(A,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:re=>{uo(re,this.mirror)&&this.iframeManager.addIframe(re),co(re,this.mirror)&&this.stylesheetManager.trackLinkElement(re),Di(A)&&this.shadowDomManager.addShadowRoot(te.shadowRoot(A),this.doc)},onIframeLoad:(re,ce)=>{this.iframeManager.attachIframe(re,ce),this.shadowDomManager.observeAttachShadow(re)},onStylesheetLoad:(re,ce)=>{this.stylesheetManager.attachLinkElement(re,ce)}});Q&&(s.push({parentId:X,nextId:K,node:Q}),l.add(Q.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var _ of this.movedSet)vo(this.removes,_,this.mirror)&&!this.movedSet.has(te.parentNode(_))||f(_);for(var w of this.addedSet)mo(this.droppedSet,w)||vo(this.removes,w,this.mirror)?mo(this.movedSet,w)?f(w):this.droppedSet.add(w):f(w);for(var S=null;c.length;){var I=null;if(S){var E=this.mirror.getId(te.parentNode(S.value)),F=h(S.value);E!==-1&&F!==-1&&(I=S)}if(!I)for(var Z=c.tail;Z;){var H=Z;if(Z=Z.previous,H){var ie=this.mirror.getId(te.parentNode(H.value));if(h(H.value)===-1)continue;if(ie!==-1){I=H;break}var he=H.value,oe=te.parentNode(he);if(oe&&oe.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var P=te.host(oe);if(this.mirror.getId(P)!==-1){I=H;break}}}}if(!I){for(;c.head;)c.removeNode(c.head.value);break}S=I.previous,c.removeNode(I.value),f(I.value)}var N={texts:this.texts.map(A=>{var j=A.node,X=te.parentNode(j);return X&&X.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(X),{id:this.mirror.getId(j),value:A.value}}).filter(A=>!l.has(A.id)).filter(A=>this.mirror.has(A.id)),attributes:this.attributes.map(A=>{var{attributes:j}=A;if(typeof j.style=="string"){var X=JSON.stringify(A.styleDiff),K=JSON.stringify(A._unchangedStyles);X.length<j.style.length&&(X+K).split("var(").length===j.style.split("var(").length&&(j.style=A.styleDiff)}return{id:this.mirror.getId(A.node),attributes:j}}).filter(A=>!l.has(A.id)).filter(A=>this.mirror.has(A.id)),removes:this.removes,adds:s};(N.texts.length||N.attributes.length||N.removes.length||N.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(N))}}),g(this,"genTextAreaValueMutation",s=>{var l=this.attributeMap.get(s);l||(l={node:s,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(l),this.attributeMap.set(s,l)),l.attributes.value=Array.from(te.childNodes(s),c=>te.textContent(c)||"").join("")}),g(this,"processMutation",s=>{if(!Pi(s.target,this.mirror,this.slimDOMOptions))switch(s.type){case"characterData":var l=te.textContent(s.target);Mt(s.target,this.blockClass,this.blockSelector,!1)||l===s.oldValue||this.texts.push({value:Pt(s.target,this.maskTextClass,this.maskTextSelector,!0)&&l?this.maskTextFn?this.maskTextFn(l,ao(s.target)):l.replace(/[\S]/g,"*"):l,node:s.target});break;case"attributes":var c=s.target,h=s.attributeName,f=s.target.getAttribute(h);if(h==="value"){var _=Tt(c);f=lt({element:c,maskInputOptions:this.maskInputOptions,tagName:c.tagName,type:_,value:f,maskInputFn:this.maskInputFn})}if(Mt(s.target,this.blockClass,this.blockSelector,!1)||f===s.oldValue)return;var w=this.attributeMap.get(s.target);if(c.tagName==="IFRAME"&&h==="src"&&!this.keepIframeSrcFn(f)){if(c.contentDocument)return;h="rr_src"}if(w||(w={node:s.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(w),this.attributeMap.set(s.target,w)),h==="type"&&c.tagName==="INPUT"&&(s.oldValue||"").toLowerCase()==="password"&&c.setAttribute("data-rr-is-password","true"),!Le(c.tagName,h))if(w.attributes[h]=Ue(this.doc,ht(c.tagName),ht(h),f),h==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}var S=this.unattachedDoc.createElement("span");for(var I of(s.oldValue&&S.setAttribute("style",s.oldValue),Array.from(c.style))){var E=c.style.getPropertyValue(I),F=c.style.getPropertyPriority(I);E!==S.style.getPropertyValue(I)||F!==S.style.getPropertyPriority(I)?w.styleDiff[I]=F===""?E:[E,F]:w._unchangedStyles[I]=[E,F]}for(var Z of Array.from(S.style))c.style.getPropertyValue(Z)===""&&(w.styleDiff[Z]=!1)}else h==="open"&&c.tagName==="DIALOG"&&(c.matches("dialog:modal")?w.attributes.rr_open_mode="modal":w.attributes.rr_open_mode="non-modal");break;case"childList":if(Mt(s.target,this.blockClass,this.blockSelector,!0))return;if(s.target.tagName==="TEXTAREA")return void this.genTextAreaValueMutation(s.target);s.addedNodes.forEach(H=>this.genAdds(H,s.target)),s.removedNodes.forEach(H=>{var ie=this.mirror.getId(H),he=Ne(s.target)?this.mirror.getId(te.host(s.target)):this.mirror.getId(s.target);Mt(s.target,this.blockClass,this.blockSelector,!1)||Pi(H,this.mirror,this.slimDOMOptions)||!function(oe,P){return P.getId(oe)!==-1}(H,this.mirror)||(this.addedSet.has(H)?(Bi(this.addedSet,H),this.droppedSet.add(H)):this.addedSet.has(s.target)&&ie===-1||lo(s.target,this.mirror)||(this.movedSet.has(H)&&this.movedMap[fo(ie,he)]?Bi(this.movedSet,H):this.removes.push({parentId:he,id:ie,isShadow:!(!Ne(s.target)||!qe(s.target))||void 0})),this.mapRemoves.push(H))})}}),g(this,"genAdds",(s,l)=>{if(!this.processedNodeManager.inOtherBuffer(s,this)&&!this.addedSet.has(s)&&!this.movedSet.has(s)){if(this.mirror.hasNode(s)){if(Pi(s,this.mirror,this.slimDOMOptions))return;this.movedSet.add(s);var c=null;l&&this.mirror.hasNode(l)&&(c=this.mirror.getId(l)),c&&c!==-1&&(this.movedMap[fo(this.mirror.getId(s),c)]=!0)}else this.addedSet.add(s),this.droppedSet.delete(s);Mt(s,this.blockClass,this.blockSelector,!1)||(te.childNodes(s).forEach(h=>this.genAdds(h)),Di(s)&&te.childNodes(te.shadowRoot(s)).forEach(h=>{this.processedNodeManager.add(h,this),this.genAdds(h,s)}))}})}init(s){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(l=>{this[l]=s[l]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Bi(n,s){n.delete(s),te.childNodes(s).forEach(l=>Bi(n,l))}function vo(n,s,l){return n.length!==0&&function(c,h,f){for(var _=te.parentNode(h),w=function(){var I=f.getId(_);if(c.some(E=>E.id===I))return{v:!0};_=te.parentNode(_)};_;){var S=w();if(typeof S=="object")return S.v}return!1}(n,s,l)}function mo(n,s){return n.size!==0&&_o(n,s)}function _o(n,s){var l=te.parentNode(s);return!!l&&(!!n.has(l)||_o(n,l))}var We=n=>yn?function(){try{return n(...arguments)}catch(s){if(yn&&yn(s)===!0)return;throw s}}:n,Br=[];function bn(n){try{if("composedPath"in n){var s=n.composedPath();if(s.length)return s[0]}else if("path"in n&&n.path.length)return n.path[0]}catch{}return n&&n.target}function yo(n,s){var l=new yu;Br.push(l),l.init(n);var c=new($e())(We(l.processMutations.bind(l)));return c.observe(s,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),c}function bu(n){var{mouseInteractionCb:s,doc:l,mirror:c,blockClass:h,blockSelector:f,sampling:_}=n;if(_.mouseInteraction===!1)return()=>{};var w=_.mouseInteraction===!0||_.mouseInteraction===void 0?{}:_.mouseInteraction,S=[],I=null;return Object.keys(Lt).filter(E=>Number.isNaN(Number(E))&&!E.endsWith("_Departed")&&w[E]!==!1).forEach(E=>{var F=ht(E),Z=(H=>ie=>{var he=bn(ie);if(!Mt(he,h,f,!0)){var oe=null,P=H;if("pointerType"in ie){switch(ie.pointerType){case"mouse":oe=dr.Mouse;break;case"touch":oe=dr.Touch;break;case"pen":oe=dr.Pen}oe===dr.Touch?Lt[H]===Lt.MouseDown?P="TouchStart":Lt[H]===Lt.MouseUp&&(P="TouchEnd"):dr.Pen}else Li(ie)&&(oe=dr.Touch);oe!==null?(I=oe,(P.startsWith("Touch")&&oe===dr.Touch||P.startsWith("Mouse")&&oe===dr.Mouse)&&(oe=null)):Lt[H]===Lt.Click&&(oe=I,I=null);var N=Li(ie)?ie.changedTouches[0]:ie;if(N){var A=c.getId(he),{clientX:j,clientY:X}=N;We(s)(t({type:Lt[P],id:A,x:j,y:X},oe!==null&&{pointerType:oe}))}}})(E);if(window.PointerEvent)switch(Lt[E]){case Lt.MouseDown:case Lt.MouseUp:F=F.replace("mouse","pointer");break;case Lt.TouchStart:case Lt.TouchEnd:return}S.push(Me(F,Z,l))}),We(()=>{S.forEach(E=>E())})}function bo(n){var{scrollCb:s,doc:l,mirror:c,blockClass:h,blockSelector:f,sampling:_}=n;return Me("scroll",We(Sr(We(w=>{var S=bn(w);if(S&&!Mt(S,h,f,!0)){var I=c.getId(S);if(S===l&&l.defaultView){var E=cr(l.defaultView);s({id:I,x:E.left,y:E.top})}else s({id:I,x:S.scrollLeft,y:S.scrollTop})}}),_.scroll||100)),l)}var wu=["INPUT","TEXTAREA","SELECT"],wo=new WeakMap;function $n(n){return function(s,l){if(jn("CSSGroupingRule")&&s.parentRule instanceof CSSGroupingRule||jn("CSSMediaRule")&&s.parentRule instanceof CSSMediaRule||jn("CSSSupportsRule")&&s.parentRule instanceof CSSSupportsRule||jn("CSSConditionRule")&&s.parentRule instanceof CSSConditionRule){var c=Array.from(s.parentRule.cssRules).indexOf(s);l.unshift(c)}else if(s.parentStyleSheet){var h=Array.from(s.parentStyleSheet.cssRules).indexOf(s);l.unshift(h)}return l}(n,[])}function Ir(n,s,l){var c,h;return n?(n.ownerNode?c=s.getId(n.ownerNode):h=l.getId(n),{styleId:h,id:c}):{}}function So(n,s){var l,c,h,{mirror:f,stylesheetManager:_}=n,w=null;w=s.nodeName==="#document"?f.getId(s):f.getId(te.host(s));var S=s.nodeName==="#document"?(l=s.defaultView)==null?void 0:l.Document:(h=(c=s.ownerDocument)==null?void 0:c.defaultView)==null?void 0:h.ShadowRoot,I=S!=null&&S.prototype?Object.getOwnPropertyDescriptor(S==null?void 0:S.prototype,"adoptedStyleSheets"):void 0;return w!==null&&w!==-1&&S&&I?(Object.defineProperty(s,"adoptedStyleSheets",{configurable:I.configurable,enumerable:I.enumerable,get(){var E;return(E=I.get)==null?void 0:E.call(this)},set(E){var F,Z=(F=I.set)==null?void 0:F.call(this,E);if(w!==null&&w!==-1)try{_.adoptStyleSheets(E,w)}catch{}return Z}}),We(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:I.configurable,enumerable:I.enumerable,get:I.get,set:I.set})})):()=>{}}function Su(n){var s,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=n.doc.defaultView;if(!c)return()=>{};(function(N,A){var{mutationCb:j,mousemoveCb:X,mouseInteractionCb:K,scrollCb:Q,viewportResizeCb:re,inputCb:ce,mediaInteractionCb:ge,styleSheetRuleCb:Ie,styleDeclarationCb:z,canvasMutationCb:Ce,fontCb:ve,selectionCb:me,customElementCb:fe}=N;N.mutationCb=function(){A.mutation&&A.mutation(...arguments),j(...arguments)},N.mousemoveCb=function(){A.mousemove&&A.mousemove(...arguments),X(...arguments)},N.mouseInteractionCb=function(){A.mouseInteraction&&A.mouseInteraction(...arguments),K(...arguments)},N.scrollCb=function(){A.scroll&&A.scroll(...arguments),Q(...arguments)},N.viewportResizeCb=function(){A.viewportResize&&A.viewportResize(...arguments),re(...arguments)},N.inputCb=function(){A.input&&A.input(...arguments),ce(...arguments)},N.mediaInteractionCb=function(){A.mediaInteaction&&A.mediaInteaction(...arguments),ge(...arguments)},N.styleSheetRuleCb=function(){A.styleSheetRule&&A.styleSheetRule(...arguments),Ie(...arguments)},N.styleDeclarationCb=function(){A.styleDeclaration&&A.styleDeclaration(...arguments),z(...arguments)},N.canvasMutationCb=function(){A.canvasMutation&&A.canvasMutation(...arguments),Ce(...arguments)},N.fontCb=function(){A.font&&A.font(...arguments),ve(...arguments)},N.selectionCb=function(){A.selection&&A.selection(...arguments),me(...arguments)},N.customElementCb=function(){A.customElement&&A.customElement(...arguments),fe(...arguments)}})(n,l),n.recordDOM&&(s=yo(n,n.doc));var h=function(N){var{mousemoveCb:A,sampling:j,doc:X,mirror:K}=N;if(j.mousemove===!1)return()=>{};var Q,re=typeof j.mousemove=="number"?j.mousemove:50,ce=typeof j.mousemoveCallback=="number"?j.mousemoveCallback:500,ge=[],Ie=Sr(We(ve=>{var me=Date.now()-Q;A(ge.map(fe=>(fe.timeOffset-=me,fe)),ve),ge=[],Q=null}),ce),z=We(Sr(We(ve=>{var me=bn(ve),{clientX:fe,clientY:ae}=Li(ve)?ve.changedTouches[0]:ve;Q||(Q=Jr()),ge.push({x:fe,y:ae,id:K.getId(me),timeOffset:Jr()-Q}),Ie(typeof DragEvent<"u"&&ve instanceof DragEvent?De.Drag:ve instanceof MouseEvent?De.MouseMove:De.TouchMove)}),re,{trailing:!1})),Ce=[Me("mousemove",z,X),Me("touchmove",z,X),Me("drag",z,X)];return We(()=>{Ce.forEach(ve=>ve())})}(n),f=bu(n),_=bo(n),w=function(N,A){var{viewportResizeCb:j}=N,{win:X}=A,K=-1,Q=-1;return Me("resize",We(Sr(We(()=>{var re=Wn(),ce=oo();K===re&&Q===ce||(j({width:Number(ce),height:Number(re)}),K=re,Q=ce)}),200)),X)}(n,{win:c}),S=function(N){var{inputCb:A,doc:j,mirror:X,blockClass:K,blockSelector:Q,ignoreClass:re,ignoreSelector:ce,maskInputOptions:ge,maskInputFn:Ie,sampling:z,userTriggeredOnInput:Ce}=N;function ve(He){var xe=bn(He),V=He.isTrusted,Te=xe&&xe.tagName;if(xe&&Te==="OPTION"&&(xe=te.parentElement(xe)),xe&&Te&&!(wu.indexOf(Te)<0)&&!Mt(xe,K,Q,!0)&&!(xe.classList.contains(re)||ce&&xe.matches(ce))){var At=xe.value,ft=!1,et=Tt(xe)||"";et==="radio"||et==="checkbox"?ft=xe.checked:(ge[Te.toLowerCase()]||ge[et])&&(At=lt({element:xe,maskInputOptions:ge,tagName:Te,type:et,value:At,maskInputFn:Ie})),me(xe,Ce?{text:At,isChecked:ft,userTriggered:V}:{text:At,isChecked:ft});var vt=xe.name;et==="radio"&&vt&&ft&&j.querySelectorAll('input[type="radio"][name="'.concat(vt,'"]')).forEach(qt=>{if(qt!==xe){var Xt=qt.value;me(qt,Ce?{text:Xt,isChecked:!ft,userTriggered:!1}:{text:Xt,isChecked:!ft})}})}}function me(He,xe){var V=wo.get(He);if(!V||V.text!==xe.text||V.isChecked!==xe.isChecked){wo.set(He,xe);var Te=X.getId(He);We(A)(t(t({},xe),{},{id:Te}))}}var fe=(z.input==="last"?["change"]:["input","change"]).map(He=>Me(He,We(ve),j)),ae=j.defaultView;if(!ae)return()=>{fe.forEach(He=>He())};var se=ae.Object.getOwnPropertyDescriptor(ae.HTMLInputElement.prototype,"value"),Be=[[ae.HTMLInputElement.prototype,"value"],[ae.HTMLInputElement.prototype,"checked"],[ae.HTMLSelectElement.prototype,"value"],[ae.HTMLTextAreaElement.prototype,"value"],[ae.HTMLSelectElement.prototype,"selectedIndex"],[ae.HTMLOptionElement.prototype,"selected"]];return se&&se.set&&fe.push(...Be.map(He=>Xr(He[0],He[1],{set(){We(ve)({target:this,isTrusted:!1})}},!1,ae))),We(()=>{fe.forEach(He=>He())})}(n),I=function(N){var{mediaInteractionCb:A,blockClass:j,blockSelector:X,mirror:K,sampling:Q,doc:re}=N,ce=We(Ie=>Sr(We(z=>{var Ce=bn(z);if(Ce&&!Mt(Ce,j,X,!0)){var{currentTime:ve,volume:me,muted:fe,playbackRate:ae,loop:se}=Ce;A({type:Ie,id:K.getId(Ce),currentTime:ve,volume:me,muted:fe,playbackRate:ae,loop:se})}}),Q.media||500)),ge=[Me("play",ce(Qr.Play),re),Me("pause",ce(Qr.Pause),re),Me("seeked",ce(Qr.Seeked),re),Me("volumechange",ce(Qr.VolumeChange),re),Me("ratechange",ce(Qr.RateChange),re)];return We(()=>{ge.forEach(Ie=>Ie())})}(n),E=()=>{},F=()=>{},Z=()=>{},H=()=>{};n.recordDOM&&(E=function(N,A){var{styleSheetRuleCb:j,mirror:X,stylesheetManager:K}=N,{win:Q}=A;if(!Q.CSSStyleSheet||!Q.CSSStyleSheet.prototype)return()=>{};var re=Q.CSSStyleSheet.prototype.insertRule;Q.CSSStyleSheet.prototype.insertRule=new Proxy(re,{apply:We((ve,me,fe)=>{var[ae,se]=fe,{id:Be,styleId:He}=Ir(me,X,K.styleMirror);return(Be&&Be!==-1||He&&He!==-1)&&j({id:Be,styleId:He,adds:[{rule:ae,index:se}]}),ve.apply(me,fe)})}),Q.CSSStyleSheet.prototype.addRule=function(ve,me){var fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.cssRules.length,ae="".concat(ve," { ").concat(me," }");return Q.CSSStyleSheet.prototype.insertRule.apply(this,[ae,fe])};var ce,ge,Ie=Q.CSSStyleSheet.prototype.deleteRule;Q.CSSStyleSheet.prototype.deleteRule=new Proxy(Ie,{apply:We((ve,me,fe)=>{var[ae]=fe,{id:se,styleId:Be}=Ir(me,X,K.styleMirror);return(se&&se!==-1||Be&&Be!==-1)&&j({id:se,styleId:Be,removes:[{index:ae}]}),ve.apply(me,fe)})}),Q.CSSStyleSheet.prototype.removeRule=function(ve){return Q.CSSStyleSheet.prototype.deleteRule.apply(this,[ve])},Q.CSSStyleSheet.prototype.replace&&(ce=Q.CSSStyleSheet.prototype.replace,Q.CSSStyleSheet.prototype.replace=new Proxy(ce,{apply:We((ve,me,fe)=>{var[ae]=fe,{id:se,styleId:Be}=Ir(me,X,K.styleMirror);return(se&&se!==-1||Be&&Be!==-1)&&j({id:se,styleId:Be,replace:ae}),ve.apply(me,fe)})})),Q.CSSStyleSheet.prototype.replaceSync&&(ge=Q.CSSStyleSheet.prototype.replaceSync,Q.CSSStyleSheet.prototype.replaceSync=new Proxy(ge,{apply:We((ve,me,fe)=>{var[ae]=fe,{id:se,styleId:Be}=Ir(me,X,K.styleMirror);return(se&&se!==-1||Be&&Be!==-1)&&j({id:se,styleId:Be,replaceSync:ae}),ve.apply(me,fe)})}));var z={};Gn("CSSGroupingRule")?z.CSSGroupingRule=Q.CSSGroupingRule:(Gn("CSSMediaRule")&&(z.CSSMediaRule=Q.CSSMediaRule),Gn("CSSConditionRule")&&(z.CSSConditionRule=Q.CSSConditionRule),Gn("CSSSupportsRule")&&(z.CSSSupportsRule=Q.CSSSupportsRule));var Ce={};return Object.entries(z).forEach(ve=>{var[me,fe]=ve;Ce[me]={insertRule:fe.prototype.insertRule,deleteRule:fe.prototype.deleteRule},fe.prototype.insertRule=new Proxy(Ce[me].insertRule,{apply:We((ae,se,Be)=>{var[He,xe]=Be,{id:V,styleId:Te}=Ir(se.parentStyleSheet,X,K.styleMirror);return(V&&V!==-1||Te&&Te!==-1)&&j({id:V,styleId:Te,adds:[{rule:He,index:[...$n(se),xe||0]}]}),ae.apply(se,Be)})}),fe.prototype.deleteRule=new Proxy(Ce[me].deleteRule,{apply:We((ae,se,Be)=>{var[He]=Be,{id:xe,styleId:V}=Ir(se.parentStyleSheet,X,K.styleMirror);return(xe&&xe!==-1||V&&V!==-1)&&j({id:xe,styleId:V,removes:[{index:[...$n(se),He]}]}),ae.apply(se,Be)})})}),We(()=>{Q.CSSStyleSheet.prototype.insertRule=re,Q.CSSStyleSheet.prototype.deleteRule=Ie,ce&&(Q.CSSStyleSheet.prototype.replace=ce),ge&&(Q.CSSStyleSheet.prototype.replaceSync=ge),Object.entries(z).forEach(ve=>{var[me,fe]=ve;fe.prototype.insertRule=Ce[me].insertRule,fe.prototype.deleteRule=Ce[me].deleteRule})})}(n,{win:c}),F=So(n,n.doc),Z=function(N,A){var{styleDeclarationCb:j,mirror:X,ignoreCSSAttributes:K,stylesheetManager:Q}=N,{win:re}=A,ce=re.CSSStyleDeclaration.prototype.setProperty;re.CSSStyleDeclaration.prototype.setProperty=new Proxy(ce,{apply:We((Ie,z,Ce)=>{var ve,[me,fe,ae]=Ce;if(K.has(me))return ce.apply(z,[me,fe,ae]);var{id:se,styleId:Be}=Ir((ve=z.parentRule)==null?void 0:ve.parentStyleSheet,X,Q.styleMirror);return(se&&se!==-1||Be&&Be!==-1)&&j({id:se,styleId:Be,set:{property:me,value:fe,priority:ae},index:$n(z.parentRule)}),Ie.apply(z,Ce)})});var ge=re.CSSStyleDeclaration.prototype.removeProperty;return re.CSSStyleDeclaration.prototype.removeProperty=new Proxy(ge,{apply:We((Ie,z,Ce)=>{var ve,[me]=Ce;if(K.has(me))return ge.apply(z,[me]);var{id:fe,styleId:ae}=Ir((ve=z.parentRule)==null?void 0:ve.parentStyleSheet,X,Q.styleMirror);return(fe&&fe!==-1||ae&&ae!==-1)&&j({id:fe,styleId:ae,remove:{property:me},index:$n(z.parentRule)}),Ie.apply(z,Ce)})}),We(()=>{re.CSSStyleDeclaration.prototype.setProperty=ce,re.CSSStyleDeclaration.prototype.removeProperty=ge})}(n,{win:c}),n.collectFonts&&(H=function(N){var{fontCb:A,doc:j}=N,X=j.defaultView;if(!X)return()=>{};var K=[],Q=new WeakMap,re=X.FontFace;X.FontFace=function(ge,Ie,z){var Ce=new re(ge,Ie,z);return Q.set(Ce,{family:ge,buffer:typeof Ie!="string",descriptors:z,fontSource:typeof Ie=="string"?Ie:JSON.stringify(Array.from(new Uint8Array(Ie)))}),Ce};var ce=ur(j.fonts,"add",function(ge){return function(Ie){return setTimeout(We(()=>{var z=Q.get(Ie);z&&(A(z),Q.delete(Ie))}),0),ge.apply(this,[Ie])}});return K.push(()=>{X.FontFace=re}),K.push(ce),We(()=>{K.forEach(ge=>ge())})}(n)));var ie=function(N){var{doc:A,mirror:j,blockClass:X,blockSelector:K,selectionCb:Q}=N,re=!0,ce=We(()=>{var ge=A.getSelection();if(!(!ge||re&&(ge!=null&&ge.isCollapsed))){re=ge.isCollapsed||!1;for(var Ie=[],z=ge.rangeCount||0,Ce=0;Ce<z;Ce++){var ve=ge.getRangeAt(Ce),{startContainer:me,startOffset:fe,endContainer:ae,endOffset:se}=ve;Mt(me,X,K,!0)||Mt(ae,X,K,!0)||Ie.push({start:j.getId(me),startOffset:fe,end:j.getId(ae),endOffset:se})}Q({ranges:Ie})}});return ce(),Me("selectionchange",ce)}(n),he=function(N){var{doc:A,customElementCb:j}=N,X=A.defaultView;return X&&X.customElements?ur(X.customElements,"define",function(K){return function(Q,re,ce){try{j({define:{name:Q}})}catch{console.warn("Custom element callback failed for ".concat(Q))}return K.apply(this,[Q,re,ce])}}):()=>{}}(n),oe=[];for(var P of n.plugins)oe.push(P.observer(P.callback,c,P.options));return We(()=>{Br.forEach(N=>N.reset()),s==null||s.disconnect(),h(),f(),_(),w(),S(),I(),E(),F(),Z(),H(),ie(),he(),oe.forEach(N=>N())})}function jn(n){return window[n]!==void 0}function Gn(n){return!!(window[n]!==void 0&&window[n].prototype&&"insertRule"in window[n].prototype&&"deleteRule"in window[n].prototype)}class Io{constructor(s){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=s}getId(s,l,c,h){var f=c||this.getIdToRemoteIdMap(s),_=h||this.getRemoteIdToIdMap(s),w=f.get(l);return w||(w=this.generateIdFn(),f.set(l,w),_.set(w,l)),w}getIds(s,l){var c=this.getIdToRemoteIdMap(s),h=this.getRemoteIdToIdMap(s);return l.map(f=>this.getId(s,f,c,h))}getRemoteId(s,l,c){var h=c||this.getRemoteIdToIdMap(s);if(typeof l!="number")return l;var f=h.get(l);return f||-1}getRemoteIds(s,l){var c=this.getRemoteIdToIdMap(s);return l.map(h=>this.getRemoteId(s,h,c))}reset(s){if(!s)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(s),this.iframeRemoteIdToIdMap.delete(s)}getIdToRemoteIdMap(s){var l=this.iframeIdToRemoteIdMap.get(s);return l||(l=new Map,this.iframeIdToRemoteIdMap.set(s,l)),l}getRemoteIdToIdMap(s){var l=this.iframeRemoteIdToIdMap.get(s);return l||(l=new Map,this.iframeRemoteIdToIdMap.set(s,l)),l}}class Iu{constructor(s){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new Io(M)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=s.mutationCb,this.wrappedEmit=s.wrappedEmit,this.stylesheetManager=s.stylesheetManager,this.recordCrossOriginIframes=s.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Io(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=s.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(s){this.iframes.set(s,!0),s.contentWindow&&this.crossOriginIframeMap.set(s.contentWindow,s)}addLoadListener(s){this.loadListener=s}attachIframe(s,l){var c,h;this.mutationCb({adds:[{parentId:this.mirror.getId(s),nextId:null,node:l}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((c=s.contentWindow)==null||c.addEventListener("message",this.handleMessage.bind(this))),(h=this.loadListener)==null||h.call(this,s),s.contentDocument&&s.contentDocument.adoptedStyleSheets&&s.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(s.contentDocument.adoptedStyleSheets,this.mirror.getId(s.contentDocument))}handleMessage(s){var l=s;if(l.data.type==="rrweb"&&l.origin===l.data.origin&&s.source){var c=this.crossOriginIframeMap.get(s.source);if(c){var h=this.transformCrossOriginEvent(c,l.data.event);h&&this.wrappedEmit(h,l.data.isCheckout)}}}transformCrossOriginEvent(s,l){var c;switch(l.type){case je.FullSnapshot:this.crossOriginIframeMirror.reset(s),this.crossOriginIframeStyleMirror.reset(s),this.replaceIdOnNode(l.data.node,s);var h=l.data.node.id;return this.crossOriginIframeRootIdMap.set(s,h),this.patchRootIdOnNode(l.data.node,h),{timestamp:l.timestamp,type:je.IncrementalSnapshot,data:{source:De.Mutation,adds:[{parentId:this.mirror.getId(s),nextId:null,node:l.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case je.Meta:case je.Load:case je.DomContentLoaded:return!1;case je.Plugin:return l;case je.Custom:return this.replaceIds(l.data.payload,s,["id","parentId","previousId","nextId"]),l;case je.IncrementalSnapshot:switch(l.data.source){case De.Mutation:return l.data.adds.forEach(f=>{this.replaceIds(f,s,["parentId","nextId","previousId"]),this.replaceIdOnNode(f.node,s);var _=this.crossOriginIframeRootIdMap.get(s);_&&this.patchRootIdOnNode(f.node,_)}),l.data.removes.forEach(f=>{this.replaceIds(f,s,["parentId","id"])}),l.data.attributes.forEach(f=>{this.replaceIds(f,s,["id"])}),l.data.texts.forEach(f=>{this.replaceIds(f,s,["id"])}),l;case De.Drag:case De.TouchMove:case De.MouseMove:return l.data.positions.forEach(f=>{this.replaceIds(f,s,["id"])}),l;case De.ViewportResize:return!1;case De.MediaInteraction:case De.MouseInteraction:case De.Scroll:case De.CanvasMutation:case De.Input:return this.replaceIds(l.data,s,["id"]),l;case De.StyleSheetRule:case De.StyleDeclaration:return this.replaceIds(l.data,s,["id"]),this.replaceStyleIds(l.data,s,["styleId"]),l;case De.Font:return l;case De.Selection:return l.data.ranges.forEach(f=>{this.replaceIds(f,s,["start","end"])}),l;case De.AdoptedStyleSheet:return this.replaceIds(l.data,s,["id"]),this.replaceStyleIds(l.data,s,["styleIds"]),(c=l.data.styles)==null||c.forEach(f=>{this.replaceStyleIds(f,s,["styleId"])}),l}}return!1}replace(s,l,c,h){for(var f of h)(Array.isArray(l[f])||typeof l[f]=="number")&&(Array.isArray(l[f])?l[f]=s.getIds(c,l[f]):l[f]=s.getId(c,l[f]));return l}replaceIds(s,l,c){return this.replace(this.crossOriginIframeMirror,s,l,c)}replaceStyleIds(s,l,c){return this.replace(this.crossOriginIframeStyleMirror,s,l,c)}replaceIdOnNode(s,l){this.replaceIds(s,l,["id","rootId"]),"childNodes"in s&&s.childNodes.forEach(c=>{this.replaceIdOnNode(c,l)})}patchRootIdOnNode(s,l){s.type===y.Document||s.rootId||(s.rootId=l),"childNodes"in s&&s.childNodes.forEach(c=>{this.patchRootIdOnNode(c,l)})}}class Cu{constructor(s){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=s.mutationCb,this.scrollCb=s.scrollCb,this.bypassOptions=s.bypassOptions,this.mirror=s.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(s,l){if(qe(s)&&!this.shadowDoms.has(s)){this.shadowDoms.add(s);var c=yo(t(t({},this.bypassOptions),{},{doc:l,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),s);this.restoreHandlers.push(()=>c.disconnect()),this.restoreHandlers.push(bo(t(t({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:s,mirror:this.mirror}))),setTimeout(()=>{s.adoptedStyleSheets&&s.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(s.adoptedStyleSheets,this.mirror.getId(te.host(s))),this.restoreHandlers.push(So({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},s))},0)}}observeAttachShadow(s){s.contentWindow&&s.contentDocument&&this.patchAttachShadow(s.contentWindow.Element,s.contentDocument)}patchAttachShadow(s,l){var c=this;this.restoreHandlers.push(ur(s.prototype,"attachShadow",function(h){return function(f){var _=h.call(this,f),w=te.shadowRoot(this);return w&&po(this)&&c.addShadowRoot(w,l),_}}))}reset(){this.restoreHandlers.forEach(s=>{try{s()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var wn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Eu=typeof Uint8Array>"u"?[]:new Uint8Array(256),qn=0;qn<64;qn++)Eu[wn.charCodeAt(qn)]=qn;var Co=new Map,Eo=(n,s,l)=>{if(n&&(To(n,s)||typeof n=="object")){var c=function(f,_){var w=Co.get(f);return w||(w=new Map,Co.set(f,w)),w.has(_)||w.set(_,[]),w.get(_)}(l,n.constructor.name),h=c.indexOf(n);return h===-1&&(h=c.length,c.push(n)),h}};function Un(n,s,l){if(n instanceof Array)return n.map(f=>Un(f,s,l));if(n===null)return n;if(n instanceof Float32Array||n instanceof Float64Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Uint8Array||n instanceof Uint16Array||n instanceof Int16Array||n instanceof Int8Array||n instanceof Uint8ClampedArray)return{rr_type:n.constructor.name,args:[Object.values(n)]};if(n instanceof ArrayBuffer)return{rr_type:n.constructor.name,base64:function(f){var _,w=new Uint8Array(f),S=w.length,I="";for(_=0;_<S;_+=3)I+=wn[w[_]>>2],I+=wn[(3&w[_])<<4|w[_+1]>>4],I+=wn[(15&w[_+1])<<2|w[_+2]>>6],I+=wn[63&w[_+2]];return S%3==2?I=I.substring(0,I.length-1)+"=":S%3==1&&(I=I.substring(0,I.length-2)+"=="),I}(n)};if(n instanceof DataView)return{rr_type:n.constructor.name,args:[Un(n.buffer,s,l),n.byteOffset,n.byteLength]};if(n instanceof HTMLImageElement){var c=n.constructor.name,{src:h}=n;return{rr_type:c,src:h}}return n instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:n.toDataURL()}:n instanceof ImageData?{rr_type:n.constructor.name,args:[Un(n.data,s,l),n.width,n.height]}:To(n,s)||typeof n=="object"?{rr_type:n.constructor.name,index:Eo(n,s,l)}:n}var ko=(n,s,l)=>n.map(c=>Un(c,s,l)),To=(n,s)=>{var l=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(c=>typeof s[c]=="function");return!!l.find(c=>n instanceof s[c])};function xo(n,s,l,c){var h=[];try{var f=ur(n.HTMLCanvasElement.prototype,"getContext",function(_){return function(w){for(var S=arguments.length,I=new Array(S>1?S-1:0),E=1;E<S;E++)I[E-1]=arguments[E];if(!Mt(this,s,l,!0)){var F=function(H){return H==="experimental-webgl"?"webgl":H}(w);if("__context"in this||(this.__context=F),c&&["webgl","webgl2"].includes(F))if(I[0]&&typeof I[0]=="object"){var Z=I[0];Z.preserveDrawingBuffer||(Z.preserveDrawingBuffer=!0)}else I.splice(0,1,{preserveDrawingBuffer:!0})}return _.apply(this,[w,...I])}});h.push(f)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{h.forEach(_=>_())}}function Ro(n,s,l,c,h,f){var _=[],w=Object.getOwnPropertyNames(n),S=function(E){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(E))return"continue";try{if(typeof n[E]!="function")return"continue";var F=ur(n,E,function(H){return function(){for(var ie=arguments.length,he=new Array(ie),oe=0;oe<ie;oe++)he[oe]=arguments[oe];var P=H.apply(this,he);if(Eo(P,f,this),"tagName"in this.canvas&&!Mt(this.canvas,c,h,!0)){var N=ko(he,f,this),A={type:s,property:E,args:N};l(this.canvas,A)}return P}});_.push(F)}catch{var Z=Xr(n,E,{set(ie){l(this.canvas,{type:s,property:E,args:[ie],setter:!0})}});_.push(Z)}};for(var I of w)S(I);return _}var Mo,nt,Vn,Hi,Ao="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Oo=typeof window<"u"&&window.Blob&&new Blob([(Mo=Ao,Uint8Array.from(atob(Mo),n=>n.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});function ku(n){var s;try{if(!(s=Oo&&(window.URL||window.webkitURL).createObjectURL(Oo)))throw"";var l=new Worker(s,{name:n==null?void 0:n.name});return l.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(s)}),l}catch{return new Worker("data:text/javascript;base64,"+Ao,{name:n==null?void 0:n.name})}finally{s&&(window.URL||window.webkitURL).revokeObjectURL(s)}}class Tu{constructor(s){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(S,I)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(S)||this.pendingCanvasMutations.set(S,[]),this.pendingCanvasMutations.get(S).push(I)});var{sampling:l="all",win:c,blockClass:h,blockSelector:f,recordCanvas:_,dataURLOptions:w}=s;this.mutationCb=s.mutationCb,this.mirror=s.mirror,_&&l==="all"&&this.initCanvasMutationObserver(c,h,f),_&&typeof l=="number"&&this.initCanvasFPSObserver(l,c,h,f,{dataURLOptions:w})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(s,l,c,h,f){var _=this,w=xo(l,c,h,!0),S=new Map,I=new ku;I.onmessage=ie=>{var{id:he}=ie.data;if(S.set(he,!1),"base64"in ie.data){var{base64:oe,type:P,width:N,height:A}=ie.data;this.mutationCb({id:he,type:Kr["2D"],commands:[{property:"clearRect",args:[0,0,N,A]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:oe}],type:P}]},0,0]}]})}};var E,F=1e3/s,Z=0,H=ie=>{var he,oe;Z&&ie-Z<F||(Z=ie,(he=[],oe=P=>{P.querySelectorAll("canvas").forEach(N=>{Mt(N,c,h,!0)||he.push(N)}),P.querySelectorAll("*").forEach(N=>{N.shadowRoot&&oe(N.shadowRoot)})},oe(l.document),he).forEach(function(){var P=o(function*(N){var A,j=_.mirror.getId(N);if(!S.get(j)&&N.width!==0&&N.height!==0){if(S.set(j,!0),["webgl","webgl2"].includes(N.__context)){var X=N.getContext(N.__context);((A=X==null?void 0:X.getContextAttributes())==null?void 0:A.preserveDrawingBuffer)===!1&&X.clear(X.COLOR_BUFFER_BIT)}var K=N.clientWidth||N.width,Q=N.clientHeight||N.height,re=yield createImageBitmap(N,{resizeWidth:K,resizeHeight:Q});I.postMessage({id:j,bitmap:re,width:K,height:Q,dataURLOptions:f.dataURLOptions},[re])}});return function(N){return P.apply(this,arguments)}}())),E=requestAnimationFrame(H)};E=requestAnimationFrame(H),this.resetObservers=()=>{w(),cancelAnimationFrame(E)}}initCanvasMutationObserver(s,l,c){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var h=xo(s,l,c,!1),f=function(w,S,I,E){var F=[],Z=Object.getOwnPropertyNames(S.CanvasRenderingContext2D.prototype),H=function(he){try{if(typeof S.CanvasRenderingContext2D.prototype[he]!="function")return"continue";var oe=ur(S.CanvasRenderingContext2D.prototype,he,function(N){return function(){for(var A=arguments.length,j=new Array(A),X=0;X<A;X++)j[X]=arguments[X];return Mt(this.canvas,I,E,!0)||setTimeout(()=>{var K=ko(j,S,this);w(this.canvas,{type:Kr["2D"],property:he,args:K})},0),N.apply(this,j)}});F.push(oe)}catch{var P=Xr(S.CanvasRenderingContext2D.prototype,he,{set(A){w(this.canvas,{type:Kr["2D"],property:he,args:[A],setter:!0})}});F.push(P)}};for(var ie of Z)H(ie);return()=>{F.forEach(he=>he())}}(this.processMutation.bind(this),s,l,c),_=function(w,S,I,E){var F=[];return F.push(...Ro(S.WebGLRenderingContext.prototype,Kr.WebGL,w,I,E,S)),S.WebGL2RenderingContext!==void 0&&F.push(...Ro(S.WebGL2RenderingContext.prototype,Kr.WebGL2,w,I,E,S)),()=>{F.forEach(Z=>Z())}}(this.processMutation.bind(this),s,l,c);this.resetObservers=()=>{h(),f(),_()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){var s=l=>{this.rafStamps.latestId=l,requestAnimationFrame(s)};requestAnimationFrame(s)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((s,l)=>{var c=this.mirror.getId(l);this.flushPendingCanvasMutationFor(l,c)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(s,l){if(!this.frozen&&!this.locked){var c=this.pendingCanvasMutations.get(s);if(c&&l!==-1){var h=c.map(_=>u(_,p)),{type:f}=c[0];this.mutationCb({id:l,type:f,commands:h}),this.pendingCanvasMutations.delete(s)}}}}class xu{constructor(s){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new vu),this.mutationCb=s.mutationCb,this.adoptedStyleSheetCb=s.adoptedStyleSheetCb}attachLinkElement(s,l){"_cssText"in l.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:l.id,attributes:l.attributes}]}),this.trackLinkElement(s)}trackLinkElement(s){this.trackedLinkElements.has(s)||(this.trackedLinkElements.add(s),this.trackStylesheetInLinkElement(s))}adoptStyleSheets(s,l){var c=this;if(s.length!==0){var h={id:l,styleIds:[]},f=[],_=function(S){var I=void 0;c.styleMirror.has(S)?I=c.styleMirror.getId(S):(I=c.styleMirror.add(S),f.push({styleId:I,rules:Array.from(S.rules||CSSRule,(E,F)=>({rule:st(E,S.href),index:F}))})),h.styleIds.push(I)};for(var w of s)_(w);f.length>0&&(h.styles=f),this.adoptedStyleSheetCb(h)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(s){}}class Ru{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(s,l){var c=this.nodeMap.get(s);return c&&Array.from(c).some(h=>h!==l)}add(s,l){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(s,(this.nodeMap.get(s)||new Set).add(l))}destroy(){}}var zn=!1;try{if(Array.from([1],n=>2*n)[0]!==2){var Wi=document.createElement("iframe");document.body.appendChild(Wi),Array.from=((d=Wi.contentWindow)==null?void 0:d.Array.from)||Array.from,document.body.removeChild(Wi)}}catch(n){console.debug("Unable to override Array.from",n)}var No,en,tr=new _t;function Hr(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{emit:s,checkoutEveryNms:l,checkoutEveryNth:c,blockClass:h="rr-block",blockSelector:f=null,ignoreClass:_="rr-ignore",ignoreSelector:w=null,maskTextClass:S="rr-mask",maskTextSelector:I=null,inlineStylesheet:E=!0,maskAllInputs:F,maskInputOptions:Z,slimDOMOptions:H,maskInputFn:ie,maskTextFn:he,hooks:oe,packFn:P,sampling:N={},dataURLOptions:A={},mousemoveWait:j,recordDOM:X=!0,recordCanvas:K=!1,recordCrossOriginIframes:Q=!1,recordAfter:re=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:ce=!1,collectFonts:ge=!1,inlineImages:Ie=!1,plugins:z,keepIframeSrcFn:Ce=()=>!1,ignoreCSSAttributes:ve=new Set([]),errorHandler:me}=n;yn=me;var fe=!Q||window.parent===window,ae=!1;if(!fe)try{window.parent.document&&(ae=!1)}catch{ae=!0}if(fe&&!s)throw new Error("emit function is required");if(!fe&&!ae)return()=>{};j!==void 0&&N.mousemove===void 0&&(N.mousemove=j),tr.reset();var se,Be=F===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:Z!==void 0?Z:{password:!0},He=H===!0||H==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:H==="all",headMetaDescKeywords:H==="all",headTitleMutations:H==="all"}:H||{};(function(){var Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;"NodeList"in Re&&!Re.NodeList.prototype.forEach&&(Re.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in Re&&!Re.DOMTokenList.prototype.forEach&&(Re.DOMTokenList.prototype.forEach=Array.prototype.forEach)})();var xe=0,V=Re=>{for(var Ot of z||[])Ot.eventProcessor&&(Re=Ot.eventProcessor(Re));return P&&!ae&&(Re=P(Re)),Re};nt=(Re,Ot)=>{var be,Oe=Re;if(Oe.timestamp=Jr(),!((be=Br[0])!=null&&be.isFrozen())||Oe.type===je.FullSnapshot||Oe.type===je.IncrementalSnapshot&&Oe.data.source===De.Mutation||Br.forEach(gr=>gr.unfreeze()),fe)s==null||s(V(Oe),Ot);else if(ae){var Bt={type:"rrweb",event:V(Oe),origin:window.location.origin,isCheckout:Ot};window.parent.postMessage(Bt,"*")}if(Oe.type===je.FullSnapshot)se=Oe,xe=0;else if(Oe.type===je.IncrementalSnapshot){if(Oe.data.source===De.Mutation&&Oe.data.isAttachIframe)return;xe++;var rr=c&&xe>=c,nr=l&&Oe.timestamp-se.timestamp>l;(rr||nr)&&Vn(!0)}};var Te=Re=>{nt({type:je.IncrementalSnapshot,data:t({source:De.Mutation},Re)})},At=Re=>nt({type:je.IncrementalSnapshot,data:t({source:De.Scroll},Re)}),ft=Re=>nt({type:je.IncrementalSnapshot,data:t({source:De.CanvasMutation},Re)}),et=new xu({mutationCb:Te,adoptedStyleSheetCb:Re=>nt({type:je.IncrementalSnapshot,data:t({source:De.AdoptedStyleSheet},Re)})}),vt=new Iu({mirror:tr,mutationCb:Te,stylesheetManager:et,recordCrossOriginIframes:Q,wrappedEmit:nt});for(var qt of z||[])qt.getMirror&&qt.getMirror({nodeMirror:tr,crossOriginIframeMirror:vt.crossOriginIframeMirror,crossOriginIframeStyleMirror:vt.crossOriginIframeStyleMirror});var Xt=new Ru;Hi=new Tu({recordCanvas:K,mutationCb:ft,win:window,blockClass:h,blockSelector:f,mirror:tr,sampling:N.canvas,dataURLOptions:A});var tt=new Cu({mutationCb:Te,scrollCb:At,bypassOptions:{blockClass:h,blockSelector:f,maskTextClass:S,maskTextSelector:I,inlineStylesheet:E,maskInputOptions:Be,dataURLOptions:A,maskTextFn:he,maskInputFn:ie,recordCanvas:K,inlineImages:Ie,sampling:N,slimDOMOptions:He,iframeManager:vt,stylesheetManager:et,canvasManager:Hi,keepIframeSrcFn:Ce,processedNodeManager:Xt},mirror:tr});Vn=function(){var Re=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(X){nt({type:je.Meta,data:{href:window.location.href,width:oo(),height:Wn()}},Re),et.reset(),tt.init(),Br.forEach(be=>be.lock());var Ot=function(be,Oe){var{mirror:Bt=new _t,blockClass:rr="rr-block",blockSelector:nr=null,maskTextClass:gr="rr-mask",maskTextSelector:ni=null,inlineStylesheet:us=!0,inlineImages:ec=!1,recordCanvas:tc=!1,maskAllInputs:cs=!1,maskTextFn:rc,maskInputFn:nc,slimDOM:In=!1,dataURLOptions:ic,preserveWhiteSpace:sc,onSerialize:oc,onIframeLoad:ac,iframeLoadTimeout:lc,onStylesheetLoad:uc,stylesheetLoadTimeout:cc,keepIframeSrcFn:dc=()=>!1}=Oe||{};return at(be,{doc:be,mirror:Bt,blockClass:rr,blockSelector:nr,maskTextClass:gr,maskTextSelector:ni,skipChild:!1,inlineStylesheet:us,maskInputOptions:cs===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:cs===!1?{password:!0}:cs,maskTextFn:rc,maskInputFn:nc,slimDOMOptions:In===!0||In==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:In==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:In===!1?{}:In,dataURLOptions:ic,inlineImages:ec,recordCanvas:tc,preserveWhiteSpace:sc,onSerialize:oc,onIframeLoad:ac,iframeLoadTimeout:lc,onStylesheetLoad:uc,stylesheetLoadTimeout:cc,keepIframeSrcFn:dc,newlyAddedElement:!1})}(document,{mirror:tr,blockClass:h,blockSelector:f,maskTextClass:S,maskTextSelector:I,inlineStylesheet:E,maskAllInputs:Be,maskTextFn:he,maskInputFn:ie,slimDOM:He,dataURLOptions:A,recordCanvas:K,inlineImages:Ie,onSerialize:be=>{uo(be,tr)&&vt.addIframe(be),co(be,tr)&&et.trackLinkElement(be),Di(be)&&tt.addShadowRoot(te.shadowRoot(be),document)},onIframeLoad:(be,Oe)=>{vt.attachIframe(be,Oe),tt.observeAttachShadow(be)},onStylesheetLoad:(be,Oe)=>{et.attachLinkElement(be,Oe)},keepIframeSrcFn:Ce});if(!Ot)return console.warn("Failed to snapshot the document");nt({type:je.FullSnapshot,data:{node:Ot,initialOffset:cr(window)}},Re),Br.forEach(be=>be.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&et.adoptStyleSheets(document.adoptedStyleSheets,tr.getId(document))}};try{var Wr=[],Sn=Re=>{var Ot;return We(Su)({mutationCb:Te,mousemoveCb:(be,Oe)=>nt({type:je.IncrementalSnapshot,data:{source:Oe,positions:be}}),mouseInteractionCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.MouseInteraction},be)}),scrollCb:At,viewportResizeCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.ViewportResize},be)}),inputCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.Input},be)}),mediaInteractionCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.MediaInteraction},be)}),styleSheetRuleCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.StyleSheetRule},be)}),styleDeclarationCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.StyleDeclaration},be)}),canvasMutationCb:ft,fontCb:be=>nt({type:je.IncrementalSnapshot,data:t({source:De.Font},be)}),selectionCb:be=>{nt({type:je.IncrementalSnapshot,data:t({source:De.Selection},be)})},customElementCb:be=>{nt({type:je.IncrementalSnapshot,data:t({source:De.CustomElement},be)})},blockClass:h,ignoreClass:_,ignoreSelector:w,maskTextClass:S,maskTextSelector:I,maskInputOptions:Be,inlineStylesheet:E,sampling:N,recordDOM:X,recordCanvas:K,inlineImages:Ie,userTriggeredOnInput:ce,collectFonts:ge,doc:Re,maskInputFn:ie,maskTextFn:he,keepIframeSrcFn:Ce,blockSelector:f,slimDOMOptions:He,dataURLOptions:A,mirror:tr,iframeManager:vt,stylesheetManager:et,shadowDomManager:tt,processedNodeManager:Xt,canvasManager:Hi,ignoreCSSAttributes:ve,plugins:((Ot=z==null?void 0:z.filter(be=>be.observer))==null?void 0:Ot.map(be=>({observer:be.observer,options:be.options,callback:Oe=>nt({type:je.Plugin,data:{plugin:be.name,payload:Oe}})})))||[]},oe)};vt.addLoadListener(Re=>{try{Wr.push(Sn(Re.contentDocument))}catch(Ot){console.warn(Ot)}});var pr=()=>{Vn(),Wr.push(Sn(document)),zn=!0};return document.readyState==="interactive"||document.readyState==="complete"?pr():(Wr.push(Me("DOMContentLoaded",()=>{nt({type:je.DomContentLoaded,data:{}}),re==="DOMContentLoaded"&&pr()})),Wr.push(Me("load",()=>{nt({type:je.Load,data:{}}),re==="load"&&pr()},window))),()=>{Wr.forEach(Re=>Re()),Xt.destroy(),zn=!1,yn=void 0}}catch(Re){console.warn(Re)}}Hr.addCustomEvent=(n,s)=>{if(!zn)throw new Error("please add custom event after start recording");nt({type:je.Custom,data:{tag:n,payload:s}})},Hr.freezePage=()=>{Br.forEach(n=>n.freeze())},Hr.takeFullSnapshot=n=>{if(!zn)throw new Error("please take full snapshot after start recording");Vn(n)},Hr.mirror=tr,(en=No||(No={}))[en.NotStarted=0]="NotStarted",en[en.Running=1]="Running",en[en.Stopped=2]="Stopped";var Fo,Mu=Object.defineProperty,Yn=(n,s,l)=>((c,h,f)=>h in c?Mu(c,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[h]=f)(n,typeof s!="symbol"?s+"":s,l),Au=Object.defineProperty,$i=(n,s,l)=>((c,h,f)=>h in c?Au(c,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[h]=f)(n,typeof s!="symbol"?s+"":s,l),Ou=Object.defineProperty,Po=(n,s,l)=>((c,h,f)=>h in c?Ou(c,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):c[h]=f)(n,typeof s!="symbol"?s+"":s,l),Lo={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Do={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Zn={};function ji(n){if(Zn[n])return Zn[n];var s=globalThis[n],l=s.prototype,c=n in Lo?Lo[n]:void 0,h=!!(c&&c.every(E=>{var F,Z;return!!((Z=(F=Object.getOwnPropertyDescriptor(l,E))==null?void 0:F.get)!=null&&Z.toString().includes("[native code]"))})),f=n in Do?Do[n]:void 0,_=!!(f&&f.every(E=>{var F;return typeof l[E]=="function"&&((F=l[E])==null?void 0:F.toString().includes("[native code]"))}));if(h&&_)return Zn[n]=s.prototype,s.prototype;try{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow;if(!S)return s.prototype;var I=S[n].prototype;return document.body.removeChild(w),I?Zn[n]=I:l}catch{return l}}var Gi={};function Cr(n,s,l){var c,h="".concat(n,".").concat(String(l));if(Gi[h])return Gi[h].call(s);var f=ji(n),_=(c=Object.getOwnPropertyDescriptor(f,l))==null?void 0:c.get;return _?(Gi[h]=_,_.call(s)):s[l]}var qi={};function Bo(n,s,l){var c="".concat(n,".").concat(String(l));if(qi[c])return qi[c].bind(s);var h=ji(n)[l];return typeof h!="function"?s[l]:(qi[c]=h,h.bind(s))}var Xn={childNodes:function(n){return Cr("Node",n,"childNodes")},parentNode:function(n){return Cr("Node",n,"parentNode")},parentElement:function(n){return Cr("Node",n,"parentElement")},textContent:function(n){return Cr("Node",n,"textContent")},contains:function(n,s){return Bo("Node",n,"contains")(s)},getRootNode:function(n){return Bo("Node",n,"getRootNode")()},host:function(n){return n&&"host"in n?Cr("ShadowRoot",n,"host"):null},styleSheets:function(n){return n.styleSheets},shadowRoot:function(n){return n&&"shadowRoot"in n?Cr("Element",n,"shadowRoot"):null},querySelector:function(n,s){return Cr("Element",n,"querySelector")(s)},querySelectorAll:function(n,s){return Cr("Element",n,"querySelectorAll")(s)},mutationObserver:function(){return ji("MutationObserver").constructor}};class Nu{constructor(){Po(this,"idNodeMap",new Map),Po(this,"nodeMetaMap",new WeakMap)}getId(s){var l;if(!s)return-1;var c=(l=this.getMeta(s))==null?void 0:l.id;return c??-1}getNode(s){return this.idNodeMap.get(s)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(s){return this.nodeMetaMap.get(s)||null}removeNodeFromMap(s){var l=this.getId(s);this.idNodeMap.delete(l),s.childNodes&&s.childNodes.forEach(c=>this.removeNodeFromMap(c))}has(s){return this.idNodeMap.has(s)}hasNode(s){return this.nodeMetaMap.has(s)}add(s,l){var c=l.id;this.idNodeMap.set(c,s),this.nodeMetaMap.set(s,l)}replace(s,l){var c=this.getNode(s);if(c){var h=this.nodeMetaMap.get(c);h&&this.nodeMetaMap.set(l,h)}this.idNodeMap.set(s,l)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ui(n,s,l){if(!n)return!1;if(n.nodeType!==n.ELEMENT_NODE)return!!l&&Ui(Xn.parentNode(n),s,l);for(var c=n.classList.length;c--;){var h=n.classList[c];if(s.test(h))return!0}return!!l&&Ui(Xn.parentNode(n),s,l)}class Vi{constructor(){__publicField22(this,"parentElement",null),__publicField22(this,"parentNode",null),__publicField22(this,"ownerDocument"),__publicField22(this,"firstChild",null),__publicField22(this,"lastChild",null),__publicField22(this,"previousSibling",null),__publicField22(this,"nextSibling",null),__publicField22(this,"ELEMENT_NODE",1),__publicField22(this,"TEXT_NODE",3),__publicField22(this,"nodeType"),__publicField22(this,"nodeName"),__publicField22(this,"RRNodeType")}get childNodes(){for(var s=[],l=this.firstChild;l;)s.push(l),l=l.nextSibling;return s}contains(s){if(!(s instanceof Vi)||s.ownerDocument!==this.ownerDocument)return!1;if(s===this)return!0;for(;s.parentNode;){if(s.parentNode===this)return!0;s=s.parentNode}return!1}appendChild(s){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(s,l){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(s){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}var Ho={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Wo={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Jn={};function zi(n){if(Jn[n])return Jn[n];var s=globalThis[n],l=s.prototype,c=n in Ho?Ho[n]:void 0,h=!!(c&&c.every(E=>{var F,Z;return!!((Z=(F=Object.getOwnPropertyDescriptor(l,E))==null?void 0:F.get)!=null&&Z.toString().includes("[native code]"))})),f=n in Wo?Wo[n]:void 0,_=!!(f&&f.every(E=>{var F;return typeof l[E]=="function"&&((F=l[E])==null?void 0:F.toString().includes("[native code]"))}));if(h&&_)return Jn[n]=s.prototype,s.prototype;try{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow;if(!S)return s.prototype;var I=S[n].prototype;return document.body.removeChild(w),I?Jn[n]=I:l}catch{return l}}var Yi={};function Er(n,s,l){var c,h="".concat(n,".").concat(String(l));if(Yi[h])return Yi[h].call(s);var f=zi(n),_=(c=Object.getOwnPropertyDescriptor(f,l))==null?void 0:c.get;return _?(Yi[h]=_,_.call(s)):s[l]}var Zi={};function $o(n,s,l){var c="".concat(n,".").concat(String(l));if(Zi[c])return Zi[c].bind(s);var h=zi(n)[l];return typeof h!="function"?s[l]:(Zi[c]=h,h.bind(s))}var Zt={childNodes:function(n){return Er("Node",n,"childNodes")},parentNode:function(n){return Er("Node",n,"parentNode")},parentElement:function(n){return Er("Node",n,"parentElement")},textContent:function(n){return Er("Node",n,"textContent")},contains:function(n,s){return $o("Node",n,"contains")(s)},getRootNode:function(n){return $o("Node",n,"getRootNode")()},host:function(n){return n&&"host"in n?Er("ShadowRoot",n,"host"):null},styleSheets:function(n){return n.styleSheets},shadowRoot:function(n){return n&&"shadowRoot"in n?Er("Element",n,"shadowRoot"):null},querySelector:function(n,s){return Er("Element",n,"querySelector")(s)},querySelectorAll:function(n,s){return Er("Element",n,"querySelectorAll")(s)},mutationObserver:function(){return zi("MutationObserver").constructor}},tn=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`,Xi={map:{},getId:()=>(console.error(tn),-1),getNode:()=>(console.error(tn),null),removeNodeFromMap(){console.error(tn)},has:()=>(console.error(tn),!1),reset(){console.error(tn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Xi=new Proxy(Xi,{get:(n,s,l)=>(s==="map"&&console.error(tn),Reflect.get(n,s,l))}));var jo=Date.now;function Go(n){return n?n.nodeType===n.ELEMENT_NODE?n:Zt.parentElement(n):null}/[1-9][0-9]{12}/.test(Date.now().toString())||(jo=()=>new Date().getTime());function qo(n){var s,l=null;return"getRootNode"in n&&((s=Zt.getRootNode(n))==null?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Zt.host(Zt.getRootNode(n))&&(l=Zt.host(Zt.getRootNode(n))),l}function Uo(n){for(var s,l=n;s=qo(l);)l=s;return l}function Vo(n){var s=n.ownerDocument;if(!s)return!1;var l=Uo(n);return Zt.contains(s,l)}for(var Fu=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){$i(this,"id",1),$i(this,"styleIDMap",new WeakMap),$i(this,"idStyleMap",new Map)}getId(n){var s;return(s=this.styleIDMap.get(n))!==null&&s!==void 0?s:-1}has(n){return this.styleIDMap.has(n)}add(n,s){return this.has(n)?this.getId(n):(l=s===void 0?this.id++:s,this.styleIDMap.set(n,l),this.idStyleMap.set(l,n),l);var l}getStyle(n){return this.idStyleMap.get(n)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return Xi},closestElementOfNode:Go,getBaseDimension:function n(s,l){var c,h,f=(h=(c=s.ownerDocument)==null?void 0:c.defaultView)==null?void 0:h.frameElement;if(!f||f===l)return{x:0,y:0,relativeScale:1,absoluteScale:1};var _=f.getBoundingClientRect(),w=n(f,l),S=_.height/f.clientHeight;return{x:_.x*w.relativeScale+w.x,y:_.y*w.relativeScale+w.y,relativeScale:S,absoluteScale:w.absoluteScale*S}},getNestedRule:function n(s,l){var c=s[l[0]];return l.length===1?c:n(c.cssRules[l[1]].cssRules,l.slice(2))},getPositionsAndIndex:function(n){var s=[...n],l=s.pop();return{positions:s,index:l}},getRootShadowHost:Uo,getShadowHost:qo,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(n){var s,l,c,h,f=n.document;return{left:f.scrollingElement?f.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:f.documentElement.scrollLeft||(f==null?void 0:f.body)&&((s=Zt.parentElement(f.body))==null?void 0:s.scrollLeft)||((l=f==null?void 0:f.body)==null?void 0:l.scrollLeft)||0,top:f.scrollingElement?f.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(f==null?void 0:f.documentElement.scrollTop)||(f==null?void 0:f.body)&&((c=Zt.parentElement(f.body))==null?void 0:c.scrollTop)||((h=f==null?void 0:f.body)==null?void 0:h.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(n){return!!n&&(n instanceof Vi&&"shadowRoot"in n?!!n.shadowRoot:!!Zt.shadowRoot(n))},hookSetter:function n(s,l,c,h){var f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:window,_=f.Object.getOwnPropertyDescriptor(s,l);return f.Object.defineProperty(s,l,h?c:{set(w){setTimeout(()=>{c.set.call(this,w)},0),_&&_.set&&_.set.call(this,w)}}),()=>n(s,l,_||{},!0)},inDom:function(n){var s=n.ownerDocument;return!!s&&(Zt.contains(s,n)||Vo(n))},isAncestorRemoved:function n(s,l){if(h=(c=s)&&"host"in c&&"mode"in c&&Xn.host(c)||null,!!(h&&"shadowRoot"in h&&Xn.shadowRoot(h)===c))return!1;var c,h,f=l.getId(s);if(!l.has(f))return!0;var _=Zt.parentNode(s);return(!_||_.nodeType!==s.DOCUMENT_NODE)&&(!_||n(_,l))},isBlocked:function(n,s,l,c){if(!n)return!1;var h=Go(n);if(!h)return!1;try{if(typeof s=="string"){if(h.classList.contains(s)||c&&h.closest("."+s)!==null)return!0}else if(Ui(h,s,c))return!0}catch{}return!!(l&&(h.matches(l)||c&&h.closest(l)!==null))},isIgnored:function(n,s,l){return!(n.tagName!=="TITLE"||!l.headTitleMutations)||s.getId(n)===-2},isSerialized:function(n,s){return s.getId(n)!==-1},isSerializedIframe:function(n,s){return!!(n.nodeName==="IFRAME"&&s.getMeta(n))},isSerializedStylesheet:function(n,s){return!!(n.nodeName==="LINK"&&n.nodeType===n.ELEMENT_NODE&&n.getAttribute&&n.getAttribute("rel")==="stylesheet"&&s.getMeta(n))},iterateResolveTree:function n(s,l){l(s.value);for(var c=s.children.length-1;c>=0;c--)n(s.children[c],l)},legacy_isTouchEvent:function(n){return!!n.changedTouches},get nowTimestamp(){return jo},on:function(n,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:document,c={capture:!0,passive:!0};return l.addEventListener(n,s,c),()=>l.removeEventListener(n,s,c)},patch:function(n,s,l){try{if(!(s in n))return()=>{};var c=n[s],h=l(c);return typeof h=="function"&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:c}})),n[s]=h,()=>{n[s]=c}}catch{return()=>{}}},polyfill:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;"NodeList"in n&&!n.NodeList.prototype.forEach&&(n.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in n&&!n.DOMTokenList.prototype.forEach&&(n.DOMTokenList.prototype.forEach=Array.prototype.forEach)},queueToResolveTrees:function(n){var s={},l=(F,Z)=>{var H={value:F,parent:Z,children:[]};return s[F.node.id]=H,H},c=[];for(var h of n){var{nextId:f,parentId:_}=h;if(f&&f in s){var w=s[f];if(w.parent){var S=w.parent.children.indexOf(w);w.parent.children.splice(S,0,l(h,w.parent))}else{var I=c.indexOf(w);c.splice(I,0,l(h,null))}}else if(_ in s){var E=s[_];E.children.push(l(h,E))}else c.push(l(h,null))}return c},shadowHostInDom:Vo,throttle:function(n,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=null,h=0;return function(){for(var f=arguments.length,_=new Array(f),w=0;w<f;w++)_[w]=arguments[w];var S=Date.now();h||l.leading!==!1||(h=S);var I=s-(S-h),E=this;I<=0||I>s?(c&&(clearTimeout(c),c=null),h=S,n.apply(E,_)):c||l.trailing===!1||(c=setTimeout(()=>{h=l.leading===!1?0:Date.now(),c=null,n.apply(E,_)},I))}},uniqueTextMutations:function(n){for(var s=new Set,l=[],c=n.length;c--;){var h=n[c];s.has(h.id)||(l.push(h),s.add(h.id))}return l}},Symbol.toStringTag,{value:"Module"})),Pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lu=typeof Uint8Array>"u"?[]:new Uint8Array(256),Kn=0;Kn<64;Kn++)Lu[Pu.charCodeAt(Kn)]=Kn;var zo;typeof window<"u"&&window.Blob&&new Blob([(n=>Uint8Array.from(atob(n),s=>s.charCodeAt(0)))("KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=")],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],n=>2*n)[0]!==2){var Ji=document.createElement("iframe");document.body.appendChild(Ji),Array.from=((Fo=Ji.contentWindow)==null?void 0:Fo.Array.from)||Array.from,document.body.removeChild(Ji)}}catch(n){console.debug("Unable to override Array.from",n)}new Nu,function(n){n[n.NotStarted=0]="NotStarted",n[n.Running=1]="Running",n[n.Stopped=2]="Stopped"}(zo||(zo={}));class rn{constructor(s){Yn(this,"fileName"),Yn(this,"functionName"),Yn(this,"lineNumber"),Yn(this,"columnNumber"),this.fileName=s.fileName||"",this.functionName=s.functionName||"",this.lineNumber=s.lineNumber,this.columnNumber=s.columnNumber}toString(){var s=this.lineNumber||"",l=this.columnNumber||"";return this.functionName?"".concat(this.functionName," (").concat(this.fileName,":").concat(s,":").concat(l,")"):"".concat(this.fileName,":").concat(s,":").concat(l)}}var Du=/(^|@)\S+:\d+/,Yo=/^\s*at .*(\S+:\d+|\(native\))/m,Bu=/^(eval@)?(\[native code])?$/,Ki={parse:function(n){return n?n.stacktrace!==void 0||n["opera#sourceloc"]!==void 0?this.parseOpera(n):n.stack&&n.stack.match(Yo)?this.parseV8OrIE(n):n.stack?this.parseFFOrSafari(n):(console.warn("[console-record-plugin]: Failed to parse error object:",n),[]):[]},extractLocation:function(n){if(n.indexOf(":")===-1)return[n];var s=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(n.replace(/[()]/g,""));if(!s)throw new Error("Cannot parse given url: ".concat(n));return[s[1],s[2]||void 0,s[3]||void 0]},parseV8OrIE:function(n){return n.stack.split(` `).filter(function(s){return!!s.match(Yo)},this).map(function(s){s.indexOf("(eval ")>-1&&(s=s.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var l=s.replace(/^\s+/,"").replace(/\(eval code/g,"("),c=l.match(/ (\((.+):(\d+):(\d+)\)$)/),h=(l=c?l.replace(c[0],""):l).split(/\s+/).slice(1),f=this.extractLocation(c?c[1]:h.pop()),_=h.join(" ")||void 0,w=["eval","<anonymous>"].indexOf(f[0])>-1?void 0:f[0];return new rn({functionName:_,fileName:w,lineNumber:f[1],columnNumber:f[2]})},this)},parseFFOrSafari:function(n){return n.stack.split(` `).filter(function(s){return!s.match(Bu)},this).map(function(s){if(s.indexOf(" > eval")>-1&&(s=s.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),s.indexOf("@")===-1&&s.indexOf(":")===-1)return new rn({functionName:s});var l=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=s.match(l),h=c&&c[1]?c[1]:void 0,f=this.extractLocation(s.replace(l,""));return new rn({functionName:h,fileName:f[0],lineNumber:f[1],columnNumber:f[2]})},this)},parseOpera:function(n){return!n.stacktrace||n.message.indexOf(` `)>-1&&n.message.split(` `).length>n.stacktrace.split(` `).length?this.parseOpera9(n):n.stack?this.parseOpera11(n):this.parseOpera10(n)},parseOpera9:function(n){for(var s=/Line (\d+).*script (?:in )?(\S+)/i,l=n.message.split(` `),c=[],h=2,f=l.length;h<f;h+=2){var _=s.exec(l[h]);_&&c.push(new rn({fileName:_[2],lineNumber:parseFloat(_[1])}))}return c},parseOpera10:function(n){for(var s=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,l=n.stacktrace.split(` `),c=[],h=0,f=l.length;h<f;h+=2){var _=s.exec(l[h]);_&&c.push(new rn({functionName:_[3]||void 0,fileName:_[2],lineNumber:parseFloat(_[1])}))}return c},parseOpera11:function(n){return n.stack.split(` `).filter(function(s){return!!s.match(Du)&&!s.match(/^Error created at/)},this).map(function(s){var l=s.split("@"),c=this.extractLocation(l.pop()),h=(l.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new rn({functionName:h,fileName:c[0],lineNumber:c[1],columnNumber:c[2]})},this)}};function Hu(n){if(!n||!n.outerHTML)return"";for(var s="";n.parentElement;){var l=n.localName;if(!l)break;l=l.toLowerCase();var c=n.parentElement,h=[];if(c.children&&c.children.length>0)for(var f=0;f<c.children.length;f++){var _=c.children[f];_.localName&&_.localName.toLowerCase&&_.localName.toLowerCase()===l&&h.push(_)}h.length>1&&(l+=":eq(".concat(h.indexOf(n),")")),s=l+(s?">"+s:""),n=c}return s}function Qi(n){return Object.prototype.toString.call(n)==="[object Object]"}function Zo(n,s){if(s===0)return!0;var l=Object.keys(n);for(var c of l)if(Qi(n[c])&&Zo(n[c],s-1))return!0;return!1}function nn(n,s){var l={numOfKeysLimit:50,depthOfLimit:4};Object.assign(l,s);var c=[],h=[];return JSON.stringify(n,function(f,_){if(c.length>0){var w=c.indexOf(this);~w?c.splice(w+1):c.push(this),~w?h.splice(w,1/0,f):h.push(f),~c.indexOf(_)&&(_=c[0]===_?"[Circular ~]":"[Circular ~."+h.slice(0,c.indexOf(_)).join(".")+"]")}else c.push(_);if(_===null)return _;if(_===void 0)return"undefined";if(function(F){return!!(Qi(F)&&Object.keys(F).length>l.numOfKeysLimit||typeof F=="function"||Qi(F)&&Zo(F,l.depthOfLimit))}(_))return function(F){var Z=F.toString();return l.stringLengthLimit&&Z.length>l.stringLengthLimit&&(Z="".concat(Z.slice(0,l.stringLengthLimit),"...")),Z}(_);if(typeof _=="bigint")return _.toString()+"n";if(_ instanceof Event){var S={};for(var I in _){var E=_[I];Array.isArray(E)?S[I]=Hu(E.length?E[0]:null):S[I]=E}return S}return _ instanceof Node?_ instanceof HTMLElement?_?_.outerHTML:"":_.nodeName:_ instanceof Error?_.stack?_.stack+` End of stack for Error object`:_.name+": "+_.message:_})}var Xo={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 Wu(n,s,l){var c,h=l?Object.assign({},Xo,l):Xo,f=h.logger;if(!f)return()=>{};c=typeof f=="string"?s[f]:f;var _=0,w=!1,S=[];if(h.level.includes("error")){var I=H=>{var ie=H.message,he=H.error,oe=Ki.parse(he).map(N=>N.toString()),P=[nn(ie,h.stringifyOptions)];n({level:"error",trace:oe,payload:P})};s.addEventListener("error",I),S.push(()=>{s.removeEventListener("error",I)});var E=H=>{var ie,he;H.reason instanceof Error?(ie=H.reason,he=[nn("Uncaught (in promise) ".concat(ie.name,": ").concat(ie.message),h.stringifyOptions)]):(ie=new Error,he=[nn("Uncaught (in promise)",h.stringifyOptions),nn(H.reason,h.stringifyOptions)]);var oe=Ki.parse(ie).map(P=>P.toString());n({level:"error",trace:oe,payload:he})};s.addEventListener("unhandledrejection",E),S.push(()=>{s.removeEventListener("unhandledrejection",E)})}for(var F of h.level)S.push(Z(c,F));return()=>{S.forEach(H=>H())};function Z(H,ie){var he=this;return H[ie]?Fu.patch(H,ie,oe=>function(){for(var P=arguments.length,N=new Array(P),A=0;A<P;A++)N[A]=arguments[A];if(oe.apply(he,N),!(ie==="assert"&&N[0]||w)){w=!0;try{var j=Ki.parse(new Error).map(K=>K.toString()).splice(1),X=(ie==="assert"?N.slice(1):N).map(K=>nn(K,h.stringifyOptions));++_<h.lengthThreshold?n({level:ie,trace:j,payload:X}):_===h.lengthThreshold&&n({level:"warn",trace:[],payload:[nn("The number of log records reached the threshold.")]})}catch(K){oe("rrweb logger error:",K,...N)}finally{w=!1}}}):()=>{}}}var Jo=n=>({name:"rrweb/console@1",observer:Wu,options:n}),hr=typeof window<"u"?window:void 0,Dt=typeof globalThis<"u"?globalThis:hr,Ko=Array.prototype.forEach,Qo=Dt==null?void 0:Dt.navigator;Dt==null||Dt.document,Dt==null||Dt.location,Dt==null||Dt.fetch,Dt!=null&&Dt.XMLHttpRequest&&"withCredentials"in new Dt.XMLHttpRequest&&Dt.XMLHttpRequest,Dt==null||Dt.AbortController,Qo==null||Qo.userAgent;var ea,kr=hr??{},ta="[PostHog.js]",sn={_log:function(n){if(hr&&kr.POSTHOG_DEBUG&&!Tr(hr.console)&&hr.console){for(var s=("__rrweb_original__"in hr.console[n])?hr.console[n].__rrweb_original__:hr.console[n],l=arguments.length,c=new Array(l>1?l-1:0),h=1;h<l;h++)c[h-1]=arguments[h];s(ta,...c)}},info:function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];sn._log("log",...s)},warn:function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];sn._log("warn",...s)},error:function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];sn._log("error",...s)},critical:function(){for(var n=arguments.length,s=new Array(n),l=0;l<n;l++)s[l]=arguments[l];console.error(ta,...s)},uninitializedWarning:n=>{sn.error("You must initialize PostHog before calling ".concat(n))}},es={};function $u(n,s,l){if(!na(n)){if(Qn(n))return function(f,_,w){if(Qn(f)){if(Ko&&f.forEach===Ko)f.forEach(_,w);else if("length"in f&&f.length===+f.length){for(var S=0,I=f.length;S<I;S++)if(S in f&&_.call(w,f[S],S)===es)return}}}(n,s,l);if(ia(n)){for(var c of n.entries())if(s.call(l,c[1],c[0])===es)return}else for(var h in n)if(Gu.call(n,h)&&s.call(l,n[h],h)===es)return}}(function(n){n.GZipJS="gzip-js",n.Base64="base64"})(ea||(ea={}));var ju=Array.isArray,ra=Object.prototype,Gu=ra.hasOwnProperty,ts=ra.toString,Qn=ju||function(n){return ts.call(n)==="[object Array]"},qu=n=>typeof n=="function",Uu=n=>n===Object(n)&&!Qn(n),Tr=n=>n===void 0,Vu=n=>ts.call(n)=="[object String]",rs=n=>n===null,na=n=>Tr(n)||rs(n),ns=n=>ts.call(n)==="[object Boolean]",zu=n=>n instanceof Document,ia=n=>n instanceof FormData,Yu=function(n){var s,l,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",h=[];return $u(n,function(f,_){Tr(f)||Tr(_)||_==="undefined"||(s=encodeURIComponent(f instanceof File?f.name:f.toString()),l=encodeURIComponent(_),h[h.length]=l+"="+s)}),h.join(c)},sa={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:n=>n,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]};function oa(n,s,l){try{if(!(s in n))return()=>{};var c=n[s],h=l(c);return qu(h)&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__posthog_wrapped__:{enumerable:!1,value:!0}})),n[s]=h,()=>{n[s]=c}}catch{return()=>{}}}function is(n,s){var l,c=function(_){try{return typeof _=="string"?new URL(_).hostname:"url"in _?new URL(_.url).hostname:_.hostname}catch{return null}}(n),h={hostname:c,isHostDenied:!1};if((l=s.payloadHostDenyList)===null||l===void 0||!l.length||c==null||!c.trim().length)return h;for(var f of s.payloadHostDenyList)if(c.endsWith(f))return{hostname:c,isHostDenied:!0};return h}var aa=n=>n.entryType==="navigation",ss=n=>n.entryType==="resource";function la(n,s){for(var l=n.length-1;l>=0;l-=1)if(s(n[l]))return n[l]}function Zu(n,s,l){if(l.recordInitialRequests){var c=s.performance.getEntries().filter(_=>aa(_)||ss(_)&&l.initiatorTypes.includes(_.initiatorType));n({requests:c.flatMap(_=>ri({entry:_,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}var h=new s.PerformanceObserver(_=>{var w=_.getEntries().filter(S=>aa(S)||ss(S)&&l.initiatorTypes.includes(S.initiatorType)&&(I=>!l.recordBody&&!l.recordHeaders||I.initiatorType!=="xmlhttprequest"&&I.initiatorType!=="fetch")(S));n({requests:w.flatMap(S=>ri({entry:S,method:void 0,status:void 0,networkRequest:{}}))})}),f=PerformanceObserver.supportedEntryTypes.filter(_=>l.performanceEntryTypeToObserve.includes(_));return h.observe({entryTypes:f}),()=>{h.disconnect()}}function ei(n,s){return!!s&&(ns(s)||s[n])}function ti(n){var{type:s,recordBody:l,headers:c}=n;function h(_){var w=Object.keys(c).find(I=>I.toLowerCase()==="content-type"),S=w&&c[w];return _.some(I=>S==null?void 0:S.includes(I))}if(!l)return!1;if(ns(l))return!0;if(Qn(l))return h(l);var f=l[s];return ns(f)?f:h(f)}function os(n,s,l,c,h){return as.apply(this,arguments)}function as(){return as=o(function*(n,s,l,c,h){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(f>10)return sn.warn("Failed to get performance entry for request",{url:l,initiatorType:s}),null;var _=la(n.performance.getEntriesByName(l),w=>ss(w)&&w.initiatorType===s&&(Tr(c)||w.startTime>=c)&&(Tr(h)||w.startTime<=h));return _||(yield new Promise(w=>setTimeout(w,50*f)),os(n,s,l,c,h,f+1))}),as.apply(this,arguments)}function ua(n){var{body:s,options:l,url:c}=n;if(na(s))return null;var{hostname:h,isHostDenied:f}=is(c,l);if(f)return h+" is in deny list";if(Vu(s))return s;if(zu(s))return s.textContent;if(ia(s))return Yu(s);if(Uu(s))try{return JSON.stringify(s)}catch{return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(s)}var Xu=n=>!rs(n)&&(n.entryType==="navigation"||n.entryType==="resource");function ri(n){var{entry:s,method:l,status:c,networkRequest:h,isInitial:f,start:_,end:w,url:S,initiatorType:I}=n;_=s?s.startTime:_,w=s?s.responseEnd:w;var E=Math.floor(Date.now()-performance.now()),F=Math.floor(E+(_||0)),Z=[t(t({},s?s.toJSON():{name:S}),{},{startTime:Tr(_)?void 0:Math.round(_),endTime:Tr(w)?void 0:Math.round(w),timeOrigin:E,timestamp:F,method:l,initiatorType:I||(s?s.initiatorType:void 0),status:c,requestHeaders:h.requestHeaders,requestBody:h.requestBody,responseHeaders:h.responseHeaders,responseBody:h.responseBody,isInitial:f})];if(Xu(s))for(var H of s.serverTiming||[])Z.push({timeOrigin:E,timestamp:F,startTime:Math.round(s.startTime),name:H.name,duration:H.duration,entryType:"serverTiming"});return Z}var Ju=["video/","audio/"];function ca(n){return new Promise((s,l)=>{var c=setTimeout(()=>s("[SessionReplay] Timeout while trying to read body"),500);try{n.clone().text().then(h=>s(h),h=>l(h)).finally(()=>clearTimeout(c))}catch{clearTimeout(c),s("[SessionReplay] Failed to read body")}})}function da(){return(da=o(function*(n){var{r:s,options:l,url:c}=n,{hostname:h,isHostDenied:f}=is(c,l);return f?Promise.resolve(h+" is in deny list"):ca(s)})).apply(this,arguments)}function ha(){return(ha=o(function*(n){var{r:s,options:l,url:c}=n,h=function(f){var _,{r:w,options:S,url:I}=f;if(w.headers.get("Transfer-Encoding")==="chunked")return"Chunked Transfer-Encoding is not supported";var E=(_=w.headers.get("Content-Type"))===null||_===void 0?void 0:_.toLowerCase(),F=Ju.some(ie=>E==null?void 0:E.startsWith(ie));if(E&&F)return"Content-Type ".concat(E," is not supported");var{hostname:Z,isHostDenied:H}=is(I,S);return H?Z+" is in deny list":null}({r:s,options:l,url:c});return rs(h)?ca(s):Promise.resolve(h)})).apply(this,arguments)}function Ku(n,s,l){if(!l.initiatorTypes.includes("fetch"))return()=>{};var c=ei("request",l.recordHeaders),h=ei("response",l.recordHeaders),f=oa(s,"fetch",_=>function(){var w=o(function*(S,I){var E,F,Z,H=new Request(S,I),ie={};try{var he={};H.headers.forEach((P,N)=>{he[N]=P}),c&&(ie.requestHeaders=he),ti({type:"request",headers:he,url:S,recordBody:l.recordBody})&&(ie.requestBody=yield function(P){return da.apply(this,arguments)}({r:H,options:l,url:S})),F=s.performance.now(),E=yield _(H),Z=s.performance.now();var oe={};return E.headers.forEach((P,N)=>{oe[N]=P}),h&&(ie.responseHeaders=oe),ti({type:"response",headers:oe,url:S,recordBody:l.recordBody})&&(ie.responseBody=yield function(P){return ha.apply(this,arguments)}({r:E,options:l,url:S})),E}finally{os(s,"fetch",H.url,F,Z).then(P=>{var N,A=ri({entry:P,method:H.method,status:(N=E)===null||N===void 0?void 0:N.status,networkRequest:ie,start:F,end:Z,url:H.url,initiatorType:"fetch"});n({requests:A})}).catch(()=>{})}});return function(S,I){return w.apply(this,arguments)}}());return()=>{f()}}var pa=null;function Qu(n,s,l){if(!("performance"in s))return()=>{};if(pa)return sn.warn("Network observer already initialised, doing nothing"),()=>{};var c=l?Object.assign({},sa,l):sa,h=S=>{var I=[];S.requests.forEach(E=>{var F=c.maskRequestFn(E);F&&I.push(F)}),I.length>0&&n(t(t({},S),{},{requests:I}))},f=Zu(h,s,c),_=()=>{},w=()=>{};return(c.recordHeaders||c.recordBody)&&(_=function(S,I,E){if(!E.initiatorTypes.includes("xmlhttprequest"))return()=>{};var F=ei("request",E.recordHeaders),Z=ei("response",E.recordHeaders),H=oa(I.XMLHttpRequest.prototype,"open",ie=>function(he,oe){var P,N,A=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],j=arguments.length>3?arguments[3]:void 0,X=arguments.length>4?arguments[4]:void 0,K=this,Q=new Request(oe),re={},ce={},ge=K.setRequestHeader.bind(K);K.setRequestHeader=(z,Ce)=>(ce[z]=Ce,ge(z,Ce)),F&&(re.requestHeaders=ce);var Ie=K.send.bind(K);K.send=z=>(ti({type:"request",headers:ce,url:oe,recordBody:E.recordBody})&&(re.requestBody=ua({body:z,options:E,url:oe})),P=I.performance.now(),Ie(z)),K.addEventListener("readystatechange",()=>{if(K.readyState===K.DONE){N=I.performance.now();var z={};K.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(Ce=>{var ve=Ce.split(": "),me=ve.shift(),fe=ve.join(": ");me&&(z[me]=fe)}),Z&&(re.responseHeaders=z),ti({type:"response",headers:z,url:oe,recordBody:E.recordBody})&&(re.responseBody=ua({body:K.response,options:E,url:oe})),os(I,"xmlhttprequest",Q.url,P,N).then(Ce=>{var ve=ri({entry:Ce,method:he,status:K==null?void 0:K.status,networkRequest:re,start:P,end:N,url:oe.toString(),initiatorType:"xmlhttprequest"});S({requests:ve})}).catch(()=>{})}}),ie.call(K,he,oe,A,j,X)});return()=>{H()}}(h,s,c),w=Ku(h,s,c)),pa=()=>{f(),_(),w()}}var ga="rrweb/network@1",ls=n=>({name:ga,observer:Qu,options:n});kr.__PosthogExtensions__=kr.__PosthogExtensions__||{},kr.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Jo,getRecordNetworkPlugin:ls},kr.__PosthogExtensions__.rrweb={record:Hr,version:"v2"},kr.rrweb={record:Hr,version:"v2"},kr.rrwebConsoleRecord={getRecordConsolePlugin:Jo},kr.getRecordNetworkPlugin=ls,r.NETWORK_PLUGIN_NAME=ga,r.default=Hr,r.findLast=la,r.getRecordNetworkPlugin=ls,Object.defineProperty(r,"__esModule",{value:!0})})({});(function(){function r(M,T){var L=Object.keys(M);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(M);T&&(U=U.filter(function(de){return Object.getOwnPropertyDescriptor(M,de).enumerable})),L.push.apply(L,U)}return L}function e(M){for(var T=1;T<arguments.length;T++){var L=arguments[T]!=null?arguments[T]:{};T%2?r(Object(L),!0).forEach(function(U){t(M,U,L[U])}):Object.getOwnPropertyDescriptors?Object.defineProperties(M,Object.getOwnPropertyDescriptors(L)):r(Object(L)).forEach(function(U){Object.defineProperty(M,U,Object.getOwnPropertyDescriptor(L,U))})}return M}function t(M,T,L){return T in M?Object.defineProperty(M,T,{value:L,enumerable:!0,configurable:!0,writable:!0}):M[T]=L,M}var i=typeof window<"u"?window:void 0,o=typeof globalThis<"u"?globalThis:i,a=o==null?void 0:o.navigator;o==null||o.document,o==null||o.location,o==null||o.fetch,o!=null&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest&&o.XMLHttpRequest,o==null||o.AbortController,a==null||a.userAgent;var u,d=i??{},p="[PostHog.js]",m={_log:function(M){if(i&&d.POSTHOG_DEBUG&&!W(i.console)&&i.console){for(var T=("__rrweb_original__"in i.console[M])?i.console[M].__rrweb_original__:i.console[M],L=arguments.length,U=new Array(L>1?L-1:0),de=1;de<L;de++)U[de-1]=arguments[de];T(p,...U)}},info:function(){for(var M=arguments.length,T=new Array(M),L=0;L<M;L++)T[L]=arguments[L];m._log("log",...T)},warn:function(){for(var M=arguments.length,T=new Array(M),L=0;L<M;L++)T[L]=arguments[L];m._log("warn",...T)},error:function(){for(var M=arguments.length,T=new Array(M),L=0;L<M;L++)T[L]=arguments[L];m._log("error",...T)},critical:function(){for(var M=arguments.length,T=new Array(M),L=0;L<M;L++)T[L]=arguments[L];console.error(p,...T)},uninitializedWarning:M=>{m.error("You must initialize PostHog before calling ".concat(M))}};(function(M){M.GZipJS="gzip-js",M.Base64="base64"})(u||(u={}));var g=["fatal","error","warning","log","info","debug"],v=Array.isArray,b=Object.prototype.toString,y=v||function(M){return b.call(M)==="[object Array]"},k=M=>typeof M=="function",R=M=>M===Object(M)&&!y(M),W=M=>M===void 0,B=M=>b.call(M)=="[object String]",q=M=>B(M)&&M.trim().length===0,le=M=>M===null;function ue(M){return!W(Event)&&Ee(M,Event)}function Ee(M,T){try{return M instanceof T}catch{return!1}}function Ge(M){return le(M)||!R(M)&&!k(M)}function we(M,T){return Object.prototype.toString.call(M)==="[object ".concat(T,"]")}function _e(M){return we(M,"DOMError")}var Ne=/\(error: (.*)\)/,qe=50,Ze="?";function st(M,T,L,U){var de={platform:"web:javascript",filename:M,function:T==="<anonymous>"?Ze:T,in_app:!0};return W(L)||(de.lineno=L),W(U)||(de.colno=U),de}var It=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_t=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,lt=/\((\S*)(?::(\d+))(?::(\d+))\)/,ht=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Tt=function(){for(var M=arguments.length,T=new Array(M),L=0;L<M;L++)T[L]=arguments[L];var U=T.sort((de,Se)=>de[0]-Se[0]).map(de=>de[1]);return function(de){for(var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Fe=[],Ue=de.split(` `),Le=Se;Le<Ue.length;Le++){var rt=Ue[Le];if(!(rt.length>1024)){var Pt=Ne.test(rt)?rt.replace(Ne,"$1"):rt;if(!Pt.match(/\S*Error: /)){for(var Yt of U){var ye=Yt(Pt);if(ye){Fe.push(ye);break}}if(Fe.length>=qe)break}}}return function(at){if(!at.length)return[];var gt=Array.from(at);return gt.reverse(),gt.slice(0,qe).map(bt=>e(e({},bt),{},{filename:bt.filename||pt(gt).filename,function:bt.function||Ze}))}(Fe)}}([30,M=>{var T=It.exec(M);if(T){var[,L,U,de]=T;return st(L,Ze,+U,+de)}var Se=_t.exec(M);if(Se){if(Se[2]&&Se[2].indexOf("eval")===0){var Fe=lt.exec(Se[2]);Fe&&(Se[2]=Fe[1],Se[3]=Fe[2],Se[4]=Fe[3])}var[Ue,Le]=yt(Se[1]||Ze,Se[2]);return st(Le,Ue,Se[3]?+Se[3]:void 0,Se[4]?+Se[4]:void 0)}}],[50,M=>{var T=ht.exec(M);if(T){if(T[3]&&T[3].indexOf(" > eval")>-1){var L=kt.exec(T[3]);L&&(T[1]=T[1]||"eval",T[3]=L[1],T[4]=L[2],T[5]="")}var U=T[3],de=T[1]||Ze;return[de,U]=yt(de,U),st(U,de,T[4]?+T[4]:void 0,T[5]?+T[5]:void 0)}}]);function pt(M){return M[M.length-1]||{}}var yt=(M,T)=>{var L=M.indexOf("safari-extension")!==-1,U=M.indexOf("safari-web-extension")!==-1;return L||U?[M.indexOf("@")!==-1?M.split("@")[0]:Ze,L?"safari-extension:".concat(T):"safari-web-extension:".concat(T)]:[M,T]},zt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Qe(M){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,L=M.stacktrace||M.stack||"",U=function(Se){return Se&&Ve.test(Se.message)?1:0}(M);try{var de=Tt(L,U);return de.slice(0,de.length-T)}catch{}return[]}var Ve=/Minified React error #\d+;/i;function ze(M,T){var L,U,de=Qe(M),Se=(L=T==null?void 0:T.handled)===null||L===void 0||L,Fe=(U=T==null?void 0:T.synthetic)!==null&&U!==void 0&&U;return{$exception_list:[{type:T!=null&&T.overrideExceptionType?T.overrideExceptionType:M.name,value:T!=null&&T.overrideExceptionMessage?T.overrideExceptionMessage:function(Ue){var Le=Ue.message;return Le.error&&typeof Le.error.message=="string"?Le.error.message:Le}(M),stacktrace:{frames:de,type:"raw"},mechanism:{handled:Se,synthetic:Fe}}],$exception_level:"error"}}function ot(M,T){var L,U,de,Se=(L=T==null?void 0:T.handled)===null||L===void 0||L,Fe=(U=T==null?void 0:T.synthetic)===null||U===void 0||U,Ue={type:T!=null&&T.overrideExceptionType?T.overrideExceptionType:(de=T==null?void 0:T.defaultExceptionType)!==null&&de!==void 0?de:"Error",value:T!=null&&T.overrideExceptionMessage?T.overrideExceptionMessage:M||(T==null?void 0:T.defaultExceptionMessage),mechanism:{handled:Se,synthetic:Fe}};if(T!=null&&T.syntheticException){var Le=Qe(T.syntheticException,1);Le.length&&(Ue.stacktrace={frames:Le,type:"raw"})}return{$exception_list:[Ue],$exception_level:"error"}}function Rt(M,T){var L,U,de,Se=(L=T==null?void 0:T.handled)===null||L===void 0||L,Fe=(U=T==null?void 0:T.synthetic)===null||U===void 0||U,Ue=T!=null&&T.overrideExceptionType?T.overrideExceptionType:ue(M)?M.constructor.name:"Error",Le=T!=null&&T.overrideExceptionMessage?T.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(Yt){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,at=Object.keys(Yt);if(at.sort(),!at.length)return"[object has no keys]";for(var gt=at.length;gt>0;gt--){var bt=at.slice(0,gt).join(", ");if(!(bt.length>ye))return gt===at.length||bt.length<=ye?bt:"".concat(bt.slice(0,ye),"...")}return""}(M)),rt={type:Ue,value:Le,mechanism:{handled:Se,synthetic:Fe}};if(T!=null&&T.syntheticException){var Pt=Qe(T==null?void 0:T.syntheticException,1);Pt.length&&(rt.stacktrace={frames:Pt,type:"raw"})}return{$exception_list:[rt],$exception_level:(de=M.level,B(de)&&!q(de)&&g.indexOf(de)>=0?M.level:"error")}}function er(M,T){var[L,U,de,Se,Fe]=M,Ue={$exception_list:[]},Le=Fe||L;if(_e(Le)||function(x){return we(x,"DOMException")}(Le)){var rt=Le;if(function(x){return"stack"in x}(Le))Ue=ze(Le,T);else{var Pt=rt.name||(_e(rt)?"DOMError":"DOMException"),Yt=rt.message?"".concat(Pt,": ").concat(rt.message):Pt,ye=_e(rt)?"DOMError":"DOMException";Ue=ot(Yt,e(e({},T),{},{overrideExceptionType:ye,defaultExceptionMessage:Yt}))}return"code"in rt&&(Ue.$exception_DOMException_code="".concat(rt.code)),Ue}if(function(x){return we(x,"ErrorEvent")}(Le)&&Le.error)return ze(Le.error,T);if(function(x){switch(Object.prototype.toString.call(x)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Ee(x,Error)}}(Le))return ze(Le,T);if(function(x){return we(x,"Object")}(Le)||ue(Le))return Rt(Le,T);if(W(Fe)&&B(L)){var at="Error",gt=L,bt=L.match(zt);return bt&&(at=bt[1],gt=bt[2]),ot(gt,e(e({},T),{},{overrideExceptionType:at,defaultExceptionMessage:gt}))}return ot(Le,T)}function Dr(M){var[T]=M,L=function(U){if(Ge(U))return U;try{if("reason"in U)return U.reason;if("detail"in U&&"reason"in U.detail)return U.detail.reason}catch{}return U}(T);return Ge(L)?ot("Non-Error promise rejection captured with value: ".concat(String(L)),{handled:!1,synthetic:!1,overrideExceptionType:"UnhandledRejection"}):er([L],{handled:!1,overrideExceptionType:"UnhandledRejection",defaultExceptionMessage:String(L)})}var jt={wrapOnError:M=>{var T=i;T||m.info("window not available, cannot wrap onerror");var L=T.onerror;return T.onerror=function(){for(var U,de=arguments.length,Se=new Array(de),Fe=0;Fe<de;Fe++)Se[Fe]=arguments[Fe];var Ue=er(Se);return M(Ue),(U=L==null?void 0:L(...Se))!==null&&U!==void 0&&U},T.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var U;(U=T.onerror)===null||U===void 0||delete U.__POSTHOG_INSTRUMENTED__,T.onerror=L}},wrapUnhandledRejection:M=>{var T=i;T||m.info("window not available, cannot wrap onUnhandledRejection");var L=T.onunhandledrejection;return T.onunhandledrejection=function(){for(var U,de=arguments.length,Se=new Array(de),Fe=0;Fe<de;Fe++)Se[Fe]=arguments[Fe];var Ue=Dr(Se);return M(Ue),(U=L==null?void 0:L.apply(T,Se))!==null&&U!==void 0&&U},T.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var U;(U=T.onunhandledrejection)===null||U===void 0||delete U.__POSTHOG_INSTRUMENTED__,T.onunhandledrejection=L}}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=jt,d.__PosthogExtensions__.parseErrorAsProperties=er,d.posthogErrorWrappingFunctions=jt,d.parseErrorAsProperties=er})();(function(){function r(m,g,v,b,y,k,R){try{var W=m[k](R),B=W.value}catch(q){return void v(q)}W.done?g(B):Promise.resolve(B).then(b,y)}var e=typeof window<"u"?window:void 0,t=typeof globalThis<"u"?globalThis:e,i=t==null?void 0:t.navigator;t==null||t.document,t==null||t.location,t==null||t.fetch,t!=null&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest&&t.XMLHttpRequest,t==null||t.AbortController,i==null||i.userAgent;var o,a=e??{};(function(m){m.GZipJS="gzip-js",m.Base64="base64"})(o||(o={}));function u(m,g,v){try{if(!(g in m))return()=>{};var b=m[g],y=v(b);return typeof y=="function"&&(y.prototype=y.prototype||{},Object.defineProperties(y,{__posthog_wrapped__:{enumerable:!1,value:!0}})),m[g]=y,()=>{m[g]=b}}catch{return()=>{}}}var d=(m,g)=>{var{sessionId:v,windowId:b}=m.checkAndGetSessionAndWindowId(!0);g.headers.set("X-POSTHOG-SESSION-ID",v),g.headers.set("X-POSTHOG-WINDOW-ID",b)};a.__PosthogExtensions__=a.__PosthogExtensions__||{};var p={_patchFetch:m=>u(e,"fetch",g=>function(){var v,b=(v=function*(y,k){var R=new Request(y,k);return d(m,R),g(R)},function(){var y=this,k=arguments;return new Promise(function(R,W){var B=v.apply(y,k);function q(ue){r(B,R,W,q,le,"next",ue)}function le(ue){r(B,R,W,q,le,"throw",ue)}q(void 0)})});return function(y,k){return b.apply(this,arguments)}}()),_patchXHR:m=>u(e.XMLHttpRequest.prototype,"open",g=>function(v,b){var y=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],k=arguments.length>3?arguments[3]:void 0,R=arguments.length>4?arguments[4]:void 0,W=new Request(b);return d(m,W),g.call(this,v,W.url,y,k,R)})};a.__PosthogExtensions__.tracingHeadersPatchFns=p,a.postHogTracingHeadersPatchFns=p})();(function(){var r,e,t,i=-1,o=function(x){addEventListener("pageshow",function(D){D.persisted&&(i=D.timeStamp,x(D))},!0)},a=function(){var x=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(x&&x.responseStart>0&&x.responseStart<performance.now())return x},u=function(){var x=a();return x&&x.activationStart||0},d=function(x,D){var Y=a(),ee="navigate";return i>=0?ee="back-forward-cache":Y&&(document.prerendering||u()>0?ee="prerender":document.wasDiscarded?ee="restore":Y.type&&(ee=Y.type.replace(/_/g,"-"))),{name:x,value:D===void 0?-1:D,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:ee}},p=function(x,D,Y){try{if(PerformanceObserver.supportedEntryTypes.includes(x)){var ee=new PerformanceObserver(function($){Promise.resolve().then(function(){D($.getEntries())})});return ee.observe(Object.assign({type:x,buffered:!0},Y||{})),ee}}catch{}},m=function(x,D,Y,ee){var $,ke;return function(Ye){D.value>=0&&(Ye||ee)&&((ke=D.value-($||0))||$===void 0)&&($=D.value,D.delta=ke,D.rating=function($e,te){return $e>te[1]?"poor":$e>te[0]?"needs-improvement":"good"}(D.value,Y),x(D))}},g=function(x){requestAnimationFrame(function(){return requestAnimationFrame(function(){return x()})})},v=function(x){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&x()})},b=function(x){var D=!1;return function(){D||(x(),D=!0)}},y=-1,k=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},R=function(x){document.visibilityState==="hidden"&&y>-1&&(y=x.type==="visibilitychange"?x.timeStamp:0,B())},W=function(){addEventListener("visibilitychange",R,!0),addEventListener("prerenderingchange",R,!0)},B=function(){removeEventListener("visibilitychange",R,!0),removeEventListener("prerenderingchange",R,!0)},q=function(){return y<0&&(y=k(),W(),o(function(){setTimeout(function(){y=k(),W()},0)})),{get firstHiddenTime(){return y}}},le=function(x){document.prerendering?addEventListener("prerenderingchange",function(){return x()},!0):x()},ue=[1800,3e3],Ee=function(x,D){D=D||{},le(function(){var Y,ee=q(),$=d("FCP"),ke=p("paint",function(Ye){Ye.forEach(function($e){$e.name==="first-contentful-paint"&&(ke.disconnect(),$e.startTime<ee.firstHiddenTime&&($.value=Math.max($e.startTime-u(),0),$.entries.push($e),Y(!0)))})});ke&&(Y=m(x,$,ue,D.reportAllChanges),o(function(Ye){$=d("FCP"),Y=m(x,$,ue,D.reportAllChanges),g(function(){$.value=performance.now()-Ye.timeStamp,Y(!0)})}))})},Ge=[.1,.25],we=[2500,4e3],_e={},Ne=function(){var x=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(x&&x.responseStart>0&&x.responseStart<performance.now())return x},qe=function(x){if(document.readyState==="loading")return"loading";var D=Ne();if(D){if(x<D.domInteractive)return"loading";if(D.domContentLoadedEventStart===0||x<D.domContentLoadedEventStart)return"dom-interactive";if(D.domComplete===0||x<D.domComplete)return"dom-content-loaded"}return"complete"},Ze=function(x){var D=x.nodeName;return x.nodeType===1?D.toLowerCase():D.toUpperCase().replace(/^#/,"")},st=function(x,D){var Y="";try{for(;x&&x.nodeType!==9;){var ee=x,$=ee.id?"#"+ee.id:Ze(ee)+(ee.classList&&ee.classList.value&&ee.classList.value.trim()&&ee.classList.value.trim().length?"."+ee.classList.value.trim().replace(/\s+/g,"."):"");if(Y.length+$.length>(D||100)-1)return Y||$;if(Y=Y?$+">"+Y:$,ee.id)break;x=ee.parentNode}}catch{}return Y},It=-1,_t=function(x,D){var Y=Ne(),ee="navigate";return It>=0?ee="back-forward-cache":Y&&(document.prerendering||function(){var $=Ne();return $&&$.activationStart||0}()>0?ee="prerender":document.wasDiscarded?ee="restore":Y.type&&(ee=Y.type.replace(/_/g,"-"))),{name:x,value:-1,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:ee}},lt=function(x,D,Y){try{if(PerformanceObserver.supportedEntryTypes.includes(x)){var ee=new PerformanceObserver(function($){Promise.resolve().then(function(){D($.getEntries())})});return ee.observe(Object.assign({type:x,buffered:!0},Y||{})),ee}}catch{}},ht=function(x,D,Y,ee){var $,ke;return function(Ye){D.value>=0&&(Ye||ee)&&((ke=D.value-($||0))||$===void 0)&&($=D.value,D.delta=ke,D.rating=function($e,te){return $e>te[1]?"poor":$e>te[0]?"needs-improvement":"good"}(D.value,Y),x(D))}},kt=function(x){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&x()})},Tt=0,pt=1/0,yt=0,zt=function(x){x.forEach(function(D){D.interactionId&&(pt=Math.min(pt,D.interactionId),yt=Math.max(yt,D.interactionId),Tt=yt?(yt-pt)/7+1:0)})},Qe=function(){"interactionCount"in performance||r||(r=lt("event",zt,{type:"event",buffered:!0,durationThreshold:0}))},Ve=[],ze=new Map,ot=0,Rt=function(){return(r?Tt:performance.interactionCount||0)-ot},er=[],Dr=function(x){if(er.forEach(function($){return $(x)}),x.interactionId||x.entryType==="first-input"){var D=Ve[Ve.length-1],Y=ze.get(x.interactionId);if(Y||Ve.length<10||x.duration>D.latency){if(Y)x.duration>Y.latency?(Y.entries=[x],Y.latency=x.duration):x.duration===Y.latency&&x.startTime===Y.entries[0].startTime&&Y.entries.push(x);else{var ee={id:x.interactionId,latency:x.duration,entries:[x]};ze.set(ee.id,ee),Ve.push(ee)}Ve.sort(function($,ke){return ke.latency-$.latency}),Ve.length>10&&Ve.splice(10).forEach(function($){return ze.delete($.id)})}}},jt=function(x){var D=self.requestIdleCallback||self.setTimeout,Y=-1;return x=function(ee){var $=!1;return function(){$||(ee(),$=!0)}}(x),document.visibilityState==="hidden"?x():(Y=D(x),kt(x)),Y},M=[200,500],T=function(x,D){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(D=D||{},function(Y){document.prerendering?addEventListener("prerenderingchange",function(){return Y()},!0):Y()}(function(){var Y;Qe();var ee,$=_t("INP"),ke=function($e){jt(function(){$e.forEach(Dr);var te,Me=(te=Math.min(Ve.length-1,Math.floor(Rt()/50)),Ve[te]);Me&&Me.latency!==$.value&&($.value=Me.latency,$.entries=Me.entries,ee())})},Ye=lt("event",ke,{durationThreshold:(Y=D.durationThreshold)!==null&&Y!==void 0?Y:40});ee=ht(x,$,M,D.reportAllChanges),Ye&&(Ye.observe({type:"first-input",buffered:!0}),kt(function(){ke(Ye.takeRecords()),ee(!0)}),function($e){addEventListener("pageshow",function(te){te.persisted&&(It=te.timeStamp,$e(te))},!0)}(function(){ot=0,Ve.length=0,ze.clear(),$=_t("INP"),ee=ht(x,$,M,D.reportAllChanges)}))}))},L=[],U=[],de=new WeakMap,Se=new Map,Fe=-1,Ue=function(x){L=L.concat(x),Le()},Le=function(){Fe<0&&(Fe=jt(rt))},rt=function(){Se.size>10&&Se.forEach(function($e,te){ze.has(te)||Se.delete(te)});var x=Ve.map(function($e){return de.get($e.entries[0])}),D=U.length-50;U=U.filter(function($e,te){return te>=D||x.includes($e)});for(var Y=new Set,ee=0;ee<U.length;ee++){var $=U[ee];Pt($.startTime,$.processingEnd).forEach(function($e){Y.add($e)})}for(var ke=0;ke<50;ke++){var Ye=L[L.length-1-ke];if(!Ye||Ye.startTime<t)break;Y.add(Ye)}L=Array.from(Y),Fe=-1};er.push(function(x){x.interactionId&&x.target&&!Se.has(x.interactionId)&&Se.set(x.interactionId,x.target)},function(x){var D,Y=x.startTime+x.duration;t=Math.max(t,x.processingEnd);for(var ee=U.length-1;ee>=0;ee--){var $=U[ee];if(Math.abs(Y-$.renderTime)<=8){(D=$).startTime=Math.min(x.startTime,D.startTime),D.processingStart=Math.min(x.processingStart,D.processingStart),D.processingEnd=Math.max(x.processingEnd,D.processingEnd),D.entries.push(x);break}}D||(D={startTime:x.startTime,processingStart:x.processingStart,processingEnd:x.processingEnd,renderTime:Y,entries:[x]},U.push(D)),(x.interactionId||x.entryType==="first-input")&&de.set(x,D),Le()});var Pt=function(x,D){for(var Y,ee=[],$=0;Y=L[$];$++)if(!(Y.startTime+Y.duration<x)){if(Y.startTime>D)break;ee.push(Y)}return ee},Yt=typeof window<"u"?window:void 0,ye=typeof globalThis<"u"?globalThis:Yt,at=ye==null?void 0:ye.navigator;ye==null||ye.document,ye==null||ye.location,ye==null||ye.fetch,ye!=null&&ye.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest&&ye.XMLHttpRequest,ye==null||ye.AbortController,at==null||at.userAgent;var gt=Yt??{},bt={onLCP:function(x,D){D=D||{},le(function(){var Y,ee=q(),$=d("LCP"),ke=function(te){D.reportAllChanges||(te=te.slice(-1)),te.forEach(function(Me){Me.startTime<ee.firstHiddenTime&&($.value=Math.max(Me.startTime-u(),0),$.entries=[Me],Y())})},Ye=p("largest-contentful-paint",ke);if(Ye){Y=m(x,$,we,D.reportAllChanges);var $e=b(function(){_e[$.id]||(ke(Ye.takeRecords()),Ye.disconnect(),_e[$.id]=!0,Y(!0))});["keydown","click"].forEach(function(te){addEventListener(te,function(){return function(Me){var Gt=self.requestIdleCallback||self.setTimeout,ar=-1;return Me=b(Me),document.visibilityState==="hidden"?Me():(ar=Gt(Me),v(Me)),ar}($e)},!0)}),v($e),o(function(te){$=d("LCP"),Y=m(x,$,we,D.reportAllChanges),g(function(){$.value=performance.now()-te.timeStamp,_e[$.id]=!0,Y(!0)})})}})},onCLS:function(x,D){D=D||{},Ee(b(function(){var Y,ee=d("CLS",0),$=0,ke=[],Ye=function(te){te.forEach(function(Me){if(!Me.hadRecentInput){var Gt=ke[0],ar=ke[ke.length-1];$&&Me.startTime-ar.startTime<1e3&&Me.startTime-Gt.startTime<5e3?($+=Me.value,ke.push(Me)):($=Me.value,ke=[Me])}}),$>ee.value&&(ee.value=$,ee.entries=ke,Y())},$e=p("layout-shift",Ye);$e&&(Y=m(x,ee,Ge,D.reportAllChanges),v(function(){Ye($e.takeRecords()),Y(!0)}),o(function(){$=0,ee=d("CLS",0),Y=m(x,ee,Ge,D.reportAllChanges),g(function(){return Y()})}),setTimeout(Y,0))}))},onFCP:Ee,onINP:function(x,D){e||(e=lt("long-animation-frame",Ue)),T(function(Y){var ee=function($){var ke=$.entries[0],Ye=de.get(ke),$e=ke.processingStart,te=Ye.processingEnd,Me=Ye.entries.sort(function(cr,Wn){return cr.processingStart-Wn.processingStart}),Gt=Pt(ke.startTime,te),ar=$.entries.find(function(cr){return cr.target}),Sr=ar&&ar.target||Se.get(ke.interactionId),Xr=[ke.startTime+ke.duration,te].concat(Gt.map(function(cr){return cr.startTime+cr.duration})),ur=Math.max.apply(Math,Xr),Jr={interactionTarget:st(Sr),interactionTargetElement:Sr,interactionType:ke.name.startsWith("key")?"keyboard":"pointer",interactionTime:ke.startTime,nextPaintTime:ur,processedEventEntries:Me,longAnimationFrameEntries:Gt,inputDelay:$e-ke.startTime,processingDuration:te-$e,presentationDelay:Math.max(ur-te,0),loadState:qe(ke.startTime)};return Object.assign($,{attribution:Jr})}(Y);x(ee)},D)}};gt.__PosthogExtensions__=gt.__PosthogExtensions__||{},gt.__PosthogExtensions__.postHogWebVitalsCallbacks=bt,gt.postHogWebVitalsCallbacks=bt})();var C=typeof window<"u"?window:void 0,Wt=typeof globalThis<"u"?globalThis:C,pl=Array.prototype,fa=pl.forEach,va=pl.indexOf,Vt=Wt==null?void 0:Wt.navigator,ne=Wt==null?void 0:Wt.document,Ht=Wt==null?void 0:Wt.location,Ss=Wt==null?void 0:Wt.fetch,Is=Wt!=null&&Wt.XMLHttpRequest&&"withCredentials"in new Wt.XMLHttpRequest?Wt.XMLHttpRequest:void 0,ma=Wt==null?void 0:Wt.AbortController,St=Vt==null?void 0:Vt.userAgent,Ae=C??{},Rr={DEBUG:!1,LIB_VERSION:"1.189.0"},fi={},Mi=function(r){return r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function cn(r,e,t){if(ct(r)){if(fa&&r.forEach===fa)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,o=r.length;i<o;i++)if(i in r&&e.call(t,r[i],i)===fi)return}}}function Xe(r,e,t){if(!Je(r)){if(ct(r))return cn(r,e,t);if(mc(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===fi)return}else for(var o in r)if(vl.call(r,o)&&e.call(t,r[o],o)===fi)return}}var Ft=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return cn(t,function(o){for(var a in o)o[a]!==void 0&&(r[a]=o[a])}),r};function Pe(r,e){return r.indexOf(e)!==-1}function pi(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var _a=function(r){try{return r()}catch{return}},hc=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(o){O.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),O.critical(o)}}},vi=function(r){var e={};return Xe(r,function(t,i){xt(t)&&t.length>0&&(e[i]=t)}),e},Cs=function(r){return r.replace(/^\$/,"")};function pc(r,e){return t=r,i=a=>xt(a)&&!Lr(e)?a.slice(0,e):a,o=new Set,function a(u,d){return u!==Object(u)?i?i(u,d):u:o.has(u)?void 0:(o.add(u),ct(u)?(p=[],cn(u,m=>{p.push(a(m))})):(p={},Xe(u,(m,g)=>{o.has(m)||(p[g]=a(m,g))})),p);var p}(t);var t,i,o}var gc=function(r){var e,t,i,o,a="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,` `).replace(/\r/g,` `)).length,o=0;o<i;o++){var u=r.charCodeAt(o),d=null;u<128?t++:d=u>127&&u<2048?String.fromCharCode(u>>6|192,63&u|128):String.fromCharCode(u>>12|224,u>>6&63|128,63&u|128),Lr(d)||(t>e&&(a+=r.substring(e,t)),a+=d,e=t=o+1)}return t>e&&(a+=r.substring(e,r.length)),a},yr=function(){function r(e){return e&&(e.preventDefault=r.preventDefault,e.stopPropagation=r.stopPropagation),e}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},function(e,t,i,o,a){if(e)if(e.addEventListener&&!o)e.addEventListener(t,i,!!a);else{var u="on"+t,d=e[u];e[u]=function(p,m,g){return function(v){if(v=v||r(C==null?void 0:C.event)){var b,y=!0;Jt(g)&&(b=g(v));var k=m.call(p,v);return b!==!1&&k!==!1||(y=!1),y}}}(e,i,d)}else O.error("No valid element provided to register_event")}}();function gl(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}var or,ds="$copy_autocapture",fc=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(r){r.GZipJS="gzip-js",r.Base64="base64"})(or||(or={}));var vc=Array.isArray,fl=Object.prototype,vl=fl.hasOwnProperty,Ai=fl.toString,ct=vc||function(r){return Ai.call(r)==="[object Array]"},Jt=r=>typeof r=="function",dt=r=>r===Object(r)&&!ct(r),an=r=>{if(dt(r)){for(var e in r)if(vl.call(r,e))return!1;return!0}return!1},pe=r=>r===void 0,xt=r=>Ai.call(r)=="[object String]",ya=r=>xt(r)&&r.trim().length===0,Lr=r=>r===null,Je=r=>pe(r)||Lr(r),Ut=r=>Ai.call(r)=="[object Number]",zr=r=>Ai.call(r)==="[object Boolean]",mc=r=>r instanceof FormData,_c=r=>Pe(fc,r),ba="[PostHog.js]",O={_log:function(r){if(C&&(Rr.DEBUG||Ae.POSTHOG_DEBUG)&&!pe(C.console)&&C.console){for(var e=("__rrweb_original__"in C.console[r])?C.console[r].__rrweb_original__:C.console[r],t=arguments.length,i=new Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];e(ba,...i)}},info:function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];O._log("log",...e)},warn:function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];O._log("warn",...e)},error:function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];O._log("error",...e)},critical:function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];console.error(ba,...e)},uninitializedWarning:r=>{O.error("You must initialize PostHog before calling ".concat(r))}},wa=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return O.warn("".concat(e," was requested but loading of external scripts is disabled.")),t("Loading of external scripts is disabled");var i=()=>{if(!ne)return t("document not found");var o=ne.createElement("script");o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=d=>t(void 0,d),o.onerror=d=>t(d);var a,u=ne.querySelectorAll("body > script");u.length>0?(a=u[0].parentNode)===null||a===void 0||a.insertBefore(o,u[0]):ne.body.appendChild(o)};ne!=null&&ne.body?i():ne==null||ne.addEventListener("DOMContentLoaded",i)};function Sa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable})),t.push.apply(t,i)}return t}function G(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(t),!0).forEach(function(i){J(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sa(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function J(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yc(r,e){if(r==null)return{};var t,i,o=function(u,d){if(u==null)return{};var p,m,g={},v=Object.keys(u);for(m=0;m<v.length;m++)p=v[m],d.indexOf(p)>=0||(g[p]=u[p]);return g}(r,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)t=a[i],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(r,t)&&(o[t]=r[t])}return o}Ae.__PosthogExtensions__=Ae.__PosthogExtensions__||{},Ae.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/".concat(e,".js")+"?v=".concat(r.version);if(e==="toolbar"){var o=3e5,a=Math.floor(Date.now()/o)*o;i="".concat(i,"&t=").concat(a)}var u=r.requestRouter.endpointFor("assets",i);wa(r,u,t)},Ae.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);wa(r,i,t)};var ml="$people_distinct_id",xn="__alias",Rn="__timers",Ia="$autocapture_disabled_server_side",Es="$heatmaps_enabled_server_side",Ca="$exception_capture_enabled_server_side",Ea="$web_vitals_enabled_server_side",_l="$dead_clicks_enabled_server_side",ka="$web_vitals_allowed_metrics",ks="$session_recording_enabled_server_side",Ta="$console_log_recording_enabled_server_side",xa="$session_recording_network_payload_capture",Ra="$session_recording_canvas_recording",Ma="$replay_sample_rate",Aa="$replay_minimum_duration",mi="$sesid",Mn="$session_is_sampled",hs="$session_recording_url_trigger_activated_session",ps="$session_recording_event_trigger_activated_session",ln="$enabled_feature_flags",Ts="$early_access_features",un="$stored_person_properties",Mr="$stored_group_properties",xs="$surveys",ii="$surveys_activated",_i="$flag_call_reported",vr="$user_state",Rs="$client_session_props",Ms="$capture_rate_limit",As="$initial_campaign_params",Os="$initial_referrer_info",Oa="$initial_person_info",yi="$epp",yl="__POSTHOG_TOOLBAR__",bc=[ml,xn,"__cmpns",Rn,ks,Es,mi,ln,vr,Ts,Mr,un,xs,_i,Rs,Ms,As,Os,yi],gs="$active_feature_flags",si="$override_feature_flags",Na="$feature_flag_payloads",Fa=r=>{var e={};for(var[t,i]of pi(r||{}))i&&(e[t]=i);return e};class wc{constructor(e){this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(ln),t=this.instance.get_property(si);if(!t)return e||{};for(var i=Ft({},e),o=Object.keys(t),a=0;a<o.length;a++)i[o[a]]=t[o[a]];return this._override_warning||(O.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){return this.instance.get_property(Na)||{}}reloadFeatureFlags(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.reloadFeatureFlagsInAction=e}resetRequestQueue(){this.reloadFeatureFlagsQueued=!1}_startReloadTimer(){this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(()=>{!this.reloadFeatureFlagsInAction&&this.reloadFeatureFlagsQueued&&(this.reloadFeatureFlagsQueued=!1,this._reloadFeatureFlagsRequest())},5)}_reloadFeatureFlagsRequest(){if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var e=this.instance.config.token,t=this.instance.get_property(un),i=this.instance.get_property(Mr),o={token:e,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:t,group_properties:i,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:o,compression:this.instance.config.disable_compression?void 0:or.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:a=>{var u;this.setReloadingPaused(!1);var d=!0;a.statusCode===200&&(this.$anon_distinct_id=void 0,d=!1),this.receivedFeatureFlags((u=a.json)!==null&&u!==void 0?u:{},d),this._startReloadTimer()}})}}getFeatureFlag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var i,o=this.getFlagVariants()[e],a="".concat(o),u=this.instance.get_property(_i)||{};return(t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))&&(ct(u[e])?u[e].push(a):u[e]=[a],(i=this.instance.persistence)===null||i===void 0||i.register({[_i]:u}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:o})),o}O.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);O.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var i=this.getFlagVariants(),o=this.getFlagPayloads();(function(a,u){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},m=a.featureFlags,g=a.featureFlagPayloads;if(m)if(ct(m)){var v={};if(m)for(var b=0;b<m.length;b++)v[m[b]]=!0;u&&u.register({[gs]:m,[ln]:v})}else{var y=m,k=g;a.errorsWhileComputingFlags&&(y=G(G({},d),y),k=G(G({},p),k)),u&&u.register({[gs]:Object.keys(Fa(y)),[ln]:y||{},[Na]:k||{}})}})(e,this.instance.persistence,i,o),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return O.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,e===!1)this.instance.persistence.unregister(si);else if(ct(e)){for(var i={},o=0;o<e.length;o++)i[e[o]]=!0;this.instance.persistence.register({[si]:i})}else this.instance.persistence.register({[si]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var i,o={["$feature_enrollment/".concat(e)]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:o}),this.setPersonPropertiesForFlags(o,!1);var a=G(G({},this.getFlagVariants()),{},{[e]:t});(i=this.instance.persistence)===null||i===void 0||i.register({[gs]:Object.keys(Fa(a)),[ln]:a}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],i=this.instance.get_property(Ts);if(i&&!t)return e(i);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:o=>{var a;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this.instance.persistence)===null||a===void 0||a.register({[Ts]:u}),e(u)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,o)=>(i[o]=t[o],i),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(o=>o(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=this.instance.get_property(un)||{};this.instance.register({[un]:G(G({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(un)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],i=this.instance.get_property(Mr)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(o=>{i[o]=G(G({},i[o]),e[o]),delete e[o]}),this.instance.register({[Mr]:G(G({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(Mr)||{};this.instance.register({[Mr]:G(G({},t),{},{[e]:{}})})}else this.instance.unregister(Mr)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Ut(r)&&isFinite(r)&&Math.floor(r)===r});var Pa="0123456789abcdef";class bi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,o){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(o)||e<0||t<0||i<0||o<0||e>0xffffffffffff||t>4095||i>1073741823||o>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=e/Math.pow(2,40),a[1]=e/Math.pow(2,32),a[2]=e/Math.pow(2,24),a[3]=e/Math.pow(2,16),a[4]=e/Math.pow(2,8),a[5]=e,a[6]=112|t>>>8,a[7]=t,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=o>>>24,a[13]=o>>>16,a[14]=o>>>8,a[15]=o,new bi(a)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Pa.charAt(this.bytes[t]>>>4)+Pa.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new bi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class Sc{constructor(){J(this,"timestamp",0),J(this,"counter",0),J(this,"random",new Ic)}generate(){var e=this.generateOrAbort();if(pe(e)){this.timestamp=0;var t=this.generateOrAbort();if(pe(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return bi.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var La,bl=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};C&&!pe(C.crypto)&&crypto.getRandomValues&&(bl=r=>crypto.getRandomValues(r));class Ic{constructor(){J(this,"buffer",new Uint32Array(8)),J(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(bl(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Or=()=>Cc().toString(),Cc=()=>(La||(La=new Sc)).generate(),Ec="Thu, 01 Jan 1970 00:00:00 GMT",Cn="",kc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Tc(r,e){if(e){var t=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ne;if(Cn)return Cn;if(!a||["localhost","127.0.0.1"].includes(o))return"";for(var u=o.split("."),d=Math.min(u.length,8),p="dmn_chk_"+Or(),m=new RegExp("(^|;)\\s*"+p+"=1");!Cn&&d--;){var g=u.slice(d).join("."),v=p+"=1;domain=."+g;a.cookie=v,m.test(a.cookie)&&(a.cookie=v+";expires="+Ec,Cn=g)}return Cn}(r);if(!t){var i=(o=>{var a=o.match(kc);return a?a[0]:""})(r);i!==t&&O.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var wr={is_supported:()=>!!ne,error:function(r){O.error("cookieStore error: "+r)},get:function(r){if(ne){try{for(var e=r+"=",t=ne.cookie.split(";").filter(a=>a.length),i=0;i<t.length;i++){for(var o=t[i];o.charAt(0)==" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return decodeURIComponent(o.substring(e.length,o.length))}}catch{}return null}},parse:function(r){var e;try{e=JSON.parse(wr.get(r))||{}}catch{}return e},set:function(r,e,t,i,o){if(ne)try{var a="",u="",d=Tc(ne.location.hostname,i);if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),a="; expires="+p.toUTCString()}o&&(u="; secure");var m=r+"="+encodeURIComponent(JSON.stringify(e))+a+"; SameSite=Lax; path=/"+d+u;return m.length>3686.4&&O.warn("cookieStore warning: large cookie, len="+m.length),ne.cookie=m,m}catch{return}},remove:function(r,e){try{wr.set(r,"",-1,e)}catch{return}}},fs=null,mt={is_supported:function(){if(!Lr(fs))return fs;var r=!0;if(pe(C))r=!1;else try{var e="__mplssupport__";mt.set(e,"xyz"),mt.get(e)!=='"xyz"'&&(r=!1),mt.remove(e)}catch{r=!1}return r||O.error("localStorage unsupported; falling back to cookie store"),fs=r,r},error:function(r){O.error("localStorage error: "+r)},get:function(r){try{return C==null?void 0:C.localStorage.getItem(r)}catch(e){mt.error(e)}return null},parse:function(r){try{return JSON.parse(mt.get(r))||{}}catch{}return null},set:function(r,e){try{C==null||C.localStorage.setItem(r,JSON.stringify(e))}catch(t){mt.error(t)}},remove:function(r){try{C==null||C.localStorage.removeItem(r)}catch(e){mt.error(e)}}},xc=["distinct_id",mi,Mn,yi],oi=G(G({},mt),{},{parse:function(r){try{var e={};try{e=wr.parse(r)||{}}catch{}var t=Ft(e,JSON.parse(mt.get(r)||"{}"));return mt.set(r,t),t}catch{}return null},set:function(r,e,t,i,o,a){try{mt.set(r,e,void 0,void 0,a);var u={};xc.forEach(d=>{e[d]&&(u[d]=e[d])}),Object.keys(u).length&&wr.set(r,u,t,i,o,a)}catch(d){mt.error(d)}},remove:function(r,e){try{C==null||C.localStorage.removeItem(r),wr.remove(r,e)}catch(t){mt.error(t)}}}),ai={},Rc={is_supported:function(){return!0},error:function(r){O.error("memoryStorage error: "+r)},get:function(r){return ai[r]||null},parse:function(r){return ai[r]||null},set:function(r,e){ai[r]=e},remove:function(r){delete ai[r]}},$r=null,Et={is_supported:function(){if(!Lr($r))return $r;if($r=!0,pe(C))$r=!1;else try{var r="__support__";Et.set(r,"xyz"),Et.get(r)!=='"xyz"'&&($r=!1),Et.remove(r)}catch{$r=!1}return $r},error:function(r){O.error("sessionStorage error: ",r)},get:function(r){try{return C==null?void 0:C.sessionStorage.getItem(r)}catch(e){Et.error(e)}return null},parse:function(r){try{return JSON.parse(Et.get(r))||null}catch{}return null},set:function(r,e){try{C==null||C.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){Et.error(t)}},remove:function(r){try{C==null||C.sessionStorage.removeItem(r)}catch(e){Et.error(e)}}},Mc=["localhost","127.0.0.1"],dn=r=>{var e=ne==null?void 0:ne.createElement("a");return pe(e)?null:(e.href=r,e)},gn=function(r,e){return!!function(t){try{new RegExp(t)}catch{return!1}return!0}(e)&&new RegExp(e).test(r)},Ac=function(r){var e,t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",o=[];return Xe(r,function(a,u){pe(a)||pe(u)||u==="undefined"||(e=encodeURIComponent((d=>d instanceof File)(a)?a.name:a.toString()),t=encodeURIComponent(u),o[o.length]=t+"="+e)}),o.join(i)},wi=function(r,e){for(var t,i=((r.split("#")[0]||"").split("?")[1]||"").split("&"),o=0;o<i.length;o++){var a=i[o].split("=");if(a[0]===e){t=a;break}}if(!ct(t)||t.length<2)return"";var u=t[1];try{u=decodeURIComponent(u)}catch{O.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Si=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Kt="Mobile",Ii="iOS",lr="Android",Pn="Tablet",wl=lr+" "+Pn,Sl="iPad",Il="Apple",Cl=Il+" Watch",Ln="Safari",fn="BlackBerry",El="Samsung",kl=El+"Browser",Tl=El+" Internet",Fr="Chrome",Oc=Fr+" OS",xl=Fr+" "+Ii,Xs="Internet Explorer",Rl=Xs+" "+Kt,Js="Opera",Nc=Js+" Mini",Ks="Edge",Ml="Microsoft "+Ks,hn="Firefox",Al=hn+" "+Ii,Dn="Nintendo",Bn="PlayStation",pn="Xbox",Ol=lr+" "+Kt,Nl=Kt+" "+Ln,An="Windows",Ns=An+" Phone",Da="Nokia",Fs="Ouya",Fl="Generic",Fc=Fl+" "+Kt.toLowerCase(),Pl=Fl+" "+Pn.toLowerCase(),Ps="Konqueror",Nt="(\\d+(\\.\\d+)?)",vs=new RegExp("Version/"+Nt),Pc=new RegExp(pn,"i"),Lc=new RegExp(Bn+" \\w+","i"),Dc=new RegExp(Dn+" \\w+","i"),Qs=new RegExp(fn+"|PlayBook|BB10","i"),Bc={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Hc=(r,e)=>e&&Pe(e,Il)||function(t){return Pe(t,Ln)&&!Pe(t,Fr)&&!Pe(t,lr)}(r),Ba=function(r,e){return e=e||"",Pe(r," OPR/")&&Pe(r,"Mini")?Nc:Pe(r," OPR/")?Js:Qs.test(r)?fn:Pe(r,"IE"+Kt)||Pe(r,"WPDesktop")?Rl:Pe(r,kl)?Tl:Pe(r,Ks)||Pe(r,"Edg/")?Ml:Pe(r,"FBIOS")?"Facebook "+Kt:Pe(r,"UCWEB")||Pe(r,"UCBrowser")?"UC Browser":Pe(r,"CriOS")?xl:Pe(r,"CrMo")?Fr:Pe(r,lr)&&Pe(r,Ln)?Ol:Pe(r,Fr)?Fr:Pe(r,"FxiOS")?Al:Pe(r.toLowerCase(),Ps.toLowerCase())?Ps:Hc(r,e)?Pe(r,Kt)?Nl:Ln:Pe(r,hn)?hn:Pe(r,"MSIE")||Pe(r,"Trident/")?Xs:Pe(r,"Gecko")?hn:""},Wc={[Rl]:[new RegExp("rv:"+Nt)],[Ml]:[new RegExp(Ks+"?\\/"+Nt)],[Fr]:[new RegExp("("+Fr+"|CrMo)\\/"+Nt)],[xl]:[new RegExp("CriOS\\/"+Nt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Nt)],[Ln]:[vs],[Nl]:[vs],[Js]:[new RegExp("(Opera|OPR)\\/"+Nt)],[hn]:[new RegExp(hn+"\\/"+Nt)],[Al]:[new RegExp("FxiOS\\/"+Nt)],[Ps]:[new RegExp("Konqueror[:/]?"+Nt,"i")],[fn]:[new RegExp(fn+" "+Nt),vs],[Ol]:[new RegExp("android\\s"+Nt,"i")],[Tl]:[new RegExp(kl+"\\/"+Nt)],[Xs]:[new RegExp("(rv:|MSIE )"+Nt)],Mozilla:[new RegExp("rv:"+Nt)]},Ha=[[new RegExp(pn+"; "+pn+" (.*?)[);]","i"),r=>[pn,r&&r[1]||""]],[new RegExp(Dn,"i"),[Dn,""]],[new RegExp(Bn,"i"),[Bn,""]],[Qs,[fn,""]],[new RegExp(An,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ns,""];if(new RegExp(Kt).test(e)&&!/IEMobile\b/.test(e))return[An+" "+Kt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],o=Bc[i]||"";return/arm/i.test(e)&&(o="RT"),[An,o]}return[An,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Ii,e.join(".")]}return[Ii,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=pe(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+lr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lr+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[lr,e.join(".")]}return[lr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Oc,""]],[/Linux|debian/i,["Linux",""]]],Wa=function(r){return Dc.test(r)?Dn:Lc.test(r)?Bn:Pc.test(r)?pn:new RegExp(Fs,"i").test(r)?Fs:new RegExp("("+Ns+"|WPDesktop)","i").test(r)?Ns:/iPad/.test(r)?Sl:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Cl:Qs.test(r)?fn:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Da,"i").test(r)?Da:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?!new RegExp(Kt).test(r)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)?/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?lr:wl:lr:new RegExp("(pda|"+Kt+")","i").test(r)?Fc:new RegExp(Pn,"i").test(r)&&!new RegExp(Pn+" pc","i").test(r)?Pl:""},li="https?://(.*)",$c=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],ut={campaignParams:function(r){return ne?this._campaignParamsFromUrl(ne.URL,r):{}},_campaignParamsFromUrl:function(r,e){var t=$c.concat(e||[]),i={};return Xe(t,function(o){var a=wi(r,o);i[o]=a||null}),i},_searchEngine:function(r){return r?r.search(li+"google.([^/?]*)")===0?"google":r.search(li+"bing.com")===0?"bing":r.search(li+"yahoo.com")===0?"yahoo":r.search(li+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(r){var e=ut._searchEngine(r),t=e!="yahoo"?"q":"p",i={};if(!Lr(e)){i.$search_engine=e;var o=ne?wi(ne.referrer,t):"";o.length&&(i.ph_keyword=o)}return i},searchInfo:function(){var r=ne==null?void 0:ne.referrer;return r?this._searchInfoFromReferrer(r):{}},browser:Ba,browserVersion:function(r,e){var t=Ba(r,e),i=Wc[t];if(pe(i))return null;for(var o=0;o<i.length;o++){var a=i[o],u=r.match(a);if(u)return parseFloat(u[u.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(r){for(var e=0;e<Ha.length;e++){var[t,i]=Ha[e],o=t.exec(r),a=o&&(Jt(i)?i(o,r):i);if(a)return a}return["",""]},device:Wa,deviceType:function(r){var e=Wa(r);return e===Sl||e===wl||e==="Kobo"||e==="Kindle Fire"||e===Pl?Pn:e===Dn||e===pn||e===Bn||e===Fs?"Console":e===Cl?"Wearable":e?Kt:"Desktop"},referrer:function(){return(ne==null?void 0:ne.referrer)||"$direct"},referringDomain:function(){var r;return ne!=null&&ne.referrer&&((r=dn(ne.referrer))===null||r===void 0?void 0:r.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:Ht==null?void 0:Ht.href}},initialPersonPropsFromInfo:function(r){var e,{r:t,u:i}=r,o={$initial_referrer:t,$initial_referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=dn(t))===null||e===void 0?void 0:e.host};if(i){o.$initial_current_url=i;var a=dn(i);o.$initial_host=a==null?void 0:a.host,o.$initial_pathname=a==null?void 0:a.pathname,Xe(this._campaignParamsFromUrl(i),function(u,d){o["$initial_"+Cs(d)]=u})}return t&&Xe(this._searchInfoFromReferrer(t),function(u,d){o["$initial_"+Cs(d)]=u}),o},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},properties:function(){if(!St)return{};var[r,e]=ut.os(St);return Ft(vi({$os:r,$os_version:e,$browser:ut.browser(St,navigator.vendor),$device:ut.device(St),$device_type:ut.deviceType(St),$timezone:ut.timezone()}),{$current_url:Ht==null?void 0:Ht.href,$host:Ht==null?void 0:Ht.host,$pathname:Ht==null?void 0:Ht.pathname,$raw_user_agent:St.length>1e3?St.substring(0,997)+"...":St,$browser_version:ut.browserVersion(St,navigator.vendor),$browser_language:ut.browserLanguage(),$screen_height:C==null?void 0:C.screen.height,$screen_width:C==null?void 0:C.screen.width,$viewport_height:C==null?void 0:C.innerHeight,$viewport_width:C==null?void 0:C.innerWidth,$lib:"web",$lib_version:Rr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!St)return{};var[r,e]=ut.os(St);return Ft(vi({$os:r,$os_version:e,$browser:ut.browser(St,navigator.vendor)}),{$browser_version:ut.browserVersion(St,navigator.vendor)})}},jc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ms{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&O.info("Persistence loaded",e.persistence,G({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){jc.indexOf(e.persistence.toLowerCase())===-1&&(O.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&mt.is_supported()?mt:t==="localstorage+cookie"&&oi.is_supported()?oi:t==="sessionstorage"&&Et.is_supported()?Et:t==="memory"?Rc:t==="cookie"?wr:oi.is_supported()?oi:wr}properties(){var e={};return Xe(this.props,function(t,i){if(i===ln&&dt(t))for(var o=Object.keys(t),a=0;a<o.length;a++)e["$feature/".concat(o[a])]=t[o[a]];else d=i,p=!1,(Lr(u=bc)?p:va&&u.indexOf===va?u.indexOf(d)!=-1:(Xe(u,function(m){if(p||(p=m===d))return fi}),p))||(e[i]=t);var u,d,p}),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Ft({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(dt(e)){pe(t)&&(t="None"),this.expire_days=pe(i)?this.default_expiry:i;var o=!1;if(Xe(e,(a,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==t||(this.props[u]=a,o=!0)}),o)return this.save(),!0}return!1}register(e,t){if(dt(e)){this.expire_days=pe(t)?this.default_expiry:t;var i=!1;if(Xe(e,(o,a)=>{e.hasOwnProperty(a)&&this.props[a]!==o&&(this.props[a]=o,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=ut.campaignParams(this.config.custom_campaign_params);an(vi(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(ut.searchInfo())}update_referrer_info(){this.register_once(ut.referrerInfo(),void 0)}set_initial_person_info(){this.props[As]||this.props[Os]||this.register_once({[Oa]:ut.initialPersonInfo()},void 0)}get_referrer_info(){return vi({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};Xe([Os,As],o=>{var a=this.props[o];a&&Xe(a,function(u,d){e["$initial_"+Cs(d)]=u})});var t=this.props[Oa];if(t){var i=ut.initialPersonPropsFromInfo(t);Ft(e,i)}return e}safe_merge(e){return Xe(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var i=this.buildStorage(e),o=this.props;this.clear(),this.storage=i,this.props=o,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Rn]||{};i[e]=t,this.props[Rn]=i,this.save()}remove_event_timer(e){var t=(this.props[Rn]||{})[e];return pe(t)||(delete this.props[Rn][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function Ci(r){var e,t;return((e=JSON.stringify(r,(t=[],function(i,o){if(dt(o)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(o)?"[Circular]":(t.push(o),o)}return o})))===null||e===void 0?void 0:e.length)||0}function Ls(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(r.size>=e&&r.data.length>1){var t=Math.floor(r.data.length/2),i=r.data.slice(0,t),o=r.data.slice(t);return[Ls({size:Ci(i),data:i,sessionId:r.sessionId,windowId:r.windowId}),Ls({size:Ci(o),data:o,sessionId:r.sessionId,windowId:r.windowId})].flatMap(a=>a)}return[r]}var mr=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(mr||{}),sr=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(sr||{});function $a(r){var e;return r.id===yl||!((e=r.closest)===null||e===void 0||!e.call(r,".toolbar-global-fade-container"))}function Oi(r){return!!r&&r.nodeType===1}function Pr(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function Ll(r){return!!r&&r.nodeType===3}function Dl(r){return!!r&&r.nodeType===11}function eo(r){return r?Mi(r).split(/\s+/):[]}function ja(r){var e=C==null?void 0:C.location.href;return!!(e&&r&&r.some(t=>e.match(t)))}function Ei(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return eo(e)}function Bl(r){return Je(r)?null:Mi(r).split(/(\s+)/).filter(e=>vn(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ni(r){var e="";return Bs(r)&&!$l(r)&&r.childNodes&&r.childNodes.length&&Xe(r.childNodes,function(t){var i;Ll(t)&&t.textContent&&(e+=(i=Bl(t.textContent))!==null&&i!==void 0?i:"")}),Mi(e)}function Hl(r){return pe(r.target)?r.srcElement||null:(e=r.target)!==null&&e!==void 0&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Ds=["a","button","form","input","select","textarea","label"];function Wl(r){var e=r.parentNode;return!(!e||!Oi(e))&&e}function Gc(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!C||!r||Pr(r,"html")||!Oi(r)||t!=null&&t.url_allowlist&&!ja(t.url_allowlist)||t!=null&&t.url_ignorelist&&ja(t.url_ignorelist))return!1;if(t!=null&&t.dom_event_allowlist){var a=t.dom_event_allowlist;if(a&&!a.some(y=>e.type===y))return!1}for(var u=!1,d=[r],p=!0,m=r;m.parentNode&&!Pr(m,"body");)if(Dl(m.parentNode))d.push(m.parentNode.host),m=m.parentNode.host;else{if(!(p=Wl(m)))break;if(i||Ds.indexOf(p.tagName.toLowerCase())>-1)u=!0;else{var g=C.getComputedStyle(p);g&&g.getPropertyValue("cursor")==="pointer"&&(u=!0)}d.push(p),m=p}if(!function(y,k){var R=k==null?void 0:k.element_allowlist;if(pe(R))return!0;var W=function(le){if(R.some(ue=>le.tagName.toLowerCase()===ue))return{v:!0}};for(var B of y){var q=W(B);if(typeof q=="object")return q.v}return!1}(d,t)||!function(y,k){var R=k==null?void 0:k.css_selector_allowlist;if(pe(R))return!0;var W=function(le){if(R.some(ue=>le.matches(ue)))return{v:!0}};for(var B of y){var q=W(B);if(typeof q=="object")return q.v}return!1}(d,t))return!1;var v=C.getComputedStyle(r);if(v&&v.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var b=r.tagName.toLowerCase();switch(b){case"html":return!1;case"form":return(o||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(o||["change","click"]).indexOf(e.type)>=0;default:return u?(o||["click"]).indexOf(e.type)>=0:(o||["click"]).indexOf(e.type)>=0&&(Ds.indexOf(b)>-1||r.getAttribute("contenteditable")==="true")}}function Bs(r){for(var e=r;e.parentNode&&!Pr(e,"body");e=e.parentNode){var t=Ei(e);if(Pe(t,"ph-sensitive")||Pe(t,"ph-no-capture"))return!1}if(Pe(Ei(r),"ph-include"))return!0;var i=r.type||"";if(xt(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var o=r.name||r.id||"";return!(xt(o)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,"")))}function $l(r){return!!(Pr(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Pr(r,"select")||Pr(r,"textarea")||r.getAttribute("contenteditable")==="true")}var jl="(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})",qc=new RegExp("^(?:".concat(jl,")$")),Uc=new RegExp(jl),Gl="\\d{3}-?\\d{2}-?\\d{4}",Vc=new RegExp("^(".concat(Gl,")$")),zc=new RegExp("(".concat(Gl,")"));function vn(r){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Je(r)||xt(r)&&(r=Mi(r),(e?qc:Uc).test((r||"").replace(/[- ]/g,""))||(e?Vc:zc).test(r)))}function ql(r){var e=Ni(r);return vn(e="".concat(e," ").concat(Ul(r)).trim())?e:""}function Ul(r){var e="";return r&&r.childNodes&&r.childNodes.length&&Xe(r.childNodes,function(t){var i;if(t&&((i=t.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{var o=Ni(t);e="".concat(e," ").concat(o).trim(),t.childNodes&&t.childNodes.length&&(e="".concat(e," ").concat(Ul(t)).trim())}catch(a){O.error(a)}}),e}function Yc(r){return function(e){var t=e.map(i=>{var o,a,u="";if(i.tag_name&&(u+=i.tag_name),i.attr_class)for(var d of(i.attr_class.sort(),i.attr_class))u+=".".concat(d.replace(/"/g,""));var p=G(G(G(G({},i.text?{text:i.text}:{}),{},{"nth-child":(o=i.nth_child)!==null&&o!==void 0?o:0,"nth-of-type":(a=i.nth_of_type)!==null&&a!==void 0?a:0},i.href?{href:i.href}:{}),i.attr_id?{attr_id:i.attr_id}:{}),i.attributes),m={};return pi(p).sort((g,v)=>{var[b]=g,[y]=v;return b.localeCompare(y)}).forEach(g=>{var[v,b]=g;return m[Ga(v.toString())]=Ga(b.toString())}),u+=":",u+=pi(p).map(g=>{var[v,b]=g;return"".concat(v,'="').concat(b,'"')}).join("")});return t.join(";")}(function(e){return e.map(t=>{var i,o,a={text:(i=t.$el_text)===null||i===void 0?void 0:i.slice(0,400),tag_name:t.tag_name,href:(o=t.attr__href)===null||o===void 0?void 0:o.slice(0,2048),attr_class:Zc(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return pi(t).filter(u=>{var[d]=u;return d.indexOf("attr__")===0}).forEach(u=>{var[d,p]=u;return a.attributes[d]=p}),a})}(r))}function Ga(r){return r.replace(/"|\\"/g,'\\"')}function Zc(r){var e=r.attr__class;return e?ct(e)?e:eo(e):void 0}var Hs="[SessionRecording]",Ws="redacted",ui={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:r=>r,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},Xc=["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"],Jc=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Kc=["/s/","/e/","/i/"];function qa(r,e,t,i){if(Je(r))return r;var o=(e==null?void 0:e["content-length"])||function(a){return new Blob([a]).size}(r);return xt(o)&&(o=parseInt(o)),o>t?Hs+" ".concat(i," body too large to record (").concat(o," bytes)"):r}function Ua(r,e){if(Je(r))return r;var t=r;return vn(t,!1)||(t=Hs+" "+e+" body "+Ws),Xe(Jc,i=>{var o,a;(o=t)!==null&&o!==void 0&&o.length&&((a=t)===null||a===void 0?void 0:a.indexOf(i))!==-1&&(t=Hs+" "+e+" body "+Ws+" as might contain: "+i)}),t}var Qc=(r,e)=>{var t,i,o,a={payloadSizeLimitBytes:ui.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ui.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ui.payloadHostDenyList]},u=r.session_recording.recordHeaders!==!1&&e.recordHeaders,d=r.session_recording.recordBody!==!1&&e.recordBody,p=r.capture_performance!==!1&&e.recordPerformance,m=(t=a,o=Math.min(1e6,(i=t.payloadSizeLimitBytes)!==null&&i!==void 0?i:1e6),b=>(b!=null&&b.requestBody&&(b.requestBody=qa(b.requestBody,b.requestHeaders,o,"Request")),b!=null&&b.responseBody&&(b.responseBody=qa(b.responseBody,b.responseHeaders,o,"Response")),b)),g=b=>{return m(((R,W)=>{var B,q=dn(R.name),le=W.indexOf("http")===0?(B=dn(W))===null||B===void 0?void 0:B.pathname:W;le==="/"&&(le="");var ue=q==null?void 0:q.pathname.replace(le||"","");if(!(q&&ue&&Kc.some(Ee=>ue.indexOf(Ee)===0)))return R})((k=(y=b).requestHeaders,Je(k)||Xe(Object.keys(k??{}),R=>{Xc.includes(R.toLowerCase())&&(k[R]=Ws)}),y),r.api_host));var y,k},v=Jt(r.session_recording.maskNetworkRequestFn);return v&&Jt(r.session_recording.maskCapturedNetworkRequestFn)&&O.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),v&&(r.session_recording.maskCapturedNetworkRequestFn=b=>{var y=r.session_recording.maskNetworkRequestFn({url:b.name});return G(G({},b),{},{name:y==null?void 0:y.url})}),a.maskRequestFn=Jt(r.session_recording.maskCapturedNetworkRequestFn)?b=>{var y,k,R,W=g(b);return W&&(y=(k=(R=r.session_recording).maskCapturedNetworkRequestFn)===null||k===void 0?void 0:k.call(R,W))!==null&&y!==void 0?y:void 0}:b=>function(y){if(!pe(y))return y.requestBody=Ua(y.requestBody,"Request"),y.responseBody=Ua(y.responseBody,"Response"),y}(g(b)),G(G(G({},ui),a),{},{recordHeaders:u,recordBody:d,recordPerformance:p,recordInitialRequests:p})};function br(r,e,t,i){return e>t&&(O.warn("min cannot be greater than max."),e=t),Ut(r)?r>t?(i&&O.warn(i+" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i&&O.warn(i+" cannot be less than min: "+e+". Using min value instead."),e):r:(i&&O.warn(i+" must be a number. Defaulting to max value:"+t),t)}class ed{constructor(e){var t,i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};J(this,"bucketSize",100),J(this,"refillRate",10),J(this,"mutationBuckets",{}),J(this,"loggedTracker",{}),J(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(a=>{this.mutationBuckets[a]=this.mutationBuckets[a]+this.refillRate,this.mutationBuckets[a]>=this.bucketSize&&delete this.mutationBuckets[a]})}),J(this,"getNodeOrRelevantParent",a=>{var u=this.rrweb.mirror.getNode(a);if((u==null?void 0:u.nodeName)!=="svg"&&u instanceof Element){var d=u.closest("svg");if(d)return[this.rrweb.mirror.getId(d),d]}return[a,u]}),J(this,"numberOfChanges",a=>{var u,d,p,m,g,v,b,y;return((u=(d=a.removes)===null||d===void 0?void 0:d.length)!==null&&u!==void 0?u:0)+((p=(m=a.attributes)===null||m===void 0?void 0:m.length)!==null&&p!==void 0?p:0)+((g=(v=a.texts)===null||v===void 0?void 0:v.length)!==null&&g!==void 0?g:0)+((b=(y=a.adds)===null||y===void 0?void 0:y.length)!==null&&b!==void 0?b:0)}),J(this,"throttleMutations",a=>{if(a.type!==3||a.data.source!==0)return a;var u=a.data,d=this.numberOfChanges(u);u.attributes&&(u.attributes=u.attributes.filter(m=>{var g,v,b,[y,k]=this.getNodeOrRelevantParent(m.id);return this.mutationBuckets[y]===0?!1:(this.mutationBuckets[y]=(g=this.mutationBuckets[y])!==null&&g!==void 0?g:this.bucketSize,this.mutationBuckets[y]=Math.max(this.mutationBuckets[y]-1,0),this.mutationBuckets[y]===0&&(this.loggedTracker[y]||(this.loggedTracker[y]=!0,(v=(b=this.options).onBlockedNode)===null||v===void 0||v.call(b,y,k))),m)}));var p=this.numberOfChanges(u);return p!==0||d===p?a:void 0}),this.rrweb=e,this.options=o,this.refillRate=br((t=this.options.refillRate)!==null&&t!==void 0?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=br((i=this.options.bucketSize)!==null&&i!==void 0?i:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var Qt=Uint8Array,$t=Uint16Array,mn=Uint32Array,to=new Qt([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]),ro=new Qt([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]),Va=new Qt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vl=function(r,e){for(var t=new $t(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var o=new mn(t[30]);for(i=1;i<30;++i)for(var a=t[i];a<t[i+1];++a)o[a]=a-t[i]<<5|i;return[t,o]},zl=Vl(to,2),td=zl[0],$s=zl[1];td[28]=258,$s[258]=28;for(var za=Vl(ro,0)[1],Yl=new $t(32768),Ke=0;Ke<32768;++Ke){var jr=(43690&Ke)>>>1|(21845&Ke)<<1;jr=(61680&(jr=(52428&jr)>>>2|(13107&jr)<<2))>>>4|(3855&jr)<<4,Yl[Ke]=((65280&jr)>>>8|(255&jr)<<8)>>>1}var On=function(r,e,t){for(var i=r.length,o=0,a=new $t(e);o<i;++o)++a[r[o]-1];var u,d=new $t(e);for(o=0;o<e;++o)d[o]=d[o-1]+a[o-1]<<1;for(u=new $t(i),o=0;o<i;++o)u[o]=Yl[d[r[o]-1]++]>>>15-r[o];return u},Zr=new Qt(288);for(Ke=0;Ke<144;++Ke)Zr[Ke]=8;for(Ke=144;Ke<256;++Ke)Zr[Ke]=9;for(Ke=256;Ke<280;++Ke)Zr[Ke]=7;for(Ke=280;Ke<288;++Ke)Zr[Ke]=8;var ki=new Qt(32);for(Ke=0;Ke<32;++Ke)ki[Ke]=5;var rd=On(Zr,9),nd=On(ki,5),Zl=function(r){return(r/8>>0)+(7&r&&1)},Xl=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof $t?$t:r instanceof mn?mn:Qt)(t-e);return i.set(r.subarray(e,t)),i},fr=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},En=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},_s=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var o=t.length,a=t.slice();if(!o)return[new Qt(0),0];if(o==1){var u=new Qt(t[0].s+1);return u[t[0].s]=1,[u,1]}t.sort(function(Ee,Ge){return Ee.f-Ge.f}),t.push({s:-1,f:25001});var d=t[0],p=t[1],m=0,g=1,v=2;for(t[0]={s:-1,f:d.f+p.f,l:d,r:p};g!=o-1;)d=t[t[m].f<t[v].f?m++:v++],p=t[m!=g&&t[m].f<t[v].f?m++:v++],t[g++]={s:-1,f:d.f+p.f,l:d,r:p};var b=a[0].s;for(i=1;i<o;++i)a[i].s>b&&(b=a[i].s);var y=new $t(b+1),k=js(t[g-1],y,0);if(k>e){i=0;var R=0,W=k-e,B=1<<W;for(a.sort(function(Ee,Ge){return y[Ge.s]-y[Ee.s]||Ee.f-Ge.f});i<o;++i){var q=a[i].s;if(!(y[q]>e))break;R+=B-(1<<k-y[q]),y[q]=e}for(R>>>=W;R>0;){var le=a[i].s;y[le]<e?R-=1<<e-y[le]++-1:++i}for(;i>=0&&R;--i){var ue=a[i].s;y[ue]==e&&(--y[ue],++R)}k=e}return[new Qt(y),k]},js=function(r,e,t){return r.s==-1?Math.max(js(r.l,e,t+1),js(r.r,e,t+1)):e[r.s]=t},Ya=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new $t(++e),i=0,o=r[0],a=1,u=function(p){t[i++]=p},d=1;d<=e;++d)if(r[d]==o&&d!=e)++a;else{if(!o&&a>2){for(;a>138;a-=138)u(32754);a>2&&(u(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(u(o),--a;a>6;a-=6)u(8304);a>2&&(u(a-3<<5|8208),a=0)}for(;a--;)u(o);a=1,o=r[d]}return[t.subarray(0,i),e]},kn=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},Gs=function(r,e,t){var i=t.length,o=Zl(e+2);r[o]=255&i,r[o+1]=i>>>8,r[o+2]=255^r[o],r[o+3]=255^r[o+1];for(var a=0;a<i;++a)r[o+a+4]=t[a];return 8*(o+4+i)},Za=function(r,e,t,i,o,a,u,d,p,m,g){fr(e,g++,t),++o[256];for(var v=_s(o,15),b=v[0],y=v[1],k=_s(a,15),R=k[0],W=k[1],B=Ya(b),q=B[0],le=B[1],ue=Ya(R),Ee=ue[0],Ge=ue[1],we=new $t(19),_e=0;_e<q.length;++_e)we[31&q[_e]]++;for(_e=0;_e<Ee.length;++_e)we[31&Ee[_e]]++;for(var Ne=_s(we,7),qe=Ne[0],Ze=Ne[1],st=19;st>4&&!qe[Va[st-1]];--st);var It,_t,lt,ht,kt=m+5<<3,Tt=kn(o,Zr)+kn(a,ki)+u,pt=kn(o,b)+kn(a,R)+u+14+3*st+kn(we,qe)+(2*we[16]+3*we[17]+7*we[18]);if(kt<=Tt&&kt<=pt)return Gs(e,g,r.subarray(p,p+m));if(fr(e,g,1+(pt<Tt)),g+=2,pt<Tt){It=On(b,y),_t=b,lt=On(R,W),ht=R;var yt=On(qe,Ze);for(fr(e,g,le-257),fr(e,g+5,Ge-1),fr(e,g+10,st-4),g+=14,_e=0;_e<st;++_e)fr(e,g+3*_e,qe[Va[_e]]);g+=3*st;for(var zt=[q,Ee],Qe=0;Qe<2;++Qe){var Ve=zt[Qe];for(_e=0;_e<Ve.length;++_e){var ze=31&Ve[_e];fr(e,g,yt[ze]),g+=qe[ze],ze>15&&(fr(e,g,Ve[_e]>>>5&127),g+=Ve[_e]>>>12)}}}else It=rd,_t=Zr,lt=nd,ht=ki;for(_e=0;_e<d;++_e)if(i[_e]>255){ze=i[_e]>>>18&31,En(e,g,It[ze+257]),g+=_t[ze+257],ze>7&&(fr(e,g,i[_e]>>>23&31),g+=to[ze]);var ot=31&i[_e];En(e,g,lt[ot]),g+=ht[ot],ot>3&&(En(e,g,i[_e]>>>5&8191),g+=ro[ot])}else En(e,g,It[i[_e]]),g+=_t[i[_e]];return En(e,g,It[256]),g+_t[256]},id=new mn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sd=function(){for(var r=new mn(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r}(),od=function(){var r=4294967295;return{p:function(e){for(var t=r,i=0;i<e.length;++i)t=sd[255&t^e[i]]^t>>>8;r=t},d:function(){return 4294967295^r}}},ad=function(r,e,t,i,o){return function(a,u,d,p,m,g){var v=a.length,b=new Qt(p+v+5*(1+Math.floor(v/7e3))+m),y=b.subarray(p,b.length-m),k=0;if(!u||v<8)for(var R=0;R<=v;R+=65535){var W=R+65535;W<v?k=Gs(y,k,a.subarray(R,W)):(y[R]=g,k=Gs(y,k,a.subarray(R,v)))}else{for(var B=id[u-1],q=B>>>13,le=8191&B,ue=(1<<d)-1,Ee=new $t(32768),Ge=new $t(ue+1),we=Math.ceil(d/3),_e=2*we,Ne=function(Ue){return(a[Ue]^a[Ue+1]<<we^a[Ue+2]<<_e)&ue},qe=new mn(25e3),Ze=new $t(288),st=new $t(32),It=0,_t=0,lt=(R=0,0),ht=0,kt=0;R<v;++R){var Tt=Ne(R),pt=32767&R,yt=Ge[Tt];if(Ee[pt]=yt,Ge[Tt]=pt,ht<=R){var zt=v-R;if((It>7e3||lt>24576)&&zt>423){k=Za(a,y,0,qe,Ze,st,_t,lt,kt,R-kt,k),lt=It=_t=0,kt=R;for(var Qe=0;Qe<286;++Qe)Ze[Qe]=0;for(Qe=0;Qe<30;++Qe)st[Qe]=0}var Ve=2,ze=0,ot=le,Rt=pt-yt&32767;if(zt>2&&Tt==Ne(R-Rt))for(var er=Math.min(q,zt)-1,Dr=Math.min(32767,R),jt=Math.min(258,zt);Rt<=Dr&&--ot&&pt!=yt;){if(a[R+Ve]==a[R+Ve-Rt]){for(var M=0;M<jt&&a[R+M]==a[R+M-Rt];++M);if(M>Ve){if(Ve=M,ze=Rt,M>er)break;var T=Math.min(Rt,M-2),L=0;for(Qe=0;Qe<T;++Qe){var U=R-Rt+Qe+32768&32767,de=U-Ee[U]+32768&32767;de>L&&(L=de,yt=U)}}}Rt+=(pt=yt)-(yt=Ee[pt])+32768&32767}if(ze){qe[lt++]=268435456|$s[Ve]<<18|za[ze];var Se=31&$s[Ve],Fe=31&za[ze];_t+=to[Se]+ro[Fe],++Ze[257+Se],++st[Fe],ht=R+Ve,++It}else qe[lt++]=a[R],++Ze[a[R]]}}k=Za(a,y,g,qe,Ze,st,_t,lt,kt,R-kt,k)}return Xl(b,0,p+Zl(k)+m)}(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!o)},qs=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8},ld=function(r,e){var t=e.filename;if(r[0]=31,r[1]=139,r[2]=8,r[8]=e.level<2?4:e.level==9?2:0,r[9]=3,e.mtime!=0&&qs(r,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){r[3]=8;for(var i=0;i<=t.length;++i)r[i+10]=t.charCodeAt(i)}},ud=function(r){return 10+(r.filename&&r.filename.length+1||0)};function Jl(r,e){e===void 0&&(e={});var t=od(),i=r.length;t.p(r);var o=ad(r,e,ud(e),8),a=o.length;return ld(o,e),qs(o,a-8,t.d()),qs(o,a-4,i),o}function Kl(r,e){var t=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var i=new Qt(r.length+(r.length>>>1)),o=0,a=function(m){i[o++]=m},u=0;u<t;++u){if(o+5>i.length){var d=new Qt(o+8+(t-u<<1));d.set(i),i=d}var p=r.charCodeAt(u);p<128||e?a(p):p<2048?(a(192|p>>>6),a(128|63&p)):p>55295&&p<57344?(a(240|(p=65536+(1047552&p)|1023&r.charCodeAt(++u))>>>18),a(128|p>>>12&63),a(128|p>>>6&63),a(128|63&p)):(a(224|p>>>12),a(128|p>>>6&63),a(128|63&p))}return Xl(i,0,o)}var cd=3e5,dd=[sr.MouseMove,sr.MouseInteraction,sr.Scroll,sr.ViewportResize,sr.Input,sr.TouchMove,sr.MediaInteraction,sr.Drag],Xa=r=>({rrwebMethod:r,enqueuedAt:Date.now(),attempt:1}),Ct="[SessionRecording]";function Gr(r){return function(e,t){for(var i="",o=0;o<e.length;){var a=e[o++];a<128||t?i+=String.fromCharCode(a):a<224?i+=String.fromCharCode((31&a)<<6|63&e[o++]):a<240?i+=String.fromCharCode((15&a)<<12|(63&e[o++])<<6|63&e[o++]):(a=((15&a)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])-65536,i+=String.fromCharCode(55296|a>>10,56320|1023&a))}return i}(Jl(Kl(JSON.stringify(r))),!0)}function Ja(r){return r.type===mr.Custom&&r.data.tag==="sessionIdle"}function Ka(r,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(r))}class hd{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return Ae==null||(e=Ae.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Ct+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return this.triggerStatus==="trigger_pending"?6e4:(e=(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.full_snapshot_interval_millis)!==null&&e!==void 0?e:cd}get isSampled(){var e=this.instance.get_property(Mn);return zr(e)?e:null}get sessionDuration(){var e,t,i=(e=this.buffer)===null||e===void 0?void 0:e.data[((t=this.buffer)===null||t===void 0?void 0:t.data.length)-1],{sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-o:null}get isRecordingEnabled(){var e=!!this.instance.get_property(ks),t=!this.instance.config.disable_session_recording;return C&&e&&t}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(Ta),t=this.instance.config.enable_recording_console_log;return t??e}get canvasRecording(){var e,t,i,o,a,u,d=this.instance.config.session_recording.captureCanvas,p=this.instance.get_property(Ra),m=(e=(t=d==null?void 0:d.recordCanvas)!==null&&t!==void 0?t:p==null?void 0:p.enabled)!==null&&e!==void 0&&e,g=(i=(o=d==null?void 0:d.canvasFps)!==null&&o!==void 0?o:p==null?void 0:p.fps)!==null&&i!==void 0?i:0,v=(a=(u=d==null?void 0:d.canvasQuality)!==null&&u!==void 0?u:p==null?void 0:p.quality)!==null&&a!==void 0?a:0;return{enabled:m,fps:br(g,0,12,"canvas recording fps"),quality:br(v,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,i=this.instance.get_property(xa),o={recordHeaders:(e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recordHeaders,recordBody:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordBody},a=(o==null?void 0:o.recordHeaders)||(i==null?void 0:i.recordHeaders),u=(o==null?void 0:o.recordBody)||(i==null?void 0:i.recordBody),d=dt(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,p=!!(zr(d)?d:i!=null&&i.capturePerformance);return a||u||p?{recordHeaders:a,recordBody:u,recordPerformance:p}:void 0}get sampleRate(){var e=this.instance.get_property(Ma);return Ut(e)?e:null}get minimumDuration(){var e=this.instance.get_property(Aa);return Ut(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?Je(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":this._urlBlocked?"paused":zr(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return this._urlTriggers.length===0?"trigger_disabled":((e=this.instance)===null||e===void 0?void 0:e.get_property(hs))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return this._eventTriggers.length===0?"trigger_disabled":((e=this.instance)===null||e===void 0?void 0:e.get_property(ps))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",t=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(J(this,"queuedRRWebEvents",[]),J(this,"isIdle",!1),J(this,"_linkedFlagSeen",!1),J(this,"_lastActivityTimestamp",Date.now()),J(this,"_linkedFlag",null),J(this,"_removePageViewCaptureHook",void 0),J(this,"_onSessionIdListener",void 0),J(this,"_persistDecideOnSessionListener",void 0),J(this,"_samplingSessionListener",void 0),J(this,"_urlTriggers",[]),J(this,"_urlBlocklist",[]),J(this,"_urlBlocked",!1),J(this,"_eventTriggers",[]),J(this,"_removeEventTriggerCaptureHook",void 0),J(this,"_forceAllowLocalhostNetworkCapture",!1),J(this,"_onBeforeUnload",()=>{this._flushBuffer()}),J(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),J(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),J(this,"_onVisibilityChange",()=>{if(ne!=null&&ne.visibilityState){var o="window "+ne.visibilityState;this._tryAddCustomEvent(o,{})}}),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw O.error(Ct+" started without valid sessionManager"),new Error(Ct+" started without valid sessionManager. This is a bug.");var{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=i,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&O.warn(Ct+" session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(e){this.isRecordingEnabled?(this._startCapture(e),C==null||C.addEventListener("beforeunload",this._onBeforeUnload),C==null||C.addEventListener("offline",this._onOffline),C==null||C.addEventListener("online",this._onOnline),C==null||C.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Je(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance._addCaptureHook(t=>{try{if(t==="$pageview"){var i=C?this._maskUrl(C.location.href):"";if(!i)return;this._tryAddCustomEvent("$pageview",{href:i})}}catch(o){O.error("Could not add $pageview to rrweb session",o)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((t,i,o)=>{var a,u,d,p;o&&(this._tryAddCustomEvent("$session_id_change",{sessionId:t,windowId:i,changeReason:o}),(a=this.instance)===null||a===void 0||(u=a.persistence)===null||u===void 0||u.unregister(ps),(d=this.instance)===null||d===void 0||(p=d.persistence)===null||p===void 0||p.unregister(hs))}))):this.stopRecording()}stopRecording(){var e,t,i,o;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,C==null||C.removeEventListener("beforeunload",this._onBeforeUnload),C==null||C.removeEventListener("offline",this._onOffline),C==null||C.removeEventListener("online",this._onOnline),C==null||C.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(e=this._removePageViewCaptureHook)===null||e===void 0||e.call(this),this._removePageViewCaptureHook=void 0,(t=this._removeEventTriggerCaptureHook)===null||t===void 0||t.call(this),this._removeEventTriggerCaptureHook=void 0,(i=this._onSessionIdListener)===null||i===void 0||i.call(this),this._onSessionIdListener=void 0,(o=this._samplingSessionListener)===null||o===void 0||o.call(this),this._samplingSessionListener=void 0,O.info(Ct+" stopped"))}makeSamplingDecision(e){var t,i=this.sessionId!==e,o=this.sampleRate;if(Ut(o)){var a,u=this.isSampled,d=i||!zr(u);d?a=Math.random()<o:a=u,d&&(a?this._reportStarted("sampled"):O.warn(Ct+" Sample rate (".concat(o,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:o,isSampled:a})),(t=this.instance.persistence)===null||t===void 0||t.register({[Mn]:a})}else{var p;(p=this.instance.persistence)===null||p===void 0||p.register({[Mn]:null})}}afterDecideResponse(e){var t,i,o,a,u,d;if(this._persistDecideResponse(e),this._linkedFlag=((t=e.sessionRecording)===null||t===void 0?void 0:t.linkedFlag)||null,(i=e.sessionRecording)!==null&&i!==void 0&&i.endpoint&&(this._endpoint=(d=e.sessionRecording)===null||d===void 0?void 0:d.endpoint),this._setupSampling(),!Je(this._linkedFlag)&&!this._linkedFlagSeen){var p=xt(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,m=xt(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((g,v)=>{var b=dt(v)&&p in v,y=m?v[p]===m:b;y&&this._reportStarted("linked_flag_matched",{linkedFlag:p,linkedVariant:m}),this._linkedFlagSeen=y})}(o=e.sessionRecording)!==null&&o!==void 0&&o.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),(a=e.sessionRecording)!==null&&a!==void 0&&a.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),(u=e.sessionRecording)!==null&&u!==void 0&&u.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Ut(this.sampleRate)&&Je(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(e=>{this.makeSamplingDecision(e)}))}_persistDecideResponse(e){if(this.instance.persistence){var t,i=this.instance.persistence,o=()=>{var a,u,d,p,m,g,v,b=(a=e.sessionRecording)===null||a===void 0?void 0:a.sampleRate,y=Je(b)?null:parseFloat(b),k=(u=e.sessionRecording)===null||u===void 0?void 0:u.minimumDurationMilliseconds;i.register({[ks]:!!e.sessionRecording,[Ta]:(d=e.sessionRecording)===null||d===void 0?void 0:d.consoleLogRecordingEnabled,[xa]:G({capturePerformance:e.capturePerformance},(p=e.sessionRecording)===null||p===void 0?void 0:p.networkPayloadCapture),[Ra]:{enabled:(m=e.sessionRecording)===null||m===void 0?void 0:m.recordCanvas,fps:(g=e.sessionRecording)===null||g===void 0?void 0:g.canvasFps,quality:(v=e.sessionRecording)===null||v===void 0?void 0:v.canvasQuality},[Ma]:y,[Aa]:pe(k)?null:k})};o(),(t=this._persistDecideOnSessionListener)===null||t===void 0||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(o)}}log(e){var t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(t=this.instance.sessionRecording)===null||t===void 0||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:i,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!pe(Object.assign)&&!pe(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,i;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():(t=Ae.__PosthogExtensions__)===null||t===void 0||(i=t.loadExternalDependency)===null||i===void 0||i.call(t,this.instance,"recorder",o=>{if(o)return O.error(Ct+" could not load recorder",o);this._onScriptLoaded()}),O.info(Ct+" starting"),this.status==="active"&&this._reportStarted(e||"recording_initialized")}}isInteractiveEvent(e){var t;return e.type===3&&dd.indexOf((t=e.data)===null||t===void 0?void 0:t.source)!==-1}_updateWindowAndSessionIds(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var i=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)),!this.isIdle){var{windowId:o,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),u=this.sessionId!==a,d=this.windowId!==o;this.windowId=o,this.sessionId=a,u||d?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):O.warn(Ct+" could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Xa(()=>this.rrwebRecord.addCustomEvent(e,t)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Xa(()=>this.rrwebRecord.takeFullSnapshot()))}_onScriptLoaded(){var e,t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this.instance.config.session_recording;for(var[o,a]of Object.entries(i||{}))o in t&&(o==="maskInputOptions"?t.maskInputOptions=G({password:!0},a):t[o]=a);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=(e=this.mutationRateLimiter)!==null&&e!==void 0?e:new ed(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(d,p)=>{var m="Too many mutations on node '".concat(d,"'. Rate limiting. This could be due to SVG animations or something similar");O.info(m,{node:p}),this.log(Ct+" "+m,"warn")}});var u=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(G({emit:d=>{this.onRRwebEmit(d)},plugins:u},t)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:u.map(d=>d==null?void 0:d.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else O.error(Ct+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_gatherRRWebPlugins(){var e,t,i,o,a=[],u=(e=Ae.__PosthogExtensions__)===null||e===void 0||(t=e.rrwebPlugins)===null||t===void 0?void 0:t.getRecordConsolePlugin;u&&this.isConsoleLogCaptureEnabled&&a.push(u());var d=(i=Ae.__PosthogExtensions__)===null||i===void 0||(o=i.rrwebPlugins)===null||o===void 0?void 0:o.getRecordNetworkPlugin;return this.networkPayloadCapture&&Jt(d)&&(!Mc.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?a.push(d(Qc(this.instance.config,this.networkPayloadCapture))):O.info(Ct+" NetworkCapture not started because we are on localhost.")),a}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&dt(e)){if(e.type===mr.Meta){var i=this._maskUrl(e.data.href);if(this._lastHref=i,!i)return;e.data.href=i}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),this.status!=="paused"||function(v){return v.type===mr.Custom&&v.data.tag==="recording paused"}(e)){e.type===mr.FullSnapshot&&this._scheduleFullSnapshot(),e.type===mr.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var o=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(o){var a=function(v){var b=v;if(b&&dt(b)&&b.type===6&&dt(b.data)&&b.data.plugin==="rrweb/console@1"){b.data.payload.payload.length>10&&(b.data.payload.payload=b.data.payload.payload.slice(0,10),b.data.payload.payload.push("...[truncated]"));for(var y=[],k=0;k<b.data.payload.payload.length;k++)b.data.payload.payload[k]&&b.data.payload.payload[k].length>2e3?y.push(b.data.payload.payload[k].slice(0,2e3)+"...[truncated]"):y.push(b.data.payload.payload[k]);return b.data.payload.payload=y,v}return v}(o);if(this._updateWindowAndSessionIds(a),!this.isIdle||Ja(a)){if(Ja(a)){var u=a.data.payload;if(u){var d=u.lastActivityTimestamp,p=u.threshold;a.timestamp=d+p}}var m=(t=this.instance.config.session_recording.compress_events)===null||t===void 0||t?function(v){if(Ci(v)<1024)return v;try{if(v.type===mr.FullSnapshot)return G(G({},v),{},{data:Gr(v.data),cv:"2024-10"});if(v.type===mr.IncrementalSnapshot&&v.data.source===sr.Mutation)return G(G({},v),{},{cv:"2024-10",data:G(G({},v.data),{},{texts:Gr(v.data.texts),attributes:Gr(v.data.attributes),removes:Gr(v.data.removes),adds:Gr(v.data.adds)})});if(v.type===mr.IncrementalSnapshot&&v.data.source===sr.StyleSheetRule)return G(G({},v),{},{cv:"2024-10",data:G(G({},v.data),{},{adds:Gr(v.data.adds),removes:Gr(v.data.removes)})})}catch(b){O.error(Ct+" could not compress event - will use uncompressed event",b)}return v}(a):a,g={$snapshot_bytes:Ci(m),$snapshot_data:m,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(g):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&C){var e=this._maskUrl(C.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach(t=>{Date.now()-t.enqueuedAt<=2e3&&this._tryRRWebMethod(t)})}}_maskUrl(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var i,o={url:e};return(i=o=t.maskNetworkRequestFn(o))===null||i===void 0?void 0:i.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,t=this.sessionDuration,i=Ut(t)&&t>=0,o=Ut(e)&&i&&t<e;return this.status==="buffering"||o?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&Ls(this.buffer).forEach(a=>{this._captureSnapshot({$snapshot_bytes:a.size,$snapshot_data:a.data,$session_id:a.sessionId,$window_id:a.windowId})}),this.clearBuffer())}_captureSnapshotBuffered(e){var t,i=2+(((t=this.buffer)===null||t===void 0?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+i>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(C!==void 0&&C.location.href){var e=C.location.href,t=this.status==="paused",i=Ka(e,this._urlBlocklist);i&&!t?this._pauseRecording():!i&&t&&this._resumeRecording(),Ka(e,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,i;this.triggerStatus==="trigger_pending"&&((t=this.instance)===null||t===void 0||(i=t.persistence)===null||i===void 0||i.register({[e==="url"?hs:ps]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;this.status!=="paused"&&(this._urlBlocked=!0,ne==null||(e=ne.body)===null||e===void 0||(t=e.classList)===null||t===void 0||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout(()=>{this._flushBuffer()},100),O.info(Ct+" recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;this.status==="paused"&&(this._urlBlocked=!1,ne==null||(e=ne.body)===null||e===void 0||(t=e.classList)===null||t===void 0||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),O.info(Ct+" recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&Je(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(t){O.error(Ct+"Could not activate event trigger",t)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;(e=this.instance.persistence)===null||e===void 0||e.register({[Mn]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),O.info(Ct+" "+e.replace("_"," "),t),Pe(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}class pd{constructor(e){this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}call(){var e={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(un),group_properties:this.instance.get_property(Mr),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:e,compression:this.instance.config.disable_compression?void 0:or.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:t=>this.parseDecideResponse(t.json)})}parseDecideResponse(e){var t=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var i=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e??{},i),i)O.error("Failed to fetch feature flags from PostHog.");else{if(!ne||!ne.body)return O.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.parseDecideResponse(e)},500);if(this.instance._afterDecideResponse(e),e.siteApps)if(this.instance.config.opt_in_site_apps){var o=function(d,p){var m,g;Ae["__$$ph_site_app_".concat(d)]=t.instance,(m=Ae.__PosthogExtensions__)===null||m===void 0||(g=m.loadSiteApp)===null||g===void 0||g.call(m,t.instance,p,v=>{if(v)return O.error("Error while initializing PostHog app with config id ".concat(d),v)})};for(var{id:a,url:u}of e.siteApps)o(a,u)}else e.siteApps.length>0&&O.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}var _r,gd=C!=null&&C.location?Si(C.location.hash,"__posthog")||Si(location.hash,"state"):null,Qa="_postHogToolbarParams";(function(r){r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED"})(_r||(_r={}));class fd{constructor(e){this.instance=e}setToolbarState(e){Ae.ph_toolbar_state=e}getToolbarState(){var e;return(e=Ae.ph_toolbar_state)!==null&&e!==void 0?e:_r.UNINITIALIZED}maybeLoadToolbar(){var e,t,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!C||!ne)return!1;i=(e=i)!==null&&e!==void 0?e:C.location,a=(t=a)!==null&&t!==void 0?t:C.history;try{if(!o){try{C.localStorage.setItem("test","test"),C.localStorage.removeItem("test")}catch{return!1}o=C==null?void 0:C.localStorage}var u,d=gd||Si(i.hash,"__posthog")||Si(i.hash,"state"),p=d?_a(()=>JSON.parse(atob(decodeURIComponent(d))))||_a(()=>JSON.parse(decodeURIComponent(d))):null;return p&&p.action==="ph_authorize"?((u=p).source="url",u&&Object.keys(u).length>0&&(p.desiredHash?i.hash=p.desiredHash:a?a.replaceState(a.state,"",i.pathname+i.search):i.hash="")):((u=JSON.parse(o.getItem(Qa)||"{}")).source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token)&&(this.loadToolbar(u),!0)}catch{return!1}}_callLoadToolbar(e){(Ae.ph_load_toolbar||Ae.ph_load_editor)(e,this.instance)}loadToolbar(e){var t=!(ne==null||!ne.getElementById(yl));if(!C||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,o=G(G({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(C.localStorage.setItem(Qa,JSON.stringify(G(G({},o),{},{source:void 0}))),this.getToolbarState()===_r.LOADED)this._callLoadToolbar(o);else if(this.getToolbarState()===_r.UNINITIALIZED){var a,u;this.setToolbarState(_r.LOADING),(a=Ae.__PosthogExtensions__)===null||a===void 0||(u=a.loadExternalDependency)===null||u===void 0||u.call(a,this.instance,"toolbar",d=>{if(d)return O.error("Failed to load toolbar",d),void this.setToolbarState(_r.UNINITIALIZED);this.setToolbarState(_r.LOADED),this._callLoadToolbar(o)}),yr(C,"turbolinks:load",()=>{this.setToolbarState(_r.UNINITIALIZED),this.loadToolbar(o)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}}class vd{constructor(e){J(this,"isPaused",!0),J(this,"queue",[]),J(this,"flushTimeoutMs",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),i=[...t.filter(o=>o.url.indexOf("/e")===0),...t.filter(o=>o.url.indexOf("/e")!==0)];i.map(o=>{this.sendRequest(G(G({},o),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var t=this.formatQueue(),i=function(a){var u=t[a],d=new Date().getTime();u.data&&ct(u.data)&&Xe(u.data,p=>{p.offset=Math.abs(p.timestamp-d),delete p.timestamp}),e.sendRequest(u)};for(var o in t)i(o)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return Xe(this.queue,t=>{var i,o=t,a=(o?o.batchKey:null)||o.url;pe(e[a])&&(e[a]=G(G({},o),{},{data:[]})),(i=e[a].data)===null||i===void 0||i.push(o.data)}),this.queue=[],e}}var md=!!Is||!!Ss,el="text/plain",Ti=(r,e)=>{var[t,i]=r.split("?"),o=G({},e);i==null||i.split("&").forEach(u=>{var[d]=u.split("=");delete o[d]});var a=Ac(o);return a=a?(i?i+"&":"")+a:i,"".concat(t,"?").concat(a)},ys=r=>{var{data:e,compression:t}=r;if(e){if(t===or.GZipJS){var i=Jl(Kl(JSON.stringify(e)),{mtime:0}),o=new Blob([i],{type:el});return{contentType:el,body:o,estimatedSize:o.size}}if(t===or.Base64){var a=function(p){var m,g,v,b,y,k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",R=0,W=0,B="",q=[];if(!p)return p;p=gc(p);do m=(y=p.charCodeAt(R++)<<16|p.charCodeAt(R++)<<8|p.charCodeAt(R++))>>18&63,g=y>>12&63,v=y>>6&63,b=63&y,q[W++]=k.charAt(m)+k.charAt(g)+k.charAt(v)+k.charAt(b);while(R<p.length);switch(B=q.join(""),p.length%3){case 1:B=B.slice(0,-2)+"==";break;case 2:B=B.slice(0,-1)+"="}return B}(JSON.stringify(e)),u=(p=>"data="+encodeURIComponent(typeof p=="string"?p:JSON.stringify(p)))(a);return{contentType:"application/x-www-form-urlencoded",body:u,estimatedSize:new Blob([u]).size}}var d=JSON.stringify(e);return{contentType:"application/json",body:d,estimatedSize:new Blob([d]).size}}},Nn=[];Is&&Nn.push({transport:"XHR",method:r=>{var e,t=new Is;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:o}=(e=ys(r))!==null&&e!==void 0?e:{};Xe(r.headers,function(a,u){t.setRequestHeader(u,a)}),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var a,u={statusCode:t.status,text:t.responseText};if(t.status===200)try{u.json=JSON.parse(t.responseText)}catch{}(a=r.callback)===null||a===void 0||a.call(r,u)}},t.send(o)}}),Ss&&Nn.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:o,estimatedSize:a}=(e=ys(r))!==null&&e!==void 0?e:{},u=new Headers;Xe(r.headers,function(g,v){u.append(v,g)}),i&&u.append("Content-Type",i);var d=r.url,p=null;if(ma){var m=new ma;p={signal:m.signal,timeout:setTimeout(()=>m.abort(),r.timeout)}}Ss(d,{method:(r==null?void 0:r.method)||"GET",headers:u,keepalive:r.method==="POST"&&(a||0)<52428.8,body:o,signal:(t=p)===null||t===void 0?void 0:t.signal}).then(g=>g.text().then(v=>{var b,y={statusCode:g.status,text:v};if(g.status===200)try{y.json=JSON.parse(v)}catch(k){O.error(k)}(b=r.callback)===null||b===void 0||b.call(r,y)})).catch(g=>{var v;O.error(g),(v=r.callback)===null||v===void 0||v.call(r,{statusCode:0,text:g})}).finally(()=>p?clearTimeout(p.timeout):null)}}),Vt!=null&&Vt.sendBeacon&&Nn.push({transport:"sendBeacon",method:r=>{var e=Ti(r.url,{beacon:"1"});try{var t,{contentType:i,body:o}=(t=ys(r))!==null&&t!==void 0?t:{},a=typeof o=="string"?new Blob([o],{type:i}):o;Vt.sendBeacon(e,a)}catch{}}});var _d=["retriesPerformedSoFar"];class yd{constructor(e){J(this,"isPolling",!1),J(this,"pollIntervalMs",3e3),J(this,"queue",[]),this.instance=e,this.queue=[],this.areWeOnline=!0,!pe(C)&&"onLine"in C.navigator&&(this.areWeOnline=C.navigator.onLine,C.addEventListener("online",()=>{this.areWeOnline=!0,this.flush()}),C.addEventListener("offline",()=>{this.areWeOnline=!1}))}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=yc(e,_d);Ut(t)&&t>0&&(i.url=Ti(i.url,{retry_count:t})),this.instance._send_request(G(G({},i),{},{callback:o=>{var a;o.statusCode!==200&&(o.statusCode<400||o.statusCode>=500)&&(t??0)<10?this.enqueue(G({retriesPerformedSoFar:t},i)):(a=i.callback)===null||a===void 0||a.call(i,o)}}))}enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(u){var d=3e3*Math.pow(2,u),p=d/2,m=Math.min(18e5,d),g=(Math.random()-.5)*(m-p);return Math.ceil(m+g)}(t),o=Date.now()+i;this.queue.push({retryAt:o,requestOptions:e});var a="Enqueued failed request for retry in ".concat(i);navigator.onLine||(a+=" (Browser is offline)"),O.warn(a),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var e=Date.now(),t=[],i=this.queue.filter(a=>a.retryAt<e||(t.push(a),!1));if(this.queue=t,i.length>0)for(var{requestOptions:o}of i)this.retriableRequest(o)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(G(G({},e),{},{transport:"sendBeacon"}))}catch(t){O.error(t)}this.queue=[]}}var Yr;class bd{constructor(e,t,i,o){var a;J(this,"_sessionIdChangedHandlers",[]),this.config=e,this.persistence=t,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=i||Or,this._windowIdGenerator=o||Or;var u=e.persistence_name||e.token,d=e.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*br(d,60,1800,"session_idle_timeout_seconds"),this._window_id_storage_key="ph_"+u+"_window_id",this._primary_window_exists_storage_key="ph_"+u+"_primary_window_exists",this._canUseSessionStorage()){var p=Et.parse(this._window_id_storage_key),m=Et.parse(this._primary_window_exists_storage_key);p&&!m?this._windowId=p:Et.remove(this._window_id_storage_key),Et.set(this._primary_window_exists_storage_key,!0)}if((a=this.config.bootstrap)!==null&&a!==void 0&&a.sessionID)try{var g=(v=>{var b=v.replace(/-/g,"");if(b.length!==32)throw new Error("Not a valid UUID");if(b[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(b.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),g)}catch(v){O.error("Invalid sessionID in bootstrap",v)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return pe(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&Et.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Et.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Et.parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[mi]:[t,e,i]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[mi];return ct(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){C==null||C.addEventListener("beforeunload",()=>{this._canUseSessionStorage()&&Et.remove(this._primary_window_exists_storage_key)})}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),[i,o,a]=this._getSessionId(),u=this._getWindowId(),d=Ut(a)&&a>0&&Math.abs(t-a)>864e5,p=!1,m=!o,g=!e&&Math.abs(t-i)>this.sessionTimeoutMs;m||g||d?(o=this._sessionIdGenerator(),u=this._windowIdGenerator(),O.info("[SessionId] new session ID generated",{sessionId:o,windowId:u,changeReason:{noSessionId:m,activityTimeout:g,sessionPastMaximumLength:d}}),a=t,p=!0):u||(u=this._windowIdGenerator(),p=!0);var v=i===0||!e||d?t:i,b=a===0?new Date().getTime():a;return this._setWindowId(u),this._setSessionId(o,v,b),p&&this._sessionIdChangedHandlers.forEach(y=>y(o,u,p?{noSessionId:m,activityTimeout:g,sessionPastMaximumLength:d}:void 0)),{sessionId:o,windowId:u,sessionStartTimestamp:b,changeReason:p?{noSessionId:m,activityTimeout:g,sessionPastMaximumLength:d}:void 0,lastActivityTimestamp:i}}}(function(r){r.US="us",r.EU="eu",r.CUSTOM="custom"})(Yr||(Yr={}));var tl="i.posthog.com";class wd{constructor(e){J(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(tl),".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Yr.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Yr.EU:this._regionCache[this.apiHost]=Yr.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(t&&(t=t[0]==="/"?t:"/".concat(t)),e==="ui")return this.uiHost+t;if(this.region===Yr.CUSTOM)return this.apiHost+t;var i=tl+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(i);case"api":return"https://".concat(this.region,".").concat(i)}}}var Ql="posthog-js";function eu(r){var{organization:e,projectId:t,prefix:i,severityAllowList:o=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return a=>{var u,d,p,m,g;if(!(o==="*"||o.includes(a.level))||!r.__loaded)return a;a.tags||(a.tags={});var v=r.requestRouter.endpointFor("ui","/project/".concat(r.config.token,"/person/").concat(r.get_distinct_id()));a.tags["PostHog Person URL"]=v,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var b=((u=a.exception)===null||u===void 0?void 0:u.values)||[];b.map(k=>{k.stacktrace&&(k.stacktrace.type="raw")});var y={$exception_message:((d=b[0])===null||d===void 0?void 0:d.value)||a.message,$exception_type:(p=b[0])===null||p===void 0?void 0:p.type,$exception_personURL:v,$exception_level:a.level,$exception_list:b,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((m=b[0])===null||m===void 0?void 0:m.value)||a.message,$sentry_exception_type:(g=b[0])===null||g===void 0?void 0:g.type,$sentry_tags:a.tags};return e&&t&&(y.$sentry_url=(i||"https://sentry.io/organizations/")+e+"/issues/?project="+t+"&query="+a.event_id),r.exceptions.sendExceptionEvent(y),a}}class Sd{constructor(e,t,i,o,a){this.name=Ql,this.setupOnce=function(u){u(eu(e,{organization:t,projectId:i,prefix:o,severityAllowList:a}))}}}var rl,xi,ir;function Id(r,e){var t=r.config.segment;if(!t)return e();(function(i,o){var a=i.config.segment;if(!a)return o();var u=p=>{var m=()=>p.anonymousId()||Or();i.config.get_device_id=m,p.id()&&(i.register({distinct_id:p.id(),$device_id:m()}),i.persistence.set_property(vr,"identified")),o()},d=a.user();"then"in d&&Jt(d.then)?d.then(p=>u(p)):u(d)})(r,()=>{t.register((i=>{Promise&&Promise.resolve||O.warn("This browser does not have Promise support, and can not use the segment integration");var o=(a,u)=>{var d;if(!u)return a;a.event.userId||a.event.anonymousId===i.get_distinct_id()||(O.info("Segment integration does not have a userId set, resetting PostHog"),i.reset()),a.event.userId&&a.event.userId!==i.get_distinct_id()&&(O.info("Segment integration has a userId set, identifying with PostHog"),i.identify(a.event.userId));var p=i._calculate_event_properties(u,(d=a.event.properties)!==null&&d!==void 0?d:{},new Date);return a.event.properties=Object.assign({},p,a.event.properties),a};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:a=>o(a,a.event.event),page:a=>o(a,"$pageview"),identify:a=>o(a,"$identify"),screen:a=>o(a,"$screen")}})(r)).then(()=>{e()})})}class Cd{constructor(e){this._instance=e}doPageView(e){var t,i=this._previousPageViewProperties(e);return this._currentPath=(t=C==null?void 0:C.location.pathname)!==null&&t!==void 0?t:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=e,i}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,i=this._prevPageviewTimestamp,o=this._instance.scrollManager.getContext();if(!i)return{};var a={};if(o){var{maxScrollHeight:u,lastScrollY:d,maxScrollY:p,maxContentHeight:m,lastContentY:g,maxContentY:v}=o;pe(u)||pe(d)||pe(p)||pe(m)||pe(g)||pe(v)||(u=Math.ceil(u),d=Math.ceil(d),p=Math.ceil(p),m=Math.ceil(m),g=Math.ceil(g),v=Math.ceil(v),a={$prev_pageview_last_scroll:d,$prev_pageview_last_scroll_percentage:u<=1?1:br(d/u,0,1),$prev_pageview_max_scroll:p,$prev_pageview_max_scroll_percentage:u<=1?1:br(p/u,0,1),$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:m<=1?1:br(g/m,0,1),$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:m<=1?1:br(v/m,0,1)})}return t&&(a.$prev_pageview_pathname=t),i&&(a.$prev_pageview_duration=(e.getTime()-i.getTime())/1e3),a}}(function(r){r.Popover="popover",r.API="api",r.Widget="widget"})(rl||(rl={})),function(r){r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link"}(xi||(xi={})),function(r){r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question"}(ir||(ir={}));class tu{constructor(){J(this,"events",{}),this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(i=>i!==t)}}emit(e,t){for(var i of this.events[e]||[])i(t);for(var o of this.events["*"]||[])o(e,t)}}class Ur{constructor(e){J(this,"_debugEventEmitter",new tu),J(this,"checkStep",(t,i)=>this.checkStepEvent(t,i)&&this.checkStepUrl(t,i)&&this.checkStepElement(t,i)),J(this,"checkStepEvent",(t,i)=>i==null||!i.event||(t==null?void 0:t.event)===(i==null?void 0:i.event)),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!pe((e=this.instance)===null||e===void 0?void 0:e._addCaptureHook)){var t;(t=this.instance)===null||t===void 0||t._addCaptureHook((i,o)=>{this.on(i,o)})}}register(e){var t,i;if(!pe((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(u=>{var d,p;(d=this.actionRegistry)===null||d===void 0||d.add(u),(p=u.steps)===null||p===void 0||p.forEach(m=>{var g;(g=this.actionEvents)===null||g===void 0||g.add((m==null?void 0:m.event)||"")})}),(i=this.instance)!==null&&i!==void 0&&i.autocapture)){var o,a=new Set;e.forEach(u=>{var d;(d=u.steps)===null||d===void 0||d.forEach(p=>{p!=null&&p.selector&&a.add(p==null?void 0:p.selector)})}),(o=this.instance)===null||o===void 0||o.autocapture.setElementSelectors(a)}}on(e,t){var i;t!=null&&e.length!=0&&(this.actionEvents.has(e)||this.actionEvents.has(t==null?void 0:t.event))&&this.actionRegistry&&((i=this.actionRegistry)===null||i===void 0?void 0:i.size)>0&&this.actionRegistry.forEach(o=>{this.checkAction(t,o)&&this._debugEventEmitter.emit("actionCaptured",o.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}checkAction(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var i of t.steps)if(this.checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(t!=null&&t.url){var i,o=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!o||typeof o!="string"||!Ur.matchString(o,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(e,t,i){switch(i){case"regex":return!!C&&gn(e,t);case"exact":return t===e;case"contains":var o=Ur.escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*");return gn(e,o);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.getElementsList(e).some(a=>!(t!=null&&t.href&&!Ur.matchString(a.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||a.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!Ur.matchString(a.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!Ur.matchString(a.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var i,o=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(!o||!o.includes(t==null?void 0:t.selector))return!1}return!0}getElementsList(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}class Hn{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;pe((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter(i=>{var o,a,u,d;return((o=i.conditions)===null||o===void 0?void 0:o.actions)&&((a=i.conditions)===null||a===void 0||(u=a.actions)===null||u===void 0||(d=u.values)===null||d===void 0?void 0:d.length)>0});t.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Ur(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(i=>{this.onAction(i)})),t.forEach(i=>{var o,a,u,d,p,m,g,v,b,y;i.conditions&&(o=i.conditions)!==null&&o!==void 0&&o.actions&&(a=i.conditions)!==null&&a!==void 0&&(u=a.actions)!==null&&u!==void 0&&u.values&&((d=i.conditions)===null||d===void 0||(p=d.actions)===null||p===void 0||(m=p.values)===null||m===void 0?void 0:m.length)>0&&((g=this.actionMatcher)===null||g===void 0||g.register(i.conditions.actions.values),(v=i.conditions)===null||v===void 0||(b=v.actions)===null||b===void 0||(y=b.values)===null||y===void 0||y.forEach(k=>{if(k&&k.name){var R=this.actionToSurveys.get(k.name);R&&R.push(i.id),this.actionToSurveys.set(k.name,R||[i.id])}}))}))}setupEventBasedSurveys(e){var t;e.filter(i=>{var o,a,u,d;return((o=i.conditions)===null||o===void 0?void 0:o.events)&&((a=i.conditions)===null||a===void 0||(u=a.events)===null||u===void 0||(d=u.values)===null||d===void 0?void 0:d.length)>0}).length!==0&&((t=this.instance)===null||t===void 0||t._addCaptureHook((i,o)=>{this.onEvent(i,o)}),e.forEach(i=>{var o,a,u;(o=i.conditions)===null||o===void 0||(a=o.events)===null||a===void 0||(u=a.values)===null||u===void 0||u.forEach(d=>{if(d&&d.name){var p=this.eventToSurveys.get(d.name);p&&p.push(i.id),this.eventToSurveys.set(d.name,p||[i.id])}})}))}onEvent(e,t){var i,o,a=((i=this.instance)===null||i===void 0||(o=i.persistence)===null||o===void 0?void 0:o.props[ii])||[];if(Hn.SURVEY_SHOWN_EVENT_NAME==e&&t&&a.length>0){var u,d=t==null||(u=t.properties)===null||u===void 0?void 0:u.$survey_id;if(d){var p=a.indexOf(d);p>=0&&(a.splice(p,1),this._updateActivatedSurveys(a))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(a.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,i,o=((t=this.instance)===null||t===void 0||(i=t.persistence)===null||i===void 0?void 0:i.props[ii])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(o.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,i;(t=this.instance)===null||t===void 0||(i=t.persistence)===null||i===void 0||i.register({[ii]:[...new Set(e)]})}getSurveys(){var e,t,i=(e=this.instance)===null||e===void 0||(t=e.persistence)===null||t===void 0?void 0:t.props[ii];return i||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}J(Hn,"SURVEY_SHOWN_EVENT_NAME","survey shown");var ru,it,nu,Vr,nl,iu,Us,su,Vs={},ou=[],Ed=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,no=Array.isArray;function Nr(r,e){for(var t in e)r[t]=e[t];return r}function au(r){var e=r.parentNode;e&&e.removeChild(r)}function bs(r,e,t,i,o){var a={type:r,props:e,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++nu,__i:-1,__u:0};return o==null&&it.vnode!=null&&it.vnode(a),a}function io(r){return r.children}function gi(r,e){this.props=r,this.context=e}function _n(r,e){if(e==null)return r.__?_n(r.__,r.__i+1):null;for(var t;e<r.__k.length;e++)if((t=r.__k[e])!=null&&t.__e!=null)return t.__e;return typeof r.type=="function"?_n(r):null}function lu(r){var e,t;if((r=r.__)!=null&&r.__c!=null){for(r.__e=r.__c.base=null,e=0;e<r.__k.length;e++)if((t=r.__k[e])!=null&&t.__e!=null){r.__e=r.__c.base=t.__e;break}return lu(r)}}function zs(r){(!r.__d&&(r.__d=!0)&&Vr.push(r)&&!Ri.__r++||nl!==it.debounceRendering)&&((nl=it.debounceRendering)||iu)(Ri)}function Ri(){var r,e,t,i,o,a,u,d,p;for(Vr.sort(Us);r=Vr.shift();)r.__d&&(e=Vr.length,i=void 0,a=(o=(t=r).__v).__e,d=[],p=[],(u=t.__P)&&((i=Nr({},o)).__v=o.__v+1,it.vnode&&it.vnode(i),du(u,i,o,t.__n,u.ownerSVGElement!==void 0,32&o.__u?[a]:null,d,a??_n(o),!!(32&o.__u),p),i.__.__k[i.__i]=i,xd(d,i,p),i.__e!=a&&lu(i)),Vr.length>e&&Vr.sort(Us));Ri.__r=0}function uu(r,e,t,i,o,a,u,d,p,m,g){var v,b,y,k,R,W=i&&i.__k||ou,B=e.length;for(t.__d=p,kd(t,e,W),p=t.__d,v=0;v<B;v++)(y=t.__k[v])!=null&&typeof y!="boolean"&&typeof y!="function"&&(b=y.__i===-1?Vs:W[y.__i]||Vs,y.__i=v,du(r,y,b,o,a,u,d,p,m,g),k=y.__e,y.ref&&b.ref!=y.ref&&(b.ref&&so(b.ref,null,y),g.push(y.ref,y.__c||k,y)),R==null&&k!=null&&(R=k),65536&y.__u||b.__k===y.__k?p=cu(y,p,r):typeof y.type=="function"&&y.__d!==void 0?p=y.__d:k&&(p=k.nextSibling),y.__d=void 0,y.__u&=-196609);t.__d=p,t.__e=R}function kd(r,e,t){var i,o,a,u,d,p=e.length,m=t.length,g=m,v=0;for(r.__k=[],i=0;i<p;i++)(o=r.__k[i]=(o=e[i])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?bs(null,o,null,null,o):no(o)?bs(io,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?bs(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=r,o.__b=r.__b+1,d=Td(o,t,u=i+v,g),o.__i=d,a=null,d!==-1&&(g--,(a=t[d])&&(a.__u|=131072)),a==null||a.__v===null?(d==-1&&v--,typeof o.type!="function"&&(o.__u|=65536)):d!==u&&(d===u+1?v++:d>u?g>p-u?v+=d-u:v--:v=d<u&&d==u-1?d-u:0,d!==i+v&&(o.__u|=65536))):(a=t[i])&&a.key==null&&a.__e&&(a.__e==r.__d&&(r.__d=_n(a)),Ys(a,a,!1),t[i]=null,g--);if(g)for(i=0;i<m;i++)(a=t[i])!=null&&!(131072&a.__u)&&(a.__e==r.__d&&(r.__d=_n(a)),Ys(a,a))}function cu(r,e,t){var i,o;if(typeof r.type=="function"){for(i=r.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=r,e=cu(i[o],e,t));return e}return r.__e!=e&&(t.insertBefore(r.__e,e||null),e=r.__e),e&&e.nextSibling}function Td(r,e,t,i){var o=r.key,a=r.type,u=t-1,d=t+1,p=e[t];if(p===null||p&&o==p.key&&a===p.type)return t;if(i>(p!=null&&!(131072&p.__u)?1:0))for(;u>=0||d<e.length;){if(u>=0){if((p=e[u])&&!(131072&p.__u)&&o==p.key&&a===p.type)return u;u--}if(d<e.length){if((p=e[d])&&!(131072&p.__u)&&o==p.key&&a===p.type)return d;d++}}return-1}function il(r,e,t){e[0]==="-"?r.setProperty(e,t??""):r[e]=t==null?"":typeof t!="number"||Ed.test(e)?t:t+"px"}function ci(r,e,t,i,o){var a;e:if(e==="style")if(typeof t=="string")r.style.cssText=t;else{if(typeof i=="string"&&(r.style.cssText=i=""),i)for(e in i)t&&e in t||il(r.style,e,"");if(t)for(e in t)i&&t[e]===i[e]||il(r.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")a=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in r?e.toLowerCase().slice(2):e.slice(2),r.l||(r.l={}),r.l[e+a]=t,t?i?t.u=i.u:(t.u=Date.now(),r.addEventListener(e,a?ol:sl,a)):r.removeEventListener(e,a?ol:sl,a);else{if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in r)try{r[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?r.removeAttribute(e):r.setAttribute(e,t))}}function sl(r){var e=this.l[r.type+!1];if(r.t){if(r.t<=e.u)return}else r.t=Date.now();return e(it.event?it.event(r):r)}function ol(r){return this.l[r.type+!0](it.event?it.event(r):r)}function du(r,e,t,i,o,a,u,d,p,m){var g,v,b,y,k,R,W,B,q,le,ue,Ee,Ge,we,_e,Ne=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(p=!!(32&t.__u),a=[d=e.__e=t.__e]),(g=it.__b)&&g(e);e:if(typeof Ne=="function")try{if(B=e.props,q=(g=Ne.contextType)&&i[g.__c],le=g?q?q.props.value:g.__:i,t.__c?W=(v=e.__c=t.__c).__=v.__E:("prototype"in Ne&&Ne.prototype.render?e.__c=v=new Ne(B,le):(e.__c=v=new gi(B,le),v.constructor=Ne,v.render=Md),q&&q.sub(v),v.props=B,v.state||(v.state={}),v.context=le,v.__n=i,b=v.__d=!0,v.__h=[],v._sb=[]),v.__s==null&&(v.__s=v.state),Ne.getDerivedStateFromProps!=null&&(v.__s==v.state&&(v.__s=Nr({},v.__s)),Nr(v.__s,Ne.getDerivedStateFromProps(B,v.__s))),y=v.props,k=v.state,v.__v=e,b)Ne.getDerivedStateFromProps==null&&v.componentWillMount!=null&&v.componentWillMount(),v.componentDidMount!=null&&v.__h.push(v.componentDidMount);else{if(Ne.getDerivedStateFromProps==null&&B!==y&&v.componentWillReceiveProps!=null&&v.componentWillReceiveProps(B,le),!v.__e&&(v.shouldComponentUpdate!=null&&v.shouldComponentUpdate(B,v.__s,le)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(v.props=B,v.state=v.__s,v.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(qe){qe&&(qe.__=e)}),ue=0;ue<v._sb.length;ue++)v.__h.push(v._sb[ue]);v._sb=[],v.__h.length&&u.push(v);break e}v.componentWillUpdate!=null&&v.componentWillUpdate(B,v.__s,le),v.componentDidUpdate!=null&&v.__h.push(function(){v.componentDidUpdate(y,k,R)})}if(v.context=le,v.props=B,v.__P=r,v.__e=!1,Ee=it.__r,Ge=0,"prototype"in Ne&&Ne.prototype.render){for(v.state=v.__s,v.__d=!1,Ee&&Ee(e),g=v.render(v.props,v.state,v.context),we=0;we<v._sb.length;we++)v.__h.push(v._sb[we]);v._sb=[]}else do v.__d=!1,Ee&&Ee(e),g=v.render(v.props,v.state,v.context),v.state=v.__s;while(v.__d&&++Ge<25);v.state=v.__s,v.getChildContext!=null&&(i=Nr(Nr({},i),v.getChildContext())),b||v.getSnapshotBeforeUpdate==null||(R=v.getSnapshotBeforeUpdate(y,k)),uu(r,no(_e=g!=null&&g.type===io&&g.key==null?g.props.children:g)?_e:[_e],e,t,i,o,a,u,d,p,m),v.base=e.__e,e.__u&=-161,v.__h.length&&u.push(v),W&&(v.__E=v.__=null)}catch(qe){e.__v=null,p||a!=null?(e.__e=d,e.__u|=p?160:32,a[a.indexOf(d)]=null):(e.__e=t.__e,e.__k=t.__k),it.__e(qe,e,t)}else a==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=Rd(t.__e,e,t,i,o,a,u,p,m);(g=it.diffed)&&g(e)}function xd(r,e,t){e.__d=void 0;for(var i=0;i<t.length;i++)so(t[i],t[++i],t[++i]);it.__c&&it.__c(e,r),r.some(function(o){try{r=o.__h,o.__h=[],r.some(function(a){a.call(o)})}catch(a){it.__e(a,o.__v)}})}function Rd(r,e,t,i,o,a,u,d,p){var m,g,v,b,y,k,R,W=t.props,B=e.props,q=e.type;if(q==="svg"&&(o=!0),a!=null){for(m=0;m<a.length;m++)if((y=a[m])&&"setAttribute"in y==!!q&&(q?y.localName===q:y.nodeType===3)){r=y,a[m]=null;break}}if(r==null){if(q===null)return document.createTextNode(B);r=o?document.createElementNS("http://www.w3.org/2000/svg",q):document.createElement(q,B.is&&B),a=null,d=!1}if(q===null)W===B||d&&r.data===B||(r.data=B);else{if(a=a&&ru.call(r.childNodes),W=t.props||Vs,!d&&a!=null)for(W={},m=0;m<r.attributes.length;m++)W[(y=r.attributes[m]).name]=y.value;for(m in W)y=W[m],m=="children"||(m=="dangerouslySetInnerHTML"?v=y:m==="key"||m in B||ci(r,m,null,y,o));for(m in B)y=B[m],m=="children"?b=y:m=="dangerouslySetInnerHTML"?g=y:m=="value"?k=y:m=="checked"?R=y:m==="key"||d&&typeof y!="function"||W[m]===y||ci(r,m,y,W[m],o);if(g)d||v&&(g.__html===v.__html||g.__html===r.innerHTML)||(r.innerHTML=g.__html),e.__k=[];else if(v&&(r.innerHTML=""),uu(r,no(b)?b:[b],e,t,i,o&&q!=="foreignObject",a,u,a?a[0]:t.__k&&_n(t,0),d,p),a!=null)for(m=a.length;m--;)a[m]!=null&&au(a[m]);d||(m="value",k!==void 0&&(k!==r[m]||q==="progress"&&!k||q==="option"&&k!==W[m])&&ci(r,m,k,W[m],!1),m="checked",R!==void 0&&R!==r[m]&&ci(r,m,R,W[m],!1))}return r}function so(r,e,t){try{typeof r=="function"?r(e):r.current=e}catch(i){it.__e(i,t)}}function Ys(r,e,t){var i,o;if(it.unmount&&it.unmount(r),(i=r.ref)&&(i.current&&i.current!==r.__e||so(i,null,e)),(i=r.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(a){it.__e(a,e)}i.base=i.__P=null,r.__c=void 0}if(i=r.__k)for(o=0;o<i.length;o++)i[o]&&Ys(i[o],e,t||typeof r.type!="function");t||r.__e==null||au(r.__e),r.__=r.__e=r.__d=void 0}function Md(r,e,t){return this.constructor(r,t)}ru=ou.slice,it={__e:function(r,e,t,i){for(var o,a,u;e=e.__;)if((o=e.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(r)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(r,i||{}),u=o.__d),u)return o.__E=o}catch(d){r=d}throw r}},nu=0,gi.prototype.setState=function(r,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Nr({},this.state),typeof r=="function"&&(r=r(Nr({},t),this.props)),r&&Nr(t,r),r!=null&&this.__v&&(e&&this._sb.push(e),zs(this))},gi.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),zs(this))},gi.prototype.render=io,Vr=[],iu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Us=function(r,e){return r.__v.__b-e.__v.__b},Ri.__r=0,su=0;(function(r,e){var t={__c:e="__cC"+su++,__:r,Consumer:function(i,o){return i.children(o)},Provider:function(i){var o,a;return this.getChildContext||(o=[],(a={})[e]=this,this.getChildContext=function(){return a},this.shouldComponentUpdate=function(u){this.props.value!==u.value&&o.some(function(d){d.__e=!0,zs(d)})},this.sub=function(u){o.push(u);var d=u.componentWillUnmount;u.componentWillUnmount=function(){o.splice(o.indexOf(u),1),d&&d.call(u)}}),i.children}};t.Provider.__=t.Consumer.contextType=t})({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});var Tn="[Surveys]",Ad={icontains:r=>!!C&&C.location.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:r=>!!C&&C.location.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:r=>!!C&&gn(C.location.href,r),not_regex:r=>!!C&&!gn(C.location.href,r),exact:r=>(C==null?void 0:C.location.href)===r,is_not:r=>(C==null?void 0:C.location.href)!==r};class Od{constructor(e){this.instance=e,this._surveyEventReceiver=null}afterDecideResponse(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var t=[],i=0;i<localStorage.length;i++){var o=localStorage.key(i);o!=null&&o.startsWith("seenSurvey_")&&t.push(o)}return t})();e.forEach(t=>localStorage.removeItem(t))}loadIfEnabled(){var e,t,i,o=Ae==null||(e=Ae.__PosthogExtensions__)===null||e===void 0?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||o||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Hn(this.instance)),(t=Ae.__PosthogExtensions__)===null||t===void 0||(i=t.loadExternalDependency)===null||i===void 0||i.call(t,this.instance,"surveys",a=>{var u,d;if(a)return O.error(Tn,"Could not load surveys script",a);this._surveyManager=(u=Ae.__PosthogExtensions__)===null||u===void 0||(d=u.generateSurveys)===null||d===void 0?void 0:d.call(u,this.instance)}))}getSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return e([]);this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Hn(this.instance));var i=this.instance.get_property(xs);if(i&&!t)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:o=>{var a;if(o.statusCode!==200||!o.json)return e([]);var u,d=o.json.surveys||[],p=d.filter(m=>{var g,v,b,y,k,R,W,B,q,le,ue,Ee;return((g=m.conditions)===null||g===void 0?void 0:g.events)&&((v=m.conditions)===null||v===void 0||(b=v.events)===null||b===void 0?void 0:b.values)&&((y=m.conditions)===null||y===void 0||(k=y.events)===null||k===void 0||(R=k.values)===null||R===void 0?void 0:R.length)>0||((W=m.conditions)===null||W===void 0?void 0:W.actions)&&((B=m.conditions)===null||B===void 0||(q=B.actions)===null||q===void 0?void 0:q.values)&&((le=m.conditions)===null||le===void 0||(ue=le.actions)===null||ue===void 0||(Ee=ue.values)===null||Ee===void 0?void 0:Ee.length)>0});return p.length>0&&((u=this._surveyEventReceiver)===null||u===void 0||u.register(p)),(a=this.instance.persistence)===null||a===void 0||a.register({[xs]:d}),e(d)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(i=>{var o,a=i.filter(p=>!(!p.start_date||p.end_date)).filter(p=>{var m,g,v,b;if(!p.conditions)return!0;var y=(m=p.conditions)===null||m===void 0||!m.url||Ad[(g=(v=p.conditions)===null||v===void 0?void 0:v.urlMatchType)!==null&&g!==void 0?g:"icontains"](p.conditions.url),k=(b=p.conditions)===null||b===void 0||!b.selector||(ne==null?void 0:ne.querySelector(p.conditions.selector));return y&&k}),u=(o=this._surveyEventReceiver)===null||o===void 0?void 0:o.getSurveys(),d=a.filter(p=>{var m,g,v,b,y,k,R,W,B,q,le;if(!(p.linked_flag_key||p.targeting_flag_key||p.internal_targeting_flag_key||(m=p.feature_flag_keys)!==null&&m!==void 0&&m.length))return!0;var ue=!p.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(p.linked_flag_key),Ee=!p.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(p.targeting_flag_key),Ge=((g=p.conditions)===null||g===void 0?void 0:g.events)&&((v=p.conditions)===null||v===void 0||(b=v.events)===null||b===void 0?void 0:b.values)&&((y=p.conditions)===null||y===void 0||(k=y.events)===null||k===void 0?void 0:k.values.length)>0,we=((R=p.conditions)===null||R===void 0?void 0:R.actions)&&((W=p.conditions)===null||W===void 0||(B=W.actions)===null||B===void 0?void 0:B.values)&&((q=p.conditions)===null||q===void 0||(le=q.actions)===null||le===void 0?void 0:le.values.length)>0,_e=!Ge&&!we||(u==null?void 0:u.includes(p.id)),Ne=this._canActivateRepeatedly(p),qe=!(p.internal_targeting_flag_key&&!Ne)||this.instance.featureFlags.isFeatureEnabled(p.internal_targeting_flag_key),Ze=this.checkFlags(p);return ue&&Ee&&qe&&_e&&Ze});return e(d)},t)}checkFlags(e){var t;return(t=e.feature_flag_keys)===null||t===void 0||!t.length||e.feature_flag_keys.every(i=>{var{key:o,value:a}=i;return!o||!a||this.instance.featureFlags.isFeatureEnabled(a)})}getNextSurveyStep(e,t,i){var o,a=e.questions[t],u=t+1;if((o=a.branching)===null||o===void 0||!o.type)return t===e.questions.length-1?ir.End:u;if(a.branching.type===ir.End)return ir.End;if(a.branching.type===ir.SpecificQuestion){if(Number.isInteger(a.branching.index))return a.branching.index}else if(a.branching.type===ir.ResponseBased){if(a.type===xi.SingleChoice){var d,p,m=a.choices.indexOf("".concat(i));if((d=a.branching)!==null&&d!==void 0&&(p=d.responseValues)!==null&&p!==void 0&&p.hasOwnProperty(m)){var g=a.branching.responseValues[m];return Number.isInteger(g)?g:g===ir.End?ir.End:u}}else if(a.type===xi.Rating){var v,b;if(typeof i!="number"||!Number.isInteger(i))throw new Error("The response type must be an integer");var y=function(R,W){if(W===3){if(R<1||R>3)throw new Error("The response must be in range 1-3");return R===1?"negative":R===2?"neutral":"positive"}if(W===5){if(R<1||R>5)throw new Error("The response must be in range 1-5");return R<=2?"negative":R===3?"neutral":"positive"}if(W===7){if(R<1||R>7)throw new Error("The response must be in range 1-7");return R<=3?"negative":R===4?"neutral":"positive"}if(W===10){if(R<0||R>10)throw new Error("The response must be in range 0-10");return R<=6?"detractors":R<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(i,a.scale);if((v=a.branching)!==null&&v!==void 0&&(b=v.responseValues)!==null&&b!==void 0&&b.hasOwnProperty(y)){var k=a.branching.responseValues[y];return Number.isInteger(k)?k:k===ir.End?ir.End:u}}return u}return O.warn(Tn,"Falling back to next question index due to unexpected branching type"),u}_canActivateRepeatedly(e){var t;return Je((t=Ae.__PosthogExtensions__)===null||t===void 0?void 0:t.canActivateRepeatedly)?(O.warn(Tn,"canActivateRepeatedly is not defined, must init before calling"),!1):Ae.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){Je(this._surveyManager)?O.warn(Tn,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(t=>{var i=t.filter(o=>o.id===e)[0];this._surveyManager.canRenderSurvey(i)})}renderSurvey(e,t){Je(this._surveyManager)?O.warn(Tn,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(i=>{var o=i.filter(a=>a.id===e)[0];this._surveyManager.renderSurvey(o,ne==null?void 0:ne.querySelector(t))})}}class Nd{constructor(e){var t,i;J(this,"serverLimits",{}),J(this,"lastEventRateLimited",!1),J(this,"checkForLimiting",o=>{var a=o.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach(u=>{O.info("[RateLimiter] ".concat(u||"events"," is quota limited.")),this.serverLimits[u]=new Date().getTime()+6e4})}catch(u){return void O.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(u==null?void 0:u.message,'"'),{text:a})}}),this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)===null||t===void 0?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)===null||i===void 0?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,i,o=arguments.length>0&&arguments[0]!==void 0&&arguments[0],a=new Date().getTime(),u=(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_property(Ms))!==null&&e!==void 0?e:{tokens:this.captureEventsBurstLimit,last:a};u.tokens+=(a-u.last)/1e3*this.captureEventsPerSecond,u.last=a,u.tokens>this.captureEventsBurstLimit&&(u.tokens=this.captureEventsBurstLimit);var d=u.tokens<1;return d||o||(u.tokens=Math.max(0,u.tokens-1)),!d||this.lastEventRateLimited||o||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=d,(i=this.instance.persistence)===null||i===void 0||i.set_property(Ms,u),{isRateLimited:d,remainingTokens:u.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Fd=()=>G({initialPathName:(Ht==null?void 0:Ht.pathname)||"",referringDomain:ut.referringDomain()},ut.campaignParams());class Pd{constructor(e,t,i){J(this,"_onSessionIdCallback",o=>{var a=this._getStoredProps();if(!a||a.sessionId!==o){var u={sessionId:o,props:this._sessionSourceParamGenerator()};this._persistence.register({[Rs]:u})}}),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=i||Fd,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[Rs]}getSessionProps(){var e,t=(e=this._getStoredProps())===null||e===void 0?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}}var Ld=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],al=function(r,e){if(!r)return!1;var t=r.toLowerCase();return Ld.concat(e||[]).some(i=>{var o=i.toLowerCase();return t.indexOf(o)!==-1})},hu=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&al(t,e))return!0;try{var i=r==null?void 0:r.userAgentData;if(i!=null&&i.brands&&i.brands.some(o=>al(o==null?void 0:o.brand,e)))return!0}catch{}return!!r.webdriver};class pu{constructor(){this.clicks=[]}isRageClick(e,t,i){var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(e-o.x)+Math.abs(t-o.y)<30&&i-o.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var di="[Dead Clicks]",Dd=()=>!0,Bd=r=>{var e,t=!((e=r.instance.persistence)===null||e===void 0||!e.get_property(_l)),i=r.instance.config.capture_dead_clicks;return zr(i)?i:t};class gu{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}afterDecideResponse(e){this.instance.persistence&&this.instance.persistence.register({[_l]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(e){var t,i,o;(t=Ae.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture&&e(),(i=Ae.__PosthogExtensions__)===null||i===void 0||(o=i.loadExternalDependency)===null||o===void 0||o.call(i,this.instance,"dead-clicks-autocapture",a=>{a?O.error(di+" failed to load script",a):e()})}start(){var e;if(ne){if(!this._lazyLoadedDeadClicksAutocapture&&(e=Ae.__PosthogExtensions__)!==null&&e!==void 0&&e.initDeadClicksAutocapture){var t=dt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Ae.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ne),O.info("".concat(di," starting..."))}}else O.error(di+" `document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,O.info("".concat(di," stopping...")))}}class Hd{constructor(e){var t;J(this,"rageclicks",new pu),J(this,"_enabledServerSide",!1),J(this,"_initialized",!1),J(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[Es]),C==null||C.addEventListener("beforeunload",()=>{this.flush()})}get flushIntervalMilliseconds(){var e=5e3;return dt(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return pe(this.instance.config.capture_heatmaps)?pe(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;O.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this._flushInterval)!==null&&e!==void 0?e:void 0),(t=this.deadClicksCapture)===null||t===void 0||t.stop(),this.getAndClearBuffer()}}afterDecideResponse(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Es]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){C&&ne&&(yr(ne,"click",e=>this._onClick(e||(C==null?void 0:C.event)),!1,!0),yr(ne,"mousemove",e=>this._onMouseMove(e||(C==null?void 0:C.event)),!1,!0),this.deadClicksCapture=new gu(this.instance,Dd,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),u=function(d,p,m){for(var g=d;g&&Oi(g)&&!Pr(g,"body");){if(g===m)return!1;if(Pe(p,C==null?void 0:C.getComputedStyle(g).position))return!0;g=Wl(g)}return!1}(Hl(e),["fixed","sticky"],a);return{x:e.clientX+(u?0:o),y:e.clientY+(u?0:i),target_fixed:u,type:t}}_onClick(e){var t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!$a(e.target)){var o=this._getProperties(e,i);(t=this.rageclicks)!==null&&t!==void 0&&t.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._capture(G(G({},o),{},{type:"rageclick"})),this._capture(o)}}_onMouseMove(e){$a(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(C){var t=C.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}flush(){this.buffer&&!an(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Wd{constructor(e){J(this,"_updateScrollData",()=>{var t,i,o,a;this.context||(this.context={});var u=this.scrollElement(),d=this.scrollY(),p=u?Math.max(0,u.scrollHeight-u.clientHeight):0,m=d+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.context.lastScrollY=Math.ceil(d),this.context.maxScrollY=Math.max(d,(t=this.context.maxScrollY)!==null&&t!==void 0?t:0),this.context.maxScrollHeight=Math.max(p,(i=this.context.maxScrollHeight)!==null&&i!==void 0?i:0),this.context.lastContentY=m,this.context.maxContentY=Math.max(m,(o=this.context.maxContentY)!==null&&o!==void 0?o:0),this.context.maxContentHeight=Math.max(g,(a=this.context.maxContentHeight)!==null&&a!==void 0?a:0)}),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){C==null||C.addEventListener("scroll",this._updateScrollData,!0),C==null||C.addEventListener("scrollend",this._updateScrollData,!0),C==null||C.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return C==null?void 0:C.document.documentElement;var e=ct(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var t of e){var i=C==null?void 0:C.document.querySelector(t);if(i)return i}}scrollY(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return C&&(C.scrollY||C.pageYOffset||C.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return C&&(C.scrollX||C.pageXOffset||C.document.documentElement.scrollLeft)||0}}function ws(r,e){return e.length>r?e.slice(0,r)+"...":e}function $d(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Oi(e));return e}function jd(r,e,t,i){var o=r.tagName.toLowerCase(),a={tag_name:o};Ds.indexOf(o)>-1&&!t&&(o.toLowerCase()==="a"||o.toLowerCase()==="button"?a.$el_text=ws(1024,ql(r)):a.$el_text=ws(1024,Ni(r)));var u=Ei(r);u.length>0&&(a.classes=u.filter(function(g){return g!==""})),Xe(r.attributes,function(g){var v;if((!$l(r)||["name","id","class","aria-label"].indexOf(g.name)!==-1)&&(i==null||!i.includes(g.name))&&!e&&vn(g.value)&&(v=g.name,!xt(v)||v.substring(0,10)!=="_ngcontent"&&v.substring(0,7)!=="_nghost")){var b=g.value;g.name==="class"&&(b=eo(b).join(" ")),a["attr__"+g.name]=ws(1024,b)}});for(var d=1,p=1,m=r;m=$d(m);)d++,m.tagName===r.tagName&&p++;return a.nth_child=d,a.nth_of_type=p,a}function Gd(r,e){for(var t,i,{e:o,maskAllElementAttributes:a,maskAllText:u,elementAttributeIgnoreList:d,elementsChainAsString:p}=e,m=[r],g=r;g.parentNode&&!Pr(g,"body");)Dl(g.parentNode)?(m.push(g.parentNode.host),g=g.parentNode.host):(m.push(g.parentNode),g=g.parentNode);var v,b=[],y={},k=!1,R=!1;if(Xe(m,ue=>{var Ee=Bs(ue);ue.tagName.toLowerCase()==="a"&&(k=ue.getAttribute("href"),k=Ee&&k&&vn(k)&&k),Pe(Ei(ue),"ph-no-capture")&&(R=!0),b.push(jd(ue,a,u,d));var Ge=function(we){if(!Bs(we))return{};var _e={};return Xe(we.attributes,function(Ne){if(Ne.name&&Ne.name.indexOf("data-ph-capture-attribute")===0){var qe=Ne.name.replace("data-ph-capture-attribute-",""),Ze=Ne.value;qe&&Ze&&vn(Ze)&&(_e[qe]=Ze)}}),_e}(ue);Ft(y,Ge)}),R)return{props:{},explicitNoCapture:R};if(u||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?b[0].$el_text=ql(r):b[0].$el_text=Ni(r)),k){var W,B;b[0].attr__href=k;var q=(W=dn(k))===null||W===void 0?void 0:W.host,le=C==null||(B=C.location)===null||B===void 0?void 0:B.host;q&&le&&q!==le&&(v=k)}return{props:Ft({$event_type:o.type,$ce_version:1},p?{$elements_chain:Yc(b)}:{$elements:b},(t=b[0])!==null&&t!==void 0&&t.$el_text?{$el_text:(i=b[0])===null||i===void 0?void 0:i.$el_text}:{},v&&o.type==="click"?{$external_click_url:v}:{},y)}}class qd{constructor(e){J(this,"_initialized",!1),J(this,"_isDisabledServerSide",null),J(this,"rageclicks",new pu),J(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,i=dt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),i.url_ignorelist=(t=i.url_ignorelist)===null||t===void 0?void 0:t.map(o=>new RegExp(o)),i}_addDomEventHandlers(){if(this.isBrowserSupported()){if(C&&ne){var e=i=>{i=i||(C==null?void 0:C.event);try{this._captureEvent(i)}catch(o){O.error("Failed to capture event",o)}},t=i=>{i=i||(C==null?void 0:C.event),this._captureEvent(i,ds)};yr(ne,"submit",e,!1,!0),yr(ne,"change",e,!1,!0),yr(ne,"click",e,!1,!0),this.config.capture_copied_text&&(yr(ne,"copy",t,!1,!0),yr(ne,"cut",t,!1,!0))}}else O.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}afterDecideResponse(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ia]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return(t=this._elementSelectors)===null||t===void 0||t.forEach(o=>{var a=ne==null?void 0:ne.querySelectorAll(o);a==null||a.forEach(u=>{e===u&&i.push(o)})}),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)===null||e===void 0?void 0:e.props[Ia],o=this._isDisabledServerSide;if(Lr(o)&&!zr(i)&&!this.instance.config.advanced_disable_decide)return!1;var a=(t=this._isDisabledServerSide)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!a}_captureEvent(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var i,o=Hl(e);Ll(o)&&(o=o.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._captureEvent(e,"$rageclick");var a=t===ds;if(o&&Gc(o,e,this.config,a,a?["copy","cut"]:void 0)){var{props:u,explicitNoCapture:d}=Gd(o,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(d)return!1;var p=this.getElementSelectors(o);if(p&&p.length>0&&(u.$element_selectors=p),t===ds){var m,g=Bl(C==null||(m=C.getSelection())===null||m===void 0?void 0:m.toString()),v=e.type||"clipboard";if(!g)return!1;u.$selected_content=g,u.$copy_type=v}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return Jt(ne==null?void 0:ne.querySelectorAll)}}class Ud{constructor(e){J(this,"_restoreXHRPatch",void 0),J(this,"_restoreFetchPatch",void 0),J(this,"_startCapturing",()=>{var t,i,o,a;pe(this._restoreXHRPatch)&&((t=Ae.__PosthogExtensions__)===null||t===void 0||(i=t.tracingHeadersPatchFns)===null||i===void 0||i._patchXHR(this.instance.sessionManager)),pe(this._restoreFetchPatch)&&((o=Ae.__PosthogExtensions__)===null||o===void 0||(a=o.tracingHeadersPatchFns)===null||a===void 0||a._patchFetch(this.instance.sessionManager))}),this.instance=e}_loadScript(e){var t,i,o;(t=Ae.__PosthogExtensions__)!==null&&t!==void 0&&t.tracingHeadersPatchFns&&e(),(i=Ae.__PosthogExtensions__)===null||i===void 0||(o=i.loadExternalDependency)===null||o===void 0||o.call(i,this.instance,"tracing-headers",a=>{if(a)return O.error("[TRACING-HEADERS] failed to load script",a);e()})}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((e=this._restoreXHRPatch)===null||e===void 0||e.call(this),(t=this._restoreFetchPatch)===null||t===void 0||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Ar;(function(r){r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED"})(Ar||(Ar={}));class Vd{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?Ar.DENIED:this.storedConsent}isOptedOut(){return this.consent===Ar.DENIED||this.consent===Ar.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return e==="1"?Ar.GRANTED:e==="0"?Ar.DENIED:Ar.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage=e==="localStorage"?mt:wr;var t=e==="localStorage"?wr:mt;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(t.get(this.storageKey)==="1"),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!gl([Vt==null?void 0:Vt.doNotTrack,Vt==null?void 0:Vt.msDoNotTrack,Ae.doNotTrack],e=>Pe([!0,1,"1","yes"],e))}}var hi="[Exception Autocapture]";class zd{constructor(e){var t;J(this,"originalOnUnhandledRejectionHandler",void 0),J(this,"startCapturing",()=>{var i,o,a,u;if(C&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var d=(i=Ae.__PosthogExtensions__)===null||i===void 0||(o=i.errorWrappingFunctions)===null||o===void 0?void 0:o.wrapOnError,p=(a=Ae.__PosthogExtensions__)===null||a===void 0||(u=a.errorWrappingFunctions)===null||u===void 0?void 0:u.wrapUnhandledRejection;if(d&&p)try{this.unwrapOnError=d(this.captureException.bind(this)),this.unwrapUnhandledRejection=p(this.captureException.bind(this))}catch(m){O.error(hi+" failed to start",m),this.stopCapturing()}else O.error(hi+" failed to load error wrapping functions - cannot start")}}),this.instance=e,this.remoteEnabled=!((t=this.instance.persistence)===null||t===void 0||!t.props[Ca]),this.startIfEnabled()}get isEnabled(){var e;return(e=this.remoteEnabled)!==null&&e!==void 0&&e}get isCapturing(){var e;return!(C==null||(e=C.onerror)===null||e===void 0||!e.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(O.info(hi+" enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,i;this.hasHandlers&&e(),(t=Ae.__PosthogExtensions__)===null||t===void 0||(i=t.loadExternalDependency)===null||i===void 0||i.call(t,this.instance,"exception-autocapture",o=>{if(o)return O.error(hi+" failed to load script",o);e()})}stopCapturing(){var e,t;(e=this.unwrapOnError)===null||e===void 0||e.call(this),(t=this.unwrapUnhandledRejection)===null||t===void 0||t.call(this)}afterDecideResponse(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[Ca]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}var ll=9e5,qr="[Web Vitals]";class Yd{constructor(e){var t;J(this,"_enabledServerSide",!1),J(this,"_initialized",!1),J(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),J(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((i,o)=>G(G({},i),{},{["$web_vitals_".concat(o.name,"_event")]:G({},o),["$web_vitals_".concat(o.name,"_value")]:o.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),J(this,"_addToBuffer",i=>{var o,a=(o=this.instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0);if(pe(a))O.error(qr+"Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var u=this._currentURL();pe(u)||(Je(i==null?void 0:i.name)||Je(i==null?void 0:i.value)?O.error(qr+"Invalid metric received",i):this._maxAllowedValue&&i.value>=this._maxAllowedValue?O.error(qr+"Ignoring metric with value >= "+this._maxAllowedValue,i):(this.buffer.url!==u&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),pe(this.buffer.url)&&(this.buffer.url=u),this.buffer.firstMetricTimestamp=pe(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(G(G({},i),{},{$current_url:u,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),J(this,"_startCapturing",()=>{var i,o,a,u,d=Ae.__PosthogExtensions__;pe(d)||pe(d.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:o,onFCP:a,onINP:u}=d.postHogWebVitalsCallbacks),i&&o&&a&&u?(this.allowedMetrics.indexOf("LCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&o(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&u(this._addToBuffer.bind(this)),this._initialized=!0):O.error(qr+"web vitals callbacks not loaded - not starting")}),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[Ea]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=dt(this.instance.config.capture_performance)?(e=this.instance.config.capture_performance)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return pe(i)?((t=this.instance.persistence)===null||t===void 0?void 0:t.props[ka])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(dt(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=dt(this.instance.config.capture_performance)&&Ut(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:ll;return 0<e&&e<=6e4?ll:e}get isEnabled(){var e=dt(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return zr(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(O.info(qr+" enabled, starting..."),this.loadScript(this._startCapturing))}afterDecideResponse(e){var t=dt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=dt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[Ea]:t}),this.instance.persistence.register({[ka]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,o;(t=Ae.__PosthogExtensions__)!==null&&t!==void 0&&t.postHogWebVitalsCallbacks&&e(),(i=Ae.__PosthogExtensions__)===null||i===void 0||(o=i.loadExternalDependency)===null||o===void 0||o.call(i,this.instance,"web-vitals",a=>{a?O.error(qr+" failed to load script",a):e()})}_currentURL(){var e=C?C.location.href:void 0;return e||O.error(qr+"Could not determine current URL"),e}}var Zd={icontains:(r,e)=>!!C&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!C&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!C&&gn(e.href,r),not_regex:(r,e)=>!!C&&!gn(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class wt{constructor(e){var t=this;J(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var i=arguments.length>0&&arguments[0]!==void 0&&arguments[0];t.getWebExperiments(o=>{wt.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,o.forEach(a=>{if(a.feature_flag_key&&t._featureFlags&&t._featureFlags[a.feature_flag_key]){var u;t._flagToExperiments&&(wt.logInfo("setting flag key ",a.feature_flag_key," to web experiment ",a),(u=t._flagToExperiments)===null||u===void 0||u.set(a.feature_flag_key,a));var d=t._featureFlags[a.feature_flag_key];d&&a.variants[d]&&t.applyTransforms(a.name,d,a.variants[d].transforms)}else if(a.variants)for(var p in a.variants){var m=a.variants[p];wt.matchesTestVariant(m)&&t.applyTransforms(a.name,p,m.transforms)}})},i)}),this.instance=e,this.instance.onFeatureFlags&&this.instance.onFeatureFlags(i=>{this.applyFeatureFlagChanges(i)}),this._flagToExperiments=new Map}applyFeatureFlagChanges(e){Je(this._flagToExperiments)||this.instance.config.disable_web_experiments||(wt.logInfo("applying feature flags",e),e.forEach(t=>{var i;if(this._flagToExperiments&&(i=this._flagToExperiments)!==null&&i!==void 0&&i.has(t)){var o,a=this.instance.getFeatureFlag(t),u=(o=this._flagToExperiments)===null||o===void 0?void 0:o.get(t);a&&u!=null&&u.variants[a]&&this.applyTransforms(u.name,a,u.variants[a].transforms)}}))}afterDecideResponse(e){this._is_bot()?wt.logInfo("Refusing to render web experiment since the viewer is a likely bot"):(this._featureFlags=e.featureFlags,this.loadIfEnabled(),this.previewWebExperiment())}previewWebExperiment(){var e=wt.getWindowLocation();if(e!=null&&e.search){var t=wi(e==null?void 0:e.search,"__experiment_id"),i=wi(e==null?void 0:e.search,"__experiment_variant");t&&i&&(wt.logInfo("previewing web experiments ".concat(t," && ").concat(i)),this.getWebExperiments(o=>{this.showPreviewWebExperiment(parseInt(t),i,o)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.instance.config.disable_web_experiments&&!i)return e([]);var o=this.instance.get_property("$web_experiments");if(o&&!t)return e(o);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:a=>{if(a.statusCode!==200||!a.json)return e([]);var u=a.json.experiments||[];return e(u)}})}showPreviewWebExperiment(e,t,i){var o=i.filter(a=>a.id===e);o&&o.length>0&&(wt.logInfo("Previewing web experiment [".concat(o[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(o[0].name,t,o[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!Je(e.conditions)&&wt.matchUrlConditions(e)&&wt.matchUTMConditions(e)}static matchUrlConditions(e){var t;if(Je(e.conditions)||Je((t=e.conditions)===null||t===void 0?void 0:t.url))return!0;var i,o,a,u=wt.getWindowLocation();return!!u&&((i=e.conditions)===null||i===void 0||!i.url||Zd[(o=(a=e.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](e.conditions.url,u))}static getWindowLocation(){return C==null?void 0:C.location}static matchUTMConditions(e){var t;if(Je(e.conditions)||Je((t=e.conditions)===null||t===void 0?void 0:t.utm))return!0;var i=ut.campaignParams();if(i.utm_source){var o,a,u,d,p,m,g,v,b,y,k,R,W,B,q,le,ue=(o=e.conditions)===null||o===void 0||(a=o.utm)===null||a===void 0||!a.utm_campaign||((u=e.conditions)===null||u===void 0||(d=u.utm)===null||d===void 0?void 0:d.utm_campaign)==i.utm_campaign,Ee=(p=e.conditions)===null||p===void 0||(m=p.utm)===null||m===void 0||!m.utm_source||((g=e.conditions)===null||g===void 0||(v=g.utm)===null||v===void 0?void 0:v.utm_source)==i.utm_source,Ge=(b=e.conditions)===null||b===void 0||(y=b.utm)===null||y===void 0||!y.utm_medium||((k=e.conditions)===null||k===void 0||(R=k.utm)===null||R===void 0?void 0:R.utm_medium)==i.utm_medium,we=(W=e.conditions)===null||W===void 0||(B=W.utm)===null||B===void 0||!B.utm_term||((q=e.conditions)===null||q===void 0||(le=q.utm)===null||le===void 0?void 0:le.utm_term)==i.utm_term;return ue&&Ge&&we&&Ee}return!1}static logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];O.info("[WebExperiments] ".concat(e),i)}applyTransforms(e,t,i,o){var a;this._is_bot()?wt.logInfo("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach(u=>{if(u.selector){var d;wt.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),u);var p,m=0,g=(d=document)===null||d===void 0?void 0:d.querySelectorAll(u.selector);g==null||g.forEach(v=>{var b=v;m+=1,u.attributes&&u.attributes.forEach(y=>{switch(y.name){case"text":b.innerText=y.value;break;case"html":b.innerHTML=y.value;break;case"cssClass":b.className=y.value;break;default:b.setAttribute(y.name,y.value)}}),u.text&&(b.innerText=u.text),u.html&&(b.parentElement?b.parentElement.innerHTML=u.html:b.innerHTML=u.html),u.css&&b.setAttribute("style",u.css)}),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:o,$web_experiment_document_url:(p=wt.getWindowLocation())===null||p===void 0?void 0:p.href,$web_experiment_elements_modified:m})}}):(wt.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:o,$web_experiment_variant:t,$web_experiment_document_url:(a=wt.getWindowLocation())===null||a===void 0?void 0:a.href,$web_experiment_elements_modified:0}))}_is_bot(){return Vt&&this.instance?hu(Vt,this.instance.config.custom_blocked_useragents):void 0}}class Xd{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var Fn={},Zs=()=>{},on="posthog",fu=!md&&(St==null?void 0:St.indexOf("MSIE"))===-1&&(St==null?void 0:St.indexOf("Mozilla"))===-1,ul=()=>{var r,e,t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(e=ne==null?void 0:ne.location,t=e==null?void 0:e.hostname,!!xt(t)&&t.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:Zs,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Ht&&xt(Ht==null?void 0:Ht.search)&&Ht.search.indexOf("__posthog_debug=true")!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(C==null||(r=C.location)===null||r===void 0?void 0:r.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:i=>{var o="Bad HTTP status: "+i.statusCode+" "+i.text;O.error(o)},get_device_id:i=>i,_onCapture:Zs,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},cl=r=>{var e={};pe(r.process_person)||(e.person_profiles=r.process_person),pe(r.xhr_headers)||(e.request_headers=r.xhr_headers),pe(r.cookie_name)||(e.persistence_name=r.cookie_name),pe(r.disable_cookie)||(e.disable_persistence=r.disable_cookie);var t=Ft({},e,r);return ct(r.property_blacklist)&&(pe(r.property_denylist)?t.property_denylist=r.property_blacklist:ct(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:O.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class Jd{constructor(){J(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){O.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Fi{constructor(){J(this,"webPerformance",new Jd),J(this,"version",Rr.LIB_VERSION),J(this,"_internalEventEmitter",new tu),this.config=ul(),this.decideEndpointWasHit=!1,this.SentryIntegration=Sd,this.sentryIntegration=e=>function(t,i){var o=eu(t,i);return{name:Ql,processEvent:a=>o(a)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new wc(this),this.toolbar=new fd(this),this.scrollManager=new Wd(this),this.pageViewManager=new Cd(this),this.surveys=new Od(this),this.experiments=new wt(this),this.exceptions=new Xd(this),this.rateLimiter=new Nd(this),this.requestRouter=new wd(this),this.consent=new Vd(this),this.people={set:(e,t,i)=>{var o=xt(e)?{[e]:t}:e;this.setPersonProperties(o),i==null||i({})},set_once:(e,t,i)=>{var o=xt(e)?{[e]:t}:e;this.setPersonProperties(void 0,o),i==null||i({})}},this.on("eventCaptured",e=>O.info('send "'.concat(e==null?void 0:e.event,'"'),e))}init(e,t,i){if(i&&i!==on){var o,a=(o=Fn[i])!==null&&o!==void 0?o:new Fi;return a._init(e,t,i),Fn[i]=a,Fn[on][i]=a,a}return this._init(e,t,i)}_init(e){var t,i,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;if(pe(e)||ya(e))return O.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return O.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],o.person_profiles&&(this._initialPersonProfilesConfig=o.person_profiles),this.set_config(Ft({},ul(),cl(o),{name:a,token:e})),this.config.on_xhr_error&&O.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=o.disable_compression?void 0:or.GZipJS,this.persistence=new ms(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ms(G(G({},this.config),{},{persistence:"sessionStorage"}));var u=G({},this.persistence.props),d=G({},this.sessionPersistence.props);if(this._requestQueue=new vd(B=>this._send_retriable_request(B)),this._retryQueue=new yd(this),this.__request_queue=[],this.sessionManager=new bd(this.config,this.persistence),this.sessionPropsManager=new Pd(this.sessionManager,this.persistence),new Ud(this).startIfEnabledOrStop(),this.sessionRecording=new hd(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new qd(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Hd(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Yd(this),this.exceptionObserver=new zd(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new gu(this,Bd),this.deadClicksAutocapture.startIfEnabled(),Rr.DEBUG=Rr.DEBUG||this.config.debug,Rr.DEBUG&&O.info("Starting in debug mode",{this:this,config:o,thisC:G({},this.config),p:u,s:d}),this._sync_opt_out_with_persistence(),((t=o.bootstrap)===null||t===void 0?void 0:t.distinctID)!==void 0){var p,m,g=this.config.get_device_id(Or()),v=(p=o.bootstrap)!==null&&p!==void 0&&p.isIdentifiedID?g:o.bootstrap.distinctID;this.persistence.set_property(vr,(m=o.bootstrap)!==null&&m!==void 0&&m.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.bootstrap.distinctID,$device_id:v})}if(this._hasBootstrappedFeatureFlags()){var b,y,k=Object.keys(((b=o.bootstrap)===null||b===void 0?void 0:b.featureFlags)||{}).filter(B=>{var q,le;return!((q=o.bootstrap)===null||q===void 0||(le=q.featureFlags)===null||le===void 0||!le[B])}).reduce((B,q)=>{var le,ue;return B[q]=((le=o.bootstrap)===null||le===void 0||(ue=le.featureFlags)===null||ue===void 0?void 0:ue[q])||!1,B},{}),R=Object.keys(((y=o.bootstrap)===null||y===void 0?void 0:y.featureFlagPayloads)||{}).filter(B=>k[B]).reduce((B,q)=>{var le,ue,Ee,Ge;return(le=o.bootstrap)!==null&&le!==void 0&&(ue=le.featureFlagPayloads)!==null&&ue!==void 0&&ue[q]&&(B[q]=(Ee=o.bootstrap)===null||Ee===void 0||(Ge=Ee.featureFlagPayloads)===null||Ge===void 0?void 0:Ge[q]),B},{});this.featureFlags.receivedFeatureFlags({featureFlags:k,featureFlagPayloads:R})}if(!this.get_distinct_id()){var W=this.config.get_device_id(Or());this.register_once({distinct_id:W,$device_id:W},""),this.persistence.set_property(vr,"anonymous")}return C==null||(i=C.addEventListener)===null||i===void 0||i.call(C,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),o.segment?Id(this,()=>this._loaded()):this._loaded(),Jt(this.config._onCapture)&&this.config._onCapture!==Zs&&(O.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",B=>this.config._onCapture(B.event,B))),this}_afterDecideResponse(e){var t,i,o,a,u,d,p,m,g;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Pe(e.supportedCompression,or.GZipJS)?or.GZipJS:Pe(e.supportedCompression,or.Base64)?or.Base64:void 0),(t=e.analytics)!==null&&t!==void 0&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),(i=this.sessionRecording)===null||i===void 0||i.afterDecideResponse(e),(o=this.autocapture)===null||o===void 0||o.afterDecideResponse(e),(a=this.heatmaps)===null||a===void 0||a.afterDecideResponse(e),(u=this.experiments)===null||u===void 0||u.afterDecideResponse(e),(d=this.surveys)===null||d===void 0||d.afterDecideResponse(e),(p=this.webVitalsAutocapture)===null||p===void 0||p.afterDecideResponse(e),(m=this.exceptionObserver)===null||m===void 0||m.afterDecideResponse(e),(g=this.deadClicksAutocapture)===null||g===void 0||g.afterDecideResponse(e)}_loaded(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(t){O.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),e||(new pd(this).call(),this.featureFlags.resetRequestQueue())}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||cn(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(t=this._retryQueue)===null||t===void 0||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(fu?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ti(e.url,{ip:this.config.ip?1:0}),e.headers=G({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(t=>{var i,o,a,u=G({},t);u.timeout=u.timeout||6e4,u.url=Ti(u.url,{_:new Date().getTime().toString(),ver:Rr.LIB_VERSION,compression:u.compression});var d=(i=u.transport)!==null&&i!==void 0?i:"XHR",p=(o=(a=gl(Nn,m=>m.transport===d))===null||a===void 0?void 0:a.method)!==null&&o!==void 0?o:Nn[0].method;if(!p)throw new Error("No available transport method");p(u)})(G(G({},e),{},{callback:t=>{var i,o,a;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((o=(a=this.config).on_request_error)===null||o===void 0||o.call(a,t)),(i=e.callback)===null||i===void 0||i.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],o=[],a=[];cn(e,d=>{d&&(t=d[0],ct(t)?a.push(d):Jt(d)?d.call(this):ct(d)&&t==="alias"?i.push(d):ct(d)&&t.indexOf("capture")!==-1&&Jt(this[t])?a.push(d):o.push(d))});var u=function(d,p){cn(d,function(m){if(ct(m[0])){var g=p;Xe(m,function(v){g=g[v[0]].apply(g,v.slice(1))})}else this[m[0]].apply(this,m.slice(1))},p)};u(i,this),u(o,this),u(a,this)}_hasBootstrappedFeatureFlags(){var e,t;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!pe(e)&&xt(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var u=new Date,d=(i==null?void 0:i.timestamp)||u,p={uuid:Or(),event:e,properties:this._calculate_event_properties(e,t||{},d)};a&&(p.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),i!=null&&i.$set&&(p.$set=i==null?void 0:i.$set);var m=this._calculate_set_once_properties(i==null?void 0:i.$set_once);m&&(p.$set_once=m),(p=pc(p,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=d,pe(i==null?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=u);var g=G(G({},p.properties.$set),p.$set);if(an(g)||this.setPersonPropertiesForFlags(g),!Je(this.config.before_send)){var v=this._runBeforeSend(p);if(!v)return;p=v}this._internalEventEmitter.emit("eventCaptured",p);var b={method:"POST",url:(o=i==null?void 0:i._url)!==null&&o!==void 0?o:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this._send_retriable_request(b):this._requestQueue.enqueue(b),p}O.critical("This capture call is ignored due to client rate limiting.")}}else O.error("No event name provided to posthog.capture")}else O.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}_calculate_event_properties(e,t,i){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o=this.persistence.remove_event_timer(e),a=G({},t);if(a.token=this.config.token,e==="$snapshot"){var u=G(G({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!xt(a.distinct_id)&&!Ut(a.distinct_id)||ya(a.distinct_id))&&O.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var d=ut.properties();if(this.sessionManager){var{sessionId:p,windowId:m}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=p,a.$window_id=m}if(this.requestRouter.region===Yr.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(e==="$pageview"||e==="$pageleave"||e==="$autocapture")){var g=this.sessionPropsManager.getSessionProps();a=Ft(a,g)}if(!this.config.disable_scroll_properties){var v={};e==="$pageview"?v=this.pageViewManager.doPageView(i):e==="$pageleave"&&(v=this.pageViewManager.doPageLeave(i)),a=Ft(a,v)}if(e==="$pageview"&&ne&&(a.title=ne.title),!pe(o)){var b=i.getTime()-o;a.$duration=parseFloat((b/1e3).toFixed(3))}St&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ft({},d,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),ct(this.config.property_denylist)?Xe(this.config.property_denylist,function(R){delete a[R]}):O.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(a=y(a,e));var k=this._hasPersonProcessing();return a.$process_person_profile=k,k&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=Ft({},this.persistence.get_initial_props(),e||{}),i=this.config.sanitize_properties;return i&&(t=i(t,"$set_once")),an(t)?void 0:t}register(e,t){var i;(i=this.persistence)===null||i===void 0||i.register(e,t)}register_once(e,t,i){var o;(o=this.persistence)===null||o===void 0||o.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)===null||t===void 0||t.register(e)}unregister(e){var t;(t=this.persistence)===null||t===void 0||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)===null||t===void 0||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,i){return this.surveys.getNextSurveyStep(e,t,i)}identify(e,t,i){if(!this.__loaded||!this.persistence)return O.uninitializedWarning("posthog.identify");if(Ut(e)&&(e=e.toString(),O.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))O.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var o=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var a=o;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}e!==o&&e!==this.get_property(xn)&&(this.unregister(xn),this.register({distinct_id:e}));var u=(this.persistence.get_property(vr)||"anonymous")==="anonymous";e!==o&&u?(this.persistence.set_property(vr,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:o},{$set:t||{},$set_once:i||{}}),this.featureFlags.setAnonymousDistinctId(o)):(t||i)&&this.setPersonProperties(t,i),e!==o&&(this.reloadFeatureFlags(),this.unregister(_i))}}else O.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,i){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var o=this.getGroups();o[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:G(G({},o),{},{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),o[e]===t||i||this.reloadFeatureFlags()}}else O.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,o,a,u;if(O.info("reset"),!this.__loaded)return O.uninitializedWarning("posthog.reset");var d=this.get_property("$device_id");this.consent.reset(),(t=this.persistence)===null||t===void 0||t.clear(),(i=this.sessionPersistence)===null||i===void 0||i.clear(),(o=this.surveys)===null||o===void 0||o.reset(),(a=this.persistence)===null||a===void 0||a.set_property(vr,"anonymous"),(u=this.sessionManager)===null||u===void 0||u.resetSessionId();var p=this.config.get_device_id(Or());this.register_once({distinct_id:p,$device_id:e?p:d},"")}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)===null||t===void 0?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),o=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(e!=null&&e.withTimestamp&&i){var a,u=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!i)return o;var d=Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0);o+="?t=".concat(d)}return o}alias(e,t){return e===this.get_property(ml)?(O.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(pe(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(xn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(O.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,i,o,a,u=G({},this.config);dt(e)&&(Ft(this.config,cl(e)),(t=this.persistence)===null||t===void 0||t.update_config(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ms(G(G({},this.config),{},{persistence:"sessionStorage"})),mt.is_supported()&&mt.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Rr.DEBUG=!0,O.info("set_config",{config:e,oldConfig:u,newConfig:G({},this.config)})),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),(o=this.autocapture)===null||o===void 0||o.startIfEnabled(),(a=this.heatmaps)===null||a===void 0||a.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var o,a,u,d,p;(o=this.sessionManager)===null||o===void 0||o.checkAndGetSessionAndWindowId(),i.sampling&&((a=this.sessionRecording)===null||a===void 0||a.overrideSampling()),i.linked_flag&&((u=this.sessionRecording)===null||u===void 0||u.overrideLinkedFlag()),i.url_trigger&&((d=this.sessionRecording)===null||d===void 0||d.overrideTrigger("url")),i.event_trigger&&((p=this.sessionRecording)===null||p===void 0||p.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started)}captureException(e,t){var i,o=new Error("PostHog syntheticException"),a=Jt((i=Ae.__PosthogExtensions__)===null||i===void 0?void 0:i.parseErrorAsProperties)?Ae.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:o}):G({$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}]},t);this.exceptions.sendExceptionEvent(a)}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)===null||t===void 0?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)===null||t===void 0?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:on;return t!==on&&(t=on+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)===null||e===void 0?void 0:e.get_property(vr))==="identified"||((t=this.sessionPersistence)===null||t===void 0?void 0:t.get_property(vr))==="identified"}_hasPersonProcessing(){var e,t,i,o;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&an(this.getGroups())&&((e=this.persistence)===null||e===void 0||(t=e.props)===null||t===void 0||!t[xn])&&((i=this.persistence)===null||i===void 0||(o=i.props)===null||o===void 0||!o[yi]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return this.config.person_profiles==="never"?(O.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(yi,!0),!0)}_sync_opt_out_with_persistence(){var e,t,i,o,a=this.consent.isOptedOut(),u=this.config.opt_out_persistence_by_default,d=this.config.disable_persistence||a&&!!u;((e=this.persistence)===null||e===void 0?void 0:e.disabled)!==d&&((i=this.persistence)===null||i===void 0||i.set_disabled(d)),((t=this.sessionPersistence)===null||t===void 0?void 0:t.disabled)!==d&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(d))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(pe(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e==null?void 0:e.captureEventName)!==null&&t!==void 0?t:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return Vt?hu(Vt,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ne&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:ne.title},{send_instantly:!0}))}debug(e){e===!1?(C==null||C.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(C==null||C.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(Je(this.config.before_send))return e;var t=ct(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var o of t){if(i=o(i),Je(i)){var a="Event '".concat(e.event,"' was rejected in beforeSend function");return _c(e.event)?O.warn("".concat(a,". This can cause unexpected behavior.")):O.info(a),null}i.properties&&!an(i.properties)||O.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return i}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=hc(r.prototype[e[t]])})(Fi,["identify"]);var dl,xr=(dl=Fn[on]=new Fi,function(){function r(){r.done||(r.done=!0,fu=!1,Xe(Fn,function(e){e._dom_loaded()}))}ne!=null&&ne.addEventListener&&(ne.readyState==="complete"?r():ne.addEventListener("DOMContentLoaded",r,!1)),C&&yr(C,"load",r,!0)}(),dl);const Kd={init:()=>{try{xr.init("phc_jPAOMMgaYCLXxaJgwNO4WIQ6mnkYDByMGB7CuxahLvb",{api_host:"https://eu.i.posthog.com",person_profiles:"identified_only",autocapture:{dom_event_allowlist:["click"],css_selector_allowlist:["[data-ph-autocapture]"]},capture_pageleave:window.location.pathname==="/community/space",capture_pageview:!1,mask_all_text:!0})}catch(r){console.error(r)}},identify:r=>{xr.identify(r,{contact_id:r})},guestVoter:r=>{xr.identify(r)},logout:()=>{xr.reset(!0)},pageView:(r,e={})=>{xr.capture("$pageview",e)},hubspotForm:r=>{xr.capture("hubspot_form_submitted",{hubspot_form_id:r})},hubspotFormPopupView:r=>{xr.capture("hubspot_form_popup_view",{hubspot_form_id:r})},profileTabsUsage:()=>{xr.capture("profile_tabs_usage")}},Qd={install:r=>{r.provide("telemetryClient",Kd)}};export{Kd as T,Qd as V};