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