(function(n){function e(i,s){var l=Object.keys(i);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(i);s&&(c=c.filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable})),l.push.apply(l,c)}return l}function t(i){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(i,c,l[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):e(Object(l)).forEach(function(c){Object.defineProperty(i,c,Object.getOwnPropertyDescriptor(l,c))})}return i}function r(i,s,l,c,d,v,_){try{var w=i[v](_),S=w.value}catch(I){return void l(I)}w.done?s(S):Promise.resolve(S).then(c,d)}function o(i){return function(){var s=this,l=arguments;return new Promise(function(c,d){var v=i.apply(s,l);function _(S){r(v,c,d,_,w,"next",S)}function w(S){r(v,c,d,_,w,"throw",S)}_(void 0)})}}function a(i,s,l){return s in i?Object.defineProperty(i,s,{value:l,enumerable:!0,configurable:!0,writable:!0}):i[s]=l,i}function u(i,s){if(i==null)return{};var l,c,d=function(_,w){if(_==null)return{};var S,I,E={},O=Object.keys(_);for(I=0;I<O.length;I++)S=O[I],w.indexOf(S)>=0||(E[S]=_[S]);return E}(i,s);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(i);for(c=0;c<v.length;c++)l=v[c],s.indexOf(l)>=0||Object.prototype.propertyIsEnumerable.call(i,l)&&(d[l]=i[l])}return d}var h,p=["type"],m=Object.defineProperty,g=(i,s,l)=>((c,d,v)=>d in c?m(c,d,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[d]=v)(i,typeof s!="symbol"?s+"":s,l),f=Object.defineProperty,b=(i,s,l)=>((c,d,v)=>d in c?f(c,d,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[d]=v)(i,typeof s!="symbol"?s+"":s,l),y=(i=>(i[i.Document=0]="Document",i[i.DocumentType=1]="DocumentType",i[i.Element=2]="Element",i[i.Text=3]="Text",i[i.CDATA=4]="CDATA",i[i.Comment=5]="Comment",i))(y||{}),k={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},T={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},j=()=>{try{return!!globalThis.Zone}catch{return!1}},$={};function G(i){if($[i])return $[i];var s=globalThis[i],l=s.prototype,c=i in k?k[i]:void 0,d=!!(c&&c.every(E=>{var O,X;return!!((X=(O=Object.getOwnPropertyDescriptor(l,E))==null?void 0:O.get)!=null&&X.toString().includes("[native code]"))})),v=i in T?T[i]:void 0,_=!!(v&&v.every(E=>{var O;return typeof l[E]=="function"&&((O=l[E])==null?void 0:O.toString().includes("[native code]"))}));if(d&&_&&!j())return $[i]=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[i].prototype;return document.body.removeChild(w),I?$[i]=I:s.prototype}catch{return s.prototype}}var ce={};function se(i,s,l){var c,d="".concat(i,".").concat(String(l));if(ce[d])return ce[d].call(s);var v=G(i),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(ce[d]=_,_.call(s)):s[l]}var Ee={};function qe(i,s,l){var c="".concat(i,".").concat(String(l));if(Ee[c])return Ee[c].bind(s);var d=G(i)[l];return typeof d!="function"?s[l]:(Ee[c]=d,d.bind(s))}var ye={childNodes:function(i){return se("Node",i,"childNodes")},parentNode:function(i){return se("Node",i,"parentNode")},parentElement:function(i){return se("Node",i,"parentElement")},textContent:function(i){return se("Node",i,"textContent")},contains:function(i,s){return qe("Node",i,"contains")(s)},getRootNode:function(i){return qe("Node",i,"getRootNode")()},host:function(i){return i&&"host"in i?se("ShadowRoot",i,"host"):null},styleSheets:function(i){return i.styleSheets},shadowRoot:function(i){return i&&"shadowRoot"in i?se("Element",i,"shadowRoot"):null},querySelector:function(i,s){return se("Element",i,"querySelector")(s)},querySelectorAll:function(i,s){return se("Element",i,"querySelectorAll")(s)},mutationObserver:function(){return G("MutationObserver").constructor}};function Se(i){return i.nodeType===i.ELEMENT_NODE}function Le(i){var s=i&&"host"in i&&"mode"in i&&ye.host(i)||null;return!!(s&&"shadowRoot"in s&&ye.shadowRoot(s)===i)}function je(i){return Object.prototype.toString.call(i)==="[object ShadowRoot]"}function Ye(i){try{var s=i.rules||i.cssRules;if(!s)return null;var l=Array.from(s,d=>nt(d,i.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 nt(i,s){if(function(v){return"styleSheet"in v}(i)){var l;try{l=Ye(i.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(" ")+";"}(i)}catch{l=i.cssText}return i.styleSheet.href?ze(l,i.styleSheet.href):l}var c,d=i.cssText;return function(v){return"selectorText"in v}(i)&&i.selectorText.includes(":")&&(c=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,d=d.replace(c,"$1\\$2")),s?ze(d,s):d}function dt(i,s){return Array.from(i.styleSheets).find(l=>l.href===s)}let bt=class{constructor(){b(this,"idNodeMap",new Map),b(this,"nodeMetaMap",new WeakMap)}getId(i){var s;if(!i)return-1;var l=(s=this.getMeta(i))==null?void 0:s.id;return l??-1}getNode(i){return this.idNodeMap.get(i)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(i){return this.nodeMetaMap.get(i)||null}removeNodeFromMap(i){var s=this.getId(i);this.idNodeMap.delete(s),i.childNodes&&i.childNodes.forEach(l=>this.removeNodeFromMap(l))}has(i){return this.idNodeMap.has(i)}hasNode(i){return this.nodeMetaMap.has(i)}add(i,s){var l=s.id;this.idNodeMap.set(l,i),this.nodeMetaMap.set(i,s)}replace(i,s){var l=this.getNode(i);if(l){var c=this.nodeMetaMap.get(l);c&&this.nodeMetaMap.set(s,c)}this.idNodeMap.set(i,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function mt(i){var{element:s,maskInputOptions:l,tagName:c,type:d,value:v,maskInputFn:_}=i,w=v||"",S=d&&Ze(d);return(l[c.toLowerCase()]||S&&l[S])&&(w=_?_(w,s):"*".repeat(w.length)),w}function Ze(i){return i.toLowerCase()}var ht="__rrweb_original__";function Tt(i){var s=i.type;return i.hasAttribute("data-rr-is-password")?"password":s?Ze(s):null}function wt(i,s){var l,c;try{c=new URL(i,s??window.location.href)}catch{return null}var d=c.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(l=d==null?void 0:d[1])!==null&&l!==void 0?l:null}var xt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zt=/^(?:[a-z+]+:)?\/\//i,tt=/^www\..*/i,pt=/^(data:)([^,]*),(.*)/i;function ze(i,s){return(i||"").replace(xt,(l,c,d,v,_,w)=>{var S,I=d||_||w,E=c||v||"";if(!I)return l;if(zt.test(I)||tt.test(I)||pt.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 O=s.split("/"),X=I.split("/");for(var B of(O.pop(),X))B!=="."&&(B===".."?O.pop():O.push(B));return"url(".concat(E).concat(O.join("/")).concat(E,")")})}var Je,St,Mt=1,cr=new RegExp("[^a-z0-9-_:]"),Yt=-2;function It(){return Mt++}var F=/^[^ \t\n\r\u000c]+/,x=/^[, \t\n\r\u000c]+/,L=new WeakMap;function H(i,s){return s&&s.trim()!==""?he(i,s):s}function ee(i){return!!(i.tagName==="svg"||i.ownerSVGElement)}function he(i,s){var l=L.get(i);if(l||(l=i.createElement("a"),L.set(i,l)),s){if(s.startsWith("blob:")||s.startsWith("data:"))return s}else s="";return l.setAttribute("href",s),l.href}function Re(i,s,l,c){return c&&(l==="src"||l==="href"&&(s!=="use"||c[0]!=="#")||l==="xlink:href"&&c[0]!=="#"?H(i,c):l!=="background"||s!=="table"&&s!=="td"&&s!=="th"?l==="srcset"?function(d,v){if(v.trim()==="")return v;var _=0;function w(B){var ie,ge=B.exec(v.substring(_));return ge?(ie=ge[0],_+=ie.length,ie):""}for(var S=[];w(x),!(_>=v.length);){var I=w(F);if(I.slice(-1)===",")I=H(d,I.substring(0,I.length-1)),S.push(I);else{var E="";I=H(d,I);for(var O=!1;;){var X=v.charAt(_);if(X===""){S.push((I+E).trim());break}if(O)X===")"&&(O=!1);else{if(X===","){_+=1,S.push((I+E).trim());break}X==="("&&(O=!0)}E+=X,_+=1}}}return S.join(", ")}(i,c):l==="style"?ze(c,he(i)):s==="object"&&l==="data"?H(i,c):c:H(i,c))}function Xe(i,s,l){return(i==="video"||i==="audio")&&s==="autoplay"}function Pe(i,s,l){if(!i)return!1;if(i.nodeType!==i.ELEMENT_NODE)return!!l&&Pe(ye.parentNode(i),s,l);for(var c=i.classList.length;c--;){var d=i.classList[c];if(s.test(d))return!0}return!!l&&Pe(ye.parentNode(i),s,l)}function R(i,s,l,c){var d;if(Se(i)){if(d=i,!ye.childNodes(d).length)return!1}else{if(ye.parentElement(i)===null)return!1;d=ye.parentElement(i)}try{if(typeof s=="string"){if(c){if(d.closest(".".concat(s)))return!0}else if(d.classList.contains(s))return!0}else if(Pe(d,s,c))return!0;if(l){if(c){if(d.closest(l))return!0}else if(d.matches(l))return!0}}catch{}return!1}function z(i,s){var{doc:l,mirror:c,blockClass:d,blockSelector:v,needsMask:_,inlineStylesheet:w,maskInputOptions:S={},maskTextFn:I,maskInputFn:E,dataURLOptions:O={},inlineImages:X,recordCanvas:B,keepIframeSrcFn:ie,newlyAddedElement:ge=!1}=s,oe=function(N,A){if(A.hasNode(N)){var M=A.getId(N);return M===1?void 0:M}}(l,c);switch(i.nodeType){case i.DOCUMENT_NODE:return i.compatMode!=="CSS1Compat"?{type:y.Document,childNodes:[],compatMode:i.compatMode}:{type:y.Document,childNodes:[]};case i.DOCUMENT_TYPE_NODE:return{type:y.DocumentType,name:i.name,publicId:i.publicId,systemId:i.systemId,rootId:oe};case i.ELEMENT_NODE:return function(N,A){for(var M,{doc:q,blockClass:J,blockSelector:K,inlineStylesheet:Q,maskInputOptions:re={},maskInputFn:pe,dataURLOptions:ve={},inlineImages:ke,recordCanvas:Z,keepIframeSrcFn:Te,newlyAddedElement:be=!1,rootId:we}=A,_e=function(Fe,Ht,nr){try{if(typeof Ht=="string"){if(Fe.classList.contains(Ht))return!0}else for(var ir=Fe.classList.length;ir--;){var gr=Fe.classList[ir];if(Ht.test(gr))return!0}if(nr)return Fe.matches(nr)}catch{}return!1}(N,J,K),le=function(Fe){if(Fe instanceof HTMLFormElement)return"form";var Ht=Ze(Fe.tagName);return cr.test(Ht)?"div":Ht}(N),te={},He=N.attributes.length,$e=0;$e<He;$e++){var Oe=N.attributes[$e];Xe(le,Oe.name,Oe.value)||(te[Oe.name]=Re(q,le,Ze(Oe.name),Oe.value))}if(le==="link"&&Q){var V=N.href,xe=dt(q,V);!xe&&V.includes(".css")&&(xe=dt(q,window.location.origin+"/"+V.replace(window.location.href,"")));var Ot=null;xe&&(Ot=Ye(xe)),Ot&&(delete te.rel,delete te.href,te._cssText=Ot)}if(le==="style"&&N.sheet&&!(N.innerText||ye.textContent(N)||"").trim().length){var gt=Ye(N.sheet);gt&&(te._cssText=gt)}if(le==="input"||le==="textarea"||le==="select"){var it=N.value,ft=N.checked;te.type!=="radio"&&te.type!=="checkbox"&&te.type!=="submit"&&te.type!=="button"&&it?te.value=mt({element:N,type:Tt(N),tagName:le,value:it,maskInputOptions:re,maskInputFn:pe}):ft&&(te.checked=ft)}if(le==="option"&&(N.selected&&!re.select?te.selected=!0:delete te.selected),le==="dialog"&&N.open)try{te.rr_open_mode=N.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(N.__context==="2d")(function(Fe){var Ht=Fe.getContext("2d");if(!Ht)return!0;for(var nr=0;nr<Fe.width;nr+=50)for(var ir=0;ir<Fe.height;ir+=50){var gr=Ht.getImageData,ii=ht in gr?gr[ht]:gr;if(new Uint32Array(ii.call(Ht,nr,ir,Math.min(50,Fe.width-nr),Math.min(50,Fe.height-ir)).data.buffer).some(po=>po!==0))return!1}return!0})(N)||(te.rr_dataURL=N.toDataURL(ve.type,ve.quality));else if(!("__context"in N)){var qt=N.toDataURL(ve.type,ve.quality),Xt=q.createElement("canvas");Xt.width=N.width,Xt.height=N.height,qt!==Xt.toDataURL(ve.type,ve.quality)&&(te.rr_dataURL=qt)}}if(le==="img"&&ke){Je||(Je=q.createElement("canvas"),St=Je.getContext("2d"));var ot=N,Pr=ot.currentSrc||ot.getAttribute("src")||"<unknown-src>",_n=ot.crossOrigin,pr=()=>{ot.removeEventListener("load",pr);try{Je.width=ot.naturalWidth,Je.height=ot.naturalHeight,St.drawImage(ot,0,0),te.rr_dataURL=Je.toDataURL(ve.type,ve.quality)}catch(Fe){if(ot.crossOrigin!=="anonymous")return ot.crossOrigin="anonymous",void(ot.complete&&ot.naturalWidth!==0?pr():ot.addEventListener("load",pr));console.warn("Cannot inline img src=".concat(Pr,"! Error: ").concat(Fe))}ot.crossOrigin==="anonymous"&&(_n?te.crossOrigin=_n:ot.removeAttribute("crossorigin"))};ot.complete&&ot.naturalWidth!==0?pr():ot.addEventListener("load",pr)}if(le==="audio"||le==="video"){var Ne=te;Ne.rr_mediaState=N.paused?"paused":"played",Ne.rr_mediaCurrentTime=N.currentTime,Ne.rr_mediaPlaybackRate=N.playbackRate,Ne.rr_mediaMuted=N.muted,Ne.rr_mediaLoop=N.loop,Ne.rr_mediaVolume=N.volume}if(be||(N.scrollLeft&&(te.rr_scrollLeft=N.scrollLeft),N.scrollTop&&(te.rr_scrollTop=N.scrollTop)),_e){var{width:Nt,height:Ie}=N.getBoundingClientRect();te={class:te.class,rr_width:"".concat(Nt,"px"),rr_height:"".concat(Ie,"px")}}le!=="iframe"||Te(te.src)||(N.contentDocument||(te.rr_src=te.src),delete te.src);try{customElements.get(le)&&(M=!0)}catch{}return{type:y.Element,tagName:le,attributes:te,childNodes:[],isSVG:ee(N)||void 0,needBlock:_e,rootId:we,isCustom:M}}(i,{doc:l,blockClass:d,blockSelector:v,inlineStylesheet:w,maskInputOptions:S,maskInputFn:E,dataURLOptions:O,inlineImages:X,recordCanvas:B,keepIframeSrcFn:ie,newlyAddedElement:ge,rootId:oe});case i.TEXT_NODE:return function(N,A){var M,{needsMask:q,maskTextFn:J,rootId:K}=A,Q=ye.parentNode(N),re=Q&&Q.tagName,pe=ye.textContent(N),ve=re==="STYLE"||void 0,ke=re==="SCRIPT"||void 0;if(ve&&pe){try{N.nextSibling||N.previousSibling||(M=Q.sheet)!=null&&M.cssRules&&(pe=Ye(Q.sheet))}catch(Z){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(Z),N)}pe=ze(pe,he(A.doc))}return ke&&(pe="SCRIPT_PLACEHOLDER"),!ve&&!ke&&pe&&q&&(pe=J?J(pe,ye.parentElement(N)):pe.replace(/[\S]/g,"*")),{type:y.Text,textContent:pe||"",isStyle:ve,rootId:K}}(i,{doc:l,needsMask:_,maskTextFn:I,rootId:oe});case i.CDATA_SECTION_NODE:return{type:y.CDATA,textContent:"",rootId:oe};case i.COMMENT_NODE:return{type:y.Comment,textContent:ye.textContent(i)||"",rootId:oe};default:return!1}}function P(i){return i==null?"":i.toLowerCase()}function Y(i,s){var{doc:l,mirror:c,blockClass:d,blockSelector:v,maskTextClass:_,maskTextSelector:w,skipChild:S=!1,inlineStylesheet:I=!0,maskInputOptions:E={},maskTextFn:O,maskInputFn:X,slimDOMOptions:B,dataURLOptions:ie={},inlineImages:ge=!1,recordCanvas:oe=!1,onSerialize:N,onIframeLoad:A,iframeLoadTimeout:M=5e3,onStylesheetLoad:q,stylesheetLoadTimeout:J=5e3,keepIframeSrcFn:K=()=>!1,newlyAddedElement:Q=!1}=s,{needsMask:re}=s,{preserveWhiteSpace:pe=!0}=s;re||(re=R(i,_,w,re===void 0));var ve,ke=z(i,{doc:l,mirror:c,blockClass:d,blockSelector:v,needsMask:re,inlineStylesheet:I,maskInputOptions:E,maskTextFn:O,maskInputFn:X,dataURLOptions:ie,inlineImages:ge,recordCanvas:oe,keepIframeSrcFn:K,newlyAddedElement:Q});if(!ke)return console.warn(i,"not serialized"),null;ve=c.hasNode(i)?c.getId(i):!function(V,xe){return!!(xe.comment&&V.type===y.Comment||V.type===y.Element&&(xe.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"&&wt(V.attributes.href)==="js")||xe.headFavicon&&(V.tagName==="link"&&V.attributes.rel==="shortcut icon"||V.tagName==="meta"&&(P(V.attributes.name).match(/^msapplication-tile(image|color)$/)||P(V.attributes.name)==="application-name"||P(V.attributes.rel)==="icon"||P(V.attributes.rel)==="apple-touch-icon"||P(V.attributes.rel)==="shortcut icon"))||V.tagName==="meta"&&(xe.headMetaDescKeywords&&P(V.attributes.name).match(/^description|keywords$/)||xe.headMetaSocial&&(P(V.attributes.property).match(/^(og|twitter|fb):/)||P(V.attributes.name).match(/^(og|twitter):/)||P(V.attributes.name)==="pinterest")||xe.headMetaRobots&&(P(V.attributes.name)==="robots"||P(V.attributes.name)==="googlebot"||P(V.attributes.name)==="bingbot")||xe.headMetaHttpEquiv&&V.attributes["http-equiv"]!==void 0||xe.headMetaAuthorship&&(P(V.attributes.name)==="author"||P(V.attributes.name)==="generator"||P(V.attributes.name)==="framework"||P(V.attributes.name)==="publisher"||P(V.attributes.name)==="progid"||P(V.attributes.property).match(/^article:/)||P(V.attributes.property).match(/^product:/))||xe.headMetaVerification&&(P(V.attributes.name)==="google-site-verification"||P(V.attributes.name)==="yandex-verification"||P(V.attributes.name)==="csrf-token"||P(V.attributes.name)==="p:domain_verify"||P(V.attributes.name)==="verify-v1"||P(V.attributes.name)==="verification"||P(V.attributes.name)==="shopify-checkout-api-token"))))}(ke,B)&&(pe||ke.type!==y.Text||ke.isStyle||ke.textContent.replace(/^\s+|\s+$/gm,"").length)?It():Yt;var Z=Object.assign(ke,{id:ve});if(c.add(i,Z),ve===Yt)return null;N&&N(i);var Te=!S;if(Z.type===y.Element){Te=Te&&!Z.needBlock,delete Z.needBlock;var be=ye.shadowRoot(i);be&&je(be)&&(Z.isShadowHost=!0)}if((Z.type===y.Document||Z.type===y.Element)&&Te){B.headWhitespace&&Z.type===y.Element&&Z.tagName==="head"&&(pe=!1);var we={doc:l,mirror:c,blockClass:d,blockSelector:v,needsMask:re,maskTextClass:_,maskTextSelector:w,skipChild:S,inlineStylesheet:I,maskInputOptions:E,maskTextFn:O,maskInputFn:X,slimDOMOptions:B,dataURLOptions:ie,inlineImages:ge,recordCanvas:oe,preserveWhiteSpace:pe,onSerialize:N,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:q,stylesheetLoadTimeout:J,keepIframeSrcFn:K};if(!(Z.type===y.Element&&Z.tagName==="textarea"&&Z.attributes.value!==void 0))for(var _e of Array.from(ye.childNodes(i))){var le=Y(_e,we);le&&Z.childNodes.push(le)}var te=null;if(Se(i)&&(te=ye.shadowRoot(i)))for(var He of Array.from(ye.childNodes(te))){var $e=Y(He,we);$e&&(je(te)&&($e.isShadow=!0),Z.childNodes.push($e))}}var Oe=ye.parentNode(i);return Oe&&Le(Oe)&&je(Oe)&&(Z.isShadow=!0),Z.type===y.Element&&Z.tagName==="iframe"&&function(V,xe,Ot){var gt=V.contentWindow;if(gt){var it,ft=!1;try{it=gt.document.readyState}catch{return}if(it==="complete"){var qt="about:blank";if(gt.location.href!==qt||V.src===qt||V.src==="")return setTimeout(xe,0),V.addEventListener("load",xe);V.addEventListener("load",xe)}else{var Xt=setTimeout(()=>{ft||(xe(),ft=!0)},Ot);V.addEventListener("load",()=>{clearTimeout(Xt),ft=!0,xe()})}}}(i,()=>{var V=i.contentDocument;if(V&&A){var xe=Y(V,{doc:V,mirror:c,blockClass:d,blockSelector:v,needsMask:re,maskTextClass:_,maskTextSelector:w,skipChild:!1,inlineStylesheet:I,maskInputOptions:E,maskTextFn:O,maskInputFn:X,slimDOMOptions:B,dataURLOptions:ie,inlineImages:ge,recordCanvas:oe,preserveWhiteSpace:pe,onSerialize:N,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:q,stylesheetLoadTimeout:J,keepIframeSrcFn:K});xe&&A(i,xe)}},M),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"&&wt(Z.attributes.href)==="css")&&function(V,xe,Ot){var gt,it=!1;try{gt=V.sheet}catch{return}if(!gt){var ft=setTimeout(()=>{it||(xe(),it=!0)},Ot);V.addEventListener("load",()=>{clearTimeout(ft),it=!0,xe()})}}(i,()=>{if(q){var V=Y(i,{doc:l,mirror:c,blockClass:d,blockSelector:v,needsMask:re,maskTextClass:_,maskTextSelector:w,skipChild:!1,inlineStylesheet:I,maskInputOptions:E,maskTextFn:O,maskInputFn:X,slimDOMOptions:B,dataURLOptions:ie,inlineImages:ge,recordCanvas:oe,preserveWhiteSpace:pe,onSerialize:N,onIframeLoad:A,iframeLoadTimeout:M,onStylesheetLoad:q,stylesheetLoadTimeout:J,keepIframeSrcFn:K});V&&q(i,V)}},J),Z}let W=class Il{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 Il)||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 ue={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ae={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},de={};function Me(i){if(de[i])return de[i];var s=globalThis[i],l=s.prototype,c=i in ue?ue[i]:void 0,d=!!(c&&c.every(E=>{var O,X;return!!((X=(O=Object.getOwnPropertyDescriptor(l,E))==null?void 0:O.get)!=null&&X.toString().includes("[native code]"))})),v=i in ae?ae[i]:void 0,_=!!(v&&v.every(E=>{var O;return typeof l[E]=="function"&&((O=l[E])==null?void 0:O.toString().includes("[native code]"))}));if(d&&_&&!j())return de[i]=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[i].prototype;return document.body.removeChild(w),I?de[i]=I:l}catch{return l}}var Ue={};function Ve(i,s,l){var c,d="".concat(i,".").concat(String(l));if(Ue[d])return Ue[d].call(s);var v=Me(i),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(Ue[d]=_,_.call(s)):s[l]}var Ke={};function tr(i,s,l){var c="".concat(i,".").concat(String(l));if(Ke[c])return Ke[c].bind(s);var d=Me(i)[l];return typeof d!="function"?s[l]:(Ke[c]=d,d.bind(s))}function Sr(){return Me("MutationObserver").constructor}var Ae={childNodes:function(i){return Ve("Node",i,"childNodes")},parentNode:function(i){return Ve("Node",i,"parentNode")},parentElement:function(i){return Ve("Node",i,"parentElement")},textContent:function(i){return Ve("Node",i,"textContent")},contains:function(i,s){return tr("Node",i,"contains")(s)},getRootNode:function(i){return tr("Node",i,"getRootNode")()},host:function(i){return i&&"host"in i?Ve("ShadowRoot",i,"host"):null},styleSheets:function(i){return i.styleSheets},shadowRoot:function(i){return i&&"shadowRoot"in i?Ve("Element",i,"shadowRoot"):null},querySelector:function(i,s){return Ve("Element",i,"querySelector")(s)},querySelectorAll:function(i,s){return Ve("Element",i,"querySelectorAll")(s)},mutationObserver:Sr};function Ct(i,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:document,c={capture:!0,passive:!0};return l.addEventListener(i,s,c),()=>l.removeEventListener(i,s,c)}var jt=`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.`,Hn={map:{},getId:()=>(console.error(jt),-1),getNode:()=>(console.error(jt),null),removeNodeFromMap(){console.error(jt)},has:()=>(console.error(jt),!1),reset(){console.error(jt)}};function gn(i,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=null,d=0;return function(){for(var v=arguments.length,_=new Array(v),w=0;w<v;w++)_[w]=arguments[w];var S=Date.now();d||l.leading!==!1||(d=S);var I=s-(S-d),E=this;I<=0||I>s?(c&&(clearTimeout(c),c=null),d=S,i.apply(E,_)):c||l.trailing===!1||(c=setTimeout(()=>{d=l.leading===!1?0:Date.now(),c=null,i.apply(E,_)},I))}}function $n(i,s,l,c){var d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:window,v=d.Object.getOwnPropertyDescriptor(i,s);return d.Object.defineProperty(i,s,c?l:{set(_){setTimeout(()=>{l.set.call(this,_)},0),v&&v.set&&v.set.call(this,_)}}),()=>$n(i,s,v||{},!0)}function Yr(i,s,l){try{if(!(s in i))return()=>{};var c=i[s],d=l(c);return typeof d=="function"&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:c}})),i[s]=d,()=>{i[s]=c}}catch{return()=>{}}}typeof window<"u"&&window.Proxy&&window.Reflect&&(Hn=new Proxy(Hn,{get:(i,s,l)=>(s==="map"&&console.error(jt),Reflect.get(i,s,l))}));var Wn=Date.now;function hs(i){var s,l,c,d,v=i.document;return{left:v.scrollingElement?v.scrollingElement.scrollLeft:i.pageXOffset!==void 0?i.pageXOffset:v.documentElement.scrollLeft||(v==null?void 0:v.body)&&((s=Ae.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:i.pageYOffset!==void 0?i.pageYOffset:(v==null?void 0:v.documentElement.scrollTop)||(v==null?void 0:v.body)&&((c=Ae.parentElement(v.body))==null?void 0:c.scrollTop)||((d=v==null?void 0:v.body)==null?void 0:d.scrollTop)||0}}function ps(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function gs(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function fs(i){return i?i.nodeType===i.ELEMENT_NODE?i:Ae.parentElement(i):null}function At(i,s,l,c){if(!i)return!1;var d=fs(i);if(!d)return!1;try{if(typeof s=="string"){if(d.classList.contains(s)||c&&d.closest("."+s)!==null)return!0}else if(Pe(d,s,c))return!0}catch{}return!!(l&&(d.matches(l)||c&&d.closest(l)!==null))}function Bi(i,s,l){return!(i.tagName!=="TITLE"||!l.headTitleMutations)||s.getId(i)===Yt}function vs(i,s){if(Le(i))return!1;var l=s.getId(i);if(!s.has(l))return!0;var c=Ae.parentNode(i);return(!c||c.nodeType!==i.DOCUMENT_NODE)&&(!c||vs(c,s))}function Hi(i){return!!i.changedTouches}function ms(i,s){return!!(i.nodeName==="IFRAME"&&s.getMeta(i))}function _s(i,s){return!!(i.nodeName==="LINK"&&i.nodeType===i.ELEMENT_NODE&&i.getAttribute&&i.getAttribute("rel")==="stylesheet"&&s.getMeta(i))}function $i(i){return!!i&&(i instanceof W&&"shadowRoot"in i?!!i.shadowRoot:!!Ae.shadowRoot(i))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Wn=()=>new Date().getTime());let Ru=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(i){var s;return(s=this.styleIDMap.get(i))!==null&&s!==void 0?s:-1}has(i){return this.styleIDMap.has(i)}add(i,s){return this.has(i)?this.getId(i):(l=s===void 0?this.id++:s,this.styleIDMap.set(i,l),this.idStyleMap.set(l,i),l);var l}getStyle(i){return this.idStyleMap.get(i)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function ys(i){var s,l=null;return"getRootNode"in i&&((s=Ae.getRootNode(i))==null?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ae.host(Ae.getRootNode(i))&&(l=Ae.host(Ae.getRootNode(i))),l}function Mu(i){var s=i.ownerDocument;if(!s)return!1;var l=function(c){for(var d,v=c;d=ys(v);)v=d;return v}(i);return Ae.contains(s,l)}function bs(i){var s=i.ownerDocument;return!!s&&(Ae.contains(s,i)||Mu(i))}var Ge=(i=>(i[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i))(Ge||{}),Be=(i=>(i[i.Mutation=0]="Mutation",i[i.MouseMove=1]="MouseMove",i[i.MouseInteraction=2]="MouseInteraction",i[i.Scroll=3]="Scroll",i[i.ViewportResize=4]="ViewportResize",i[i.Input=5]="Input",i[i.TouchMove=6]="TouchMove",i[i.MediaInteraction=7]="MediaInteraction",i[i.StyleSheetRule=8]="StyleSheetRule",i[i.CanvasMutation=9]="CanvasMutation",i[i.Font=10]="Font",i[i.Log=11]="Log",i[i.Drag=12]="Drag",i[i.StyleDeclaration=13]="StyleDeclaration",i[i.Selection=14]="Selection",i[i.AdoptedStyleSheet=15]="AdoptedStyleSheet",i[i.CustomElement=16]="CustomElement",i))(Be||{}),Dt=(i=>(i[i.MouseUp=0]="MouseUp",i[i.MouseDown=1]="MouseDown",i[i.Click=2]="Click",i[i.ContextMenu=3]="ContextMenu",i[i.DblClick=4]="DblClick",i[i.Focus=5]="Focus",i[i.Blur=6]="Blur",i[i.TouchStart=7]="TouchStart",i[i.TouchMove_Departed=8]="TouchMove_Departed",i[i.TouchEnd=9]="TouchEnd",i[i.TouchCancel=10]="TouchCancel",i))(Dt||{}),dr=(i=>(i[i.Mouse=0]="Mouse",i[i.Pen=1]="Pen",i[i.Touch=2]="Touch",i))(dr||{}),Zr=(i=>(i[i["2D"]=0]="2D",i[i.WebGL=1]="WebGL",i[i.WebGL2=2]="WebGL2",i))(Zr||{}),Xr=(i=>(i[i.Play=0]="Play",i[i.Pause=1]="Pause",i[i.Seeked=2]="Seeked",i[i.VolumeChange=3]="VolumeChange",i[i.RateChange=4]="RateChange",i))(Xr||{});function ws(i){return"__ln"in i}class Au{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&&ws(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&&ws(s.nextSibling)&&s.nextSibling.__ln.previous){var d=s.nextSibling.__ln.previous;l.previous=d,l.next=s.nextSibling.__ln,s.nextSibling.__ln.previous=l,d&&(d.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 fn,Ss=(i,s)=>"".concat(i,"@").concat(s);class Ou{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 Au,d=M=>{for(var q=M,J=Yt;J===Yt;)J=(q=q&&q.nextSibling)&&this.mirror.getId(q);return J},v=M=>{var q=Ae.parentNode(M);if(q&&bs(M)&&q.tagName!=="TEXTAREA"){var J=Le(q)?this.mirror.getId(ys(M)):this.mirror.getId(q),K=d(M);if(J===-1||K===-1)return c.addNode(M);var Q=Y(M,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:re=>{ms(re,this.mirror)&&this.iframeManager.addIframe(re),_s(re,this.mirror)&&this.stylesheetManager.trackLinkElement(re),$i(M)&&this.shadowDomManager.addShadowRoot(Ae.shadowRoot(M),this.doc)},onIframeLoad:(re,pe)=>{this.iframeManager.attachIframe(re,pe),this.shadowDomManager.observeAttachShadow(re)},onStylesheetLoad:(re,pe)=>{this.stylesheetManager.attachLinkElement(re,pe)}});Q&&(s.push({parentId:J,nextId:K,node:Q}),l.add(Q.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var _ of this.movedSet)Is(this.removes,_,this.mirror)&&!this.movedSet.has(Ae.parentNode(_))||v(_);for(var w of this.addedSet)Cs(this.droppedSet,w)||Is(this.removes,w,this.mirror)?Cs(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(Ae.parentNode(S.value)),O=d(S.value);E!==-1&&O!==-1&&(I=S)}if(!I)for(var X=c.tail;X;){var B=X;if(X=X.previous,B){var ie=this.mirror.getId(Ae.parentNode(B.value));if(d(B.value)===-1)continue;if(ie!==-1){I=B;break}var ge=B.value,oe=Ae.parentNode(ge);if(oe&&oe.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var N=Ae.host(oe);if(this.mirror.getId(N)!==-1){I=B;break}}}}if(!I){for(;c.head;)c.removeNode(c.head.value);break}S=I.previous,c.removeNode(I.value),v(I.value)}var A={texts:this.texts.map(M=>{var q=M.node,J=Ae.parentNode(q);return J&&J.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(J),{id:this.mirror.getId(q),value:M.value}}).filter(M=>!l.has(M.id)).filter(M=>this.mirror.has(M.id)),attributes:this.attributes.map(M=>{var{attributes:q}=M;if(typeof q.style=="string"){var J=JSON.stringify(M.styleDiff),K=JSON.stringify(M._unchangedStyles);J.length<q.style.length&&(J+K).split("var(").length===q.style.split("var(").length&&(q.style=M.styleDiff)}return{id:this.mirror.getId(M.node),attributes:q}}).filter(M=>!l.has(M.id)).filter(M=>this.mirror.has(M.id)),removes:this.removes,adds:s};(A.texts.length||A.attributes.length||A.removes.length||A.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(A))}}),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(Ae.childNodes(s),c=>Ae.textContent(c)||"").join("")}),g(this,"processMutation",s=>{if(!Bi(s.target,this.mirror,this.slimDOMOptions))switch(s.type){case"characterData":var l=Ae.textContent(s.target);At(s.target,this.blockClass,this.blockSelector,!1)||l===s.oldValue||this.texts.push({value:R(s.target,this.maskTextClass,this.maskTextSelector,!0)&&l?this.maskTextFn?this.maskTextFn(l,fs(s.target)):l.replace(/[\S]/g,"*"):l,node:s.target});break;case"attributes":var c=s.target,d=s.attributeName,v=s.target.getAttribute(d);if(d==="value"){var _=Tt(c);v=mt({element:c,maskInputOptions:this.maskInputOptions,tagName:c.tagName,type:_,value:v,maskInputFn:this.maskInputFn})}if(At(s.target,this.blockClass,this.blockSelector,!1)||v===s.oldValue)return;var w=this.attributeMap.get(s.target);if(c.tagName==="IFRAME"&&d==="src"&&!this.keepIframeSrcFn(v)){if(c.contentDocument)return;d="rr_src"}if(w||(w={node:s.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(w),this.attributeMap.set(s.target,w)),d==="type"&&c.tagName==="INPUT"&&(s.oldValue||"").toLowerCase()==="password"&&c.setAttribute("data-rr-is-password","true"),!Xe(c.tagName,d))if(w.attributes[d]=Re(this.doc,Ze(c.tagName),Ze(d),v),d==="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),O=c.style.getPropertyPriority(I);E!==S.style.getPropertyValue(I)||O!==S.style.getPropertyPriority(I)?w.styleDiff[I]=O===""?E:[E,O]:w._unchangedStyles[I]=[E,O]}for(var X of Array.from(S.style))c.style.getPropertyValue(X)===""&&(w.styleDiff[X]=!1)}else d==="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(At(s.target,this.blockClass,this.blockSelector,!0))return;if(s.target.tagName==="TEXTAREA")return void this.genTextAreaValueMutation(s.target);s.addedNodes.forEach(B=>this.genAdds(B,s.target)),s.removedNodes.forEach(B=>{var ie=this.mirror.getId(B),ge=Le(s.target)?this.mirror.getId(Ae.host(s.target)):this.mirror.getId(s.target);At(s.target,this.blockClass,this.blockSelector,!1)||Bi(B,this.mirror,this.slimDOMOptions)||!function(oe,N){return N.getId(oe)!==-1}(B,this.mirror)||(this.addedSet.has(B)?(Wi(this.addedSet,B),this.droppedSet.add(B)):this.addedSet.has(s.target)&&ie===-1||vs(s.target,this.mirror)||(this.movedSet.has(B)&&this.movedMap[Ss(ie,ge)]?Wi(this.movedSet,B):this.removes.push({parentId:ge,id:ie,isShadow:!(!Le(s.target)||!je(s.target))||void 0})),this.mapRemoves.push(B))})}}),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(Bi(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[Ss(this.mirror.getId(s),c)]=!0)}else this.addedSet.add(s),this.droppedSet.delete(s);At(s,this.blockClass,this.blockSelector,!1)||(Ae.childNodes(s).forEach(d=>this.genAdds(d)),$i(s)&&Ae.childNodes(Ae.shadowRoot(s)).forEach(d=>{this.processedNodeManager.add(d,this),this.genAdds(d,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 Wi(i,s){i.delete(s),Ae.childNodes(s).forEach(l=>Wi(i,l))}function Is(i,s,l){return i.length!==0&&function(c,d,v){for(var _=Ae.parentNode(d),w=function(){var I=v.getId(_);if(c.some(E=>E.id===I))return{v:!0};_=Ae.parentNode(_)};_;){var S=w();if(typeof S=="object")return S.v}return!1}(i,s,l)}function Cs(i,s){return i.size!==0&&Es(i,s)}function Es(i,s){var l=Ae.parentNode(s);return!!l&&(!!i.has(l)||Es(i,l))}var We=i=>fn?function(){try{return i(...arguments)}catch(s){if(fn&&fn(s)===!0)return;throw s}}:i,Nr=[];function vn(i){try{if("composedPath"in i){var s=i.composedPath();if(s.length)return s[0]}else if("path"in i&&i.path.length)return i.path[0]}catch{}return i&&i.target}function ks(i,s){var l=new Ou;Nr.push(l),l.init(i);var c=new(Sr())(We(l.processMutations.bind(l)));return c.observe(s,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),c}function Nu(i){var{mouseInteractionCb:s,doc:l,mirror:c,blockClass:d,blockSelector:v,sampling:_}=i;if(_.mouseInteraction===!1)return()=>{};var w=_.mouseInteraction===!0||_.mouseInteraction===void 0?{}:_.mouseInteraction,S=[],I=null;return Object.keys(Dt).filter(E=>Number.isNaN(Number(E))&&!E.endsWith("_Departed")&&w[E]!==!1).forEach(E=>{var O=Ze(E),X=(B=>ie=>{var ge=vn(ie);if(!At(ge,d,v,!0)){var oe=null,N=B;if("pointerType"in ie){switch(ie.pointerType){case"mouse":oe=dr.Mouse;break;case"touch":oe=dr.Touch;break;case"pen":oe=dr.Pen}oe===dr.Touch?Dt[B]===Dt.MouseDown?N="TouchStart":Dt[B]===Dt.MouseUp&&(N="TouchEnd"):dr.Pen}else Hi(ie)&&(oe=dr.Touch);oe!==null?(I=oe,(N.startsWith("Touch")&&oe===dr.Touch||N.startsWith("Mouse")&&oe===dr.Mouse)&&(oe=null)):Dt[B]===Dt.Click&&(oe=I,I=null);var A=Hi(ie)?ie.changedTouches[0]:ie;if(A){var M=c.getId(ge),{clientX:q,clientY:J}=A;We(s)(t({type:Dt[N],id:M,x:q,y:J},oe!==null&&{pointerType:oe}))}}})(E);if(window.PointerEvent)switch(Dt[E]){case Dt.MouseDown:case Dt.MouseUp:O=O.replace("mouse","pointer");break;case Dt.TouchStart:case Dt.TouchEnd:return}S.push(Ct(O,X,l))}),We(()=>{S.forEach(E=>E())})}function Ts(i){var{scrollCb:s,doc:l,mirror:c,blockClass:d,blockSelector:v,sampling:_}=i;return Ct("scroll",We(gn(We(w=>{var S=vn(w);if(S&&!At(S,d,v,!0)){var I=c.getId(S);if(S===l&&l.defaultView){var E=hs(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 Fu=["INPUT","TEXTAREA","SELECT"],xs=new WeakMap;function Gn(i){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 d=Array.from(s.parentStyleSheet.cssRules).indexOf(s);l.unshift(d)}return l}(i,[])}function Ir(i,s,l){var c,d;return i?(i.ownerNode?c=s.getId(i.ownerNode):d=l.getId(i),{styleId:d,id:c}):{}}function Rs(i,s){var l,c,d,{mirror:v,stylesheetManager:_}=i,w=null;w=s.nodeName==="#document"?v.getId(s):v.getId(Ae.host(s));var S=s.nodeName==="#document"?(l=s.defaultView)==null?void 0:l.Document:(d=(c=s.ownerDocument)==null?void 0:c.defaultView)==null?void 0:d.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 O,X=(O=I.set)==null?void 0:O.call(this,E);if(w!==null&&w!==-1)try{_.adoptStyleSheets(E,w)}catch{}return X}}),We(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:I.configurable,enumerable:I.enumerable,get:I.get,set:I.set})})):()=>{}}function Pu(i){var s,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=i.doc.defaultView;if(!c)return()=>{};(function(A,M){var{mutationCb:q,mousemoveCb:J,mouseInteractionCb:K,scrollCb:Q,viewportResizeCb:re,inputCb:pe,mediaInteractionCb:ve,styleSheetRuleCb:ke,styleDeclarationCb:Z,canvasMutationCb:Te,fontCb:be,selectionCb:we,customElementCb:_e}=A;A.mutationCb=function(){M.mutation&&M.mutation(...arguments),q(...arguments)},A.mousemoveCb=function(){M.mousemove&&M.mousemove(...arguments),J(...arguments)},A.mouseInteractionCb=function(){M.mouseInteraction&&M.mouseInteraction(...arguments),K(...arguments)},A.scrollCb=function(){M.scroll&&M.scroll(...arguments),Q(...arguments)},A.viewportResizeCb=function(){M.viewportResize&&M.viewportResize(...arguments),re(...arguments)},A.inputCb=function(){M.input&&M.input(...arguments),pe(...arguments)},A.mediaInteractionCb=function(){M.mediaInteaction&&M.mediaInteaction(...arguments),ve(...arguments)},A.styleSheetRuleCb=function(){M.styleSheetRule&&M.styleSheetRule(...arguments),ke(...arguments)},A.styleDeclarationCb=function(){M.styleDeclaration&&M.styleDeclaration(...arguments),Z(...arguments)},A.canvasMutationCb=function(){M.canvasMutation&&M.canvasMutation(...arguments),Te(...arguments)},A.fontCb=function(){M.font&&M.font(...arguments),be(...arguments)},A.selectionCb=function(){M.selection&&M.selection(...arguments),we(...arguments)},A.customElementCb=function(){M.customElement&&M.customElement(...arguments),_e(...arguments)}})(i,l),i.recordDOM&&(s=ks(i,i.doc));var d=function(A){var{mousemoveCb:M,sampling:q,doc:J,mirror:K}=A;if(q.mousemove===!1)return()=>{};var Q,re=typeof q.mousemove=="number"?q.mousemove:50,pe=typeof q.mousemoveCallback=="number"?q.mousemoveCallback:500,ve=[],ke=gn(We(be=>{var we=Date.now()-Q;M(ve.map(_e=>(_e.timeOffset-=we,_e)),be),ve=[],Q=null}),pe),Z=We(gn(We(be=>{var we=vn(be),{clientX:_e,clientY:le}=Hi(be)?be.changedTouches[0]:be;Q||(Q=Wn()),ve.push({x:_e,y:le,id:K.getId(we),timeOffset:Wn()-Q}),ke(typeof DragEvent<"u"&&be instanceof DragEvent?Be.Drag:be instanceof MouseEvent?Be.MouseMove:Be.TouchMove)}),re,{trailing:!1})),Te=[Ct("mousemove",Z,J),Ct("touchmove",Z,J),Ct("drag",Z,J)];return We(()=>{Te.forEach(be=>be())})}(i),v=Nu(i),_=Ts(i),w=function(A,M){var{viewportResizeCb:q}=A,{win:J}=M,K=-1,Q=-1;return Ct("resize",We(gn(We(()=>{var re=ps(),pe=gs();K===re&&Q===pe||(q({width:Number(pe),height:Number(re)}),K=re,Q=pe)}),200)),J)}(i,{win:c}),S=function(A){var{inputCb:M,doc:q,mirror:J,blockClass:K,blockSelector:Q,ignoreClass:re,ignoreSelector:pe,maskInputOptions:ve,maskInputFn:ke,sampling:Z,userTriggeredOnInput:Te}=A;function be($e){var Oe=vn($e),V=$e.isTrusted,xe=Oe&&Oe.tagName;if(Oe&&xe==="OPTION"&&(Oe=Ae.parentElement(Oe)),Oe&&xe&&!(Fu.indexOf(xe)<0)&&!At(Oe,K,Q,!0)&&!(Oe.classList.contains(re)||pe&&Oe.matches(pe))){var Ot=Oe.value,gt=!1,it=Tt(Oe)||"";it==="radio"||it==="checkbox"?gt=Oe.checked:(ve[xe.toLowerCase()]||ve[it])&&(Ot=mt({element:Oe,maskInputOptions:ve,tagName:xe,type:it,value:Ot,maskInputFn:ke})),we(Oe,Te?{text:Ot,isChecked:gt,userTriggered:V}:{text:Ot,isChecked:gt});var ft=Oe.name;it==="radio"&&ft&>&&q.querySelectorAll('input[type="radio"][name="'.concat(ft,'"]')).forEach(qt=>{if(qt!==Oe){var Xt=qt.value;we(qt,Te?{text:Xt,isChecked:!gt,userTriggered:!1}:{text:Xt,isChecked:!gt})}})}}function we($e,Oe){var V=xs.get($e);if(!V||V.text!==Oe.text||V.isChecked!==Oe.isChecked){xs.set($e,Oe);var xe=J.getId($e);We(M)(t(t({},Oe),{},{id:xe}))}}var _e=(Z.input==="last"?["change"]:["input","change"]).map($e=>Ct($e,We(be),q)),le=q.defaultView;if(!le)return()=>{_e.forEach($e=>$e())};var te=le.Object.getOwnPropertyDescriptor(le.HTMLInputElement.prototype,"value"),He=[[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&&_e.push(...He.map($e=>$n($e[0],$e[1],{set(){We(be)({target:this,isTrusted:!1})}},!1,le))),We(()=>{_e.forEach($e=>$e())})}(i),I=function(A){var{mediaInteractionCb:M,blockClass:q,blockSelector:J,mirror:K,sampling:Q,doc:re}=A,pe=We(ke=>gn(We(Z=>{var Te=vn(Z);if(Te&&!At(Te,q,J,!0)){var{currentTime:be,volume:we,muted:_e,playbackRate:le,loop:te}=Te;M({type:ke,id:K.getId(Te),currentTime:be,volume:we,muted:_e,playbackRate:le,loop:te})}}),Q.media||500)),ve=[Ct("play",pe(Xr.Play),re),Ct("pause",pe(Xr.Pause),re),Ct("seeked",pe(Xr.Seeked),re),Ct("volumechange",pe(Xr.VolumeChange),re),Ct("ratechange",pe(Xr.RateChange),re)];return We(()=>{ve.forEach(ke=>ke())})}(i),E=()=>{},O=()=>{},X=()=>{},B=()=>{};i.recordDOM&&(E=function(A,M){var{styleSheetRuleCb:q,mirror:J,stylesheetManager:K}=A,{win:Q}=M;if(!Q.CSSStyleSheet||!Q.CSSStyleSheet.prototype)return()=>{};var re=Q.CSSStyleSheet.prototype.insertRule;Q.CSSStyleSheet.prototype.insertRule=new Proxy(re,{apply:We((be,we,_e)=>{var[le,te]=_e,{id:He,styleId:$e}=Ir(we,J,K.styleMirror);return(He&&He!==-1||$e&&$e!==-1)&&q({id:He,styleId:$e,adds:[{rule:le,index:te}]}),be.apply(we,_e)})}),Q.CSSStyleSheet.prototype.addRule=function(be,we){var _e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.cssRules.length,le="".concat(be," { ").concat(we," }");return Q.CSSStyleSheet.prototype.insertRule.apply(this,[le,_e])};var pe,ve,ke=Q.CSSStyleSheet.prototype.deleteRule;Q.CSSStyleSheet.prototype.deleteRule=new Proxy(ke,{apply:We((be,we,_e)=>{var[le]=_e,{id:te,styleId:He}=Ir(we,J,K.styleMirror);return(te&&te!==-1||He&&He!==-1)&&q({id:te,styleId:He,removes:[{index:le}]}),be.apply(we,_e)})}),Q.CSSStyleSheet.prototype.removeRule=function(be){return Q.CSSStyleSheet.prototype.deleteRule.apply(this,[be])},Q.CSSStyleSheet.prototype.replace&&(pe=Q.CSSStyleSheet.prototype.replace,Q.CSSStyleSheet.prototype.replace=new Proxy(pe,{apply:We((be,we,_e)=>{var[le]=_e,{id:te,styleId:He}=Ir(we,J,K.styleMirror);return(te&&te!==-1||He&&He!==-1)&&q({id:te,styleId:He,replace:le}),be.apply(we,_e)})})),Q.CSSStyleSheet.prototype.replaceSync&&(ve=Q.CSSStyleSheet.prototype.replaceSync,Q.CSSStyleSheet.prototype.replaceSync=new Proxy(ve,{apply:We((be,we,_e)=>{var[le]=_e,{id:te,styleId:He}=Ir(we,J,K.styleMirror);return(te&&te!==-1||He&&He!==-1)&&q({id:te,styleId:He,replaceSync:le}),be.apply(we,_e)})}));var Z={};qn("CSSGroupingRule")?Z.CSSGroupingRule=Q.CSSGroupingRule:(qn("CSSMediaRule")&&(Z.CSSMediaRule=Q.CSSMediaRule),qn("CSSConditionRule")&&(Z.CSSConditionRule=Q.CSSConditionRule),qn("CSSSupportsRule")&&(Z.CSSSupportsRule=Q.CSSSupportsRule));var Te={};return Object.entries(Z).forEach(be=>{var[we,_e]=be;Te[we]={insertRule:_e.prototype.insertRule,deleteRule:_e.prototype.deleteRule},_e.prototype.insertRule=new Proxy(Te[we].insertRule,{apply:We((le,te,He)=>{var[$e,Oe]=He,{id:V,styleId:xe}=Ir(te.parentStyleSheet,J,K.styleMirror);return(V&&V!==-1||xe&&xe!==-1)&&q({id:V,styleId:xe,adds:[{rule:$e,index:[...Gn(te),Oe||0]}]}),le.apply(te,He)})}),_e.prototype.deleteRule=new Proxy(Te[we].deleteRule,{apply:We((le,te,He)=>{var[$e]=He,{id:Oe,styleId:V}=Ir(te.parentStyleSheet,J,K.styleMirror);return(Oe&&Oe!==-1||V&&V!==-1)&&q({id:Oe,styleId:V,removes:[{index:[...Gn(te),$e]}]}),le.apply(te,He)})})}),We(()=>{Q.CSSStyleSheet.prototype.insertRule=re,Q.CSSStyleSheet.prototype.deleteRule=ke,pe&&(Q.CSSStyleSheet.prototype.replace=pe),ve&&(Q.CSSStyleSheet.prototype.replaceSync=ve),Object.entries(Z).forEach(be=>{var[we,_e]=be;_e.prototype.insertRule=Te[we].insertRule,_e.prototype.deleteRule=Te[we].deleteRule})})}(i,{win:c}),O=Rs(i,i.doc),X=function(A,M){var{styleDeclarationCb:q,mirror:J,ignoreCSSAttributes:K,stylesheetManager:Q}=A,{win:re}=M,pe=re.CSSStyleDeclaration.prototype.setProperty;re.CSSStyleDeclaration.prototype.setProperty=new Proxy(pe,{apply:We((ke,Z,Te)=>{var be,[we,_e,le]=Te;if(K.has(we))return pe.apply(Z,[we,_e,le]);var{id:te,styleId:He}=Ir((be=Z.parentRule)==null?void 0:be.parentStyleSheet,J,Q.styleMirror);return(te&&te!==-1||He&&He!==-1)&&q({id:te,styleId:He,set:{property:we,value:_e,priority:le},index:Gn(Z.parentRule)}),ke.apply(Z,Te)})});var ve=re.CSSStyleDeclaration.prototype.removeProperty;return re.CSSStyleDeclaration.prototype.removeProperty=new Proxy(ve,{apply:We((ke,Z,Te)=>{var be,[we]=Te;if(K.has(we))return ve.apply(Z,[we]);var{id:_e,styleId:le}=Ir((be=Z.parentRule)==null?void 0:be.parentStyleSheet,J,Q.styleMirror);return(_e&&_e!==-1||le&&le!==-1)&&q({id:_e,styleId:le,remove:{property:we},index:Gn(Z.parentRule)}),ke.apply(Z,Te)})}),We(()=>{re.CSSStyleDeclaration.prototype.setProperty=pe,re.CSSStyleDeclaration.prototype.removeProperty=ve})}(i,{win:c}),i.collectFonts&&(B=function(A){var{fontCb:M,doc:q}=A,J=q.defaultView;if(!J)return()=>{};var K=[],Q=new WeakMap,re=J.FontFace;J.FontFace=function(ve,ke,Z){var Te=new re(ve,ke,Z);return Q.set(Te,{family:ve,buffer:typeof ke!="string",descriptors:Z,fontSource:typeof ke=="string"?ke:JSON.stringify(Array.from(new Uint8Array(ke)))}),Te};var pe=Yr(q.fonts,"add",function(ve){return function(ke){return setTimeout(We(()=>{var Z=Q.get(ke);Z&&(M(Z),Q.delete(ke))}),0),ve.apply(this,[ke])}});return K.push(()=>{J.FontFace=re}),K.push(pe),We(()=>{K.forEach(ve=>ve())})}(i)));var ie=function(A){var{doc:M,mirror:q,blockClass:J,blockSelector:K,selectionCb:Q}=A,re=!0,pe=We(()=>{var ve=M.getSelection();if(!(!ve||re&&(ve!=null&&ve.isCollapsed))){re=ve.isCollapsed||!1;for(var ke=[],Z=ve.rangeCount||0,Te=0;Te<Z;Te++){var be=ve.getRangeAt(Te),{startContainer:we,startOffset:_e,endContainer:le,endOffset:te}=be;At(we,J,K,!0)||At(le,J,K,!0)||ke.push({start:q.getId(we),startOffset:_e,end:q.getId(le),endOffset:te})}Q({ranges:ke})}});return pe(),Ct("selectionchange",pe)}(i),ge=function(A){var{doc:M,customElementCb:q}=A,J=M.defaultView;return J&&J.customElements?Yr(J.customElements,"define",function(K){return function(Q,re,pe){try{q({define:{name:Q}})}catch{console.warn("Custom element callback failed for ".concat(Q))}return K.apply(this,[Q,re,pe])}}):()=>{}}(i),oe=[];for(var N of i.plugins)oe.push(N.observer(N.callback,c,N.options));return We(()=>{Nr.forEach(A=>A.reset()),s==null||s.disconnect(),d(),v(),_(),w(),S(),I(),E(),O(),X(),B(),ie(),ge(),oe.forEach(A=>A())})}function jn(i){return window[i]!==void 0}function qn(i){return!!(window[i]!==void 0&&window[i].prototype&&"insertRule"in window[i].prototype&&"deleteRule"in window[i].prototype)}class Ms{constructor(s){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=s}getId(s,l,c,d){var v=c||this.getIdToRemoteIdMap(s),_=d||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),d=this.getRemoteIdToIdMap(s);return l.map(v=>this.getId(s,v,c,d))}getRemoteId(s,l,c){var d=c||this.getRemoteIdToIdMap(s);if(typeof l!="number")return l;var v=d.get(l);return v||-1}getRemoteIds(s,l){var c=this.getRemoteIdToIdMap(s);return l.map(d=>this.getRemoteId(s,d,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 Lu{constructor(s){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new Ms(It)),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 Ms(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,d;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))),(d=this.loadListener)==null||d.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 d=this.transformCrossOriginEvent(c,l.data.event);d&&this.wrappedEmit(d,l.data.isCheckout)}}}transformCrossOriginEvent(s,l){var c;switch(l.type){case Ge.FullSnapshot:this.crossOriginIframeMirror.reset(s),this.crossOriginIframeStyleMirror.reset(s),this.replaceIdOnNode(l.data.node,s);var d=l.data.node.id;return this.crossOriginIframeRootIdMap.set(s,d),this.patchRootIdOnNode(l.data.node,d),{timestamp:l.timestamp,type:Ge.IncrementalSnapshot,data:{source:Be.Mutation,adds:[{parentId:this.mirror.getId(s),nextId:null,node:l.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Ge.Meta:case Ge.Load:case Ge.DomContentLoaded:return!1;case Ge.Plugin:return l;case Ge.Custom:return this.replaceIds(l.data.payload,s,["id","parentId","previousId","nextId"]),l;case Ge.IncrementalSnapshot:switch(l.data.source){case Be.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 Be.Drag:case Be.TouchMove:case Be.MouseMove:return l.data.positions.forEach(v=>{this.replaceIds(v,s,["id"])}),l;case Be.ViewportResize:return!1;case Be.MediaInteraction:case Be.MouseInteraction:case Be.Scroll:case Be.CanvasMutation:case Be.Input:return this.replaceIds(l.data,s,["id"]),l;case Be.StyleSheetRule:case Be.StyleDeclaration:return this.replaceIds(l.data,s,["id"]),this.replaceStyleIds(l.data,s,["styleId"]),l;case Be.Font:return l;case Be.Selection:return l.data.ranges.forEach(v=>{this.replaceIds(v,s,["start","end"])}),l;case Be.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,d){for(var v of d)(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 Du{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(je(s)&&!this.shadowDoms.has(s)){this.shadowDoms.add(s);var c=ks(t(t({},this.bypassOptions),{},{doc:l,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),s);this.restoreHandlers.push(()=>c.disconnect()),this.restoreHandlers.push(Ts(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(Ae.host(s))),this.restoreHandlers.push(Rs({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(Yr(s.prototype,"attachShadow",function(d){return function(v){var _=d.call(this,v),w=Ae.shadowRoot(this);return w&&bs(this)&&c.addShadowRoot(w,l),_}}))}reset(){this.restoreHandlers.forEach(s=>{try{s()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bu=typeof Uint8Array>"u"?[]:new Uint8Array(256),Un=0;Un<64;Un++)Bu[mn.charCodeAt(Un)]=Un;var As=new Map,Os=(i,s,l)=>{if(i&&(Fs(i,s)||typeof i=="object")){var c=function(v,_){var w=As.get(v);return w||(w=new Map,As.set(v,w)),w.has(_)||w.set(_,[]),w.get(_)}(l,i.constructor.name),d=c.indexOf(i);return d===-1&&(d=c.length,c.push(i)),d}};function Vn(i,s,l){if(i instanceof Array)return i.map(v=>Vn(v,s,l));if(i===null)return i;if(i instanceof Float32Array||i instanceof Float64Array||i instanceof Int32Array||i instanceof Uint32Array||i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Int16Array||i instanceof Int8Array||i instanceof Uint8ClampedArray)return{rr_type:i.constructor.name,args:[Object.values(i)]};if(i instanceof ArrayBuffer)return{rr_type:i.constructor.name,base64:function(v){var _,w=new Uint8Array(v),S=w.length,I="";for(_=0;_<S;_+=3)I+=mn[w[_]>>2],I+=mn[(3&w[_])<<4|w[_+1]>>4],I+=mn[(15&w[_+1])<<2|w[_+2]>>6],I+=mn[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}(i)};if(i instanceof DataView)return{rr_type:i.constructor.name,args:[Vn(i.buffer,s,l),i.byteOffset,i.byteLength]};if(i instanceof HTMLImageElement){var c=i.constructor.name,{src:d}=i;return{rr_type:c,src:d}}return i instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:i.toDataURL()}:i instanceof ImageData?{rr_type:i.constructor.name,args:[Vn(i.data,s,l),i.width,i.height]}:Fs(i,s)||typeof i=="object"?{rr_type:i.constructor.name,index:Os(i,s,l)}:i}var Ns=(i,s,l)=>i.map(c=>Vn(c,s,l)),Fs=(i,s)=>{var l=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(c=>typeof s[c]=="function");return!!l.find(c=>i instanceof s[c])};function Ps(i,s,l,c){var d=[];try{var v=Yr(i.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(!At(this,s,l,!0)){var O=function(B){return B==="experimental-webgl"?"webgl":B}(w);if("__context"in this||(this.__context=O),c&&["webgl","webgl2"].includes(O))if(I[0]&&typeof I[0]=="object"){var X=I[0];X.preserveDrawingBuffer||(X.preserveDrawingBuffer=!0)}else I.splice(0,1,{preserveDrawingBuffer:!0})}return _.apply(this,[w,...I])}});d.push(v)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{d.forEach(_=>_())}}function Ls(i,s,l,c,d,v){var _=[],w=Object.getOwnPropertyNames(i),S=function(E){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(E))return"continue";try{if(typeof i[E]!="function")return"continue";var O=Yr(i,E,function(B){return function(){for(var ie=arguments.length,ge=new Array(ie),oe=0;oe<ie;oe++)ge[oe]=arguments[oe];var N=B.apply(this,ge);if(Os(N,v,this),"tagName"in this.canvas&&!At(this.canvas,c,d,!0)){var A=Ns(ge,v,this),M={type:s,property:E,args:A};l(this.canvas,M)}return N}});_.push(O)}catch{var X=$n(i,E,{set(ie){l(this.canvas,{type:s,property:E,args:[ie],setter:!0})}});_.push(X)}};for(var I of w)S(I);return _}var Ds,st,zn,Gi,Bs="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",Hs=typeof window<"u"&&window.Blob&&new Blob([(Ds=Bs,Uint8Array.from(atob(Ds),i=>i.charCodeAt(0)))],{type:"text/javascript;charset=utf-8"});function Hu(i){var s;try{if(!(s=Hs&&(window.URL||window.webkitURL).createObjectURL(Hs)))throw"";var l=new Worker(s,{name:i==null?void 0:i.name});return l.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(s)}),l}catch{return new Worker("data:text/javascript;base64,"+Bs,{name:i==null?void 0:i.name})}finally{s&&(window.URL||window.webkitURL).revokeObjectURL(s)}}class $u{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:d,blockSelector:v,recordCanvas:_,dataURLOptions:w}=s;this.mutationCb=s.mutationCb,this.mirror=s.mirror,_&&l==="all"&&this.initCanvasMutationObserver(c,d,v),_&&typeof l=="number"&&this.initCanvasFPSObserver(l,c,d,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,d,v){var _=this,w=Ps(l,c,d,!0),S=new Map,I=new Hu;I.onmessage=ie=>{var{id:ge}=ie.data;if(S.set(ge,!1),"base64"in ie.data){var{base64:oe,type:N,width:A,height:M}=ie.data;this.mutationCb({id:ge,type:Zr["2D"],commands:[{property:"clearRect",args:[0,0,A,M]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:oe}],type:N}]},0,0]}]})}};var E,O=1e3/s,X=0,B=ie=>{var ge,oe;X&&ie-X<O||(X=ie,(ge=[],oe=N=>{N.querySelectorAll("canvas").forEach(A=>{At(A,c,d,!0)||ge.push(A)}),N.querySelectorAll("*").forEach(A=>{A.shadowRoot&&oe(A.shadowRoot)})},oe(l.document),ge).forEach(function(){var N=o(function*(A){var M,q=_.mirror.getId(A);if(!S.get(q)&&A.width!==0&&A.height!==0){if(S.set(q,!0),["webgl","webgl2"].includes(A.__context)){var J=A.getContext(A.__context);((M=J==null?void 0:J.getContextAttributes())==null?void 0:M.preserveDrawingBuffer)===!1&&J.clear(J.COLOR_BUFFER_BIT)}var K=A.clientWidth||A.width,Q=A.clientHeight||A.height,re=yield createImageBitmap(A,{resizeWidth:K,resizeHeight:Q});I.postMessage({id:q,bitmap:re,width:K,height:Q,dataURLOptions:v.dataURLOptions},[re])}});return function(A){return N.apply(this,arguments)}}())),E=requestAnimationFrame(B)};E=requestAnimationFrame(B),this.resetObservers=()=>{w(),cancelAnimationFrame(E)}}initCanvasMutationObserver(s,l,c){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var d=Ps(s,l,c,!1),v=function(w,S,I,E){var O=[],X=Object.getOwnPropertyNames(S.CanvasRenderingContext2D.prototype),B=function(ge){try{if(typeof S.CanvasRenderingContext2D.prototype[ge]!="function")return"continue";var oe=Yr(S.CanvasRenderingContext2D.prototype,ge,function(A){return function(){for(var M=arguments.length,q=new Array(M),J=0;J<M;J++)q[J]=arguments[J];return At(this.canvas,I,E,!0)||setTimeout(()=>{var K=Ns(q,S,this);w(this.canvas,{type:Zr["2D"],property:ge,args:K})},0),A.apply(this,q)}});O.push(oe)}catch{var N=$n(S.CanvasRenderingContext2D.prototype,ge,{set(M){w(this.canvas,{type:Zr["2D"],property:ge,args:[M],setter:!0})}});O.push(N)}};for(var ie of X)B(ie);return()=>{O.forEach(ge=>ge())}}(this.processMutation.bind(this),s,l,c),_=function(w,S,I,E){var O=[];return O.push(...Ls(S.WebGLRenderingContext.prototype,Zr.WebGL,w,I,E,S)),S.WebGL2RenderingContext!==void 0&&O.push(...Ls(S.WebGL2RenderingContext.prototype,Zr.WebGL2,w,I,E,S)),()=>{O.forEach(X=>X())}}(this.processMutation.bind(this),s,l,c);this.resetObservers=()=>{d(),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 d=c.map(_=>u(_,p)),{type:v}=c[0];this.mutationCb({id:l,type:v,commands:d}),this.pendingCanvasMutations.delete(s)}}}}class Wu{constructor(s){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new Ru),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 d={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,O)=>({rule:nt(E,S.href),index:O}))})),d.styleIds.push(I)};for(var w of s)_(w);v.length>0&&(d.styles=v),this.adoptedStyleSheetCb(d)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(s){}}class Gu{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(d=>d!==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 Yn=!1;try{if(Array.from([1],i=>2*i)[0]!==2){var ji=document.createElement("iframe");document.body.appendChild(ji),Array.from=((h=ji.contentWindow)==null?void 0:h.Array.from)||Array.from,document.body.removeChild(ji)}}catch(i){console.debug("Unable to override Array.from",i)}var $s,Jr,rr=new bt;function Fr(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{emit:s,checkoutEveryNms:l,checkoutEveryNth:c,blockClass:d="rr-block",blockSelector:v=null,ignoreClass:_="rr-ignore",ignoreSelector:w=null,maskTextClass:S="rr-mask",maskTextSelector:I=null,inlineStylesheet:E=!0,maskAllInputs:O,maskInputOptions:X,slimDOMOptions:B,maskInputFn:ie,maskTextFn:ge,hooks:oe,packFn:N,sampling:A={},dataURLOptions:M={},mousemoveWait:q,recordDOM:J=!0,recordCanvas:K=!1,recordCrossOriginIframes:Q=!1,recordAfter:re=i.recordAfter==="DOMContentLoaded"?i.recordAfter:"load",userTriggeredOnInput:pe=!1,collectFonts:ve=!1,inlineImages:ke=!1,plugins:Z,keepIframeSrcFn:Te=()=>!1,ignoreCSSAttributes:be=new Set([]),errorHandler:we}=i;fn=we;var _e=!Q||window.parent===window,le=!1;if(!_e)try{window.parent.document&&(le=!1)}catch{le=!0}if(_e&&!s)throw new Error("emit function is required");if(!_e&&!le)return()=>{};q!==void 0&&A.mousemove===void 0&&(A.mousemove=q),rr.reset();var te,He=O===!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}:X!==void 0?X:{password:!0},$e=B===!0||B==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:B==="all",headMetaDescKeywords:B==="all",headTitleMutations:B==="all"}:B||{};(function(){var Ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;"NodeList"in Ne&&!Ne.NodeList.prototype.forEach&&(Ne.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in Ne&&!Ne.DOMTokenList.prototype.forEach&&(Ne.DOMTokenList.prototype.forEach=Array.prototype.forEach)})();var Oe=0,V=Ne=>{for(var Nt of Z||[])Nt.eventProcessor&&(Ne=Nt.eventProcessor(Ne));return N&&!le&&(Ne=N(Ne)),Ne};st=(Ne,Nt)=>{var Ie,Fe=Ne;if(Fe.timestamp=Wn(),!((Ie=Nr[0])!=null&&Ie.isFrozen())||Fe.type===Ge.FullSnapshot||Fe.type===Ge.IncrementalSnapshot&&Fe.data.source===Be.Mutation||Nr.forEach(gr=>gr.unfreeze()),_e)s==null||s(V(Fe),Nt);else if(le){var Ht={type:"rrweb",event:V(Fe),origin:window.location.origin,isCheckout:Nt};window.parent.postMessage(Ht,"*")}if(Fe.type===Ge.FullSnapshot)te=Fe,Oe=0;else if(Fe.type===Ge.IncrementalSnapshot){if(Fe.data.source===Be.Mutation&&Fe.data.isAttachIframe)return;Oe++;var nr=c&&Oe>=c,ir=l&&Fe.timestamp-te.timestamp>l;(nr||ir)&&zn(!0)}};var xe=Ne=>{st({type:Ge.IncrementalSnapshot,data:t({source:Be.Mutation},Ne)})},Ot=Ne=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.Scroll},Ne)}),gt=Ne=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.CanvasMutation},Ne)}),it=new Wu({mutationCb:xe,adoptedStyleSheetCb:Ne=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.AdoptedStyleSheet},Ne)})}),ft=new Lu({mirror:rr,mutationCb:xe,stylesheetManager:it,recordCrossOriginIframes:Q,wrappedEmit:st});for(var qt of Z||[])qt.getMirror&&qt.getMirror({nodeMirror:rr,crossOriginIframeMirror:ft.crossOriginIframeMirror,crossOriginIframeStyleMirror:ft.crossOriginIframeStyleMirror});var Xt=new Gu;Gi=new $u({recordCanvas:K,mutationCb:gt,win:window,blockClass:d,blockSelector:v,mirror:rr,sampling:A.canvas,dataURLOptions:M});var ot=new Du({mutationCb:xe,scrollCb:Ot,bypassOptions:{blockClass:d,blockSelector:v,maskTextClass:S,maskTextSelector:I,inlineStylesheet:E,maskInputOptions:He,dataURLOptions:M,maskTextFn:ge,maskInputFn:ie,recordCanvas:K,inlineImages:ke,sampling:A,slimDOMOptions:$e,iframeManager:ft,stylesheetManager:it,canvasManager:Gi,keepIframeSrcFn:Te,processedNodeManager:Xt},mirror:rr});zn=function(){var Ne=arguments.length>0&&arguments[0]!==void 0&&arguments[0];if(J){st({type:Ge.Meta,data:{href:window.location.href,width:gs(),height:ps()}},Ne),it.reset(),ot.init(),Nr.forEach(Ie=>Ie.lock());var Nt=function(Ie,Fe){var{mirror:Ht=new bt,blockClass:nr="rr-block",blockSelector:ir=null,maskTextClass:gr="rr-mask",maskTextSelector:ii=null,inlineStylesheet:po=!0,inlineImages:gc=!1,recordCanvas:fc=!1,maskAllInputs:go=!1,maskTextFn:vc,maskInputFn:mc,slimDOM:yn=!1,dataURLOptions:_c,preserveWhiteSpace:yc,onSerialize:bc,onIframeLoad:wc,iframeLoadTimeout:Sc,onStylesheetLoad:Ic,stylesheetLoadTimeout:Cc,keepIframeSrcFn:Ec=()=>!1}=Fe||{};return Y(Ie,{doc:Ie,mirror:Ht,blockClass:nr,blockSelector:ir,maskTextClass:gr,maskTextSelector:ii,skipChild:!1,inlineStylesheet:po,maskInputOptions:go===!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}:go===!1?{password:!0}:go,maskTextFn:vc,maskInputFn:mc,slimDOMOptions:yn===!0||yn==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:yn==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:yn===!1?{}:yn,dataURLOptions:_c,inlineImages:gc,recordCanvas:fc,preserveWhiteSpace:yc,onSerialize:bc,onIframeLoad:wc,iframeLoadTimeout:Sc,onStylesheetLoad:Ic,stylesheetLoadTimeout:Cc,keepIframeSrcFn:Ec,newlyAddedElement:!1})}(document,{mirror:rr,blockClass:d,blockSelector:v,maskTextClass:S,maskTextSelector:I,inlineStylesheet:E,maskAllInputs:He,maskTextFn:ge,maskInputFn:ie,slimDOM:$e,dataURLOptions:M,recordCanvas:K,inlineImages:ke,onSerialize:Ie=>{ms(Ie,rr)&&ft.addIframe(Ie),_s(Ie,rr)&&it.trackLinkElement(Ie),$i(Ie)&&ot.addShadowRoot(Ae.shadowRoot(Ie),document)},onIframeLoad:(Ie,Fe)=>{ft.attachIframe(Ie,Fe),ot.observeAttachShadow(Ie)},onStylesheetLoad:(Ie,Fe)=>{it.attachLinkElement(Ie,Fe)},keepIframeSrcFn:Te});if(!Nt)return console.warn("Failed to snapshot the document");st({type:Ge.FullSnapshot,data:{node:Nt,initialOffset:hs(window)}},Ne),Nr.forEach(Ie=>Ie.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&it.adoptStyleSheets(document.adoptedStyleSheets,rr.getId(document))}};try{var Pr=[],_n=Ne=>{var Nt;return We(Pu)({mutationCb:xe,mousemoveCb:(Ie,Fe)=>st({type:Ge.IncrementalSnapshot,data:{source:Fe,positions:Ie}}),mouseInteractionCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.MouseInteraction},Ie)}),scrollCb:Ot,viewportResizeCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.ViewportResize},Ie)}),inputCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.Input},Ie)}),mediaInteractionCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.MediaInteraction},Ie)}),styleSheetRuleCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.StyleSheetRule},Ie)}),styleDeclarationCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.StyleDeclaration},Ie)}),canvasMutationCb:gt,fontCb:Ie=>st({type:Ge.IncrementalSnapshot,data:t({source:Be.Font},Ie)}),selectionCb:Ie=>{st({type:Ge.IncrementalSnapshot,data:t({source:Be.Selection},Ie)})},customElementCb:Ie=>{st({type:Ge.IncrementalSnapshot,data:t({source:Be.CustomElement},Ie)})},blockClass:d,ignoreClass:_,ignoreSelector:w,maskTextClass:S,maskTextSelector:I,maskInputOptions:He,inlineStylesheet:E,sampling:A,recordDOM:J,recordCanvas:K,inlineImages:ke,userTriggeredOnInput:pe,collectFonts:ve,doc:Ne,maskInputFn:ie,maskTextFn:ge,keepIframeSrcFn:Te,blockSelector:v,slimDOMOptions:$e,dataURLOptions:M,mirror:rr,iframeManager:ft,stylesheetManager:it,shadowDomManager:ot,processedNodeManager:Xt,canvasManager:Gi,ignoreCSSAttributes:be,plugins:((Nt=Z==null?void 0:Z.filter(Ie=>Ie.observer))==null?void 0:Nt.map(Ie=>({observer:Ie.observer,options:Ie.options,callback:Fe=>st({type:Ge.Plugin,data:{plugin:Ie.name,payload:Fe}})})))||[]},oe)};ft.addLoadListener(Ne=>{try{Pr.push(_n(Ne.contentDocument))}catch(Nt){console.warn(Nt)}});var pr=()=>{zn(),Pr.push(_n(document)),Yn=!0};return document.readyState==="interactive"||document.readyState==="complete"?pr():(Pr.push(Ct("DOMContentLoaded",()=>{st({type:Ge.DomContentLoaded,data:{}}),re==="DOMContentLoaded"&&pr()})),Pr.push(Ct("load",()=>{st({type:Ge.Load,data:{}}),re==="load"&&pr()},window))),()=>{Pr.forEach(Ne=>Ne()),Xt.destroy(),Yn=!1,fn=void 0}}catch(Ne){console.warn(Ne)}}Fr.addCustomEvent=(i,s)=>{if(!Yn)throw new Error("please add custom event after start recording");st({type:Ge.Custom,data:{tag:i,payload:s}})},Fr.freezePage=()=>{Nr.forEach(i=>i.freeze())},Fr.takeFullSnapshot=i=>{if(!Yn)throw new Error("please take full snapshot after start recording");zn(i)},Fr.mirror=rr,(Jr=$s||($s={}))[Jr.NotStarted=0]="NotStarted",Jr[Jr.Running=1]="Running",Jr[Jr.Stopped=2]="Stopped";var Ws,ju=Object.defineProperty,Zn=(i,s,l)=>((c,d,v)=>d in c?ju(c,d,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[d]=v)(i,typeof s!="symbol"?s+"":s,l),qu=Object.defineProperty,qi=(i,s,l)=>((c,d,v)=>d in c?qu(c,d,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[d]=v)(i,typeof s!="symbol"?s+"":s,l),Uu=Object.defineProperty,Gs=(i,s,l)=>((c,d,v)=>d in c?Uu(c,d,{enumerable:!0,configurable:!0,writable:!0,value:v}):c[d]=v)(i,typeof s!="symbol"?s+"":s,l),js={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},qs={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Xn={};function Ui(i){if(Xn[i])return Xn[i];var s=globalThis[i],l=s.prototype,c=i in js?js[i]:void 0,d=!!(c&&c.every(E=>{var O,X;return!!((X=(O=Object.getOwnPropertyDescriptor(l,E))==null?void 0:O.get)!=null&&X.toString().includes("[native code]"))})),v=i in qs?qs[i]:void 0,_=!!(v&&v.every(E=>{var O;return typeof l[E]=="function"&&((O=l[E])==null?void 0:O.toString().includes("[native code]"))}));if(d&&_)return Xn[i]=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[i].prototype;return document.body.removeChild(w),I?Xn[i]=I:l}catch{return l}}var Vi={};function Cr(i,s,l){var c,d="".concat(i,".").concat(String(l));if(Vi[d])return Vi[d].call(s);var v=Ui(i),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(Vi[d]=_,_.call(s)):s[l]}var zi={};function Us(i,s,l){var c="".concat(i,".").concat(String(l));if(zi[c])return zi[c].bind(s);var d=Ui(i)[l];return typeof d!="function"?s[l]:(zi[c]=d,d.bind(s))}var Jn={childNodes:function(i){return Cr("Node",i,"childNodes")},parentNode:function(i){return Cr("Node",i,"parentNode")},parentElement:function(i){return Cr("Node",i,"parentElement")},textContent:function(i){return Cr("Node",i,"textContent")},contains:function(i,s){return Us("Node",i,"contains")(s)},getRootNode:function(i){return Us("Node",i,"getRootNode")()},host:function(i){return i&&"host"in i?Cr("ShadowRoot",i,"host"):null},styleSheets:function(i){return i.styleSheets},shadowRoot:function(i){return i&&"shadowRoot"in i?Cr("Element",i,"shadowRoot"):null},querySelector:function(i,s){return Cr("Element",i,"querySelector")(s)},querySelectorAll:function(i,s){return Cr("Element",i,"querySelectorAll")(s)},mutationObserver:function(){return Ui("MutationObserver").constructor}};class Vu{constructor(){Gs(this,"idNodeMap",new Map),Gs(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 d=this.nodeMetaMap.get(c);d&&this.nodeMetaMap.set(l,d)}this.idNodeMap.set(s,l)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Yi(i,s,l){if(!i)return!1;if(i.nodeType!==i.ELEMENT_NODE)return!!l&&Yi(Jn.parentNode(i),s,l);for(var c=i.classList.length;c--;){var d=i.classList[c];if(s.test(d))return!0}return!!l&&Yi(Jn.parentNode(i),s,l)}class Zi{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 Zi)||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 Vs={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},zs={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Kn={};function Xi(i){if(Kn[i])return Kn[i];var s=globalThis[i],l=s.prototype,c=i in Vs?Vs[i]:void 0,d=!!(c&&c.every(E=>{var O,X;return!!((X=(O=Object.getOwnPropertyDescriptor(l,E))==null?void 0:O.get)!=null&&X.toString().includes("[native code]"))})),v=i in zs?zs[i]:void 0,_=!!(v&&v.every(E=>{var O;return typeof l[E]=="function"&&((O=l[E])==null?void 0:O.toString().includes("[native code]"))}));if(d&&_)return Kn[i]=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[i].prototype;return document.body.removeChild(w),I?Kn[i]=I:l}catch{return l}}var Ji={};function Er(i,s,l){var c,d="".concat(i,".").concat(String(l));if(Ji[d])return Ji[d].call(s);var v=Xi(i),_=(c=Object.getOwnPropertyDescriptor(v,l))==null?void 0:c.get;return _?(Ji[d]=_,_.call(s)):s[l]}var Ki={};function Ys(i,s,l){var c="".concat(i,".").concat(String(l));if(Ki[c])return Ki[c].bind(s);var d=Xi(i)[l];return typeof d!="function"?s[l]:(Ki[c]=d,d.bind(s))}var Zt={childNodes:function(i){return Er("Node",i,"childNodes")},parentNode:function(i){return Er("Node",i,"parentNode")},parentElement:function(i){return Er("Node",i,"parentElement")},textContent:function(i){return Er("Node",i,"textContent")},contains:function(i,s){return Ys("Node",i,"contains")(s)},getRootNode:function(i){return Ys("Node",i,"getRootNode")()},host:function(i){return i&&"host"in i?Er("ShadowRoot",i,"host"):null},styleSheets:function(i){return i.styleSheets},shadowRoot:function(i){return i&&"shadowRoot"in i?Er("Element",i,"shadowRoot"):null},querySelector:function(i,s){return Er("Element",i,"querySelector")(s)},querySelectorAll:function(i,s){return Er("Element",i,"querySelectorAll")(s)},mutationObserver:function(){return Xi("MutationObserver").constructor}},Kr=`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.`,Qi={map:{},getId:()=>(console.error(Kr),-1),getNode:()=>(console.error(Kr),null),removeNodeFromMap(){console.error(Kr)},has:()=>(console.error(Kr),!1),reset(){console.error(Kr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Qi=new Proxy(Qi,{get:(i,s,l)=>(s==="map"&&console.error(Kr),Reflect.get(i,s,l))}));var Zs=Date.now;function Xs(i){return i?i.nodeType===i.ELEMENT_NODE?i:Zt.parentElement(i):null}/[1-9][0-9]{12}/.test(Date.now().toString())||(Zs=()=>new Date().getTime());function Js(i){var s,l=null;return"getRootNode"in i&&((s=Zt.getRootNode(i))==null?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Zt.host(Zt.getRootNode(i))&&(l=Zt.host(Zt.getRootNode(i))),l}function Ks(i){for(var s,l=i;s=Js(l);)l=s;return l}function Qs(i){var s=i.ownerDocument;if(!s)return!1;var l=Ks(i);return Zt.contains(s,l)}for(var zu=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:class{constructor(){qi(this,"id",1),qi(this,"styleIDMap",new WeakMap),qi(this,"idStyleMap",new Map)}getId(i){var s;return(s=this.styleIDMap.get(i))!==null&&s!==void 0?s:-1}has(i){return this.styleIDMap.has(i)}add(i,s){return this.has(i)?this.getId(i):(l=s===void 0?this.id++:s,this.styleIDMap.set(i,l),this.idStyleMap.set(l,i),l);var l}getStyle(i){return this.idStyleMap.get(i)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}},get _mirror(){return Qi},closestElementOfNode:Xs,getBaseDimension:function i(s,l){var c,d,v=(d=(c=s.ownerDocument)==null?void 0:c.defaultView)==null?void 0:d.frameElement;if(!v||v===l)return{x:0,y:0,relativeScale:1,absoluteScale:1};var _=v.getBoundingClientRect(),w=i(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 i(s,l){var c=s[l[0]];return l.length===1?c:i(c.cssRules[l[1]].cssRules,l.slice(2))},getPositionsAndIndex:function(i){var s=[...i],l=s.pop();return{positions:s,index:l}},getRootShadowHost:Ks,getShadowHost:Js,getWindowHeight:function(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight},getWindowScroll:function(i){var s,l,c,d,v=i.document;return{left:v.scrollingElement?v.scrollingElement.scrollLeft:i.pageXOffset!==void 0?i.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:i.pageYOffset!==void 0?i.pageYOffset:(v==null?void 0:v.documentElement.scrollTop)||(v==null?void 0:v.body)&&((c=Zt.parentElement(v.body))==null?void 0:c.scrollTop)||((d=v==null?void 0:v.body)==null?void 0:d.scrollTop)||0}},getWindowWidth:function(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth},hasShadowRoot:function(i){return!!i&&(i instanceof Zi&&"shadowRoot"in i?!!i.shadowRoot:!!Zt.shadowRoot(i))},hookSetter:function i(s,l,c,d){var v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:window,_=v.Object.getOwnPropertyDescriptor(s,l);return v.Object.defineProperty(s,l,d?c:{set(w){setTimeout(()=>{c.set.call(this,w)},0),_&&_.set&&_.set.call(this,w)}}),()=>i(s,l,_||{},!0)},inDom:function(i){var s=i.ownerDocument;return!!s&&(Zt.contains(s,i)||Qs(i))},isAncestorRemoved:function i(s,l){if(d=(c=s)&&"host"in c&&"mode"in c&&Jn.host(c)||null,!!(d&&"shadowRoot"in d&&Jn.shadowRoot(d)===c))return!1;var c,d,v=l.getId(s);if(!l.has(v))return!0;var _=Zt.parentNode(s);return(!_||_.nodeType!==s.DOCUMENT_NODE)&&(!_||i(_,l))},isBlocked:function(i,s,l,c){if(!i)return!1;var d=Xs(i);if(!d)return!1;try{if(typeof s=="string"){if(d.classList.contains(s)||c&&d.closest("."+s)!==null)return!0}else if(Yi(d,s,c))return!0}catch{}return!!(l&&(d.matches(l)||c&&d.closest(l)!==null))},isIgnored:function(i,s,l){return!(i.tagName!=="TITLE"||!l.headTitleMutations)||s.getId(i)===-2},isSerialized:function(i,s){return s.getId(i)!==-1},isSerializedIframe:function(i,s){return!!(i.nodeName==="IFRAME"&&s.getMeta(i))},isSerializedStylesheet:function(i,s){return!!(i.nodeName==="LINK"&&i.nodeType===i.ELEMENT_NODE&&i.getAttribute&&i.getAttribute("rel")==="stylesheet"&&s.getMeta(i))},iterateResolveTree:function i(s,l){l(s.value);for(var c=s.children.length-1;c>=0;c--)i(s.children[c],l)},legacy_isTouchEvent:function(i){return!!i.changedTouches},get nowTimestamp(){return Zs},on:function(i,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:document,c={capture:!0,passive:!0};return l.addEventListener(i,s,c),()=>l.removeEventListener(i,s,c)},patch:function(i,s,l){try{if(!(s in i))return()=>{};var c=i[s],d=l(c);return typeof d=="function"&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:c}})),i[s]=d,()=>{i[s]=c}}catch{return()=>{}}},polyfill:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window;"NodeList"in i&&!i.NodeList.prototype.forEach&&(i.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in i&&!i.DOMTokenList.prototype.forEach&&(i.DOMTokenList.prototype.forEach=Array.prototype.forEach)},queueToResolveTrees:function(i){var s={},l=(O,X)=>{var B={value:O,parent:X,children:[]};return s[O.node.id]=B,B},c=[];for(var d of i){var{nextId:v,parentId:_}=d;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(d,w.parent))}else{var I=c.indexOf(w);c.splice(I,0,l(d,null))}}else if(_ in s){var E=s[_];E.children.push(l(d,E))}else c.push(l(d,null))}return c},shadowHostInDom:Qs,throttle:function(i,s){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=null,d=0;return function(){for(var v=arguments.length,_=new Array(v),w=0;w<v;w++)_[w]=arguments[w];var S=Date.now();d||l.leading!==!1||(d=S);var I=s-(S-d),E=this;I<=0||I>s?(c&&(clearTimeout(c),c=null),d=S,i.apply(E,_)):c||l.trailing===!1||(c=setTimeout(()=>{d=l.leading===!1?0:Date.now(),c=null,i.apply(E,_)},I))}},uniqueTextMutations:function(i){for(var s=new Set,l=[],c=i.length;c--;){var d=i[c];s.has(d.id)||(l.push(d),s.add(d.id))}return l}},Symbol.toStringTag,{value:"Module"})),Yu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zu=typeof Uint8Array>"u"?[]:new Uint8Array(256),Qn=0;Qn<64;Qn++)Zu[Yu.charCodeAt(Qn)]=Qn;var ea;typeof window<"u"&&window.Blob&&new Blob([(i=>Uint8Array.from(atob(i),s=>s.charCodeAt(0)))("KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=")],{type:"text/javascript;charset=utf-8"});try{if(Array.from([1],i=>2*i)[0]!==2){var eo=document.createElement("iframe");document.body.appendChild(eo),Array.from=((Ws=eo.contentWindow)==null?void 0:Ws.Array.from)||Array.from,document.body.removeChild(eo)}}catch(i){console.debug("Unable to override Array.from",i)}new Vu,function(i){i[i.NotStarted=0]="NotStarted",i[i.Running=1]="Running",i[i.Stopped=2]="Stopped"}(ea||(ea={}));class Qr{constructor(s){Zn(this,"fileName"),Zn(this,"functionName"),Zn(this,"lineNumber"),Zn(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 Xu=/(^|@)\S+:\d+/,ta=/^\s*at .*(\S+:\d+|\(native\))/m,Ju=/^(eval@)?(\[native code])?$/,to={parse:function(i){return i?i.stacktrace!==void 0||i["opera#sourceloc"]!==void 0?this.parseOpera(i):i.stack&&i.stack.match(ta)?this.parseV8OrIE(i):i.stack?this.parseFFOrSafari(i):(console.warn("[console-record-plugin]: Failed to parse error object:",i),[]):[]},extractLocation:function(i){if(i.indexOf(":")===-1)return[i];var s=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(i.replace(/[()]/g,""));if(!s)throw new Error("Cannot parse given url: ".concat(i));return[s[1],s[2]||void 0,s[3]||void 0]},parseV8OrIE:function(i){return i.stack.split(` `).filter(function(s){return!!s.match(ta)},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+)\)$)/),d=(l=c?l.replace(c[0],""):l).split(/\s+/).slice(1),v=this.extractLocation(c?c[1]:d.pop()),_=d.join(" ")||void 0,w=["eval","<anonymous>"].indexOf(v[0])>-1?void 0:v[0];return new Qr({functionName:_,fileName:w,lineNumber:v[1],columnNumber:v[2]})},this)},parseFFOrSafari:function(i){return i.stack.split(` `).filter(function(s){return!s.match(Ju)},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 Qr({functionName:s});var l=/((.*".+"[^@]*)?[^@]*)(?:@)/,c=s.match(l),d=c&&c[1]?c[1]:void 0,v=this.extractLocation(s.replace(l,""));return new Qr({functionName:d,fileName:v[0],lineNumber:v[1],columnNumber:v[2]})},this)},parseOpera:function(i){return!i.stacktrace||i.message.indexOf(` `)>-1&&i.message.split(` `).length>i.stacktrace.split(` `).length?this.parseOpera9(i):i.stack?this.parseOpera11(i):this.parseOpera10(i)},parseOpera9:function(i){for(var s=/Line (\d+).*script (?:in )?(\S+)/i,l=i.message.split(` `),c=[],d=2,v=l.length;d<v;d+=2){var _=s.exec(l[d]);_&&c.push(new Qr({fileName:_[2],lineNumber:parseFloat(_[1])}))}return c},parseOpera10:function(i){for(var s=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,l=i.stacktrace.split(` `),c=[],d=0,v=l.length;d<v;d+=2){var _=s.exec(l[d]);_&&c.push(new Qr({functionName:_[3]||void 0,fileName:_[2],lineNumber:parseFloat(_[1])}))}return c},parseOpera11:function(i){return i.stack.split(` `).filter(function(s){return!!s.match(Xu)&&!s.match(/^Error created at/)},this).map(function(s){var l=s.split("@"),c=this.extractLocation(l.pop()),d=(l.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Qr({functionName:d,fileName:c[0],lineNumber:c[1],columnNumber:c[2]})},this)}};function Ku(i){if(!i||!i.outerHTML)return"";for(var s="";i.parentElement;){var l=i.localName;if(!l)break;l=l.toLowerCase();var c=i.parentElement,d=[];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&&d.push(_)}d.length>1&&(l+=":eq(".concat(d.indexOf(i),")")),s=l+(s?">"+s:""),i=c}return s}function ro(i){return Object.prototype.toString.call(i)==="[object Object]"}function ra(i,s){if(s===0)return!0;var l=Object.keys(i);for(var c of l)if(ro(i[c])&&ra(i[c],s-1))return!0;return!1}function en(i,s){var l={numOfKeysLimit:50,depthOfLimit:4};Object.assign(l,s);var c=[],d=[];return JSON.stringify(i,function(v,_){if(c.length>0){var w=c.indexOf(this);~w?c.splice(w+1):c.push(this),~w?d.splice(w,1/0,v):d.push(v),~c.indexOf(_)&&(_=c[0]===_?"[Circular ~]":"[Circular ~."+d.slice(0,c.indexOf(_)).join(".")+"]")}else c.push(_);if(_===null)return _;if(_===void 0)return"undefined";if(function(O){return!!(ro(O)&&Object.keys(O).length>l.numOfKeysLimit||typeof O=="function"||ro(O)&&ra(O,l.depthOfLimit))}(_))return function(O){var X=O.toString();return l.stringLengthLimit&&X.length>l.stringLengthLimit&&(X="".concat(X.slice(0,l.stringLengthLimit),"...")),X}(_);if(typeof _=="bigint")return _.toString()+"n";if(_ instanceof Event){var S={};for(var I in _){var E=_[I];Array.isArray(E)?S[I]=Ku(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 na={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 Qu(i,s,l){var c,d=l?Object.assign({},na,l):na,v=d.logger;if(!v)return()=>{};c=typeof v=="string"?s[v]:v;var _=0,w=!1,S=[];if(d.level.includes("error")){var I=B=>{var ie=B.message,ge=B.error,oe=to.parse(ge).map(A=>A.toString()),N=[en(ie,d.stringifyOptions)];i({level:"error",trace:oe,payload:N})};s.addEventListener("error",I),S.push(()=>{s.removeEventListener("error",I)});var E=B=>{var ie,ge;B.reason instanceof Error?(ie=B.reason,ge=[en("Uncaught (in promise) ".concat(ie.name,": ").concat(ie.message),d.stringifyOptions)]):(ie=new Error,ge=[en("Uncaught (in promise)",d.stringifyOptions),en(B.reason,d.stringifyOptions)]);var oe=to.parse(ie).map(N=>N.toString());i({level:"error",trace:oe,payload:ge})};s.addEventListener("unhandledrejection",E),S.push(()=>{s.removeEventListener("unhandledrejection",E)})}for(var O of d.level)S.push(X(c,O));return()=>{S.forEach(B=>B())};function X(B,ie){var ge=this;return B[ie]?zu.patch(B,ie,oe=>function(){for(var N=arguments.length,A=new Array(N),M=0;M<N;M++)A[M]=arguments[M];if(oe.apply(ge,A),!(ie==="assert"&&A[0]||w)){w=!0;try{var q=to.parse(new Error).map(K=>K.toString()).splice(1),J=(ie==="assert"?A.slice(1):A).map(K=>en(K,d.stringifyOptions));++_<d.lengthThreshold?i({level:ie,trace:q,payload:J}):_===d.lengthThreshold&&i({level:"warn",trace:[],payload:[en("The number of log records reached the threshold.")]})}catch(K){oe("rrweb logger error:",K,...A)}finally{w=!1}}}):()=>{}}}var ia=i=>({name:"rrweb/console@1",observer:Qu,options:i}),hr=typeof window<"u"?window:void 0,Bt=typeof globalThis<"u"?globalThis:hr,oa=Array.prototype.forEach,sa=Bt==null?void 0:Bt.navigator;Bt==null||Bt.document,Bt==null||Bt.location,Bt==null||Bt.fetch,Bt!=null&&Bt.XMLHttpRequest&&"withCredentials"in new Bt.XMLHttpRequest&&Bt.XMLHttpRequest,Bt==null||Bt.AbortController,sa==null||sa.userAgent;var aa,kr=hr??{},la=i=>{var s={_log:function(l){if(hr&&kr.POSTHOG_DEBUG&&!Tr(hr.console)&&hr.console){for(var c=("__rrweb_original__"in hr.console[l])?hr.console[l].__rrweb_original__:hr.console[l],d=arguments.length,v=new Array(d>1?d-1:0),_=1;_<d;_++)v[_-1]=arguments[_];c(i,...v)}},info:function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];s._log("log",...c)},warn:function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];s._log("warn",...c)},error:function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];s._log("error",...c)},critical:function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];console.error(i,...c)},uninitializedWarning:l=>{s.error("You must initialize PostHog before calling ".concat(l))},createLogger:l=>la("".concat(i," ").concat(l))};return s},ec=la("[PostHog.js]").createLogger,no={};function tc(i,s,l){if(!ca(i)){if(ei(i))return function(v,_,w){if(ei(v)){if(oa&&v.forEach===oa)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)===no)return}}}(i,s,l);if(da(i)){for(var c of i.entries())if(s.call(l,c[1],c[0])===no)return}else for(var d in i)if(nc.call(i,d)&&s.call(l,i[d],d)===no)return}}(function(i){i.GZipJS="gzip-js",i.Base64="base64"})(aa||(aa={}));var rc=Array.isArray,ua=Object.prototype,nc=ua.hasOwnProperty,io=ua.toString,ei=rc||function(i){return io.call(i)==="[object Array]"},ic=i=>typeof i=="function",oc=i=>i===Object(i)&&!ei(i),Tr=i=>i===void 0,sc=i=>io.call(i)=="[object String]",oo=i=>i===null,ca=i=>Tr(i)||oo(i),so=i=>io.call(i)==="[object Boolean]",ac=i=>i instanceof Document,da=i=>i instanceof FormData,lc=function(i){var s,l,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",d=[];return tc(i,function(v,_){Tr(v)||Tr(_)||_==="undefined"||(s=encodeURIComponent(v instanceof File?v.name:v.toString()),l=encodeURIComponent(_),d[d.length]=l+"="+s)}),d.join(c)},ha={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:i=>i,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]};function pa(i,s,l){try{if(!(s in i))return()=>{};var c=i[s],d=l(c);return ic(d)&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[s]=d,()=>{i[s]=c}}catch{return()=>{}}}function ao(i,s){var l,c=function(_){try{return typeof _=="string"?new URL(_).hostname:"url"in _?new URL(_.url).hostname:_.hostname}catch{return null}}(i),d={hostname:c,isHostDenied:!1};if((l=s.payloadHostDenyList)===null||l===void 0||!l.length||c==null||!c.trim().length)return d;for(var v of s.payloadHostDenyList)if(c.endsWith(v))return{hostname:c,isHostDenied:!0};return d}var ga=ec("[Recorder]"),fa=i=>i.entryType==="navigation",lo=i=>i.entryType==="resource";function va(i,s){for(var l=i.length-1;l>=0;l-=1)if(s(i[l]))return i[l]}function uc(i,s,l){if(l.recordInitialRequests){var c=s.performance.getEntries().filter(_=>fa(_)||lo(_)&&l.initiatorTypes.includes(_.initiatorType));i({requests:c.flatMap(_=>ni({entry:_,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}var d=new s.PerformanceObserver(_=>{var w=_.getEntries().filter(S=>fa(S)||lo(S)&&l.initiatorTypes.includes(S.initiatorType)&&(I=>!l.recordBody&&!l.recordHeaders||I.initiatorType!=="xmlhttprequest"&&I.initiatorType!=="fetch")(S));i({requests:w.flatMap(S=>ni({entry:S,method:void 0,status:void 0,networkRequest:{}}))})}),v=PerformanceObserver.supportedEntryTypes.filter(_=>l.performanceEntryTypeToObserve.includes(_));return d.observe({entryTypes:v}),()=>{d.disconnect()}}function ti(i,s){return!!s&&(so(s)||s[i])}function ri(i){var{type:s,recordBody:l,headers:c}=i;function d(_){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(so(l))return!0;if(ei(l))return d(l);var v=l[s];return so(v)?v:d(v)}function uo(i,s,l,c,d){return co.apply(this,arguments)}function co(){return co=o(function*(i,s,l,c,d){var v=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0;if(v>10)return ga.warn("Failed to get performance entry for request",{url:l,initiatorType:s}),null;var _=va(i.performance.getEntriesByName(l),w=>lo(w)&&w.initiatorType===s&&(Tr(c)||w.startTime>=c)&&(Tr(d)||w.startTime<=d));return _||(yield new Promise(w=>setTimeout(w,50*v)),uo(i,s,l,c,d,v+1))}),co.apply(this,arguments)}function ma(i){var{body:s,options:l,url:c}=i;if(ca(s))return null;var{hostname:d,isHostDenied:v}=ao(c,l);if(v)return d+" is in deny list";if(sc(s))return s;if(ac(s))return s.textContent;if(da(s))return lc(s);if(oc(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 cc=i=>!oo(i)&&(i.entryType==="navigation"||i.entryType==="resource");function ni(i){var{entry:s,method:l,status:c,networkRequest:d,isInitial:v,start:_,end:w,url:S,initiatorType:I}=i;_=s?s.startTime:_,w=s?s.responseEnd:w;var E=Math.floor(Date.now()-performance.now()),O=Math.floor(E+(_||0)),X=[t(t({},s?s.toJSON():{name:S}),{},{startTime:Tr(_)?void 0:Math.round(_),endTime:Tr(w)?void 0:Math.round(w),timeOrigin:E,timestamp:O,method:l,initiatorType:I||(s?s.initiatorType:void 0),status:c,requestHeaders:d.requestHeaders,requestBody:d.requestBody,responseHeaders:d.responseHeaders,responseBody:d.responseBody,isInitial:v})];if(cc(s))for(var B of s.serverTiming||[])X.push({timeOrigin:E,timestamp:O,startTime:Math.round(s.startTime),name:B.name,duration:B.duration,entryType:"serverTiming"});return X}var dc=["video/","audio/"];function _a(i){return new Promise((s,l)=>{var c=setTimeout(()=>s("[SessionReplay] Timeout while trying to read body"),500);try{i.clone().text().then(d=>s(d),d=>l(d)).finally(()=>clearTimeout(c))}catch{clearTimeout(c),s("[SessionReplay] Failed to read body")}})}function ya(){return(ya=o(function*(i){var{r:s,options:l,url:c}=i,{hostname:d,isHostDenied:v}=ao(c,l);return v?Promise.resolve(d+" is in deny list"):_a(s)})).apply(this,arguments)}function ba(){return(ba=o(function*(i){var{r:s,options:l,url:c}=i,d=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(),O=dc.some(ie=>E==null?void 0:E.startsWith(ie));if(E&&O)return"Content-Type ".concat(E," is not supported");var{hostname:X,isHostDenied:B}=ao(I,S);return B?X+" is in deny list":null}({r:s,options:l,url:c});return oo(d)?_a(s):Promise.resolve(d)})).apply(this,arguments)}function hc(i,s,l){if(!l.initiatorTypes.includes("fetch"))return()=>{};var c=ti("request",l.recordHeaders),d=ti("response",l.recordHeaders),v=pa(s,"fetch",_=>function(){var w=o(function*(S,I){var E,O,X,B=new Request(S,I),ie={};try{var ge={};B.headers.forEach((N,A)=>{ge[A]=N}),c&&(ie.requestHeaders=ge),ri({type:"request",headers:ge,url:S,recordBody:l.recordBody})&&(ie.requestBody=yield function(N){return ya.apply(this,arguments)}({r:B,options:l,url:S})),O=s.performance.now(),E=yield _(B),X=s.performance.now();var oe={};return E.headers.forEach((N,A)=>{oe[A]=N}),d&&(ie.responseHeaders=oe),ri({type:"response",headers:oe,url:S,recordBody:l.recordBody})&&(ie.responseBody=yield function(N){return ba.apply(this,arguments)}({r:E,options:l,url:S})),E}finally{uo(s,"fetch",B.url,O,X).then(N=>{var A,M=ni({entry:N,method:B.method,status:(A=E)===null||A===void 0?void 0:A.status,networkRequest:ie,start:O,end:X,url:B.url,initiatorType:"fetch"});i({requests:M})}).catch(()=>{})}});return function(S,I){return w.apply(this,arguments)}}());return()=>{v()}}var wa=null;function pc(i,s,l){if(!("performance"in s))return()=>{};if(wa)return ga.warn("Network observer already initialised, doing nothing"),()=>{};var c=l?Object.assign({},ha,l):ha,d=S=>{var I=[];S.requests.forEach(E=>{var O=c.maskRequestFn(E);O&&I.push(O)}),I.length>0&&i(t(t({},S),{},{requests:I}))},v=uc(d,s,c),_=()=>{},w=()=>{};return(c.recordHeaders||c.recordBody)&&(_=function(S,I,E){if(!E.initiatorTypes.includes("xmlhttprequest"))return()=>{};var O=ti("request",E.recordHeaders),X=ti("response",E.recordHeaders),B=pa(I.XMLHttpRequest.prototype,"open",ie=>function(ge,oe){var N,A,M=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],q=arguments.length>3?arguments[3]:void 0,J=arguments.length>4?arguments[4]:void 0,K=this,Q=new Request(oe),re={},pe={},ve=K.setRequestHeader.bind(K);K.setRequestHeader=(Z,Te)=>(pe[Z]=Te,ve(Z,Te)),O&&(re.requestHeaders=pe);var ke=K.send.bind(K);K.send=Z=>(ri({type:"request",headers:pe,url:oe,recordBody:E.recordBody})&&(re.requestBody=ma({body:Z,options:E,url:oe})),N=I.performance.now(),ke(Z)),K.addEventListener("readystatechange",()=>{if(K.readyState===K.DONE){A=I.performance.now();var Z={};K.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(Te=>{var be=Te.split(": "),we=be.shift(),_e=be.join(": ");we&&(Z[we]=_e)}),X&&(re.responseHeaders=Z),ri({type:"response",headers:Z,url:oe,recordBody:E.recordBody})&&(re.responseBody=ma({body:K.response,options:E,url:oe})),uo(I,"xmlhttprequest",Q.url,N,A).then(Te=>{var be=ni({entry:Te,method:ge,status:K==null?void 0:K.status,networkRequest:re,start:N,end:A,url:oe.toString(),initiatorType:"xmlhttprequest"});S({requests:be})}).catch(()=>{})}}),ie.call(K,ge,oe,M,q,J)});return()=>{B()}}(d,s,c),w=hc(d,s,c)),wa=()=>{v(),_(),w()}}var Sa="rrweb/network@1",ho=i=>({name:Sa,observer:pc,options:i});kr.__PosthogExtensions__=kr.__PosthogExtensions__||{},kr.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:ia,getRecordNetworkPlugin:ho},kr.__PosthogExtensions__.rrweb={record:Fr,version:"v2"},kr.rrweb={record:Fr,version:"v2"},kr.rrwebConsoleRecord={getRecordConsolePlugin:ia},kr.getRecordNetworkPlugin=ho,n.NETWORK_PLUGIN_NAME=Sa,n.default=Fr,n.findLast=va,n.getRecordNetworkPlugin=ho,Object.defineProperty(n,"__esModule",{value:!0})})({});(function(){function n(F,x){var L=Object.keys(F);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);x&&(H=H.filter(function(ee){return Object.getOwnPropertyDescriptor(F,ee).enumerable})),L.push.apply(L,H)}return L}function e(F){for(var x=1;x<arguments.length;x++){var L=arguments[x]!=null?arguments[x]:{};x%2?n(Object(L),!0).forEach(function(H){t(F,H,L[H])}):Object.getOwnPropertyDescriptors?Object.defineProperties(F,Object.getOwnPropertyDescriptors(L)):n(Object(L)).forEach(function(H){Object.defineProperty(F,H,Object.getOwnPropertyDescriptor(L,H))})}return F}function t(F,x,L){return x in F?Object.defineProperty(F,x,{value:L,enumerable:!0,configurable:!0,writable:!0}):F[x]=L,F}var r=typeof window<"u"?window:void 0,o=typeof globalThis<"u"?globalThis:r,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,h=r??{},p=F=>{var x={_log:function(L){if(r&&h.POSTHOG_DEBUG&&!j(r.console)&&r.console){for(var H=("__rrweb_original__"in r.console[L])?r.console[L].__rrweb_original__:r.console[L],ee=arguments.length,he=new Array(ee>1?ee-1:0),Re=1;Re<ee;Re++)he[Re-1]=arguments[Re];H(F,...he)}},info:function(){for(var L=arguments.length,H=new Array(L),ee=0;ee<L;ee++)H[ee]=arguments[ee];x._log("log",...H)},warn:function(){for(var L=arguments.length,H=new Array(L),ee=0;ee<L;ee++)H[ee]=arguments[ee];x._log("warn",...H)},error:function(){for(var L=arguments.length,H=new Array(L),ee=0;ee<L;ee++)H[ee]=arguments[ee];x._log("error",...H)},critical:function(){for(var L=arguments.length,H=new Array(L),ee=0;ee<L;ee++)H[ee]=arguments[ee];console.error(F,...H)},uninitializedWarning:L=>{x.error("You must initialize PostHog before calling ".concat(L))},createLogger:L=>p("".concat(F," ").concat(L))};return x},m=p("[PostHog.js]").createLogger;(function(F){F.GZipJS="gzip-js",F.Base64="base64"})(u||(u={}));var g=["fatal","error","warning","log","info","debug"],f=Array.isArray,b=Object.prototype.toString,y=f||function(F){return b.call(F)==="[object Array]"},k=F=>typeof F=="function",T=F=>F===Object(F)&&!y(F),j=F=>F===void 0,$=F=>b.call(F)=="[object String]",G=F=>$(F)&&F.trim().length===0,ce=F=>F===null;function se(F){return!j(Event)&&Ee(F,Event)}function Ee(F,x){try{return F instanceof x}catch{return!1}}function qe(F){return ce(F)||!T(F)&&!k(F)}function ye(F,x){return Object.prototype.toString.call(F)==="[object ".concat(x,"]")}function Se(F){return ye(F,"DOMError")}var Le=/\(error: (.*)\)/,je=50,Ye="?";function nt(F,x,L,H){var ee={platform:"web:javascript",filename:F,function:x==="<anonymous>"?Ye:x,in_app:!0};return j(L)||(ee.lineno=L),j(H)||(ee.colno=H),ee}var dt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,bt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ze=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ht=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Tt=function(){for(var F=arguments.length,x=new Array(F),L=0;L<F;L++)x[L]=arguments[L];var H=x.sort((ee,he)=>ee[0]-he[0]).map(ee=>ee[1]);return function(ee){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Re=[],Xe=ee.split(` `),Pe=he;Pe<Xe.length;Pe++){var R=Xe[Pe];if(!(R.length>1024)){var z=Le.test(R)?R.replace(Le,"$1"):R;if(!z.match(/\S*Error: /)){for(var P of H){var Y=P(z);if(Y){Re.push(Y);break}}if(Re.length>=je)break}}}return function(W){if(!W.length)return[];var ue=Array.from(W);return ue.reverse(),ue.slice(0,je).map(ae=>e(e({},ae),{},{filename:ae.filename||wt(ue).filename,function:ae.function||Ye}))}(Re)}}([30,F=>{var x=dt.exec(F);if(x){var[,L,H,ee]=x;return nt(L,Ye,+H,+ee)}var he=bt.exec(F);if(he){if(he[2]&&he[2].indexOf("eval")===0){var Re=mt.exec(he[2]);Re&&(he[2]=Re[1],he[3]=Re[2],he[4]=Re[3])}var[Xe,Pe]=xt(he[1]||Ye,he[2]);return nt(Pe,Xe,he[3]?+he[3]:void 0,he[4]?+he[4]:void 0)}}],[50,F=>{var x=Ze.exec(F);if(x){if(x[3]&&x[3].indexOf(" > eval")>-1){var L=ht.exec(x[3]);L&&(x[1]=x[1]||"eval",x[3]=L[1],x[4]=L[2],x[5]="")}var H=x[3],ee=x[1]||Ye;return[ee,H]=xt(ee,H),nt(H,ee,x[4]?+x[4]:void 0,x[5]?+x[5]:void 0)}}]);function wt(F){return F[F.length-1]||{}}var xt=(F,x)=>{var L=F.indexOf("safari-extension")!==-1,H=F.indexOf("safari-web-extension")!==-1;return L||H?[F.indexOf("@")!==-1?F.split("@")[0]:Ye,L?"safari-extension:".concat(x):"safari-web-extension:".concat(x)]:[F,x]},zt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function tt(F){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,L=F.stacktrace||F.stack||"",H=function(he){return he&&pt.test(he.message)?1:0}(F);try{var ee=Tt(L,H);return ee.slice(0,ee.length-x)}catch{}return[]}var pt=/Minified React error #\d+;/i;function ze(F,x){var L,H,ee=tt(F),he=(L=x==null?void 0:x.handled)===null||L===void 0||L,Re=(H=x==null?void 0:x.synthetic)!==null&&H!==void 0&&H;return{$exception_list:[{type:x!=null&&x.overrideExceptionType?x.overrideExceptionType:F.name,value:x!=null&&x.overrideExceptionMessage?x.overrideExceptionMessage:function(Xe){var Pe=Xe.message;return Pe.error&&typeof Pe.error.message=="string"?Pe.error.message:Pe}(F),stacktrace:{frames:ee,type:"raw"},mechanism:{handled:he,synthetic:Re}}],$exception_level:"error"}}function Je(F,x){var L,H,ee,he=(L=x==null?void 0:x.handled)===null||L===void 0||L,Re=(H=x==null?void 0:x.synthetic)===null||H===void 0||H,Xe={type:x!=null&&x.overrideExceptionType?x.overrideExceptionType:(ee=x==null?void 0:x.defaultExceptionType)!==null&&ee!==void 0?ee:"Error",value:x!=null&&x.overrideExceptionMessage?x.overrideExceptionMessage:F||(x==null?void 0:x.defaultExceptionMessage),mechanism:{handled:he,synthetic:Re}};if(x!=null&&x.syntheticException){var Pe=tt(x.syntheticException,1);Pe.length&&(Xe.stacktrace={frames:Pe,type:"raw"})}return{$exception_list:[Xe],$exception_level:"error"}}function St(F,x){var L,H,ee,he=(L=x==null?void 0:x.handled)===null||L===void 0||L,Re=(H=x==null?void 0:x.synthetic)===null||H===void 0||H,Xe=x!=null&&x.overrideExceptionType?x.overrideExceptionType:se(F)?F.constructor.name:"Error",Pe=x!=null&&x.overrideExceptionMessage?x.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(P){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,W=Object.keys(P);if(W.sort(),!W.length)return"[object has no keys]";for(var ue=W.length;ue>0;ue--){var ae=W.slice(0,ue).join(", ");if(!(ae.length>Y))return ue===W.length||ae.length<=Y?ae:"".concat(ae.slice(0,Y),"...")}return""}(F)),R={type:Xe,value:Pe,mechanism:{handled:he,synthetic:Re}};if(x!=null&&x.syntheticException){var z=tt(x==null?void 0:x.syntheticException,1);z.length&&(R.stacktrace={frames:z,type:"raw"})}return{$exception_list:[R],$exception_level:(ee=F.level,$(ee)&&!G(ee)&&g.indexOf(ee)>=0?F.level:"error")}}function Mt(F,x){var[L,H,ee,he,Re]=F,Xe={$exception_list:[]},Pe=Re||L;if(Se(Pe)||function(de){return ye(de,"DOMException")}(Pe)){var R=Pe;if(function(de){return"stack"in de}(Pe))Xe=ze(Pe,x);else{var z=R.name||(Se(R)?"DOMError":"DOMException"),P=R.message?"".concat(z,": ").concat(R.message):z,Y=Se(R)?"DOMError":"DOMException";Xe=Je(P,e(e({},x),{},{overrideExceptionType:Y,defaultExceptionMessage:P}))}return"code"in R&&(Xe.$exception_DOMException_code="".concat(R.code)),Xe}if(function(de){return ye(de,"ErrorEvent")}(Pe)&&Pe.error)return ze(Pe.error,x);if(function(de){switch(Object.prototype.toString.call(de)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Ee(de,Error)}}(Pe))return ze(Pe,x);if(function(de){return ye(de,"Object")}(Pe)||se(Pe))return St(Pe,x);if(j(Re)&&$(L)){var W="Error",ue=L,ae=L.match(zt);return ae&&(W=ae[1],ue=ae[2]),Je(ue,e(e({},x),{},{overrideExceptionType:W,defaultExceptionMessage:ue}))}return Je(Pe,x)}function cr(F){var[x]=F,L=function(H){if(qe(H))return H;try{if("reason"in H)return H.reason;if("detail"in H&&"reason"in H.detail)return H.detail.reason}catch{}return H}(x);return qe(L)?Je("Non-Error promise rejection captured with value: ".concat(String(L)),{handled:!1,synthetic:!1,overrideExceptionType:"UnhandledRejection"}):Mt([L],{handled:!1,overrideExceptionType:"UnhandledRejection",defaultExceptionMessage:String(L)})}var Yt=m("[ExceptionAutocapture]"),It={wrapOnError:F=>{var x=r;x||Yt.info("window not available, cannot wrap onerror");var L=x.onerror;return x.onerror=function(){for(var H,ee=arguments.length,he=new Array(ee),Re=0;Re<ee;Re++)he[Re]=arguments[Re];var Xe=Mt(he);return F(Xe),(H=L==null?void 0:L(...he))!==null&&H!==void 0&&H},x.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var H;(H=x.onerror)===null||H===void 0||delete H.__POSTHOG_INSTRUMENTED__,x.onerror=L}},wrapUnhandledRejection:F=>{var x=r;x||Yt.info("window not available, cannot wrap onUnhandledRejection");var L=x.onunhandledrejection;return x.onunhandledrejection=function(){for(var H,ee=arguments.length,he=new Array(ee),Re=0;Re<ee;Re++)he[Re]=arguments[Re];var Xe=cr(he);return F(Xe),(H=L==null?void 0:L.apply(x,he))!==null&&H!==void 0&&H},x.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var H;(H=x.onunhandledrejection)===null||H===void 0||delete H.__POSTHOG_INSTRUMENTED__,x.onunhandledrejection=L}}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=It,h.__PosthogExtensions__.parseErrorAsProperties=Mt,h.posthogErrorWrappingFunctions=It,h.parseErrorAsProperties=Mt})();(function(){function n(m,g,f,b,y,k,T){try{var j=m[k](T),$=j.value}catch(G){return void f(G)}j.done?g($):Promise.resolve($).then(b,y)}var e=typeof window<"u"?window:void 0,t=typeof globalThis<"u"?globalThis:e,r=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,r==null||r.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 h=(m,g)=>{if(m){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 h(m,T),g(T)},function(){var y=this,k=arguments;return new Promise(function(T,j){var $=f.apply(y,k);function G(se){n($,T,j,G,ce,"next",se)}function ce(se){n($,T,j,G,ce,"throw",se)}G(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,j=new Request(b);return h(m,j),g.call(this,f,j.url,y,k,T)})};a.__PosthogExtensions__.tracingHeadersPatchFns=p,a.postHogTracingHeadersPatchFns=p})();(function(){var n,e,t,r=function(){var R=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(R&&R.responseStart>0&&R.responseStart<performance.now())return R},o=function(R){if(document.readyState==="loading")return"loading";var z=r();if(z){if(R<z.domInteractive)return"loading";if(z.domContentLoadedEventStart===0||R<z.domContentLoadedEventStart)return"dom-interactive";if(z.domComplete===0||R<z.domComplete)return"dom-content-loaded"}return"complete"},a=function(R){var z=R.nodeName;return R.nodeType===1?z.toLowerCase():z.toUpperCase().replace(/^#/,"")},u=function(R,z){var P="";try{for(;R&&R.nodeType!==9;){var Y=R,W=Y.id?"#"+Y.id:a(Y)+(Y.classList&&Y.classList.value&&Y.classList.value.trim()&&Y.classList.value.trim().length?"."+Y.classList.value.trim().replace(/\s+/g,"."):"");if(P.length+W.length>(z||100)-1)return P||W;if(P=P?W+">"+P:W,Y.id)break;R=Y.parentNode}}catch{}return P},h=-1,p=function(){return h},m=function(R){addEventListener("pageshow",function(z){z.persisted&&(h=z.timeStamp,R(z))},!0)},g=function(){var R=r();return R&&R.activationStart||0},f=function(R,z){var P=r(),Y="navigate";return p()>=0?Y="back-forward-cache":P&&(document.prerendering||g()>0?Y="prerender":document.wasDiscarded?Y="restore":P.type&&(Y=P.type.replace(/_/g,"-"))),{name:R,value:z===void 0?-1:z,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:Y}},b=function(R,z,P){try{if(PerformanceObserver.supportedEntryTypes.includes(R)){var Y=new PerformanceObserver(function(W){Promise.resolve().then(function(){z(W.getEntries())})});return Y.observe(Object.assign({type:R,buffered:!0},P||{})),Y}}catch{}},y=function(R,z,P,Y){var W,ue;return function(ae){z.value>=0&&(ae||Y)&&((ue=z.value-(W||0))||W===void 0)&&(W=z.value,z.delta=ue,z.rating=function(de,Me){return de>Me[1]?"poor":de>Me[0]?"needs-improvement":"good"}(z.value,P),R(z))}},k=function(R){requestAnimationFrame(function(){return requestAnimationFrame(function(){return R()})})},T=function(R){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&R()})},j=function(R){var z=!1;return function(){z||(R(),z=!0)}},$=-1,G=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},ce=function(R){document.visibilityState==="hidden"&&$>-1&&($=R.type==="visibilitychange"?R.timeStamp:0,Ee())},se=function(){addEventListener("visibilitychange",ce,!0),addEventListener("prerenderingchange",ce,!0)},Ee=function(){removeEventListener("visibilitychange",ce,!0),removeEventListener("prerenderingchange",ce,!0)},qe=function(){return $<0&&($=G(),se(),m(function(){setTimeout(function(){$=G(),se()},0)})),{get firstHiddenTime(){return $}}},ye=function(R){document.prerendering?addEventListener("prerenderingchange",function(){return R()},!0):R()},Se=[1800,3e3],Le=function(R,z){z=z||{},ye(function(){var P,Y=qe(),W=f("FCP"),ue=b("paint",function(ae){ae.forEach(function(de){de.name==="first-contentful-paint"&&(ue.disconnect(),de.startTime<Y.firstHiddenTime&&(W.value=Math.max(de.startTime-g(),0),W.entries.push(de),P(!0)))})});ue&&(P=y(R,W,Se,z.reportAllChanges),m(function(ae){W=f("FCP"),P=y(R,W,Se,z.reportAllChanges),k(function(){W.value=performance.now()-ae.timeStamp,P(!0)})}))})},je=[.1,.25],Ye=0,nt=1/0,dt=0,bt=function(R){R.forEach(function(z){z.interactionId&&(nt=Math.min(nt,z.interactionId),dt=Math.max(dt,z.interactionId),Ye=dt?(dt-nt)/7+1:0)})},mt=function(){"interactionCount"in performance||n||(n=b("event",bt,{type:"event",buffered:!0,durationThreshold:0}))},Ze=[],ht=new Map,Tt=0,wt=function(){return(n?Ye:performance.interactionCount||0)-Tt},xt=[],zt=function(R){if(xt.forEach(function(W){return W(R)}),R.interactionId||R.entryType==="first-input"){var z=Ze[Ze.length-1],P=ht.get(R.interactionId);if(P||Ze.length<10||R.duration>z.latency){if(P)R.duration>P.latency?(P.entries=[R],P.latency=R.duration):R.duration===P.latency&&R.startTime===P.entries[0].startTime&&P.entries.push(R);else{var Y={id:R.interactionId,latency:R.duration,entries:[R]};ht.set(Y.id,Y),Ze.push(Y)}Ze.sort(function(W,ue){return ue.latency-W.latency}),Ze.length>10&&Ze.splice(10).forEach(function(W){return ht.delete(W.id)})}}},tt=function(R){var z=self.requestIdleCallback||self.setTimeout,P=-1;return R=j(R),document.visibilityState==="hidden"?R():(P=z(R),T(R)),P},pt=[200,500],ze=[],Je=[],St=new WeakMap,Mt=new Map,cr=-1,Yt=function(R){ze=ze.concat(R),It()},It=function(){cr<0&&(cr=tt(F))},F=function(){Mt.size>10&&Mt.forEach(function(de,Me){ht.has(Me)||Mt.delete(Me)});var R=Ze.map(function(de){return St.get(de.entries[0])}),z=Je.length-50;Je=Je.filter(function(de,Me){return Me>=z||R.includes(de)});for(var P=new Set,Y=0;Y<Je.length;Y++){var W=Je[Y];x(W.startTime,W.processingEnd).forEach(function(de){P.add(de)})}for(var ue=0;ue<50;ue++){var ae=ze[ze.length-1-ue];if(!ae||ae.startTime<t)break;P.add(ae)}ze=Array.from(P),cr=-1};xt.push(function(R){R.interactionId&&R.target&&!Mt.has(R.interactionId)&&Mt.set(R.interactionId,R.target)},function(R){var z,P=R.startTime+R.duration;t=Math.max(t,R.processingEnd);for(var Y=Je.length-1;Y>=0;Y--){var W=Je[Y];if(Math.abs(P-W.renderTime)<=8){(z=W).startTime=Math.min(R.startTime,z.startTime),z.processingStart=Math.min(R.processingStart,z.processingStart),z.processingEnd=Math.max(R.processingEnd,z.processingEnd),z.entries.push(R);break}}z||(z={startTime:R.startTime,processingStart:R.processingStart,processingEnd:R.processingEnd,renderTime:P,entries:[R]},Je.push(z)),(R.interactionId||R.entryType==="first-input")&&St.set(R,z),It()});var x=function(R,z){for(var P,Y=[],W=0;P=ze[W];W++)if(!(P.startTime+P.duration<R)){if(P.startTime>z)break;Y.push(P)}return Y},L=[2500,4e3],H={},ee=typeof window<"u"?window:void 0,he=typeof globalThis<"u"?globalThis:ee,Re=he==null?void 0:he.navigator;he==null||he.document,he==null||he.location,he==null||he.fetch,he!=null&&he.XMLHttpRequest&&"withCredentials"in new he.XMLHttpRequest&&he.XMLHttpRequest,he==null||he.AbortController,Re==null||Re.userAgent;var Xe=ee??{},Pe={onLCP:function(R,z){(function(P,Y){Y=Y||{},ye(function(){var W,ue=qe(),ae=f("LCP"),de=function(Ve){Y.reportAllChanges||(Ve=Ve.slice(-1)),Ve.forEach(function(Ke){Ke.startTime<ue.firstHiddenTime&&(ae.value=Math.max(Ke.startTime-g(),0),ae.entries=[Ke],W())})},Me=b("largest-contentful-paint",de);if(Me){W=y(P,ae,L,Y.reportAllChanges);var Ue=j(function(){H[ae.id]||(de(Me.takeRecords()),Me.disconnect(),H[ae.id]=!0,W(!0))});["keydown","click"].forEach(function(Ve){addEventListener(Ve,function(){return tt(Ue)},!0)}),T(Ue),m(function(Ve){ae=f("LCP"),W=y(P,ae,L,Y.reportAllChanges),k(function(){ae.value=performance.now()-Ve.timeStamp,H[ae.id]=!0,W(!0)})})}})})(function(P){var Y=function(W){var ue={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:W.value};if(W.entries.length){var ae=r();if(ae){var de=ae.activationStart||0,Me=W.entries[W.entries.length-1],Ue=Me.url&&performance.getEntriesByType("resource").filter(function(Ae){return Ae.name===Me.url})[0],Ve=Math.max(0,ae.responseStart-de),Ke=Math.max(Ve,Ue?(Ue.requestStart||Ue.startTime)-de:0),tr=Math.max(Ke,Ue?Ue.responseEnd-de:0),Sr=Math.max(tr,Me.startTime-de);ue={element:u(Me.element),timeToFirstByte:Ve,resourceLoadDelay:Ke-Ve,resourceLoadDuration:tr-Ke,elementRenderDelay:Sr-tr,navigationEntry:ae,lcpEntry:Me},Me.url&&(ue.url=Me.url),Ue&&(ue.lcpResourceEntry=Ue)}}return Object.assign(W,{attribution:ue})}(P);R(Y)},z)},onCLS:function(R,z){(function(P,Y){Y=Y||{},Le(j(function(){var W,ue=f("CLS",0),ae=0,de=[],Me=function(Ve){Ve.forEach(function(Ke){if(!Ke.hadRecentInput){var tr=de[0],Sr=de[de.length-1];ae&&Ke.startTime-Sr.startTime<1e3&&Ke.startTime-tr.startTime<5e3?(ae+=Ke.value,de.push(Ke)):(ae=Ke.value,de=[Ke])}}),ae>ue.value&&(ue.value=ae,ue.entries=de,W())},Ue=b("layout-shift",Me);Ue&&(W=y(P,ue,je,Y.reportAllChanges),T(function(){Me(Ue.takeRecords()),W(!0)}),m(function(){ae=0,ue=f("CLS",0),W=y(P,ue,je,Y.reportAllChanges),k(function(){return W()})}),setTimeout(W,0))}))})(function(P){var Y=function(W){var ue,ae={};if(W.entries.length){var de=W.entries.reduce(function(Ue,Ve){return Ue&&Ue.value>Ve.value?Ue:Ve});if(de&&de.sources&&de.sources.length){var Me=(ue=de.sources).find(function(Ue){return Ue.node&&Ue.node.nodeType===1})||ue[0];Me&&(ae={largestShiftTarget:u(Me.node),largestShiftTime:de.startTime,largestShiftValue:de.value,largestShiftSource:Me,largestShiftEntry:de,loadState:o(de.startTime)})}}return Object.assign(W,{attribution:ae})}(P);R(Y)},z)},onFCP:function(R,z){Le(function(P){var Y=function(W){var ue={timeToFirstByte:0,firstByteToFCP:W.value,loadState:o(p())};if(W.entries.length){var ae=r(),de=W.entries[W.entries.length-1];if(ae){var Me=ae.activationStart||0,Ue=Math.max(0,ae.responseStart-Me);ue={timeToFirstByte:Ue,firstByteToFCP:W.value-Ue,loadState:o(W.entries[0].startTime),navigationEntry:ae,fcpEntry:de}}}return Object.assign(W,{attribution:ue})}(P);R(Y)},z)},onINP:function(R,z){e||(e=b("long-animation-frame",Yt)),function(P,Y){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(Y=Y||{},ye(function(){var W;mt();var ue,ae=f("INP"),de=function(Ue){tt(function(){Ue.forEach(zt);var Ve,Ke=(Ve=Math.min(Ze.length-1,Math.floor(wt()/50)),Ze[Ve]);Ke&&Ke.latency!==ae.value&&(ae.value=Ke.latency,ae.entries=Ke.entries,ue())})},Me=b("event",de,{durationThreshold:(W=Y.durationThreshold)!==null&&W!==void 0?W:40});ue=y(P,ae,pt,Y.reportAllChanges),Me&&(Me.observe({type:"first-input",buffered:!0}),T(function(){de(Me.takeRecords()),ue(!0)}),m(function(){Tt=0,Ze.length=0,ht.clear(),ae=f("INP"),ue=y(P,ae,pt,Y.reportAllChanges)}))}))}(function(P){var Y=function(W){var ue=W.entries[0],ae=St.get(ue),de=ue.processingStart,Me=ae.processingEnd,Ue=ae.entries.sort(function(jt,Hn){return jt.processingStart-Hn.processingStart}),Ve=x(ue.startTime,Me),Ke=W.entries.find(function(jt){return jt.target}),tr=Ke&&Ke.target||Mt.get(ue.interactionId),Sr=[ue.startTime+ue.duration,Me].concat(Ve.map(function(jt){return jt.startTime+jt.duration})),Ae=Math.max.apply(Math,Sr),Ct={interactionTarget:u(tr),interactionTargetElement:tr,interactionType:ue.name.startsWith("key")?"keyboard":"pointer",interactionTime:ue.startTime,nextPaintTime:Ae,processedEventEntries:Ue,longAnimationFrameEntries:Ve,inputDelay:de-ue.startTime,processingDuration:Me-de,presentationDelay:Math.max(Ae-Me,0),loadState:o(ue.startTime)};return Object.assign(W,{attribution:Ct})}(P);R(Y)},z)}};Xe.__PosthogExtensions__=Xe.__PosthogExtensions__||{},Xe.__PosthogExtensions__.postHogWebVitalsCallbacks=Pe,Xe.postHogWebVitalsCallbacks=Pe})();var C=typeof window<"u"?window:void 0,Wt=typeof globalThis<"u"?globalThis:C,Cl=Array.prototype,Ia=Cl.forEach,Ca=Cl.indexOf,Vt=Wt==null?void 0:Wt.navigator,ne=Wt==null?void 0:Wt.document,$t=Wt==null?void 0:Wt.location,To=Wt==null?void 0:Wt.fetch,xo=Wt!=null&&Wt.XMLHttpRequest&&"withCredentials"in new Wt.XMLHttpRequest?Wt.XMLHttpRequest:void 0,Ea=Wt==null?void 0:Wt.AbortController,yt=Vt==null?void 0:Vt.userAgent,Ce=C??{},yr={DEBUG:!1,LIB_VERSION:"1.201.0"},_i={},Ni=function(n){return n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function on(n,e,t){if(ut(n)){if(Ia&&n.forEach===Ia)n.forEach(e,t);else if("length"in n&&n.length===+n.length){for(var r=0,o=n.length;r<o;r++)if(r in n&&e.call(t,n[r],r)===_i)return}}}function Qe(n,e,t){if(!et(n)){if(ut(n))return on(n,e,t);if(Ac(n)){for(var r of n.entries())if(e.call(t,r[1],r[0])===_i)return}else for(var o in n)if(Tl.call(n,o)&&e.call(t,n[o],o)===_i)return}}var Pt=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return on(t,function(o){for(var a in o)o[a]!==void 0&&(n[a]=o[a])}),n};function De(n,e){return n.indexOf(e)!==-1}function vi(n){for(var e=Object.keys(n),t=e.length,r=new Array(t);t--;)r[t]=[e[t],n[e[t]]];return r}var ka=function(n){try{return n()}catch{return}},kc=function(n){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.apply(this,t)}catch(o){me.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),me.critical(o)}}},yi=function(n){var e={};return Qe(n,function(t,r){kt(t)&&t.length>0&&(e[r]=t)}),e},Ro=function(n){return n.replace(/^\$/,"")};function Tc(n,e){return t=n,r=a=>kt(a)&&!Or(e)?a.slice(0,e):a,o=new Set,function a(u,h){return u!==Object(u)?r?r(u,h):u:o.has(u)?void 0:(o.add(u),ut(u)?(p=[],on(u,m=>{p.push(a(m))})):(p={},Qe(u,(m,g)=>{o.has(m)||(p[g]=a(m,g))})),p);var p}(t);var t,r,o}var xc=function(n){var e,t,r,o,a="";for(e=t=0,r=(n=(n+"").replace(/\r\n/g,` `).replace(/\r/g,` `)).length,o=0;o<r;o++){var u=n.charCodeAt(o),h=null;u<128?t++:h=u>127&&u<2048?String.fromCharCode(u>>6|192,63&u|128):String.fromCharCode(u>>12|224,u>>6&63|128,63&u|128),Or(h)||(t>e&&(a+=n.substring(e,t)),a+=h,e=t=o+1)}return t>e&&(a+=n.substring(e,n.length)),a},br=function(){function n(e){return e&&(e.preventDefault=n.preventDefault,e.stopPropagation=n.stopPropagation),e}return n.preventDefault=function(){this.returnValue=!1},n.stopPropagation=function(){this.cancelBubble=!0},function(e,t,r,o,a){if(e)if(e.addEventListener&&!o)e.addEventListener(t,r,!!a);else{var u="on"+t,h=e[u];e[u]=function(p,m,g){return function(f){if(f=f||n(C==null?void 0:C.event)){var b,y=!0;Kt(g)&&(b=g(f));var k=m.call(p,f);return b!==!1&&k!==!1||(y=!1),y}}}(e,r,h)}else me.error("No valid element provided to register_event")}}();function El(n,e){for(var t=0;t<n.length;t++)if(e(n[t]))return n[t]}var ar,fo="$copy_autocapture",Rc=["$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(n){n.GZipJS="gzip-js",n.Base64="base64"})(ar||(ar={}));var Mc=Array.isArray,kl=Object.prototype,Tl=kl.hasOwnProperty,Fi=kl.toString,ut=Mc||function(n){return Fi.call(n)==="[object Array]"},Kt=n=>typeof n=="function",ct=n=>n===Object(n)&&!ut(n),rn=n=>{if(ct(n)){for(var e in n)if(Tl.call(n,e))return!1;return!0}return!1},fe=n=>n===void 0,kt=n=>Fi.call(n)=="[object String]",Ta=n=>kt(n)&&n.trim().length===0,Or=n=>n===null,et=n=>fe(n)||Or(n),Ut=n=>Fi.call(n)=="[object Number]",qr=n=>Fi.call(n)==="[object Boolean]",Ac=n=>n instanceof FormData,Oc=n=>De(Rc,n),xl=n=>{var e={_log:function(t){if(C&&(yr.DEBUG||Ce.POSTHOG_DEBUG)&&!fe(C.console)&&C.console){for(var r=("__rrweb_original__"in C.console[t])?C.console[t].__rrweb_original__:C.console[t],o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];r(n,...a)}},info:function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];e._log("log",...r)},warn:function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];e._log("warn",...r)},error:function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];e._log("error",...r)},critical:function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];console.error(n,...r)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling ".concat(t))},createLogger:t=>xl("".concat(n," ").concat(t))};return e},me=xl("[PostHog.js]"),Lt=me.createLogger,Nc=Lt("[ExternalScriptsLoader]"),xa=(n,e,t)=>{if(n.config.disable_external_dependency_loading)return Nc.warn("".concat(e," was requested but loading of external scripts is disabled.")),t("Loading of external scripts is disabled");var r=()=>{if(!ne)return t("document not found");var o=ne.createElement("script");o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=h=>t(void 0,h),o.onerror=h=>t(h);var a,u=ne.querySelectorAll("body > script");u.length>0?(a=u[0].parentNode)===null||a===void 0||a.insertBefore(o,u[0]):ne.body.appendChild(o)};ne!=null&&ne.body?r():ne==null||ne.addEventListener("DOMContentLoaded",r)};function Ra(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),t.push.apply(t,r)}return t}function D(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ra(Object(t),!0).forEach(function(r){U(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ra(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function U(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rl(n,e){if(n==null)return{};var t,r,o=function(u,h){if(u==null)return{};var p,m,g={},f=Object.keys(u);for(m=0;m<f.length;m++)p=f[m],h.indexOf(p)>=0||(g[p]=u[p]);return g}(n,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(r=0;r<a.length;r++)t=a[r],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}Ce.__PosthogExtensions__=Ce.__PosthogExtensions__||{},Ce.__PosthogExtensions__.loadExternalDependency=(n,e,t)=>{var r="/static/".concat(e,".js")+"?v=".concat(n.version);if(e==="remote-config"&&(r="/array/".concat(n.config.token,"/config.js")),e==="toolbar"){var o=3e5,a=Math.floor(Date.now()/o)*o;r="".concat(r,"&t=").concat(a)}var u=n.requestRouter.endpointFor("assets",r);xa(n,u,t)},Ce.__PosthogExtensions__.loadSiteApp=(n,e,t)=>{var r=n.requestRouter.endpointFor("api",e);xa(n,r,t)};var Ml="$people_distinct_id",En="__alias",kn="__timers",Ma="$autocapture_disabled_server_side",Mo="$heatmaps_enabled_server_side",Aa="$exception_capture_enabled_server_side",Oa="$web_vitals_enabled_server_side",Al="$dead_clicks_enabled_server_side",Na="$web_vitals_allowed_metrics",Ao="$session_recording_enabled_server_side",Fa="$console_log_recording_enabled_server_side",Pa="$session_recording_network_payload_capture",La="$session_recording_canvas_recording",Da="$replay_sample_rate",Ba="$replay_minimum_duration",Ha="$replay_script_config",bi="$sesid",Tn="$session_is_sampled",vo="$session_recording_url_trigger_activated_session",mo="$session_recording_event_trigger_activated_session",nn="$enabled_feature_flags",Oo="$early_access_features",xn="$stored_person_properties",Wr="$stored_group_properties",No="$surveys",oi="$surveys_activated",wi="$flag_call_reported",vr="$user_state",Fo="$client_session_props",Po="$capture_rate_limit",Lo="$initial_campaign_params",Do="$initial_referrer_info",Bo="$initial_person_info",Si="$epp",Ol="__POSTHOG_TOOLBAR__",$a="$posthog_cklsh",Fc=[Ml,En,"__cmpns",kn,Ao,Mo,bi,nn,vr,Oo,Wr,xn,No,wi,Fo,Po,Lo,Do,Si],si=Lt("[FeatureFlags]"),_o="$active_feature_flags",ai="$override_feature_flags",Wa="$feature_flag_payloads",Ga=n=>{var e={};for(var[t,r]of vi(n||{}))r&&(e[t]=r);return e};class Pc{constructor(e){U(this,"_override_warning",!1),U(this,"_hasLoadedFlags",!1),U(this,"_requestInFlight",!1),U(this,"_reloadingDisabled",!1),U(this,"_additionalReloadRequested",!1),U(this,"_decideCalled",!1),U(this,"_flagsLoadedFromRemote",!1),this.instance=e,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(nn),t=this.instance.get_property(ai);if(!t)return e||{};for(var r=Pt({},e),o=Object.keys(t),a=0;a<o.length;a++)r[o[a]]=t[o[a]];return this._override_warning||(si.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){return this.instance.get_property(Wa)||{}}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callDecideEndpoint(e){if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:this.instance.get_property(xn),group_properties:this.instance.get_property(Wr)};(e!=null&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(t.disable_flags=!0),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:t,compression:this.instance.config.disable_compression?void 0:ar.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:r=>{var o,a,u=!0;r.statusCode===200&&(this.$anon_distinct_id=void 0,u=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((a=r.json)!==null&&a!==void 0?a:{})),t.disable_flags||(this._flagsLoadedFromRemote=!u,this.receivedFeatureFlags((o=r.json)!==null&&o!==void 0?o:{},u),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint()))}})}}getFeatureFlag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r,o,a,u,h,p=this.getFlagVariants()[e],m="".concat(p),g=this.instance.get_property(wi)||{};return(t.send_event||!("send_event"in t))&&(!(e in g)||!g[e].includes(m))&&(ut(g[e])?g[e].push(m):g[e]=[m],(r=this.instance.persistence)===null||r===void 0||r.register({[wi]:g}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:p,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_bootstrapped_response:((o=this.instance.config.bootstrap)===null||o===void 0||(a=o.featureFlags)===null||a===void 0?void 0:a[e])||null,$feature_flag_bootstrapped_payload:((u=this.instance.config.bootstrap)===null||u===void 0||(h=u.featureFlagPayloads)===null||h===void 0?void 0:h[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote})),p}si.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._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);si.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._hasLoadedFlags=!0;var r=this.getFlagVariants(),o=this.getFlagPayloads();(function(a,u){var h=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(ut(m)){var f={};if(m)for(var b=0;b<m.length;b++)f[m[b]]=!0;u&&u.register({[_o]:m,[nn]:f})}else{var y=m,k=g;a.errorsWhileComputingFlags&&(y=D(D({},h),y),k=D(D({},p),k)),u&&u.register({[_o]:Object.keys(Ga(y)),[nn]:y||{},[Wa]:k||{}})}})(e,this.instance.persistence,r,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 si.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,e===!1)this.instance.persistence.unregister(ai);else if(ut(e)){for(var r={},o=0;o<e.length;o++)r[e[o]]=!0;this.instance.persistence.register({[ai]:r})}else this.instance.persistence.register({[ai]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var r,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=D(D({},this.getFlagVariants()),{},{[e]:t});(r=this.instance.persistence)===null||r===void 0||r.register({[_o]:Object.keys(Ga(a)),[nn]:a}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=this.instance.get_property(Oo);if(r&&!t)return e(r);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({[Oo]:u}),e(u)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(r=>t[r]),flagVariants:Object.keys(t).filter(r=>t[r]).reduce((r,o)=>(r[o]=t[o],r),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(o=>o(t,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(xn)||{};this.instance.register({[xn]:D(D({},r),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(xn)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Wr)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(o=>{r[o]=D(D({},r[o]),e[o]),delete e[o]}),this.instance.register({[Wr]:D(D({},r),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(Wr)||{};this.instance.register({[Wr]:D(D({},t),{},{[e]:{}})})}else this.instance.unregister(Wr)}}Math.trunc||(Math.trunc=function(n){return n<0?Math.ceil(n):Math.floor(n)}),Number.isInteger||(Number.isInteger=function(n){return Ut(n)&&isFinite(n)&&Math.floor(n)===n});var ja="0123456789abcdef";class Ii{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,o){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(o)||e<0||t<0||r<0||o<0||e>0xffffffffffff||t>4095||r>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|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=o>>>24,a[13]=o>>>16,a[14]=o>>>8,a[15]=o,new Ii(a)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+ja.charAt(this.bytes[t]>>>4)+ja.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 Ii(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}}class Lc{constructor(){U(this,"timestamp",0),U(this,"counter",0),U(this,"random",new Dc)}generate(){var e=this.generateOrAbort();if(fe(e)){this.timestamp=0;var t=this.generateOrAbort();if(fe(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 Ii.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 qa,Nl=n=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<n.length;e++)n[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return n};C&&!fe(C.crypto)&&crypto.getRandomValues&&(Nl=n=>crypto.getRandomValues(n));class Dc{constructor(){U(this,"buffer",new Uint32Array(8)),U(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(Nl(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Rr=()=>Bc().toString(),Bc=()=>(qa||(qa=new Lc)).generate(),Hc="Thu, 01 Jan 1970 00:00:00 GMT",bn="",$c=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Wc(n,e){if(e){var t=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ne;if(bn)return bn;if(!a||["localhost","127.0.0.1"].includes(o))return"";for(var u=o.split("."),h=Math.min(u.length,8),p="dmn_chk_"+Rr(),m=new RegExp("(^|;)\\s*"+p+"=1");!bn&&h--;){var g=u.slice(h).join("."),f=p+"=1;domain=."+g;a.cookie=f,m.test(a.cookie)&&(a.cookie=f+";expires="+Hc,bn=g)}return bn}(n);if(!t){var r=(o=>{var a=o.match($c);return a?a[0]:""})(n);r!==t&&me.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var wr={is_supported:()=>!!ne,error:function(n){me.error("cookieStore error: "+n)},get:function(n){if(ne){try{for(var e=n+"=",t=ne.cookie.split(";").filter(a=>a.length),r=0;r<t.length;r++){for(var o=t[r];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(n){var e;try{e=JSON.parse(wr.get(n))||{}}catch{}return e},set:function(n,e,t,r,o){if(ne)try{var a="",u="",h=Wc(ne.location.hostname,r);if(t){var p=new Date;p.setTime(p.getTime()+24*t*60*60*1e3),a="; expires="+p.toUTCString()}o&&(u="; secure");var m=n+"="+encodeURIComponent(JSON.stringify(e))+a+"; SameSite=Lax; path=/"+h+u;return m.length>3686.4&&me.warn("cookieStore warning: large cookie, len="+m.length),ne.cookie=m,m}catch{return}},remove:function(n,e){try{wr.set(n,"",-1,e)}catch{return}}},yo=null,vt={is_supported:function(){if(!Or(yo))return yo;var n=!0;if(fe(C))n=!1;else try{var e="__mplssupport__";vt.set(e,"xyz"),vt.get(e)!=='"xyz"'&&(n=!1),vt.remove(e)}catch{n=!1}return n||me.error("localStorage unsupported; falling back to cookie store"),yo=n,n},error:function(n){me.error("localStorage error: "+n)},get:function(n){try{return C==null?void 0:C.localStorage.getItem(n)}catch(e){vt.error(e)}return null},parse:function(n){try{return JSON.parse(vt.get(n))||{}}catch{}return null},set:function(n,e){try{C==null||C.localStorage.setItem(n,JSON.stringify(e))}catch(t){vt.error(t)}},remove:function(n){try{C==null||C.localStorage.removeItem(n)}catch(e){vt.error(e)}}},Gc=["distinct_id",bi,Tn,Si,Bo],li=D(D({},vt),{},{parse:function(n){try{var e={};try{e=wr.parse(n)||{}}catch{}var t=Pt(e,JSON.parse(vt.get(n)||"{}"));return vt.set(n,t),t}catch{}return null},set:function(n,e,t,r,o,a){try{vt.set(n,e,void 0,void 0,a);var u={};Gc.forEach(h=>{e[h]&&(u[h]=e[h])}),Object.keys(u).length&&wr.set(n,u,t,r,o,a)}catch(h){vt.error(h)}},remove:function(n,e){try{C==null||C.localStorage.removeItem(n),wr.remove(n,e)}catch(t){vt.error(t)}}}),ui={},jc={is_supported:function(){return!0},error:function(n){me.error("memoryStorage error: "+n)},get:function(n){return ui[n]||null},parse:function(n){return ui[n]||null},set:function(n,e){ui[n]=e},remove:function(n){delete ui[n]}},Lr=null,Et={is_supported:function(){if(!Or(Lr))return Lr;if(Lr=!0,fe(C))Lr=!1;else try{var n="__support__";Et.set(n,"xyz"),Et.get(n)!=='"xyz"'&&(Lr=!1),Et.remove(n)}catch{Lr=!1}return Lr},error:function(n){me.error("sessionStorage error: ",n)},get:function(n){try{return C==null?void 0:C.sessionStorage.getItem(n)}catch(e){Et.error(e)}return null},parse:function(n){try{return JSON.parse(Et.get(n))||null}catch{}return null},set:function(n,e){try{C==null||C.sessionStorage.setItem(n,JSON.stringify(e))}catch(t){Et.error(t)}},remove:function(n){try{C==null||C.sessionStorage.removeItem(n)}catch(e){Et.error(e)}}},qc=["localhost","127.0.0.1"],sn=n=>{var e=ne==null?void 0:ne.createElement("a");return fe(e)?null:(e.href=n,e)},un=function(n,e){return!!function(t){try{new RegExp(t)}catch{return!1}return!0}(e)&&new RegExp(e).test(n)},Uc=function(n){var e,t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",o=[];return Qe(n,function(a,u){fe(a)||fe(u)||u==="undefined"||(e=encodeURIComponent((h=>h instanceof File)(a)?a.name:a.toString()),t=encodeURIComponent(u),o[o.length]=t+"="+e)}),o.join(r)},Ci=function(n,e){for(var t,r=((n.split("#")[0]||"").split("?")[1]||"").split("&"),o=0;o<r.length;o++){var a=r[o].split("=");if(a[0]===e){t=a;break}}if(!ut(t)||t.length<2)return"";var u=t[1];try{u=decodeURIComponent(u)}catch{me.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Ei=function(n,e){var t=n.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Qt="Mobile",ki="iOS",lr="Android",Fn="Tablet",Fl=lr+" "+Fn,Pl="iPad",Ll="Apple",Dl=Ll+" Watch",Pn="Safari",cn="BlackBerry",Bl="Samsung",Hl=Bl+"Browser",$l=Bl+" Internet",Vr="Chrome",Vc=Vr+" OS",Wl=Vr+" "+ki,rs="Internet Explorer",Gl=rs+" "+Qt,ns="Opera",zc=ns+" Mini",is="Edge",jl="Microsoft "+is,an="Firefox",ql=an+" "+ki,Ln="Nintendo",Dn="PlayStation",ln="Xbox",Ul=lr+" "+Qt,Vl=Qt+" "+Pn,Rn="Windows",Ho=Rn+" Phone",Ua="Nokia",$o="Ouya",zl="Generic",Yc=zl+" "+Qt.toLowerCase(),Yl=zl+" "+Fn.toLowerCase(),Wo="Konqueror",Ft="(\\d+(\\.\\d+)?)",bo=new RegExp("Version/"+Ft),Zc=new RegExp(ln,"i"),Xc=new RegExp(Dn+" \\w+","i"),Jc=new RegExp(Ln+" \\w+","i"),os=new RegExp(cn+"|PlayBook|BB10","i"),Kc={"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"},Qc=(n,e)=>e&&De(e,Ll)||function(t){return De(t,Pn)&&!De(t,Vr)&&!De(t,lr)}(n),Va=function(n,e){return e=e||"",De(n," OPR/")&&De(n,"Mini")?zc:De(n," OPR/")?ns:os.test(n)?cn:De(n,"IE"+Qt)||De(n,"WPDesktop")?Gl:De(n,Hl)?$l:De(n,is)||De(n,"Edg/")?jl:De(n,"FBIOS")?"Facebook "+Qt:De(n,"UCWEB")||De(n,"UCBrowser")?"UC Browser":De(n,"CriOS")?Wl:De(n,"CrMo")||De(n,Vr)?Vr:De(n,lr)&&De(n,Pn)?Ul:De(n,"FxiOS")?ql:De(n.toLowerCase(),Wo.toLowerCase())?Wo:Qc(n,e)?De(n,Qt)?Vl:Pn:De(n,an)?an:De(n,"MSIE")||De(n,"Trident/")?rs:De(n,"Gecko")?an:""},ed={[Gl]:[new RegExp("rv:"+Ft)],[jl]:[new RegExp(is+"?\\/"+Ft)],[Vr]:[new RegExp("("+Vr+"|CrMo)\\/"+Ft)],[Wl]:[new RegExp("CriOS\\/"+Ft)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ft)],[Pn]:[bo],[Vl]:[bo],[ns]:[new RegExp("(Opera|OPR)\\/"+Ft)],[an]:[new RegExp(an+"\\/"+Ft)],[ql]:[new RegExp("FxiOS\\/"+Ft)],[Wo]:[new RegExp("Konqueror[:/]?"+Ft,"i")],[cn]:[new RegExp(cn+" "+Ft),bo],[Ul]:[new RegExp("android\\s"+Ft,"i")],[$l]:[new RegExp(Hl+"\\/"+Ft)],[rs]:[new RegExp("(rv:|MSIE )"+Ft)],Mozilla:[new RegExp("rv:"+Ft)]},za=[[new RegExp(ln+"; "+ln+" (.*?)[);]","i"),n=>[ln,n&&n[1]||""]],[new RegExp(Ln,"i"),[Ln,""]],[new RegExp(Dn,"i"),[Dn,""]],[os,[cn,""]],[new RegExp(Rn,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ho,""];if(new RegExp(Qt).test(e)&&!/IEMobile\b/.test(e))return[Rn+" "+Qt,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],o=Kc[r]||"";return/arm/i.test(e)&&(o="RT"),[Rn,o]}return[Rn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[ki,e.join(".")]}return[ki,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,n=>{var e="";return n&&n.length>=3&&(e=fe(n[2])?n[3]:n[2]),["watchOS",e]}],[new RegExp("("+lr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lr+")","i"),n=>{if(n&&n[2]){var e=[n[2],n[3],n[4]||"0"];return[lr,e.join(".")]}return[lr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,n=>{var e=["Mac OS X",""];if(n&&n[1]){var t=[n[1],n[2],n[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Vc,""]],[/Linux|debian/i,["Linux",""]]],Ya=function(n){return Jc.test(n)?Ln:Xc.test(n)?Dn:Zc.test(n)?ln:new RegExp($o,"i").test(n)?$o:new RegExp("("+Ho+"|WPDesktop)","i").test(n)?Ho:/iPad/.test(n)?Pl:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?Dl:os.test(n)?cn:/(kobo)\s(ereader|touch)/i.test(n)?"Kobo":new RegExp(Ua,"i").test(n)?Ua:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(n)||/(kf[a-z]+)( bui|\)).+silk\//i.test(n)?"Kindle Fire":/(Android|ZTE)/i.test(n)?!new RegExp(Qt).test(n)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(n)?/pixel[\daxl ]{1,6}/i.test(n)&&!/pixel c/i.test(n)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(n)||/lmy47v/i.test(n)&&!/QTAQZ3/i.test(n)?lr:Fl:lr:new RegExp("(pda|"+Qt+")","i").test(n)?Yc:new RegExp(Fn,"i").test(n)&&!new RegExp(Fn+" pc","i").test(n)?Yl:""},ci="https?://(.*)",td=["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"],at={campaignParams:function(n){return ne?this._campaignParamsFromUrl(ne.URL,n):{}},_campaignParamsFromUrl:function(n,e){var t=td.concat(e||[]),r={};return Qe(t,function(o){var a=Ci(n,o);r[o]=a||null}),r},_searchEngine:function(n){return n?n.search(ci+"google.([^/?]*)")===0?"google":n.search(ci+"bing.com")===0?"bing":n.search(ci+"yahoo.com")===0?"yahoo":n.search(ci+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(n){var e=at._searchEngine(n),t=e!="yahoo"?"q":"p",r={};if(!Or(e)){r.$search_engine=e;var o=ne?Ci(ne.referrer,t):"";o.length&&(r.ph_keyword=o)}return r},searchInfo:function(){var n=ne==null?void 0:ne.referrer;return n?this._searchInfoFromReferrer(n):{}},browser:Va,browserVersion:function(n,e){var t=Va(n,e),r=ed[t];if(fe(r))return null;for(var o=0;o<r.length;o++){var a=r[o],u=n.match(a);if(u)return parseFloat(u[u.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var n=this.browserLanguage();return typeof n=="string"?n.split("-")[0]:void 0},os:function(n){for(var e=0;e<za.length;e++){var[t,r]=za[e],o=t.exec(n),a=o&&(Kt(r)?r(o,n):r);if(a)return a}return["",""]},device:Ya,deviceType:function(n){var e=Ya(n);return e===Pl||e===Fl||e==="Kobo"||e==="Kindle Fire"||e===Yl?Fn:e===Ln||e===ln||e===Dn||e===$o?"Console":e===Dl?"Wearable":e?Qt:"Desktop"},referrer:function(){return(ne==null?void 0:ne.referrer)||"$direct"},referringDomain:function(){var n;return ne!=null&&ne.referrer&&((n=sn(ne.referrer))===null||n===void 0?void 0:n.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:$t==null?void 0:$t.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(n){var e,{r:t,u:r}=n,o={$initial_referrer:t,$initial_referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=sn(t))===null||e===void 0?void 0:e.host};if(r){o.$initial_current_url=r;var a=sn(r);o.$initial_host=a==null?void 0:a.host,o.$initial_pathname=a==null?void 0:a.pathname,Qe(this._campaignParamsFromUrl(r),function(u,h){o["$initial_"+Ro(h)]=u})}return t&&Qe(this._searchInfoFromReferrer(t),function(u,h){o["$initial_"+Ro(h)]=u}),o},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){if(!yt)return{};var[n,e]=at.os(yt);return Pt(yi({$os:n,$os_version:e,$browser:at.browser(yt,navigator.vendor),$device:at.device(yt),$device_type:at.deviceType(yt),$timezone:at.timezone(),$timezone_offset:at.timezoneOffset()}),{$current_url:$t==null?void 0:$t.href,$host:$t==null?void 0:$t.host,$pathname:$t==null?void 0:$t.pathname,$raw_user_agent:yt.length>1e3?yt.substring(0,997)+"...":yt,$browser_version:at.browserVersion(yt,navigator.vendor),$browser_language:at.browserLanguage(),$browser_language_prefix:at.browserLanguagePrefix(),$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:yr.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(!yt)return{};var[n,e]=at.os(yt);return Pt(yi({$os:n,$os_version:e,$browser:at.browser(yt,navigator.vendor)}),{$browser_version:at.browserVersion(yt,navigator.vendor)})}},rd=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class wo{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(t=>{var r="";return t.token&&(r=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+r+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&me.info("Persistence loaded",e.persistence,D({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){rd.indexOf(e.persistence.toLowerCase())===-1&&(me.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&vt.is_supported()?vt:t==="localstorage+cookie"&&li.is_supported()?li:t==="sessionstorage"&&Et.is_supported()?Et:t==="memory"?jc:t==="cookie"?wr:li.is_supported()?li:wr}properties(){var e={};return Qe(this.props,function(t,r){if(r===nn&&ct(t))for(var o=Object.keys(t),a=0;a<o.length;a++)e["$feature/".concat(o[a])]=t[o[a]];else h=r,p=!1,(Or(u=Fc)?p:Ca&&u.indexOf===Ca?u.indexOf(h)!=-1:(Qe(u,function(m){if(p||(p=m===h))return _i}),p))||(e[r]=t);var u,h,p}),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Pt({},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,r){if(ct(e)){fe(t)&&(t="None"),this.expire_days=fe(r)?this.default_expiry:r;var o=!1;if(Qe(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(ct(e)){this.expire_days=fe(t)?this.default_expiry:t;var r=!1;if(Qe(e,(o,a)=>{e.hasOwnProperty(a)&&this.props[a]!==o&&(this.props[a]=o,r=!0)}),r)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=at.campaignParams(this.config.custom_campaign_params);rn(yi(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(at.searchInfo())}update_referrer_info(){this.register_once(at.referrerInfo(),void 0)}set_initial_person_info(){this.props[Lo]||this.props[Do]||this.register_once({[Bo]:at.initialPersonInfo()},void 0)}get_referrer_info(){return yi({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};Qe([Do,Lo],o=>{var a=this.props[o];a&&Qe(a,function(u,h){e["$initial_"+Ro(h)]=u})});var t=this.props[Bo];if(t){var r=at.initialPersonPropsFromInfo(t);Pt(e,r)}return e}safe_merge(e){return Qe(this.props,function(t,r){r in e||(e[r]=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 r=this.buildStorage(e),o=this.props;this.clear(),this.storage=r,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 r=this.props[kn]||{};r[e]=t,this.props[kn]=r,this.save()}remove_event_timer(e){var t=(this.props[kn]||{})[e];return fe(t)||(delete this.props[kn][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}function Ti(n){var e,t;return((e=JSON.stringify(n,(t=[],function(r,o){if(ct(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 Go(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(n.size>=e&&n.data.length>1){var t=Math.floor(n.data.length/2),r=n.data.slice(0,t),o=n.data.slice(t);return[Go({size:Ti(r),data:r,sessionId:n.sessionId,windowId:n.windowId}),Go({size:Ti(o),data:o,sessionId:n.sessionId,windowId:n.windowId})].flatMap(a=>a)}return[n]}var mr=(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))(mr||{}),sr=(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))(sr||{});function Za(n){var e;return n.id===Ol||!((e=n.closest)===null||e===void 0||!e.call(n,".toolbar-global-fade-container"))}function Pi(n){return!!n&&n.nodeType===1}function Ar(n,e){return!!n&&!!n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function Zl(n){return!!n&&n.nodeType===3}function Xl(n){return!!n&&n.nodeType===11}function ss(n){return n?Ni(n).split(/\s+/):[]}function Xa(n){var e=C==null?void 0:C.location.href;return!!(e&&n&&n.some(t=>e.match(t)))}function xi(n){var e="";switch(typeof n.className){case"string":e=n.className;break;case"object":e=(n.className&&"baseVal"in n.className?n.className.baseVal:null)||n.getAttribute("class")||"";break;default:e=""}return ss(e)}function Jl(n){return et(n)?null:Ni(n).split(/(\s+)/).filter(e=>dn(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Li(n){var e="";return qo(n)&&!eu(n)&&n.childNodes&&n.childNodes.length&&Qe(n.childNodes,function(t){var r;Zl(t)&&t.textContent&&(e+=(r=Jl(t.textContent))!==null&&r!==void 0?r:"")}),Ni(e)}function Kl(n){return fe(n.target)?n.srcElement||null:(e=n.target)!==null&&e!==void 0&&e.shadowRoot?n.composedPath()[0]||null:n.target||null;var e}var jo=["a","button","form","input","select","textarea","label"];function Ql(n){var e=n.parentNode;return!(!e||!Pi(e))&&e}function nd(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!C||!n||Ar(n,"html")||!Pi(n)||t!=null&&t.url_allowlist&&!Xa(t.url_allowlist)||t!=null&&t.url_ignorelist&&Xa(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,h=[n],p=!0,m=n;m.parentNode&&!Ar(m,"body");)if(Xl(m.parentNode))h.push(m.parentNode.host),m=m.parentNode.host;else{if(!(p=Ql(m)))break;if(r||jo.indexOf(p.tagName.toLowerCase())>-1)u=!0;else{var g=C.getComputedStyle(p);g&&g.getPropertyValue("cursor")==="pointer"&&(u=!0)}h.push(p),m=p}if(!function(y,k){var T=k==null?void 0:k.element_allowlist;if(fe(T))return!0;var j=function(ce){if(T.some(se=>ce.tagName.toLowerCase()===se))return{v:!0}};for(var $ of y){var G=j($);if(typeof G=="object")return G.v}return!1}(h,t)||!function(y,k){var T=k==null?void 0:k.css_selector_allowlist;if(fe(T))return!0;var j=function(ce){if(T.some(se=>ce.matches(se)))return{v:!0}};for(var $ of y){var G=j($);if(typeof G=="object")return G.v}return!1}(h,t))return!1;var f=C.getComputedStyle(n);if(f&&f.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var b=n.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&&(jo.indexOf(b)>-1||n.getAttribute("contenteditable")==="true")}}function qo(n){for(var e=n;e.parentNode&&!Ar(e,"body");e=e.parentNode){var t=xi(e);if(De(t,"ph-sensitive")||De(t,"ph-no-capture"))return!1}if(De(xi(n),"ph-include"))return!0;var r=n.type||"";if(kt(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var o=n.name||n.id||"";return!(kt(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 eu(n){return!!(Ar(n,"input")&&!["button","checkbox","submit","reset"].includes(n.type)||Ar(n,"select")||Ar(n,"textarea")||n.getAttribute("contenteditable")==="true")}var tu="(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})",id=new RegExp("^(?:".concat(tu,")$")),od=new RegExp(tu),ru="\\d{3}-?\\d{2}-?\\d{4}",sd=new RegExp("^(".concat(ru,")$")),ad=new RegExp("(".concat(ru,")"));function dn(n){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(et(n)||kt(n)&&(n=Ni(n),(e?id:od).test((n||"").replace(/[- ]/g,""))||(e?sd:ad).test(n)))}function nu(n){var e=Li(n);return dn(e="".concat(e," ").concat(iu(n)).trim())?e:""}function iu(n){var e="";return n&&n.childNodes&&n.childNodes.length&&Qe(n.childNodes,function(t){var r;if(t&&((r=t.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var o=Li(t);e="".concat(e," ").concat(o).trim(),t.childNodes&&t.childNodes.length&&(e="".concat(e," ").concat(iu(t)).trim())}catch(a){me.error("[AutoCapture]",a)}}),e}function ld(n){return function(e){var t=e.map(r=>{var o,a,u="";if(r.tag_name&&(u+=r.tag_name),r.attr_class)for(var h of(r.attr_class.sort(),r.attr_class))u+=".".concat(h.replace(/"/g,""));var p=D(D(D(D({},r.text?{text:r.text}:{}),{},{"nth-child":(o=r.nth_child)!==null&&o!==void 0?o:0,"nth-of-type":(a=r.nth_of_type)!==null&&a!==void 0?a:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),m={};return vi(p).sort((g,f)=>{var[b]=g,[y]=f;return b.localeCompare(y)}).forEach(g=>{var[f,b]=g;return m[Ja(f.toString())]=Ja(b.toString())}),u+=":",u+=vi(p).map(g=>{var[f,b]=g;return"".concat(f,'="').concat(b,'"')}).join("")});return t.join(";")}(function(e){return e.map(t=>{var r,o,a={text:(r=t.$el_text)===null||r===void 0?void 0:r.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:ud(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return vi(t).filter(u=>{var[h]=u;return h.indexOf("attr__")===0}).forEach(u=>{var[h,p]=u;return a.attributes[h]=p}),a})}(n))}function Ja(n){return n.replace(/"|\\"/g,'\\"')}function ud(n){var e=n.attr__class;return e?ut(e)?e:ss(e):void 0}var Uo="[SessionRecording]",Vo="redacted",di={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"]},cd=["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"],dd=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],hd=["/s/","/e/","/i/"];function Ka(n,e,t,r){if(et(n))return n;var o=(e==null?void 0:e["content-length"])||function(a){return new Blob([a]).size}(n);return kt(o)&&(o=parseInt(o)),o>t?Uo+" ".concat(r," body too large to record (").concat(o," bytes)"):n}function Qa(n,e){if(et(n))return n;var t=n;return dn(t,!1)||(t=Uo+" "+e+" body "+Vo),Qe(dd,r=>{var o,a;(o=t)!==null&&o!==void 0&&o.length&&((a=t)===null||a===void 0?void 0:a.indexOf(r))!==-1&&(t=Uo+" "+e+" body "+Vo+" as might contain: "+r)}),t}var pd=(n,e)=>{var t,r,o,a={payloadSizeLimitBytes:di.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...di.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...di.payloadHostDenyList]},u=n.session_recording.recordHeaders!==!1&&e.recordHeaders,h=n.session_recording.recordBody!==!1&&e.recordBody,p=n.capture_performance!==!1&&e.recordPerformance,m=(t=a,o=Math.min(1e6,(r=t.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),b=>(b!=null&&b.requestBody&&(b.requestBody=Ka(b.requestBody,b.requestHeaders,o,"Request")),b!=null&&b.responseBody&&(b.responseBody=Ka(b.responseBody,b.responseHeaders,o,"Response")),b)),g=b=>{return m(((T,j)=>{var $,G=sn(T.name),ce=j.indexOf("http")===0?($=sn(j))===null||$===void 0?void 0:$.pathname:j;ce==="/"&&(ce="");var se=G==null?void 0:G.pathname.replace(ce||"","");if(!(G&&se&&hd.some(Ee=>se.indexOf(Ee)===0)))return T})((k=(y=b).requestHeaders,et(k)||Qe(Object.keys(k??{}),T=>{cd.includes(T.toLowerCase())&&(k[T]=Vo)}),y),n.api_host));var y,k},f=Kt(n.session_recording.maskNetworkRequestFn);return f&&Kt(n.session_recording.maskCapturedNetworkRequestFn)&&me.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(n.session_recording.maskCapturedNetworkRequestFn=b=>{var y=n.session_recording.maskNetworkRequestFn({url:b.name});return D(D({},b),{},{name:y==null?void 0:y.url})}),a.maskRequestFn=Kt(n.session_recording.maskCapturedNetworkRequestFn)?b=>{var y,k,T,j=g(b);return j&&(y=(k=(T=n.session_recording).maskCapturedNetworkRequestFn)===null||k===void 0?void 0:k.call(T,j))!==null&&y!==void 0?y:void 0}:b=>function(y){if(!fe(y))return y.requestBody=Qa(y.requestBody,"Request"),y.responseBody=Qa(y.responseBody,"Response"),y}(g(b)),D(D(D({},di),a),{},{recordHeaders:u,recordBody:h,recordPerformance:p,recordInitialRequests:p})};function ur(n,e,t,r,o){return e>t&&(me.warn("min cannot be greater than max."),e=t),Ut(n)?n>t?(r&&me.warn(r+" cannot be greater than max: "+t+". Using max value instead."),t):n<e?(r&&me.warn(r+" cannot be less than min: "+e+". Using min value instead."),e):n:(r&&me.warn(r+" must be a number. using max or fallback. max: "+t+", fallback: "+o),ur(o||t,e,t,r))}class gd{constructor(e){var t,r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};U(this,"bucketSize",100),U(this,"refillRate",10),U(this,"mutationBuckets",{}),U(this,"loggedTracker",{}),U(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]})}),U(this,"getNodeOrRelevantParent",a=>{var u=this.rrweb.mirror.getNode(a);if((u==null?void 0:u.nodeName)!=="svg"&&u instanceof Element){var h=u.closest("svg");if(h)return[this.rrweb.mirror.getId(h),h]}return[a,u]}),U(this,"numberOfChanges",a=>{var u,h,p,m,g,f,b,y;return((u=(h=a.removes)===null||h===void 0?void 0:h.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)}),U(this,"throttleMutations",a=>{if(a.type!==3||a.data.source!==0)return a;var u=a.data,h=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||h===p?a:void 0}),this.rrweb=e,this.options=o,this.refillRate=ur((t=this.options.refillRate)!==null&&t!==void 0?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=ur((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var er=Uint8Array,Gt=Uint16Array,hn=Uint32Array,as=new er([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]),ls=new er([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]),el=new er([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ou=function(n,e){for(var t=new Gt(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];var o=new hn(t[30]);for(r=1;r<30;++r)for(var a=t[r];a<t[r+1];++a)o[a]=a-t[r]<<5|r;return[t,o]},su=ou(as,2),fd=su[0],zo=su[1];fd[28]=258,zo[258]=28;for(var tl=ou(ls,0)[1],au=new Gt(32768),rt=0;rt<32768;++rt){var Dr=(43690&rt)>>>1|(21845&rt)<<1;Dr=(61680&(Dr=(52428&Dr)>>>2|(13107&Dr)<<2))>>>4|(3855&Dr)<<4,au[rt]=((65280&Dr)>>>8|(255&Dr)<<8)>>>1}var An=function(n,e,t){for(var r=n.length,o=0,a=new Gt(e);o<r;++o)++a[n[o]-1];var u,h=new Gt(e);for(o=0;o<e;++o)h[o]=h[o-1]+a[o-1]<<1;for(u=new Gt(r),o=0;o<r;++o)u[o]=au[h[n[o]-1]++]>>>15-n[o];return u},zr=new er(288);for(rt=0;rt<144;++rt)zr[rt]=8;for(rt=144;rt<256;++rt)zr[rt]=9;for(rt=256;rt<280;++rt)zr[rt]=7;for(rt=280;rt<288;++rt)zr[rt]=8;var Ri=new er(32);for(rt=0;rt<32;++rt)Ri[rt]=5;var vd=An(zr,9),md=An(Ri,5),lu=function(n){return(n/8>>0)+(7&n&&1)},uu=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof Gt?Gt:n instanceof hn?hn:er)(t-e);return r.set(n.subarray(e,t)),r},fr=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8},wn=function(n,e,t){t<<=7&e;var r=e/8>>0;n[r]|=t,n[r+1]|=t>>>8,n[r+2]|=t>>>16},So=function(n,e){for(var t=[],r=0;r<n.length;++r)n[r]&&t.push({s:r,f:n[r]});var o=t.length,a=t.slice();if(!o)return[new er(0),0];if(o==1){var u=new er(t[0].s+1);return u[t[0].s]=1,[u,1]}t.sort(function(Ee,qe){return Ee.f-qe.f}),t.push({s:-1,f:25001});var h=t[0],p=t[1],m=0,g=1,f=2;for(t[0]={s:-1,f:h.f+p.f,l:h,r:p};g!=o-1;)h=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:h.f+p.f,l:h,r:p};var b=a[0].s;for(r=1;r<o;++r)a[r].s>b&&(b=a[r].s);var y=new Gt(b+1),k=Yo(t[g-1],y,0);if(k>e){r=0;var T=0,j=k-e,$=1<<j;for(a.sort(function(Ee,qe){return y[qe.s]-y[Ee.s]||Ee.f-qe.f});r<o;++r){var G=a[r].s;if(!(y[G]>e))break;T+=$-(1<<k-y[G]),y[G]=e}for(T>>>=j;T>0;){var ce=a[r].s;y[ce]<e?T-=1<<e-y[ce]++-1:++r}for(;r>=0&&T;--r){var se=a[r].s;y[se]==e&&(--y[se],++T)}k=e}return[new er(y),k]},Yo=function(n,e,t){return n.s==-1?Math.max(Yo(n.l,e,t+1),Yo(n.r,e,t+1)):e[n.s]=t},rl=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Gt(++e),r=0,o=n[0],a=1,u=function(p){t[r++]=p},h=1;h<=e;++h)if(n[h]==o&&h!=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=n[h]}return[t.subarray(0,r),e]},Sn=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},Zo=function(n,e,t){var r=t.length,o=lu(e+2);n[o]=255&r,n[o+1]=r>>>8,n[o+2]=255^n[o],n[o+3]=255^n[o+1];for(var a=0;a<r;++a)n[o+a+4]=t[a];return 8*(o+4+r)},nl=function(n,e,t,r,o,a,u,h,p,m,g){fr(e,g++,t),++o[256];for(var f=So(o,15),b=f[0],y=f[1],k=So(a,15),T=k[0],j=k[1],$=rl(b),G=$[0],ce=$[1],se=rl(T),Ee=se[0],qe=se[1],ye=new Gt(19),Se=0;Se<G.length;++Se)ye[31&G[Se]]++;for(Se=0;Se<Ee.length;++Se)ye[31&Ee[Se]]++;for(var Le=So(ye,7),je=Le[0],Ye=Le[1],nt=19;nt>4&&!je[el[nt-1]];--nt);var dt,bt,mt,Ze,ht=m+5<<3,Tt=Sn(o,zr)+Sn(a,Ri)+u,wt=Sn(o,b)+Sn(a,T)+u+14+3*nt+Sn(ye,je)+(2*ye[16]+3*ye[17]+7*ye[18]);if(ht<=Tt&&ht<=wt)return Zo(e,g,n.subarray(p,p+m));if(fr(e,g,1+(wt<Tt)),g+=2,wt<Tt){dt=An(b,y),bt=b,mt=An(T,j),Ze=T;var xt=An(je,Ye);for(fr(e,g,ce-257),fr(e,g+5,qe-1),fr(e,g+10,nt-4),g+=14,Se=0;Se<nt;++Se)fr(e,g+3*Se,je[el[Se]]);g+=3*nt;for(var zt=[G,Ee],tt=0;tt<2;++tt){var pt=zt[tt];for(Se=0;Se<pt.length;++Se){var ze=31&pt[Se];fr(e,g,xt[ze]),g+=je[ze],ze>15&&(fr(e,g,pt[Se]>>>5&127),g+=pt[Se]>>>12)}}}else dt=vd,bt=zr,mt=md,Ze=Ri;for(Se=0;Se<h;++Se)if(r[Se]>255){ze=r[Se]>>>18&31,wn(e,g,dt[ze+257]),g+=bt[ze+257],ze>7&&(fr(e,g,r[Se]>>>23&31),g+=as[ze]);var Je=31&r[Se];wn(e,g,mt[Je]),g+=Ze[Je],Je>3&&(wn(e,g,r[Se]>>>5&8191),g+=ls[Je])}else wn(e,g,dt[r[Se]]),g+=bt[r[Se]];return wn(e,g,dt[256]),g+bt[256]},_d=new hn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yd=function(){for(var n=new hn(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;n[e]=t}return n}(),bd=function(){var n=4294967295;return{p:function(e){for(var t=n,r=0;r<e.length;++r)t=yd[255&t^e[r]]^t>>>8;n=t},d:function(){return 4294967295^n}}},wd=function(n,e,t,r,o){return function(a,u,h,p,m,g){var f=a.length,b=new er(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 j=T+65535;j<f?k=Zo(y,k,a.subarray(T,j)):(y[T]=g,k=Zo(y,k,a.subarray(T,f)))}else{for(var $=_d[u-1],G=$>>>13,ce=8191&$,se=(1<<h)-1,Ee=new Gt(32768),qe=new Gt(se+1),ye=Math.ceil(h/3),Se=2*ye,Le=function(Re){return(a[Re]^a[Re+1]<<ye^a[Re+2]<<Se)&se},je=new hn(25e3),Ye=new Gt(288),nt=new Gt(32),dt=0,bt=0,mt=(T=0,0),Ze=0,ht=0;T<f;++T){var Tt=Le(T),wt=32767&T,xt=qe[Tt];if(Ee[wt]=xt,qe[Tt]=wt,Ze<=T){var zt=f-T;if((dt>7e3||mt>24576)&&zt>423){k=nl(a,y,0,je,Ye,nt,bt,mt,ht,T-ht,k),mt=dt=bt=0,ht=T;for(var tt=0;tt<286;++tt)Ye[tt]=0;for(tt=0;tt<30;++tt)nt[tt]=0}var pt=2,ze=0,Je=ce,St=wt-xt&32767;if(zt>2&&Tt==Le(T-St))for(var Mt=Math.min(G,zt)-1,cr=Math.min(32767,T),Yt=Math.min(258,zt);St<=cr&&--Je&&wt!=xt;){if(a[T+pt]==a[T+pt-St]){for(var It=0;It<Yt&&a[T+It]==a[T+It-St];++It);if(It>pt){if(pt=It,ze=St,It>Mt)break;var F=Math.min(St,It-2),x=0;for(tt=0;tt<F;++tt){var L=T-St+tt+32768&32767,H=L-Ee[L]+32768&32767;H>x&&(x=H,xt=L)}}}St+=(wt=xt)-(xt=Ee[wt])+32768&32767}if(ze){je[mt++]=268435456|zo[pt]<<18|tl[ze];var ee=31&zo[pt],he=31&tl[ze];bt+=as[ee]+ls[he],++Ye[257+ee],++nt[he],Ze=T+pt,++dt}else je[mt++]=a[T],++Ye[a[T]]}}k=nl(a,y,g,je,Ye,nt,bt,mt,ht,T-ht,k)}return uu(b,0,p+lu(k)+m)}(n,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+e.mem,t,r,!o)},Xo=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},Sd=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&Xo(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},Id=function(n){return 10+(n.filename&&n.filename.length+1||0)};function cu(n,e){e===void 0&&(e={});var t=bd(),r=n.length;t.p(n);var o=wd(n,e,Id(e),8),a=o.length;return Sd(o,e),Xo(o,a-8,t.d()),Xo(o,a-4,r),o}function du(n,e){var t=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var r=new er(n.length+(n.length>>>1)),o=0,a=function(m){r[o++]=m},u=0;u<t;++u){if(o+5>r.length){var h=new er(o+8+(t-u<<1));h.set(r),r=h}var p=n.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&n.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 uu(r,0,o)}var Mn="[SessionRecording]",Rt=Lt(Mn),Cd=3e5,Ed=[sr.MouseMove,sr.MouseInteraction,sr.Scroll,sr.ViewportResize,sr.Input,sr.TouchMove,sr.MediaInteraction,sr.Drag],il=n=>({rrwebMethod:n,enqueuedAt:Date.now(),attempt:1});function Br(n){return function(e,t){for(var r="",o=0;o<e.length;){var a=e[o++];a<128||t?r+=String.fromCharCode(a):a<224?r+=String.fromCharCode((31&a)<<6|63&e[o++]):a<240?r+=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,r+=String.fromCharCode(55296|a>>10,56320|1023&a))}return r}(cu(du(JSON.stringify(n))),!0)}function ol(n){return n.type===mr.Custom&&n.data.tag==="sessionIdle"}function sl(n,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(n))}class kd{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return Ce==null||(e=Ce.__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(Mn+" 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(Tn);return qr(e)?e:null}get sessionDuration(){var e,t,r=(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 r?r.timestamp-o:null}get isRecordingEnabled(){var e=!!this.instance.get_property(Ao),t=!this.instance.config.disable_session_recording;return C&&e&&t}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(Fa),t=this.instance.config.enable_recording_console_log;return t??e}get canvasRecording(){var e,t,r,o,a,u,h=this.instance.config.session_recording.captureCanvas,p=this.instance.get_property(La),m=(e=(t=h==null?void 0:h.recordCanvas)!==null&&t!==void 0?t:p==null?void 0:p.enabled)!==null&&e!==void 0&&e,g=(r=(o=h==null?void 0:h.canvasFps)!==null&&o!==void 0?o:p==null?void 0:p.fps)!==null&&r!==void 0?r:0,f=(a=(u=h==null?void 0:h.canvasQuality)!==null&&u!==void 0?u:p==null?void 0:p.quality)!==null&&a!==void 0?a:0;return{enabled:m,fps:ur(g,0,12,"canvas recording fps"),quality:ur(f,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,r=this.instance.get_property(Pa),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)||(r==null?void 0:r.recordHeaders),u=(o==null?void 0:o.recordBody)||(r==null?void 0:r.recordBody),h=ct(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,p=!!(qr(h)?h:r!=null&&r.capturePerformance);return a||u||p?{recordHeaders:a,recordBody:u,recordPerformance:p}:void 0}get sampleRate(){var e=this.instance.get_property(Da);return Ut(e)?e:null}get minimumDuration(){var e=this.instance.get_property(Ba);return Ut(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this._urlBlocked?"paused":et(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":qr(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(vo))===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(mo))===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(U(this,"queuedRRWebEvents",[]),U(this,"isIdle",!1),U(this,"_linkedFlagSeen",!1),U(this,"_lastActivityTimestamp",Date.now()),U(this,"_linkedFlag",null),U(this,"_removePageViewCaptureHook",void 0),U(this,"_onSessionIdListener",void 0),U(this,"_persistDecideOnSessionListener",void 0),U(this,"_samplingSessionListener",void 0),U(this,"_urlTriggers",[]),U(this,"_urlBlocklist",[]),U(this,"_urlBlocked",!1),U(this,"_eventTriggers",[]),U(this,"_removeEventTriggerCaptureHook",void 0),U(this,"_forceAllowLocalhostNetworkCapture",!1),U(this,"_onBeforeUnload",()=>{this._flushBuffer()}),U(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),U(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),U(this,"_onVisibilityChange",()=>{if(ne!=null&&ne.visibilityState){var o="window "+ne.visibilityState;this._tryAddCustomEvent(o,{})}}),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Rt.error("started without valid sessionManager"),new Error(Mn+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Mn+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:t,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Rt.warn("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(),et(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",t=>{try{if(t.event==="$pageview"){var r=t!=null&&t.properties.$current_url?this._maskUrl(t==null?void 0:t.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(o){Rt.error("Could not add $pageview to rrweb session",o)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((t,r,o)=>{var a,u,h,p;o&&(this._tryAddCustomEvent("$session_id_change",{sessionId:t,windowId:r,changeReason:o}),(a=this.instance)===null||a===void 0||(u=a.persistence)===null||u===void 0||u.unregister(mo),(h=this.instance)===null||h===void 0||(p=h.persistence)===null||p===void 0||p.unregister(vo))}))):this.stopRecording()}stopRecording(){var e,t,r,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,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(o=this._samplingSessionListener)===null||o===void 0||o.call(this),this._samplingSessionListener=void 0,Rt.info("stopped"))}makeSamplingDecision(e){var t,r=this.sessionId!==e,o=this.sampleRate;if(Ut(o)){var a,u=this.isSampled,h=r||!qr(u);h?a=Math.random()<o:a=u,h&&(a?this._reportStarted("sampled"):Rt.warn("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({[Tn]:a})}else{var p;(p=this.instance.persistence)===null||p===void 0||p.register({[Tn]:null})}}onRemoteConfig(e){var t,r,o,a,u,h;if(this._persistRemoteConfig(e),this._linkedFlag=((t=e.sessionRecording)===null||t===void 0?void 0:t.linkedFlag)||null,(r=e.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(h=e.sessionRecording)===null||h===void 0?void 0:h.endpoint),this._setupSampling(),!et(this._linkedFlag)&&!this._linkedFlagSeen){var p=kt(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,m=kt(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((g,f)=>{var b=ct(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)&&et(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(e=>{this.makeSamplingDecision(e)}))}_persistRemoteConfig(e){if(this.instance.persistence){var t,r=this.instance.persistence,o=()=>{var a,u,h,p,m,g,f,b,y=(a=e.sessionRecording)===null||a===void 0?void 0:a.sampleRate,k=et(y)?null:parseFloat(y),T=(u=e.sessionRecording)===null||u===void 0?void 0:u.minimumDurationMilliseconds;r.register({[Ao]:!!e.sessionRecording,[Fa]:(h=e.sessionRecording)===null||h===void 0?void 0:h.consoleLogRecordingEnabled,[Pa]:D({capturePerformance:e.capturePerformance},(p=e.sessionRecording)===null||p===void 0?void 0:p.networkPayloadCapture),[La]:{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},[Da]:k,[Ba]:fe(T)?null:T,[Ha]:(b=e.sessionRecording)===null||b===void 0?void 0:b.scriptConfig})};o(),(t=this._persistDecideOnSessionListener)===null||t===void 0||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(o)}}log(e){var t,r=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:r,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!fe(Object.assign)&&!fe(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():(t=Ce.__PosthogExtensions__)===null||t===void 0||(r=t.loadExternalDependency)===null||r===void 0||r.call(t,this.instance,this.scriptName,o=>{if(o)return Rt.error("could not load recorder",o);this._onScriptLoaded()}),Rt.info("starting"),this.status==="active"&&this._reportStarted(e||"recording_initialized")}}get scriptName(){var e,t,r;return((e=this.instance)===null||e===void 0||(t=e.persistence)===null||t===void 0||(r=t.get_property(Ha))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(e){var t;return e.type===3&&Ed.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 r=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)),!this.isIdle){var{windowId:o,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),u=this.sessionId!==a,h=this.windowId!==o;this.windowId=o,this.sessionId=a,u||h?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&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}):Rt.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(il(()=>this.rrwebRecord.addCustomEvent(e,t)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(il(()=>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},r=this.instance.config.session_recording;for(var[o,a]of Object.entries(r||{}))o in t&&(o==="maskInputOptions"?t.maskInputOptions=D({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 gd(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(h,p)=>{var m="Too many mutations on node '".concat(h,"'. Rate limiting. This could be due to SVG animations or something similar");Rt.info(m,{node:p}),this.log(Mn+" "+m,"warn")}});var u=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(D({emit:h=>{this.onRRwebEmit(h)},plugins:u},t)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:u.map(h=>h==null?void 0:h.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Rt.error("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,r,o,a=[],u=(e=Ce.__PosthogExtensions__)===null||e===void 0||(t=e.rrwebPlugins)===null||t===void 0?void 0:t.getRecordConsolePlugin;u&&this.isConsoleLogCaptureEnabled&&a.push(u());var h=(r=Ce.__PosthogExtensions__)===null||r===void 0||(o=r.rrwebPlugins)===null||o===void 0?void 0:o.getRecordNetworkPlugin;return this.networkPayloadCapture&&Kt(h)&&(!qc.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?a.push(h(pd(this.instance.config,this.networkPayloadCapture))):Rt.info("NetworkCapture not started because we are on localhost.")),a}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&ct(e)){if(e.type===mr.Meta){var r=this._maskUrl(e.data.href);if(this._lastHref=r,!r)return;e.data.href=r}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&&ct(b)&&b.type===6&&ct(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||ol(a)){if(ol(a)){var u=a.data.payload;if(u){var h=u.lastActivityTimestamp,p=u.threshold;a.timestamp=h+p}}var m=(t=this.instance.config.session_recording.compress_events)===null||t===void 0||t?function(f){if(Ti(f)<1024)return f;try{if(f.type===mr.FullSnapshot)return D(D({},f),{},{data:Br(f.data),cv:"2024-10"});if(f.type===mr.IncrementalSnapshot&&f.data.source===sr.Mutation)return D(D({},f),{},{cv:"2024-10",data:D(D({},f.data),{},{texts:Br(f.data.texts),attributes:Br(f.data.attributes),removes:Br(f.data.removes),adds:Br(f.data.adds)})});if(f.type===mr.IncrementalSnapshot&&f.data.source===sr.StyleSheetRule)return D(D({},f),{},{cv:"2024-10",data:D(D({},f.data),{},{adds:Br(f.data.adds),removes:Br(f.data.removes)})})}catch(b){Rt.error("could not compress event - will use uncompressed event",b)}return f}(a):a,g={$snapshot_bytes:Ti(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 r,o={url:e};return(r=o=t.maskNetworkRequestFn(o))===null||r===void 0?void 0:r.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,r=Ut(t)&&t>=0,o=Ut(e)&&r&&t<e;return this.status==="buffering"||o?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&Go(this.buffer).forEach(a=>{this._captureSnapshot({$snapshot_bytes:a.size,$snapshot_data:a.data,$session_id:a.sessionId,$window_id:a.windowId,$lib:"web",$lib_version:yr.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(e){var t,r=2+(((t=this.buffer)===null||t===void 0?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+r>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",r=sl(e,this._urlBlocklist);r&&!t?this._pauseRecording():!r&&t&&this._resumeRecording(),sl(e,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,r;this.triggerStatus==="trigger_pending"&&((t=this.instance)===null||t===void 0||(r=t.persistence)===null||r===void 0||r.register({[e==="url"?vo:mo]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;this.status!=="paused"&&(this._urlBlocked=!0,ne==null||(e=ne.body)===null||e===void 0||(t=e.classList)===null||t===void 0||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout(()=>{this._flushBuffer()},100),Rt.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;this.status==="paused"&&(this._urlBlocked=!1,ne==null||(e=ne.body)===null||e===void 0||(t=e.classList)===null||t===void 0||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Rt.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&et(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(t){Rt.error("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({[Tn]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),Rt.info(e.replace("_"," "),t),De(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}}var In=Lt("[Decide]");class Td{constructor(e){this.instance=e}_loadRemoteConfigJs(e){var t,r,o;(t=Ce.__PosthogExtensions__)!==null&&t!==void 0&&t.loadExternalDependency?(r=Ce.__PosthogExtensions__)===null||r===void 0||(o=r.loadExternalDependency)===null||o===void 0||o.call(r,this.instance,"remote-config",()=>e(Ce._POSTHOG_CONFIG)):(In.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:t=>{e(t.json)}})}load(){if(this.instance.config.__preview_remote_config)return Ce._POSTHOG_CONFIG?(In.info("Using preloaded remote config",Ce._POSTHOG_CONFIG),void this.onRemoteConfig(Ce._POSTHOG_CONFIG)):void(this.instance.config.advanced_disable_decide?In.warn("Remote config is disabled. Falling back to local config."):this._loadRemoteConfigJs(e=>{if(!e)return In.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(t=>{this.onRemoteConfig(t)});this.onRemoteConfig(e)}))}onRemoteConfig(e){e?(this.instance._onRemoteConfig(e),e.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):In.error("Failed to fetch remote config from PostHog.")}}var _r,xd=C!=null&&C.location?Ei(C.location.hash,"__posthog")||Ei(location.hash,"state"):null,al="_postHogToolbarParams";(function(n){n[n.UNINITIALIZED=0]="UNINITIALIZED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED"})(_r||(_r={}));class Rd{constructor(e){this.instance=e}setToolbarState(e){Ce.ph_toolbar_state=e}getToolbarState(){var e;return(e=Ce.ph_toolbar_state)!==null&&e!==void 0?e:_r.UNINITIALIZED}maybeLoadToolbar(){var e,t,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!C||!ne)return!1;r=(e=r)!==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,h=xd||Ei(r.hash,"__posthog")||Ei(r.hash,"state"),p=h?ka(()=>JSON.parse(atob(decodeURIComponent(h))))||ka(()=>JSON.parse(decodeURIComponent(h))):null;return p&&p.action==="ph_authorize"?((u=p).source="url",u&&Object.keys(u).length>0&&(p.desiredHash?r.hash=p.desiredHash:a?a.replaceState(a.state,"",r.pathname+r.search):r.hash="")):((u=JSON.parse(o.getItem(al)||"{}")).source="localstorage",delete u.userIntent),!(!u.token||this.instance.config.token!==u.token)&&(this.loadToolbar(u),!0)}catch{return!1}}_callLoadToolbar(e){(Ce.ph_load_toolbar||Ce.ph_load_editor)(e,this.instance)}loadToolbar(e){var t=!(ne==null||!ne.getElementById(Ol));if(!C||t)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,o=D(D({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(C.localStorage.setItem(al,JSON.stringify(D(D({},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=Ce.__PosthogExtensions__)===null||a===void 0||(u=a.loadExternalDependency)===null||u===void 0||u.call(a,this.instance,"toolbar",h=>{if(h)return me.error("[Toolbar] Failed to load",h),void this.setToolbarState(_r.UNINITIALIZED);this.setToolbarState(_r.LOADED),this._callLoadToolbar(o)}),br(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,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,r)}}class Md{constructor(e){U(this,"isPaused",!0),U(this,"queue",[]),U(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),r=[...t.filter(o=>o.url.indexOf("/e")===0),...t.filter(o=>o.url.indexOf("/e")!==0)];r.map(o=>{this.sendRequest(D(D({},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(),r=function(a){var u=t[a],h=new Date().getTime();u.data&&ut(u.data)&&Qe(u.data,p=>{p.offset=Math.abs(p.timestamp-h),delete p.timestamp}),e.sendRequest(u)};for(var o in t)r(o)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return Qe(this.queue,t=>{var r,o=t,a=(o?o.batchKey:null)||o.url;fe(e[a])&&(e[a]=D(D({},o),{},{data:[]})),(r=e[a].data)===null||r===void 0||r.push(o.data)}),this.queue=[],e}}var Ad=!!xo||!!To,ll="text/plain",Mi=(n,e)=>{var[t,r]=n.split("?"),o=D({},e);r==null||r.split("&").forEach(u=>{var[h]=u.split("=");delete o[h]});var a=Uc(o);return a=a?(r?r+"&":"")+a:r,"".concat(t,"?").concat(a)},hi=(n,e)=>JSON.stringify(n,(t,r)=>typeof r=="bigint"?r.toString():r,e),Io=n=>{var{data:e,compression:t}=n;if(e){if(t===ar.GZipJS){var r=cu(du(hi(e)),{mtime:0}),o=new Blob([r],{type:ll});return{contentType:ll,body:o,estimatedSize:o.size}}if(t===ar.Base64){var a=function(p){var m,g,f,b,y,k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",T=0,j=0,$="",G=[];if(!p)return p;p=xc(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[j++]=k.charAt(m)+k.charAt(g)+k.charAt(f)+k.charAt(b);while(T<p.length);switch($=G.join(""),p.length%3){case 1:$=$.slice(0,-2)+"==";break;case 2:$=$.slice(0,-1)+"="}return $}(hi(e)),u=(p=>"data="+encodeURIComponent(typeof p=="string"?p:hi(p)))(a);return{contentType:"application/x-www-form-urlencoded",body:u,estimatedSize:new Blob([u]).size}}var h=hi(e);return{contentType:"application/json",body:h,estimatedSize:new Blob([h]).size}}},On=[];xo&&On.push({transport:"XHR",method:n=>{var e,t=new xo;t.open(n.method||"GET",n.url,!0);var{contentType:r,body:o}=(e=Io(n))!==null&&e!==void 0?e:{};Qe(n.headers,function(a,u){t.setRequestHeader(u,a)}),r&&t.setRequestHeader("Content-Type",r),n.timeout&&(t.timeout=n.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=n.callback)===null||a===void 0||a.call(n,u)}},t.send(o)}}),To&&On.push({transport:"fetch",method:n=>{var e,t,{contentType:r,body:o,estimatedSize:a}=(e=Io(n))!==null&&e!==void 0?e:{},u=new Headers;Qe(n.headers,function(g,f){u.append(f,g)}),r&&u.append("Content-Type",r);var h=n.url,p=null;if(Ea){var m=new Ea;p={signal:m.signal,timeout:setTimeout(()=>m.abort(),n.timeout)}}To(h,D({method:(n==null?void 0:n.method)||"GET",headers:u,keepalive:n.method==="POST"&&(a||0)<52428.8,body:o,signal:(t=p)===null||t===void 0?void 0:t.signal},n.fetchOptions)).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){me.error(k)}(b=n.callback)===null||b===void 0||b.call(n,y)})).catch(g=>{var f;me.error(g),(f=n.callback)===null||f===void 0||f.call(n,{statusCode:0,text:g})}).finally(()=>p?clearTimeout(p.timeout):null)}}),Vt!=null&&Vt.sendBeacon&&On.push({transport:"sendBeacon",method:n=>{var e=Mi(n.url,{beacon:"1"});try{var t,{contentType:r,body:o}=(t=Io(n))!==null&&t!==void 0?t:{},a=typeof o=="string"?new Blob([o],{type:r}):o;Vt.sendBeacon(e,a)}catch{}}});var Od=["retriesPerformedSoFar"];class Nd{constructor(e){U(this,"isPolling",!1),U(this,"pollIntervalMs",3e3),U(this,"queue",[]),this.instance=e,this.queue=[],this.areWeOnline=!0,!fe(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,r=Rl(e,Od);Ut(t)&&t>0&&(r.url=Mi(r.url,{retry_count:t})),this.instance._send_request(D(D({},r),{},{callback:o=>{var a;o.statusCode!==200&&(o.statusCode<400||o.statusCode>=500)&&(t??0)<10?this.enqueue(D({retriesPerformedSoFar:t},r)):(a=r.callback)===null||a===void 0||a.call(r,o)}}))}enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(u){var h=3e3*Math.pow(2,u),p=h/2,m=Math.min(18e5,h),g=(Math.random()-.5)*(m-p);return Math.ceil(m+g)}(t),o=Date.now()+r;this.queue.push({retryAt:o,requestOptions:e});var a="Enqueued failed request for retry in ".concat(r);navigator.onLine||(a+=" (Browser is offline)"),me.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=[],r=this.queue.filter(a=>a.retryAt<e||(t.push(a),!1));if(this.queue=t,r.length>0)for(var{requestOptions:o}of r)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(D(D({},e),{},{transport:"sendBeacon"}))}catch(t){me.error(t)}this.queue=[]}}var Ur,ul=Lt("[SessionId]");class Fd{constructor(e,t,r){var o;if(U(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=e.config,this.persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Rr,this._windowIdGenerator=r||Rr;var a=this.config.persistence_name||this.config.token,u=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ur(u,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+a+"_window_id",this._primary_window_exists_storage_key="ph_"+a+"_primary_window_exists",this._canUseSessionStorage()){var h=Et.parse(this._window_id_storage_key),p=Et.parse(this._primary_window_exists_storage_key);h&&!p?this._windowId=h:Et.remove(this._window_id_storage_key),Et.set(this._primary_window_exists_storage_key,!0)}if((o=this.config.bootstrap)!==null&&o!==void 0&&o.sessionID)try{var m=(g=>{var f=g.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),m)}catch(g){ul.error("Invalid sessionID in bootstrap",g)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return fe(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,r){e===this._sessionId&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[bi]:[t,e,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[bi];return ut(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;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var r=t||new Date().getTime(),[o,a,u]=this._getSessionId(),h=this._getWindowId(),p=Ut(u)&&u>0&&Math.abs(r-u)>864e5,m=!1,g=!a,f=!e&&Math.abs(r-o)>this.sessionTimeoutMs;g||f||p?(a=this._sessionIdGenerator(),h=this._windowIdGenerator(),ul.info("new session ID generated",{sessionId:a,windowId:h,changeReason:{noSessionId:g,activityTimeout:f,sessionPastMaximumLength:p}}),u=r,m=!0):h||(h=this._windowIdGenerator(),m=!0);var b=o===0||!e||p?r:o,y=u===0?new Date().getTime():u;return this._setWindowId(h),this._setSessionId(a,b,y),e||this.resetIdleTimer(),m&&this._sessionIdChangedHandlers.forEach(k=>k(a,h,m?{noSessionId:g,activityTimeout:f,sessionPastMaximumLength:p}:void 0)),{sessionId:a,windowId:h,sessionStartTimestamp:y,changeReason:m?{noSessionId:g,activityTimeout:f,sessionPastMaximumLength:p}:void 0,lastActivityTimestamp:o}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}(function(n){n.US="us",n.EU="eu",n.CUSTOM="custom"})(Ur||(Ur={}));var cl="i.posthog.com";class Pd{constructor(e){U(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(cl),".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]=Ur.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ur.EU:this._regionCache[this.apiHost]=Ur.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===Ur.CUSTOM)return this.apiHost+t;var r=cl+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}}var hu="posthog-js";function pu(n){var{organization:e,projectId:t,prefix:r,severityAllowList:o=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return a=>{var u,h,p,m,g;if(!(o==="*"||o.includes(a.level))||!n.__loaded)return a;a.tags||(a.tags={});var f=n.requestRouter.endpointFor("ui","/project/".concat(n.config.token,"/person/").concat(n.get_distinct_id()));a.tags["PostHog Person URL"]=f,n.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=n.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:((h=b[0])===null||h===void 0?void 0:h.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=(r||"https://sentry.io/organizations/")+e+"/issues/?project="+t+"&query="+a.event_id),n.exceptions.sendExceptionEvent(y),a}}class Ld{constructor(e,t,r,o,a){this.name=hu,this.setupOnce=function(u){u(pu(e,{organization:t,projectId:r,prefix:o,severityAllowList:a}))}}}var dl,Ai,or,Co=Lt("[SegmentIntegration]");function Dd(n,e){var t=n.config.segment;if(!t)return e();(function(r,o){var a=r.config.segment;if(!a)return o();var u=p=>{var m=()=>p.anonymousId()||Rr();r.config.get_device_id=m,p.id()&&(r.register({distinct_id:p.id(),$device_id:m()}),r.persistence.set_property(vr,"identified")),o()},h=a.user();"then"in h&&Kt(h.then)?h.then(p=>u(p)):u(h)})(n,()=>{t.register((r=>{Promise&&Promise.resolve||Co.warn("This browser does not have Promise support, and can not use the segment integration");var o=(a,u)=>{var h;if(!u)return a;a.event.userId||a.event.anonymousId===r.get_distinct_id()||(Co.info("No userId set, resetting PostHog"),r.reset()),a.event.userId&&a.event.userId!==r.get_distinct_id()&&(Co.info("UserId set, identifying with PostHog"),r.identify(a.event.userId));var p=r._calculate_event_properties(u,(h=a.event.properties)!==null&&h!==void 0?h:{},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")}})(n)).then(()=>{e()})})}class Bd{constructor(e){this._instance=e}doPageView(e){var t,r=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,r}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,r=this._prevPageviewTimestamp,o=this._instance.scrollManager.getContext();if(!r)return{};var a={};if(o){var{maxScrollHeight:u,lastScrollY:h,maxScrollY:p,maxContentHeight:m,lastContentY:g,maxContentY:f}=o;fe(u)||fe(h)||fe(p)||fe(m)||fe(g)||fe(f)||(u=Math.ceil(u),h=Math.ceil(h),p=Math.ceil(p),m=Math.ceil(m),g=Math.ceil(g),f=Math.ceil(f),a={$prev_pageview_last_scroll:h,$prev_pageview_last_scroll_percentage:u<=1?1:ur(h/u,0,1),$prev_pageview_max_scroll:p,$prev_pageview_max_scroll_percentage:u<=1?1:ur(p/u,0,1),$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:m<=1?1:ur(g/m,0,1),$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:m<=1?1:ur(f/m,0,1)})}return t&&(a.$prev_pageview_pathname=t),r&&(a.$prev_pageview_duration=(e.getTime()-r.getTime())/1e3),a}}(function(n){n.Popover="popover",n.API="api",n.Widget="widget"})(dl||(dl={})),function(n){n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link"}(Ai||(Ai={})),function(n){n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question"}(or||(or={}));class gu{constructor(){U(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(r=>r!==t)}}emit(e,t){for(var r of this.events[e]||[])r(t);for(var o of this.events["*"]||[])o(e,t)}}class Gr{constructor(e){U(this,"_debugEventEmitter",new gu),U(this,"checkStep",(t,r)=>this.checkStepEvent(t,r)&&this.checkStepUrl(t,r)&&this.checkStepElement(t,r)),U(this,"checkStepEvent",(t,r)=>r==null||!r.event||(t==null?void 0:t.event)===(r==null?void 0:r.event)),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!fe((e=this.instance)===null||e===void 0?void 0:e._addCaptureHook)){var t;(t=this.instance)===null||t===void 0||t._addCaptureHook((r,o)=>{this.on(r,o)})}}register(e){var t,r;if(!fe((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(u=>{var h,p;(h=this.actionRegistry)===null||h===void 0||h.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)||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var o,a=new Set;e.forEach(u=>{var h;(h=u.steps)===null||h===void 0||h.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 r;t!=null&&e.length!=0&&(this.actionEvents.has(e)||this.actionEvents.has(t==null?void 0:t.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.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 r of t.steps)if(this.checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(t!=null&&t.url){var r,o=e==null||(r=e.properties)===null||r===void 0?void 0:r.$current_url;if(!o||typeof o!="string"||!Gr.matchString(o,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static matchString(e,t,r){switch(r){case"regex":return!!C&&un(e,t);case"exact":return t===e;case"contains":var o=Gr.escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*");return un(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&&!Gr.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&&!Gr.matchString(a.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!Gr.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 r,o=e==null||(r=e.properties)===null||r===void 0?void 0:r.$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 Bn{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;fe((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter(r=>{var o,a,u,h;return((o=r.conditions)===null||o===void 0?void 0:o.actions)&&((a=r.conditions)===null||a===void 0||(u=a.actions)===null||u===void 0||(h=u.values)===null||h===void 0?void 0:h.length)>0});t.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Gr(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),t.forEach(r=>{var o,a,u,h,p,m,g,f,b,y;r.conditions&&(o=r.conditions)!==null&&o!==void 0&&o.actions&&(a=r.conditions)!==null&&a!==void 0&&(u=a.actions)!==null&&u!==void 0&&u.values&&((h=r.conditions)===null||h===void 0||(p=h.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(r.conditions.actions.values),(f=r.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(r.id),this.actionToSurveys.set(k.name,T||[r.id])}}))}))}setupEventBasedSurveys(e){var t;e.filter(r=>{var o,a,u,h;return((o=r.conditions)===null||o===void 0?void 0:o.events)&&((a=r.conditions)===null||a===void 0||(u=a.events)===null||u===void 0||(h=u.values)===null||h===void 0?void 0:h.length)>0}).length!==0&&((t=this.instance)===null||t===void 0||t._addCaptureHook((r,o)=>{this.onEvent(r,o)}),e.forEach(r=>{var o,a,u;(o=r.conditions)===null||o===void 0||(a=o.events)===null||a===void 0||(u=a.values)===null||u===void 0||u.forEach(h=>{if(h&&h.name){var p=this.eventToSurveys.get(h.name);p&&p.push(r.id),this.eventToSurveys.set(h.name,p||[r.id])}})}))}onEvent(e,t){var r,o,a=((r=this.instance)===null||r===void 0||(o=r.persistence)===null||o===void 0?void 0:o.props[oi])||[];if(Bn.SURVEY_SHOWN_EVENT_NAME==e&&t&&a.length>0){var u,h=t==null||(u=t.properties)===null||u===void 0?void 0:u.$survey_id;if(h){var p=a.indexOf(h);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,r,o=((t=this.instance)===null||t===void 0||(r=t.persistence)===null||r===void 0?void 0:r.props[oi])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(o.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,r;(t=this.instance)===null||t===void 0||(r=t.persistence)===null||r===void 0||r.register({[oi]:[...new Set(e)]})}getSurveys(){var e,t,r=(e=this.instance)===null||e===void 0||(t=e.persistence)===null||t===void 0?void 0:t.props[oi];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}U(Bn,"SURVEY_SHOWN_EVENT_NAME","survey shown");var fu,lt,vu,jr,hl,mu,Jo,_u,Ko={},yu=[],Hd=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,us=Array.isArray;function Mr(n,e){for(var t in e)n[t]=e[t];return n}function bu(n){var e=n.parentNode;e&&e.removeChild(n)}function Eo(n,e,t,r,o){var a={type:n,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++vu,__i:-1,__u:0};return o==null&<.vnode!=null&<.vnode(a),a}function cs(n){return n.children}function mi(n,e){this.props=n,this.context=e}function pn(n,e){if(e==null)return n.__?pn(n.__,n.__i+1):null;for(var t;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null)return t.__e;return typeof n.type=="function"?pn(n):null}function wu(n){var e,t;if((n=n.__)!=null&&n.__c!=null){for(n.__e=n.__c.base=null,e=0;e<n.__k.length;e++)if((t=n.__k[e])!=null&&t.__e!=null){n.__e=n.__c.base=t.__e;break}return wu(n)}}function Qo(n){(!n.__d&&(n.__d=!0)&&jr.push(n)&&!Oi.__r++||hl!==lt.debounceRendering)&&((hl=lt.debounceRendering)||mu)(Oi)}function Oi(){var n,e,t,r,o,a,u,h,p;for(jr.sort(Jo);n=jr.shift();)n.__d&&(e=jr.length,r=void 0,a=(o=(t=n).__v).__e,h=[],p=[],(u=t.__P)&&((r=Mr({},o)).__v=o.__v+1,lt.vnode&<.vnode(r),Cu(u,r,o,t.__n,u.ownerSVGElement!==void 0,32&o.__u?[a]:null,h,a??pn(o),!!(32&o.__u),p),r.__.__k[r.__i]=r,Gd(h,r,p),r.__e!=a&&wu(r)),jr.length>e&&jr.sort(Jo));Oi.__r=0}function Su(n,e,t,r,o,a,u,h,p,m,g){var f,b,y,k,T,j=r&&r.__k||yu,$=e.length;for(t.__d=p,$d(t,e,j),p=t.__d,f=0;f<$;f++)(y=t.__k[f])!=null&&typeof y!="boolean"&&typeof y!="function"&&(b=y.__i===-1?Ko:j[y.__i]||Ko,y.__i=f,Cu(n,y,b,o,a,u,h,p,m,g),k=y.__e,y.ref&&b.ref!=y.ref&&(b.ref&&ds(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=Iu(y,p,n):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 $d(n,e,t){var r,o,a,u,h,p=e.length,m=t.length,g=m,f=0;for(n.__k=[],r=0;r<p;r++)(o=n.__k[r]=(o=e[r])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Eo(null,o,null,null,o):us(o)?Eo(cs,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?Eo(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=n,o.__b=n.__b+1,h=Wd(o,t,u=r+f,g),o.__i=h,a=null,h!==-1&&(g--,(a=t[h])&&(a.__u|=131072)),a==null||a.__v===null?(h==-1&&f--,typeof o.type!="function"&&(o.__u|=65536)):h!==u&&(h===u+1?f++:h>u?g>p-u?f+=h-u:f--:f=h<u&&h==u-1?h-u:0,h!==r+f&&(o.__u|=65536))):(a=t[r])&&a.key==null&&a.__e&&(a.__e==n.__d&&(n.__d=pn(a)),es(a,a,!1),t[r]=null,g--);if(g)for(r=0;r<m;r++)(a=t[r])!=null&&!(131072&a.__u)&&(a.__e==n.__d&&(n.__d=pn(a)),es(a,a))}function Iu(n,e,t){var r,o;if(typeof n.type=="function"){for(r=n.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=n,e=Iu(r[o],e,t));return e}return n.__e!=e&&(t.insertBefore(n.__e,e||null),e=n.__e),e&&e.nextSibling}function Wd(n,e,t,r){var o=n.key,a=n.type,u=t-1,h=t+1,p=e[t];if(p===null||p&&o==p.key&&a===p.type)return t;if(r>(p!=null&&!(131072&p.__u)?1:0))for(;u>=0||h<e.length;){if(u>=0){if((p=e[u])&&!(131072&p.__u)&&o==p.key&&a===p.type)return u;u--}if(h<e.length){if((p=e[h])&&!(131072&p.__u)&&o==p.key&&a===p.type)return h;h++}}return-1}function pl(n,e,t){e[0]==="-"?n.setProperty(e,t??""):n[e]=t==null?"":typeof t!="number"||Hd.test(e)?t:t+"px"}function pi(n,e,t,r,o){var a;e:if(e==="style")if(typeof t=="string")n.style.cssText=t;else{if(typeof r=="string"&&(n.style.cssText=r=""),r)for(e in r)t&&e in t||pl(n.style,e,"");if(t)for(e in t)r&&t[e]===r[e]||pl(n.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")a=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in n?e.toLowerCase().slice(2):e.slice(2),n.l||(n.l={}),n.l[e+a]=t,t?r?t.u=r.u:(t.u=Date.now(),n.addEventListener(e,a?fl:gl,a)):n.removeEventListener(e,a?fl:gl,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 n)try{n[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?n.removeAttribute(e):n.setAttribute(e,t))}}function gl(n){var e=this.l[n.type+!1];if(n.t){if(n.t<=e.u)return}else n.t=Date.now();return e(lt.event?lt.event(n):n)}function fl(n){return this.l[n.type+!0](lt.event?lt.event(n):n)}function Cu(n,e,t,r,o,a,u,h,p,m){var g,f,b,y,k,T,j,$,G,ce,se,Ee,qe,ye,Se,Le=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(p=!!(32&t.__u),a=[h=e.__e=t.__e]),(g=lt.__b)&&g(e);e:if(typeof Le=="function")try{if($=e.props,G=(g=Le.contextType)&&r[g.__c],ce=g?G?G.props.value:g.__:r,t.__c?j=(f=e.__c=t.__c).__=f.__E:("prototype"in Le&&Le.prototype.render?e.__c=f=new Le($,ce):(e.__c=f=new mi($,ce),f.constructor=Le,f.render=qd),G&&G.sub(f),f.props=$,f.state||(f.state={}),f.context=ce,f.__n=r,b=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),Le.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Mr({},f.__s)),Mr(f.__s,Le.getDerivedStateFromProps($,f.__s))),y=f.props,k=f.state,f.__v=e,b)Le.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(Le.getDerivedStateFromProps==null&&$!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps($,ce),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate($,f.__s,ce)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(f.props=$,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(je){je&&(je.__=e)}),se=0;se<f._sb.length;se++)f.__h.push(f._sb[se]);f._sb=[],f.__h.length&&u.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate($,f.__s,ce),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,k,T)})}if(f.context=ce,f.props=$,f.__P=n,f.__e=!1,Ee=lt.__r,qe=0,"prototype"in Le&&Le.prototype.render){for(f.state=f.__s,f.__d=!1,Ee&&Ee(e),g=f.render(f.props,f.state,f.context),ye=0;ye<f._sb.length;ye++)f.__h.push(f._sb[ye]);f._sb=[]}else do f.__d=!1,Ee&&Ee(e),g=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++qe<25);f.state=f.__s,f.getChildContext!=null&&(r=Mr(Mr({},r),f.getChildContext())),b||f.getSnapshotBeforeUpdate==null||(T=f.getSnapshotBeforeUpdate(y,k)),Su(n,us(Se=g!=null&&g.type===cs&&g.key==null?g.props.children:g)?Se:[Se],e,t,r,o,a,u,h,p,m),f.base=e.__e,e.__u&=-161,f.__h.length&&u.push(f),j&&(f.__E=f.__=null)}catch(je){e.__v=null,p||a!=null?(e.__e=h,e.__u|=p?160:32,a[a.indexOf(h)]=null):(e.__e=t.__e,e.__k=t.__k),lt.__e(je,e,t)}else a==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=jd(t.__e,e,t,r,o,a,u,p,m);(g=lt.diffed)&&g(e)}function Gd(n,e,t){e.__d=void 0;for(var r=0;r<t.length;r++)ds(t[r],t[++r],t[++r]);lt.__c&<.__c(e,n),n.some(function(o){try{n=o.__h,o.__h=[],n.some(function(a){a.call(o)})}catch(a){lt.__e(a,o.__v)}})}function jd(n,e,t,r,o,a,u,h,p){var m,g,f,b,y,k,T,j=t.props,$=e.props,G=e.type;if(G==="svg"&&(o=!0),a!=null){for(m=0;m<a.length;m++)if((y=a[m])&&"setAttribute"in y==!!G&&(G?y.localName===G:y.nodeType===3)){n=y,a[m]=null;break}}if(n==null){if(G===null)return document.createTextNode($);n=o?document.createElementNS("http://www.w3.org/2000/svg",G):document.createElement(G,$.is&&$),a=null,h=!1}if(G===null)j===$||h&&n.data===$||(n.data=$);else{if(a=a&&fu.call(n.childNodes),j=t.props||Ko,!h&&a!=null)for(j={},m=0;m<n.attributes.length;m++)j[(y=n.attributes[m]).name]=y.value;for(m in j)y=j[m],m=="children"||(m=="dangerouslySetInnerHTML"?f=y:m==="key"||m in $||pi(n,m,null,y,o));for(m in $)y=$[m],m=="children"?b=y:m=="dangerouslySetInnerHTML"?g=y:m=="value"?k=y:m=="checked"?T=y:m==="key"||h&&typeof y!="function"||j[m]===y||pi(n,m,y,j[m],o);if(g)h||f&&(g.__html===f.__html||g.__html===n.innerHTML)||(n.innerHTML=g.__html),e.__k=[];else if(f&&(n.innerHTML=""),Su(n,us(b)?b:[b],e,t,r,o&&G!=="foreignObject",a,u,a?a[0]:t.__k&&pn(t,0),h,p),a!=null)for(m=a.length;m--;)a[m]!=null&&bu(a[m]);h||(m="value",k!==void 0&&(k!==n[m]||G==="progress"&&!k||G==="option"&&k!==j[m])&&pi(n,m,k,j[m],!1),m="checked",T!==void 0&&T!==n[m]&&pi(n,m,T,j[m],!1))}return n}function ds(n,e,t){try{typeof n=="function"?n(e):n.current=e}catch(r){lt.__e(r,t)}}function es(n,e,t){var r,o;if(lt.unmount&<.unmount(n),(r=n.ref)&&(r.current&&r.current!==n.__e||ds(r,null,e)),(r=n.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){lt.__e(a,e)}r.base=r.__P=null,n.__c=void 0}if(r=n.__k)for(o=0;o<r.length;o++)r[o]&&es(r[o],e,t||typeof n.type!="function");t||n.__e==null||bu(n.__e),n.__=n.__e=n.__d=void 0}function qd(n,e,t){return this.constructor(n,t)}fu=yu.slice,lt={__e:function(n,e,t,r){for(var o,a,u;e=e.__;)if((o=e.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(n)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(n,r||{}),u=o.__d),u)return o.__E=o}catch(h){n=h}throw n}},vu=0,mi.prototype.setState=function(n,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Mr({},this.state),typeof n=="function"&&(n=n(Mr({},t),this.props)),n&&Mr(t,n),n!=null&&this.__v&&(e&&this._sb.push(e),Qo(this))},mi.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),Qo(this))},mi.prototype.render=cs,jr=[],mu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Jo=function(n,e){return n.__v.__b-e.__v.__b},Oi.__r=0,_u=0;(function(n,e){var t={__c:e="__cC"+_u++,__:n,Consumer:function(r,o){return r.children(o)},Provider:function(r){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(h){h.__e=!0,Qo(h)})},this.sub=function(u){o.push(u);var h=u.componentWillUnmount;u.componentWillUnmount=function(){o.splice(o.indexOf(u),1),h&&h.call(u)}}),r.children}};t.Provider.__=t.Consumer.contextType=t})({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});var Cn=Lt("[Surveys]"),Ud={icontains:n=>!!C&&C.location.href.toLowerCase().indexOf(n.toLowerCase())>-1,not_icontains:n=>!!C&&C.location.href.toLowerCase().indexOf(n.toLowerCase())===-1,regex:n=>!!C&&un(C.location.href,n),not_regex:n=>!!C&&!un(C.location.href,n),exact:n=>(C==null?void 0:C.location.href)===n,is_not:n=>(C==null?void 0:C.location.href)!==n};class Vd{constructor(e){this.instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var t=[],r=0;r<localStorage.length;r++){var o=localStorage.key(r);o!=null&&o.startsWith("seenSurvey_")&&t.push(o)}return t})();e.forEach(t=>localStorage.removeItem(t))}loadIfEnabled(){var e,t,r,o=Ce==null||(e=Ce.__PosthogExtensions__)===null||e===void 0?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||o||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Bn(this.instance)),(t=Ce.__PosthogExtensions__)===null||t===void 0||(r=t.loadExternalDependency)===null||r===void 0||r.call(t,this.instance,"surveys",a=>{var u,h;if(a)return Cn.error("Could not load surveys script",a);this._surveyManager=(u=Ce.__PosthogExtensions__)===null||u===void 0||(h=u.generateSurveys)===null||h===void 0?void 0:h.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 Bn(this.instance));var r=this.instance.get_property(No);if(r&&!t)return e(r);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,h=o.json.surveys||[],p=h.filter(m=>{var g,f,b,y,k,T,j,$,G,ce,se,Ee;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||((j=m.conditions)===null||j===void 0?void 0:j.actions)&&(($=m.conditions)===null||$===void 0||(G=$.actions)===null||G===void 0?void 0:G.values)&&((ce=m.conditions)===null||ce===void 0||(se=ce.actions)===null||se===void 0||(Ee=se.values)===null||Ee===void 0?void 0:Ee.length)>0});return p.length>0&&((u=this._surveyEventReceiver)===null||u===void 0||u.register(p)),(a=this.instance.persistence)===null||a===void 0||a.register({[No]:h}),e(h)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var o,a=r.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||Ud[(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||(ne==null?void 0:ne.querySelector(p.conditions.selector));return y&&k}),u=(o=this._surveyEventReceiver)===null||o===void 0?void 0:o.getSurveys(),h=a.filter(p=>{var m,g,f,b,y,k,T,j,$,G,ce;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 se=!p.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(p.linked_flag_key),Ee=!p.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(p.targeting_flag_key),qe=((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,ye=((T=p.conditions)===null||T===void 0?void 0:T.actions)&&((j=p.conditions)===null||j===void 0||($=j.actions)===null||$===void 0?void 0:$.values)&&((G=p.conditions)===null||G===void 0||(ce=G.actions)===null||ce===void 0?void 0:ce.values.length)>0,Se=!qe&&!ye||(u==null?void 0:u.includes(p.id)),Le=this._canActivateRepeatedly(p),je=!(p.internal_targeting_flag_key&&!Le)||this.instance.featureFlags.isFeatureEnabled(p.internal_targeting_flag_key),Ye=this.checkFlags(p);return se&&Ee&&je&&Se&&Ye});return e(h)},t)}checkFlags(e){var t;return(t=e.feature_flag_keys)===null||t===void 0||!t.length||e.feature_flag_keys.every(r=>{var{key:o,value:a}=r;return!o||!a||this.instance.featureFlags.isFeatureEnabled(a)})}getNextSurveyStep(e,t,r){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?or.End:u;if(a.branching.type===or.End)return or.End;if(a.branching.type===or.SpecificQuestion){if(Number.isInteger(a.branching.index))return a.branching.index}else if(a.branching.type===or.ResponseBased){if(a.type===Ai.SingleChoice){var h,p,m=a.choices.indexOf("".concat(r));if((h=a.branching)!==null&&h!==void 0&&(p=h.responseValues)!==null&&p!==void 0&&p.hasOwnProperty(m)){var g=a.branching.responseValues[m];return Number.isInteger(g)?g:g===or.End?or.End:u}}else if(a.type===Ai.Rating){var f,b;if(typeof r!="number"||!Number.isInteger(r))throw new Error("The response type must be an integer");var y=function(T,j){if(j===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(j===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(j===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(j===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")}(r,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===or.End?or.End:u}}return u}return Cn.warn("Falling back to next question index due to unexpected branching type"),u}_canActivateRepeatedly(e){var t;return et((t=Ce.__PosthogExtensions__)===null||t===void 0?void 0:t.canActivateRepeatedly)?(Cn.warn("init was not called"),!1):Ce.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){et(this._surveyManager)?Cn.warn("init was not called"):this.getSurveys(t=>{var r=t.filter(o=>o.id===e)[0];this._surveyManager.canRenderSurvey(r)})}renderSurvey(e,t){et(this._surveyManager)?Cn.warn("init was not called"):this.getSurveys(r=>{var o=r.filter(a=>a.id===e)[0];this._surveyManager.renderSurvey(o,ne==null?void 0:ne.querySelector(t))})}}var vl=Lt("[RateLimiter]");class zd{constructor(e){var t,r;U(this,"serverLimits",{}),U(this,"lastEventRateLimited",!1),U(this,"checkForLimiting",o=>{var a=o.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach(u=>{vl.info("".concat(u||"events"," is quota limited.")),this.serverLimits[u]=new Date().getTime()+6e4})}catch(u){return void vl.warn('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(((r=e.config.rate_limiting)===null||r===void 0?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,r,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(Po))!==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 h=u.tokens<1;return h||o||(u.tokens=Math.max(0,u.tokens-1)),!h||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=h,(r=this.instance.persistence)===null||r===void 0||r.set_property(Po,u),{isRateLimited:h,remainingTokens:u.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Yd=()=>D({initialPathName:($t==null?void 0:$t.pathname)||"",referringDomain:at.referringDomain()},at.campaignParams());class Zd{constructor(e,t,r){U(this,"_onSessionIdCallback",o=>{var a=this._getStoredProps();if(!a||a.sessionId!==o){var u={sessionId:o,props:this._sessionSourceParamGenerator()};this._persistence.register({[Fo]:u})}}),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=r||Yd,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[Fo]}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 Xd=["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;"],ml=function(n,e){if(!n)return!1;var t=n.toLowerCase();return Xd.concat(e||[]).some(r=>{var o=r.toLowerCase();return t.indexOf(o)!==-1})},Eu=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&ml(t,e))return!0;try{var r=n==null?void 0:n.userAgentData;if(r!=null&&r.brands&&r.brands.some(o=>ml(o==null?void 0:o.brand,e)))return!0}catch{}return!!n.webdriver};class ku{constructor(){this.clicks=[]}isRageClick(e,t,r){var o=this.clicks[this.clicks.length-1];if(o&&Math.abs(e-o.x)+Math.abs(t-o.y)<30&&r-o.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var gi=Lt("[Dead Clicks]"),Jd=()=>!0,Kd=n=>{var e,t=!((e=n.instance.persistence)===null||e===void 0||!e.get_property(Al)),r=n.instance.config.capture_dead_clicks;return qr(r)?r:t};class Tu{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Al]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(e){var t,r,o;(t=Ce.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture&&e(),(r=Ce.__PosthogExtensions__)===null||r===void 0||(o=r.loadExternalDependency)===null||o===void 0||o.call(r,this.instance,"dead-clicks-autocapture",a=>{a?gi.error("failed to load script",a):e()})}start(){var e;if(ne){if(!this._lazyLoadedDeadClicksAutocapture&&(e=Ce.__PosthogExtensions__)!==null&&e!==void 0&&e.initDeadClicksAutocapture){var t=ct(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Ce.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(ne),gi.info("starting...")}}else gi.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,gi.info("stopping..."))}}var Qd=Lt("[Heatmaps]");class eh{constructor(e){var t;U(this,"rageclicks",new ku),U(this,"_enabledServerSide",!1),U(this,"_initialized",!1),U(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[Mo]),C==null||C.addEventListener("beforeunload",()=>{this.flush()})}get flushIntervalMilliseconds(){var e=5e3;return ct(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 fe(this.instance.config.capture_heatmaps)?fe(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;Qd.info("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()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Mo]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){C&&ne&&(br(ne,"click",e=>this._onClick(e||(C==null?void 0:C.event)),!1,!0),br(ne,"mousemove",e=>this._onMouseMove(e||(C==null?void 0:C.event)),!1,!0),this.deadClicksCapture=new Tu(this.instance,Jd,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){var r=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),u=function(h,p,m){for(var g=h;g&&Pi(g)&&!Ar(g,"body");){if(g===m)return!1;if(De(p,C==null?void 0:C.getComputedStyle(g).position))return!0;g=Ql(g)}return!1}(Kl(e),["fixed","sticky"],a);return{x:e.clientX+(u?0:o),y:e.clientY+(u?0:r),target_fixed:u,type:t}}_onClick(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!Za(e.target)){var o=this._getProperties(e,r);(t=this.rageclicks)!==null&&t!==void 0&&t.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._capture(D(D({},o),{},{type:"rageclick"})),this._capture(o)}}_onMouseMove(e){Za(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&&!rn(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class th{constructor(e){U(this,"_updateScrollData",()=>{var t,r,o,a;this.context||(this.context={});var u=this.scrollElement(),h=this.scrollY(),p=u?Math.max(0,u.scrollHeight-u.clientHeight):0,m=h+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.context.lastScrollY=Math.ceil(h),this.context.maxScrollY=Math.max(h,(t=this.context.maxScrollY)!==null&&t!==void 0?t:0),this.context.maxScrollHeight=Math.max(p,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r: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=ut(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var t of e){var r=C==null?void 0:C.document.querySelector(t);if(r)return r}}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}}var _l=Lt("[AutoCapture]");function ko(n,e){return e.length>n?e.slice(0,n)+"...":e}function rh(n){if(n.previousElementSibling)return n.previousElementSibling;var e=n;do e=e.previousSibling;while(e&&!Pi(e));return e}function nh(n,e,t,r){var o=n.tagName.toLowerCase(),a={tag_name:o};jo.indexOf(o)>-1&&!t&&(o.toLowerCase()==="a"||o.toLowerCase()==="button"?a.$el_text=ko(1024,nu(n)):a.$el_text=ko(1024,Li(n)));var u=xi(n);u.length>0&&(a.classes=u.filter(function(g){return g!==""})),Qe(n.attributes,function(g){var f;if((!eu(n)||["name","id","class","aria-label"].indexOf(g.name)!==-1)&&(r==null||!r.includes(g.name))&&!e&&dn(g.value)&&(f=g.name,!kt(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var b=g.value;g.name==="class"&&(b=ss(b).join(" ")),a["attr__"+g.name]=ko(1024,b)}});for(var h=1,p=1,m=n;m=rh(m);)h++,m.tagName===n.tagName&&p++;return a.nth_child=h,a.nth_of_type=p,a}function ih(n,e){for(var t,r,{e:o,maskAllElementAttributes:a,maskAllText:u,elementAttributeIgnoreList:h,elementsChainAsString:p}=e,m=[n],g=n;g.parentNode&&!Ar(g,"body");)Xl(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(Qe(m,se=>{var Ee=qo(se);se.tagName.toLowerCase()==="a"&&(k=se.getAttribute("href"),k=Ee&&k&&dn(k)&&k),De(xi(se),"ph-no-capture")&&(T=!0),b.push(nh(se,a,u,h));var qe=function(ye){if(!qo(ye))return{};var Se={};return Qe(ye.attributes,function(Le){if(Le.name&&Le.name.indexOf("data-ph-capture-attribute")===0){var je=Le.name.replace("data-ph-capture-attribute-",""),Ye=Le.value;je&&Ye&&dn(Ye)&&(Se[je]=Ye)}}),Se}(se);Pt(y,qe)}),T)return{props:{},explicitNoCapture:T};if(u||(n.tagName.toLowerCase()==="a"||n.tagName.toLowerCase()==="button"?b[0].$el_text=nu(n):b[0].$el_text=Li(n)),k){var j,$;b[0].attr__href=k;var G=(j=sn(k))===null||j===void 0?void 0:j.host,ce=C==null||($=C.location)===null||$===void 0?void 0:$.host;G&&ce&&G!==ce&&(f=k)}return{props:Pt({$event_type:o.type,$ce_version:1},p?{}:{$elements:b},{$elements_chain:ld(b)},(t=b[0])!==null&&t!==void 0&&t.$el_text?{$el_text:(r=b[0])===null||r===void 0?void 0:r.$el_text}:{},f&&o.type==="click"?{$external_click_url:f}:{},y)}}class oh{constructor(e){U(this,"_initialized",!1),U(this,"_isDisabledServerSide",null),U(this,"rageclicks",new ku),U(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,r=ct(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),r.url_ignorelist=(t=r.url_ignorelist)===null||t===void 0?void 0:t.map(o=>new RegExp(o)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(C&&ne){var e=r=>{r=r||(C==null?void 0:C.event);try{this._captureEvent(r)}catch(o){_l.error("Failed to capture event",o)}},t=r=>{r=r||(C==null?void 0:C.event),this._captureEvent(r,fo)};br(ne,"submit",e,!1,!0),br(ne,"change",e,!1,!0),br(ne,"click",e,!1,!0),this.config.capture_copied_text&&(br(ne,"copy",t,!1,!0),br(ne,"cut",t,!1,!0))}}else _l.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ma]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return(t=this._elementSelectors)===null||t===void 0||t.forEach(o=>{var a=ne==null?void 0:ne.querySelectorAll(o);a==null||a.forEach(u=>{e===u&&r.push(o)})}),r}get isEnabled(){var e,t,r=(e=this.instance.persistence)===null||e===void 0?void 0:e.props[Ma],o=this._isDisabledServerSide;if(Or(o)&&!qr(r)&&!this.instance.config.advanced_disable_decide)return!1;var a=(t=this._isDisabledServerSide)!==null&&t!==void 0?t:!!r;return!!this.instance.config.autocapture&&!a}_captureEvent(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,o=Kl(e);Zl(o)&&(o=o.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._captureEvent(e,"$rageclick");var a=t===fo;if(o&&nd(o,e,this.config,a,a?["copy","cut"]:void 0)){var{props:u,explicitNoCapture:h}=ih(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(h)return!1;var p=this.getElementSelectors(o);if(p&&p.length>0&&(u.$element_selectors=p),t===fo){var m,g=Jl(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 Kt(ne==null?void 0:ne.querySelectorAll)}}var sh=Lt("[TracingHeaders]");class ah{constructor(e){U(this,"_restoreXHRPatch",void 0),U(this,"_restoreFetchPatch",void 0),U(this,"_startCapturing",()=>{var t,r,o,a;fe(this._restoreXHRPatch)&&((t=Ce.__PosthogExtensions__)===null||t===void 0||(r=t.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),fe(this._restoreFetchPatch)&&((o=Ce.__PosthogExtensions__)===null||o===void 0||(a=o.tracingHeadersPatchFns)===null||a===void 0||a._patchFetch(this.instance.sessionManager))}),this.instance=e}_loadScript(e){var t,r,o;(t=Ce.__PosthogExtensions__)!==null&&t!==void 0&&t.tracingHeadersPatchFns&&e(),(r=Ce.__PosthogExtensions__)===null||r===void 0||(o=r.loadExternalDependency)===null||o===void 0||o.call(r,this.instance,"tracing-headers",a=>{if(a)return sh.error("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 xr;(function(n){n[n.PENDING=-1]="PENDING",n[n.DENIED=0]="DENIED",n[n.GRANTED=1]="GRANTED"})(xr||(xr={}));class lh{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?xr.DENIED:this.storedConsent}isOptedOut(){return this.consent===xr.DENIED||this.consent===xr.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"?xr.GRANTED:e==="0"?xr.DENIED:xr.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage=e==="localStorage"?vt:wr;var t=e==="localStorage"?wr:vt;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&&!!El([Vt==null?void 0:Vt.doNotTrack,Vt==null?void 0:Vt.msDoNotTrack,Ce.doNotTrack],e=>De([!0,1,"1","yes"],e))}}var fi=Lt("[ExceptionAutocapture]");class uh{constructor(e){var t;U(this,"originalOnUnhandledRejectionHandler",void 0),U(this,"startCapturing",()=>{var r,o,a,u;if(C&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var h=(r=Ce.__PosthogExtensions__)===null||r===void 0||(o=r.errorWrappingFunctions)===null||o===void 0?void 0:o.wrapOnError,p=(a=Ce.__PosthogExtensions__)===null||a===void 0||(u=a.errorWrappingFunctions)===null||u===void 0?void 0:u.wrapUnhandledRejection;if(h&&p)try{this.unwrapOnError=h(this.captureException.bind(this)),this.unwrapUnhandledRejection=p(this.captureException.bind(this))}catch(m){fi.error("failed to start",m),this.stopCapturing()}else fi.error("failed to load error wrapping functions - cannot start")}}),this.instance=e,this.remoteEnabled=!((t=this.instance.persistence)===null||t===void 0||!t.props[Aa]),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&&(fi.info("enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,r;this.hasHandlers&&e(),(t=Ce.__PosthogExtensions__)===null||t===void 0||(r=t.loadExternalDependency)===null||r===void 0||r.call(t,this.instance,"exception-autocapture",o=>{if(o)return fi.error("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)}onRemoteConfig(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[Aa]: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 Hr=Lt("[Web Vitals]"),yl=9e5;class ch{constructor(e){var t;U(this,"_enabledServerSide",!1),U(this,"_initialized",!1),U(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),U(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,o)=>D(D({},r),{},{["$web_vitals_".concat(o.name,"_event")]:D({},o),["$web_vitals_".concat(o.name,"_value")]:o.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),U(this,"_addToBuffer",r=>{var o,a=(o=this.instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0);if(fe(a))Hr.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var u=this._currentURL();fe(u)||(et(r==null?void 0:r.name)||et(r==null?void 0:r.value)?Hr.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?Hr.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==u&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),fe(this.buffer.url)&&(this.buffer.url=u),this.buffer.firstMetricTimestamp=fe(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(D(D({},r),{},{$current_url:u,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),U(this,"_startCapturing",()=>{var r,o,a,u,h=Ce.__PosthogExtensions__;fe(h)||fe(h.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:o,onFCP:a,onINP:u}=h.postHogWebVitalsCallbacks),r&&o&&a&&u?(this.allowedMetrics.indexOf("LCP")>-1&&r(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):Hr.error("web vitals callbacks not loaded - not starting")}),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[Oa]),this.startIfEnabled()}get allowedMetrics(){var e,t,r=ct(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 fe(r)?((t=this.instance.persistence)===null||t===void 0?void 0:t.props[Na])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(ct(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=ct(this.instance.config.capture_performance)&&Ut(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:yl;return 0<e&&e<=6e4?yl:e}get isEnabled(){var e=ct(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return qr(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Hr.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(e){var t=ct(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=ct(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[Oa]:t}),this.instance.persistence.register({[Na]:r})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,r,o;(t=Ce.__PosthogExtensions__)!==null&&t!==void 0&&t.postHogWebVitalsCallbacks&&e(),(r=Ce.__PosthogExtensions__)===null||r===void 0||(o=r.loadExternalDependency)===null||o===void 0||o.call(r,this.instance,"web-vitals",a=>{a?Hr.error("failed to load script",a):e()})}_currentURL(){var e=C?C.location.href:void 0;return e||Hr.error("Could not determine current URL"),e}}var dh={icontains:(n,e)=>!!C&&e.href.toLowerCase().indexOf(n.toLowerCase())>-1,not_icontains:(n,e)=>!!C&&e.href.toLowerCase().indexOf(n.toLowerCase())===-1,regex:(n,e)=>!!C&&un(e.href,n),not_regex:(n,e)=>!!C&&!un(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n};class _t{constructor(e){var t=this;U(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];t.getWebExperiments(o=>{_t.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,o.forEach(a=>{if(a.feature_flag_key){var u;t._flagToExperiments&&(_t.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 h=t.instance.getFeatureFlag(a.feature_flag_key);kt(h)&&a.variants[h]&&t.applyTransforms(a.name,h,a.variants[h].transforms)}else if(a.variants)for(var p in a.variants){var m=a.variants[p];_t.matchesTestVariant(m)&&t.applyTransforms(a.name,p,m.transforms)}})},r)}),this.instance=e,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())_t.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(et(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_t.logInfo("applying feature flags",e),e.forEach(t=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.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)}})}}previewWebExperiment(){var e=_t.getWindowLocation();if(e!=null&&e.search){var t=Ci(e==null?void 0:e.search,"__experiment_id"),r=Ci(e==null?void 0:e.search,"__experiment_variant");t&&r&&(_t.logInfo("previewing web experiments ".concat(t," && ").concat(r)),this.getWebExperiments(o=>{this.showPreviewWebExperiment(parseInt(t),r,o)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.instance.config.disable_web_experiments&&!r)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,r){var o=r.filter(a=>a.id===e);o&&o.length>0&&(_t.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!et(e.conditions)&&_t.matchUrlConditions(e)&&_t.matchUTMConditions(e)}static matchUrlConditions(e){var t;if(et(e.conditions)||et((t=e.conditions)===null||t===void 0?void 0:t.url))return!0;var r,o,a,u=_t.getWindowLocation();return!!u&&((r=e.conditions)===null||r===void 0||!r.url||dh[(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(et(e.conditions)||et((t=e.conditions)===null||t===void 0?void 0:t.utm))return!0;var r=at.campaignParams();if(r.utm_source){var o,a,u,h,p,m,g,f,b,y,k,T,j,$,G,ce,se=(o=e.conditions)===null||o===void 0||(a=o.utm)===null||a===void 0||!a.utm_campaign||((u=e.conditions)===null||u===void 0||(h=u.utm)===null||h===void 0?void 0:h.utm_campaign)==r.utm_campaign,Ee=(p=e.conditions)===null||p===void 0||(m=p.utm)===null||m===void 0||!m.utm_source||((g=e.conditions)===null||g===void 0||(f=g.utm)===null||f===void 0?void 0:f.utm_source)==r.utm_source,qe=(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)==r.utm_medium,ye=(j=e.conditions)===null||j===void 0||($=j.utm)===null||$===void 0||!$.utm_term||((G=e.conditions)===null||G===void 0||(ce=G.utm)===null||ce===void 0?void 0:ce.utm_term)==r.utm_term;return se&&qe&&ye&&Ee}return!1}static logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];me.info("[WebExperiments] ".concat(e),r)}applyTransforms(e,t,r,o){var a;this._is_bot()?_t.logInfo("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?r.forEach(u=>{if(u.selector){var h;_t.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),u);var p,m=0,g=(h=document)===null||h===void 0?void 0:h.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=_t.getWindowLocation())===null||p===void 0?void 0:p.href,$web_experiment_elements_modified:m})}}):(_t.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=_t.getWindowLocation())===null||a===void 0?void 0:a.href,$web_experiment_elements_modified:0}))}_is_bot(){return Vt&&this.instance?Eu(Vt,this.instance.config.custom_blocked_useragents):void 0}}class hh{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var ph=["$set_once","$set"],$r=Lt("[SiteApps]");class gh{constructor(e){this.instance=e,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}init(){if(this.isEnabled){var e=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{e(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(e){var t,r,o,a,u,h,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:D(D({},Rl(e,ph)),{},{properties:D(D(D({},e.properties),T?{$set:D(D({},(t=(r=e.properties)===null||r===void 0?void 0:r.$set)!==null&&t!==void 0?t:{}),T)}:{}),k?{$set_once:D(D({},(o=(a=e.properties)===null||a===void 0?void 0:a.$set_once)!==null&&o!==void 0?o:{}),k)}:{}),elements_chain:(u=(h=e.properties)===null||h===void 0?void 0:h.$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}}setupSiteApp(e){var t={id:e.id,loaded:!1,errored:!1};this.apps[e.id]=t;var r=a=>{var u;for(var h of(this.apps[e.id].errored=!a,this.apps[e.id].loaded=!0,$r.info("Site app with id ".concat(e.id," ").concat(a?"loaded":"errored")),a&&this.bufferedInvocations.length&&($r.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(e.id)),this.bufferedInvocations.forEach(p=>{var m;return(m=t.processEvent)===null||m===void 0?void 0:m.call(t,p)})),Object.values(this.apps)))if(!h.loaded)return;(u=this.stopBuffering)===null||u===void 0||u.call(this)};try{var{processEvent:o}=e.init({posthog:this.instance,callback:a=>{r(a)}});o&&(t.processEvent=o)}catch(a){$r.error("Error while initializing PostHog app with config id ".concat(e.id),a),r(!1)}}onCapturedEvent(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{var o;(o=r.processEvent)===null||o===void 0||o.call(r,t)}catch(a){$r.error("Error while processing event ".concat(e.event," for site app ").concat(r.id),a)}}}onRemoteConfig(e){var t,r,o=this;if(ut(Ce._POSTHOG_JS_APPS)){if(!this.isEnabled)return void $r.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');for(var a of Ce._POSTHOG_JS_APPS)this.setupSiteApp(a);var u;Ce._POSTHOG_JS_APPS.length?this.instance.on("eventCaptured",g=>this.onCapturedEvent(g)):(u=this.stopBuffering)===null||u===void 0||u.call(this)}else if((t=this.stopBuffering)===null||t===void 0||t.call(this),(r=e.siteApps)!==null&&r!==void 0&&r.length)if(this.isEnabled){var h=function(g,f){var b,y;Ce["__$$ph_site_app_".concat(g)]=o.instance,(b=Ce.__PosthogExtensions__)===null||b===void 0||(y=b.loadSiteApp)===null||y===void 0||y.call(b,o.instance,f,k=>{if(k)return $r.error("Error while initializing PostHog app with config id ".concat(g),k)})};for(var{id:p,url:m}of e.siteApps)h(p,m)}else $r.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Nn={},ts=()=>{},tn="posthog",xu=!Ad&&(yt==null?void 0:yt.indexOf("MSIE"))===-1&&(yt==null?void 0:yt.indexOf("Mozilla"))===-1,bl=()=>{var n,e,t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(e=ne==null?void 0:ne.location,t=e==null?void 0:e.hostname,!!kt(t)&&t.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:ts,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:$t&&kt($t==null?void 0:$t.search)&&$t.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||(n=C.location)===null||n===void 0?void 0:n.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:r=>{var o="Bad HTTP status: "+r.statusCode+" "+r.text;me.error(o)},get_device_id:r=>r,_onCapture:ts,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}},wl=n=>{var e={};fe(n.process_person)||(e.person_profiles=n.process_person),fe(n.xhr_headers)||(e.request_headers=n.xhr_headers),fe(n.cookie_name)||(e.persistence_name=n.cookie_name),fe(n.disable_cookie)||(e.disable_persistence=n.disable_cookie);var t=Pt({},e,n);return ut(n.property_blacklist)&&(fe(n.property_denylist)?t.property_denylist=n.property_blacklist:ut(n.property_denylist)?t.property_denylist=[...n.property_blacklist,...n.property_denylist]:me.error("Invalid value for property_denylist config: "+n.property_denylist)),t};class fh{constructor(){U(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){me.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Di{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)===null||t===void 0?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){U(this,"webPerformance",new fh),U(this,"version",yr.LIB_VERSION),U(this,"_internalEventEmitter",new gu),this.config=bl(),this.SentryIntegration=Ld,this.sentryIntegration=e=>function(t,r){var o=pu(t,r);return{name:hu,processEvent:a=>o(a)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new Pc(this),this.toolbar=new Rd(this),this.scrollManager=new th(this),this.pageViewManager=new Bd(this),this.surveys=new Vd(this),this.experiments=new _t(this),this.exceptions=new hh(this),this.rateLimiter=new zd(this),this.requestRouter=new Pd(this),this.consent=new lh(this),this.people={set:(e,t,r)=>{var o=kt(e)?{[e]:t}:e;this.setPersonProperties(o),r==null||r({})},set_once:(e,t,r)=>{var o=kt(e)?{[e]:t}:e;this.setPersonProperties(void 0,o),r==null||r({})}},this.on("eventCaptured",e=>me.info('send "'.concat(e==null?void 0:e.event,'"'),e))}init(e,t,r){if(r&&r!==tn){var o,a=(o=Nn[r])!==null&&o!==void 0?o:new Di;return a._init(e,t,r),Nn[r]=a,Nn[tn][r]=a,a}return this._init(e,t,r)}_init(e){var t,r,o,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=arguments.length>2?arguments[2]:void 0;if(fe(e)||Ta(e))return me.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 me.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(Pt({},bl(),wl(a),{name:u,token:e})),this.config.on_xhr_error&&me.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=a.disable_compression?void 0:ar.GZipJS,this.persistence=new wo(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wo(D(D({},this.config),{},{persistence:"sessionStorage"}));var h=D({},this.persistence.props),p=D({},this.sessionPersistence.props);if(this._requestQueue=new Md(G=>this._send_retriable_request(G)),this._retryQueue=new Nd(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new Fd(this),this.sessionPropsManager=new Zd(this.sessionManager,this.persistence)),new ah(this).startIfEnabledOrStop(),this.siteApps=new gh(this),(t=this.siteApps)===null||t===void 0||t.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new kd(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new oh(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new eh(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new ch(this),this.exceptionObserver=new uh(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Tu(this,Kd),this.deadClicksAutocapture.startIfEnabled(),yr.DEBUG=yr.DEBUG||this.config.debug,yr.DEBUG&&me.info("Starting in debug mode",{this:this,config:a,thisC:D({},this.config),p:h,s:p}),this._sync_opt_out_with_persistence(),((r=a.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var m,g,f=this.config.get_device_id(Rr()),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(G=>{var ce,se;return!((ce=a.bootstrap)===null||ce===void 0||(se=ce.featureFlags)===null||se===void 0||!se[G])}).reduce((G,ce)=>{var se,Ee;return G[ce]=((se=a.bootstrap)===null||se===void 0||(Ee=se.featureFlags)===null||Ee===void 0?void 0:Ee[ce])||!1,G},{}),j=Object.keys(((k=a.bootstrap)===null||k===void 0?void 0:k.featureFlagPayloads)||{}).filter(G=>T[G]).reduce((G,ce)=>{var se,Ee,qe,ye;return(se=a.bootstrap)!==null&&se!==void 0&&(Ee=se.featureFlagPayloads)!==null&&Ee!==void 0&&Ee[ce]&&(G[ce]=(qe=a.bootstrap)===null||qe===void 0||(ye=qe.featureFlagPayloads)===null||ye===void 0?void 0:ye[ce]),G},{});this.featureFlags.receivedFeatureFlags({featureFlags:T,featureFlagPayloads:j})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:$a,$device_id:null},"");else if(!this.get_distinct_id()){var $=this.config.get_device_id(Rr());this.register_once({distinct_id:$,$device_id:$},""),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?Dd(this,()=>this._loaded()):this._loaded(),Kt(this.config._onCapture)&&this.config._onCapture!==ts&&(me.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",G=>this.config._onCapture(G.event,G))),this}_onRemoteConfig(e){var t,r,o,a,u,h,p,m,g;if(!ne||!ne.body)return me.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=De(e.supportedCompression,ar.GZipJS)?ar.GZipJS:De(e.supportedCompression,ar.Base64)?ar.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"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(e),(o=this.sessionRecording)===null||o===void 0||o.onRemoteConfig(e),(a=this.autocapture)===null||a===void 0||a.onRemoteConfig(e),(u=this.heatmaps)===null||u===void 0||u.onRemoteConfig(e),(h=this.surveys)===null||h===void 0||h.onRemoteConfig(e),(p=this.webVitalsAutocapture)===null||p===void 0||p.onRemoteConfig(e),(m=this.exceptionObserver)===null||m===void 0||m.onRemoteConfig(e),(g=this.deadClicksAutocapture)===null||g===void 0||g.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){me.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new Td(this).load(),this.featureFlags.decide()}_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()||on(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&&(xu?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Mi(e.url,{ip:this.config.ip?1:0}),e.headers=D({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,o,a,u=D({},t);u.timeout=u.timeout||6e4,u.url=Mi(u.url,{_:new Date().getTime().toString(),ver:yr.LIB_VERSION,compression:u.compression});var h=(r=u.transport)!==null&&r!==void 0?r:"XHR",p=(o=(a=El(On,m=>m.transport===h))===null||a===void 0?void 0:a.method)!==null&&o!==void 0?o:On[0].method;if(!p)throw new Error("No available transport method");p(u)})(D(D({},e),{},{callback:t=>{var r,o,a;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((o=(a=this.config).on_request_error)===null||o===void 0||o.call(a,t)),(r=e.callback)===null||r===void 0||r.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,r=[],o=[],a=[];on(e,h=>{h&&(t=h[0],ut(t)?a.push(h):Kt(h)?h.call(this):ut(h)&&t==="alias"?r.push(h):ut(h)&&t.indexOf("capture")!==-1&&Kt(this[t])?a.push(h):o.push(h))});var u=function(h,p){on(h,function(m){if(ut(m[0])){var g=p;Qe(m,function(f){g=g[f[0]].apply(g,f.slice(1))})}else this[m[0]].apply(this,m.slice(1))},p)};u(r,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,r){var o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!fe(e)&&kt(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=r!=null&&r.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,h=(r==null?void 0:r.timestamp)||u,p={uuid:Rr(),event:e,properties:this._calculate_event_properties(e,t||{},h)};a&&(p.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),r!=null&&r.$set&&(p.$set=r==null?void 0:r.$set);var m=this._calculate_set_once_properties(r==null?void 0:r.$set_once);m&&(p.$set_once=m),(p=Tc(p,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=h,fe(r==null?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=u);var g=D(D({},p.properties.$set),p.$set);if(rn(g)||this.setPersonPropertiesForFlags(g),!et(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=r==null?void 0:r._url)!==null&&o!==void 0?o:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(b):this._requestQueue.enqueue(b),p}me.critical("This capture call is ignored due to client rate limiting.")}}else me.error("No event name provided to posthog.capture")}else me.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}_calculate_event_properties(e,t,r){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=this.persistence.remove_event_timer(e),a=D({},t);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cklsh_mode=!0),e==="$snapshot"){var u=D(D({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!kt(a.distinct_id)&&!Ut(a.distinct_id)||Ta(a.distinct_id))&&me.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var h=at.properties();if(this.sessionManager){var{sessionId:p,windowId:m}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=p,a.$window_id=m}if(this.sessionRecording&&(a.$recording_status=this.sessionRecording.status),this.requestRouter.region===Ur.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=Pt(a,g)}if(!this.config.disable_scroll_properties){var f={};e==="$pageview"?f=this.pageViewManager.doPageView(r):e==="$pageleave"&&(f=this.pageViewManager.doPageLeave(r)),a=Pt(a,f)}if(e==="$pageview"&&ne&&(a.title=ne.title),!fe(o)){var b=r.getTime()-o;a.$duration=parseFloat((b/1e3).toFixed(3))}yt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Pt({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),ut(this.config.property_denylist)?Qe(this.config.property_denylist,function(T){delete a[T]}):me.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=Pt({},this.persistence.get_initial_props(),e||{}),r=this.config.sanitize_properties;return r&&(t=r(t,"$set_once")),rn(t)?void 0:t}register(e,t){var r;(r=this.persistence)===null||r===void 0||r.register(e,t)}register_once(e,t,r){var o;(o=this.persistence)===null||o===void 0||o.register_once(e,t,r)}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,r;return(t=(r=this.sessionManager)===null||r===void 0?void 0:r.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,r){return this.surveys.getNextSurveyStep(e,t,r)}identify(e,t,r){if(!this.__loaded||!this.persistence)return me.uninitializedWarning("posthog.identify");if(Ut(e)&&(e=e.toString(),me.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()))me.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(En)&&(this.unregister(En),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:r||{}}),this.featureFlags.setAnonymousDistinctId(o)):(t||r)&&this.setPersonProperties(t,r),e!==o&&(this.reloadFeatureFlags(),this.unregister(wi))}}else me.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,r){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var o=this.getGroups();o[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:D(D({},o),{},{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),o[e]===t||r||this.reloadFeatureFlags()}}else me.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.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,r,o,a,u;if(me.info("reset"),!this.__loaded)return me.uninitializedWarning("posthog.reset");var h=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)===null||t===void 0||t.clear(),(r=this.sessionPersistence)===null||r===void 0||r.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(),this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:$a,$device_id:null},"");else{var p=this.config.get_device_id(Rr());this.register_once({distinct_id:p,$device_id:e?p:h},"")}}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:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),o=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(e!=null&&e.withTimestamp&&r){var a,u=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!r)return o;var h=Math.max(Math.floor((new Date().getTime()-r)/1e3)-u,0);o+="?t=".concat(h)}return o}alias(e,t){return e===this.get_property(Ml)?(me.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(fe(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(En,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(me.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,r,o,a,u=D({},this.config);ct(e)&&(Pt(this.config,wl(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 wo(D(D({},this.config),{},{persistence:"sessionStorage"})),vt.is_supported()&&vt.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(yr.DEBUG=!0,me.info("set_config",{config:e,oldConfig:u,newConfig:D({},this.config)})),(r=this.sessionRecording)===null||r===void 0||r.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,r={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(r).some(Boolean)){var o,a,u,h,p;(o=this.sessionManager)===null||o===void 0||o.checkAndGetSessionAndWindowId(),r.sampling&&((a=this.sessionRecording)===null||a===void 0||a.overrideSampling()),r.linked_flag&&((u=this.sessionRecording)===null||u===void 0||u.overrideLinkedFlag()),r.url_trigger&&((h=this.sessionRecording)===null||h===void 0||h.overrideTrigger("url")),r.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 r,o=new Error("PostHog syntheticException"),a=Kt((r=Ce.__PosthogExtensions__)===null||r===void 0?void 0:r.parseErrorAsProperties)?Ce.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:o}):D({$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:tn;return t!==tn&&(t=tn+"."+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,r,o;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&rn(this.getGroups())&&((e=this.persistence)===null||e===void 0||(t=e.props)===null||t===void 0||!t[En])&&((r=this.persistence)===null||r===void 0||(o=r.props)===null||o===void 0||!o[Si]))}_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"?(me.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Si,!0),!0)}_sync_opt_out_with_persistence(){var e,t,r,o,a=this.consent.isOptedOut(),u=this.config.opt_out_persistence_by_default,h=this.config.disable_persistence||a&&!!u;((e=this.persistence)===null||e===void 0?void 0:e.disabled)!==h&&((r=this.persistence)===null||r===void 0||r.set_disabled(h)),((t=this.sessionPersistence)===null||t===void 0?void 0:t.disabled)!==h&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(h))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(fe(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?Eu(Vt,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ne&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:ne.title},{send_instantly:!0}))}debug(e){e===!1?(C==null||C.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(C==null||C.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(et(this.config.before_send))return e;var t=ut(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var o of t){if(r=o(r),et(r)){var a="Event '".concat(e.event,"' was rejected in beforeSend function");return Oc(e.event)?me.warn("".concat(a,". This can cause unexpected behavior.")):me.info(a),null}r.properties&&!rn(r.properties)||me.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return r}}(function(n,e){for(var t=0;t<e.length;t++)n.prototype[e[t]]=kc(n.prototype[e[t]])})(Di,["identify"]);var Sl,Jt=(Sl=Nn[tn]=new Di,function(){function n(){n.done||(n.done=!0,xu=!1,Qe(Nn,function(e){e._dom_loaded()}))}ne!=null&&ne.addEventListener&&(ne.readyState==="complete"?n():ne.addEventListener("DOMContentLoaded",n,!1)),C&&br(C,"load",n,!0)}(),Sl);const vh={init:()=>{try{Jt.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(n){console.error(n)}},identify:n=>{Jt.identify(n,{contact_id:n})},guestVoter:n=>{Jt.identify(n)},logout:()=>{Jt.reset(!0)},pageView:(n,e={})=>{Jt.capture("$pageview",e)},hubspotForm:n=>{Jt.capture("hubspot_form_submitted",{hubspot_form_id:n})},hubspotFormPopupView:n=>{Jt.capture("hubspot_form_popup_view",{hubspot_form_id:n})},profileTabsUsage:()=>{Jt.capture("profile_tabs_usage")},webinarRegister:(n,e)=>{Jt.capture("webinar_registered",{title:n,type:e})},webinarContactUs:(n,e)=>{Jt.capture("webinar_contact_us",{title:n,type:e})},webinarReplay:n=>{Jt.capture("webinar_replay",{title:n})},webinarSessions:(n,e,t,r)=>{Jt.capture("webinar_sessions",{title:n,type:e,session:t,checked:r?"yes":"no"})}},mh={install:n=>{n.provide("telemetryClient",vh)}};export{vh as T,mh as V};