posthog-js 1.372.1 → 1.372.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/conversations.js +1 -1
- package/dist/conversations.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/src/extensions/conversations/external/components/ConversationsWidget.d.ts +0 -2
- package/dist/src/extensions/conversations/external/components/MessagesView.d.ts +1 -2
- package/dist/src/extensions/conversations/external/components/styles.d.ts +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.d.ts +0 -2
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.js +3 -12
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/MessagesView.d.ts +1 -2
- package/lib/src/extensions/conversations/external/components/MessagesView.js +2 -2
- package/lib/src/extensions/conversations/external/components/MessagesView.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/OpenChatButton.js +0 -2
- package/lib/src/extensions/conversations/external/components/OpenChatButton.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/styles.d.ts +1 -1
- package/lib/src/extensions/conversations/external/components/styles.js +2 -2
- package/lib/src/extensions/conversations/external/components/styles.js.map +1 -1
- package/lib/src/extensions/conversations/external/index.js +3 -1
- package/lib/src/extensions/conversations/external/index.js.map +1 -1
- package/package.json +3 -3
package/dist/module.slim.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,u=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.372.1",c={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function _(t,e,i,r,s,n,o){try{var a=t[n](o),u=a.value}catch(t){return void i(t)}a.done?e(u):Promise.resolve(u).then(r,s)}function v(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){_(n,r,s,o,a,"next",t)}function a(t){_(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}function f(){return f=v((function*(t,e,i){void 0===e&&(e=!0);try{var r=new CompressionStream("gzip"),s=r.writable.getWriter(),n=s.write((new TextEncoder).encode(t)).then((()=>s.close())).catch(function(){var t=v((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,n]);return a}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),f.apply(this,arguments)}var g=["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"],m=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return g.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))},w=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function b(t,e){return-1!==t.indexOf(e)}var y=function(t){return t.replace(/^\$/,"")},x=Object.prototype,E=x.hasOwnProperty,S=x.toString,T=Array.isArray||function(t){return"[object Array]"===S.call(t)},R=t=>"function"==typeof t,P=t=>t===Object(t)&&!T(t),I=t=>{if(P(t)){for(var e in t)if(E.call(t,e))return!1;return!0}return!1},O=t=>void 0===t,k=t=>"[object String]"==S.call(t),M=t=>k(t)&&0===t.trim().length,U=t=>null===t,C=t=>O(t)||U(t),N=t=>"[object Number]"==S.call(t)&&t==t,A=t=>N(t)&&t>0,D=t=>"[object Boolean]"===S.call(t),L=t=>t instanceof FormData,F=t=>b(w,t),B=[!0,"true",1,"1","yes"],z=t=>b(B,t),j=[!1,"false",0,"0","no"];function q(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),N(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),q(s||i,e,i,r))}var H="Mobile",W="iOS",Y="Android",V="Tablet",G=Y+" "+V,J="iPad",K="Apple",X=K+" Watch",Q="Safari",Z="BlackBerry",tt="Samsung",et=tt+"Browser",it=tt+" Internet",rt="Chrome",st=rt+" OS",nt=rt+" "+W,ot="Internet Explorer",at=ot+" "+H,ut="Opera",lt=ut+" Mini",ht="Edge",dt="Microsoft "+ht,ct="Firefox",_t=ct+" "+W,vt="Nintendo",pt="PlayStation",ft="Xbox",gt=Y+" "+H,mt=H+" "+Q,wt="Windows",bt=wt+" Phone",yt="Nokia",xt="Ouya",$t="Generic",Et=$t+" "+H.toLowerCase(),St=$t+" "+V.toLowerCase(),Tt="Konqueror",Rt="(\\d+(\\.\\d+)?)",Pt=new RegExp("Version/"+Rt),It=new RegExp(ft,"i"),Ot=new RegExp(pt+" \\w+","i"),kt=new RegExp(vt+" \\w+","i"),Mt=new RegExp(Z+"|PlayBook|BB10","i"),Ut={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Ct=function(t,e){return e=e||"",b(t," OPR/")&&b(t,"Mini")?lt:b(t," OPR/")?ut:Mt.test(t)?Z:b(t,"IE"+H)||b(t,"WPDesktop")?at:b(t,et)?it:b(t,ht)||b(t,"Edg/")?dt:b(t,"FBIOS")?"Facebook "+H:b(t,"UCWEB")||b(t,"UCBrowser")?"UC Browser":b(t,"CriOS")?nt:b(t,"CrMo")||b(t,rt)?rt:b(t,Y)&&b(t,Q)?gt:b(t,"FxiOS")?_t:b(t.toLowerCase(),Tt.toLowerCase())?Tt:((t,e)=>e&&b(e,K)||function(t){return b(t,Q)&&!b(t,rt)&&!b(t,Y)}(t))(t,e)?b(t,H)?mt:Q:b(t,ct)?ct:b(t,"MSIE")||b(t,"Trident/")?ot:b(t,"Gecko")?ct:""},Nt={[at]:[new RegExp("rv:"+Rt)],[dt]:[new RegExp(ht+"?\\/"+Rt)],[rt]:[new RegExp("("+rt+"|CrMo)\\/"+Rt)],[nt]:[new RegExp("CriOS\\/"+Rt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rt)],[Q]:[Pt],[mt]:[Pt],[ut]:[new RegExp("(Opera|OPR)\\/"+Rt)],[ct]:[new RegExp(ct+"\\/"+Rt)],[_t]:[new RegExp("FxiOS\\/"+Rt)],[Tt]:[new RegExp("Konqueror[:/]?"+Rt,"i")],[Z]:[new RegExp(Z+" "+Rt),Pt],[gt]:[new RegExp("android\\s"+Rt,"i")],[it]:[new RegExp(et+"\\/"+Rt)],[ot]:[new RegExp("(rv:|MSIE )"+Rt)],Mozilla:[new RegExp("rv:"+Rt)]},At=function(t,e){var i=Ct(t,e),r=Nt[i];if(O(r))return null;for(var s=0;r.length>s;s++){var n=t.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Dt=[[new RegExp(ft+"; "+ft+" (.*?)[);]","i"),t=>[ft,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(pt,"i"),[pt,""]],[Mt,[Z,""]],[new RegExp(wt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[bt,""];if(new RegExp(H).test(e)&&!/IEMobile\b/.test(e))return[wt+" "+H,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ut[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[wt,r]}return[wt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[W,[t[3],t[4],t[5]||"0"].join(".")]:[W,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=O(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Y+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Y+")","i"),t=>t&&t[2]?[Y,[t[2],t[3],t[4]||"0"].join(".")]:[Y,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[st,""]],[/Linux|debian/i,["Linux",""]]],Lt=function(t){return kt.test(t)?vt:Ot.test(t)?pt:It.test(t)?ft:new RegExp(xt,"i").test(t)?xt:new RegExp("("+bt+"|WPDesktop)","i").test(t)?bt:/iPad/.test(t)?J:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?X:Mt.test(t)?Z:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(yt,"i").test(t)?yt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(H).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Y:G:new RegExp("(pda|"+H+")","i").test(t)?Et:new RegExp(V,"i").test(t)&&!new RegExp(V+" pc","i").test(t)?St:""},Ft=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={C(i){if(t&&(c.DEBUG||h.POSTHOG_DEBUG||r)&&!O(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Ft(e+" "+t,i)};return s},Bt=Ft("[PostHog.js]"),zt=Bt.createLogger,jt=zt("[ExternalScriptsLoader]"),qt=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return jt.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var u=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?u():null==r||r.addEventListener("DOMContentLoaded",u)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}qt(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");qt(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);qt(t,r,i)};var Ht="$people_distinct_id",Wt="$device_id",Yt="__alias",Vt="__timers",Gt="$dead_clicks_enabled_server_side",Jt="$sesid",Kt="$session_is_sampled",Xt="$enabled_feature_flags",Qt="$flag_call_reported",Zt="$feature_flag_evaluated_at",te="$user_state",ee="$client_session_props",ie="$capture_rate_limit",re="$initial_campaign_params",se="$initial_referrer_info",ne="$initial_person_info",oe="$epp",ae="$posthog_cookieless",ue="$sdk_debug_extensions_init_method",le="$sdk_debug_extensions_init_time_ms",he="on_reject",de="always",ce="anonymous",_e="identified",ve="identified_only",pe="visibilitychange",fe="beforeunload",ge="$pageview",me="$pageleave",we="$identify",be="$groupidentify";function ye(t,e){T(t)&&t.forEach(e)}function xe(t,e){if(!C(t))if(T(t))t.forEach(e);else if(L(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)E.call(t,i)&&e(t[i],i)}var $e=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},Ee=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Bt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Bt.critical(t)}}},Se=function(t){var e={};return xe(t,(function(t,i){(k(t)&&t.length>0||N(t))&&(e[i]=t)})),e};var Te=["herokuapp.com","vercel.app","netlify.app"];function Re(t){var e=null==t?void 0:t.hostname;if(!k(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Te)if(i===r)return!1;return!0}function Pe(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return N(t)&&isFinite(t)&&Math.floor(t)===t});class Ie{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Ie(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Ie(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Oe{constructor(){this.I=0,this.S=0,this.k=new Ue}generate(){var t=this.generateOrAbort();if(O(t)){this.I=0;var e=this.generateOrAbort();if(O(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Ie.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var ke,Me=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!O(t.crypto)&&crypto.getRandomValues&&(Me=t=>crypto.getRandomValues(t));class Ue{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Me(this.T),this.N=0),this.T[this.N++]}}var Ce=()=>Ne().toString(),Ne=()=>(ke||(ke=new Oe)).generate(),Ae="",De=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Le={R:()=>!!r,B(t){Bt.error("cookieStore error: "+t)},O(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(Le.O(t))||{}}catch(t){}return e},M(t,e,i,s,n){if(r)try{var o="",a="",u=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Ae)return Ae;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Ce();!Ae&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Ae=o)}return Ae}(t);if(!i){var s=(t=>{var e=t.match(De);return e?e[0]:""})(t);s!==i&&Bt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+u+a;return h.length>3686.4&&Bt.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},F(t,e){if(null!=r&&r.cookie)try{Le.M(t,"",-1,e)}catch(t){return}}},Fe=null,Be={R(){if(!U(Fe))return Fe;var e=!0;if(O(t))e=!1;else try{var i="__mplssupport__";Be.M(i,"xyz"),'"xyz"'!==Be.O(i)&&(e=!1),Be.F(i)}catch(t){e=!1}return e||Bt.error("localStorage unsupported; falling back to cookie store"),Fe=e,e},B(t){Bt.error("localStorage error: "+t)},O(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Be.B(t)}return null},Z(t){try{return JSON.parse(Be.O(t))||{}}catch(t){}return null},M(e,i){try{null==t||t.localStorage.setItem(e,JSON.stringify(i))}catch(t){Be.B(t)}},F(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Be.B(t)}}},ze=[Wt,"distinct_id",Jt,Kt,oe,ne,te],je={},qe={R:()=>!0,B(t){Bt.error("memoryStorage error: "+t)},O:t=>je[t]||null,Z:t=>je[t]||null,M(t,e){je[t]=e},F(t){delete je[t]}},He=null,We={R(){if(!U(He))return He;if(He=!0,O(t))He=!1;else try{var e="__support__";We.M(e,"xyz"),'"xyz"'!==We.O(e)&&(He=!1),We.F(e)}catch(t){He=!1}return He},B(t){Bt.error("sessionStorage error: ",t)},O(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){We.B(t)}return null},Z(t){try{return JSON.parse(We.O(t))||null}catch(t){}return null},M(e,i){try{null==t||t.sessionStorage.setItem(e,JSON.stringify(i))}catch(t){We.B(t)}},F(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){We.B(t)}}};class Ye{constructor(t){this._instance=t}get Lt(){return this._instance.config}get consent(){return this.tr()?0:this.rr}isOptedOut(){return this.Lt.cookieless_mode===de||this.isRejected()||-1===this.consent&&this.Lt.cookieless_mode===he}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Lt.opt_out_capturing_by_default}optInOut(t){this.ir.M(this.nr,t?1:0,this.Lt.cookie_expiration,this.Lt.cross_subdomain_cookie,this.Lt.secure_cookie)}reset(){this.ir.F(this.nr,this.Lt.cross_subdomain_cookie)}get nr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get rr(){var t=this.ir.O(this.nr);return z(t)?1:b(j,t)?0:-1}get ir(){var t=this.Lt.opt_out_capturing_persistence_type,e="localStorage"===t?Be:Le;if(!this.sr||this.sr!==e){this.sr=e;var i="localStorage"===t?Le:Be;i.O(this.nr)&&(this.sr.O(this.nr)||this.optInOut(z(i.O(this.nr))),i.F(this.nr,this.Lt.cross_subdomain_cookie))}return this.sr}tr(){return!!this.Lt.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>z(t)))}}zt("[Dead Clicks]");var Ve=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Gt)),r=t.instance.config.capture_dead_clicks;return D(r)?r:!!P(r)||i},Ge=zt("[SegmentIntegration]");var Je="posthog-js";function Ke(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,u,l,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var _,v=(null==(a=e.exception)?void 0:a.values)||[],f=v.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(u=v[0])?void 0:u.value)||e.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=v[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(_=t.exceptions)||_.sendExceptionEvent(g)),e}}class Xe{constructor(t,e,i,r,s,n){this.name=Je,this.setupOnce=function(o){o(Ke(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Qe{constructor(t){this.hr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Bt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.cr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.dr()}dr(){var t;this.vr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.hr)}destroy(){var t;null==(t=this.vr)||t.call(this),this.vr=void 0}doPageView(e,i){var r,s=this.pr(e,i);return this.cr={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.pr(t,null==(e=this.cr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.cr)?void 0:t.pageViewId}}pr(t,e){var i=this.cr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:u,lastContentY:l,maxContentY:h}=s;if(!(O(n)||O(o)||O(a)||O(u)||O(l)||O(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),h=Math.ceil(h);var d=n>1?q(o/n,0,1,Bt):1,c=n>1?q(a/n,0,1,Bt):1,_=u>1?q(l/u,0,1,Bt):1,v=u>1?q(h/u,0,1,Bt):1;r=$e(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ze={[Ht]:{exposure:"hidden"},[Yt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Vt]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[Gt]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},$session_recording_remote_config:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Jt]:{exposure:"hidden"},[Kt]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[Xt]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!P(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},$active_feature_flags:{exposure:"event"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden"},$feature_flag_payloads:{exposure:"event"},$feature_flag_request_id:{exposure:"event"},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden"},$surveys_activated:{exposure:"event"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Qt]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[Zt]:{exposure:"hidden"},[te]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[ie]:{exposure:"hidden"},[re]:{exposure:"hidden"},[se]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[oe]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[ue]:{exposure:"event"},[le]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},ti=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ei=t=>{var e=null==r?void 0:r.createElement("a");return O(e)?null:(e.href=t,e)},ii=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!T(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Bt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ri=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],u=(o||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");T(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(u[h]))}var c=a;return null!=o&&(c+="?"+l.join("&")),null!=s&&(c+="#"+s),c},si="https?://(.*)",ni=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],oi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ni],ai="<masked>",ui=["li_fat_id"];function li(t,e){var i=oi.concat(e||[]),r={};return xe(i,(function(e){var i=ii(t,e);r[e]=i||null})),r}function hi(t){var e=function(t){return t?0===t.search(si+"google.([^/?]*)")?"google":0===t.search(si+"bing.com")?"bing":0===t.search(si+"yahoo.com")?"yahoo":0===t.search(si+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!U(e)){s.$search_engine=e;var n=r?ii(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function di(){return navigator.language||navigator.userLanguage}var ci="$direct";function _i(){return(null==r?void 0:r.referrer)||ci}function vi(t,e){var i=t?[...ni,...e||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:_i().substring(0,1e3),u:r?ri(r,i,ai):void 0}}function pi(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==ci?ci:null==(e=ei(i))?void 0:e.host};if(r){s.$current_url=r;var n=ei(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=li(r);$e(s,o)}if(i){var a=hi(i);$e(s,a)}return s}function fi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gi(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var mi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class wi{constructor(t,e){this.Lt=t,this.props={},this.gr=!1,this.mr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.ir=this.yr(t),this.load(),t.debug&&Bt.info("Persistence loaded",t.persistence,p({},this.props)),this.update_config(t,t,e),this.save()}isDisabled(){return!!this.br}yr(e){-1===mi.indexOf(e.persistence.toLowerCase())&&(Bt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i=function(e){void 0===e&&(e=[]);var i=[...ze,...e];return p({},Be,{Z(t){try{var e={};try{e=Le.Z(t)||{}}catch(t){}var i=$e(e,JSON.parse(Be.O(t)||"{}"));return Be.M(t,i),i}catch(t){}return null},M(t,e,r,s,n,o){try{Be.M(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&Le.M(t,a,r,s,n,o)}catch(t){Be.B(t)}},F(e,i){try{null==t||t.localStorage.removeItem(e),Le.F(e,i)}catch(t){Be.B(t)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&Be.R()?Be:"localstorage+cookie"===r&&i.R()?i:"sessionstorage"===r&&We.R()?We:"memory"===r?qe:"cookie"===r?Le:i.R()?i:Le}_r(t){var e=null!=t?t:this.Lt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Zt];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return xe(this.props,((e,i)=>{var r=(t=>{var e=Ze[t];if(e)return e;for(var[i,r]of ti)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===Xt?()=>this._r():()=>!1))return;r.transformToEventProperties&&$e(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this.br){var t=this.ir.Z(this.mr);t&&(this.props=$e({},t))}}save(){this.br||this.ir.M(this.mr,this.props,this.wr,this.Ir,this.Cr,this.Lt.debug)}remove(){this.ir.F(this.mr,!1),this.ir.F(this.mr,!0)}clear(){this.remove(),this.props={}}register_once(t,e,i){if(P(t)){O(e)&&(e="None"),this.wr=O(i)?this.Sr:i;var r=!1;if(xe(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.kr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(P(t)){this.wr=O(e)?this.Sr:e;var i=!1;if(xe(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.kr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){if(!this.gr){var t=function(t,e,i){if(!r)return{};var s,n=e?[...ni,...i||[]]:[],o=li(ri(r.URL,n,ai),t),a=(s={},xe(ui,(function(t){var e=Le.O(t);s[t]=e||null})),s);return $e(a,o)}(this.Lt.custom_campaign_params,this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties);I(Se(t))||this.register(t),this.gr=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?hi(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_i(),$referring_domain:null!=r&&r.referrer&&(null==(t=ei(r.referrer))?void 0:t.host)||ci},void 0)}set_initial_person_info(){this.props[re]||this.props[se]||this.register_once({[ne]:vi(this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};xe([se,re],(e=>{var i=this.props[e];i&&xe(i,(function(e,i){t["$initial_"+y(i)]=e}))}));var e,i,r=this.props[ne];if(r){var s=(e=pi(r),i={},xe(e,(function(t,e){i["$initial_"+y(e)]=t})),i);$e(t,s)}return t}safe_merge(t){return xe(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.Sr=this.wr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.yr(t),s=this.props;this.clear(),this.ir=r,this.props=s,this.save()}}set_disabled(t){this.br=t,this.br?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ir&&(this.Ir=t,this.remove(),this.save())}set_secure(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[Vt]||{};i[t]=e,this.kr(Vt,i),this.save()}remove_event_timer(t){var e=this.props[Vt]||{},i=e[t];return O(i)||(delete e[t],this.kr(Vt,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.kr(t,e),this.save()}kr(t,e){this.props[t]=e}Tr(t){delete this.props[t]}}var bi={Activation:"events",Cancellation:"cancelEvents"},yi={Button:"button",Tab:"tab",Selector:"selector"},xi={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},$i={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ei={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Si={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ti={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ri={Once:"once",Recurring:"recurring",Always:"always"},Pi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ii={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Oi={Popover:"popover",Inline:"inline"},ki={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Mi={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Ui={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ci=zt("[RateLimiter]");class Ni{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Ci.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Ci.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(ie))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var u=1>a.tokens;return u||t||(a.tokens=Math.max(0,a.tokens-1)),!u||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,null==(r=this.instance.persistence)||r.set_property(ie,a),{isRateLimited:u,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Ai=zt("[RemoteConfig]");class Di{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ar(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Er(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return Ai.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void Ai.warn("Remote config is disabled. Falling back to local config.");this.Ar((t=>{if(!t)return Ai.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er((t=>{this.Rr(t),this.Nr()}));this.Rr(t),this.Nr()}))}catch(t){Ai.error("Error loading remote config",t)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.Fr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Fr=setInterval((()=>{this.refresh()}),e))}}Rr(t){var e;t||Ai.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var Li=["fatal","error","warning","log","info","debug"],Fi={GZipJS:"gzip-js",Base64:"base64"},Bi=Uint8Array,zi=Uint16Array,ji=Uint32Array,qi=new Bi([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]),Hi=new Bi([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]),Wi=new Bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yi=function(t,e){for(var i=new zi(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new ji(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Vi=Yi(qi,2),Gi=Vi[1];Vi[0][28]=258,Gi[258]=28;for(var Ji=Yi(Hi,0)[1],Ki=new zi(32768),Xi=0;32768>Xi;++Xi){var Qi=(43690&Xi)>>>1|(21845&Xi)<<1;Ki[Xi]=((65280&(Qi=(61680&(Qi=(52428&Qi)>>>2|(13107&Qi)<<2))>>>4|(3855&Qi)<<4))>>>8|(255&Qi)<<8)>>>1}var Zi=function(t,e,i){for(var r=t.length,s=0,n=new zi(e);r>s;++s)++n[t[s]-1];var o,a=new zi(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new zi(1<<e);var u=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)o[Ki[d]>>>u]=l}else for(o=new zi(r),s=0;r>s;++s)o[s]=Ki[a[t[s]-1]++]>>>15-t[s];return o},tr=new Bi(288);for(Xi=0;144>Xi;++Xi)tr[Xi]=8;for(Xi=144;256>Xi;++Xi)tr[Xi]=9;for(Xi=256;280>Xi;++Xi)tr[Xi]=7;for(Xi=280;288>Xi;++Xi)tr[Xi]=8;var er=new Bi(32);for(Xi=0;32>Xi;++Xi)er[Xi]=5;var ir=Zi(tr,9,0),rr=Zi(er,5,0),sr=function(t){return(t/8>>0)+(7&t&&1)},nr=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof zi?zi:t instanceof ji?ji:Bi)(i-e);return r.set(t.subarray(e,i)),r},or=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},ar=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ur=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Bi(0),0];if(1==s){var o=new Bi(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],u=i[1],l=0,h=1,d=2;for(i[0]={s:-1,f:a.f+u.f,l:a,r:u};h!=s-1;)a=i[i[d].f>i[l].f?l++:d++],u=i[l!=h&&i[d].f>i[l].f?l++:d++],i[h++]={s:-1,f:a.f+u.f,l:a,r:u};var c=n[0].s;for(r=1;s>r;++r)n[r].s>c&&(c=n[r].s);var _=new zi(c+1),v=lr(i[h-1],_,0);if(v>e){r=0;var p=0,f=v-e,g=1<<f;for(n.sort((function(t,e){return _[e.s]-_[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=_[m])break;p+=g-(1<<v-_[m]),_[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>_[w]?p-=1<<e-_[w]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;_[b]==e&&(--_[b],++p)}v=e}return[new Bi(_),v]},lr=function(t,e,i){return-1==t.s?Math.max(lr(t.l,e,i+1),lr(t.r,e,i+1)):e[t.s]=i},hr=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new zi(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},dr=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},cr=function(t,e,i){var r=i.length,s=sr(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},_r=function(t,e,i,r,s,n,o,a,u,l,h){or(e,h++,i),++s[256];for(var d=ur(s,15),c=d[0],_=d[1],v=ur(n,15),p=v[0],f=v[1],g=hr(c),m=g[0],w=g[1],b=hr(p),y=b[0],x=b[1],E=new zi(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;y.length>S;++S)E[31&y[S]]++;for(var T=ur(E,7),R=T[0],P=T[1],I=19;I>4&&!R[Wi[I-1]];--I);var O,k,M,U,C=l+5<<3,N=dr(s,tr)+dr(n,er)+o,A=dr(s,c)+dr(n,p)+o+14+3*I+dr(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(N>=C&&A>=C)return cr(e,h,t.subarray(u,u+l));if(or(e,h,1+(N>A)),h+=2,N>A){O=Zi(c,_,0),k=c,M=Zi(p,f,0),U=p;var D=Zi(R,P,0);for(or(e,h,w-257),or(e,h+5,x-1),or(e,h+10,I-4),h+=14,S=0;I>S;++S)or(e,h+3*S,R[Wi[S]]);h+=3*I;for(var L=[m,y],F=0;2>F;++F){var B=L[F];for(S=0;B.length>S;++S)or(e,h,D[z=31&B[S]]),h+=R[z],z>15&&(or(e,h,B[S]>>>5&127),h+=B[S]>>>12)}}else O=ir,k=tr,M=rr,U=er;for(S=0;a>S;++S)if(r[S]>255){var z;ar(e,h,O[257+(z=r[S]>>>18&31)]),h+=k[z+257],z>7&&(or(e,h,r[S]>>>23&31),h+=qi[z]);var j=31&r[S];ar(e,h,M[j]),h+=U[j],j>3&&(ar(e,h,r[S]>>>5&8191),h+=Hi[j])}else ar(e,h,O[r[S]]),h+=k[r[S]];return ar(e,h,O[256]),h+k[256]},vr=new ji([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pr=function(){for(var t=new ji(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),fr=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function gr(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=pr[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,u,l=(a=10+((s=e).filename&&s.filename.length+1||0),u=8,function(t,e,i,r,s,n){var o=t.length,a=new Bi(r+o+5*(1+Math.floor(o/7e3))+s),u=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?l=cr(u,l,t.subarray(h,d)):(u[h]=!0,l=cr(u,l,t.subarray(h,o)))}else{for(var c=vr[e-1],_=c>>>13,v=8191&c,p=(1<<i)-1,f=new zi(32768),g=new zi(p+1),m=Math.ceil(i/3),w=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},y=new ji(25e3),x=new zi(288),E=new zi(32),S=0,T=0,R=(h=0,0),P=0,I=0;o>h;++h){var O=b(h),k=32767&h,M=g[O];if(f[k]=M,g[O]=k,h>=P){var U=o-h;if((S>7e3||R>24576)&&U>423){l=_r(t,u,0,y,x,E,T,R,I,h-I,l),R=S=T=0,I=h;for(var C=0;286>C;++C)x[C]=0;for(C=0;30>C;++C)E[C]=0}var N=2,A=0,D=v,L=k-M&32767;if(U>2&&O==b(h-L))for(var F=Math.min(_,U)-1,B=Math.min(32767,h),z=Math.min(258,U);B>=L&&--D&&k!=M;){if(t[h+N]==t[h+N-L]){for(var j=0;z>j&&t[h+j]==t[h+j-L];++j);if(j>N){if(N=j,A=L,j>F)break;var q=Math.min(L,j-2),H=0;for(C=0;q>C;++C){var W=h-L+C+32768&32767,Y=W-f[W]+32768&32767;Y>H&&(H=Y,M=W)}}}L+=(k=M)-(M=f[k])+32768&32767}if(A){y[R++]=268435456|Gi[N]<<18|Ji[A];var V=31&Gi[N],G=31&Ji[A];T+=qi[V]+Hi[G],++x[257+V],++E[G],P=h+N,++S}else y[R++]=t[h],++x[t[h]]}}l=_r(t,u,!0,y,x,E,T,R,I,h-I,l)}return nr(a,0,r+sr(l)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,u)),h=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&fr(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),fr(l,h-8,i.d()),fr(l,h-4,r),l}var mr=!!o||!!n,wr="text/plain",br=!1,yr=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=p({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return xe(t,(function(t,e){O(t)||O(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return u&&a.push(u),s+"?"+a.join("&")},xr=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),$r=t=>{if(t.er)return t.er;var{data:e,compression:i}=t;if(e){if(i===Fi.GZipJS){var r=gr(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Bi(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Bi(s+8+(i-o<<1));a.set(r),r=a}var u=t.charCodeAt(o);128>u?n(u):2048>u?(n(192|u>>>6),n(128|63&u)):u>55295&&57344>u?(n(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++o))>>>18),n(128|u>>>12&63),n(128|u>>>6&63),n(128|63&u)):(n(224|u>>>12),n(128|u>>>6&63),n(128|63&u))}return nr(r,0,s)}(xr(e)),{mtime:0});return{contentType:wr,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Fi.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(xr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:xr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=xr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Er=function(){var t=v((function*(t){var e=xr(t.data),i=yield function(t,e,i){return f.apply(this,arguments)}(e,c.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{er:{contentType:wr,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Sr=(t,e)=>yr(t,{_:(new Date).getTime().toString(),ver:c.JS_SDK_VERSION,compression:e}),Tr=[];n&&Tr.push({transport:"fetch",method(t){var e,i,{contentType:r,body:s,estimatedSize:o}=null!==(e=$r(t))&&void 0!==e?e:{},u=new Headers;xe(t.headers,(function(t,e){u.append(e,t)})),r&&u.append("Content-Type",r);var l=t.url,h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(l,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(o||0),body:s,signal:null==(i=h)?void 0:i.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Bt.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{Bt.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&Tr.push({transport:"XHR",method(t){var e,i=new o;i.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(e=$r(t))&&void 0!==e?e:{};xe(t.headers,(function(t,e){i.setRequestHeader(e,t)})),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),t.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(s)}}),null!=i&&i.sendBeacon&&Tr.push({transport:"sendBeacon",method(t){var e=yr(t.url,{beacon:"1"});try{var r,{contentType:s,body:n}=null!==(r=$r(t))&&void 0!==r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});i.sendBeacon(e,o)}catch(t){}}});var Rr=3e3;class Pr{constructor(t,e){this.Or=!0,this.Pr=[],this.Lr=q((null==e?void 0:e.flush_interval_ms)||Rr,250,5e3,Bt.createLogger("flush interval"),Rr),this.Dr=t}enqueue(t){this.Pr.push(t),this.Br||this.jr()}unload(){this.$r();var t=this.Pr.length>0?this.qr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Dr(p({},t,{transport:"sendBeacon"}))}))}enable(){this.Or=!1,this.jr()}jr(){var t=this;this.Or||(this.Br=setTimeout((()=>{if(this.$r(),this.Pr.length>0){var e=this.qr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&T(i.data)&&xe(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Dr(i)};for(var r in e)i()}}),this.Lr))}$r(){clearTimeout(this.Br),this.Br=void 0}qr(){var t={};return xe(this.Pr,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;O(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.Pr=[],t}}var Ir=["retriesPerformedSoFar"];class Or{constructor(e){this.Zr=!1,this.Hr=3e3,this.Pr=[],this._instance=e,this.Pr=[],this.Vr=!0,!O(t)&&"onLine"in t.navigator&&(this.Vr=t.navigator.onLine,this.zr=()=>{this.Vr=!0,this.Ur()},this.Yr=()=>{this.Vr=!1},Pe(t,"online",this.zr),Pe(t,"offline",this.Yr))}get length(){return this.Pr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ir);A(e)&&(i.url=yr(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==i.callback||i.callback(t):this.Wr(p({retriesPerformedSoFar:e},i))}}))}Wr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Pr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Bt.warn(s),this.Zr||(this.Zr=!0,this.Gr())}Gr(){if(this.Xr&&clearTimeout(this.Xr),0===this.Pr.length)return this.Zr=!1,void(this.Xr=void 0);this.Xr=setTimeout((()=>{this.Vr&&this.Pr.length>0&&this.Ur(),this.Gr()}),this.Hr)}Ur(){var t=Date.now(),e=[],i=this.Pr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Pr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Xr&&(clearTimeout(this.Xr),this.Xr=void 0),this.Zr=!1,O(t)||(this.zr&&(t.removeEventListener("online",this.zr),this.zr=void 0),this.Yr&&(t.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.Pr))try{this._instance._send_request(p({},e,{transport:"sendBeacon"}))}catch(t){Bt.error(t)}this.Pr=[]}}class kr{constructor(t){this.Jr=()=>{var t,e,i,r;this.Kr||(this.Kr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),u=(null==s?void 0:s.scrollHeight)||0;this.Kr.lastScrollY=Math.ceil(n),this.Kr.maxScrollY=Math.max(n,null!==(t=this.Kr.maxScrollY)&&void 0!==t?t:0),this.Kr.maxScrollHeight=Math.max(o,null!==(e=this.Kr.maxScrollHeight)&&void 0!==e?e:0),this.Kr.lastContentY=a,this.Kr.maxContentY=Math.max(a,null!==(i=this.Kr.maxContentY)&&void 0!==i?i:0),this.Kr.maxContentHeight=Math.max(u,null!==(r=this.Kr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Kr}resetContext(){var t=this.Kr;return setTimeout(this.Jr,0),t}startMeasuringScrollPosition(){Pe(t,"scroll",this.Jr,{capture:!0}),Pe(t,"scrollend",this.Jr,{capture:!0}),Pe(t,"resize",this.Jr)}scrollElement(){if(!this.Qr)return null==t?void 0:t.document.documentElement;var e=T(this.Qr)?this.Qr:[this.Qr];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}scrollY(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var Mr=t=>vi(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Ur{constructor(t,e,i,r){this.ei=t=>{var e=this.ti();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ri(this._instance)};this.ii.register({[ee]:i})}},this._instance=t,this.ni=e,this.ii=i,this.ri=r||Mr,this.ni.onSessionId(this.ei)}ti(){return this.ii.props[ee]}getSetOnceProps(){var t,e=null==(t=this.ti())?void 0:t.props;return e?"r"in e?pi(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return xe(Se(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+y(i)]=e})),t}}class Cr{constructor(){this.si={}}on(t,e){return this.si[t]||(this.si[t]=[]),this.si[t].push(e),()=>{this.si[t]=this.si[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.si[t]||[])i(e);for(var r of this.si["*"]||[])r(t,e)}}var Nr=zt("[SessionId]");class Ar{on(t,e){return this.oi.on(t,e)}constructor(t,e,i){var r;if(this.ai=[],this.li=void 0,this.oi=new Cr,this.ui=(t,e)=>!(!A(t)||!A(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===de)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Lt=t.config,this.ii=t.persistence,this.hi=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.di=e||Ce,this.vi=i||Ce;var s=this.Lt.persistence_name||this.Lt.token;if(this._sessionTimeoutMs=1e3*q(this.Lt.session_idle_timeout_seconds||1800,60,36e3,Nr.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+s+"_window_id",this.gi="ph_"+s+"_primary_window_exists",this.mi()){var n=We.Z(this.pi),o=We.Z(this.gi);n&&!o?this.hi=n:We.F(this.pi),We.M(this.gi,!0)}if(null!=(r=this.Lt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Lt.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.yi(this.Lt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Nr.error("Invalid sessionID in bootstrap",t)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return O(this.ai)&&(this.ai=[]),this.ai.push(t),this.ci&&t(this.ci,this.hi),()=>{this.ai=this.ai.filter((e=>e!==t))}}mi(){return"memory"!==this.Lt.persistence&&!this.ii.br&&We.R()}wi(t){t!==this.hi&&(this.hi=t,this.mi()&&We.M(this.pi,t))}Ii(){return this.hi?this.hi:this.mi()?We.Z(this.pi):null}yi(t,e,i){t===this.ci&&e===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.ci=t,this.ii.register({[Jt]:[e,t,i]}))}Ci(){var t=this.ii.props[Jt];return T(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.yi(null,null,null)}destroy(){clearTimeout(this.Si),this.Si=void 0,this.li&&t&&(t.removeEventListener(fe,this.li,{capture:!1}),this.li=void 0),this.ai=[]}bi(){this.li=()=>{this.mi()&&We.F(this.gi)},Pe(t,fe,this.li,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Lt.cookieless_mode===de)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[r,s,n]=this.Ci(),o=this.Ii(),a=A(n)&&Math.abs(i-n)>864e5,u=!1,l=!s,h=!l&&!t&&this.ui(i,r);l||h||a?(s=this.di(),o=this.vi(),Nr.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:l,activityTimeout:h,sessionPastMaximumLength:a}}),n=i,u=!0):o||(o=this.vi(),u=!0);var d=A(r)&&t&&!a?r:i,c=A(n)?n:(new Date).getTime();return this.wi(o),this.yi(s,d,c),t||this.fi(),u&&this.ai.forEach((t=>t(s,o,u?{noSessionId:l,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:c,changeReason:u?{noSessionId:l,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}fi(){clearTimeout(this.Si),this.Si=setTimeout((()=>{var[t]=this.Ci();if(this.ui((new Date).getTime(),t)){var e=this.ci;this.resetSessionId(),this.oi.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}function Dr(t,e,i){return xr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Lr="custom",Fr="i.posthog.com",Br=/^\/static\//;class zr{constructor(t){this.xi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Fr,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.xi[this.apiHost]||(this.xi[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":Lr),this.xi[this.apiHost]}ki(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&Br.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.ki(e);if(i)return""+i+e}if(this.region===Lr)return this.apiHost+e;var r=Fr+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var jr=zt("[Surveys]"),qr={ignoreConditions:!1,ignoreDelay:!1,displayType:Oi.Popover},Hr=zt("[PostHog ExternalIntegrations]"),Wr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Yr{constructor(t){this._instance=t}lr(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Hr.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.lr(Wr[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Vr,Gr={},Jr=0,Kr=()=>{},Xr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Qr="Surveys module not available",Zr="sanitize_properties is deprecated. Use before_send instead",ts="Invalid value for property_denylist config: ",es="posthog",is=!mr&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),rs=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Re(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kr,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,__preview_external_dependency_versioned_paths:!1,debug:s&&k(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Bt.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ve,before_send:void 0,request_queue_config:{flush_interval_ms:Rr},error_tracking:{},_onCapture:Kr,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},ss=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],ns=t=>{var e={};for(var[i,r]of ss)O(t[i])||(e[r]=t[i]);var s=$e({},e,t);return T(t.property_blacklist)&&(O(t.property_denylist)?s.property_denylist=t.property_blacklist:T(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:Bt.error(ts+t.property_denylist)),s};class os{constructor(){this.__forceAllowLocalhost=!1}get Ti(){return this.__forceAllowLocalhost}set Ti(t){Bt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class as{Ai(t,e){if(t){var i=this.Ei.indexOf(t);-1!==i&&this.Ei.splice(i,1)}return this.Ei.push(e),null==e.initialize||e.initialize(),e}Ri(){return this.config.cookieless_mode===de||this.config.cookieless_mode===he&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new os,this.Ni=!1,this.version=c.LIB_VERSION,this.Mi=new Cr,this.Ei=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rs(),this.SentryIntegration=Xe,this.sentryIntegration=t=>function(t,e){var i=Ke(t,e);return{name:Je,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Oi=null,this.Pi=null,this.Li=null,this.scrollManager=new kr(this),this.pageViewManager=new Qe(this),this.rateLimiter=new Ni(this),this.requestRouter=new zr(this),this.consent=new Ye(this),this.externalIntegrations=new Yr(this);var e=null!==(t=as.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=k(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=k(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Bt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==es){var r,s=null!==(r=Gr[i])&&void 0!==r?r:new as;return s._init(t,e,i),Gr[i]=s,Gr[es][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;if(void 0===i&&(i={}),O(e)||M(e))return Bt.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={},i.debug=this.Di(i.debug),this.Bi=i,this.ji=[],i.person_profiles?this.Pi=i.person_profiles:i.process_person&&(this.Pi=i.process_person),this.set_config($e({},rs(i.defaults),ns(i),{name:r,token:e})),this.config.on_xhr_error&&Bt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Fi.GZipJS;var o=this.$i();this.persistence=new wi(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new wi(p({},this.config,{persistence:"sessionStorage"}),o);var a=p({},this.persistence.props),u=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qi=new Pr((t=>this.Zi(t)),this.config.request_queue_config),this.Hi=new Or(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new Ar(this),this.sessionPropsManager=new Ur(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Bt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Vi(l)}),0)):(Bt.info("Initializing extensions synchronously"),this.Vi(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Bt.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:a,s:u}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var h=i.bootstrap.distinctID,d=this.get_distinct_id(),_=this.persistence.get_property(te);if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&_===ce)this.identify(h);else if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&_===_e)Bt.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 v=this.config.get_device_id(Ce()),f=i.bootstrap.isIdentifiedID?v:h;this.persistence.set_property(te,i.bootstrap.isIdentifiedID?_e:ce),this.register({distinct_id:h,$device_id:f})}}if(l)this.register_once({distinct_id:ae,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Ce());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(te,ce)}return Pe(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Ce();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(te,_e)),e()},s=i.user();"then"in s&&R(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||Ge.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Ge.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Ge.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ge),identify:t=>e(t,we),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.zi())):this.zi(),R(this.config._onCapture)&&this.config._onCapture!==Kr&&(Bt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Bt.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}Vi(t){var e,i,r,s,n,o,a,u=performance.now(),l=p({},as.__defaultExtensionClasses,this.config.__extensionClasses),h=[];l.featureFlags&&this.Ei.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new l.featureFlags(this)),l.exceptions&&this.Ei.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new l.exceptions(this)),l.historyAutocapture&&this.Ei.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.Ei.push(new l.tracingHeaders(this)),l.siteApps&&this.Ei.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.Ei.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.Ei.push(this.autocapture=new l.autocapture(this)),l.surveys&&this.Ei.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new l.surveys(this)),l.logs&&this.Ei.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new l.logs(this)),l.conversations&&this.Ei.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.Ei.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.Ei.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.Ei.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.Ei.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.Ei.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Ve)),l.toolbar&&this.Ei.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.Ei.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.Ei.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Ui){var t=this.Ui;this.Ui=void 0,this.Rr(t)}})),this.Yi(h,u)}Yi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Yi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Bt.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ue]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[le]:r}),this.config.__preview_deferred_init_extensions&&Bt.info("PostHog extensions initialized ("+r+"ms)")}Rr(t){var e;if(!r||!r.body)return Bt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Rr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ui=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=b(t.supportedCompression,Fi.GZipJS)?Fi.GZipJS:b(t.supportedCompression,Fi.Base64)?Fi.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:ve}),this.Ei.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}zi(){try{this.config.loaded(this)}catch(t){Bt.critical("`loaded` function failed",t)}if(this.Gi(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ri())&&this.Xi()}),1),this.Ji=new Di(this),this.Ji.load()}Gi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.qi)||t.enable())}_dom_loaded(){this.is_capturing()&&ye(this.__request_queue,(t=>this.Zi(t))),this.__request_queue=[],this.Gi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Ki()&&this.capture(me),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.qi)||i.unload(),null==(r=this.Hi)||r.unload()):this.Ki()&&this.capture(me,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(is?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=yr(t.url,{ip:this.config.ip?1:0}),t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=Sr(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=Tr.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Fi.GZipJS&&u&&!br?Er(s).then((t=>{a(t)})).catch((e=>{if((t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(e))return br=!0,void a(p({},s,{compression:void 0,url:Sr(t.url,void 0)}));a(s)})):a(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Zi(t){this.Hi?this.Hi.retriableRequest(t):this._send_request(t)}_execute_array(t){Jr++;try{var e,i=[],r=[],s=[];ye(t,(t=>{t&&(T(e=t[0])?s.push(t):R(t)?t.call(this):T(t)&&"alias"===e?i.push(t):T(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t))}));var n=function(t,e){ye(t,(function(t){if(T(t[0])){var i=e;xe(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}))};n(i,this),n(r,this),n(s,this)}finally{Jr--}}push(t){if(Jr>0&&T(t)&&k(t[0])){var e=as.prototype[t[0]];R(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qi){if(this.is_capturing())if(!O(t)&&k(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var l=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=e&&e.$current_url&&!k(null==e?void 0:e.$current_url)&&(Bt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.Qi||Bt.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,c=Ce(),_={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},d,c)};t===ge&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),l&&(_.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens),(null==i?void 0:i.$set)&&(_.$set=null==i?void 0:i.$set);var v,f,g,m=this.en(null==i?void 0:i.$set_once,t!==be,t===we);if(m&&(_.$set_once=m),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=_,o=t=>k(t)?t.slice(0,s):t,a=new Set,_=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),T(e)?(r=[],ye(e,(e=>{r.push(t(e))}))):(r={},xe(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),_.timestamp=d,O(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=h),t===Pi.DISMISSED||t===Pi.SENT){var w=null==e?void 0:e[Ii.SURVEY_ID],b=null==e?void 0:e[Ii.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>{var i=""+t+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+t+e.id+"_"+e.current_iteration),i})("seenSurvey_",t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){jr.error("Failed to persist survey seen state",t)}})({id:w,current_iteration:b}),_.$set=p({},_.$set,{[(v={id:w,current_iteration:b},f=t===Pi.SENT?"responded":"dismissed",g="$survey_"+f+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(g="$survey_"+f+"/"+v.id+"/"+v.current_iteration),g)]:!0})}else t===Pi.SHOWN&&(_.$set=p({},_.$set,{[Ii.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Mi.SHOWN){var y=null==e?void 0:e[Ui.TOUR_TYPE];y&&(_.$set=p({},_.$set,{[Ui.TOUR_LAST_SEEN_DATE+"/"+y]:(new Date).toISOString()}))}var x=p({},_.properties.$set,_.$set);if(I(x)||this.setPersonPropertiesForFlags(x),!C(this.config.before_send)){var E=this.tn(_);if(!E)return;_=E}this.Mi.emit("eventCaptured",_);var S={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,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.Zi(S):this.qi.enqueue(S),_}Bt.critical("This capture call is ignored due to client rate limiting.")}}else Bt.error("No event name provided to posthog.capture")}else Bt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var u=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Ri()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!k(h.distinct_id)&&!N(h.distinct_id)||M(h.distinct_id))&&Bt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var _,v=function(e,i){var r,n,o,a;if(!l)return{};var u,h,d,_,v,p,f,g,m=e?[...ni,...i||[]]:[],[w,b]=function(t){for(var e=0;Dt.length>e;e++){var[i,r]=Dt[e],s=i.exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(l);return $e(Se({$os:w,$os_version:b,$browser:Ct(l,navigator.vendor),$device:Lt(l),$device_type:(h=l,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},g=Lt(h),g===J||g===G||"Kobo"===g||"Kindle Fire"===g||g===St?V:g===vt||g===ft||g===pt||g===xt?"Console":g===X?"Wearable":g?H:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(_=null==d?void 0:d.maxTouchPoints)&&void 0!==_?_:0)>0?600>Math.min(null!==(v=null==d?void 0:d.screenWidth)&&void 0!==v?v:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(f=null==d?void 0:d.devicePixelRatio)&&void 0!==f?f:1)?H:V:"Desktop"),$timezone:fi(),$timezone_offset:gi()}),{$current_url:ri(null==s?void 0:s.href,m,ai),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:At(l,navigator.vendor),$browser_language:di(),$browser_language_prefix:(u=di(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:c.LIB_NAME,$lib_version:c.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:f,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=f,h.$window_id=g}this.sessionPropsManager&&$e(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&$e(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Hi)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Lr&&(h.$lib_custom_api_host=this.config.api_host),_=e!==ge||a?e!==me||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=$e(h,_),e===ge&&r&&(h.title=r.title),!O(u)){var w=n.getTime()-u;h.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=$e({},v,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?xe(this.config.property_denylist,(function(t){delete h[t]})):Bt.error(ts+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Bt.error(Zr),h=b(h,e));var y=this.rn();return h.$process_person_profile=y,y&&!a&&this.nn("_calculate_event_properties"),h}en(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.rn())return t;if(this.Ni&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=$e({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Bt.error(Zr),o=a(o,"$set_once")),e&&(this.Ni=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}sn(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Mi.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Qr}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Qr})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Qr})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=qr),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Qr}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Qr})}an(t){return!t||M(t)?(Bt.critical("Unique user id has not been set in posthog.identify"),!1):t===ae?(Bt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Bt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Bt.uninitializedWarning("posthog.identify");if(N(t)&&(t=t.toString(),Bt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.an(t)&&this.nn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Wt)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(Yt)&&(this.unregister(Yt),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(te)||ce)===ce;t!==r&&n?(this.persistence.set_property(te,_e),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(we,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Li=Dr(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(Qt))}}setPersonProperties(t,e){if((t||e)&&this.nn("posthog.setPersonProperties")){var i=Dr(this.get_distinct_id(),t,e);this.Li!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Li=i):Bt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(be,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else Bt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.nn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,u;if(Bt.info("reset"),!this.__loaded)return Bt.uninitializedWarning("posthog.reset");var l=this.get_property(Wt);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Ji)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(te,ce),null==(u=this.sessionManager)||u.resetSessionId(),this.Li=null,this.config.cookieless_mode===de)this.register_once({distinct_id:ae,$device_id:null},"");else{var h=this.config.get_device_id(Ce());this.register_once({distinct_id:h,$device_id:t?h:l},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.un()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(Ht)?(Bt.critical("Attempting to create alias for existing People user - aborting."),-2):this.nn("posthog.alias")?(O(e)&&(e=this.get_distinct_id()),t!==e?(this.sn(Yt,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Bt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(P(t)){var i,r,s,n,o,a,u,l,h,d;$e(this.config,ns(t));var _=this.$i();null==(i=this.persistence)||i.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new wi(p({},this.config,{persistence:"sessionStorage"}),_);var v=this.Di(this.config.debug);D(v)&&(this.config.debug=v),D(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Be.R()&&Be.M("ph_debug",!0),Bt.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(c.DEBUG=!1,Be.R()&&Be.F("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this.hn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){c.LIB_NAME=t,c.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:as.cn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:es;return e!==es&&(e=es+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(te))===_e||(null==(e=this.sessionPersistence)?void 0:e.get_property(te))===_e}rn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ve&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Yt])&&(null==(e=this.persistence)||null==(e=e.props)||!e[oe]))}Ki(){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.rn()||this.nn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.nn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}nn(t){return"never"===this.config.person_profiles?(Bt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sn(oe,!0),!0)}$i(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==he)}hn(){var t,e,i,r,s=this.$i();return(null==(t=this.persistence)?void 0:t.br)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.br)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==de){if(this.Ri()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ar(this),this.pageViewManager=new Qe(this),this.persistence&&(this.sessionPropsManager=new Ur(this,this.sessionManager,this.persistence));var a,u=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=as.__defaultExtensionClasses)?void 0:o.sessionRecording;u&&(this.sessionRecording=this.Ai(this.sessionRecording,new u(this)),this.Wi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Wi)))}var l,h;this.consent.optInOut(!0),this.hn(),this.Gi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==he&&(null==(l=this.surveys)||l.loadIfEnabled()),(O(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Xi()}else Bt.warn(Xr)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==de?(this.config.cookieless_mode===he&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.hn(),this.config.cookieless_mode===he&&(this.register({distinct_id:ae,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Xi())):Bt.warn(Xr)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===de||(this.config.cookieless_mode===he?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hn()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&m(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>m(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}Xi(){r&&("visible"===r.visibilityState?this.Fi||(this.Fi=!0,this.capture(ge,{title:r.title},{send_instantly:!0}),this.Oi&&(r.removeEventListener(pe,this.Oi),this.Oi=null)):this.Oi||(this.Oi=this.Xi.bind(this),Pe(r,pe,this.Oi)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Mr(){var t,e,i,r,s,n,o=this.Bi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Bt.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",!1,r=Bt,s=(e="advanced_disable_flags")in(t=o)&&!C(t[e]),n=i in t&&!C(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}tn(t){if(C(this.config.before_send))return t;var e=T(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),C(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return F(t.event)?Bt.warn(s+". This can cause unexpected behavior."):Bt.info(s),null}i.properties&&!I(i.properties)||Bt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.cr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Di(t){var e=D(t)&&!t,i=Be.R()&&"true"===Be.O("ph_debug");return!e&&(!!i||t)}}as.__defaultExtensionClasses={},as.cn={trace:Vr=()=>{},debug:Vr,info:Vr,warn:Vr,error:Vr,fatal:Vr},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Ee(t.prototype[e[i]])}(as,["identify"]);var us,ls=(us=Gr[es]=new as,function(){function e(){e.done||(e.done=!0,is=!1,xe(Gr,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():Pe(r,"DOMContentLoaded",e,{capture:!1}):t&&Bt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),us);export{Fi as Compression,ki as DEFAULT_PRODUCT_TOUR_APPEARANCE,Oi as DisplaySurveyType,as as PostHog,Mi as ProductTourEventName,Ui as ProductTourEventProperties,Pi as SurveyEventName,Ii as SurveyEventProperties,bi as SurveyEventType,xi as SurveyPosition,Ti as SurveyQuestionBranchingType,Si as SurveyQuestionType,Ri as SurveySchedule,$i as SurveyTabPosition,Ei as SurveyType,yi as SurveyWidgetType,ls as default,ls as posthog,Li as severityLevels};
|
|
1
|
+
var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,u=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.372.2",c={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function _(t,e,i,r,s,n,o){try{var a=t[n](o),u=a.value}catch(t){return void i(t)}a.done?e(u):Promise.resolve(u).then(r,s)}function v(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){_(n,r,s,o,a,"next",t)}function a(t){_(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}function f(){return f=v((function*(t,e,i){void 0===e&&(e=!0);try{var r=new CompressionStream("gzip"),s=r.writable.getWriter(),n=s.write((new TextEncoder).encode(t)).then((()=>s.close())).catch(function(){var t=v((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,n]);return a}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),f.apply(this,arguments)}var g=["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"],m=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return g.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))},w=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function b(t,e){return-1!==t.indexOf(e)}var y=function(t){return t.replace(/^\$/,"")},x=Object.prototype,E=x.hasOwnProperty,S=x.toString,T=Array.isArray||function(t){return"[object Array]"===S.call(t)},R=t=>"function"==typeof t,P=t=>t===Object(t)&&!T(t),I=t=>{if(P(t)){for(var e in t)if(E.call(t,e))return!1;return!0}return!1},O=t=>void 0===t,k=t=>"[object String]"==S.call(t),M=t=>k(t)&&0===t.trim().length,U=t=>null===t,C=t=>O(t)||U(t),N=t=>"[object Number]"==S.call(t)&&t==t,A=t=>N(t)&&t>0,D=t=>"[object Boolean]"===S.call(t),L=t=>t instanceof FormData,F=t=>b(w,t),B=[!0,"true",1,"1","yes"],z=t=>b(B,t),j=[!1,"false",0,"0","no"];function q(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),N(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),q(s||i,e,i,r))}var H="Mobile",W="iOS",Y="Android",V="Tablet",G=Y+" "+V,J="iPad",K="Apple",X=K+" Watch",Q="Safari",Z="BlackBerry",tt="Samsung",et=tt+"Browser",it=tt+" Internet",rt="Chrome",st=rt+" OS",nt=rt+" "+W,ot="Internet Explorer",at=ot+" "+H,ut="Opera",lt=ut+" Mini",ht="Edge",dt="Microsoft "+ht,ct="Firefox",_t=ct+" "+W,vt="Nintendo",pt="PlayStation",ft="Xbox",gt=Y+" "+H,mt=H+" "+Q,wt="Windows",bt=wt+" Phone",yt="Nokia",xt="Ouya",$t="Generic",Et=$t+" "+H.toLowerCase(),St=$t+" "+V.toLowerCase(),Tt="Konqueror",Rt="(\\d+(\\.\\d+)?)",Pt=new RegExp("Version/"+Rt),It=new RegExp(ft,"i"),Ot=new RegExp(pt+" \\w+","i"),kt=new RegExp(vt+" \\w+","i"),Mt=new RegExp(Z+"|PlayBook|BB10","i"),Ut={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Ct=function(t,e){return e=e||"",b(t," OPR/")&&b(t,"Mini")?lt:b(t," OPR/")?ut:Mt.test(t)?Z:b(t,"IE"+H)||b(t,"WPDesktop")?at:b(t,et)?it:b(t,ht)||b(t,"Edg/")?dt:b(t,"FBIOS")?"Facebook "+H:b(t,"UCWEB")||b(t,"UCBrowser")?"UC Browser":b(t,"CriOS")?nt:b(t,"CrMo")||b(t,rt)?rt:b(t,Y)&&b(t,Q)?gt:b(t,"FxiOS")?_t:b(t.toLowerCase(),Tt.toLowerCase())?Tt:((t,e)=>e&&b(e,K)||function(t){return b(t,Q)&&!b(t,rt)&&!b(t,Y)}(t))(t,e)?b(t,H)?mt:Q:b(t,ct)?ct:b(t,"MSIE")||b(t,"Trident/")?ot:b(t,"Gecko")?ct:""},Nt={[at]:[new RegExp("rv:"+Rt)],[dt]:[new RegExp(ht+"?\\/"+Rt)],[rt]:[new RegExp("("+rt+"|CrMo)\\/"+Rt)],[nt]:[new RegExp("CriOS\\/"+Rt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rt)],[Q]:[Pt],[mt]:[Pt],[ut]:[new RegExp("(Opera|OPR)\\/"+Rt)],[ct]:[new RegExp(ct+"\\/"+Rt)],[_t]:[new RegExp("FxiOS\\/"+Rt)],[Tt]:[new RegExp("Konqueror[:/]?"+Rt,"i")],[Z]:[new RegExp(Z+" "+Rt),Pt],[gt]:[new RegExp("android\\s"+Rt,"i")],[it]:[new RegExp(et+"\\/"+Rt)],[ot]:[new RegExp("(rv:|MSIE )"+Rt)],Mozilla:[new RegExp("rv:"+Rt)]},At=function(t,e){var i=Ct(t,e),r=Nt[i];if(O(r))return null;for(var s=0;r.length>s;s++){var n=t.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Dt=[[new RegExp(ft+"; "+ft+" (.*?)[);]","i"),t=>[ft,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(pt,"i"),[pt,""]],[Mt,[Z,""]],[new RegExp(wt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[bt,""];if(new RegExp(H).test(e)&&!/IEMobile\b/.test(e))return[wt+" "+H,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Ut[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[wt,r]}return[wt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[W,[t[3],t[4],t[5]||"0"].join(".")]:[W,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=O(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Y+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Y+")","i"),t=>t&&t[2]?[Y,[t[2],t[3],t[4]||"0"].join(".")]:[Y,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[st,""]],[/Linux|debian/i,["Linux",""]]],Lt=function(t){return kt.test(t)?vt:Ot.test(t)?pt:It.test(t)?ft:new RegExp(xt,"i").test(t)?xt:new RegExp("("+bt+"|WPDesktop)","i").test(t)?bt:/iPad/.test(t)?J:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?X:Mt.test(t)?Z:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(yt,"i").test(t)?yt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(H).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Y:G:new RegExp("(pda|"+H+")","i").test(t)?Et:new RegExp(V,"i").test(t)&&!new RegExp(V+" pc","i").test(t)?St:""},Ft=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={C(i){if(t&&(c.DEBUG||h.POSTHOG_DEBUG||r)&&!O(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Ft(e+" "+t,i)};return s},Bt=Ft("[PostHog.js]"),zt=Bt.createLogger,jt=zt("[ExternalScriptsLoader]"),qt=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return jt.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var u=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?u():null==r||r.addEventListener("DOMContentLoaded",u)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}qt(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");qt(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);qt(t,r,i)};var Ht="$people_distinct_id",Wt="$device_id",Yt="__alias",Vt="__timers",Gt="$dead_clicks_enabled_server_side",Jt="$sesid",Kt="$session_is_sampled",Xt="$enabled_feature_flags",Qt="$flag_call_reported",Zt="$feature_flag_evaluated_at",te="$user_state",ee="$client_session_props",ie="$capture_rate_limit",re="$initial_campaign_params",se="$initial_referrer_info",ne="$initial_person_info",oe="$epp",ae="$posthog_cookieless",ue="$sdk_debug_extensions_init_method",le="$sdk_debug_extensions_init_time_ms",he="on_reject",de="always",ce="anonymous",_e="identified",ve="identified_only",pe="visibilitychange",fe="beforeunload",ge="$pageview",me="$pageleave",we="$identify",be="$groupidentify";function ye(t,e){T(t)&&t.forEach(e)}function xe(t,e){if(!C(t))if(T(t))t.forEach(e);else if(L(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)E.call(t,i)&&e(t[i],i)}var $e=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},Ee=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Bt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Bt.critical(t)}}},Se=function(t){var e={};return xe(t,(function(t,i){(k(t)&&t.length>0||N(t))&&(e[i]=t)})),e};var Te=["herokuapp.com","vercel.app","netlify.app"];function Re(t){var e=null==t?void 0:t.hostname;if(!k(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Te)if(i===r)return!1;return!0}function Pe(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return N(t)&&isFinite(t)&&Math.floor(t)===t});class Ie{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Ie(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Ie(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Oe{constructor(){this.I=0,this.S=0,this.k=new Ue}generate(){var t=this.generateOrAbort();if(O(t)){this.I=0;var e=this.generateOrAbort();if(O(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Ie.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var ke,Me=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!O(t.crypto)&&crypto.getRandomValues&&(Me=t=>crypto.getRandomValues(t));class Ue{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Me(this.T),this.N=0),this.T[this.N++]}}var Ce=()=>Ne().toString(),Ne=()=>(ke||(ke=new Oe)).generate(),Ae="",De=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Le={R:()=>!!r,B(t){Bt.error("cookieStore error: "+t)},O(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(Le.O(t))||{}}catch(t){}return e},M(t,e,i,s,n){if(r)try{var o="",a="",u=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Ae)return Ae;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Ce();!Ae&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Ae=o)}return Ae}(t);if(!i){var s=(t=>{var e=t.match(De);return e?e[0]:""})(t);s!==i&&Bt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+u+a;return h.length>3686.4&&Bt.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},F(t,e){if(null!=r&&r.cookie)try{Le.M(t,"",-1,e)}catch(t){return}}},Fe=null,Be={R(){if(!U(Fe))return Fe;var e=!0;if(O(t))e=!1;else try{var i="__mplssupport__";Be.M(i,"xyz"),'"xyz"'!==Be.O(i)&&(e=!1),Be.F(i)}catch(t){e=!1}return e||Bt.error("localStorage unsupported; falling back to cookie store"),Fe=e,e},B(t){Bt.error("localStorage error: "+t)},O(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Be.B(t)}return null},Z(t){try{return JSON.parse(Be.O(t))||{}}catch(t){}return null},M(e,i){try{null==t||t.localStorage.setItem(e,JSON.stringify(i))}catch(t){Be.B(t)}},F(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Be.B(t)}}},ze=[Wt,"distinct_id",Jt,Kt,oe,ne,te],je={},qe={R:()=>!0,B(t){Bt.error("memoryStorage error: "+t)},O:t=>je[t]||null,Z:t=>je[t]||null,M(t,e){je[t]=e},F(t){delete je[t]}},He=null,We={R(){if(!U(He))return He;if(He=!0,O(t))He=!1;else try{var e="__support__";We.M(e,"xyz"),'"xyz"'!==We.O(e)&&(He=!1),We.F(e)}catch(t){He=!1}return He},B(t){Bt.error("sessionStorage error: ",t)},O(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){We.B(t)}return null},Z(t){try{return JSON.parse(We.O(t))||null}catch(t){}return null},M(e,i){try{null==t||t.sessionStorage.setItem(e,JSON.stringify(i))}catch(t){We.B(t)}},F(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){We.B(t)}}};class Ye{constructor(t){this._instance=t}get Lt(){return this._instance.config}get consent(){return this.tr()?0:this.rr}isOptedOut(){return this.Lt.cookieless_mode===de||this.isRejected()||-1===this.consent&&this.Lt.cookieless_mode===he}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Lt.opt_out_capturing_by_default}optInOut(t){this.ir.M(this.nr,t?1:0,this.Lt.cookie_expiration,this.Lt.cross_subdomain_cookie,this.Lt.secure_cookie)}reset(){this.ir.F(this.nr,this.Lt.cross_subdomain_cookie)}get nr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get rr(){var t=this.ir.O(this.nr);return z(t)?1:b(j,t)?0:-1}get ir(){var t=this.Lt.opt_out_capturing_persistence_type,e="localStorage"===t?Be:Le;if(!this.sr||this.sr!==e){this.sr=e;var i="localStorage"===t?Le:Be;i.O(this.nr)&&(this.sr.O(this.nr)||this.optInOut(z(i.O(this.nr))),i.F(this.nr,this.Lt.cross_subdomain_cookie))}return this.sr}tr(){return!!this.Lt.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>z(t)))}}zt("[Dead Clicks]");var Ve=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Gt)),r=t.instance.config.capture_dead_clicks;return D(r)?r:!!P(r)||i},Ge=zt("[SegmentIntegration]");var Je="posthog-js";function Ke(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,u,l,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var _,v=(null==(a=e.exception)?void 0:a.values)||[],f=v.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(u=v[0])?void 0:u.value)||e.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=v[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(_=t.exceptions)||_.sendExceptionEvent(g)),e}}class Xe{constructor(t,e,i,r,s,n){this.name=Je,this.setupOnce=function(o){o(Ke(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Qe{constructor(t){this.hr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Bt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.cr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.dr()}dr(){var t;this.vr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.hr)}destroy(){var t;null==(t=this.vr)||t.call(this),this.vr=void 0}doPageView(e,i){var r,s=this.pr(e,i);return this.cr={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.pr(t,null==(e=this.cr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.cr)?void 0:t.pageViewId}}pr(t,e){var i=this.cr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:u,lastContentY:l,maxContentY:h}=s;if(!(O(n)||O(o)||O(a)||O(u)||O(l)||O(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),h=Math.ceil(h);var d=n>1?q(o/n,0,1,Bt):1,c=n>1?q(a/n,0,1,Bt):1,_=u>1?q(l/u,0,1,Bt):1,v=u>1?q(h/u,0,1,Bt):1;r=$e(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ze={[Ht]:{exposure:"hidden"},[Yt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Vt]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[Gt]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},$session_recording_remote_config:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Jt]:{exposure:"hidden"},[Kt]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[Xt]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!P(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},$active_feature_flags:{exposure:"event"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden"},$feature_flag_payloads:{exposure:"event"},$feature_flag_request_id:{exposure:"event"},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden"},$surveys_activated:{exposure:"event"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Qt]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[Zt]:{exposure:"hidden"},[te]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[ie]:{exposure:"hidden"},[re]:{exposure:"hidden"},[se]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[oe]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[ue]:{exposure:"event"},[le]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},ti=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ei=t=>{var e=null==r?void 0:r.createElement("a");return O(e)?null:(e.href=t,e)},ii=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!T(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Bt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ri=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],u=(o||"").split("&"),l=[],h=0;u.length>h;h++){var d=u[h].split("=");T(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(u[h]))}var c=a;return null!=o&&(c+="?"+l.join("&")),null!=s&&(c+="#"+s),c},si="https?://(.*)",ni=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],oi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ni],ai="<masked>",ui=["li_fat_id"];function li(t,e){var i=oi.concat(e||[]),r={};return xe(i,(function(e){var i=ii(t,e);r[e]=i||null})),r}function hi(t){var e=function(t){return t?0===t.search(si+"google.([^/?]*)")?"google":0===t.search(si+"bing.com")?"bing":0===t.search(si+"yahoo.com")?"yahoo":0===t.search(si+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!U(e)){s.$search_engine=e;var n=r?ii(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function di(){return navigator.language||navigator.userLanguage}var ci="$direct";function _i(){return(null==r?void 0:r.referrer)||ci}function vi(t,e){var i=t?[...ni,...e||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:_i().substring(0,1e3),u:r?ri(r,i,ai):void 0}}function pi(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==ci?ci:null==(e=ei(i))?void 0:e.host};if(r){s.$current_url=r;var n=ei(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=li(r);$e(s,o)}if(i){var a=hi(i);$e(s,a)}return s}function fi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gi(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var mi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class wi{constructor(t,e){this.Lt=t,this.props={},this.gr=!1,this.mr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.ir=this.yr(t),this.load(),t.debug&&Bt.info("Persistence loaded",t.persistence,p({},this.props)),this.update_config(t,t,e),this.save()}isDisabled(){return!!this.br}yr(e){-1===mi.indexOf(e.persistence.toLowerCase())&&(Bt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i=function(e){void 0===e&&(e=[]);var i=[...ze,...e];return p({},Be,{Z(t){try{var e={};try{e=Le.Z(t)||{}}catch(t){}var i=$e(e,JSON.parse(Be.O(t)||"{}"));return Be.M(t,i),i}catch(t){}return null},M(t,e,r,s,n,o){try{Be.M(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&Le.M(t,a,r,s,n,o)}catch(t){Be.B(t)}},F(e,i){try{null==t||t.localStorage.removeItem(e),Le.F(e,i)}catch(t){Be.B(t)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&Be.R()?Be:"localstorage+cookie"===r&&i.R()?i:"sessionstorage"===r&&We.R()?We:"memory"===r?qe:"cookie"===r?Le:i.R()?i:Le}_r(t){var e=null!=t?t:this.Lt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Zt];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return xe(this.props,((e,i)=>{var r=(t=>{var e=Ze[t];if(e)return e;for(var[i,r]of ti)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===Xt?()=>this._r():()=>!1))return;r.transformToEventProperties&&$e(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this.br){var t=this.ir.Z(this.mr);t&&(this.props=$e({},t))}}save(){this.br||this.ir.M(this.mr,this.props,this.wr,this.Ir,this.Cr,this.Lt.debug)}remove(){this.ir.F(this.mr,!1),this.ir.F(this.mr,!0)}clear(){this.remove(),this.props={}}register_once(t,e,i){if(P(t)){O(e)&&(e="None"),this.wr=O(i)?this.Sr:i;var r=!1;if(xe(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.kr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(P(t)){this.wr=O(e)?this.Sr:e;var i=!1;if(xe(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.kr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){if(!this.gr){var t=function(t,e,i){if(!r)return{};var s,n=e?[...ni,...i||[]]:[],o=li(ri(r.URL,n,ai),t),a=(s={},xe(ui,(function(t){var e=Le.O(t);s[t]=e||null})),s);return $e(a,o)}(this.Lt.custom_campaign_params,this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties);I(Se(t))||this.register(t),this.gr=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?hi(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_i(),$referring_domain:null!=r&&r.referrer&&(null==(t=ei(r.referrer))?void 0:t.host)||ci},void 0)}set_initial_person_info(){this.props[re]||this.props[se]||this.register_once({[ne]:vi(this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};xe([se,re],(e=>{var i=this.props[e];i&&xe(i,(function(e,i){t["$initial_"+y(i)]=e}))}));var e,i,r=this.props[ne];if(r){var s=(e=pi(r),i={},xe(e,(function(t,e){i["$initial_"+y(e)]=t})),i);$e(t,s)}return t}safe_merge(t){return xe(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.Sr=this.wr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.yr(t),s=this.props;this.clear(),this.ir=r,this.props=s,this.save()}}set_disabled(t){this.br=t,this.br?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ir&&(this.Ir=t,this.remove(),this.save())}set_secure(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[Vt]||{};i[t]=e,this.kr(Vt,i),this.save()}remove_event_timer(t){var e=this.props[Vt]||{},i=e[t];return O(i)||(delete e[t],this.kr(Vt,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.kr(t,e),this.save()}kr(t,e){this.props[t]=e}Tr(t){delete this.props[t]}}var bi={Activation:"events",Cancellation:"cancelEvents"},yi={Button:"button",Tab:"tab",Selector:"selector"},xi={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},$i={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ei={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Si={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ti={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ri={Once:"once",Recurring:"recurring",Always:"always"},Pi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ii={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Oi={Popover:"popover",Inline:"inline"},ki={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Mi={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Ui={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ci=zt("[RateLimiter]");class Ni{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Ci.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Ci.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(ie))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var u=1>a.tokens;return u||t||(a.tokens=Math.max(0,a.tokens-1)),!u||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,null==(r=this.instance.persistence)||r.set_property(ie,a),{isRateLimited:u,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var Ai=zt("[RemoteConfig]");class Di{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ar(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Er(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return Ai.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void Ai.warn("Remote config is disabled. Falling back to local config.");this.Ar((t=>{if(!t)return Ai.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er((t=>{this.Rr(t),this.Nr()}));this.Rr(t),this.Nr()}))}catch(t){Ai.error("Error loading remote config",t)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.Fr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Fr=setInterval((()=>{this.refresh()}),e))}}Rr(t){var e;t||Ai.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var Li=["fatal","error","warning","log","info","debug"],Fi={GZipJS:"gzip-js",Base64:"base64"},Bi=Uint8Array,zi=Uint16Array,ji=Uint32Array,qi=new Bi([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]),Hi=new Bi([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]),Wi=new Bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yi=function(t,e){for(var i=new zi(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new ji(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Vi=Yi(qi,2),Gi=Vi[1];Vi[0][28]=258,Gi[258]=28;for(var Ji=Yi(Hi,0)[1],Ki=new zi(32768),Xi=0;32768>Xi;++Xi){var Qi=(43690&Xi)>>>1|(21845&Xi)<<1;Ki[Xi]=((65280&(Qi=(61680&(Qi=(52428&Qi)>>>2|(13107&Qi)<<2))>>>4|(3855&Qi)<<4))>>>8|(255&Qi)<<8)>>>1}var Zi=function(t,e,i){for(var r=t.length,s=0,n=new zi(e);r>s;++s)++n[t[s]-1];var o,a=new zi(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new zi(1<<e);var u=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)o[Ki[d]>>>u]=l}else for(o=new zi(r),s=0;r>s;++s)o[s]=Ki[a[t[s]-1]++]>>>15-t[s];return o},tr=new Bi(288);for(Xi=0;144>Xi;++Xi)tr[Xi]=8;for(Xi=144;256>Xi;++Xi)tr[Xi]=9;for(Xi=256;280>Xi;++Xi)tr[Xi]=7;for(Xi=280;288>Xi;++Xi)tr[Xi]=8;var er=new Bi(32);for(Xi=0;32>Xi;++Xi)er[Xi]=5;var ir=Zi(tr,9,0),rr=Zi(er,5,0),sr=function(t){return(t/8>>0)+(7&t&&1)},nr=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof zi?zi:t instanceof ji?ji:Bi)(i-e);return r.set(t.subarray(e,i)),r},or=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},ar=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ur=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Bi(0),0];if(1==s){var o=new Bi(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],u=i[1],l=0,h=1,d=2;for(i[0]={s:-1,f:a.f+u.f,l:a,r:u};h!=s-1;)a=i[i[d].f>i[l].f?l++:d++],u=i[l!=h&&i[d].f>i[l].f?l++:d++],i[h++]={s:-1,f:a.f+u.f,l:a,r:u};var c=n[0].s;for(r=1;s>r;++r)n[r].s>c&&(c=n[r].s);var _=new zi(c+1),v=lr(i[h-1],_,0);if(v>e){r=0;var p=0,f=v-e,g=1<<f;for(n.sort((function(t,e){return _[e.s]-_[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=_[m])break;p+=g-(1<<v-_[m]),_[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>_[w]?p-=1<<e-_[w]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;_[b]==e&&(--_[b],++p)}v=e}return[new Bi(_),v]},lr=function(t,e,i){return-1==t.s?Math.max(lr(t.l,e,i+1),lr(t.r,e,i+1)):e[t.s]=i},hr=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new zi(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},dr=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},cr=function(t,e,i){var r=i.length,s=sr(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},_r=function(t,e,i,r,s,n,o,a,u,l,h){or(e,h++,i),++s[256];for(var d=ur(s,15),c=d[0],_=d[1],v=ur(n,15),p=v[0],f=v[1],g=hr(c),m=g[0],w=g[1],b=hr(p),y=b[0],x=b[1],E=new zi(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;y.length>S;++S)E[31&y[S]]++;for(var T=ur(E,7),R=T[0],P=T[1],I=19;I>4&&!R[Wi[I-1]];--I);var O,k,M,U,C=l+5<<3,N=dr(s,tr)+dr(n,er)+o,A=dr(s,c)+dr(n,p)+o+14+3*I+dr(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(N>=C&&A>=C)return cr(e,h,t.subarray(u,u+l));if(or(e,h,1+(N>A)),h+=2,N>A){O=Zi(c,_,0),k=c,M=Zi(p,f,0),U=p;var D=Zi(R,P,0);for(or(e,h,w-257),or(e,h+5,x-1),or(e,h+10,I-4),h+=14,S=0;I>S;++S)or(e,h+3*S,R[Wi[S]]);h+=3*I;for(var L=[m,y],F=0;2>F;++F){var B=L[F];for(S=0;B.length>S;++S)or(e,h,D[z=31&B[S]]),h+=R[z],z>15&&(or(e,h,B[S]>>>5&127),h+=B[S]>>>12)}}else O=ir,k=tr,M=rr,U=er;for(S=0;a>S;++S)if(r[S]>255){var z;ar(e,h,O[257+(z=r[S]>>>18&31)]),h+=k[z+257],z>7&&(or(e,h,r[S]>>>23&31),h+=qi[z]);var j=31&r[S];ar(e,h,M[j]),h+=U[j],j>3&&(ar(e,h,r[S]>>>5&8191),h+=Hi[j])}else ar(e,h,O[r[S]]),h+=k[r[S]];return ar(e,h,O[256]),h+k[256]},vr=new ji([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pr=function(){for(var t=new ji(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),fr=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function gr(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=pr[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,u,l=(a=10+((s=e).filename&&s.filename.length+1||0),u=8,function(t,e,i,r,s,n){var o=t.length,a=new Bi(r+o+5*(1+Math.floor(o/7e3))+s),u=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?l=cr(u,l,t.subarray(h,d)):(u[h]=!0,l=cr(u,l,t.subarray(h,o)))}else{for(var c=vr[e-1],_=c>>>13,v=8191&c,p=(1<<i)-1,f=new zi(32768),g=new zi(p+1),m=Math.ceil(i/3),w=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},y=new ji(25e3),x=new zi(288),E=new zi(32),S=0,T=0,R=(h=0,0),P=0,I=0;o>h;++h){var O=b(h),k=32767&h,M=g[O];if(f[k]=M,g[O]=k,h>=P){var U=o-h;if((S>7e3||R>24576)&&U>423){l=_r(t,u,0,y,x,E,T,R,I,h-I,l),R=S=T=0,I=h;for(var C=0;286>C;++C)x[C]=0;for(C=0;30>C;++C)E[C]=0}var N=2,A=0,D=v,L=k-M&32767;if(U>2&&O==b(h-L))for(var F=Math.min(_,U)-1,B=Math.min(32767,h),z=Math.min(258,U);B>=L&&--D&&k!=M;){if(t[h+N]==t[h+N-L]){for(var j=0;z>j&&t[h+j]==t[h+j-L];++j);if(j>N){if(N=j,A=L,j>F)break;var q=Math.min(L,j-2),H=0;for(C=0;q>C;++C){var W=h-L+C+32768&32767,Y=W-f[W]+32768&32767;Y>H&&(H=Y,M=W)}}}L+=(k=M)-(M=f[k])+32768&32767}if(A){y[R++]=268435456|Gi[N]<<18|Ji[A];var V=31&Gi[N],G=31&Ji[A];T+=qi[V]+Hi[G],++x[257+V],++E[G],P=h+N,++S}else y[R++]=t[h],++x[t[h]]}}l=_r(t,u,!0,y,x,E,T,R,I,h-I,l)}return nr(a,0,r+sr(l)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,u)),h=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&fr(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),fr(l,h-8,i.d()),fr(l,h-4,r),l}var mr=!!o||!!n,wr="text/plain",br=!1,yr=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=p({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return xe(t,(function(t,e){O(t)||O(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return u&&a.push(u),s+"?"+a.join("&")},xr=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),$r=t=>{if(t.er)return t.er;var{data:e,compression:i}=t;if(e){if(i===Fi.GZipJS){var r=gr(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Bi(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Bi(s+8+(i-o<<1));a.set(r),r=a}var u=t.charCodeAt(o);128>u?n(u):2048>u?(n(192|u>>>6),n(128|63&u)):u>55295&&57344>u?(n(240|(u=65536+(1047552&u)|1023&t.charCodeAt(++o))>>>18),n(128|u>>>12&63),n(128|u>>>6&63),n(128|63&u)):(n(224|u>>>12),n(128|u>>>6&63),n(128|63&u))}return nr(r,0,s)}(xr(e)),{mtime:0});return{contentType:wr,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Fi.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(xr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:xr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=xr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Er=function(){var t=v((function*(t){var e=xr(t.data),i=yield function(t,e,i){return f.apply(this,arguments)}(e,c.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{er:{contentType:wr,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Sr=(t,e)=>yr(t,{_:(new Date).getTime().toString(),ver:c.JS_SDK_VERSION,compression:e}),Tr=[];n&&Tr.push({transport:"fetch",method(t){var e,i,{contentType:r,body:s,estimatedSize:o}=null!==(e=$r(t))&&void 0!==e?e:{},u=new Headers;xe(t.headers,(function(t,e){u.append(e,t)})),r&&u.append("Content-Type",r);var l=t.url,h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(l,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(o||0),body:s,signal:null==(i=h)?void 0:i.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Bt.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{Bt.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&Tr.push({transport:"XHR",method(t){var e,i=new o;i.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(e=$r(t))&&void 0!==e?e:{};xe(t.headers,(function(t,e){i.setRequestHeader(e,t)})),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),t.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(s)}}),null!=i&&i.sendBeacon&&Tr.push({transport:"sendBeacon",method(t){var e=yr(t.url,{beacon:"1"});try{var r,{contentType:s,body:n}=null!==(r=$r(t))&&void 0!==r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});i.sendBeacon(e,o)}catch(t){}}});var Rr=3e3;class Pr{constructor(t,e){this.Or=!0,this.Pr=[],this.Lr=q((null==e?void 0:e.flush_interval_ms)||Rr,250,5e3,Bt.createLogger("flush interval"),Rr),this.Dr=t}enqueue(t){this.Pr.push(t),this.Br||this.jr()}unload(){this.$r();var t=this.Pr.length>0?this.qr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Dr(p({},t,{transport:"sendBeacon"}))}))}enable(){this.Or=!1,this.jr()}jr(){var t=this;this.Or||(this.Br=setTimeout((()=>{if(this.$r(),this.Pr.length>0){var e=this.qr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&T(i.data)&&xe(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Dr(i)};for(var r in e)i()}}),this.Lr))}$r(){clearTimeout(this.Br),this.Br=void 0}qr(){var t={};return xe(this.Pr,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;O(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.Pr=[],t}}var Ir=["retriesPerformedSoFar"];class Or{constructor(e){this.Zr=!1,this.Hr=3e3,this.Pr=[],this._instance=e,this.Pr=[],this.Vr=!0,!O(t)&&"onLine"in t.navigator&&(this.Vr=t.navigator.onLine,this.zr=()=>{this.Vr=!0,this.Ur()},this.Yr=()=>{this.Vr=!1},Pe(t,"online",this.zr),Pe(t,"offline",this.Yr))}get length(){return this.Pr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ir);A(e)&&(i.url=yr(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==i.callback||i.callback(t):this.Wr(p({retriesPerformedSoFar:e},i))}}))}Wr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Pr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Bt.warn(s),this.Zr||(this.Zr=!0,this.Gr())}Gr(){if(this.Xr&&clearTimeout(this.Xr),0===this.Pr.length)return this.Zr=!1,void(this.Xr=void 0);this.Xr=setTimeout((()=>{this.Vr&&this.Pr.length>0&&this.Ur(),this.Gr()}),this.Hr)}Ur(){var t=Date.now(),e=[],i=this.Pr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Pr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Xr&&(clearTimeout(this.Xr),this.Xr=void 0),this.Zr=!1,O(t)||(this.zr&&(t.removeEventListener("online",this.zr),this.zr=void 0),this.Yr&&(t.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.Pr))try{this._instance._send_request(p({},e,{transport:"sendBeacon"}))}catch(t){Bt.error(t)}this.Pr=[]}}class kr{constructor(t){this.Jr=()=>{var t,e,i,r;this.Kr||(this.Kr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),u=(null==s?void 0:s.scrollHeight)||0;this.Kr.lastScrollY=Math.ceil(n),this.Kr.maxScrollY=Math.max(n,null!==(t=this.Kr.maxScrollY)&&void 0!==t?t:0),this.Kr.maxScrollHeight=Math.max(o,null!==(e=this.Kr.maxScrollHeight)&&void 0!==e?e:0),this.Kr.lastContentY=a,this.Kr.maxContentY=Math.max(a,null!==(i=this.Kr.maxContentY)&&void 0!==i?i:0),this.Kr.maxContentHeight=Math.max(u,null!==(r=this.Kr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Kr}resetContext(){var t=this.Kr;return setTimeout(this.Jr,0),t}startMeasuringScrollPosition(){Pe(t,"scroll",this.Jr,{capture:!0}),Pe(t,"scrollend",this.Jr,{capture:!0}),Pe(t,"resize",this.Jr)}scrollElement(){if(!this.Qr)return null==t?void 0:t.document.documentElement;var e=T(this.Qr)?this.Qr:[this.Qr];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}scrollY(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var Mr=t=>vi(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Ur{constructor(t,e,i,r){this.ei=t=>{var e=this.ti();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ri(this._instance)};this.ii.register({[ee]:i})}},this._instance=t,this.ni=e,this.ii=i,this.ri=r||Mr,this.ni.onSessionId(this.ei)}ti(){return this.ii.props[ee]}getSetOnceProps(){var t,e=null==(t=this.ti())?void 0:t.props;return e?"r"in e?pi(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return xe(Se(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+y(i)]=e})),t}}class Cr{constructor(){this.si={}}on(t,e){return this.si[t]||(this.si[t]=[]),this.si[t].push(e),()=>{this.si[t]=this.si[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.si[t]||[])i(e);for(var r of this.si["*"]||[])r(t,e)}}var Nr=zt("[SessionId]");class Ar{on(t,e){return this.oi.on(t,e)}constructor(t,e,i){var r;if(this.ai=[],this.li=void 0,this.oi=new Cr,this.ui=(t,e)=>!(!A(t)||!A(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===de)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Lt=t.config,this.ii=t.persistence,this.hi=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.di=e||Ce,this.vi=i||Ce;var s=this.Lt.persistence_name||this.Lt.token;if(this._sessionTimeoutMs=1e3*q(this.Lt.session_idle_timeout_seconds||1800,60,36e3,Nr.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+s+"_window_id",this.gi="ph_"+s+"_primary_window_exists",this.mi()){var n=We.Z(this.pi),o=We.Z(this.gi);n&&!o?this.hi=n:We.F(this.pi),We.M(this.gi,!0)}if(null!=(r=this.Lt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Lt.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.yi(this.Lt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Nr.error("Invalid sessionID in bootstrap",t)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return O(this.ai)&&(this.ai=[]),this.ai.push(t),this.ci&&t(this.ci,this.hi),()=>{this.ai=this.ai.filter((e=>e!==t))}}mi(){return"memory"!==this.Lt.persistence&&!this.ii.br&&We.R()}wi(t){t!==this.hi&&(this.hi=t,this.mi()&&We.M(this.pi,t))}Ii(){return this.hi?this.hi:this.mi()?We.Z(this.pi):null}yi(t,e,i){t===this.ci&&e===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.ci=t,this.ii.register({[Jt]:[e,t,i]}))}Ci(){var t=this.ii.props[Jt];return T(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.yi(null,null,null)}destroy(){clearTimeout(this.Si),this.Si=void 0,this.li&&t&&(t.removeEventListener(fe,this.li,{capture:!1}),this.li=void 0),this.ai=[]}bi(){this.li=()=>{this.mi()&&We.F(this.gi)},Pe(t,fe,this.li,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Lt.cookieless_mode===de)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[r,s,n]=this.Ci(),o=this.Ii(),a=A(n)&&Math.abs(i-n)>864e5,u=!1,l=!s,h=!l&&!t&&this.ui(i,r);l||h||a?(s=this.di(),o=this.vi(),Nr.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:l,activityTimeout:h,sessionPastMaximumLength:a}}),n=i,u=!0):o||(o=this.vi(),u=!0);var d=A(r)&&t&&!a?r:i,c=A(n)?n:(new Date).getTime();return this.wi(o),this.yi(s,d,c),t||this.fi(),u&&this.ai.forEach((t=>t(s,o,u?{noSessionId:l,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:c,changeReason:u?{noSessionId:l,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}fi(){clearTimeout(this.Si),this.Si=setTimeout((()=>{var[t]=this.Ci();if(this.ui((new Date).getTime(),t)){var e=this.ci;this.resetSessionId(),this.oi.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}function Dr(t,e,i){return xr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Lr="custom",Fr="i.posthog.com",Br=/^\/static\//;class zr{constructor(t){this.xi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Fr,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.xi[this.apiHost]||(this.xi[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":Lr),this.xi[this.apiHost]}ki(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&Br.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.ki(e);if(i)return""+i+e}if(this.region===Lr)return this.apiHost+e;var r=Fr+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var jr=zt("[Surveys]"),qr={ignoreConditions:!1,ignoreDelay:!1,displayType:Oi.Popover},Hr=zt("[PostHog ExternalIntegrations]"),Wr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Yr{constructor(t){this._instance=t}lr(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Hr.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.lr(Wr[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Vr,Gr={},Jr=0,Kr=()=>{},Xr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Qr="Surveys module not available",Zr="sanitize_properties is deprecated. Use before_send instead",ts="Invalid value for property_denylist config: ",es="posthog",is=!mr&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),rs=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Re(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kr,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,__preview_external_dependency_versioned_paths:!1,debug:s&&k(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Bt.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ve,before_send:void 0,request_queue_config:{flush_interval_ms:Rr},error_tracking:{},_onCapture:Kr,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},ss=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],ns=t=>{var e={};for(var[i,r]of ss)O(t[i])||(e[r]=t[i]);var s=$e({},e,t);return T(t.property_blacklist)&&(O(t.property_denylist)?s.property_denylist=t.property_blacklist:T(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:Bt.error(ts+t.property_denylist)),s};class os{constructor(){this.__forceAllowLocalhost=!1}get Ti(){return this.__forceAllowLocalhost}set Ti(t){Bt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class as{Ai(t,e){if(t){var i=this.Ei.indexOf(t);-1!==i&&this.Ei.splice(i,1)}return this.Ei.push(e),null==e.initialize||e.initialize(),e}Ri(){return this.config.cookieless_mode===de||this.config.cookieless_mode===he&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new os,this.Ni=!1,this.version=c.LIB_VERSION,this.Mi=new Cr,this.Ei=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rs(),this.SentryIntegration=Xe,this.sentryIntegration=t=>function(t,e){var i=Ke(t,e);return{name:Je,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Oi=null,this.Pi=null,this.Li=null,this.scrollManager=new kr(this),this.pageViewManager=new Qe(this),this.rateLimiter=new Ni(this),this.requestRouter=new zr(this),this.consent=new Ye(this),this.externalIntegrations=new Yr(this);var e=null!==(t=as.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=k(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=k(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Bt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==es){var r,s=null!==(r=Gr[i])&&void 0!==r?r:new as;return s._init(t,e,i),Gr[i]=s,Gr[es][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;if(void 0===i&&(i={}),O(e)||M(e))return Bt.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={},i.debug=this.Di(i.debug),this.Bi=i,this.ji=[],i.person_profiles?this.Pi=i.person_profiles:i.process_person&&(this.Pi=i.process_person),this.set_config($e({},rs(i.defaults),ns(i),{name:r,token:e})),this.config.on_xhr_error&&Bt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Fi.GZipJS;var o=this.$i();this.persistence=new wi(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new wi(p({},this.config,{persistence:"sessionStorage"}),o);var a=p({},this.persistence.props),u=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qi=new Pr((t=>this.Zi(t)),this.config.request_queue_config),this.Hi=new Or(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new Ar(this),this.sessionPropsManager=new Ur(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Bt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Vi(l)}),0)):(Bt.info("Initializing extensions synchronously"),this.Vi(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Bt.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:a,s:u}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var h=i.bootstrap.distinctID,d=this.get_distinct_id(),_=this.persistence.get_property(te);if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&_===ce)this.identify(h);else if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&_===_e)Bt.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 v=this.config.get_device_id(Ce()),f=i.bootstrap.isIdentifiedID?v:h;this.persistence.set_property(te,i.bootstrap.isIdentifiedID?_e:ce),this.register({distinct_id:h,$device_id:f})}}if(l)this.register_once({distinct_id:ae,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Ce());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(te,ce)}return Pe(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Ce();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(te,_e)),e()},s=i.user();"then"in s&&R(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||Ge.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Ge.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Ge.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ge),identify:t=>e(t,we),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.zi())):this.zi(),R(this.config._onCapture)&&this.config._onCapture!==Kr&&(Bt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Bt.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}Vi(t){var e,i,r,s,n,o,a,u=performance.now(),l=p({},as.__defaultExtensionClasses,this.config.__extensionClasses),h=[];l.featureFlags&&this.Ei.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new l.featureFlags(this)),l.exceptions&&this.Ei.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new l.exceptions(this)),l.historyAutocapture&&this.Ei.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.Ei.push(new l.tracingHeaders(this)),l.siteApps&&this.Ei.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.Ei.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.Ei.push(this.autocapture=new l.autocapture(this)),l.surveys&&this.Ei.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new l.surveys(this)),l.logs&&this.Ei.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new l.logs(this)),l.conversations&&this.Ei.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.Ei.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.Ei.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.Ei.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.Ei.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.Ei.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Ve)),l.toolbar&&this.Ei.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.Ei.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.Ei.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Ui){var t=this.Ui;this.Ui=void 0,this.Rr(t)}})),this.Yi(h,u)}Yi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Yi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Bt.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ue]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[le]:r}),this.config.__preview_deferred_init_extensions&&Bt.info("PostHog extensions initialized ("+r+"ms)")}Rr(t){var e;if(!r||!r.body)return Bt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Rr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ui=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=b(t.supportedCompression,Fi.GZipJS)?Fi.GZipJS:b(t.supportedCompression,Fi.Base64)?Fi.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:ve}),this.Ei.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}zi(){try{this.config.loaded(this)}catch(t){Bt.critical("`loaded` function failed",t)}if(this.Gi(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ri())&&this.Xi()}),1),this.Ji=new Di(this),this.Ji.load()}Gi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.qi)||t.enable())}_dom_loaded(){this.is_capturing()&&ye(this.__request_queue,(t=>this.Zi(t))),this.__request_queue=[],this.Gi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Ki()&&this.capture(me),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.qi)||i.unload(),null==(r=this.Hi)||r.unload()):this.Ki()&&this.capture(me,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(is?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=yr(t.url,{ip:this.config.ip?1:0}),t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=Sr(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=Tr.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Fi.GZipJS&&u&&!br?Er(s).then((t=>{a(t)})).catch((e=>{if((t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(e))return br=!0,void a(p({},s,{compression:void 0,url:Sr(t.url,void 0)}));a(s)})):a(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Zi(t){this.Hi?this.Hi.retriableRequest(t):this._send_request(t)}_execute_array(t){Jr++;try{var e,i=[],r=[],s=[];ye(t,(t=>{t&&(T(e=t[0])?s.push(t):R(t)?t.call(this):T(t)&&"alias"===e?i.push(t):T(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t))}));var n=function(t,e){ye(t,(function(t){if(T(t[0])){var i=e;xe(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}))};n(i,this),n(r,this),n(s,this)}finally{Jr--}}push(t){if(Jr>0&&T(t)&&k(t[0])){var e=as.prototype[t[0]];R(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qi){if(this.is_capturing())if(!O(t)&&k(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var l=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=e&&e.$current_url&&!k(null==e?void 0:e.$current_url)&&(Bt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.Qi||Bt.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,c=Ce(),_={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},d,c)};t===ge&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),l&&(_.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens),(null==i?void 0:i.$set)&&(_.$set=null==i?void 0:i.$set);var v,f,g,m=this.en(null==i?void 0:i.$set_once,t!==be,t===we);if(m&&(_.$set_once=m),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=_,o=t=>k(t)?t.slice(0,s):t,a=new Set,_=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),T(e)?(r=[],ye(e,(e=>{r.push(t(e))}))):(r={},xe(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),_.timestamp=d,O(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=h),t===Pi.DISMISSED||t===Pi.SENT){var w=null==e?void 0:e[Ii.SURVEY_ID],b=null==e?void 0:e[Ii.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>{var i=""+t+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+t+e.id+"_"+e.current_iteration),i})("seenSurvey_",t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){jr.error("Failed to persist survey seen state",t)}})({id:w,current_iteration:b}),_.$set=p({},_.$set,{[(v={id:w,current_iteration:b},f=t===Pi.SENT?"responded":"dismissed",g="$survey_"+f+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(g="$survey_"+f+"/"+v.id+"/"+v.current_iteration),g)]:!0})}else t===Pi.SHOWN&&(_.$set=p({},_.$set,{[Ii.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Mi.SHOWN){var y=null==e?void 0:e[Ui.TOUR_TYPE];y&&(_.$set=p({},_.$set,{[Ui.TOUR_LAST_SEEN_DATE+"/"+y]:(new Date).toISOString()}))}var x=p({},_.properties.$set,_.$set);if(I(x)||this.setPersonPropertiesForFlags(x),!C(this.config.before_send)){var E=this.tn(_);if(!E)return;_=E}this.Mi.emit("eventCaptured",_);var S={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,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.Zi(S):this.qi.enqueue(S),_}Bt.critical("This capture call is ignored due to client rate limiting.")}}else Bt.error("No event name provided to posthog.capture")}else Bt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var u=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Ri()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!k(h.distinct_id)&&!N(h.distinct_id)||M(h.distinct_id))&&Bt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var _,v=function(e,i){var r,n,o,a;if(!l)return{};var u,h,d,_,v,p,f,g,m=e?[...ni,...i||[]]:[],[w,b]=function(t){for(var e=0;Dt.length>e;e++){var[i,r]=Dt[e],s=i.exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(l);return $e(Se({$os:w,$os_version:b,$browser:Ct(l,navigator.vendor),$device:Lt(l),$device_type:(h=l,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},g=Lt(h),g===J||g===G||"Kobo"===g||"Kindle Fire"===g||g===St?V:g===vt||g===ft||g===pt||g===xt?"Console":g===X?"Wearable":g?H:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(_=null==d?void 0:d.maxTouchPoints)&&void 0!==_?_:0)>0?600>Math.min(null!==(v=null==d?void 0:d.screenWidth)&&void 0!==v?v:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(f=null==d?void 0:d.devicePixelRatio)&&void 0!==f?f:1)?H:V:"Desktop"),$timezone:fi(),$timezone_offset:gi()}),{$current_url:ri(null==s?void 0:s.href,m,ai),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:At(l,navigator.vendor),$browser_language:di(),$browser_language_prefix:(u=di(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:c.LIB_NAME,$lib_version:c.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:f,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=f,h.$window_id=g}this.sessionPropsManager&&$e(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&$e(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Hi)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Lr&&(h.$lib_custom_api_host=this.config.api_host),_=e!==ge||a?e!==me||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=$e(h,_),e===ge&&r&&(h.title=r.title),!O(u)){var w=n.getTime()-u;h.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=$e({},v,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?xe(this.config.property_denylist,(function(t){delete h[t]})):Bt.error(ts+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Bt.error(Zr),h=b(h,e));var y=this.rn();return h.$process_person_profile=y,y&&!a&&this.nn("_calculate_event_properties"),h}en(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.rn())return t;if(this.Ni&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=$e({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Bt.error(Zr),o=a(o,"$set_once")),e&&(this.Ni=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}sn(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Mi.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Qr}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Qr})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Qr})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=qr),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Qr}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Qr})}an(t){return!t||M(t)?(Bt.critical("Unique user id has not been set in posthog.identify"),!1):t===ae?(Bt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Bt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Bt.uninitializedWarning("posthog.identify");if(N(t)&&(t=t.toString(),Bt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.an(t)&&this.nn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Wt)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(Yt)&&(this.unregister(Yt),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(te)||ce)===ce;t!==r&&n?(this.persistence.set_property(te,_e),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(we,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Li=Dr(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(Qt))}}setPersonProperties(t,e){if((t||e)&&this.nn("posthog.setPersonProperties")){var i=Dr(this.get_distinct_id(),t,e);this.Li!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Li=i):Bt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(be,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else Bt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.nn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,u;if(Bt.info("reset"),!this.__loaded)return Bt.uninitializedWarning("posthog.reset");var l=this.get_property(Wt);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Ji)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(te,ce),null==(u=this.sessionManager)||u.resetSessionId(),this.Li=null,this.config.cookieless_mode===de)this.register_once({distinct_id:ae,$device_id:null},"");else{var h=this.config.get_device_id(Ce());this.register_once({distinct_id:h,$device_id:t?h:l},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.un()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(Ht)?(Bt.critical("Attempting to create alias for existing People user - aborting."),-2):this.nn("posthog.alias")?(O(e)&&(e=this.get_distinct_id()),t!==e?(this.sn(Yt,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Bt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(P(t)){var i,r,s,n,o,a,u,l,h,d;$e(this.config,ns(t));var _=this.$i();null==(i=this.persistence)||i.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new wi(p({},this.config,{persistence:"sessionStorage"}),_);var v=this.Di(this.config.debug);D(v)&&(this.config.debug=v),D(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Be.R()&&Be.M("ph_debug",!0),Bt.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(c.DEBUG=!1,Be.R()&&Be.F("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this.hn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){c.LIB_NAME=t,c.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:as.cn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:es;return e!==es&&(e=es+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(te))===_e||(null==(e=this.sessionPersistence)?void 0:e.get_property(te))===_e}rn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ve&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Yt])&&(null==(e=this.persistence)||null==(e=e.props)||!e[oe]))}Ki(){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.rn()||this.nn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.nn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}nn(t){return"never"===this.config.person_profiles?(Bt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sn(oe,!0),!0)}$i(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==he)}hn(){var t,e,i,r,s=this.$i();return(null==(t=this.persistence)?void 0:t.br)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.br)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==de){if(this.Ri()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ar(this),this.pageViewManager=new Qe(this),this.persistence&&(this.sessionPropsManager=new Ur(this,this.sessionManager,this.persistence));var a,u=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=as.__defaultExtensionClasses)?void 0:o.sessionRecording;u&&(this.sessionRecording=this.Ai(this.sessionRecording,new u(this)),this.Wi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Wi)))}var l,h;this.consent.optInOut(!0),this.hn(),this.Gi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==he&&(null==(l=this.surveys)||l.loadIfEnabled()),(O(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Xi()}else Bt.warn(Xr)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==de?(this.config.cookieless_mode===he&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.hn(),this.config.cookieless_mode===he&&(this.register({distinct_id:ae,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Xi())):Bt.warn(Xr)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===de||(this.config.cookieless_mode===he?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hn()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&m(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>m(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}Xi(){r&&("visible"===r.visibilityState?this.Fi||(this.Fi=!0,this.capture(ge,{title:r.title},{send_instantly:!0}),this.Oi&&(r.removeEventListener(pe,this.Oi),this.Oi=null)):this.Oi||(this.Oi=this.Xi.bind(this),Pe(r,pe,this.Oi)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Mr(){var t,e,i,r,s,n,o=this.Bi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Bt.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",!1,r=Bt,s=(e="advanced_disable_flags")in(t=o)&&!C(t[e]),n=i in t&&!C(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}tn(t){if(C(this.config.before_send))return t;var e=T(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),C(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return F(t.event)?Bt.warn(s+". This can cause unexpected behavior."):Bt.info(s),null}i.properties&&!I(i.properties)||Bt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.cr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Di(t){var e=D(t)&&!t,i=Be.R()&&"true"===Be.O("ph_debug");return!e&&(!!i||t)}}as.__defaultExtensionClasses={},as.cn={trace:Vr=()=>{},debug:Vr,info:Vr,warn:Vr,error:Vr,fatal:Vr},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Ee(t.prototype[e[i]])}(as,["identify"]);var us,ls=(us=Gr[es]=new as,function(){function e(){e.done||(e.done=!0,is=!1,xe(Gr,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():Pe(r,"DOMContentLoaded",e,{capture:!1}):t&&Bt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),us);export{Fi as Compression,ki as DEFAULT_PRODUCT_TOUR_APPEARANCE,Oi as DisplaySurveyType,as as PostHog,Mi as ProductTourEventName,Ui as ProductTourEventProperties,Pi as SurveyEventName,Ii as SurveyEventProperties,bi as SurveyEventType,xi as SurveyPosition,Ti as SurveyQuestionBranchingType,Si as SurveyQuestionType,Ri as SurveySchedule,$i as SurveyTabPosition,Ei as SurveyType,yi as SurveyWidgetType,ls as default,ls as posthog,Li as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.js.map
|