!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c="1.361.1",f={DEBUG:!1,LIB_VERSION:c,LIB_NAME:"web",JS_SDK_VERSION:c};function p(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function _(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){p(n,r,s,o,a,"next",t)}function a(t){p(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function x(t,i){return-1!==t.indexOf(i)}var E=function(t){return t.trim()},S=function(t){return t.replace(/^\$/,"")};var k=Array.isArray,P=Object.prototype,T=P.hasOwnProperty,I=P.toString,R=k||function(t){return"[object Array]"===I.call(t)},C=t=>"function"==typeof t,F=t=>t===Object(t)&&!R(t),O=t=>{if(F(t)){for(var i in t)if(T.call(t,i))return!1;return!0}return!1},M=t=>void 0===t,A=t=>"[object String]"==I.call(t),D=t=>A(t)&&0===t.trim().length,j=t=>null===t,L=t=>M(t)||j(t),N=t=>"[object Number]"==I.call(t)&&t==t,z=t=>N(t)&&t>0,U=t=>"[object Boolean]"===I.call(t),H=t=>t instanceof FormData,B=t=>x(b,t);function q(t){return null===t||"object"!=typeof t}function W(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function V(t){return!M(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var G=[!0,"true",1,"1","yes"],J=t=>x(G,t),K=[!1,"false",0,"0","no"];function Y(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),N(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.$}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.S(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var Q="Mobile",Z="iOS",tt="Android",it="Tablet",et=tt+" "+it,rt="iPad",st="Apple",nt=st+" Watch",ot="Safari",at="BlackBerry",lt="Samsung",ut=lt+"Browser",ht=lt+" Internet",dt="Chrome",vt=dt+" OS",ct=dt+" "+Z,ft="Internet Explorer",pt=ft+" "+Q,_t="Opera",gt=_t+" Mini",mt="Edge",bt="Microsoft "+mt,yt="Firefox",wt=yt+" "+Z,xt="Nintendo",$t="PlayStation",Et="Xbox",St=tt+" "+Q,kt=Q+" "+ot,Pt="Windows",Tt=Pt+" Phone",It="Nokia",Rt="Ouya",Ct="Generic",Ft=Ct+" "+Q.toLowerCase(),Ot=Ct+" "+it.toLowerCase(),Mt="Konqueror",At="(\\d+(\\.\\d+)?)",Dt=new RegExp("Version/"+At),jt=new RegExp(Et,"i"),Lt=new RegExp($t+" \\w+","i"),Nt=new RegExp(xt+" \\w+","i"),zt=new RegExp(at+"|PlayBook|BB10","i"),Ut={"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"};var Ht,Bt,qt,Wt=(t,i)=>i&&x(i,st)||function(t){return x(t,ot)&&!x(t,dt)&&!x(t,tt)}(t),Vt=function(t,i){return i=i||"",x(t," OPR/")&&x(t,"Mini")?gt:x(t," OPR/")?_t:zt.test(t)?at:x(t,"IE"+Q)||x(t,"WPDesktop")?pt:x(t,ut)?ht:x(t,mt)||x(t,"Edg/")?bt:x(t,"FBIOS")?"Facebook "+Q:x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?ct:x(t,"CrMo")||x(t,dt)?dt:x(t,tt)&&x(t,ot)?St:x(t,"FxiOS")?wt:x(t.toLowerCase(),Mt.toLowerCase())?Mt:Wt(t,i)?x(t,Q)?kt:ot:x(t,yt)?yt:x(t,"MSIE")||x(t,"Trident/")?ft:x(t,"Gecko")?yt:""},Gt={[pt]:[new RegExp("rv:"+At)],[bt]:[new RegExp(mt+"?\\/"+At)],[dt]:[new RegExp("("+dt+"|CrMo)\\/"+At)],[ct]:[new RegExp("CriOS\\/"+At)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+At)],[ot]:[Dt],[kt]:[Dt],[_t]:[new RegExp("(Opera|OPR)\\/"+At)],[yt]:[new RegExp(yt+"\\/"+At)],[wt]:[new RegExp("FxiOS\\/"+At)],[Mt]:[new RegExp("Konqueror[:/]?"+At,"i")],[at]:[new RegExp(at+" "+At),Dt],[St]:[new RegExp("android\\s"+At,"i")],[ht]:[new RegExp(ut+"\\/"+At)],[ft]:[new RegExp("(rv:|MSIE )"+At)],Mozilla:[new RegExp("rv:"+At)]},Jt=function(t,i){var e=Vt(t,i),r=Gt[e];if(M(r))return null;for(var s=0;s[Et,t&&t[1]||""]],[new RegExp(xt,"i"),[xt,""]],[new RegExp($t,"i"),[$t,""]],[zt,[at,""]],[new RegExp(Pt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Tt,""];if(new RegExp(Q).test(i)&&!/IEMobile\b/.test(i))return[Pt+" "+Q,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Ut[r]||"";return/arm/i.test(i)&&(s="RT"),[Pt,s]}return[Pt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[Z,i.join(".")]}return[Z,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=M(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+tt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+tt+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[tt,i.join(".")]}return[tt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[vt,""]],[/Linux|debian/i,["Linux",""]]],Yt=function(t){return Nt.test(t)?xt:Lt.test(t)?$t:jt.test(t)?Et:new RegExp(Rt,"i").test(t)?Rt:new RegExp("("+Tt+"|WPDesktop)","i").test(t)?Tt:/iPad/.test(t)?rt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?nt:zt.test(t)?at:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(It,"i").test(t)?It:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Q).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?tt:et:new RegExp("(pda|"+Q+")","i").test(t)?Ft:new RegExp(it,"i").test(t)&&!new RegExp(it+" pc","i").test(t)?Ot:""},Xt=t=>t instanceof Error;function Qt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return qt&&e.length===Bt||(Bt=e.length,qt=e.reduce(((e,r)=>{Ht||(Ht={});var s=Ht[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=i[r];if(l&&u){e[l]=u,Ht[r]=[l,u];break}}return e}),{})),qt}}class Zt{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return _((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&R(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return _((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Qt(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var ti="?";function ii(t,i,e,r,s){var n={platform:t,filename:i,function:""===e?ti:e,in_app:!0};return M(r)||(n.lineno=r),M(s)||(n.colno=s),n}var ei=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:ti,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ri=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,si=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ni=/\((\S*)(?::(\d+))(?::(\d+))\)/,oi=(t,i)=>{var e=ri.exec(t);if(e){var[,r,s,n]=e;return ii(i,r,ti,+s,+n)}var o=si.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ni.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=ei(o[1]||ti,o[2]);return ii(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ai=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,li=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ui=(t,i)=>{var e=ai.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=li.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||ti;return[n,s]=ei(n,s),ii(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},hi=/\(error: (.*)\)/,di=50;function vi(){return function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r1024)){var l=hi.test(a)?a.replace(hi,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=di)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,di).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||ti});var e}))}(s)}}("web:javascript",oi,ui)}class ci{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=A(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return W(t,"DOMException")}isDOMError(t){return W(t,"DOMError")}}class fi{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class pi{constructor(){}match(t){return W(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var _i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class gi{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(_i);return r&&(i=r[1],e=r[2]),[i,e]}}var mi=["fatal","error","warning","log","info","debug"];function bi(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class yi{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return V(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+bi(t)}isSeverityLevel(t){return A(t)&&!D(t)&&mi.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Xt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class wi{match(t){return V(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+bi(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class xi{match(t){return q(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class $i{match(t){return W(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!V(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return q(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Ei=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(f.DEBUG||v.POSTHOG_DEBUG||r)&&!M(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>Ei(i+" "+t,e)};return s},Si=Ei("[PostHog.js]"),ki=Si.createLogger,Pi=ki("[ExternalScriptsLoader]"),Ti=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Pi.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)o.head.appendChild(r);else{var s,n=o.querySelectorAll("body > script");if(n.length>0)null==(s=n[0].parentNode)||s.insertBefore(r,n[0]);else o.body.appendChild(r)}};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);Ti(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);Ti(t,r,e)};var Ii={};function Ri(t,i,e){if(R(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s1?i-1:0),r=1;r1?i-1:0),r=1;r0||N(t))&&(i[e]=t)})),i};function Li(t,i){return e=t,r=t=>A(t)&&!j(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),R(i)?(n=[],Ri(i,(i=>{n.push(t(i))}))):(n={},Ci(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var Ni=["herokuapp.com","vercel.app","netlify.app"];function zi(t){var i=null==t?void 0:t.hostname;if(!A(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Ni)if(e===r)return!1;return!0}function Ui(t,i){for(var e=0;e0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ke(s)}toString(){for(var t="",i=0;i>>4)+Se.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ke(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Pe{constructor(){this.P=0,this.T=0,this.I=new Re}generate(){var t=this.generateOrAbort();if(M(t)){this.P=0;var i=this.generateOrAbort();if(M(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.P)this.P=t,this.R();else{if(!(t+1e4>this.P))return;this.T++,this.T>4398046511103&&(this.P++,this.R())}return ke.fromFieldsV7(this.P,Math.trunc(this.T/Math.pow(2,30)),this.T&Math.pow(2,30)-1,this.I.nextUint32())}R(){this.T=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Te,Ie=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;icrypto.getRandomValues(t));class Re{constructor(){this.C=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.C.length&&(Ie(this.C),this.F=0),this.C[this.F++]}}var Ce=()=>Fe().toString(),Fe=()=>(Te||(Te=new Pe)).generate(),Oe="";var Me=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ae(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Oe)return Oe;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ce();!Oe&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Oe=n)}return Oe}(t);if(!e){var r=(t=>{var i=t.match(Me);return i?i[0]:""})(t);r!==e&&Si.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var De={O:()=>!!o,M:function(t){Si.error("cookieStore error: "+t)},A:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r3686.4&&Si.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},L:function(t,i){if(null!=o&&o.cookie)try{De.j(t,"",-1,i)}catch(t){return}}},je=null,Le={O:function(){if(!j(je))return je;var i=!0;if(M(t))i=!1;else try{var e="__mplssupport__";Le.j(e,"xyz"),'"xyz"'!==Le.A(e)&&(i=!1),Le.L(e)}catch(t){i=!1}return i||Si.error("localStorage unsupported; falling back to cookie store"),je=i,i},M:function(t){Si.error("localStorage error: "+t)},A:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Le.M(t)}return null},D:function(t){try{return JSON.parse(Le.A(t))||{}}catch(t){}return null},j:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Le.M(t)}},L:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Le.M(t)}}},Ne=["$device_id","distinct_id",re,se,we,ye,pe],ze={},Ue={O:function(){return!0},M:function(t){Si.error("memoryStorage error: "+t)},A:function(t){return ze[t]||null},D:function(t){return ze[t]||null},j:function(t,i){ze[t]=i},L:function(t){delete ze[t]}},He=null,Be={O:function(){if(!j(He))return He;if(He=!0,M(t))He=!1;else try{var i="__support__";Be.j(i,"xyz"),'"xyz"'!==Be.A(i)&&(He=!1),Be.L(i)}catch(t){He=!1}return He},M:function(t){Si.error("sessionStorage error: ",t)},A:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Be.M(t)}return null},D:function(t){try{return JSON.parse(Be.A(t))||null}catch(t){}return null},j:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){Be.M(t)}},L:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Be.M(t)}}},qe=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class We{constructor(t){this._instance=t}get N(){return this._instance.config}get consent(){return this.U()?qe.DENIED:this.H}isOptedOut(){return"always"===this.N.cookieless_mode||(this.consent===qe.DENIED||this.consent===qe.PENDING&&(this.N.opt_out_capturing_by_default||"on_reject"===this.N.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===qe.DENIED}optInOut(t){this.B.j(this.q,t?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.L(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get H(){var t=this.B.A(this.q);return J(t)?qe.GRANTED:x(K,t)?qe.DENIED:qe.PENDING}get B(){if(!this.W){var t=this.N.opt_out_capturing_persistence_type;this.W="localStorage"===t?Le:De;var i="localStorage"===t?De:Le;i.A(this.q)&&(this.W.A(this.q)||this.optInOut(J(i.A(this.q))),i.L(this.q,this.N.cross_subdomain_cookie))}return this.W}U(){return!!this.N.respect_dnt&&!!Ui([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>J(t)))}}var Ve=ki("[Dead Clicks]"),Ge=()=>!0,Je=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Zi)),r=t.instance.config.capture_dead_clicks;return U(r)?r:!!F(r)||e};class Ke{get lazyLoadedDeadClicksAutocapture(){return this.V}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Zi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.G((()=>{this.J()})):this.stop()}G(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ve.error("failed to load script",i):t()}))}J(){var t;if(o){if(!this.V&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=F(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.V=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.V.start(o),Ve.info("starting...")}}else Ve.error("`document` not found. Cannot start.")}stop(){this.V&&(this.V.stop(),this.V=void 0,Ve.info("stopping..."))}}var Ye=ki("[SegmentIntegration]");function Xe(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Ce();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(pe,"identified")),i()},s=e.user();"then"in s&&C(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Ye.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Ye.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Ye.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Qe="posthog-js";function Ze(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,d;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=i.exception)?void 0:a.values)||[],p=f.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(l=f[0])?void 0:l.value)||i.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};(e&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o)&&(null==(c=t.exceptions)||c.sendExceptionEvent(_));return i}}class tr{constructor(t,i,e,r,s,n){this.name=Qe,this.setupOnce=function(o){o(Ze(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class ir{constructor(t){this.K=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(Si.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Y=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.X()}X(){var t;this.Z=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.K)}destroy(){var t;null==(t=this.Z)||t.call(this),this.Z=void 0}doPageView(i,e){var r,s=this.tt(i,e);return this.Y={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.tt(t,null==(i=this.Y)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Y)?void 0:t.pageViewId}}tt(t,i){var e=this.Y;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n<=1?1:Y(o/n,0,1,Si),v=n<=1?1:Y(a/n,0,1,Si),c=l<=1?1:Y(u/l,0,1,Si),f=l<=1?1:Y(h/l,0,1,Si);r=Fi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var er=t=>{var i=null==o?void 0:o.createElement("a");return M(i)?null:(i.href=t,i)},rr=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ci(t,(function(t,i){M(t)||M(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},sr=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s",dr=["li_fat_id"];function vr(t,i,e){if(!o)return{};var r,s=i?Oi([],lr,e||[]):[],n=cr(nr(o.URL,s,hr),t),a=(r={},Ci(dr,(function(t){var i=De.A(t);r[t]=i||null})),r);return Fi(a,n)}function cr(t,i){var e=ur.concat(i||[]),r={};return Ci(e,(function(i){var e=sr(t,i);r[i]=e||null})),r}function fr(t){var i=function(t){return t?0===t.search(ar+"google.([^/?]*)")?"google":0===t.search(ar+"bing.com")?"bing":0===t.search(ar+"yahoo.com")?"yahoo":0===t.search(ar+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!j(i)){r.$search_engine=i;var s=o?sr(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function pr(){return navigator.language||navigator.userLanguage}function _r(){return(null==o?void 0:o.referrer)||"$direct"}function gr(t,i){var e=t?Oi([],lr,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:_r().substring(0,1e3),u:r?nr(r,e,hr):void 0}}function mr(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=er(e))?void 0:i.host};if(r){s.$current_url=r;var n=er(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=cr(r);Fi(s,o)}if(e){var a=fr(e);Fi(s,a)}return s}function br(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function yr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function wr(i,e){var r,s,n,o;if(!d)return{};var l,u,h,v,c,p,_,g,m=i?Oi([],lr,e||[]):[],[b,y]=function(t){for(var i=0;i0?Math.min(null!==(c=null==h?void 0:h.screenWidth)&&void 0!==c?c:0,null!==(p=null==h?void 0:h.screenHeight)&&void 0!==p?p:0)/(null!==(_=null==h?void 0:h.devicePixelRatio)&&void 0!==_?_:1)>=600?it:Q:"Desktop"),$timezone:br(),$timezone_offset:yr()}),{$current_url:nr(null==a?void 0:a.href,m,hr),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Jt(d,navigator.vendor),$browser_language:pr(),$browser_language_prefix:(l=pr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:f.LIB_NAME,$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var xr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class $r{constructor(t,i){this.N=t,this.props={},this.it=!1,this.et=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.B=this.rt(t),this.load(),t.debug&&Si.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.st}rt(i){-1===xr.indexOf(i.persistence.toLowerCase())&&(Si.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e=function(i){void 0===i&&(i=[]);var e=[...Ne,...i];return g({},Le,{D:function(t){try{var i={};try{i=De.D(t)||{}}catch(t){}var e=Fi(i,JSON.parse(Le.A(t)||"{}"));return Le.j(t,e),e}catch(t){}return null},j:function(t,i,r,s,n,o){try{Le.j(t,i,void 0,void 0,o);var a={};e.forEach((t=>{i[t]&&(a[t]=i[t])})),Object.keys(a).length&&De.j(t,a,r,s,n,o)}catch(t){Le.M(t)}},L:function(i,e){try{null==t||t.localStorage.removeItem(i),De.L(i,e)}catch(t){Le.M(t)}}})}(i.cookie_persisted_properties||[]),r=i.persistence.toLowerCase();return"localstorage"===r&&Le.O()?Le:"localstorage+cookie"===r&&e.O()?e:"sessionstorage"===r&&Be.O()?Be:"memory"===r?Ue:"cookie"===r?De:e.O()?e:De}nt(t){var i=null!=t?t:this.N.feature_flag_cache_ttl_ms;if(!i||i<=0)return!1;var e=this.props[fe];return!e||"number"!=typeof e||Date.now()-e>i}properties(){var t={};return Ci(this.props,((i,e)=>{if(e===ne&&F(i)){if(!this.nt())for(var r=Object.keys(i),n=0;n{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(F(t)){this.ot=M(i)?this.dt:i;var e=!1;if(Ci(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.it){var t=vr(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);O(ji(t))||this.register(t),this.it=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?fr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_r(),$referring_domain:null!=o&&o.referrer&&(null==(t=er(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[me]||this.props[be]||this.register_once({[ye]:gr(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ci([be,me],(i=>{var e=this.props[i];e&&Ci(e,(function(i,e){t["$initial_"+S(e)]=i}))}));var i,e,r=this.props[ye];if(r){var s=(i=mr(r),e={},Ci(i,(function(t,i){e["$initial_"+S(i)]=t})),e);Fi(t,s)}return t}safe_merge(t){return Ci(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.dt=this.ot=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence||!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[])){var r=this.rt(t),s=this.props;this.clear(),this.B=r,this.props=s,this.save()}}set_disabled(t){this.st=t,this.st?this.remove():this.save()}set_cross_subdomain(t){t!==this.ut&&(this.ut=t,this.remove(),this.save())}set_secure(t){t!==this.ht&&(this.ht=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Vi]||{};e[t]=i,this.props[Vi]=e,this.save()}remove_event_timer(t){var i=(this.props[Vi]||{})[t];return M(i)||(delete this.props[Vi][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Er="events",Sr="cancelEvents",kr="popover",Pr="api",Tr="widget",Ir="survey shown",Rr="survey dismissed",Cr="survey sent",Fr="$survey_id",Or="$survey_iteration",Mr="$survey_last_seen_date",Ar="popover",Dr="inline",jr=function(t){return t.SHOWN="product tour shown",t.DISMISSED="product tour dismissed",t.COMPLETED="product tour completed",t.STEP_SHOWN="product tour step shown",t.STEP_COMPLETED="product tour step completed",t.BUTTON_CLICKED="product tour button clicked",t.STEP_SELECTOR_FAILED="product tour step selector failed",t.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",t.BANNER_ACTION_CLICKED="product tour banner action clicked",t}({}),Lr=function(t){return t.TOUR_ID="$product_tour_id",t.TOUR_NAME="$product_tour_name",t.TOUR_ITERATION="$product_tour_iteration",t.TOUR_RENDER_REASON="$product_tour_render_reason",t.TOUR_STEP_ID="$product_tour_step_id",t.TOUR_STEP_ORDER="$product_tour_step_order",t.TOUR_STEP_TYPE="$product_tour_step_type",t.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",t.TOUR_BUTTON_TEXT="$product_tour_button_text",t.TOUR_BUTTON_action="proxy.php?url=$product_tour_button_action",t.TOUR_BUTTON_LINK="$product_tour_button_link",t.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",t.TOUR_STEPS_COUNT="$product_tour_steps_count",t.TOUR_STEP_SELECTOR="$product_tour_step_selector",t.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",t.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",t.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",t.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",t.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",t.TOUR_ERROR="$product_tour_error",t.TOUR_MATCHES_COUNT="$product_tour_matches_count",t.TOUR_FAILURE_PHASE="$product_tour_failure_phase",t.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",t.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",t.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",t.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",t.USE_MANUAL_SELECTOR="$use_manual_selector",t.INFERENCE_DATA_PRESENT="$inference_data_present",t.TOUR_LAST_SEEN_DATE="$product_tour_last_seen_date",t.TOUR_TYPE="$product_tour_type",t}({}),Nr=ki("[RateLimiter]");class zr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Nr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Nr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(ge))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=a.tokens<1;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(ge,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()t(this.remoteConfig))):t()}ct(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return Ur.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void Ur.warn("Remote config is disabled. Falling back to local config.");this.vt((t=>{if(!t)return Ur.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct((t=>{this.ft(t),this._t()}));this.ft(t),this._t()}))}catch(t){Ur.error("Error loading remote config",t)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||"hidden"===(null==o?void 0:o.visibilityState)||this._instance.reloadFeatureFlags()}_t(){var t;if(!this.yt){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.yt=setInterval((()=>{this.refresh()}),i))}}ft(t){var i;(t||Ur.error("Failed to fetch remote config from PostHog."),this._instance.ft(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags))&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded())}}var Br=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),qr=Uint8Array,Wr=Uint16Array,Vr=Uint32Array,Gr=new qr([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]),Jr=new qr([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]),Kr=new qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yr=function(t,i){for(var e=new Wr(31),r=0;r<31;++r)e[r]=i+=1<>>1|(21845&es)<<1;rs=(61680&(rs=(52428&rs)>>>2|(13107&rs)<<2))>>>4|(3855&rs)<<4,is[es]=((65280&rs)>>>8|(255&rs)<<8)>>>1}var ss=function(t,i,e){for(var r=t.length,s=0,n=new Wr(i);s>>l]=u}else for(o=new Wr(r),s=0;s>>15-t[s];return o},ns=new qr(288);for(es=0;es<144;++es)ns[es]=8;for(es=144;es<256;++es)ns[es]=9;for(es=256;es<280;++es)ns[es]=7;for(es=280;es<288;++es)ns[es]=8;var os=new qr(32);for(es=0;es<32;++es)os[es]=5;var as=ss(ns,9,0),ls=ss(os,5,0),us=function(t){return(t/8>>0)+(7&t&&1)},hs=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Wr?Wr:t instanceof Vr?Vr:qr)(e-i);return r.set(t.subarray(i,e)),r},ds=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},vs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},cs=function(t,i){for(var e=[],r=0;rv&&(v=n[r].s);var c=new Wr(v+1),f=fs(e[h-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));ri))break;p+=g-(1<>>=_;p>0;){var b=n[r].s;c[b]=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new qr(c),f]},fs=function(t,i,e){return-1==t.s?Math.max(fs(t.l,i,e+1),fs(t.r,i,e+1)):i[t.s]=e},ps=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Wr(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},_s=function(t,i){for(var e=0,r=0;r>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n4&&!P[Kr[I-1]];--I);var R,C,F,O,M=u+5<<3,A=_s(s,ns)+_s(n,os)+o,D=_s(s,v)+_s(n,p)+o+14+3*I+_s(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(M<=A&&M<=D)return gs(i,h,t.subarray(l,l+u));if(ds(i,h,1+(D15&&(ds(i,h,z[S]>>>5&127),h+=z[S]>>>12)}}}else R=as,C=ns,F=ls,O=os;for(S=0;S255){U=r[S]>>>18&31;vs(i,h,R[U+257]),h+=C[U+257],U>7&&(ds(i,h,r[S]>>>23&31),h+=Gr[U]);var H=31&r[S];vs(i,h,F[H]),h+=O[H],H>3&&(vs(i,h,r[S]>>>5&8191),h+=Jr[H])}else vs(i,h,R[r[S]]),h+=C[r[S]];return vs(i,h,R[256]),h+C[256]},bs=new Vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ys=function(){for(var t=new Vr(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ws=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new qr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var d=h+65535;d>>13,f=8191&v,p=(1<7e3||P>24576)&&O>423){u=ms(t,l,0,w,x,E,k,P,I,h-I,u),P=S=k=0,I=h;for(var M=0;M<286;++M)x[M]=0;for(M=0;M<30;++M)E[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&R==y(h-L))for(var N=Math.min(c,O)-1,z=Math.min(32767,h),U=Math.min(258,O);L<=z&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;HA){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(M=0;Mq&&(q=V,F=W)}}}L+=(C=F)-(F=_[C])+32768&32767}if(D){w[P++]=268435456|Zr[A]<<18|ts[D];var G=31&Zr[A],J=31&ts[D];k+=Gr[G]+Jr[J],++x[257+G],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=ms(t,l,n,w,x,E,k,P,I,h-I,u)}return hs(a,0,r+us(u)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},xs=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function $s(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=ws(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&xs(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(n,i),xs(n,o-8,e.d()),xs(n,o-4,r),n}var Es=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),j(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},Ss=!!u||!!l,ks=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=g({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=rr(o);return l&&a.push(l),s+"?"+a.join("&")},Ps=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),Ts=t=>{var{data:i,compression:e}=t;if(i){if(e===Br.GZipJS){var r=$s(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new qr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;or.length){var a=new qr(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return hs(r,0,s)}(Ps(i)),{mtime:0});return{contentType:"text/plain",body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Br.Base64){var s=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=Es(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a"data="+encodeURIComponent("string"==typeof t?t:Ps(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ps(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Is=[];l&&Is.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=Ts(t))&&void 0!==i?i:{},o=new Headers;Ci(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var d=new h;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Si.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Si.error(i),null==t.callback||t.callback({statusCode:0,error:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&Is.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=Ts(t))&&void 0!==i?i:{};Ci(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&Is.push({transport:"sendBeacon",method:t=>{var i=ks(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=Ts(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var Rs=3e3;class Cs{constructor(t,i){this.wt=!0,this.xt=[],this.$t=Y((null==i?void 0:i.flush_interval_ms)||Rs,250,5e3,Si.createLogger("flush interval"),Rs),this.Et=t}enqueue(t){this.xt.push(t),this.St||this.kt()}unload(){this.Pt();var t=this.xt.length>0?this.Tt():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Et(g({},t,{transport:"sendBeacon"}))}))}enable(){this.wt=!1,this.kt()}kt(){var t=this;this.wt||(this.St=setTimeout((()=>{if(this.Pt(),this.xt.length>0){var i=this.Tt(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&R(e.data)&&Ci(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Et(e)};for(var r in i)e()}}),this.$t))}Pt(){clearTimeout(this.St),this.St=void 0}Tt(){var t={};return Ci(this.xt,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;M(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.xt=[],t}}var Fs=["retriesPerformedSoFar"];class Os{constructor(i){this.It=!1,this.Rt=3e3,this.xt=[],this._instance=i,this.xt=[],this.Ct=!0,!M(t)&&"onLine"in t.navigator&&(this.Ct=t.navigator.onLine,this.Ft=()=>{this.Ct=!0,this.Ot()},this.Mt=()=>{this.Ct=!1},Hi(t,"online",this.Ft),Hi(t,"offline",this.Mt))}get length(){return this.xt.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=m(t,Fs);z(i)&&(e.url=ks(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.At(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}At(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.xt.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Si.warn(s),this.It||(this.It=!0,this.Dt())}Dt(){if(this.jt&&clearTimeout(this.jt),0===this.xt.length)return this.It=!1,void(this.jt=void 0);this.jt=setTimeout((()=>{this.Ct&&this.xt.length>0&&this.Ot(),this.Dt()}),this.Rt)}Ot(){var t=Date.now(),i=[],e=this.xt.filter((e=>e.retryAt0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.jt&&(clearTimeout(this.jt),this.jt=void 0),this.It=!1,M(t)||(this.Ft&&(t.removeEventListener("online",this.Ft),this.Ft=void 0),this.Mt&&(t.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.xt))try{this._instance._send_request(g({},i,{transport:"sendBeacon"}))}catch(t){Si.error(t)}this.xt=[]}}class Ms{constructor(t){this.Lt=()=>{var t,i,e,r;this.Nt||(this.Nt={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Nt.lastScrollY=Math.ceil(n),this.Nt.maxScrollY=Math.max(n,null!==(t=this.Nt.maxScrollY)&&void 0!==t?t:0),this.Nt.maxScrollHeight=Math.max(o,null!==(i=this.Nt.maxScrollHeight)&&void 0!==i?i:0),this.Nt.lastContentY=a,this.Nt.maxContentY=Math.max(a,null!==(e=this.Nt.maxContentY)&&void 0!==e?e:0),this.Nt.maxContentHeight=Math.max(l,null!==(r=this.Nt.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.Nt}resetContext(){var t=this.Nt;return setTimeout(this.Lt,0),t}startMeasuringScrollPosition(){Hi(t,"scroll",this.Lt,{capture:!0}),Hi(t,"scrollend",this.Lt,{capture:!0}),Hi(t,"resize",this.Lt)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=R(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var As=t=>gr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Ds{constructor(t,i,e,r){this.zt=t=>{var i=this.Ut();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ht(this._instance)};this.Bt.register({[_e]:e})}},this._instance=t,this.qt=i,this.Bt=e,this.Ht=r||As,this.qt.onSessionId(this.zt)}Ut(){return this.Bt.props[_e]}getSetOnceProps(){var t,i=null==(t=this.Ut())?void 0:t.props;return i?"r"in i?mr(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Ci(ji(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+S(e)]=i})),t}}class js{constructor(){this.Wt={},this.Wt={}}on(t,i){return this.Wt[t]||(this.Wt[t]=[]),this.Wt[t].push(i),()=>{this.Wt[t]=this.Wt[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Wt[t]||[])e(i);for(var r of this.Wt["*"]||[])r(t,i)}}var Ls=ki("[SessionId]");class Ns{on(t,i){return this.Vt.on(t,i)}constructor(t,i,e){var r;if(this.Gt=[],this.Jt=void 0,this.Vt=new js,this.Kt=(t,i)=>!(!z(t)||!z(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=t.config,this.Bt=t.persistence,this.Yt=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Qt=i||Ce,this.Zt=e||Ce;var s=this.N.persistence_name||this.N.token,n=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Y(n,60,36e3,Ls.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ti(),this.ii="ph_"+s+"_window_id",this.ei="ph_"+s+"_primary_window_exists",this.ri()){var o=Be.D(this.ii),a=Be.D(this.ei);o&&!a?this.Yt=o:Be.L(this.ii),Be.j(this.ei,!0)}if(null!=(r=this.N.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.N.bootstrap.sessionID);this.si(this.N.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){Ls.error("Invalid sessionID in bootstrap",t)}this.ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return M(this.Gt)&&(this.Gt=[]),this.Gt.push(t),this.Xt&&t(this.Xt,this.Yt),()=>{this.Gt=this.Gt.filter((i=>i!==t))}}ri(){return"memory"!==this.N.persistence&&!this.Bt.st&&Be.O()}oi(t){t!==this.Yt&&(this.Yt=t,this.ri()&&Be.j(this.ii,t))}ai(){return this.Yt?this.Yt:this.ri()?Be.D(this.ii):null}si(t,i,e){t===this.Xt&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,this.Bt.register({[re]:[i,t,e]}))}li(){var t=this.Bt.props[re];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.si(null,null,null)}destroy(){clearTimeout(this.ui),this.ui=void 0,this.Jt&&t&&(t.removeEventListener("beforeunload",this.Jt,{capture:!1}),this.Jt=void 0),this.Gt=[]}ni(){this.Jt=()=>{this.ri()&&Be.L(this.ei)},Hi(t,"beforeunload",this.Jt,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.N.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.li(),o=this.ai(),a=z(n)&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.Kt(e,r);u||h||a?(s=this.Qt(),o=this.Zt(),Ls.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Zt(),l=!0);var d=!!z(r)&&t&&!a?r:e,v=!z(n)?(new Date).getTime():n;return this.oi(o),this.si(s,d,v),t||this.ti(),l&&this.Gt.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}ti(){clearTimeout(this.ui),this.ui=setTimeout((()=>{var[t]=this.li();if(this.Kt((new Date).getTime(),t)){var i=this.Xt;this.resetSessionId(),this.Vt.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var zs=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&w(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>w(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Us=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function Hs(t,i,e){return Ps({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Bs={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Us(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Us(i,t))))),icontains:(t,i)=>i.map(qs).some((i=>t.map(qs).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(qs).every((i=>t.map(qs).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>et.toLowerCase();function Ws(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(M(s)||j(s))return!1;var n=[String(s)],o=Bs[r.operator];return!!o&&o(r.values,n)}))}var Vs=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),Gs="i.posthog.com";class Js{constructor(t){this.hi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Gs,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.hi[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=Vs.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=Vs.EU:this.hi[this.apiHost]=Vs.CUSTOM),this.hi[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===Vs.CUSTOM)return this.apiHost+i;var e=Gs+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Ks=ki("[Surveys]");var Ys="seenSurvey_",Xs=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Qs=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(Ys,t),Zs=[kr,Tr,Pr],tn={ignoreConditions:!1,ignoreDelay:!1,displayType:Ar},en=ki("[PostHog ExternalIntegrations]"),rn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class sn{constructor(t){this._instance=t}G(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return en.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.G(rn[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var nn={},on=0,an=()=>{},ln="posthog",un=!Ss&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),hn=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zi(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:an,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:a&&A(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Si.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Rs},error_tracking:{},_onCapture:an,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},dn=t=>{var i={};M(t.process_person)||(i.person_profiles=t.process_person),M(t.xhr_headers)||(i.request_headers=t.xhr_headers),M(t.cookie_name)||(i.persistence_name=t.cookie_name),M(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),M(t.store_google)||(i.save_campaign_params=t.store_google),M(t.verbose)||(i.debug=t.verbose);var e=Fi({},i,t);return R(t.property_blacklist)&&(M(t.property_denylist)?e.property_denylist=t.property_blacklist:R(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Si.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class vn{constructor(){this.__forceAllowLocalhost=!1}get di(){return this.__forceAllowLocalhost}set di(t){Si.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class cn{vi(t,i){if(t){var e=this.ci.indexOf(t);-1!==e&&this.ci.splice(e,1)}return this.ci.push(i),null==i.initialize||i.initialize(),i}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new vn,this.fi=!1,this.version=f.LIB_VERSION,this.pi=new js,this.ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=hn(),this.SentryIntegration=tr,this.sentryIntegration=t=>function(t,i){var e=Ze(t,i);return{name:Qe,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.gi=!1,this.mi=null,this.bi=null,this.yi=null,this.scrollManager=new Ms(this),this.pageViewManager=new ir(this),this.rateLimiter=new zr(this),this.requestRouter=new Js(this),this.consent=new We(this),this.externalIntegrations=new sn(this);var i=null!==(t=cn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=A(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=A(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Si.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==ln){var r,s=null!==(r=nn[e])&&void 0!==r?r:new cn;return s._init(t,i,e),nn[e]=s,nn[ln][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),M(i)||D(i))return Si.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 console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},e.debug=this.wi(e.debug),this.xi=e,this.$i=[],e.person_profiles?this.bi=e.person_profiles:e.process_person&&(this.bi=e.process_person),this.set_config(Fi({},hn(e.defaults),dn(e),{name:r,token:i})),this.config.on_xhr_error&&Si.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Br.GZipJS;var n=this.Ei();this.persistence=new $r(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new $r(g({},this.config,{persistence:"sessionStorage"}),n);var o=g({},this.persistence.props),a=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Si=new Cs((t=>this.ki(t)),this.config.request_queue_config),this.Pi=new Os(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Ns(this),this.sessionPropsManager=new Ds(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Si.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ti(l)}),0)):(Si.info("Initializing extensions synchronously"),this.Ti(l)),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&Si.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(Ce()),v=null!=(u=e.bootstrap)&&u.isIdentifiedID?d:e.bootstrap.distinctID;this.persistence.set_property(pe,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:v})}if(l)this.register_once({distinct_id:$e,$device_id:null},"");else if(!this.get_distinct_id()){var c=this.config.get_device_id(Ce());this.register_once({distinct_id:c,$device_id:c},""),this.persistence.set_property(pe,"anonymous")}return Hi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?Xe(this,(()=>this.Ii())):this.Ii(),C(this.config._onCapture)&&this.config._onCapture!==an&&(Si.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Si.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ti(t){var i,e,r,s,n,o,a,l=performance.now(),u=g({},cn.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.ci.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new u.featureFlags(this));u.exceptions&&this.ci.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this));(u.historyAutocapture&&this.ci.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ci.push(new u.tracingHeaders(this)),u.siteApps&&this.ci.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.ci.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ci.push(this.autocapture=new u.autocapture(this)),u.surveys)&&this.ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this));u.logs&&this.ci.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this));u.conversations&&this.ci.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this));(u.productTours&&this.ci.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ci.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ci.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ci.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ci.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Je)),u.toolbar)&&this.ci.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this));u.experiments&&this.ci.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this));this.ci.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Ri){var t=this.Ri;this.Ri=void 0,this.ft(t)}})),this.Ci(h,l)}Ci(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Ci(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Si.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&Si.info("PostHog extensions initialized ("+r+"ms)")}ft(t){var i;if(!o||!o.body)return Si.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ft(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ri=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=x(t.supportedCompression,Br.GZipJS)?Br.GZipJS:x(t.supportedCompression,Br.Base64)?Br.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.bi?this.bi:"identified_only"}),this.ci.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Ii(){try{this.config.loaded(this)}catch(t){Si.critical("`loaded` function failed",t)}if(this.Fi(),this.config.internal_or_test_user_hostname&&null!=a&&a.hostname){var t=a.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Oi()}),1),this.Mi=new Hr(this),this.Mi.load()}Fi(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Si)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ri(this.__request_queue,(t=>this.ki(t))),this.__request_queue=[],this.Fi()}_handle_unload(){var t,i,e;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Ai()&&this.capture("$pageleave"),null==(i=this.Si)||i.unload(),null==(e=this.Pi)||e.unload()):this.Ai()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(un?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=ks(t.url,{ip:this.config.ip?1:0}),t.headers=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4,s.url=ks(s.url,{_:(new Date).getTime().toString(),ver:f.JS_SDK_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=Is.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=Ui(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}ki(t){this.Pi?this.Pi.retriableRequest(t):this._send_request(t)}_execute_array(t){on++;try{var i,e=[],r=[],s=[];Ri(t,(t=>{t&&(i=t[0],R(i)?s.push(t):C(t)?t.call(this):R(t)&&"alias"===i?e.push(t):R(t)&&-1!==i.indexOf("capture")&&C(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ri(t,(function(t){if(R(t[0])){var e=i;Ci(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}finally{on--}}push(t){if(on>0&&R(t)&&A(t[0])){var i=cn.prototype[t[0]];C(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Si){if(this.is_capturing())if(!M(t)&&A(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!A(null==i?void 0:i.$current_url)&&(Si.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.Di||Si.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==e?void 0:e.timestamp)||o,l=Ce(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,d="$groupidentify"!==t,v=this.ji(null==e?void 0:e.$set_once,d);if(v&&(u.$set_once=v),(u=Li(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===Rr||t===Cr){var c=null==i?void 0:i[Fr],f=null==i?void 0:i[Or];h={id:c,current_iteration:f},localStorage.getItem(Qs(h))||localStorage.setItem(Qs(h),"true"),u.$set=g({},u.$set,{[Xs({id:c,current_iteration:f},t===Cr?"responded":"dismissed")]:!0})}else t===Ir&&(u.$set=g({},u.$set,{[Mr]:(new Date).toISOString()}));if(t===jr.SHOWN){var p=null==i?void 0:i[Lr.TOUR_TYPE];p&&(u.$set=g({},u.$set,{[Lr.TOUR_LAST_SEEN_DATE+"/"+p]:(new Date).toISOString()}))}var _=g({},u.properties.$set,u.$set);if(O(_)||this.setPersonPropertiesForFlags(_),!L(this.config.before_send)){var m=this.Li(u);if(!m)return;u=m}this.pi.emit("eventCaptured",u);var b={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.ki(b):this.Si.enqueue(b),u}Si.critical("This capture call is ignored due to client rate limiting.")}}else Si.error("No event name provided to posthog.capture")}else Si.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!A(a.distinct_id)&&!N(a.distinct_id)||D(a.distinct_id))&&Si.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=wr(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Fi(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Fi(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Pi)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Vs.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Fi(a,u),"$pageview"===t&&o&&(a.title=o.title),!M(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Fi({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?Ci(this.config.property_denylist,(function(t){delete a[t]})):Si.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Si.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.Ni();return a.$process_person_profile=m,m&&!s&&this.zi("_calculate_event_properties"),a}ji(t,i){var e;if(void 0===i&&(i=!0),!this.persistence||!this.Ni())return t;if(this.fi)return t;var r=this.persistence.get_initial_props(),s=null==(e=this.sessionPropsManager)?void 0:e.getSetOnceProps(),n=Fi({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Si.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),i&&(this.fi=!0),O(n)?void 0:n}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Ui(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var e;return null==(e=this.featureFlags)?void 0:e.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.pi.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:"Surveys module not available"}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:"Surveys module not available"})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:"Surveys module not available"})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=tn),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:"Surveys module not available"}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:"Surveys module not available"})}identify(t,i,e){if(!this.__loaded||!this.persistence)return Si.uninitializedWarning("posthog.identify");if(N(t)&&(t=t.toString(),Si.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Si.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==$e){if(this.zi("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Wi)&&(this.unregister(Wi),this.register({distinct_id:t}));var n,o="anonymous"===(this.persistence.get_property(pe)||"anonymous");if(t!==r&&o)this.persistence.set_property(pe,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.yi=Hs(t,i,e),null==(n=this.featureFlags)||n.setAnonymousDistinctId(r);else(i||e)&&this.setPersonProperties(i,e);t!==r&&(this.reloadFeatureFlags(),this.unregister(de))}}else Si.critical('The string "'+$e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Si.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.zi("posthog.setPersonProperties")){var e=Hs(this.get_distinct_id(),t,i);this.yi!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.yi=e):Si.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}else Si.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.zi("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s,n,o,a;if(Si.info("reset"),!this.__loaded)return Si.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Mi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.persistence)||o.set_property(pe,"anonymous"),null==(a=this.sessionManager)||a.resetSessionId(),this.yi=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:$e,$device_id:null},"");else{var u=this.config.get_device_id(Ce());this.register_once({distinct_id:u,$device_id:t?u:l},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),this.reloadFeatureFlags()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(qi)?(Si.critical("Attempting to create alias for existing People user - aborting."),-2):this.zi("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this.Ui(Wi,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Si.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(F(t)){var e,r,s,n,o,a,l,u,h;Fi(this.config,dn(t));var d=this.Ei();null==(e=this.persistence)||e.update_config(this.config,i,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new $r(g({},this.config,{persistence:"sessionStorage"}),d);var v=this.wi(this.config.debug);U(v)&&(this.config.debug=v),U(this.config.debug)&&(this.config.debug?(f.DEBUG=!0,Le.O()&&Le.j("ph_debug",!0),Si.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(f.DEBUG=!1,Le.O()&&Le.L("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.Hi(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){f.LIB_NAME=t,f.LIB_VERSION=i}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.overrideTrigger("event")}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:ln;return i!==ln&&(i=ln+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(pe))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(pe))}Ni(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&O(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Wi])&&(null==(i=this.persistence)||null==(i=i.props)||!i[we]))}Ai(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Ni()||this.zi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.zi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}zi(t){return"never"===this.config.person_profiles?(Si.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ui(we,!0),!0)}Ei(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}Hi(){var t,i,e,r,s=this.Ei();(null==(t=this.persistence)?void 0:t.st)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.st)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()){var e,r,s,n,o;this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ns(this),this.pageViewManager=new ir(this),this.persistence&&(this.sessionPropsManager=new Ds(this,this.sessionManager,this.persistence));var a=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=cn.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this.vi(this.sessionRecording,new a(this)))}var l,u;if(this.consent.optInOut(!0),this.Hi(),this.Fi(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode)null==(l=this.surveys)||l.loadIfEnabled();if(M(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Oi()}else Si.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i,e;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Hi(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:$e,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,this.Oi())):Si.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===qe.GRANTED?"granted":t===qe.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Hi()}_is_bot(){return n?zs(n,this.config.custom_blocked_useragents):void 0}Oi(){o&&("visible"===o.visibilityState?this.gi||(this.gi=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.mi&&(o.removeEventListener("visibilitychange",this.mi),this.mi=null)):this.mi||(this.mi=this.Oi.bind(this),Hi(o,"visibilitychange",this.mi)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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)`."),this.set_config({debug:!0}))}bt(){var t,i,e,r,s,n,o,a=this.xi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Si.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(e="advanced_disable_decide",r=!1,s=Si,n=(i="advanced_disable_flags")in(t=a)&&!L(t[i]),o=e in t&&!L(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Li(t){if(L(this.config.before_send))return t;var i=R(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),L(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return B(t.event)?Si.warn(s+". This can cause unexpected behavior."):Si.info(s),null}e.properties&&!O(e.properties)||Si.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.Y)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}wi(t){var i=U(t)&&!t,e=Le.O()&&"true"===Le.A("ph_debug");return!i&&(!!e||t)}}cn.__defaultExtensionClasses={},function(t,i){for(var e=0;ee.match(t))))}function wn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return bn(i)}function xn(t){return L(t)?null:E(t).split(/(\s+)/).filter((t=>Bn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $n(t){var i="";return An(t)&&!Dn(t)&&t.childNodes&&t.childNodes.length&&Ci(t.childNodes,(function(t){var e;gn(t)&&t.textContent&&(i+=null!==(e=xn(t.textContent))&&void 0!==e?e:"")})),E(i)}function En(t){return M(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Sn=["a","button","form","input","select","textarea","label"];function kn(t,i){if(M(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Pn(t){var i=t.parentNode;return!(!i||!pn(i))&&i}var Tn=["next","previous","prev",">","<"],In=10;var Rn=[".ph-no-rageclick",".ph-no-capture"];function Cn(i,e){if(!t||Fn(i))return!1;var r,s,n;U(e)?(r=!!e&&Rn,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Rn,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=On(i,!1);return!function(t,i){if(!1===t||M(t))return!1;var e;if(!0===t)e=Tn;else{if(!R(t))return!1;if(t.length>In)return Si.error("[PostHog] content_ignorelist array cannot exceed "+In+" items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:$n(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!kn(o,r)}var Fn=t=>!t||_n(t,"html")||!pn(t),On=(i,e)=>{if(!t||Fn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!_n(n,"body");)if(mn(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Pn(n);if(!o)break;if(e||Sn.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Mn(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||Fn(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!yn(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&yn(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=On(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(M(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!kn(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Sn.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function An(t){for(var i=t;i.parentNode&&!_n(i,"body");i=i.parentNode){var e=wn(i);if(x(e,"ph-sensitive")||x(e,"ph-no-capture"))return!1}if(x(wn(t),"ph-include"))return!0;var r=t.type||"";if(A(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";if(A(s)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Dn(t){return!!(_n(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||_n(t,"select")||_n(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var jn="(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})",Ln=new RegExp("^(?:"+jn+")$"),Nn=new RegExp(jn),zn="\\d{3}-?\\d{2}-?\\d{4}",Un=new RegExp("^("+zn+")$"),Hn=new RegExp("("+zn+")");function Bn(t,i){if(void 0===i&&(i=!0),L(t))return!1;if(A(t)){if(t=E(t),(i?Ln:Nn).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Un:Hn).test(t))return!1}return!0}function qn(t){var i=$n(t);return Bn(i=(i+" "+Wn(t)).trim())?i:""}function Wn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ci(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=$n(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Wn(t)).trim())}catch(t){Si.error("[AutoCapture]",t)}})),i}function Vn(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Mi(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[Gn(i.toString())]=Gn(e.toString())})),r+=":",r+=Mi(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Jn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Mi(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function Gn(t){return t.replace(/"|\\"/g,'\\"')}function Jn(t){var i=t.attr__class;return i?R(i)?i:bn(i):void 0}class Kn{constructor(t){this.disabled=!1===t;var i=F(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)t?i.slice(0,t)+"...":i}function Zn(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!pn(i));return i}function to(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Sn.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=Qn(1024,qn(t)):n.$el_text=Qn(1024,$n(t)));var o=wn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Ci(t.attributes,(function(e){var s;if((!Dn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Bn(e.value)&&(s=e.name,!A(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=bn(o).join(" ")),n["attr__"+e.name]=Qn(1024,o)}}));for(var a=1,l=1,u=t;u=Zn(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function io(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!_n(d,"body");)mn(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,_=!1;if(Ci(h,(t=>{var i=An(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Bn(p)&&p),x(wn(t),"ph-no-capture")&&(_=!0),c.push(to(t,o,a,l));var e=function(t){if(!An(t))return{};var i={};return Ci(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Bn(r)&&(i[e]=r)}})),i}(t);Fi(f,e)})),_)return{props:{},explicitNoCapture:_};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=qn(i):c[0].$el_text=$n(i)),p){var g,m;c[0].attr__href=p;var b=null==(g=er(p))?void 0:g.host,y=null==t||null==(m=t.location)?void 0:m.host;b&&y&&b!==y&&(v=p)}return{props:Fi({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:Vn(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}var eo=ki("[ExceptionAutocapture]");function ro(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return C(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}var so=ki("[TracingHeaders]");var no=ki("[Web Vitals]"),oo=9e5;var ao="disabled",lo="lazy_loading",uo="awaiting_config",ho="missing_config";ki("[SessionRecording]");var vo="[SessionRecording]",co=ki(vo);var fo=ki("[Heatmaps]");function po(t){return F(t)&&"clientX"in t&&"clientY"in t&&N(t.clientX)&&N(t.clientY)}var _o=ki("[Product Tours]"),go="ph_product_tours";var mo=["$set_once","$set"],bo=ki("[SiteApps]");function yo(t,i,e){if(L(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class wo{constructor(t){this.Bi=new js,this.qi=(t,i)=>this.Wi(t,i)&&this.Vi(t,i)&&this.Gi(t,i)&&this.Ji(t,i),this.Wi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Ki=new Set,this.Yi=new Set}init(){var t;if(!M(null==(t=this._instance)?void 0:t._addCaptureHook)){var i;null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!M(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i,e;null==(i=this.Yi)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Ki)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.Ki.has(t)||this.Ki.has(null==i?void 0:i.event))&&this.Yi&&(null==(e=this.Yi)?void 0:e.size)>0&&this.Yi.forEach((t=>{this.Xi(i,t)&&this.Bi.emit("actionCaptured",t.name)}))}Qi(t){this.onAction("actionCaptured",(i=>t(i)))}Xi(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.qi(t,e))return!0;return!1}onAction(t,i){return this.Bi.on(t,i)}Vi(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!yo(r,i.url,i.url_matching||"contains"))return!1}return!0}Gi(t,i){return!!this.Zi(t,i)&&(!!this.te(t,i)&&!!this.ie(t,i))}Zi(t,i){var e;if(null==i||!i.href)return!0;var r=this.ee(t);if(r.length>0)return r.some((t=>yo(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&yo((s=n.match(/(?::|")href="proxy.php?url=(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}te(t,i){var e;if(null==i||!i.text)return!0;var r=this.ee(t);if(r.length>0)return r.some((t=>yo(t.text,i.text,i.text_matching||"exact")||yo(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!L(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>yo(t,n,o))))}ie(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}ee(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ji(t,i){return null==i||!i.properties||0===i.properties.length||Ws(i.properties.reduce(((t,i)=>{var e=R(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class xo{constructor(t){this._instance=t,this.re=new Map,this.se=new Map,this.ne=new Map}oe(t,i){return!!t&&Ws(t.propertyFilters,null==i?void 0:i.properties)}ae(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}le(t,i,e){var r=(e===Er?this.re:this.se).get(t),s=[];return this.ue((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.oe(n,i)}))}register(t){var i;M(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.he(t),this.de(t))}de(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.ve){this.ve=new wo(this._instance),this.ve.init();this.ve.Qi((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.ve)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.ne.get(i.name);e&&e.push(t.id),this.ne.set(i.name,e||[t.id])}})))}))}}he(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.onEvent(t,i)})),this.re=this.ae(t,Er),this.se=this.ae(t,Sr)}}onEvent(t,i){var e,r=this.ce(),s=this.fe(),n=this.pe(),o=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[s])||[];if(n===t&&i&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:i,existingActivatedItems:o});var u=(null==i||null==(a=i.properties)?void 0:a.$survey_id)||(null==i||null==(l=i.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);h>=0&&(o.splice(h,1),this._e(o))}}else{if(this.se.has(t)){var d=this.le(t,i,Sr);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var i=o.indexOf(t.id);i>=0&&o.splice(i,1),this.ge(t.id)})),this._e(o))}if(this.re.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.re.get(t)});var v=this.le(t,i,Er);this._e(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.fe(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.ne.has(t)&&this._e(r.concat(this.ne.get(t)||[]))}_e(t){var i,e=this.ce(),r=this.fe(),s=[...new Set(t)].filter((t=>!this.me(t)));e.info("updating activated items",{activatedItems:s}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[r]:s})}getActivatedIds(){var t,i=this.fe(),e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e||[]}getEventToItemsMap(){return this.re}be(){return this.ve}}class $o extends xo{constructor(t){super(t)}fe(){return"$surveys_activated"}pe(){return Ir}ue(t){var i;null==(i=this._instance)||i.getSurveys(t)}ge(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}ce(){return Ks}me(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Eo=null!=t&&t.location?or(t.location.hash,"__posthog")||or(location.hash,"state"):null,So="_postHogToolbarParams",ko=ki("[Toolbar]"),Po=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Po||{});var To=ki("[FeatureFlags]"),Io=ki("[FeatureFlags]",{debugEnabled:!0}),Ro="errors_while_computing_flags",Co="flag_missing",Fo="quota_limited",Oo="timeout",Mo="connection_error",Ao="unknown_error",Do=t=>"api_error_"+t,jo="$active_feature_flags",Lo="$override_feature_flags",No="$feature_flag_payloads",zo="$override_feature_flag_payloads",Uo="$feature_flag_request_id",Ho=t=>{var i={};for(var[e,r]of Mi(t||{}))r&&(i[e]=r);return i},Bo=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):To.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},qo=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});var Wo=ki("[Error tracking]");var Vo={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&Us(e.href,i),not_regex:(i,e)=>!!t&&!Us(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Go{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Go.ye("retrieved web experiments from the server"),i.we=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.we)Go.ye("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.we)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);A(r)&&t.variants[r]&&i.xe(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Go.$e(n)&&i.xe(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Go.ye("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(L(this.we))return this.we=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Go.ye("applying feature flags",t),t.forEach((t=>{var i;if(this.we&&null!=(i=this.we)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.we)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.xe(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Go.getWindowLocation();if(null!=t&&t.search){var i=sr(null==t?void 0:t.search,"__experiment_id"),e=sr(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Go.ye("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Ee(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}Ee(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Go.ye("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.xe(r[0].name,i,r[0].variants[i].transforms))}static $e(t){return!L(t.conditions)&&(Go.Se(t)&&Go.ke(t))}static Se(t){var i;if(L(t.conditions)||L(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Go.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||Vo[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static ke(t){var i;if(L(t.conditions)||L(null==(i=t.conditions)?void 0:i.utm))return!0;var e=vr();if(e.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static ye(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r{if(e.selector){var r;Go.ye("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Go.ye("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?zs(n,this._instance.config.custom_blocked_useragents):void 0}}var Jo=ki("[Conversations]");var Ko,Yo,Xo={featureFlags:class{constructor(t){this.Pe=!1,this.Te=!1,this.Ie=!1,this.Re=!1,this.Ce=!1,this.Fe=!1,this.Oe=!1,this.Me=!1,this._instance=t,this.featureFlagEventHandlers=[]}Ae(){var t,i;return null!==(t=null==(i=this._instance.persistence)?void 0:i.nt(this._instance.config.feature_flag_cache_ttl_ms))&&void 0!==t&&t}De(){return!!this.Ae()&&(this.Me||this.Ie||(this.Me=!0,To.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}je(){var t,i=null!==(t=this._instance.config.evaluation_contexts)&&void 0!==t?t:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.Oe||(To.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Oe=!0),null!=i&&i.length?i.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||To.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Le(){return this.je().length>0}initialize(){var t,i,{config:e}=this._instance,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(o[i]&&(t[i]=o[i]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r=null!=e&&e.merge?this.getFlagVariants():{},s=null!=e&&e.merge?this.getFlagPayloads():{},n=g({},r,t),o=g({},s,i),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:M(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Te}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(ae),i=this._instance.get_property(Lo),e=this._instance.get_property(zo);if(!e&&!i)return t||{};var r=Fi({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=M(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});if(h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.Pe||(To.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.Pe=!0),r}getFlagVariants(){var t=this._instance.get_property(ne),i=this._instance.get_property(Lo);if(!i)return t||{};for(var e=Fi({},t),r=Object.keys(i),s=0;s{this.ze()}),5))}Ue(){clearTimeout(this.Ne),this.Ne=void 0}ensureFlagsLoaded(){this.Te||this.Ie||this.Ne||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Re=t}ze(t){var i;if(this.Ue(),!this._instance.bt())if(this.Ie)this.Ce=!0;else{var e=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(le)||{}),group_properties:this._instance.get_property(ue),timezone:br()};j(r)||M(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Le()&&(s.evaluation_contexts=this.je());var n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+n);this.Ie=!0,this._instance._send_request({method:"POST",url:o,data:s,compression:this._instance.config.disable_compression?void 0:Br.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,e,r,n=!0;if(200===t.statusCode&&(this.Ce||(this.$anon_distinct_id=void 0),n=!1),this.Ie=!1,!s.disable_flags||this.Ce){this.Fe=!n;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?Oo:Mo):o.push(Ao):200!==t.statusCode&&o.push(Do(t.statusCode)),null!=(i=t.json)&&i.errorsWhileComputingFlags&&o.push(Ro);var a=!(null==(e=t.json)||null==(e=e.quotaLimited)||!e.includes(qo.FeatureFlags));if(a&&o.push(Fo),null==(r=this._instance.persistence)||r.register({[ce]:o}),a)To.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var l;if(!s.disable_flags)this.receivedFeatureFlags(null!==(l=t.json)&&void 0!==l?l:{},n);this.Ce&&(this.Ce=!1,this.ze())}}}})}}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.Fe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else To.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.Fe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var e=this.getFlagVariants(),r=t in e,s=e[t],n=this.getFlagPayloads()[t],o=String(s),a=this._instance.get_property(Uo)||void 0,l=this._instance.get_property(fe)||void 0,u=this._instance.get_property(de)||{};if(this._instance.config.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this._instance.get_property(ve);if(d&&d!==v)u={},null==(h=this._instance.persistence)||h.register({[de]:u,[ve]:d})}if((i.send_event||!("send_event"in i))&&(!(t in u)||!u[t].includes(o))){var c,f,p,_,g,m,b,y,w,x;R(u[t])?u[t].push(o):u[t]=[o],null==(c=this._instance.persistence)||c.register({[de]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(f=this._instance.get_property(ce))&&void 0!==f?f:[]];M(s)&&S.push(Co);var k={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this._instance.config.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this._instance.config.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.Fe};M(null==E||null==(g=E.metadata)?void 0:g.version)||(k.$feature_flag_version=E.metadata.version);var P,T=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;if(T&&(k.$feature_flag_reason=T),null!=E&&null!=(w=E.metadata)&&w.id&&(k.$feature_flag_id=E.metadata.id),M(null==E?void 0:E.original_variant)&&M(null==E?void 0:E.original_enabled)||(k.$feature_flag_original_response=M(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload)k.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload;S.length&&(k.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var I=n;if(!M(n))try{I=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:I}}}}else To.warn('getFeatureFlagResult for key "'+t+"\" failed. Feature flags didn't load in time.")}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Le()&&(r.evaluation_contexts=this.je()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._instance.config.disable_compression?void 0:Br.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),!i.fresh||this.Fe){if(this.Te||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return M(e)?void 0:!!e}To.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.Te=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=Bo(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(R(a)){To.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;v{var i;return!(null!=(i=o[t])&&i.failed)})));c=g({},e,Object.fromEntries(Object.entries(c).filter((t=>{var[i]=t;return _.has(i)})))),f=g({},r,Object.fromEntries(Object.entries(f||{}).filter((t=>{var[i]=t;return _.has(i)})))),p=g({},s,Object.fromEntries(Object.entries(p||{}).filter((t=>{var[i]=t;return _.has(i)}))))}else c=g({},e,c),f=g({},r,f),p=g({},s,p);i&&i.register(g({[jo]:Object.keys(Ho(c)),[ne]:c||{},[No]:f||{},[ae]:p||{}},u?{[Uo]:u}:{},h?{[fe]:h}:{}))}}}(t,this._instance.persistence,e,r,s),i||(this.Me=!1),this.He(i)}}override(t,i){void 0===i&&(i=!1),To.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return To.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(Lo),this._instance.persistence.unregister(zo),this.He(),Io.info("All overrides cleared");if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.Pe=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(Lo),Io.info("Flag overrides cleared");else if(e.flags){if(R(e.flags)){for(var r={},s=0;sthis.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(oe)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[jo]:Object.keys(Ho(a)),[ne]:a}),this.He()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(oe),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(oe),null==(r=this._instance.persistence)||r.register({[oe]:s}),t(s)}}})}Be(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}He(t){var{flags:i,flagVariants:e}=this.Be();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(le)||{};this._instance.register({[le]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(le)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ue)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[ue]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(ue)||{};this._instance.register({[ue]:g({},i,{[t]:{}})})}else this._instance.unregister(ue)}reset(){this.Te=!1,this.Ie=!1,this.Re=!1,this.Ce=!1,this.Fe=!1,this.$anon_distinct_id=void 0,this.Ue(),this.Pe=!1}}},Qo={sessionRecording:class{get started(){var t;return!(null==(t=this.qe)||!t.isStarted)}get status(){var t,i;return this.We===uo||this.We===ho?this.We:null!==(t=null==(i=this.qe)?void 0:i.status)&&void 0!==t?t:this.We}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.We=ao,this.Ve=void 0,this._instance=t,!this._instance.sessionManager)throw co.error("started without valid sessionManager"),new Error(vo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(vo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ge(){var i,e=!(null==(i=this._instance.get_property(ee))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.Ge||null==(i=this.qe)||!i.isStarted){var e=!M(Object.assign)&&!M(Array.from);this.Ge&&e?(this.Je(t),co.info("starting")):(this.We=ao,this.stopRecording())}}Je(t){var i,e,r;this.Ge&&(this.We!==uo&&this.We!==ho&&(this.We=lo),null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Ke(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ye,(i=>{if(i)return co.error("could not load recorder",i);this.Ke(t)})))}stopRecording(){var t,i;null==(t=this.Ve)||t.call(this),this.Ve=void 0,null==(i=this.qe)||i.stop()}Xe(){var t,i;null==(t=this.Ve)||t.call(this),this.Ve=void 0,null==(i=this.qe)||i.discard()}Qe(){var t;null==(t=this._instance.persistence)||t.unregister(se)}Ze(t,i){if(L(t))return null;var e,r=N(t)?t:parseFloat(t);return"number"==typeof(e=r)&&Number.isFinite(e)&&e>=0&&e<=1?r:(co.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null)}tr(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ze(null==(i=this._instance.config.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.Ze(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;L(o)&&this.Qe();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ee]:g({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:M(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers})})};s(),null==(i=this.Ve)||i.call(this),this.Ve=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.tr(t),void this.Xe()):(this.tr(t),void this.startIfEnabledOrStop()):(this.We===uo&&(this.We=ho,co.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.qe)&&e.log?this.qe.log(t,i):co.warn("log called before recorder was ready")}get Ye(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ee);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}ir(){var t,i=this._instance.get_property(ee);if(!i)return!1;var e=null!==(t=("object"==typeof i?i:JSON.parse(i)).cache_timestamp)&&void 0!==t?t:Date.now();return Date.now()-e<=36e5}Ke(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.qe||(this.qe=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);if(!this.ir()){if(this.We===ho||this.We===uo)return;return this.We=uo,co.info("persisted remote config is stale, requesting fresh config before starting"),void new Hr(this._instance).load()}this.We=lo,this.qe.start(t)}onRRwebEmit(t){var i;null==(i=this.qe)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.qe||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.qe)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.qe||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.qe)||t.overrideSampling()}overrideTrigger(t){var i,e;this.qe||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.qe)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qe)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.qe)||!e.tryAddCustomEvent(t,i))}}},Zo={autocapture:class{constructor(t){this.er=!1,this.rr=null,this.sr=!1,this.instance=t,this.rageclicks=new Kn(t.config.rageclick),this.nr=null}initialize(){this.startIfEnabled()}get N(){var t,i,e=F(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}ar(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.lr(i)}catch(t){Xn.error("Failed to capture event",t)}};if(Hi(o,"submit",i,{capture:!0}),Hi(o,"change",i,{capture:!0}),Hi(o,"click",i,{capture:!0}),this.N.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.lr(i,Yn)};Hi(o,"copy",e,{capture:!0}),Hi(o,"cut",e,{capture:!0})}}}else Xn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.er&&(this.ar(),this.er=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.sr=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Gi]:!!t.autocapture_opt_out}),this.rr=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.nr=t}getElementSelectors(t){var i,e=[];return null==(i=this.nr)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Gi],r=this.rr;if(j(r)&&!U(e)&&!this.instance.bt())return!1;var s=null!==(i=this.rr)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}lr(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=En(i);if(gn(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&Cn(s,this.instance.config.rageclick)&&this.lr(i,"$rageclick");var n=e===Yn;if(s&&Mn(s,i,this.N,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=io(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.sr});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===Yn){var u,h=xn(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return C(null==o?void 0:o.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ur=(null==t||null==(e=t.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Si.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.hr&&this.hr(),this.hr=void 0,Si.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||ro(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.dr("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||ro(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.dr("replaceState")})),this.vr()}}dr(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.ur&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.ur=r}catch(t){Si.error("Error capturing "+i+" pageview",t)}}vr(){if(!this.hr){var i=()=>{this.dr("popstate")};Hi(t,"popstate",i),this.hr=()=>{t&&t.removeEventListener("popstate",i)}}}},heatmaps:class{constructor(t){var i;this.cr=!1,this.er=!1,this.pr=null,this.instance=t,this.cr=!(null==(i=this.instance.persistence)||!i.props[Ji]),this.rageclicks=new Kn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return F(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return L(this.instance.config.capture_heatmaps)?L(this.instance.config.enable_heatmaps)?this.cr:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.er)return;fo.info("starting..."),this._r(),this.gr()}else{var t;clearInterval(null!==(t=this.pr)&&void 0!==t?t:void 0),this.mr(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ji]:i}),this.cr=i,this.startIfEnabled()}}getAndClearBuffer(){var t=this.C;return this.C=void 0,t}br(t){this.yr(t.originalEvent,"deadclick")}gr(){this.pr&&clearInterval(this.pr),this.pr=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Ot.bind(this),this.flushIntervalMilliseconds):null}_r(){t&&o&&(this.wr=this.Ot.bind(this),Hi(t,"beforeunload",this.wr),this.$r=i=>this.yr(i||(null==t?void 0:t.event)),Hi(o,"click",this.$r,{capture:!0}),this.Er=i=>this.Sr(i||(null==t?void 0:t.event)),Hi(o,"mousemove",this.Er,{capture:!0}),this.kr=new Ke(this.instance,Ge,this.br.bind(this)),this.kr.startIfEnabledOrStop(),this.Pr=this.gr.bind(this),Hi(o,"visibilitychange",this.Pr),this.er=!0)}mr(){var i;t&&o&&(this.wr&&t.removeEventListener("beforeunload",this.wr),this.$r&&o.removeEventListener("click",this.$r,{capture:!0}),this.Er&&o.removeEventListener("mousemove",this.Er,{capture:!0}),this.Pr&&o.removeEventListener("visibilitychange",this.Pr),clearTimeout(this.Tr),null==(i=this.kr)||i.stop(),this.er=!1)}Ir(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&pn(s)&&!_n(s,"body");){if(s===r)return!1;if(x(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Pn(s)}return!1}(En(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}yr(t,i){var e;if(void 0===i&&(i="click"),!fn(t.target)&&po(t)){var r=this.Ir(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Rr(g({},r,{type:"rageclick"})),this.Rr(r)}}Sr(t){!fn(t.target)&&po(t)&&(clearTimeout(this.Tr),this.Tr=setTimeout((()=>{this.Rr(this.Ir(t,"mousemove"))}),500))}Rr(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?Oi([],lr,s||[]):[],o=nr(e,n,hr);this.C=this.C||{},this.C[o]||(this.C[o]=[]),this.C[o].push(i)}}Ot(){this.C&&!O(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ke,webVitalsAutocapture:class{constructor(t){var i;this.cr=!1,this.er=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Cr=()=>{clearTimeout(this.Fr),0!==this.C.metrics.length&&(this._instance.capture("$web_vitals",this.C.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Or=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(M(e))no.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Mr();if(!M(r))if(L(null==t?void 0:t.name)||L(null==t?void 0:t.value))no.error("Invalid metric received",t);else if(this.Ar&&t.value>=this.Ar)no.error("Ignoring metric with value >= "+this.Ar,t);else this.C.url!==r&&(this.Cr(),this.Fr=setTimeout(this.Cr,this.flushToCaptureTimeoutMs)),M(this.C.url)&&(this.C.url=r),this.C.firstMetricTimestamp=M(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.C.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Cr()}},this.Dr=()=>{if(!this.er){var t,i,e,r,s=v.__PosthogExtensions__;M(s)||M(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Or.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Or.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Or.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Or.bind(this)),this.er=!0):no.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.cr=!(null==(i=this._instance.persistence)||!i.props[Qi]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=F(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return L(e)?(null==(i=this._instance.persistence)?void 0:i.props[ie])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(F(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=F(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return null!=t&&t}get Ar(){var t=F(this._instance.config.capture_performance)&&N(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:oo;return 0{i?no.error("failed to load script",i):t()}))}}Mr(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?Oi([],lr,r||[]):[];return nr(i,s,hr)}no.error("Could not determine current URL")}}},ta={exceptionObserver:class{constructor(i){var e,r,s;this.Dr=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jr&&this.N.capture_unhandled_errors&&(this.jr=e(this.captureException.bind(this))),!this.Lr&&this.N.capture_unhandled_rejections&&(this.Lr=r(this.captureException.bind(this))),!this.Nr&&this.N.capture_console_errors&&(this.Nr=s(this.captureException.bind(this)))}catch(t){eo.error("failed to start",t),this.zr()}}},this._instance=i,this.Ur=!(null==(e=this._instance.persistence)||!e.props[Ki]),this.Hr=new X({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,h:eo}),this.N=this.Br(),this.startIfEnabledOrStop()}Br(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return F(t)?i=g({},i,t):(M(t)?this.Ur:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(eo.info("enabled"),this.zr(),this.G(this.Dr)):this.zr()}G(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return eo.error("failed to load script",i);t()}))}zr(){var t,i,e;null==(t=this.jr)||t.call(this),this.jr=void 0,null==(i=this.Lr)||i.call(this),this.Lr=void 0,null==(e=this.Nr)||e.call(this),this.Nr=void 0}onRemoteConfig(t){if("autocaptureExceptions"in t){var i=t.autocaptureExceptions;this.Ur=!!i||!1,this._instance.persistence&&this._instance.persistence.register({[Ki]:this.Ur}),this.N=this.Br(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.Br()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.Hr.consumeRateLimit(s)?eo.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this.qr=[],this.Wr=new Zt([new ci,new $i,new pi,new fi,new wi,new yi,new gi,new xi],vi()),this._instance=t,this.qr=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Yi))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r;if("errorTracking"in t){var s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.qr=s,this._instance.persistence&&this._instance.persistence.register({[Yi]:this.qr,[Xi]:n})}}get Vr(){var t,i=!!this._instance.get_property(Xi),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Wr.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.Gr(i)){if(this.Jr(i))return void Wo.info("Skipping exception capture because a suppression rule matched");if(!this.Vr&&this.Kr(i))return void Wo.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yr(i))return void Wo.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Di:!0})}Jr(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return A(e)&&e.length>0&&t.$exception_types.push(e),A(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.qr.some((t=>{var e=t.values.map((t=>{var e,r=Bs[t.operator],s=R(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}Kr(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Yr(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Gr(t){return!L(t)&&R(t)}}},ia=g({productTours:class{constructor(t){this.Xr=null,this.Qr=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this._instance.persistence&&this._instance.persistence.register({[te]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,i;this.Xr||((t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(te))||this.G((()=>this.Zr()))}G(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?_o.error("Could not load product tours script",i):t()}))}Zr(){var t;!this.Xr&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Xr=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!R(this.Qr)||i){var e=this._instance.persistence;if(e){var r=e.props[go];if(R(r)&&!i)return this.Qr=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return _o.error(s),void t([],{isLoaded:!1,error:s})}var n=R(i.json.product_tours)?i.json.product_tours:[];this.Qr=n,e&&e.register({[go]:n}),t(n,{isLoaded:!0})}})}else t(this.Qr,{isLoaded:!0})}getActiveProductTours(t){L(this.Xr)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Xr.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Xr)||i.showTourById(t)}previewTour(t){this.Xr?this.Xr.previewTour(t):this.G((()=>{var i;this.Zr(),null==(i=this.Xr)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Xr)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Xr)||t.nextStep()}previousStep(){var t;null==(t=this.Xr)||t.previousStep()}clearCache(){var t;this.Qr=null,null==(t=this._instance.persistence)||t.unregister(go)}resetTour(t){var i;null==(i=this.Xr)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Xr)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Xr)||i.cancelPendingTour(t)}}},Xo),ea={siteApps:class{constructor(t){this._instance=t,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(t,i){if(i){var e=this.globalsForEvent(i);this.ts.push(e),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.es.bind(this));this.rs=()=>{t(),this.ts=[],this.rs=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:g({},m(t,mo),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.ts.length&&(bo.info("Processing "+this.ts.length+" events for site app with id "+t.id),this.ts.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.rs)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,bo.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){bo.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){bo.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}ss(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}ns(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){bo.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",(t=>this.ns(t)))):void bo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.rs)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return bo.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else bo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ra={tracingHeaders:class{constructor(t){this.os=void 0,this.ls=void 0,this.Dr=()=>{var t,i;M(this.os)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));M(this.ls)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}G(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return so.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.G(this.Dr):(null==(t=this.os)||t.call(this),null==(i=this.ls)||i.call(this),this.os=void 0,this.ls=void 0)}}},sa=g({surveys:class{constructor(t){this.us=void 0,this._surveyManager=null,this.hs=!1,this.ds=[],this.vs=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(L(i))return Ks.warn("Flags not loaded yet. Not loading surveys.");var e=R(i);this.us=e?i.length>0:i,Ks.info("flags response received, isSurveysEnabled: "+this.us),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;ilocalStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.hs)Ks.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ks.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ks.info("Not loading surveys in cookieless mode without consent.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!M(this.us)||this._instance.config.advanced_enable_surveys){var i=this.us||this._instance.config.advanced_enable_surveys;this.hs=!0;try{var e=t.generateSurveys;if(e)return void this.cs(e,i);var r=t.loadExternalDependency;if(!r)return void this.fs("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.fs("Could not load surveys script",e):this.cs(t.generateSurveys,i)}))}catch(t){throw this.fs("Error initializing surveys",t),t}finally{this.hs=!1}}}else Ks.error("PostHog Extensions not found.")}}cs(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new $o(this._instance),Ks.info("Surveys loaded successfully"),this.ps({isLoaded:!0})}fs(t,i){Ks.error(t,i),this.ps({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.ds.push(t),this._surveyManager&&this.ps({isLoaded:!0}),()=>{this.ds=this.ds.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return Ks.info("Disabled. Not loading surveys."),t([]);var e,r=this._instance.get_property(he);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.vs?this.vs.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.vs=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var r;this.vs=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Ks.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==e||e({surveys:[],context:o}))}var a,l=i.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u));null==(r=this._instance.persistence)||r.register({[he]:l});var h={isLoaded:!0};t(l,h),null==e||e({surveys:l,context:h})}}))}ps(t){for(var i of this.ds)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Ks.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ks.warn("init was not called")}_s(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}gs(t){if(L(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this._s(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(L(this._surveyManager))return Ks.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.gs(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return L(this._surveyManager)?(Ks.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.gs(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(L(this._surveyManager))Ks.warn("init was not called");else{var s="string"==typeof t?this._s(t):t;if(null!=s&&s.id)if(Zs.includes(s.type)){var n=null==o?void 0:o.querySelector(i);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Ks.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Ks.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Ks.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,e);Ks.warn("Survey element not found")}else Ks.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ks.warn("Survey not found")}}displaySurvey(t,i){var e;if(L(this._surveyManager))Ks.warn("init was not called");else{var r=this._s(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Ar&&i.initialResponses&&Ks.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Ks.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Dr?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Ks.warn("Survey not found")}}cancelPendingSurvey(t){L(this._surveyManager)?Ks.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Xo),na={toolbar:class{constructor(t){this.instance=t}bs(t){v.ph_toolbar_state=t}ys(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:Po.UNINITIALIZED}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),Bi(this.instance.config))return!1;if(!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=Eo||or(i.hash,"__posthog")||or(i.hash,"state"),a=n?Ai((()=>JSON.parse(atob(decodeURIComponent(n)))))||Ai((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(So)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}ws(t){var i=v.ph_load_toolbar||v.ph_load_editor;!L(i)&&C(i)?i(t,this.instance):ko.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(xe));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(So,JSON.stringify(g({},s,{source:void 0}))),this.ys()===Po.LOADED)this.ws(s);else if(this.ys()===Po.UNINITIALIZED){var n;this.bs(Po.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ko.error("[Toolbar] Failed to load",t),void this.bs(Po.UNINITIALIZED);this.bs(Po.LOADED),this.ws(s)})),Hi(t,"turbolinks:load",(()=>{this.bs(Po.UNINITIALIZED),this.loadToolbar(s)}))}return!0}xs(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},oa=g({experiments:Go},Xo),aa={conversations:class{constructor(t){this.$s=void 0,this._conversationsManager=null,this.Es=!1,this.Ss=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;L(i)||(U(i)?this.$s=i:(this.$s=i.enabled,this.Ss=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.$s=void 0,this.Ss=null}loadIfEnabled(){if(!(this._conversationsManager||this.Es||this._instance.config.disable_conversations||Bi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!M(this.$s)&&this.$s)if(this.Ss&&this.Ss.token){this.Es=!0;try{var i=t.initConversations;if(i)return this.ks(i),void(this.Es=!1);var e=t.loadExternalDependency;if(!e)return void this.Ps("PostHog loadExternalDependency extension not found.");e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Ps("Could not load conversations script",i):this.ks(t.initConversations),this.Es=!1}))}catch(t){this.Ps("Error initializing conversations",t),this.Es=!1}}else Jo.error("Conversations enabled but missing token in remote config.")}}ks(t){if(this.Ss)try{this._conversationsManager=t(this.Ss,this._instance),Jo.info("Conversations loaded successfully")}catch(t){this.Ps("Error completing conversations initialization",t)}else Jo.error("Cannot complete initialization: remote config is null")}Ps(t,i){Jo.error(t,i),this._conversationsManager=null,this.Es=!1}show(){this._conversationsManager?this._conversationsManager.show():Jo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.$s&&!j(this._conversationsManager)}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return _((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Jo.warn("Conversations not available yet."),null)}))()}getMessages(t,i){var e=this;return _((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Jo.warn("Conversations not available yet."),null)}))()}markAsRead(t){var i=this;return _((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Jo.warn("Conversations not available yet."),null)}))()}getTickets(t){var i=this;return _((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Jo.warn("Conversations not available yet."),null)}))()}requestRestoreLink(t){var i=this;return _((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Jo.warn("Conversations not available yet."),null)}))()}restoreFromToken(t){var i=this;return _((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Jo.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var t=this;return _((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Jo.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}}},la={logs:class{constructor(t){var i;this.Ts=!1,this.Is=!1,this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Ts=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i,e=null==(i=t.logs)?void 0:i.captureConsoleLogs;!L(e)&&e&&(this.Ts=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ts&&!this.Is){var t=ki("[logs]"),i=null==v?void 0:v.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(e=>{var r;e||null==(r=i.logs)||!r.initializeLogs?t.error("Could not load logs script",e):(i.logs.initializeLogs(this._instance),this.Is=!0)})):t.error("PostHog loadExternalDependency extension not found.")}else t.error("PostHog Extensions not found.")}}}},ua=g({},Xo,Qo,Zo,ta,ia,ea,sa,ra,na,oa,aa,la);cn.__defaultExtensionClasses=g({},ua),Ko=nn[ln]=new cn,(Yo=v.posthog)&&Ci(Yo._i,(function(t){if(t&&R(t)){var i=Ko.init(t[0],t[1],t[2]),e=Yo[t[2]]||Yo;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),v.posthog=Ko,function(){function i(){i.done||(i.done=!0,un=!1,Ci(nn,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():Hi(o,"DOMContentLoaded",i,{capture:!1}):t&&Si.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}(); //# sourceMappingURL=array.js.map