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