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