(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,v,_){try{var w=n[v](_),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 v=n.apply(s,l);function _(S){i(v,c,h,_,w,"next",S)}function w(S){i(v,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 v=Object.getOwnPropertySymbols(n);for(c=0;c<v.length;c++)l=v[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,v)=>h in c?m(c,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[h]=v)(n,typeof s!="symbol"?s+"":s,l),f=Object.defineProperty,b=(n,s,l)=>((c,h,v)=>h in c?f(c,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[h]=v)(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:[]},T={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},G=n=>{try{return!!(s=>typeof s=="function")(n)&&Object.getOwnPropertyNames(n.prototype||{}).some(s=>s.indexOf("__zone"))}catch{return!1}},q={};function $(n){if(q[n])return q[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]"))})),v=n in T?T[n]:void 0,_=!!(v&&v.every(E=>{var F;return typeof l[E]=="function"&&((F=l[E])==null?void 0:F.toString().includes("[native code]"))}));if(h&&_&&!G(s))return q[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?q[n]=I:s.prototype}catch{return s.prototype}}var ue={};function ae(n,s,l){var c,h="".concat(n,".").concat(String(l));if(ue[h])return ue[h].call(s);var v=$(n),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(ue[h]=_,_.call(s)):s[l]}var Se={};function Ge(n,s,l){var c="".concat(n,".").concat(String(l));if(Se[c])return Se[c].bind(s);var h=$(n)[l];return typeof h!="function"?s[l]:(Se[c]=h,h.bind(s))}var me={childNodes:function(n){return ae("Node",n,"childNodes")},parentNode:function(n){return ae("Node",n,"parentNode")},parentElement:function(n){return ae("Node",n,"parentElement")},textContent:function(n){return ae("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?ae("ShadowRoot",n,"host"):null},styleSheets:function(n){return n.styleSheets},shadowRoot:function(n){return n&&"shadowRoot"in n?ae("Element",n,"shadowRoot"):null},querySelector:function(n,s){return ae("Element",n,"querySelector")(s)},querySelectorAll:function(n,s){return ae("Element",n,"querySelectorAll")(s)},mutationObserver:function(){return $("MutationObserver").constructor}};function ye(n){return n.nodeType===n.ELEMENT_NODE}function Ne(n){var s=n&&"host"in n&&"mode"in n&&me.host(n)||null;return!!(s&&"shadowRoot"in s&&me.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(v){return"styleSheet"in v}(n)){var l;try{l=Ze(n.styleSheet)||function(v){var{cssText:_}=v;if(_.split('"').length<3)return _;var w=["@import","url(".concat(JSON.stringify(v.href),")")];return v.layerName===""?w.push("layer"):v.layerName&&w.push("layer(".concat(v.layerName,")")),v.supportsText&&w.push("supports(".concat(v.supportsText,")")),v.media.length&&w.push(v.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(v){return"selectorText"in v}(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 ut(n){var{element:s,maskInputOptions:l,tagName:c,type:h,value:v,maskInputFn:_}=n,w=v||"",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,v,_,w)=>{var S,I=h||_||w,E=c||v||"";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 x=/^[^ \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 Ie(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,v){if(v.trim()==="")return v;var _=0;function w(H){var se,he=H.exec(v.substring(_));return he?(se=he[0],_+=se.length,se):""}for(var S=[];w(L),!(_>=v.length);){var I=w(x);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=v.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(me.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(me.parentNode(n),s,l)}function Pt(n,s,l,c){var h;if(ye(n)){if(h=n,!me.childNodes(h).length)return!1}else{if(me.parentElement(n)===null)return!1;h=me.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:v,needsMask:_,inlineStylesheet:w,maskInputOptions:S={},maskTextFn:I,maskInputFn:E,dataURLOptions:F={},inlineImages:Z,recordCanvas:H,keepIframeSrcFn:se,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:ne={},maskInputFn:ce,dataURLOptions:ge={},inlineImages:Ce,recordCanvas:z,keepIframeSrcFn:Ee,newlyAddedElement:ve=!1,rootId:_e}=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),le=function(Oe){if(Oe instanceof HTMLFormElement)return"form";var Bt=ht(Oe.tagName);return Dr.test(Bt)?"div":Bt}(P),te={},Be=P.attributes.length,He=0;He<Be;He++){var Re=P.attributes[He];Le(le,Re.name,Re.value)||(te[Re.name]=Ue(j,le,ht(Re.name),Re.value))}if(le==="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 te.rel,delete te.href,te._cssText=At)}if(le==="style"&&P.sheet&&!(P.innerText||me.textContent(P)||"").trim().length){var ft=Ze(P.sheet);ft&&(te._cssText=ft)}if(le==="input"||le==="textarea"||le==="select"){var et=P.value,vt=P.checked;te.type!=="radio"&&te.type!=="checkbox"&&te.type!=="submit"&&te.type!=="button"&&et?te.value=ut({element:P,type:Tt(P),tagName:le,value:et,maskInputOptions:ne,maskInputFn:ce}):vt&&(te.checked=vt)}if(le==="option"&&(P.selected&&!ne.select?te.selected=!0:delete te.selected),le==="dialog"&&P.open)try{te.rr_open_mode=P.matches("dialog:modal")?"modal":"non-modal"}catch{te.rr_open_mode="modal",te.ph_rr_could_not_detect_modal=!0}if(le==="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)||(te.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)&&(te.rr_dataURL=qt)}}if(le==="img"&&Ce){ot||(ot=j.createElement("canvas"),Rt=ot.getContext("2d"));var tt=P,$r=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),te.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($r,"! Error: ").concat(Oe))}tt.crossOrigin==="anonymous"&&(Sn?te.crossOrigin=Sn:tt.removeAttribute("crossorigin"))};tt.complete&&tt.naturalWidth!==0?pr():tt.addEventListener("load",pr)}if(le==="audio"||le==="video"){var Me=te;Me.rr_mediaState=P.paused?"paused":"played",Me.rr_mediaCurrentTime=P.currentTime,Me.rr_mediaPlaybackRate=P.playbackRate,Me.rr_mediaMuted=P.muted,Me.rr_mediaLoop=P.loop,Me.rr_mediaVolume=P.volume}if(ve||(P.scrollLeft&&(te.rr_scrollLeft=P.scrollLeft),P.scrollTop&&(te.rr_scrollTop=P.scrollTop)),fe){var{width:Ot,height:we}=P.getBoundingClientRect();te={class:te.class,rr_width:"".concat(Ot,"px"),rr_height:"".concat(we,"px")}}le!=="iframe"||Ee(te.src)||(P.contentDocument||(te.rr_src=te.src),delete te.src);try{customElements.get(le)&&(A=!0)}catch{}return{type:y.Element,tagName:le,attributes:te,childNodes:[],isSVG:Ie(P)||void 0,needBlock:fe,rootId:_e,isCustom:A}}(n,{doc:l,blockClass:h,blockSelector:v,inlineStylesheet:w,maskInputOptions:S,maskInputFn:E,dataURLOptions:F,inlineImages:Z,recordCanvas:H,keepIframeSrcFn:se,newlyAddedElement:he,rootId:oe});case n.TEXT_NODE:return function(P,N){var A,{needsMask:j,maskTextFn:X,rootId:K}=N,Q=me.parentNode(P),ne=Q&&Q.tagName,ce=me.textContent(P),ge=ne==="STYLE"||void 0,Ce=ne==="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 Ce&&(ce="SCRIPT_PLACEHOLDER"),!ge&&!Ce&&ce&&j&&(ce=X?X(ce,me.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:me.textContent(n)||"",rootId:oe};default:return!1}}function be(n){return n==null?"":n.toLowerCase()}function at(n,s){var{doc:l,mirror:c,blockClass:h,blockSelector:v,maskTextClass:_,maskTextSelector:w,skipChild:S=!1,inlineStylesheet:I=!0,maskInputOptions:E={},maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:se={},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:ne}=s,{preserveWhiteSpace:ce=!0}=s;ne||(ne=Pt(n,_,w,ne===void 0));var ge,Ce=Yt(n,{doc:l,mirror:c,blockClass:h,blockSelector:v,needsMask:ne,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,dataURLOptions:se,inlineImages:he,recordCanvas:oe,keepIframeSrcFn:K,newlyAddedElement:Q});if(!Ce)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"&&(be(V.attributes.name).match(/^msapplication-tile(image|color)$/)||be(V.attributes.name)==="application-name"||be(V.attributes.rel)==="icon"||be(V.attributes.rel)==="apple-touch-icon"||be(V.attributes.rel)==="shortcut icon"))||V.tagName==="meta"&&(Te.headMetaDescKeywords&&be(V.attributes.name).match(/^description|keywords$/)||Te.headMetaSocial&&(be(V.attributes.property).match(/^(og|twitter|fb):/)||be(V.attributes.name).match(/^(og|twitter):/)||be(V.attributes.name)==="pinterest")||Te.headMetaRobots&&(be(V.attributes.name)==="robots"||be(V.attributes.name)==="googlebot"||be(V.attributes.name)==="bingbot")||Te.headMetaHttpEquiv&&V.attributes["http-equiv"]!==void 0||Te.headMetaAuthorship&&(be(V.attributes.name)==="author"||be(V.attributes.name)==="generator"||be(V.attributes.name)==="framework"||be(V.attributes.name)==="publisher"||be(V.attributes.name)==="progid"||be(V.attributes.property).match(/^article:/)||be(V.attributes.property).match(/^product:/))||Te.headMetaVerification&&(be(V.attributes.name)==="google-site-verification"||be(V.attributes.name)==="yandex-verification"||be(V.attributes.name)==="csrf-token"||be(V.attributes.name)==="p:domain_verify"||be(V.attributes.name)==="verify-v1"||be(V.attributes.name)==="verification"||be(V.attributes.name)==="shopify-checkout-api-token"))))}(Ce,H)&&(ce||Ce.type!==y.Text||Ce.isStyle||Ce.textContent.replace(/^\s+|\s+$/gm,"").length)?M():jt;var z=Object.assign(Ce,{id:ge});if(c.add(n,z),ge===jt)return null;P&&P(n);var Ee=!S;if(z.type===y.Element){Ee=Ee&&!z.needBlock,delete z.needBlock;var ve=me.shadowRoot(n);ve&&qe(ve)&&(z.isShadowHost=!0)}if((z.type===y.Document||z.type===y.Element)&&Ee){H.headWhitespace&&z.type===y.Element&&z.tagName==="head"&&(ce=!1);var _e={doc:l,mirror:c,blockClass:h,blockSelector:v,needsMask:ne,maskTextClass:_,maskTextSelector:w,skipChild:S,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:se,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(me.childNodes(n))){var le=at(fe,_e);le&&z.childNodes.push(le)}var te=null;if(ye(n)&&(te=me.shadowRoot(n)))for(var Be of Array.from(me.childNodes(te))){var He=at(Be,_e);He&&(qe(te)&&(He.isShadow=!0),z.childNodes.push(He))}}var Re=me.parentNode(n);return Re&&Ne(Re)&&qe(Re)&&(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:v,needsMask:ne,maskTextClass:_,maskTextSelector:w,skipChild:!1,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:se,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:v,needsMask:ne,maskTextClass:_,maskTextSelector:w,skipChild:!1,inlineStylesheet:I,maskInputOptions:E,maskTextFn:F,maskInputFn:Z,slimDOMOptions:H,dataURLOptions:se,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:[]},R={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]"))})),v=n in R?R[n]:void 0,_=!!(v&&v.every(E=>{var F;return typeof l[E]=="function"&&((F=l[E])==null?void 0:F.toString().includes("[native code]"))}));if(h&&_&&!G(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 W(n,s,l){var c,h="".concat(n,".").concat(String(l));if(ee[h])return ee[h].call(s);var v=Y(n),_=(c=Object.getOwnPropertyDescriptor(v,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 We(){return Y("MutationObserver").constructor}var re={childNodes:function(n){return W("Node",n,"childNodes")},parentNode:function(n){return W("Node",n,"parentNode")},parentElement:function(n){return W("Node",n,"parentElement")},textContent:function(n){return W("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?W("ShadowRoot",n,"host"):null},styleSheets:function(n){return n.styleSheets},shadowRoot:function(n){return n&&"shadowRoot"in n?W("Element",n,"shadowRoot"):null},querySelector:function(n,s){return W("Element",n,"querySelector")(s)},querySelectorAll:function(n,s){return W("Element",n,"querySelectorAll")(s)},mutationObserver:We};function Ae(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 v=arguments.length,_=new Array(v),w=0;w<v;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,v=h.Object.getOwnPropertyDescriptor(n,s);return h.Object.defineProperty(n,s,c?l:{set(_){setTimeout(()=>{l.set.call(this,_)},0),v&&v.set&&v.set.call(this,_)}}),()=>Xr(n,s,v||{},!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,v=n.document;return{left:v.scrollingElement?v.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:v.documentElement.scrollLeft||(v==null?void 0:v.body)&&((s=re.parentElement(v.body))==null?void 0:s.scrollLeft)||((l=v==null?void 0:v.body)==null?void 0:l.scrollLeft)||0,top:v.scrollingElement?v.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(v==null?void 0:v.documentElement.scrollTop)||(v==null?void 0:v.body)&&((c=re.parentElement(v.body))==null?void 0:c.scrollTop)||((h=v==null?void 0:v.body)==null?void 0:h.scrollTop)||0}}function $n(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function ao(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function lo(n){return n?n.nodeType===n.ELEMENT_NODE?n:re.parentElement(n):null}function Mt(n,s,l,c){if(!n)return!1;var h=lo(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 uo(n,s){if(Ne(n))return!1;var l=s.getId(n);if(!s.has(l))return!0;var c=re.parentNode(n);return(!c||c.nodeType!==n.DOCUMENT_NODE)&&(!c||uo(c,s))}function Li(n){return!!n.changedTouches}function co(n,s){return!!(n.nodeName==="IFRAME"&&s.getMeta(n))}function ho(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:!!re.shadowRoot(n))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Jr=()=>new Date().getTime());let mu=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 po(n){var s,l=null;return"getRootNode"in n&&((s=re.getRootNode(n))==null?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&re.host(re.getRootNode(n))&&(l=re.host(re.getRootNode(n))),l}function _u(n){var s=n.ownerDocument;if(!s)return!1;var l=function(c){for(var h,v=c;h=po(v);)v=h;return v}(n);return re.contains(s,l)}function go(n){var s=n.ownerDocument;return!!s&&(re.contains(s,n)||_u(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 fo(n){return"__ln"in n}class yu{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&&fo(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&&fo(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,vo=(n,s)=>"".concat(n,"@").concat(s);class bu{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 yu,h=A=>{for(var j=A,X=jt;X===jt;)X=(j=j&&j.nextSibling)&&this.mirror.getId(j);return X},v=A=>{var j=re.parentNode(A);if(j&&go(A)&&j.tagName!=="TEXTAREA"){var X=Ne(j)?this.mirror.getId(po(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:ne=>{co(ne,this.mirror)&&this.iframeManager.addIframe(ne),ho(ne,this.mirror)&&this.stylesheetManager.trackLinkElement(ne),Di(A)&&this.shadowDomManager.addShadowRoot(re.shadowRoot(A),this.doc)},onIframeLoad:(ne,ce)=>{this.iframeManager.attachIframe(ne,ce),this.shadowDomManager.observeAttachShadow(ne)},onStylesheetLoad:(ne,ce)=>{this.stylesheetManager.attachLinkElement(ne,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)mo(this.removes,_,this.mirror)&&!this.movedSet.has(re.parentNode(_))||v(_);for(var w of this.addedSet)_o(this.droppedSet,w)||mo(this.removes,w,this.mirror)?_o(this.movedSet,w)?v(w):this.droppedSet.add(w):v(w);for(var S=null;c.length;){var I=null;if(S){var E=this.mirror.getId(re.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 se=this.mirror.getId(re.parentNode(H.value));if(h(H.value)===-1)continue;if(se!==-1){I=H;break}var he=H.value,oe=re.parentNode(he);if(oe&&oe.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var P=re.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),v(I.value)}var N={texts:this.texts.map(A=>{var j=A.node,X=re.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(re.childNodes(s),c=>re.textContent(c)||"").join("")}),g(this,"processMutation",s=>{if(!Pi(s.target,this.mirror,this.slimDOMOptions))switch(s.type){case"characterData":var l=re.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,lo(s.target)):l.replace(/[\S]/g,"*"):l,node:s.target});break;case"attributes":var c=s.target,h=s.attributeName,v=s.target.getAttribute(h);if(h==="value"){var _=Tt(c);v=ut({element:c,maskInputOptions:this.maskInputOptions,tagName:c.tagName,type:_,value:v,maskInputFn:this.maskInputFn})}if(Mt(s.target,this.blockClass,this.blockSelector,!1)||v===s.oldValue)return;var w=this.attributeMap.get(s.target);if(c.tagName==="IFRAME"&&h==="src"&&!this.keepIframeSrcFn(v)){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),v),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 se=this.mirror.getId(H),he=Ne(s.target)?this.mirror.getId(re.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)&&se===-1||uo(s.target,this.mirror)||(this.movedSet.has(H)&&this.movedMap[vo(se,he)]?Bi(this.movedSet,H):this.removes.push({parentId:he,id:se,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[vo(this.mirror.getId(s),c)]=!0)}else this.addedSet.add(s),this.droppedSet.delete(s);Mt(s,this.blockClass,this.blockSelector,!1)||(re.childNodes(s).forEach(h=>this.genAdds(h)),Di(s)&&re.childNodes(re.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),re.childNodes(s).forEach(l=>Bi(n,l))}function mo(n,s,l){return n.length!==0&&function(c,h,v){for(var _=re.parentNode(h),w=function(){var I=v.getId(_);if(c.some(E=>E.id===I))return{v:!0};_=re.parentNode(_)};_;){var S=w();if(typeof S=="object")return S.v}return!1}(n,s,l)}function _o(n,s){return n.size!==0&&yo(n,s)}function yo(n,s){var l=re.parentNode(s);return!!l&&(!!n.has(l)||yo(n,l))}var $e=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 bo(n,s){var l=new bu;Br.push(l),l.init(n);var c=new(We())($e(l.processMutations.bind(l)));return c.observe(s,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),c}function wu(n){var{mouseInteractionCb:s,doc:l,mirror:c,blockClass:h,blockSelector:v,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=>se=>{var he=bn(se);if(!Mt(he,h,v,!0)){var oe=null,P=H;if("pointerType"in se){switch(se.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(se)&&(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(se)?se.changedTouches[0]:se;if(N){var A=c.getId(he),{clientX:j,clientY:X}=N;$e(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(Ae(F,Z,l))}),$e(()=>{S.forEach(E=>E())})}function wo(n){var{scrollCb:s,doc:l,mirror:c,blockClass:h,blockSelector:v,sampling:_}=n;return Ae("scroll",$e(Sr($e(w=>{var S=bn(w);if(S&&!Mt(S,h,v,!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 Su=["INPUT","TEXTAREA","SELECT"],So=new WeakMap;function Wn(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 Io(n,s){var l,c,h,{mirror:v,stylesheetManager:_}=n,w=null;w=s.nodeName==="#document"?v.getId(s):v.getId(re.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}}),$e(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:I.configurable,enumerable:I.enumerable,get:I.get,set:I.set})})):()=>{}}function Iu(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:ne,inputCb:ce,mediaInteractionCb:ge,styleSheetRuleCb:Ce,styleDeclarationCb:z,canvasMutationCb:Ee,fontCb:ve,selectionCb:_e,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),ne(...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),Ce(...arguments)},N.styleDeclarationCb=function(){A.styleDeclaration&&A.styleDeclaration(...arguments),z(...arguments)},N.canvasMutationCb=function(){A.canvasMutation&&A.canvasMutation(...arguments),Ee(...arguments)},N.fontCb=function(){A.font&&A.font(...arguments),ve(...arguments)},N.selectionCb=function(){A.selection&&A.selection(...arguments),_e(...arguments)},N.customElementCb=function(){A.customElement&&A.customElement(...arguments),fe(...arguments)}})(n,l),n.recordDOM&&(s=bo(n,n.doc));var h=function(N){var{mousemoveCb:A,sampling:j,doc:X,mirror:K}=N;if(j.mousemove===!1)return()=>{};var Q,ne=typeof j.mousemove=="number"?j.mousemove:50,ce=typeof j.mousemoveCallback=="number"?j.mousemoveCallback:500,ge=[],Ce=Sr($e(ve=>{var _e=Date.now()-Q;A(ge.map(fe=>(fe.timeOffset-=_e,fe)),ve),ge=[],Q=null}),ce),z=$e(Sr($e(ve=>{var _e=bn(ve),{clientX:fe,clientY:le}=Li(ve)?ve.changedTouches[0]:ve;Q||(Q=Jr()),ge.push({x:fe,y:le,id:K.getId(_e),timeOffset:Jr()-Q}),Ce(typeof DragEvent<"u"&&ve instanceof DragEvent?De.Drag:ve instanceof MouseEvent?De.MouseMove:De.TouchMove)}),ne,{trailing:!1})),Ee=[Ae("mousemove",z,X),Ae("touchmove",z,X),Ae("drag",z,X)];return $e(()=>{Ee.forEach(ve=>ve())})}(n),v=wu(n),_=wo(n),w=function(N,A){var{viewportResizeCb:j}=N,{win:X}=A,K=-1,Q=-1;return Ae("resize",$e(Sr($e(()=>{var ne=$n(),ce=ao();K===ne&&Q===ce||(j({width:Number(ce),height:Number(ne)}),K=ne,Q=ce)}),200)),X)}(n,{win:c}),S=function(N){var{inputCb:A,doc:j,mirror:X,blockClass:K,blockSelector:Q,ignoreClass:ne,ignoreSelector:ce,maskInputOptions:ge,maskInputFn:Ce,sampling:z,userTriggeredOnInput:Ee}=N;function ve(He){var Re=bn(He),V=He.isTrusted,Te=Re&&Re.tagName;if(Re&&Te==="OPTION"&&(Re=re.parentElement(Re)),Re&&Te&&!(Su.indexOf(Te)<0)&&!Mt(Re,K,Q,!0)&&!(Re.classList.contains(ne)||ce&&Re.matches(ce))){var At=Re.value,ft=!1,et=Tt(Re)||"";et==="radio"||et==="checkbox"?ft=Re.checked:(ge[Te.toLowerCase()]||ge[et])&&(At=ut({element:Re,maskInputOptions:ge,tagName:Te,type:et,value:At,maskInputFn:Ce})),_e(Re,Ee?{text:At,isChecked:ft,userTriggered:V}:{text:At,isChecked:ft});var vt=Re.name;et==="radio"&&vt&&ft&&j.querySelectorAll('input[type="radio"][name="'.concat(vt,'"]')).forEach(qt=>{if(qt!==Re){var Xt=qt.value;_e(qt,Ee?{text:Xt,isChecked:!ft,userTriggered:!1}:{text:Xt,isChecked:!ft})}})}}function _e(He,Re){var V=So.get(He);if(!V||V.text!==Re.text||V.isChecked!==Re.isChecked){So.set(He,Re);var Te=X.getId(He);$e(A)(t(t({},Re),{},{id:Te}))}}var fe=(z.input==="last"?["change"]:["input","change"]).map(He=>Ae(He,$e(ve),j)),le=j.defaultView;if(!le)return()=>{fe.forEach(He=>He())};var te=le.Object.getOwnPropertyDescriptor(le.HTMLInputElement.prototype,"value"),Be=[[le.HTMLInputElement.prototype,"value"],[le.HTMLInputElement.prototype,"checked"],[le.HTMLSelectElement.prototype,"value"],[le.HTMLTextAreaElement.prototype,"value"],[le.HTMLSelectElement.prototype,"selectedIndex"],[le.HTMLOptionElement.prototype,"selected"]];return te&&te.set&&fe.push(...Be.map(He=>Xr(He[0],He[1],{set(){$e(ve)({target:this,isTrusted:!1})}},!1,le))),$e(()=>{fe.forEach(He=>He())})}(n),I=function(N){var{mediaInteractionCb:A,blockClass:j,blockSelector:X,mirror:K,sampling:Q,doc:ne}=N,ce=$e(Ce=>Sr($e(z=>{var Ee=bn(z);if(Ee&&!Mt(Ee,j,X,!0)){var{currentTime:ve,volume:_e,muted:fe,playbackRate:le,loop:te}=Ee;A({type:Ce,id:K.getId(Ee),currentTime:ve,volume:_e,muted:fe,playbackRate:le,loop:te})}}),Q.media||500)),ge=[Ae("play",ce(Qr.Play),ne),Ae("pause",ce(Qr.Pause),ne),Ae("seeked",ce(Qr.Seeked),ne),Ae("volumechange",ce(Qr.VolumeChange),ne),Ae("ratechange",ce(Qr.RateChange),ne)];return $e(()=>{ge.forEach(Ce=>Ce())})}(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 ne=Q.CSSStyleSheet.prototype.insertRule;Q.CSSStyleSheet.prototype.insertRule=new Proxy(ne,{apply:$e((ve,_e,fe)=>{var[le,te]=fe,{id:Be,styleId:He}=Ir(_e,X,K.styleMirror);return(Be&&Be!==-1||He&&He!==-1)&&j({id:Be,styleId:He,adds:[{rule:le,index:te}]}),ve.apply(_e,fe)})}),Q.CSSStyleSheet.prototype.addRule=function(ve,_e){var fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.cssRules.length,le="".concat(ve," { ").concat(_e," }");return Q.CSSStyleSheet.prototype.insertRule.apply(this,[le,fe])};var ce,ge,Ce=Q.CSSStyleSheet.prototype.deleteRule;Q.CSSStyleSheet.prototype.deleteRule=new Proxy(Ce,{apply:$e((ve,_e,fe)=>{var[le]=fe,{id:te,styleId:Be}=Ir(_e,X,K.styleMirror);return(te&&te!==-1||Be&&Be!==-1)&&j({id:te,styleId:Be,removes:[{index:le}]}),ve.apply(_e,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:$e((ve,_e,fe)=>{var[le]=fe,{id:te,styleId:Be}=Ir(_e,X,K.styleMirror);return(te&&te!==-1||Be&&Be!==-1)&&j({id:te,styleId:Be,replace:le}),ve.apply(_e,fe)})})),Q.CSSStyleSheet.prototype.replaceSync&&(ge=Q.CSSStyleSheet.prototype.replaceSync,Q.CSSStyleSheet.prototype.replaceSync=new Proxy(ge,{apply:$e((ve,_e,fe)=>{var[le]=fe,{id:te,styleId:Be}=Ir(_e,X,K.styleMirror);return(te&&te!==-1||Be&&Be!==-1)&&j({id:te,styleId:Be,replaceSync:le}),ve.apply(_e,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 Ee={};return Object.entries(z).forEach(ve=>{var[_e,fe]=ve;Ee[_e]={insertRule:fe.prototype.insertRule,deleteRule:fe.prototype.deleteRule},fe.prototype.insertRule=new Proxy(Ee[_e].insertRule,{apply:$e((le,te,Be)=>{var[He,Re]=Be,{id:V,styleId:Te}=Ir(te.parentStyleSheet,X,K.styleMirror);return(V&&V!==-1||Te&&Te!==-1)&&j({id:V,styleId:Te,adds:[{rule:He,index:[...Wn(te),Re||0]}]}),le.apply(te,Be)})}),fe.prototype.deleteRule=new Proxy(Ee[_e].deleteRule,{apply:$e((le,te,Be)=>{var[He]=Be,{id:Re,styleId:V}=Ir(te.parentStyleSheet,X,K.styleMirror);return(Re&&Re!==-1||V&&V!==-1)&&j({id:Re,styleId:V,removes:[{index:[...Wn(te),He]}]}),le.apply(te,Be)})})}),$e(()=>{Q.CSSStyleSheet.prototype.insertRule=ne,Q.CSSStyleSheet.prototype.deleteRule=Ce,ce&&(Q.CSSStyleSheet.prototype.replace=ce),ge&&(Q.CSSStyleSheet.prototype.replaceSync=ge),Object.entries(z).forEach(ve=>{var[_e,fe]=ve;fe.prototype.insertRule=Ee[_e].insertRule,fe.prototype.deleteRule=Ee[_e].deleteRule})})}(n,{win:c}),F=Io(n,n.doc),Z=function(N,A){var{styleDeclarationCb:j,mirror:X,ignoreCSSAttributes:K,stylesheetManager:Q}=N,{win:ne}=A,ce=ne.CSSStyleDeclaration.prototype.setProperty;ne.CSSStyleDeclaration.prototype.setProperty=new Proxy(ce,{apply:$e((Ce,z,Ee)=>{var ve,[_e,fe,le]=Ee;if(K.has(_e))return ce.apply(z,[_e,fe,le]);var{id:te,styleId:Be}=Ir((ve=z.parentRule)==null?void 0:ve.parentStyleSheet,X,Q.styleMirror);return(te&&te!==-1||Be&&Be!==-1)&&j({id:te,styleId:Be,set:{property:_e,value:fe,priority:le},index:Wn(z.parentRule)}),Ce.apply(z,Ee)})});var ge=ne.CSSStyleDeclaration.prototype.removeProperty;return ne.CSSStyleDeclaration.prototype.removeProperty=new Proxy(ge,{apply:$e((Ce,z,Ee)=>{var ve,[_e]=Ee;if(K.has(_e))return ge.apply(z,[_e]);var{id:fe,styleId:le}=Ir((ve=z.parentRule)==null?void 0:ve.parentStyleSheet,X,Q.styleMirror);return(fe&&fe!==-1||le&&le!==-1)&&j({id:fe,styleId:le,remove:{property:_e},index:Wn(z.parentRule)}),Ce.apply(z,Ee)})}),$e(()=>{ne.CSSStyleDeclaration.prototype.setProperty=ce,ne.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,ne=X.FontFace;X.FontFace=function(ge,Ce,z){var Ee=new ne(ge,Ce,z);return Q.set(Ee,{family:ge,buffer:typeof Ce!="string",descriptors:z,fontSource:typeof Ce=="string"?Ce:JSON.stringify(Array.from(new Uint8Array(Ce)))}),Ee};var ce=ur(j.fonts,"add",function(ge){return function(Ce){return setTimeout($e(()=>{var z=Q.get(Ce);z&&(A(z),Q.delete(Ce))}),0),ge.apply(this,[Ce])}});return K.push(()=>{X.FontFace=ne}),K.push(ce),$e(()=>{K.forEach(ge=>ge())})}(n)));var se=function(N){var{doc:A,mirror:j,blockClass:X,blockSelector:K,selectionCb:Q}=N,ne=!0,ce=$e(()=>{var ge=A.getSelection();if(!(!ge||ne&&(ge!=null&&ge.isCollapsed))){ne=ge.isCollapsed||!1;for(var Ce=[],z=ge.rangeCount||0,Ee=0;Ee<z;Ee++){var ve=ge.getRangeAt(Ee),{startContainer:_e,startOffset:fe,endContainer:le,endOffset:te}=ve;Mt(_e,X,K,!0)||Mt(le,X,K,!0)||Ce.push({start:j.getId(_e),startOffset:fe,end:j.getId(le),endOffset:te})}Q({ranges:Ce})}});return ce(),Ae("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,ne,ce){try{j({define:{name:Q}})}catch{console.warn("Custom element callback failed for ".concat(Q))}return K.apply(this,[Q,ne,ce])}}):()=>{}}(n),oe=[];for(var P of n.plugins)oe.push(P.observer(P.callback,c,P.options));return $e(()=>{Br.forEach(N=>N.reset()),s==null||s.disconnect(),h(),v(),_(),w(),S(),I(),E(),F(),Z(),H(),se(),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 Co{constructor(s){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=s}getId(s,l,c,h){var v=c||this.getIdToRemoteIdMap(s),_=h||this.getRemoteIdToIdMap(s),w=v.get(l);return w||(w=this.generateIdFn(),v.set(l,w),_.set(w,l)),w}getIds(s,l){var c=this.getIdToRemoteIdMap(s),h=this.getRemoteIdToIdMap(s);return l.map(v=>this.getId(s,v,c,h))}getRemoteId(s,l,c){var h=c||this.getRemoteIdToIdMap(s);if(typeof l!="number")return l;var v=h.get(l);return v||-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 Cu{constructor(s){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new Co(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 Co(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(v=>{this.replaceIds(v,s,["parentId","nextId","previousId"]),this.replaceIdOnNode(v.node,s);var _=this.crossOriginIframeRootIdMap.get(s);_&&this.patchRootIdOnNode(v.node,_)}),l.data.removes.forEach(v=>{this.replaceIds(v,s,["parentId","id"])}),l.data.attributes.forEach(v=>{this.replaceIds(v,s,["id"])}),l.data.texts.forEach(v=>{this.replaceIds(v,s,["id"])}),l;case De.Drag:case De.TouchMove:case De.MouseMove:return l.data.positions.forEach(v=>{this.replaceIds(v,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(v=>{this.replaceIds(v,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(v=>{this.replaceStyleIds(v,s,["styleId"])}),l}}return!1}replace(s,l,c,h){for(var v of h)(Array.isArray(l[v])||typeof l[v]=="number")&&(Array.isArray(l[v])?l[v]=s.getIds(c,l[v]):l[v]=s.getId(c,l[v]));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 Eu{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=bo(t(t({},this.bypassOptions),{},{doc:l,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),s);this.restoreHandlers.push(()=>c.disconnect()),this.restoreHandlers.push(wo(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(re.host(s))),this.restoreHandlers.push(Io({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(v){var _=h.call(this,v),w=re.shadowRoot(this);return w&&go(this)&&c.addShadowRoot(w,l),_}}))}reset(){this.restoreHandlers.forEach(s=>{try{s()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var wn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ku=typeof Uint8Array>"u"?[]:new Uint8Array(256),qn=0;qn<64;qn++)ku[wn.charCodeAt(qn)]=qn;var Eo=new Map,ko=(n,s,l)=>{if(n&&(xo(n,s)||typeof n=="object")){var c=function(v,_){var w=Eo.get(v);return w||(w=new Map,Eo.set(v,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(v=>Un(v,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(v){var _,w=new Uint8Array(v),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]}:xo(n,s)||typeof n=="object"?{rr_type:n.constructor.name,index:ko(n,s,l)}:n}var To=(n,s,l)=>n.map(c=>Un(c,s,l)),xo=(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 Ro(n,s,l,c){var h=[];try{var v=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(v)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{h.forEach(_=>_())}}function Mo(n,s,l,c,h,v){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 se=arguments.length,he=new Array(se),oe=0;oe<se;oe++)he[oe]=arguments[oe];var P=H.apply(this,he);if(ko(P,v,this),"tagName"in this.canvas&&!Mt(this.canvas,c,h,!0)){var N=To(he,v,this),A={type:s,property:E,args:N};l(this.canvas,A)}return P}});_.push(F)}catch{var Z=Xr(n,E,{set(se){l(this.canvas,{type:s,property:E,args:[se],setter:!0})}});_.push(Z)}};for(var I of w)S(I);return _}var Ao,nt,Vn,Hi,Oo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",No=typeof window<"u"&&window.Blob&&new Blob([(Ao=Oo,Uint8Array.from(atob(Ao),n=>n.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});function Tu(n){var s;try{if(!(s=No&&(window.URL||window.webkitURL).createObjectURL(No)))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,"+Oo,{name:n==null?void 0:n.name})}finally{s&&(window.URL||window.webkitURL).revokeObjectURL(s)}}class xu{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:v,recordCanvas:_,dataURLOptions:w}=s;this.mutationCb=s.mutationCb,this.mirror=s.mirror,_&&l==="all"&&this.initCanvasMutationObserver(c,h,v),_&&typeof l=="number"&&this.initCanvasFPSObserver(l,c,h,v,{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,v){var _=this,w=Ro(l,c,h,!0),S=new Map,I=new Tu;I.onmessage=se=>{var{id:he}=se.data;if(S.set(he,!1),"base64"in se.data){var{base64:oe,type:P,width:N,height:A}=se.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=se=>{var he,oe;Z&&se-Z<F||(Z=se,(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,ne=yield createImageBitmap(N,{resizeWidth:K,resizeHeight:Q});I.postMessage({id:j,bitmap:ne,width:K,height:Q,dataURLOptions:v.dataURLOptions},[ne])}});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=Ro(s,l,c,!1),v=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=To(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 se of Z)H(se);return()=>{F.forEach(he=>he())}}(this.processMutation.bind(this),s,l,c),_=function(w,S,I,E){var F=[];return F.push(...Mo(S.WebGLRenderingContext.prototype,Kr.WebGL,w,I,E,S)),S.WebGL2RenderingContext!==void 0&&F.push(...Mo(S.WebGL2RenderingContext.prototype,Kr.WebGL2,w,I,E,S)),()=>{F.forEach(Z=>Z())}}(this.processMutation.bind(this),s,l,c);this.resetObservers=()=>{h(),v(),_()}}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:v}=c[0];this.mutationCb({id:l,type:v,commands:h}),this.pendingCanvasMutations.delete(s)}}}}class Ru{constructor(s){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new mu),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:[]},v=[],_=function(S){var I=void 0;c.styleMirror.has(S)?I=c.styleMirror.getId(S):(I=c.styleMirror.add(S),v.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);v.length>0&&(h.styles=v),this.adoptedStyleSheetCb(h)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(s){}}class Mu{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 $i=document.createElement("iframe");document.body.appendChild($i),Array.from=((d=$i.contentWindow)==null?void 0:d.Array.from)||Array.from,document.body.removeChild($i)}}catch(n){console.debug("Unable to override Array.from",n)}var Fo,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:v=null,ignoreClass:_="rr-ignore",ignoreSelector:w=null,maskTextClass:S="rr-mask",maskTextSelector:I=null,inlineStylesheet:E=!0,maskAllInputs:F,maskInputOptions:Z,slimDOMOptions:H,maskInputFn:se,maskTextFn:he,hooks:oe,packFn:P,sampling:N={},dataURLOptions:A={},mousemoveWait:j,recordDOM:X=!0,recordCanvas:K=!1,recordCrossOriginIframes:Q=!1,recordAfter:ne=n.recordAfter==="DOMContentLoaded"?n.recordAfter:"load",userTriggeredOnInput:ce=!1,collectFonts:ge=!1,inlineImages:Ce=!1,plugins:z,keepIframeSrcFn:Ee=()=>!1,ignoreCSSAttributes:ve=new Set([]),errorHandler:_e}=n;yn=_e;var fe=!Q||window.parent===window,le=!1;if(!fe)try{window.parent.document&&(le=!1)}catch{le=!0}if(fe&&!s)throw new Error("emit function is required");if(!fe&&!le)return()=>{};j!==void 0&&N.mousemove===void 0&&(N.mousemove=j),tr.reset();var te,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 Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;"NodeList"in Me&&!Me.NodeList.prototype.forEach&&(Me.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in Me&&!Me.DOMTokenList.prototype.forEach&&(Me.DOMTokenList.prototype.forEach=Array.prototype.forEach)})();var Re=0,V=Me=>{for(var Ot of z||[])Ot.eventProcessor&&(Me=Ot.eventProcessor(Me));return P&&!le&&(Me=P(Me)),Me};nt=(Me,Ot)=>{var we,Oe=Me;if(Oe.timestamp=Jr(),!((we=Br[0])!=null&&we.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(le){var Bt={type:"rrweb",event:V(Oe),origin:window.location.origin,isCheckout:Ot};window.parent.postMessage(Bt,"*")}if(Oe.type===je.FullSnapshot)te=Oe,Re=0;else if(Oe.type===je.IncrementalSnapshot){if(Oe.data.source===De.Mutation&&Oe.data.isAttachIframe)return;Re++;var rr=c&&Re>=c,nr=l&&Oe.timestamp-te.timestamp>l;(rr||nr)&&Vn(!0)}};var Te=Me=>{nt({type:je.IncrementalSnapshot,data:t({source:De.Mutation},Me)})},At=Me=>nt({type:je.IncrementalSnapshot,data:t({source:De.Scroll},Me)}),ft=Me=>nt({type:je.IncrementalSnapshot,data:t({source:De.CanvasMutation},Me)}),et=new Ru({mutationCb:Te,adoptedStyleSheetCb:Me=>nt({type:je.IncrementalSnapshot,data:t({source:De.AdoptedStyleSheet},Me)})}),vt=new Cu({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 Mu;Hi=new xu({recordCanvas:K,mutationCb:ft,win:window,blockClass:h,blockSelector:v,mirror:tr,sampling:N.canvas,dataURLOptions:A});var tt=new Eu({mutationCb:Te,scrollCb:At,bypassOptions:{blockClass:h,blockSelector:v,maskTextClass:S,maskTextSelector:I,inlineStylesheet:E,maskInputOptions:Be,dataURLOptions:A,maskTextFn:he,maskInputFn:se,recordCanvas:K,inlineImages:Ce,sampling:N,slimDOMOptions:He,iframeManager:vt,stylesheetManager:et,canvasManager:Hi,keepIframeSrcFn:Ee,processedNodeManager:Xt},mirror:tr});Vn=function(){var Me=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(X){nt({type:je.Meta,data:{href:window.location.href,width:ao(),height:$n()}},Me),et.reset(),tt.init(),Br.forEach(we=>we.lock());var Ot=function(we,Oe){var{mirror:Bt=new _t,blockClass:rr="rr-block",blockSelector:nr=null,maskTextClass:gr="rr-mask",maskTextSelector:ni=null,inlineStylesheet:us=!0,inlineImages:tc=!1,recordCanvas:rc=!1,maskAllInputs:cs=!1,maskTextFn:nc,maskInputFn:ic,slimDOM:In=!1,dataURLOptions:sc,preserveWhiteSpace:oc,onSerialize:ac,onIframeLoad:lc,iframeLoadTimeout:uc,onStylesheetLoad:cc,stylesheetLoadTimeout:dc,keepIframeSrcFn:hc=()=>!1}=Oe||{};return at(we,{doc:we,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:nc,maskInputFn:ic,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:sc,inlineImages:tc,recordCanvas:rc,preserveWhiteSpace:oc,onSerialize:ac,onIframeLoad:lc,iframeLoadTimeout:uc,onStylesheetLoad:cc,stylesheetLoadTimeout:dc,keepIframeSrcFn:hc,newlyAddedElement:!1})}(document,{mirror:tr,blockClass:h,blockSelector:v,maskTextClass:S,maskTextSelector:I,inlineStylesheet:E,maskAllInputs:Be,maskTextFn:he,maskInputFn:se,slimDOM:He,dataURLOptions:A,recordCanvas:K,inlineImages:Ce,onSerialize:we=>{co(we,tr)&&vt.addIframe(we),ho(we,tr)&&et.trackLinkElement(we),Di(we)&&tt.addShadowRoot(re.shadowRoot(we),document)},onIframeLoad:(we,Oe)=>{vt.attachIframe(we,Oe),tt.observeAttachShadow(we)},onStylesheetLoad:(we,Oe)=>{et.attachLinkElement(we,Oe)},keepIframeSrcFn:Ee});if(!Ot)return console.warn("Failed to snapshot the document");nt({type:je.FullSnapshot,data:{node:Ot,initialOffset:cr(window)}},Me),Br.forEach(we=>we.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&et.adoptStyleSheets(document.adoptedStyleSheets,tr.getId(document))}};try{var $r=[],Sn=Me=>{var Ot;return $e(Iu)({mutationCb:Te,mousemoveCb:(we,Oe)=>nt({type:je.IncrementalSnapshot,data:{source:Oe,positions:we}}),mouseInteractionCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.MouseInteraction},we)}),scrollCb:At,viewportResizeCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.ViewportResize},we)}),inputCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.Input},we)}),mediaInteractionCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.MediaInteraction},we)}),styleSheetRuleCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.StyleSheetRule},we)}),styleDeclarationCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.StyleDeclaration},we)}),canvasMutationCb:ft,fontCb:we=>nt({type:je.IncrementalSnapshot,data:t({source:De.Font},we)}),selectionCb:we=>{nt({type:je.IncrementalSnapshot,data:t({source:De.Selection},we)})},customElementCb:we=>{nt({type:je.IncrementalSnapshot,data:t({source:De.CustomElement},we)})},blockClass:h,ignoreClass:_,ignoreSelector:w,maskTextClass:S,maskTextSelector:I,maskInputOptions:Be,inlineStylesheet:E,sampling:N,recordDOM:X,recordCanvas:K,inlineImages:Ce,userTriggeredOnInput:ce,collectFonts:ge,doc:Me,maskInputFn:se,maskTextFn:he,keepIframeSrcFn:Ee,blockSelector:v,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(we=>we.observer))==null?void 0:Ot.map(we=>({observer:we.observer,options:we.options,callback:Oe=>nt({type:je.Plugin,data:{plugin:we.name,payload:Oe}})})))||[]},oe)};vt.addLoadListener(Me=>{try{$r.push(Sn(Me.contentDocument))}catch(Ot){console.warn(Ot)}});var pr=()=>{Vn(),$r.push(Sn(document)),zn=!0};return document.readyState==="interactive"||document.readyState==="complete"?pr():($r.push(Ae("DOMContentLoaded",()=>{nt({type:je.DomContentLoaded,data:{}}),ne==="DOMContentLoaded"&&pr()})),$r.push(Ae("load",()=>{nt({type:je.Load,data:{}}),ne==="load"&&pr()},window))),()=>{$r.forEach(Me=>Me()),Xt.destroy(),zn=!1,yn=void 0}}catch(Me){console.warn(Me)}}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=Fo||(Fo={}))[en.NotStarted=0]="NotStarted",en[en.Running=1]="Running",en[en.Stopped=2]="Stopped";var Po,Au=Object.defineProperty,Yn=(n,s,l)=>((c,h,v)=>h in c?Au(c,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[h]=v)(n,typeof s!="symbol"?s+"":s,l),Ou=Object.defineProperty,Wi=(n,s,l)=>((c,h,v)=>h in c?Ou(c,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[h]=v)(n,typeof s!="symbol"?s+"":s,l),Nu=Object.defineProperty,Lo=(n,s,l)=>((c,h,v)=>h in c?Nu(c,h,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[h]=v)(n,typeof s!="symbol"?s+"":s,l),Do={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Bo={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 Do?Do[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]"))})),v=n in Bo?Bo[n]:void 0,_=!!(v&&v.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 v=ji(n),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(Gi[h]=_,_.call(s)):s[l]}var qi={};function Ho(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 Ho("Node",n,"contains")(s)},getRootNode:function(n){return Ho("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 Fu{constructor(){Lo(this,"idNodeMap",new Map),Lo(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 $o={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 $o?$o[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]"))})),v=n in Wo?Wo[n]:void 0,_=!!(v&&v.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 v=zi(n),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(Yi[h]=_,_.call(s)):s[l]}var Zi={};function jo(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 jo("Node",n,"contains")(s)},getRootNode:function(n){return jo("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 Go=Date.now;function qo(n){return n?n.nodeType===n.ELEMENT_NODE?n:Zt.parentElement(n):null}/[1-9][0-9]{12}/.test(Date.now().toString())||(Go=()=>new Date().getTime());function Uo(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 Vo(n){for(var s,l=n;s=Uo(l);)l=s;return l}function zo(n){var s=n.ownerDocument;if(!s)return!1;var l=Vo(n);return Zt.contains(s,l)}for(var Pu=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){Wi(this,"id",1),Wi(this,"styleIDMap",new WeakMap),Wi(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:qo,getBaseDimension:function n(s,l){var c,h,v=(h=(c=s.ownerDocument)==null?void 0:c.defaultView)==null?void 0:h.frameElement;if(!v||v===l)return{x:0,y:0,relativeScale:1,absoluteScale:1};var _=v.getBoundingClientRect(),w=n(v,l),S=_.height/v.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:Vo,getShadowHost:Uo,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(n){var s,l,c,h,v=n.document;return{left:v.scrollingElement?v.scrollingElement.scrollLeft:n.pageXOffset!==void 0?n.pageXOffset:v.documentElement.scrollLeft||(v==null?void 0:v.body)&&((s=Zt.parentElement(v.body))==null?void 0:s.scrollLeft)||((l=v==null?void 0:v.body)==null?void 0:l.scrollLeft)||0,top:v.scrollingElement?v.scrollingElement.scrollTop:n.pageYOffset!==void 0?n.pageYOffset:(v==null?void 0:v.documentElement.scrollTop)||(v==null?void 0:v.body)&&((c=Zt.parentElement(v.body))==null?void 0:c.scrollTop)||((h=v==null?void 0:v.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 v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:window,_=v.Object.getOwnPropertyDescriptor(s,l);return v.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)||zo(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,v=l.getId(s);if(!l.has(v))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=qo(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 Go},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:v,parentId:_}=h;if(v&&v in s){var w=s[v];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:zo,throttle:function(n,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=null,h=0;return function(){for(var v=arguments.length,_=new Array(v),w=0;w<v;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"})),Lu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Du=typeof Uint8Array>"u"?[]:new Uint8Array(256),Kn=0;Kn<64;Kn++)Du[Lu.charCodeAt(Kn)]=Kn;var Yo;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=((Po=Ji.contentWindow)==null?void 0:Po.Array.from)||Array.from,document.body.removeChild(Ji)}}catch(n){console.debug("Unable to override Array.from",n)}new Fu,function(n){n[n.NotStarted=0]="NotStarted",n[n.Running=1]="Running",n[n.Stopped=2]="Stopped"}(Yo||(Yo={}));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 Bu=/(^|@)\S+:\d+/,Zo=/^\s*at .*(\S+:\d+|\(native\))/m,Hu=/^(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(Zo)?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(Zo)},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),v=this.extractLocation(c?c[1]:h.pop()),_=h.join(" ")||void 0,w=["eval","<anonymous>"].indexOf(v[0])>-1?void 0:v[0];return new rn({functionName:_,fileName:w,lineNumber:v[1],columnNumber:v[2]})},this)},parseFFOrSafari:function(n){return n.stack.split(`
`).filter(function(s){return!s.match(Hu)},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,v=this.extractLocation(s.replace(l,""));return new rn({functionName:h,fileName:v[0],lineNumber:v[1],columnNumber:v[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,v=l.length;h<v;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,v=l.length;h<v;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(Bu)&&!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 $u(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 v=0;v<c.children.length;v++){var _=c.children[v];_.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 Xo(n,s){if(s===0)return!0;var l=Object.keys(n);for(var c of l)if(Qi(n[c])&&Xo(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(v,_){if(c.length>0){var w=c.indexOf(this);~w?c.splice(w+1):c.push(this),~w?h.splice(w,1/0,v):h.push(v),~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)&&Xo(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]=$u(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 Jo={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({},Jo,l):Jo,v=h.logger;if(!v)return()=>{};c=typeof v=="string"?s[v]:v;var _=0,w=!1,S=[];if(h.level.includes("error")){var I=H=>{var se=H.message,he=H.error,oe=Ki.parse(he).map(N=>N.toString()),P=[nn(se,h.stringifyOptions)];n({level:"error",trace:oe,payload:P})};s.addEventListener("error",I),S.push(()=>{s.removeEventListener("error",I)});var E=H=>{var se,he;H.reason instanceof Error?(se=H.reason,he=[nn("Uncaught (in promise) ".concat(se.name,": ").concat(se.message),h.stringifyOptions)]):(se=new Error,he=[nn("Uncaught (in promise)",h.stringifyOptions),nn(H.reason,h.stringifyOptions)]);var oe=Ki.parse(se).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,se){var he=this;return H[se]?Pu.patch(H,se,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),!(se==="assert"&&N[0]||w)){w=!0;try{var j=Ki.parse(new Error).map(K=>K.toString()).splice(1),X=(se==="assert"?N.slice(1):N).map(K=>nn(K,h.stringifyOptions));++_<h.lengthThreshold?n({level:se,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 Ko=n=>({name:"rrweb/console@1",observer:Wu,options:n}),hr=typeof window<"u"?window:void 0,Dt=typeof globalThis<"u"?globalThis:hr,Qo=Array.prototype.forEach,ea=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,ea==null||ea.userAgent;var ta,kr=hr??{},ra="[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(ra,...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(ra,...s)},uninitializedWarning:n=>{sn.error("You must initialize PostHog before calling ".concat(n))}},es={};function ju(n,s,l){if(!ia(n)){if(Qn(n))return function(v,_,w){if(Qn(v)){if(Qo&&v.forEach===Qo)v.forEach(_,w);else if("length"in v&&v.length===+v.length){for(var S=0,I=v.length;S<I;S++)if(S in v&&_.call(w,v[S],S)===es)return}}}(n,s,l);if(sa(n)){for(var c of n.entries())if(s.call(l,c[1],c[0])===es)return}else for(var h in n)if(qu.call(n,h)&&s.call(l,n[h],h)===es)return}}(function(n){n.GZipJS="gzip-js",n.Base64="base64"})(ta||(ta={}));var Gu=Array.isArray,na=Object.prototype,qu=na.hasOwnProperty,ts=na.toString,Qn=Gu||function(n){return ts.call(n)==="[object Array]"},Uu=n=>typeof n=="function",Vu=n=>n===Object(n)&&!Qn(n),Tr=n=>n===void 0,zu=n=>ts.call(n)=="[object String]",rs=n=>n===null,ia=n=>Tr(n)||rs(n),ns=n=>ts.call(n)==="[object Boolean]",Yu=n=>n instanceof Document,sa=n=>n instanceof FormData,Zu=function(n){var s,l,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",h=[];return ju(n,function(v,_){Tr(v)||Tr(_)||_==="undefined"||(s=encodeURIComponent(v instanceof File?v.name:v.toString()),l=encodeURIComponent(_),h[h.length]=l+"="+s)}),h.join(c)},oa={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 aa(n,s,l){try{if(!(s in n))return()=>{};var c=n[s],h=l(c);return Uu(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 v of s.payloadHostDenyList)if(c.endsWith(v))return{hostname:c,isHostDenied:!0};return h}var la=n=>n.entryType==="navigation",ss=n=>n.entryType==="resource";function ua(n,s){for(var l=n.length-1;l>=0;l-=1)if(s(n[l]))return n[l]}function Xu(n,s,l){if(l.recordInitialRequests){var c=s.performance.getEntries().filter(_=>la(_)||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=>la(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:{}}))})}),v=PerformanceObserver.supportedEntryTypes.filter(_=>l.performanceEntryTypeToObserve.includes(_));return h.observe({entryTypes:v}),()=>{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 v=l[s];return ns(v)?v:h(v)}function os(n,s,l,c,h){return as.apply(this,arguments)}function as(){return as=o(function*(n,s,l,c,h){var v=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(v>10)return sn.warn("Failed to get performance entry for request",{url:l,initiatorType:s}),null;var _=ua(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*v)),os(n,s,l,c,h,v+1))}),as.apply(this,arguments)}function ca(n){var{body:s,options:l,url:c}=n;if(ia(s))return null;var{hostname:h,isHostDenied:v}=is(c,l);if(v)return h+" is in deny list";if(zu(s))return s;if(Yu(s))return s.textContent;if(sa(s))return Zu(s);if(Vu(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 Ju=n=>!rs(n)&&(n.entryType==="navigation"||n.entryType==="resource");function ri(n){var{entry:s,method:l,status:c,networkRequest:h,isInitial:v,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:v})];if(Ju(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 Ku=["video/","audio/"];function da(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 ha(){return(ha=o(function*(n){var{r:s,options:l,url:c}=n,{hostname:h,isHostDenied:v}=is(c,l);return v?Promise.resolve(h+" is in deny list"):da(s)})).apply(this,arguments)}function pa(){return(pa=o(function*(n){var{r:s,options:l,url:c}=n,h=function(v){var _,{r:w,options:S,url:I}=v;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=Ku.some(se=>E==null?void 0:E.startsWith(se));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)?da(s):Promise.resolve(h)})).apply(this,arguments)}function Qu(n,s,l){if(!l.initiatorTypes.includes("fetch"))return()=>{};var c=ei("request",l.recordHeaders),h=ei("response",l.recordHeaders),v=aa(s,"fetch",_=>function(){var w=o(function*(S,I){var E,F,Z,H=new Request(S,I),se={};try{var he={};H.headers.forEach((P,N)=>{he[N]=P}),c&&(se.requestHeaders=he),ti({type:"request",headers:he,url:S,recordBody:l.recordBody})&&(se.requestBody=yield function(P){return ha.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&&(se.responseHeaders=oe),ti({type:"response",headers:oe,url:S,recordBody:l.recordBody})&&(se.responseBody=yield function(P){return pa.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:se,start:F,end:Z,url:H.url,initiatorType:"fetch"});n({requests:A})}).catch(()=>{})}});return function(S,I){return w.apply(this,arguments)}}());return()=>{v()}}var ga=null;function ec(n,s,l){if(!("performance"in s))return()=>{};if(ga)return sn.warn("Network observer already initialised, doing nothing"),()=>{};var c=l?Object.assign({},oa,l):oa,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}))},v=Xu(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=aa(I.XMLHttpRequest.prototype,"open",se=>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),ne={},ce={},ge=K.setRequestHeader.bind(K);K.setRequestHeader=(z,Ee)=>(ce[z]=Ee,ge(z,Ee)),F&&(ne.requestHeaders=ce);var Ce=K.send.bind(K);K.send=z=>(ti({type:"request",headers:ce,url:oe,recordBody:E.recordBody})&&(ne.requestBody=ca({body:z,options:E,url:oe})),P=I.performance.now(),Ce(z)),K.addEventListener("readystatechange",()=>{if(K.readyState===K.DONE){N=I.performance.now();var z={};K.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(Ee=>{var ve=Ee.split(": "),_e=ve.shift(),fe=ve.join(": ");_e&&(z[_e]=fe)}),Z&&(ne.responseHeaders=z),ti({type:"response",headers:z,url:oe,recordBody:E.recordBody})&&(ne.responseBody=ca({body:K.response,options:E,url:oe})),os(I,"xmlhttprequest",Q.url,P,N).then(Ee=>{var ve=ri({entry:Ee,method:he,status:K==null?void 0:K.status,networkRequest:ne,start:P,end:N,url:oe.toString(),initiatorType:"xmlhttprequest"});S({requests:ve})}).catch(()=>{})}}),se.call(K,he,oe,A,j,X)});return()=>{H()}}(h,s,c),w=Qu(h,s,c)),ga=()=>{v(),_(),w()}}var fa="rrweb/network@1",ls=n=>({name:fa,observer:ec,options:n});kr.__PosthogExtensions__=kr.__PosthogExtensions__||{},kr.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Ko,getRecordNetworkPlugin:ls},kr.__PosthogExtensions__.rrweb={record:Hr,version:"v2"},kr.rrweb={record:Hr,version:"v2"},kr.rrwebConsoleRecord={getRecordConsolePlugin:Ko},kr.getRecordNetworkPlugin=ls,r.NETWORK_PLUGIN_NAME=fa,r.default=Hr,r.findLast=ua,r.getRecordNetworkPlugin=ls,Object.defineProperty(r,"__esModule",{value:!0})})({});(function(){function r(M,x){var L=Object.keys(M);if(Object.getOwnPropertySymbols){var U=Object.getOwnPropertySymbols(M);x&&(U=U.filter(function(de){return Object.getOwnPropertyDescriptor(M,de).enumerable})),L.push.apply(L,U)}return L}function e(M){for(var x=1;x<arguments.length;x++){var L=arguments[x]!=null?arguments[x]:{};x%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,x,L){return x in M?Object.defineProperty(M,x,{value:L,enumerable:!0,configurable:!0,writable:!0}):M[x]=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&&!G(i.console)&&i.console){for(var x=("__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];x(p,...U)}},info:function(){for(var M=arguments.length,x=new Array(M),L=0;L<M;L++)x[L]=arguments[L];m._log("log",...x)},warn:function(){for(var M=arguments.length,x=new Array(M),L=0;L<M;L++)x[L]=arguments[L];m._log("warn",...x)},error:function(){for(var M=arguments.length,x=new Array(M),L=0;L<M;L++)x[L]=arguments[L];m._log("error",...x)},critical:function(){for(var M=arguments.length,x=new Array(M),L=0;L<M;L++)x[L]=arguments[L];console.error(p,...x)},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"],f=Array.isArray,b=Object.prototype.toString,y=f||function(M){return b.call(M)==="[object Array]"},k=M=>typeof M=="function",T=M=>M===Object(M)&&!y(M),G=M=>M===void 0,q=M=>b.call(M)=="[object String]",$=M=>q(M)&&M.trim().length===0,ue=M=>M===null;function ae(M){return!G(Event)&&Se(M,Event)}function Se(M,x){try{return M instanceof x}catch{return!1}}function Ge(M){return ue(M)||!T(M)&&!k(M)}function me(M,x){return Object.prototype.toString.call(M)==="[object ".concat(x,"]")}function ye(M){return me(M,"DOMError")}var Ne=/\(error: (.*)\)/,qe=50,Ze="?";function st(M,x,L,U){var de={platform:"web:javascript",filename:M,function:x==="<anonymous>"?Ze:x,in_app:!0};return G(L)||(de.lineno=L),G(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,ut=/\((\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,x=new Array(M),L=0;L<M;L++)x[L]=arguments[L];var U=x.sort((de,Ie)=>de[0]-Ie[0]).map(de=>de[1]);return function(de){for(var Ie=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Fe=[],Ue=de.split(`
`),Le=Ie;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 be=Yt(Pt);if(be){Fe.push(be);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 x=It.exec(M);if(x){var[,L,U,de]=x;return st(L,Ze,+U,+de)}var Ie=_t.exec(M);if(Ie){if(Ie[2]&&Ie[2].indexOf("eval")===0){var Fe=ut.exec(Ie[2]);Fe&&(Ie[2]=Fe[1],Ie[3]=Fe[2],Ie[4]=Fe[3])}var[Ue,Le]=yt(Ie[1]||Ze,Ie[2]);return st(Le,Ue,Ie[3]?+Ie[3]:void 0,Ie[4]?+Ie[4]:void 0)}}],[50,M=>{var x=ht.exec(M);if(x){if(x[3]&&x[3].indexOf(" > eval")>-1){var L=kt.exec(x[3]);L&&(x[1]=x[1]||"eval",x[3]=L[1],x[4]=L[2],x[5]="")}var U=x[3],de=x[1]||Ze;return[de,U]=yt(de,U),st(U,de,x[4]?+x[4]:void 0,x[5]?+x[5]:void 0)}}]);function pt(M){return M[M.length-1]||{}}var yt=(M,x)=>{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(x):"safari-web-extension:".concat(x)]:[M,x]},zt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Qe(M){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,L=M.stacktrace||M.stack||"",U=function(Ie){return Ie&&Ve.test(Ie.message)?1:0}(M);try{var de=Tt(L,U);return de.slice(0,de.length-x)}catch{}return[]}var Ve=/Minified React error #\d+;/i;function ze(M,x){var L,U,de=Qe(M),Ie=(L=x==null?void 0:x.handled)===null||L===void 0||L,Fe=(U=x==null?void 0:x.synthetic)!==null&&U!==void 0&&U;return{$exception_list:[{type:x!=null&&x.overrideExceptionType?x.overrideExceptionType:M.name,value:x!=null&&x.overrideExceptionMessage?x.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:Ie,synthetic:Fe}}],$exception_level:"error"}}function ot(M,x){var L,U,de,Ie=(L=x==null?void 0:x.handled)===null||L===void 0||L,Fe=(U=x==null?void 0:x.synthetic)===null||U===void 0||U,Ue={type:x!=null&&x.overrideExceptionType?x.overrideExceptionType:(de=x==null?void 0:x.defaultExceptionType)!==null&&de!==void 0?de:"Error",value:x!=null&&x.overrideExceptionMessage?x.overrideExceptionMessage:M||(x==null?void 0:x.defaultExceptionMessage),mechanism:{handled:Ie,synthetic:Fe}};if(x!=null&&x.syntheticException){var Le=Qe(x.syntheticException,1);Le.length&&(Ue.stacktrace={frames:Le,type:"raw"})}return{$exception_list:[Ue],$exception_level:"error"}}function Rt(M,x){var L,U,de,Ie=(L=x==null?void 0:x.handled)===null||L===void 0||L,Fe=(U=x==null?void 0:x.synthetic)===null||U===void 0||U,Ue=x!=null&&x.overrideExceptionType?x.overrideExceptionType:ae(M)?M.constructor.name:"Error",Le=x!=null&&x.overrideExceptionMessage?x.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(Yt){var be=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>be))return gt===at.length||bt.length<=be?bt:"".concat(bt.slice(0,be),"...")}return""}(M)),rt={type:Ue,value:Le,mechanism:{handled:Ie,synthetic:Fe}};if(x!=null&&x.syntheticException){var Pt=Qe(x==null?void 0:x.syntheticException,1);Pt.length&&(rt.stacktrace={frames:Pt,type:"raw"})}return{$exception_list:[rt],$exception_level:(de=M.level,q(de)&&!$(de)&&g.indexOf(de)>=0?M.level:"error")}}function er(M,x){var[L,U,de,Ie,Fe]=M,Ue={$exception_list:[]},Le=Fe||L;if(ye(Le)||function(R){return me(R,"DOMException")}(Le)){var rt=Le;if(function(R){return"stack"in R}(Le))Ue=ze(Le,x);else{var Pt=rt.name||(ye(rt)?"DOMError":"DOMException"),Yt=rt.message?"".concat(Pt,": ").concat(rt.message):Pt,be=ye(rt)?"DOMError":"DOMException";Ue=ot(Yt,e(e({},x),{},{overrideExceptionType:be,defaultExceptionMessage:Yt}))}return"code"in rt&&(Ue.$exception_DOMException_code="".concat(rt.code)),Ue}if(function(R){return me(R,"ErrorEvent")}(Le)&&Le.error)return ze(Le.error,x);if(function(R){switch(Object.prototype.toString.call(R)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Se(R,Error)}}(Le))return ze(Le,x);if(function(R){return me(R,"Object")}(Le)||ae(Le))return Rt(Le,x);if(G(Fe)&&q(L)){var at="Error",gt=L,bt=L.match(zt);return bt&&(at=bt[1],gt=bt[2]),ot(gt,e(e({},x),{},{overrideExceptionType:at,defaultExceptionMessage:gt}))}return ot(Le,x)}function Dr(M){var[x]=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}(x);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 x=i;x||m.info("window not available, cannot wrap onerror");var L=x.onerror;return x.onerror=function(){for(var U,de=arguments.length,Ie=new Array(de),Fe=0;Fe<de;Fe++)Ie[Fe]=arguments[Fe];var Ue=er(Ie);return M(Ue),(U=L==null?void 0:L(...Ie))!==null&&U!==void 0&&U},x.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var U;(U=x.onerror)===null||U===void 0||delete U.__POSTHOG_INSTRUMENTED__,x.onerror=L}},wrapUnhandledRejection:M=>{var x=i;x||m.info("window not available, cannot wrap onUnhandledRejection");var L=x.onunhandledrejection;return x.onunhandledrejection=function(){for(var U,de=arguments.length,Ie=new Array(de),Fe=0;Fe<de;Fe++)Ie[Fe]=arguments[Fe];var Ue=Dr(Ie);return M(Ue),(U=L==null?void 0:L.apply(x,Ie))!==null&&U!==void 0&&U},x.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var U;(U=x.onunhandledrejection)===null||U===void 0||delete U.__POSTHOG_INSTRUMENTED__,x.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,f,b,y,k,T){try{var G=m[k](T),q=G.value}catch($){return void f($)}G.done?g(q):Promise.resolve(q).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,f){try{if(!(g in m))return()=>{};var b=m[g],y=f(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:f,windowId:b}=m.checkAndGetSessionAndWindowId(!0);g.headers.set("X-POSTHOG-SESSION-ID",f),g.headers.set("X-POSTHOG-WINDOW-ID",b)};a.__PosthogExtensions__=a.__PosthogExtensions__||{};var p={_patchFetch:m=>u(e,"fetch",g=>function(){var f,b=(f=function*(y,k){var T=new Request(y,k);return d(m,T),g(T)},function(){var y=this,k=arguments;return new Promise(function(T,G){var q=f.apply(y,k);function $(ae){r(q,T,G,$,ue,"next",ae)}function ue(ae){r(q,T,G,$,ue,"throw",ae)}$(void 0)})});return function(y,k){return b.apply(this,arguments)}}()),_patchXHR:m=>u(e.XMLHttpRequest.prototype,"open",g=>function(f,b){var y=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],k=arguments.length>3?arguments[3]:void 0,T=arguments.length>4?arguments[4]:void 0,G=new Request(b);return d(m,G),g.call(this,f,G.url,y,k,T)})};a.__PosthogExtensions__.tracingHeadersPatchFns=p,a.postHogTracingHeadersPatchFns=p})();(function(){var r,e,t,i=-1,o=function(R){addEventListener("pageshow",function(D){D.persisted&&(i=D.timeStamp,R(D))},!0)},a=function(){var R=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(R&&R.responseStart>0&&R.responseStart<performance.now())return R},u=function(){var R=a();return R&&R.activationStart||0},d=function(R,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:R,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(R,D,Y){try{if(PerformanceObserver.supportedEntryTypes.includes(R)){var ee=new PerformanceObserver(function(W){Promise.resolve().then(function(){D(W.getEntries())})});return ee.observe(Object.assign({type:R,buffered:!0},Y||{})),ee}}catch{}},m=function(R,D,Y,ee){var W,ke;return function(Ye){D.value>=0&&(Ye||ee)&&((ke=D.value-(W||0))||W===void 0)&&(W=D.value,D.delta=ke,D.rating=function(We,re){return We>re[1]?"poor":We>re[0]?"needs-improvement":"good"}(D.value,Y),R(D))}},g=function(R){requestAnimationFrame(function(){return requestAnimationFrame(function(){return R()})})},f=function(R){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&R()})},b=function(R){var D=!1;return function(){D||(R(),D=!0)}},y=-1,k=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},T=function(R){document.visibilityState==="hidden"&&y>-1&&(y=R.type==="visibilitychange"?R.timeStamp:0,q())},G=function(){addEventListener("visibilitychange",T,!0),addEventListener("prerenderingchange",T,!0)},q=function(){removeEventListener("visibilitychange",T,!0),removeEventListener("prerenderingchange",T,!0)},$=function(){return y<0&&(y=k(),G(),o(function(){setTimeout(function(){y=k(),G()},0)})),{get firstHiddenTime(){return y}}},ue=function(R){document.prerendering?addEventListener("prerenderingchange",function(){return R()},!0):R()},ae=[1800,3e3],Se=function(R,D){D=D||{},ue(function(){var Y,ee=$(),W=d("FCP"),ke=p("paint",function(Ye){Ye.forEach(function(We){We.name==="first-contentful-paint"&&(ke.disconnect(),We.startTime<ee.firstHiddenTime&&(W.value=Math.max(We.startTime-u(),0),W.entries.push(We),Y(!0)))})});ke&&(Y=m(R,W,ae,D.reportAllChanges),o(function(Ye){W=d("FCP"),Y=m(R,W,ae,D.reportAllChanges),g(function(){W.value=performance.now()-Ye.timeStamp,Y(!0)})}))})},Ge=[.1,.25],me=[2500,4e3],ye={},Ne=function(){var R=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(R&&R.responseStart>0&&R.responseStart<performance.now())return R},qe=function(R){if(document.readyState==="loading")return"loading";var D=Ne();if(D){if(R<D.domInteractive)return"loading";if(D.domContentLoadedEventStart===0||R<D.domContentLoadedEventStart)return"dom-interactive";if(D.domComplete===0||R<D.domComplete)return"dom-content-loaded"}return"complete"},Ze=function(R){var D=R.nodeName;return R.nodeType===1?D.toLowerCase():D.toUpperCase().replace(/^#/,"")},st=function(R,D){var Y="";try{for(;R&&R.nodeType!==9;){var ee=R,W=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+W.length>(D||100)-1)return Y||W;if(Y=Y?W+">"+Y:W,ee.id)break;R=ee.parentNode}}catch{}return Y},It=-1,_t=function(R,D){var Y=Ne(),ee="navigate";return It>=0?ee="back-forward-cache":Y&&(document.prerendering||function(){var W=Ne();return W&&W.activationStart||0}()>0?ee="prerender":document.wasDiscarded?ee="restore":Y.type&&(ee=Y.type.replace(/_/g,"-"))),{name:R,value:-1,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:ee}},ut=function(R,D,Y){try{if(PerformanceObserver.supportedEntryTypes.includes(R)){var ee=new PerformanceObserver(function(W){Promise.resolve().then(function(){D(W.getEntries())})});return ee.observe(Object.assign({type:R,buffered:!0},Y||{})),ee}}catch{}},ht=function(R,D,Y,ee){var W,ke;return function(Ye){D.value>=0&&(Ye||ee)&&((ke=D.value-(W||0))||W===void 0)&&(W=D.value,D.delta=ke,D.rating=function(We,re){return We>re[1]?"poor":We>re[0]?"needs-improvement":"good"}(D.value,Y),R(D))}},kt=function(R){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&R()})},Tt=0,pt=1/0,yt=0,zt=function(R){R.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=ut("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(R){if(er.forEach(function(W){return W(R)}),R.interactionId||R.entryType==="first-input"){var D=Ve[Ve.length-1],Y=ze.get(R.interactionId);if(Y||Ve.length<10||R.duration>D.latency){if(Y)R.duration>Y.latency?(Y.entries=[R],Y.latency=R.duration):R.duration===Y.latency&&R.startTime===Y.entries[0].startTime&&Y.entries.push(R);else{var ee={id:R.interactionId,latency:R.duration,entries:[R]};ze.set(ee.id,ee),Ve.push(ee)}Ve.sort(function(W,ke){return ke.latency-W.latency}),Ve.length>10&&Ve.splice(10).forEach(function(W){return ze.delete(W.id)})}}},jt=function(R){var D=self.requestIdleCallback||self.setTimeout,Y=-1;return R=function(ee){var W=!1;return function(){W||(ee(),W=!0)}}(R),document.visibilityState==="hidden"?R():(Y=D(R),kt(R)),Y},M=[200,500],x=function(R,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,W=_t("INP"),ke=function(We){jt(function(){We.forEach(Dr);var re,Ae=(re=Math.min(Ve.length-1,Math.floor(Rt()/50)),Ve[re]);Ae&&Ae.latency!==W.value&&(W.value=Ae.latency,W.entries=Ae.entries,ee())})},Ye=ut("event",ke,{durationThreshold:(Y=D.durationThreshold)!==null&&Y!==void 0?Y:40});ee=ht(R,W,M,D.reportAllChanges),Ye&&(Ye.observe({type:"first-input",buffered:!0}),kt(function(){ke(Ye.takeRecords()),ee(!0)}),function(We){addEventListener("pageshow",function(re){re.persisted&&(It=re.timeStamp,We(re))},!0)}(function(){ot=0,Ve.length=0,ze.clear(),W=_t("INP"),ee=ht(R,W,M,D.reportAllChanges)}))}))},L=[],U=[],de=new WeakMap,Ie=new Map,Fe=-1,Ue=function(R){L=L.concat(R),Le()},Le=function(){Fe<0&&(Fe=jt(rt))},rt=function(){Ie.size>10&&Ie.forEach(function(We,re){ze.has(re)||Ie.delete(re)});var R=Ve.map(function(We){return de.get(We.entries[0])}),D=U.length-50;U=U.filter(function(We,re){return re>=D||R.includes(We)});for(var Y=new Set,ee=0;ee<U.length;ee++){var W=U[ee];Pt(W.startTime,W.processingEnd).forEach(function(We){Y.add(We)})}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(R){R.interactionId&&R.target&&!Ie.has(R.interactionId)&&Ie.set(R.interactionId,R.target)},function(R){var D,Y=R.startTime+R.duration;t=Math.max(t,R.processingEnd);for(var ee=U.length-1;ee>=0;ee--){var W=U[ee];if(Math.abs(Y-W.renderTime)<=8){(D=W).startTime=Math.min(R.startTime,D.startTime),D.processingStart=Math.min(R.processingStart,D.processingStart),D.processingEnd=Math.max(R.processingEnd,D.processingEnd),D.entries.push(R);break}}D||(D={startTime:R.startTime,processingStart:R.processingStart,processingEnd:R.processingEnd,renderTime:Y,entries:[R]},U.push(D)),(R.interactionId||R.entryType==="first-input")&&de.set(R,D),Le()});var Pt=function(R,D){for(var Y,ee=[],W=0;Y=L[W];W++)if(!(Y.startTime+Y.duration<R)){if(Y.startTime>D)break;ee.push(Y)}return ee},Yt=typeof window<"u"?window:void 0,be=typeof globalThis<"u"?globalThis:Yt,at=be==null?void 0:be.navigator;be==null||be.document,be==null||be.location,be==null||be.fetch,be!=null&&be.XMLHttpRequest&&"withCredentials"in new be.XMLHttpRequest&&be.XMLHttpRequest,be==null||be.AbortController,at==null||at.userAgent;var gt=Yt??{},bt={onLCP:function(R,D){D=D||{},ue(function(){var Y,ee=$(),W=d("LCP"),ke=function(re){D.reportAllChanges||(re=re.slice(-1)),re.forEach(function(Ae){Ae.startTime<ee.firstHiddenTime&&(W.value=Math.max(Ae.startTime-u(),0),W.entries=[Ae],Y())})},Ye=p("largest-contentful-paint",ke);if(Ye){Y=m(R,W,me,D.reportAllChanges);var We=b(function(){ye[W.id]||(ke(Ye.takeRecords()),Ye.disconnect(),ye[W.id]=!0,Y(!0))});["keydown","click"].forEach(function(re){addEventListener(re,function(){return function(Ae){var Gt=self.requestIdleCallback||self.setTimeout,ar=-1;return Ae=b(Ae),document.visibilityState==="hidden"?Ae():(ar=Gt(Ae),f(Ae)),ar}(We)},!0)}),f(We),o(function(re){W=d("LCP"),Y=m(R,W,me,D.reportAllChanges),g(function(){W.value=performance.now()-re.timeStamp,ye[W.id]=!0,Y(!0)})})}})},onCLS:function(R,D){D=D||{},Se(b(function(){var Y,ee=d("CLS",0),W=0,ke=[],Ye=function(re){re.forEach(function(Ae){if(!Ae.hadRecentInput){var Gt=ke[0],ar=ke[ke.length-1];W&&Ae.startTime-ar.startTime<1e3&&Ae.startTime-Gt.startTime<5e3?(W+=Ae.value,ke.push(Ae)):(W=Ae.value,ke=[Ae])}}),W>ee.value&&(ee.value=W,ee.entries=ke,Y())},We=p("layout-shift",Ye);We&&(Y=m(R,ee,Ge,D.reportAllChanges),f(function(){Ye(We.takeRecords()),Y(!0)}),o(function(){W=0,ee=d("CLS",0),Y=m(R,ee,Ge,D.reportAllChanges),g(function(){return Y()})}),setTimeout(Y,0))}))},onFCP:Se,onINP:function(R,D){e||(e=ut("long-animation-frame",Ue)),x(function(Y){var ee=function(W){var ke=W.entries[0],Ye=de.get(ke),We=ke.processingStart,re=Ye.processingEnd,Ae=Ye.entries.sort(function(cr,$n){return cr.processingStart-$n.processingStart}),Gt=Pt(ke.startTime,re),ar=W.entries.find(function(cr){return cr.target}),Sr=ar&&ar.target||Ie.get(ke.interactionId),Xr=[ke.startTime+ke.duration,re].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:Ae,longAnimationFrameEntries:Gt,inputDelay:We-ke.startTime,processingDuration:re-We,presentationDelay:Math.max(ur-re,0),loadState:qe(ke.startTime)};return Object.assign(W,{attribution:Jr})}(Y);R(ee)},D)}};gt.__PosthogExtensions__=gt.__PosthogExtensions__||{},gt.__PosthogExtensions__.postHogWebVitalsCallbacks=bt,gt.postHogWebVitalsCallbacks=bt})();var C=typeof window<"u"?window:void 0,$t=typeof globalThis<"u"?globalThis:C,pl=Array.prototype,va=pl.forEach,ma=pl.indexOf,Vt=$t==null?void 0:$t.navigator,ie=$t==null?void 0:$t.document,Ht=$t==null?void 0:$t.location,Ss=$t==null?void 0:$t.fetch,Is=$t!=null&&$t.XMLHttpRequest&&"withCredentials"in new $t.XMLHttpRequest?$t.XMLHttpRequest:void 0,_a=$t==null?void 0:$t.AbortController,St=Vt==null?void 0:Vt.userAgent,xe=C??{},Rr={DEBUG:!1,LIB_VERSION:"1.190.2"},fi={},Mi=function(r){return r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function cn(r,e,t){if(lt(r)){if(va&&r.forEach===va)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(lt(r))return cn(r,e,t);if(_c(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 ya=function(r){try{return r()}catch{return}},pc=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 gc(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),lt(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 fc=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(f){if(f=f||r(C==null?void 0:C.event)){var b,y=!0;Jt(g)&&(b=g(f));var k=m.call(p,f);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",vc=["$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 mc=Array.isArray,fl=Object.prototype,vl=fl.hasOwnProperty,Ai=fl.toString,lt=mc||function(r){return Ai.call(r)==="[object Array]"},Jt=r=>typeof r=="function",dt=r=>r===Object(r)&&!lt(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]",ba=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]",_c=r=>r instanceof FormData,yc=r=>Pe(vc,r),wa="[PostHog.js]",O={_log:function(r){if(C&&(Rr.DEBUG||xe.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(wa,...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(wa,...e)},uninitializedWarning:r=>{O.error("You must initialize PostHog before calling ".concat(r))}},Sa=(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(!ie)return t("document not found");var o=ie.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=ie.querySelectorAll("body > script");u.length>0?(a=u[0].parentNode)===null||a===void 0||a.insertBefore(o,u[0]):ie.body.appendChild(o)};ie!=null&&ie.body?i():ie==null||ie.addEventListener("DOMContentLoaded",i)};function Ia(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 B(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(i){J(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ia(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 ml(r,e){if(r==null)return{};var t,i,o=function(u,d){if(u==null)return{};var p,m,g={},f=Object.keys(u);for(m=0;m<f.length;m++)p=f[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}xe.__PosthogExtensions__=xe.__PosthogExtensions__||{},xe.__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);Sa(r,u,t)},xe.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);Sa(r,i,t)};var _l="$people_distinct_id",xn="__alias",Rn="__timers",Ca="$autocapture_disabled_server_side",Es="$heatmaps_enabled_server_side",Ea="$exception_capture_enabled_server_side",ka="$web_vitals_enabled_server_side",yl="$dead_clicks_enabled_server_side",Ta="$web_vitals_allowed_metrics",ks="$session_recording_enabled_server_side",xa="$console_log_recording_enabled_server_side",Ra="$session_recording_network_payload_capture",Ma="$session_recording_canvas_recording",Aa="$replay_sample_rate",Oa="$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",Ns="$initial_person_info",yi="$epp",bl="__POSTHOG_TOOLBAR__",bc=[_l,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))&&(lt(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(lt(m)){var f={};if(m)for(var b=0;b<m.length;b++)f[m[b]]=!0;u&&u.register({[gs]:m,[ln]:f})}else{var y=m,k=g;a.errorsWhileComputingFlags&&(y=B(B({},d),y),k=B(B({},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(lt(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=B(B({},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]:B(B({},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]=B(B({},i[o]),e[o]),delete e[o]}),this.instance.register({[Mr]:B(B({},i),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(Mr)||{};this.instance.register({[Mr]:B(B({},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,wl=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&&(wl=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&&(wl(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]:ie;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("."),f=p+"=1;domain=."+g;a.cookie=f,m.test(a.cookie)&&(a.cookie=f+";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:()=>!!ie,error:function(r){O.error("cookieStore error: "+r)},get:function(r){if(ie){try{for(var e=r+"=",t=ie.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(ie)try{var a="",u="",d=Tc(ie.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),ie.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,Ns],oi=B(B({},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]}},Wr=null,Et={is_supported:function(){if(!Lr(Wr))return Wr;if(Wr=!0,pe(C))Wr=!1;else try{var r="__support__";Et.set(r,"xyz"),Et.get(r)!=='"xyz"'&&(Wr=!1),Et.remove(r)}catch{Wr=!1}return Wr},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=ie==null?void 0:ie.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(!lt(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",Sl=lr+" "+Pn,Il="iPad",Cl="Apple",El=Cl+" Watch",Ln="Safari",fn="BlackBerry",kl="Samsung",Tl=kl+"Browser",xl=kl+" Internet",Fr="Chrome",Oc=Fr+" OS",Rl=Fr+" "+Ii,Js="Internet Explorer",Ml=Js+" "+Kt,Ks="Opera",Nc=Ks+" Mini",Qs="Edge",Al="Microsoft "+Qs,hn="Firefox",Ol=hn+" "+Ii,Dn="Nintendo",Bn="PlayStation",pn="Xbox",Nl=lr+" "+Kt,Fl=Kt+" "+Ln,An="Windows",Fs=An+" Phone",Da="Nokia",Ps="Ouya",Pl="Generic",Fc=Pl+" "+Kt.toLowerCase(),Ll=Pl+" "+Pn.toLowerCase(),Ls="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"),eo=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,Cl)||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/")?Ks:eo.test(r)?fn:Pe(r,"IE"+Kt)||Pe(r,"WPDesktop")?Ml:Pe(r,Tl)?xl:Pe(r,Qs)||Pe(r,"Edg/")?Al:Pe(r,"FBIOS")?"Facebook "+Kt:Pe(r,"UCWEB")||Pe(r,"UCBrowser")?"UC Browser":Pe(r,"CriOS")?Rl:Pe(r,"CrMo")?Fr:Pe(r,lr)&&Pe(r,Ln)?Nl:Pe(r,Fr)?Fr:Pe(r,"FxiOS")?Ol:Pe(r.toLowerCase(),Ls.toLowerCase())?Ls:Hc(r,e)?Pe(r,Kt)?Fl:Ln:Pe(r,hn)?hn:Pe(r,"MSIE")||Pe(r,"Trident/")?Js:Pe(r,"Gecko")?hn:""},$c={[Ml]:[new RegExp("rv:"+Nt)],[Al]:[new RegExp(Qs+"?\\/"+Nt)],[Fr]:[new RegExp("("+Fr+"|CrMo)\\/"+Nt)],[Rl]:[new RegExp("CriOS\\/"+Nt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Nt)],[Ln]:[vs],[Fl]:[vs],[Ks]:[new RegExp("(Opera|OPR)\\/"+Nt)],[hn]:[new RegExp(hn+"\\/"+Nt)],[Ol]:[new RegExp("FxiOS\\/"+Nt)],[Ls]:[new RegExp("Konqueror[:/]?"+Nt,"i")],[fn]:[new RegExp(fn+" "+Nt),vs],[Nl]:[new RegExp("android\\s"+Nt,"i")],[xl]:[new RegExp(Tl+"\\/"+Nt)],[Js]:[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,""]],[eo,[fn,""]],[new RegExp(An,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Fs,""];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",""]]],$a=function(r){return Dc.test(r)?Dn:Lc.test(r)?Bn:Pc.test(r)?pn:new RegExp(Ps,"i").test(r)?Ps:new RegExp("("+Fs+"|WPDesktop)","i").test(r)?Fs:/iPad/.test(r)?Il:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?El:eo.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:Sl:lr:new RegExp("(pda|"+Kt+")","i").test(r)?Fc:new RegExp(Pn,"i").test(r)&&!new RegExp(Pn+" pc","i").test(r)?Ll:""},li="https?://(.*)",Wc=["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"],ct={campaignParams:function(r){return ie?this._campaignParamsFromUrl(ie.URL,r):{}},_campaignParamsFromUrl:function(r,e){var t=Wc.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=ct._searchEngine(r),t=e!="yahoo"?"q":"p",i={};if(!Lr(e)){i.$search_engine=e;var o=ie?wi(ie.referrer,t):"";o.length&&(i.ph_keyword=o)}return i},searchInfo:function(){var r=ie==null?void 0:ie.referrer;return r?this._searchInfoFromReferrer(r):{}},browser:Ba,browserVersion:function(r,e){var t=Ba(r,e),i=$c[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:$a,deviceType:function(r){var e=$a(r);return e===Il||e===Sl||e==="Kobo"||e==="Kindle Fire"||e===Ll?Pn:e===Dn||e===pn||e===Bn||e===Ps?"Console":e===El?"Wearable":e?Kt:"Desktop"},referrer:function(){return(ie==null?void 0:ie.referrer)||"$direct"},referringDomain:function(){var r;return ie!=null&&ie.referrer&&((r=dn(ie.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().substring(0,1e3),u:Ht==null?void 0:Ht.href.substring(0,1e3)}},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]=ct.os(St);return Ft(vi({$os:r,$os_version:e,$browser:ct.browser(St,navigator.vendor),$device:ct.device(St),$device_type:ct.deviceType(St),$timezone:ct.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:ct.browserVersion(St,navigator.vendor),$browser_language:ct.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]=ct.os(St);return Ft(vi({$os:r,$os_version:e,$browser:ct.browser(St,navigator.vendor)}),{$browser_version:ct.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,B({},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:ma&&u.indexOf===ma?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=ct.campaignParams(this.config.custom_campaign_params);an(vi(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(ct.searchInfo())}update_referrer_info(){this.register_once(ct.referrerInfo(),void 0)}set_initial_person_info(){this.props[As]||this.props[Os]||this.register_once({[Ns]:ct.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[Ns];if(t){var i=ct.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 Ds(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[Ds({size:Ci(i),data:i,sessionId:r.sessionId,windowId:r.windowId}),Ds({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 Wa(r){var e;return r.id===bl||!((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 Dl(r){return!!r&&r.nodeType===3}function Bl(r){return!!r&&r.nodeType===11}function to(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 to(e)}function Hl(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 Hs(r)&&!jl(r)&&r.childNodes&&r.childNodes.length&&Xe(r.childNodes,function(t){var i;Dl(t)&&t.textContent&&(e+=(i=Hl(t.textContent))!==null&&i!==void 0?i:"")}),Mi(e)}function $l(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 Bs=["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(Bl(m.parentNode))d.push(m.parentNode.host),m=m.parentNode.host;else{if(!(p=Wl(m)))break;if(i||Bs.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 T=k==null?void 0:k.element_allowlist;if(pe(T))return!0;var G=function(ue){if(T.some(ae=>ue.tagName.toLowerCase()===ae))return{v:!0}};for(var q of y){var $=G(q);if(typeof $=="object")return $.v}return!1}(d,t)||!function(y,k){var T=k==null?void 0:k.css_selector_allowlist;if(pe(T))return!0;var G=function(ue){if(T.some(ae=>ue.matches(ae)))return{v:!0}};for(var q of y){var $=G(q);if(typeof $=="object")return $.v}return!1}(d,t))return!1;var f=C.getComputedStyle(r);if(f&&f.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&&(Bs.indexOf(b)>-1||r.getAttribute("contenteditable")==="true")}}function Hs(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 jl(r){return!!(Pr(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Pr(r,"select")||Pr(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Gl="(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(Gl,")$")),Uc=new RegExp(Gl),ql="\\d{3}-?\\d{2}-?\\d{4}",Vc=new RegExp("^(".concat(ql,")$")),zc=new RegExp("(".concat(ql,")"));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 Ul(r){var e=Ni(r);return vn(e="".concat(e," ").concat(Vl(r)).trim())?e:""}function Vl(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(Vl(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=B(B(B(B({},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,f)=>{var[b]=g,[y]=f;return b.localeCompare(y)}).forEach(g=>{var[f,b]=g;return m[Ga(f.toString())]=Ga(b.toString())}),u+=":",u+=pi(p).map(g=>{var[f,b]=g;return"".concat(f,'="').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?lt(e)?e:to(e):void 0}var $s="[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?$s+" ".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=$s+" "+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=$s+" "+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(((T,G)=>{var q,$=dn(T.name),ue=G.indexOf("http")===0?(q=dn(G))===null||q===void 0?void 0:q.pathname:G;ue==="/"&&(ue="");var ae=$==null?void 0:$.pathname.replace(ue||"","");if(!($&&ae&&Kc.some(Se=>ae.indexOf(Se)===0)))return T})((k=(y=b).requestHeaders,Je(k)||Xe(Object.keys(k??{}),T=>{Xc.includes(T.toLowerCase())&&(k[T]=Ws)}),y),r.api_host));var y,k},f=Jt(r.session_recording.maskNetworkRequestFn);return f&&Jt(r.session_recording.maskCapturedNetworkRequestFn)&&O.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(r.session_recording.maskCapturedNetworkRequestFn=b=>{var y=r.session_recording.maskNetworkRequestFn({url:b.name});return B(B({},b),{},{name:y==null?void 0:y.url})}),a.maskRequestFn=Jt(r.session_recording.maskCapturedNetworkRequestFn)?b=>{var y,k,T,G=g(b);return G&&(y=(k=(T=r.session_recording).maskCapturedNetworkRequestFn)===null||k===void 0?void 0:k.call(T,G))!==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)),B(B(B({},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,f,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=(f=a.texts)===null||f===void 0?void 0:f.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,f,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,(f=(b=this.options).onBlockedNode)===null||f===void 0||f.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,Wt=Uint16Array,mn=Uint32Array,ro=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]),no=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]),zl=function(r,e){for(var t=new Wt(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]},Yl=zl(ro,2),td=Yl[0],js=Yl[1];td[28]=258,js[258]=28;for(var za=zl(no,0)[1],Zl=new Wt(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,Zl[Ke]=((65280&jr)>>>8|(255&jr)<<8)>>>1}var On=function(r,e,t){for(var i=r.length,o=0,a=new Wt(e);o<i;++o)++a[r[o]-1];var u,d=new Wt(e);for(o=0;o<e;++o)d[o]=d[o-1]+a[o-1]<<1;for(u=new Wt(i),o=0;o<i;++o)u[o]=Zl[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),Xl=function(r){return(r/8>>0)+(7&r&&1)},Jl=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Wt?Wt: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(Se,Ge){return Se.f-Ge.f}),t.push({s:-1,f:25001});var d=t[0],p=t[1],m=0,g=1,f=2;for(t[0]={s:-1,f:d.f+p.f,l:d,r:p};g!=o-1;)d=t[t[m].f<t[f].f?m++:f++],p=t[m!=g&&t[m].f<t[f].f?m++:f++],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 Wt(b+1),k=Gs(t[g-1],y,0);if(k>e){i=0;var T=0,G=k-e,q=1<<G;for(a.sort(function(Se,Ge){return y[Ge.s]-y[Se.s]||Se.f-Ge.f});i<o;++i){var $=a[i].s;if(!(y[$]>e))break;T+=q-(1<<k-y[$]),y[$]=e}for(T>>>=G;T>0;){var ue=a[i].s;y[ue]<e?T-=1<<e-y[ue]++-1:++i}for(;i>=0&&T;--i){var ae=a[i].s;y[ae]==e&&(--y[ae],++T)}k=e}return[new Qt(y),k]},Gs=function(r,e,t){return r.s==-1?Math.max(Gs(r.l,e,t+1),Gs(r.r,e,t+1)):e[r.s]=t},Ya=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Wt(++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},qs=function(r,e,t){var i=t.length,o=Xl(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 f=_s(o,15),b=f[0],y=f[1],k=_s(a,15),T=k[0],G=k[1],q=Ya(b),$=q[0],ue=q[1],ae=Ya(T),Se=ae[0],Ge=ae[1],me=new Wt(19),ye=0;ye<$.length;++ye)me[31&$[ye]]++;for(ye=0;ye<Se.length;++ye)me[31&Se[ye]]++;for(var Ne=_s(me,7),qe=Ne[0],Ze=Ne[1],st=19;st>4&&!qe[Va[st-1]];--st);var It,_t,ut,ht,kt=m+5<<3,Tt=kn(o,Zr)+kn(a,ki)+u,pt=kn(o,b)+kn(a,T)+u+14+3*st+kn(me,qe)+(2*me[16]+3*me[17]+7*me[18]);if(kt<=Tt&&kt<=pt)return qs(e,g,r.subarray(p,p+m));if(fr(e,g,1+(pt<Tt)),g+=2,pt<Tt){It=On(b,y),_t=b,ut=On(T,G),ht=T;var yt=On(qe,Ze);for(fr(e,g,ue-257),fr(e,g+5,Ge-1),fr(e,g+10,st-4),g+=14,ye=0;ye<st;++ye)fr(e,g+3*ye,qe[Va[ye]]);g+=3*st;for(var zt=[$,Se],Qe=0;Qe<2;++Qe){var Ve=zt[Qe];for(ye=0;ye<Ve.length;++ye){var ze=31&Ve[ye];fr(e,g,yt[ze]),g+=qe[ze],ze>15&&(fr(e,g,Ve[ye]>>>5&127),g+=Ve[ye]>>>12)}}}else It=rd,_t=Zr,ut=nd,ht=ki;for(ye=0;ye<d;++ye)if(i[ye]>255){ze=i[ye]>>>18&31,En(e,g,It[ze+257]),g+=_t[ze+257],ze>7&&(fr(e,g,i[ye]>>>23&31),g+=ro[ze]);var ot=31&i[ye];En(e,g,ut[ot]),g+=ht[ot],ot>3&&(En(e,g,i[ye]>>>5&8191),g+=no[ot])}else En(e,g,It[i[ye]]),g+=_t[i[ye]];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 f=a.length,b=new Qt(p+f+5*(1+Math.floor(f/7e3))+m),y=b.subarray(p,b.length-m),k=0;if(!u||f<8)for(var T=0;T<=f;T+=65535){var G=T+65535;G<f?k=qs(y,k,a.subarray(T,G)):(y[T]=g,k=qs(y,k,a.subarray(T,f)))}else{for(var q=id[u-1],$=q>>>13,ue=8191&q,ae=(1<<d)-1,Se=new Wt(32768),Ge=new Wt(ae+1),me=Math.ceil(d/3),ye=2*me,Ne=function(Ue){return(a[Ue]^a[Ue+1]<<me^a[Ue+2]<<ye)&ae},qe=new mn(25e3),Ze=new Wt(288),st=new Wt(32),It=0,_t=0,ut=(T=0,0),ht=0,kt=0;T<f;++T){var Tt=Ne(T),pt=32767&T,yt=Ge[Tt];if(Se[pt]=yt,Ge[Tt]=pt,ht<=T){var zt=f-T;if((It>7e3||ut>24576)&&zt>423){k=Za(a,y,0,qe,Ze,st,_t,ut,kt,T-kt,k),ut=It=_t=0,kt=T;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=ue,Rt=pt-yt&32767;if(zt>2&&Tt==Ne(T-Rt))for(var er=Math.min($,zt)-1,Dr=Math.min(32767,T),jt=Math.min(258,zt);Rt<=Dr&&--ot&&pt!=yt;){if(a[T+Ve]==a[T+Ve-Rt]){for(var M=0;M<jt&&a[T+M]==a[T+M-Rt];++M);if(M>Ve){if(Ve=M,ze=Rt,M>er)break;var x=Math.min(Rt,M-2),L=0;for(Qe=0;Qe<x;++Qe){var U=T-Rt+Qe+32768&32767,de=U-Se[U]+32768&32767;de>L&&(L=de,yt=U)}}}Rt+=(pt=yt)-(yt=Se[pt])+32768&32767}if(ze){qe[ut++]=268435456|js[Ve]<<18|za[ze];var Ie=31&js[Ve],Fe=31&za[ze];_t+=ro[Ie]+no[Fe],++Ze[257+Ie],++st[Fe],ht=T+Ve,++It}else qe[ut++]=a[T],++Ze[a[T]]}}k=Za(a,y,g,qe,Ze,st,_t,ut,kt,T-kt,k)}return Jl(b,0,p+Xl(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)},Us=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&&Us(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 Kl(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),Us(o,a-8,t.d()),Us(o,a-4,i),o}function Ql(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 Jl(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}(Kl(Ql(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 xe==null||(e=xe.__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(xa),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(Ma),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,f=(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(f,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,i=this.instance.get_property(Ra),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(Aa);return Ut(e)?e:null}get minimumDuration(){var e=this.instance.get_property(Oa);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(ie!=null&&ie.visibilityState){var o="window "+ie.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,f)=>{var b=dt(f)&&p in f,y=m?f[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,f,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,[xa]:(d=e.sessionRecording)===null||d===void 0?void 0:d.consoleLogRecordingEnabled,[Ra]:B({capturePerformance:e.capturePerformance},(p=e.sessionRecording)===null||p===void 0?void 0:p.networkPayloadCapture),[Ma]:{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:(f=e.sessionRecording)===null||f===void 0?void 0:f.canvasQuality},[Aa]:y,[Oa]: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=xe.__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=B({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(B({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=xe.__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=xe.__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(f){return f.type===mr.Custom&&f.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(f){var b=f;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,f}return f}(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(f){if(Ci(f)<1024)return f;try{if(f.type===mr.FullSnapshot)return B(B({},f),{},{data:Gr(f.data),cv:"2024-10"});if(f.type===mr.IncrementalSnapshot&&f.data.source===sr.Mutation)return B(B({},f),{},{cv:"2024-10",data:B(B({},f.data),{},{texts:Gr(f.data.texts),attributes:Gr(f.data.attributes),removes:Gr(f.data.removes),adds:Gr(f.data.adds)})});if(f.type===mr.IncrementalSnapshot&&f.data.source===sr.StyleSheetRule)return B(B({},f),{},{cv:"2024-10",data:B(B({},f.data),{},{adds:Gr(f.data.adds),removes:Gr(f.data.removes)})})}catch(b){O.error(Ct+" could not compress event - will use uncompressed event",b)}return f}(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&&Ds(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,ie==null||(e=ie.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,ie==null||(e=ie.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){this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var t=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e??{},t),!t)return ie&&ie.body?void this.instance._afterDecideResponse(e):(O.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.parseDecideResponse(e)},500));O.error("Failed to fetch feature flags from PostHog.")}}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){xe.ph_toolbar_state=e}getToolbarState(){var e;return(e=xe.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||!ie)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?ya(()=>JSON.parse(atob(decodeURIComponent(d))))||ya(()=>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){(xe.ph_load_toolbar||xe.ph_load_editor)(e,this.instance)}loadToolbar(e){var t=!(ie==null||!ie.getElementById(bl));if(!C||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,o=B(B({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(C.localStorage.setItem(Qa,JSON.stringify(B(B({},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=xe.__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(B(B({},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&&lt(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]=B(B({},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=B({},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=Kl(Ql(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,f,b,y,k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",T=0,G=0,q="",$=[];if(!p)return p;p=fc(p);do m=(y=p.charCodeAt(T++)<<16|p.charCodeAt(T++)<<8|p.charCodeAt(T++))>>18&63,g=y>>12&63,f=y>>6&63,b=63&y,$[G++]=k.charAt(m)+k.charAt(g)+k.charAt(f)+k.charAt(b);while(T<p.length);switch(q=$.join(""),p.length%3){case 1:q=q.slice(0,-2)+"==";break;case 2:q=q.slice(0,-1)+"="}return q}(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,f){u.append(f,g)}),i&&u.append("Content-Type",i);var d=r.url,p=null;if(_a){var m=new _a;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(f=>{var b,y={statusCode:g.status,text:f};if(g.status===200)try{y.json=JSON.parse(f)}catch(k){O.error(k)}(b=r.callback)===null||b===void 0||b.call(r,y)})).catch(g=>{var f;O.error(g),(f=r.callback)===null||f===void 0||f.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=ml(e,_d);Ut(t)&&t>0&&(i.url=Ti(i.url,{retry_count:t})),this.instance._send_request(B(B({},i),{},{callback:o=>{var a;o.statusCode!==200&&(o.statusCode<400||o.statusCode>=500)&&(t??0)<10?this.enqueue(B({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(B(B({},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=(f=>{var b=f.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(f){O.error("Invalid sessionID in bootstrap",f)}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 lt(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 f=i===0||!e||d?t:i,b=a===0?new Date().getTime():a;return this._setWindowId(u),this._setSessionId(o,f,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 eu="posthog-js";function tu(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 f=r.requestRouter.endpointFor("ui","/project/".concat(r.config.token,"/person/").concat(r.get_distinct_id()));a.tags["PostHog Person URL"]=f,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:f,$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=eu,this.setupOnce=function(u){u(tu(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:f}=o;pe(u)||pe(d)||pe(p)||pe(m)||pe(g)||pe(f)||(u=Math.ceil(u),d=Math.ceil(d),p=Math.ceil(p),m=Math.ceil(m),g=Math.ceil(g),f=Math.ceil(f),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:f,$prev_pageview_max_content_percentage:m<=1?1:br(f/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 ru{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 ru),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,f,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),(f=i.conditions)===null||f===void 0||(b=f.actions)===null||b===void 0||(y=b.values)===null||y===void 0||y.forEach(k=>{if(k&&k.name){var T=this.actionToSurveys.get(k.name);T&&T.push(i.id),this.actionToSurveys.set(k.name,T||[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 nu,it,iu,Vr,nl,su,Vs,ou,zs={},au=[],Ed=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,io=Array.isArray;function Nr(r,e){for(var t in e)r[t]=e[t];return r}function lu(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??++iu,__i:-1,__u:0};return o==null&&it.vnode!=null&&it.vnode(a),a}function so(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 uu(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 uu(r)}}function Ys(r){(!r.__d&&(r.__d=!0)&&Vr.push(r)&&!Ri.__r++||nl!==it.debounceRendering)&&((nl=it.debounceRendering)||su)(Ri)}function Ri(){var r,e,t,i,o,a,u,d,p;for(Vr.sort(Vs);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),hu(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&&uu(i)),Vr.length>e&&Vr.sort(Vs));Ri.__r=0}function cu(r,e,t,i,o,a,u,d,p,m,g){var f,b,y,k,T,G=i&&i.__k||au,q=e.length;for(t.__d=p,kd(t,e,G),p=t.__d,f=0;f<q;f++)(y=t.__k[f])!=null&&typeof y!="boolean"&&typeof y!="function"&&(b=y.__i===-1?zs:G[y.__i]||zs,y.__i=f,hu(r,y,b,o,a,u,d,p,m,g),k=y.__e,y.ref&&b.ref!=y.ref&&(b.ref&&oo(b.ref,null,y),g.push(y.ref,y.__c||k,y)),T==null&&k!=null&&(T=k),65536&y.__u||b.__k===y.__k?p=du(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=T}function kd(r,e,t){var i,o,a,u,d,p=e.length,m=t.length,g=m,f=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):io(o)?bs(so,{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+f,g),o.__i=d,a=null,d!==-1&&(g--,(a=t[d])&&(a.__u|=131072)),a==null||a.__v===null?(d==-1&&f--,typeof o.type!="function"&&(o.__u|=65536)):d!==u&&(d===u+1?f++:d>u?g>p-u?f+=d-u:f--:f=d<u&&d==u-1?d-u:0,d!==i+f&&(o.__u|=65536))):(a=t[i])&&a.key==null&&a.__e&&(a.__e==r.__d&&(r.__d=_n(a)),Zs(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)),Zs(a,a))}function du(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=du(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 hu(r,e,t,i,o,a,u,d,p,m){var g,f,b,y,k,T,G,q,$,ue,ae,Se,Ge,me,ye,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(q=e.props,$=(g=Ne.contextType)&&i[g.__c],ue=g?$?$.props.value:g.__:i,t.__c?G=(f=e.__c=t.__c).__=f.__E:("prototype"in Ne&&Ne.prototype.render?e.__c=f=new Ne(q,ue):(e.__c=f=new gi(q,ue),f.constructor=Ne,f.render=Md),$&&$.sub(f),f.props=q,f.state||(f.state={}),f.context=ue,f.__n=i,b=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),Ne.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Nr({},f.__s)),Nr(f.__s,Ne.getDerivedStateFromProps(q,f.__s))),y=f.props,k=f.state,f.__v=e,b)Ne.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(Ne.getDerivedStateFromProps==null&&q!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(q,ue),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(q,f.__s,ue)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(f.props=q,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(qe){qe&&(qe.__=e)}),ae=0;ae<f._sb.length;ae++)f.__h.push(f._sb[ae]);f._sb=[],f.__h.length&&u.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(q,f.__s,ue),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,k,T)})}if(f.context=ue,f.props=q,f.__P=r,f.__e=!1,Se=it.__r,Ge=0,"prototype"in Ne&&Ne.prototype.render){for(f.state=f.__s,f.__d=!1,Se&&Se(e),g=f.render(f.props,f.state,f.context),me=0;me<f._sb.length;me++)f.__h.push(f._sb[me]);f._sb=[]}else do f.__d=!1,Se&&Se(e),g=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++Ge<25);f.state=f.__s,f.getChildContext!=null&&(i=Nr(Nr({},i),f.getChildContext())),b||f.getSnapshotBeforeUpdate==null||(T=f.getSnapshotBeforeUpdate(y,k)),cu(r,io(ye=g!=null&&g.type===so&&g.key==null?g.props.children:g)?ye:[ye],e,t,i,o,a,u,d,p,m),f.base=e.__e,e.__u&=-161,f.__h.length&&u.push(f),G&&(f.__E=f.__=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++)oo(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,f,b,y,k,T,G=t.props,q=e.props,$=e.type;if($==="svg"&&(o=!0),a!=null){for(m=0;m<a.length;m++)if((y=a[m])&&"setAttribute"in y==!!$&&($?y.localName===$:y.nodeType===3)){r=y,a[m]=null;break}}if(r==null){if($===null)return document.createTextNode(q);r=o?document.createElementNS("http://www.w3.org/2000/svg",$):document.createElement($,q.is&&q),a=null,d=!1}if($===null)G===q||d&&r.data===q||(r.data=q);else{if(a=a&&nu.call(r.childNodes),G=t.props||zs,!d&&a!=null)for(G={},m=0;m<r.attributes.length;m++)G[(y=r.attributes[m]).name]=y.value;for(m in G)y=G[m],m=="children"||(m=="dangerouslySetInnerHTML"?f=y:m==="key"||m in q||ci(r,m,null,y,o));for(m in q)y=q[m],m=="children"?b=y:m=="dangerouslySetInnerHTML"?g=y:m=="value"?k=y:m=="checked"?T=y:m==="key"||d&&typeof y!="function"||G[m]===y||ci(r,m,y,G[m],o);if(g)d||f&&(g.__html===f.__html||g.__html===r.innerHTML)||(r.innerHTML=g.__html),e.__k=[];else if(f&&(r.innerHTML=""),cu(r,io(b)?b:[b],e,t,i,o&&$!=="foreignObject",a,u,a?a[0]:t.__k&&_n(t,0),d,p),a!=null)for(m=a.length;m--;)a[m]!=null&&lu(a[m]);d||(m="value",k!==void 0&&(k!==r[m]||$==="progress"&&!k||$==="option"&&k!==G[m])&&ci(r,m,k,G[m],!1),m="checked",T!==void 0&&T!==r[m]&&ci(r,m,T,G[m],!1))}return r}function oo(r,e,t){try{typeof r=="function"?r(e):r.current=e}catch(i){it.__e(i,t)}}function Zs(r,e,t){var i,o;if(it.unmount&&it.unmount(r),(i=r.ref)&&(i.current&&i.current!==r.__e||oo(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]&&Zs(i[o],e,t||typeof r.type!="function");t||r.__e==null||lu(r.__e),r.__=r.__e=r.__d=void 0}function Md(r,e,t){return this.constructor(r,t)}nu=au.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}},iu=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),Ys(this))},gi.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),Ys(this))},gi.prototype.render=so,Vr=[],su=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vs=function(r,e){return r.__v.__b-e.__v.__b},Ri.__r=0,ou=0;(function(r,e){var t={__c:e="__cC"+ou++,__: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,Ys(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=xe==null||(e=xe.__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=xe.__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=xe.__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,f,b,y,k,T,G,q,$,ue,ae,Se;return((g=m.conditions)===null||g===void 0?void 0:g.events)&&((f=m.conditions)===null||f===void 0||(b=f.events)===null||b===void 0?void 0:b.values)&&((y=m.conditions)===null||y===void 0||(k=y.events)===null||k===void 0||(T=k.values)===null||T===void 0?void 0:T.length)>0||((G=m.conditions)===null||G===void 0?void 0:G.actions)&&((q=m.conditions)===null||q===void 0||($=q.actions)===null||$===void 0?void 0:$.values)&&((ue=m.conditions)===null||ue===void 0||(ae=ue.actions)===null||ae===void 0||(Se=ae.values)===null||Se===void 0?void 0:Se.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,f,b;if(!p.conditions)return!0;var y=(m=p.conditions)===null||m===void 0||!m.url||Ad[(g=(f=p.conditions)===null||f===void 0?void 0:f.urlMatchType)!==null&&g!==void 0?g:"icontains"](p.conditions.url),k=(b=p.conditions)===null||b===void 0||!b.selector||(ie==null?void 0:ie.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,f,b,y,k,T,G,q,$,ue;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 ae=!p.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(p.linked_flag_key),Se=!p.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(p.targeting_flag_key),Ge=((g=p.conditions)===null||g===void 0?void 0:g.events)&&((f=p.conditions)===null||f===void 0||(b=f.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,me=((T=p.conditions)===null||T===void 0?void 0:T.actions)&&((G=p.conditions)===null||G===void 0||(q=G.actions)===null||q===void 0?void 0:q.values)&&(($=p.conditions)===null||$===void 0||(ue=$.actions)===null||ue===void 0?void 0:ue.values.length)>0,ye=!Ge&&!me||(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 ae&&Se&&qe&&ye&&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 f,b;if(typeof i!="number"||!Number.isInteger(i))throw new Error("The response type must be an integer");var y=function(T,G){if(G===3){if(T<1||T>3)throw new Error("The response must be in range 1-3");return T===1?"negative":T===2?"neutral":"positive"}if(G===5){if(T<1||T>5)throw new Error("The response must be in range 1-5");return T<=2?"negative":T===3?"neutral":"positive"}if(G===7){if(T<1||T>7)throw new Error("The response must be in range 1-7");return T<=3?"negative":T===4?"neutral":"positive"}if(G===10){if(T<0||T>10)throw new Error("The response must be in range 0-10");return T<=6?"detractors":T<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(i,a.scale);if((f=a.branching)!==null&&f!==void 0&&(b=f.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=xe.__PosthogExtensions__)===null||t===void 0?void 0:t.canActivateRepeatedly)?(O.warn(Tn,"canActivateRepeatedly is not defined, must init before calling"),!1):xe.__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,ie==null?void 0:ie.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=()=>B({initialPathName:(Ht==null?void 0:Ht.pathname)||"",referringDomain:ct.referringDomain()},ct.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})},pu=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 gu{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(yl)),i=r.instance.config.capture_dead_clicks;return zr(i)?i:t};class fu{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({[yl]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(e){var t,i,o;(t=xe.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture&&e(),(i=xe.__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(ie){if(!this._lazyLoadedDeadClicksAutocapture&&(e=xe.__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=xe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ie),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 gu),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&&ie&&(yr(ie,"click",e=>this._onClick(e||(C==null?void 0:C.event)),!1,!0),yr(ie,"mousemove",e=>this._onMouseMove(e||(C==null?void 0:C.event)),!1,!0),this.deadClicksCapture=new fu(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}($l(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(!Wa(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(B(B({},o),{},{type:"rageclick"})),this._capture(o)}}_onMouseMove(e){Wa(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 $d{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=lt(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 Wd(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};Bs.indexOf(o)>-1&&!t&&(o.toLowerCase()==="a"||o.toLowerCase()==="button"?a.$el_text=ws(1024,Ul(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 f;if((!jl(r)||["name","id","class","aria-label"].indexOf(g.name)!==-1)&&(i==null||!i.includes(g.name))&&!e&&vn(g.value)&&(f=g.name,!xt(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var b=g.value;g.name==="class"&&(b=to(b).join(" ")),a["attr__"+g.name]=ws(1024,b)}});for(var d=1,p=1,m=r;m=Wd(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");)Bl(g.parentNode)?(m.push(g.parentNode.host),g=g.parentNode.host):(m.push(g.parentNode),g=g.parentNode);var f,b=[],y={},k=!1,T=!1;if(Xe(m,ae=>{var Se=Hs(ae);ae.tagName.toLowerCase()==="a"&&(k=ae.getAttribute("href"),k=Se&&k&&vn(k)&&k),Pe(Ei(ae),"ph-no-capture")&&(T=!0),b.push(jd(ae,a,u,d));var Ge=function(me){if(!Hs(me))return{};var ye={};return Xe(me.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)&&(ye[qe]=Ze)}}),ye}(ae);Ft(y,Ge)}),T)return{props:{},explicitNoCapture:T};if(u||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?b[0].$el_text=Ul(r):b[0].$el_text=Ni(r)),k){var G,q;b[0].attr__href=k;var $=(G=dn(k))===null||G===void 0?void 0:G.host,ue=C==null||(q=C.location)===null||q===void 0?void 0:q.host;$&&ue&&$!==ue&&(f=k)}return{props:Ft({$event_type:o.type,$ce_version:1},p?{}:{$elements:b},{$elements_chain:Yc(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}:{},f&&o.type==="click"?{$external_click_url:f}:{},y)}}class qd{constructor(e){J(this,"_initialized",!1),J(this,"_isDisabledServerSide",null),J(this,"rageclicks",new gu),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&&ie){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(ie,"submit",e,!1,!0),yr(ie,"change",e,!1,!0),yr(ie,"click",e,!1,!0),this.config.capture_copied_text&&(yr(ie,"copy",t,!1,!0),yr(ie,"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({[Ca]:!!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=ie==null?void 0:ie.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[Ca],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=$l(e);Dl(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=Hl(C==null||(m=C.getSelection())===null||m===void 0?void 0:m.toString()),f=e.type||"clipboard";if(!g)return!1;u.$selected_content=g,u.$copy_type=f}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return Jt(ie==null?void 0:ie.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=xe.__PosthogExtensions__)===null||t===void 0||(i=t.tracingHeadersPatchFns)===null||i===void 0||i._patchXHR(this.instance.sessionManager)),pe(this._restoreFetchPatch)&&((o=xe.__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=xe.__PosthogExtensions__)!==null&&t!==void 0&&t.tracingHeadersPatchFns&&e(),(i=xe.__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,xe.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=xe.__PosthogExtensions__)===null||i===void 0||(o=i.errorWrappingFunctions)===null||o===void 0?void 0:o.wrapOnError,p=(a=xe.__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[Ea]),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=xe.__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({[Ea]: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)=>B(B({},i),{},{["$web_vitals_".concat(o.name,"_event")]:B({},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(B(B({},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=xe.__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[ka]),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[Ta])||["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({[ka]:t}),this.instance.persistence.register({[Ta]:i})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,i,o;(t=xe.__PosthogExtensions__)!==null&&t!==void 0&&t.postHogWebVitalsCallbacks&&e(),(i=xe.__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=ct.campaignParams();if(i.utm_source){var o,a,u,d,p,m,g,f,b,y,k,T,G,q,$,ue,ae=(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,Se=(p=e.conditions)===null||p===void 0||(m=p.utm)===null||m===void 0||!m.utm_source||((g=e.conditions)===null||g===void 0||(f=g.utm)===null||f===void 0?void 0:f.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||(T=k.utm)===null||T===void 0?void 0:T.utm_medium)==i.utm_medium,me=(G=e.conditions)===null||G===void 0||(q=G.utm)===null||q===void 0||!q.utm_term||(($=e.conditions)===null||$===void 0||(ue=$.utm)===null||ue===void 0?void 0:ue.utm_term)==i.utm_term;return ae&&Ge&&me&&Se}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(f=>{var b=f;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?pu(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 Jd=["$set_once","$set"];class Kd{constructor(e){this.instance=e,this.enabled=!!this.instance.config.opt_in_site_apps&&!this.instance.config.advanced_disable_decide,this.missedInvocations=[],this.loaded=!1,this.appsLoading=new Set}eventCollector(e,t){if(this.enabled&&!this.loaded&&t){var i=this.globalsForEvent(t);this.missedInvocations.push(i),this.missedInvocations.length>1e3&&(this.missedInvocations=this.missedInvocations.slice(10))}}init(){var e;(e=this.instance)===null||e===void 0||e._addCaptureHook(this.eventCollector.bind(this))}globalsForEvent(e){var t,i,o,a,u,d,p;if(!e)throw new Error("Event payload is required");var m={},g=this.instance.get_property("$groups")||[],f=this.instance.get_property("$stored_group_properties")||{};for(var[b,y]of Object.entries(f))m[b]={id:g[b],type:b,properties:y};var{$set_once:k,$set:T}=e;return{event:B(B({},ml(e,Jd)),{},{properties:B(B(B({},e.properties),T?{$set:B(B({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),T)}:{}),k?{$set_once:B(B({},(o=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&o!==void 0?o:{}),k)}:{}),elements_chain:(u=(d=e.properties)===null||d===void 0?void 0:d.$elements_chain)!==null&&u!==void 0?u:"",distinct_id:(p=e.properties)===null||p===void 0?void 0:p.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:m}}afterDecideResponse(e){var t=this;lt(e==null?void 0:e.siteApps)&&e.siteApps.length>0?this.enabled&&this.instance.config.opt_in_site_apps?function(){var i=()=>{t.appsLoading.size===0&&(t.loaded=!0,t.missedInvocations=[])},o=function(d,p){var m,g;t.appsLoading.add(d),xe["__$$ph_site_app_".concat(d,"_posthog")]=t.instance,xe["__$$ph_site_app_".concat(d,"_missed_invocations")]=()=>t.missedInvocations,xe["__$$ph_site_app_".concat(d,"_callback")]=()=>{t.appsLoading.delete(d),i()},(m=xe.__PosthogExtensions__)===null||m===void 0||(g=m.loadSiteApp)===null||g===void 0||g.call(m,t.instance,p,f=>{if(f)return t.appsLoading.delete(d),i(),O.error("Error while initializing PostHog app with config id ".concat(d),f)})};for(var{id:a,url:u}of e.siteApps)o(a,u)}():e.siteApps.length>0?(O.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.'),this.loaded=!0):this.loaded=!0:(this.loaded=!0,this.enabled=!1)}}var Fn={},Xs=()=>{},on="posthog",vu=!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=ie==null?void 0:ie.location,t=e==null?void 0:e.hostname,!!xt(t)&&t.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:Xs,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:Xs,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 lt(r.property_blacklist)&&(pe(r.property_denylist)?t.property_denylist=r.property_blacklist:lt(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 Qd{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 Qd),J(this,"version",Rr.LIB_VERSION),J(this,"_internalEventEmitter",new ru),this.config=ul(),this.decideEndpointWasHit=!1,this.SentryIntegration=Sd,this.sentryIntegration=e=>function(t,i){var o=tu(t,i);return{name:eu,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 $d(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,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=arguments.length>2?arguments[2]:void 0;if(pe(e)||ba(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=[],a.person_profiles&&(this._initialPersonProfilesConfig=a.person_profiles),this.set_config(Ft({},ul(),cl(a),{name:u,token:e})),this.config.on_xhr_error&&O.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=a.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(B(B({},this.config),{},{persistence:"sessionStorage"}));var d=B({},this.persistence.props),p=B({},this.sessionPersistence.props);if(this._requestQueue=new vd($=>this._send_retriable_request($)),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.siteApps=new Kd(this),(t=this.siteApps)===null||t===void 0||t.init(),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 fu(this,Bd),this.deadClicksAutocapture.startIfEnabled(),Rr.DEBUG=Rr.DEBUG||this.config.debug,Rr.DEBUG&&O.info("Starting in debug mode",{this:this,config:a,thisC:B({},this.config),p:d,s:p}),this._sync_opt_out_with_persistence(),((i=a.bootstrap)===null||i===void 0?void 0:i.distinctID)!==void 0){var m,g,f=this.config.get_device_id(Or()),b=(m=a.bootstrap)!==null&&m!==void 0&&m.isIdentifiedID?f:a.bootstrap.distinctID;this.persistence.set_property(vr,(g=a.bootstrap)!==null&&g!==void 0&&g.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:a.bootstrap.distinctID,$device_id:b})}if(this._hasBootstrappedFeatureFlags()){var y,k,T=Object.keys(((y=a.bootstrap)===null||y===void 0?void 0:y.featureFlags)||{}).filter($=>{var ue,ae;return!((ue=a.bootstrap)===null||ue===void 0||(ae=ue.featureFlags)===null||ae===void 0||!ae[$])}).reduce(($,ue)=>{var ae,Se;return $[ue]=((ae=a.bootstrap)===null||ae===void 0||(Se=ae.featureFlags)===null||Se===void 0?void 0:Se[ue])||!1,$},{}),G=Object.keys(((k=a.bootstrap)===null||k===void 0?void 0:k.featureFlagPayloads)||{}).filter($=>T[$]).reduce(($,ue)=>{var ae,Se,Ge,me;return(ae=a.bootstrap)!==null&&ae!==void 0&&(Se=ae.featureFlagPayloads)!==null&&Se!==void 0&&Se[ue]&&($[ue]=(Ge=a.bootstrap)===null||Ge===void 0||(me=Ge.featureFlagPayloads)===null||me===void 0?void 0:me[ue]),$},{});this.featureFlags.receivedFeatureFlags({featureFlags:T,featureFlagPayloads:G})}if(!this.get_distinct_id()){var q=this.config.get_device_id(Or());this.register_once({distinct_id:q,$device_id:q},""),this.persistence.set_property(vr,"anonymous")}return C==null||(o=C.addEventListener)===null||o===void 0||o.call(C,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),a.segment?Id(this,()=>this._loaded()):this._loaded(),Jt(this.config._onCapture)&&this.config._onCapture!==Xs&&(O.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",$=>this.config._onCapture($.event,$))),this}_afterDecideResponse(e){var t,i,o,a,u,d,p,m,g,f;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.siteApps)===null||i===void 0||i.afterDecideResponse(e),(o=this.sessionRecording)===null||o===void 0||o.afterDecideResponse(e),(a=this.autocapture)===null||a===void 0||a.afterDecideResponse(e),(u=this.heatmaps)===null||u===void 0||u.afterDecideResponse(e),(d=this.experiments)===null||d===void 0||d.afterDecideResponse(e),(p=this.surveys)===null||p===void 0||p.afterDecideResponse(e),(m=this.webVitalsAutocapture)===null||m===void 0||m.afterDecideResponse(e),(g=this.exceptionObserver)===null||g===void 0||g.afterDecideResponse(e),(f=this.deadClicksAutocapture)===null||f===void 0||f.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&&(vu?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=B({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(t=>{var i,o,a,u=B({},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)})(B(B({},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],lt(t)?a.push(d):Jt(d)?d.call(this):lt(d)&&t==="alias"?i.push(d):lt(d)&&t.indexOf("capture")!==-1&&Jt(this[t])?a.push(d):o.push(d))});var u=function(d,p){cn(d,function(m){if(lt(m[0])){var g=p;Xe(m,function(f){g=g[f[0]].apply(g,f.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=gc(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=B(B({},p.properties.$set),p.$set);if(an(g)||this.setPersonPropertiesForFlags(g),!Je(this.config.before_send)){var f=this._runBeforeSend(p);if(!f)return;p=f}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=B({},t);if(a.token=this.config.token,e==="$snapshot"){var u=B(B({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!xt(a.distinct_id)&&!Ut(a.distinct_id)||ba(a.distinct_id))&&O.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var d=ct.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 f={};e==="$pageview"?f=this.pageViewManager.doPageView(i):e==="$pageleave"&&(f=this.pageViewManager.doPageLeave(i)),a=Ft(a,f)}if(e==="$pageview"&&ie&&(a.title=ie.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(),lt(this.config.property_denylist)?Xe(this.config.property_denylist,function(T){delete a[T]}):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:B(B({},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(_l)?(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=B({},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(B(B({},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:B({},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=xe.__PosthogExtensions__)===null||i===void 0?void 0:i.parseErrorAsProperties)?xe.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:o}):B({$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?pu(Vt,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ie&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:ie.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=lt(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 yc(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]]=pc(r.prototype[e[t]])})(Fi,["identify"]);var dl,xr=(dl=Fn[on]=new Fi,function(){function r(){r.done||(r.done=!0,vu=!1,Xe(Fn,function(e){e._dom_loaded()}))}ie!=null&&ie.addEventListener&&(ie.readyState==="complete"?r():ie.addEventListener("DOMContentLoaded",r,!1)),C&&yr(C,"load",r,!0)}(),dl);const eh={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")}},th={install:r=>{r.provide("telemetryClient",eh)}};export{eh as T,th as V};