posthog-js 1.407.7 → 1.407.8
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/customizations.full.js +1 -1
- package/dist/customizations.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/lib/package.json +1 -1
- package/package.json +3 -3
- package/react/dist/umd/index.js +20 -15
- package/react/dist/umd/index.js.map +1 -1
- package/react/dist/umd/slim/index.js +18 -14
- package/react/dist/umd/slim/index.js.map +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}var s={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.407.7",s.LIB_NAME="web";var r="$people_distinct_id",n="$device_id",o="$device_model",a="__alias",l="__timers",u="$dead_clicks_enabled_server_side",_="$session_recording_remote_config",d="$sesid",c="$session_is_sampled",h="$enabled_feature_flags",p="$minimal_flag_called_events",g="$surveys_loaded_at",v="$flag_call_reported",f="$feature_flag_evaluated_at",m="$user_state",y="$client_session_props",b="$capture_rate_limit",w="$initial_campaign_params",S="$initial_referrer_info",x="$initial_person_info",E="$epp",P="$posthog_cookieless",T="$cookieless_mode",I="$sdk_debug_extensions_init_method",k="$sdk_debug_extensions_init_time_ms",R="on_reject",C="always",O="anonymous",A="identified",F="identified_only",M="visibilitychange",L="beforeunload",D="$pageview",U="$pageleave",N="$identify",q="$groupidentify",B="undefined"!=typeof window?window:void 0,H="undefined"!=typeof globalThis?globalThis:B,G=null==H?void 0:H.navigator,z=null==H?void 0:H.document,V=null==H?void 0:H.location,j=null==H?void 0:H.fetch,W=null!=H&&H.XMLHttpRequest&&"withCredentials"in new H.XMLHttpRequest?H.XMLHttpRequest:void 0,Y=null==H?void 0:H.AbortController,K=null==H?void 0:H.CompressionStream,J=null==G?void 0:G.userAgent,Q="undefined"!=typeof globalThis?globalThis:B;Q&&"undefined"==typeof self&&(Q.self=Q),Q&&"undefined"==typeof File&&(Q.File=function(){});var X,Z=null!=B?B:{},ee=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],te=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ie=["$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"],se=["token"],re="NativeGzipValidationError",ne=e=>e.length>=2&&31===e[0]&&139===e[1],oe=(e,t)=>e===te.GZipJS||t===te.GZipJS||"gzip"===t,ae=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),le=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=re,t},ue=function(){var e=t((function*(e,t){18>e.size&&le("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ne(i)&&8===i[2]||le("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(X)return X;X=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;X[e]=t>>>0}return X})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&le("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&le("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function _e(){return _e=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield ue(u,r),u}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),_e.apply(this,arguments)}var de=["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"],ce=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return de.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function he(e,t){return-1!==e.indexOf(t)}var pe=function(e){return e.replace(/^\$/,"")},ge=Object.prototype,ve=ge.hasOwnProperty,fe=ge.toString,me=Array.isArray||function(e){return"[object Array]"===fe.call(e)},ye=e=>"function"==typeof e,be=e=>e===Object(e)&&!me(e),we=e=>{if(be(e)){for(var t in e)if(ve.call(e,t))return!1;return!0}return!1},Se=e=>void 0===e,xe=e=>"[object String]"==fe.call(e),Ee=e=>xe(e)&&0===e.trim().length,Pe=e=>null===e,Te=e=>Se(e)||Pe(e),Ie=e=>"[object Number]"==fe.call(e)&&e==e,$e=e=>Ie(e)&&e>0,ke=e=>"[object Boolean]"===fe.call(e),Re=e=>e instanceof FormData,Ce=e=>he(ie,e),Oe=e=>he(se,e),Ae=[!0,"true",1,"1","yes"],Fe=e=>he(Ae,e),Me=[!1,"false",0,"0","no"];function Le(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Ie(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Le(r||i,t,i,s))}var De="Mobile",Ue="iOS",Ne="Android",qe="Tablet",Be=Ne+" "+qe,He="iPad",Ge="Apple",ze=Ge+" Watch",Ve="Safari",je="BlackBerry",We="Samsung",Ye=We+"Browser",Ke=We+" Internet",Je="Chrome",Qe=Je+" OS",Xe=Je+" "+Ue,Ze="Internet Explorer",et=Ze+" "+De,tt="Opera",it=tt+" Mini",st="Edge",rt="Microsoft "+st,nt="Firefox",ot=nt+" "+Ue,at="Nintendo",lt="PlayStation",ut="Xbox",_t=Ne+" "+De,dt=De+" "+Ve,ct="Windows",ht=ct+" Phone",pt="Nokia",gt="Ouya",vt="Generic",ft=vt+" "+De.toLowerCase(),mt=vt+" "+qe.toLowerCase(),yt="Konqueror",bt="Oculus Browser",wt="Vivaldi",St="Yandex",xt="Whale",Et="DuckDuckGo",Pt="Pale Moon",Tt="Waterfox",It="Brave",$t="Google Search App",kt="(\\d+(\\.\\d+)?)",Rt=new RegExp("Version/"+kt),Ct=new RegExp(ut,"i"),Ot=new RegExp(lt+" \\w+","i"),At=new RegExp(at+" \\w+","i"),Ft=new RegExp(je+"|PlayBook|BB10","i"),Mt={"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"},Lt=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?It:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&he(e,"GSA/")?$t:he(e," OPR/")&&he(e,"Mini")?it:he(e," OPR/")?tt:Ft.test(e)?je:he(e,"IE"+De)||he(e,"WPDesktop")?et:he(e,"OculusBrowser")?bt:he(e,Ye)?Ke:he(e,st)||he(e,"Edg/")?rt:he(e,wt+"/")?wt:he(e,"YaBrowser/")?St:he(e,xt+"/")?xt:he(e,Et+"/")||he(e,"Ddg/")?Et:he(e,"FBIOS")?"Facebook "+De:he(e,"UCWEB")||he(e,"UCBrowser")?"UC Browser":he(e,"CriOS")?Xe:he(e,"CrMo")||he(e,Je)?Je:he(e,Ne)&&he(e,Ve)?_t:he(e,"FxiOS")?ot:he(e.toLowerCase(),yt.toLowerCase())?yt:he(e,It+"/")?It:((e,t)=>t&&he(t,Ge)||function(e){return he(e,Ve)&&!he(e,Je)&&!he(e,Ne)}(e))(e,t)?he(e,De)?dt:Ve:he(e,"PaleMoon/")?Pt:he(e,Tt+"/")?Tt:he(e,nt)?nt:he(e,"MSIE")||he(e,"Trident/")?Ze:he(e,"Gecko")?nt:"")},Dt={[et]:[new RegExp("rv:"+kt)],[rt]:[new RegExp(st+"?\\/"+kt)],[Je]:[new RegExp("("+Je+"|CrMo)\\/"+kt)],[Xe]:[new RegExp("CriOS\\/"+kt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+kt)],[Ve]:[Rt],[dt]:[Rt],[tt]:[new RegExp("(Opera|OPR)\\/"+kt)],[nt]:[new RegExp(nt+"\\/"+kt)],[ot]:[new RegExp("FxiOS\\/"+kt)],[yt]:[new RegExp("Konqueror[:/]?"+kt,"i")],[je]:[new RegExp(je+" "+kt),Rt],[_t]:[new RegExp("android\\s"+kt,"i")],[Ke]:[new RegExp(Ye+"\\/"+kt)],[bt]:[new RegExp("OculusBrowser\\/"+kt)],[wt]:[new RegExp(wt+"\\/"+kt)],[St]:[new RegExp("YaBrowser\\/"+kt)],[xt]:[new RegExp(xt+"\\/"+kt)],[It]:[new RegExp(It+"\\/"+kt)],[Et]:[new RegExp("(DuckDuckGo|Ddg)\\/"+kt)],[Pt]:[new RegExp("PaleMoon\\/"+kt)],[Tt]:[new RegExp(Tt+"\\/"+kt)],[$t]:[new RegExp("GSA\\/"+kt)],[Ze]:[new RegExp("(rv:|MSIE )"+kt)],Mozilla:[new RegExp("rv:"+kt)]},Ut=function(e,t,i,s){var r=Lt(e,t,i,s),n=Dt[r];if(Se(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Nt=[[new RegExp(ut+"; "+ut+" (.*?)[);]","i"),e=>[ut,e&&e[1]||""]],[new RegExp(at,"i"),[at,""]],[new RegExp(lt,"i"),[lt,""]],[Ft,[je,""]],[new RegExp(ct,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ht,""];if(new RegExp(De).test(t)&&!/IEMobile\b/.test(t))return[ct+" "+De,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Mt[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ct,s]}return[ct,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ue,[e[3],e[4],e[5]||"0"].join(".")]:[Ue,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ne+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ne+")","i"),e=>e&&e[2]?[Ne,[e[2],e[3],e[4]||"0"].join(".")]:[Ne,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Qe,""]],[/Linux|debian/i,["Linux",""]]],qt=function(e){return At.test(e)?at:Ot.test(e)?lt:Ct.test(e)?ut:new RegExp(gt,"i").test(e)?gt:new RegExp("("+ht+"|WPDesktop)","i").test(e)?ht:/iPad/.test(e)?He:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ze:Ft.test(e)?je:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(pt,"i").test(e)?pt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(De).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ne:Be:new RegExp("(pda|"+De+")","i").test(e)?ft:new RegExp(qe,"i").test(e)&&!new RegExp(qe+" pc","i").test(e)?mt:""},Bt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ht(e,t){return"string"==typeof(i=e)&&Bt.test(i)?e:t();var i}function Gt(e){return e?e.split("#")[0]:e}var zt=function(e,t){var i=(void 0===t?{}:t).debugEnabled,r={_log(t){if(B&&(s.DEBUG||B.POSTHOG_DEBUG||i)&&!Se(B.console)&&B.console){for(var r=("__rrweb_original__"in B.console[t]?B.console[t].__rrweb_original__:B.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>zt(e+" "+t,i)};return r},Vt=zt("[PostHog.js]"),jt=Vt.createLogger;function Wt(e,t){me(e)&&e.forEach(t)}function Yt(e,t){if(!Te(e))if(me(e))e.forEach(t);else if(Re(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)ve.call(e,i)&&t(e[i],i)}var Kt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},Jt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Vt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vt.critical(e)}}},Qt=function(e){var t={};return Yt(e,(function(e,i){(xe(e)&&e.length>0||Ie(e))&&(t[i]=e)})),t};var Xt=["herokuapp.com","vercel.app","netlify.app"];function Zt(e){var t=null==e?void 0:e.hostname;if(!xe(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Xt)if(i===s)return!1;return!0}function ei(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var ti=e=>{if(z){try{for(var t=e+"=",i=z.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ie(e)&&isFinite(e)&&Math.floor(e)===e});class ii{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new ii(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ii(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class si{generate(){var e=this.generateOrAbort();if(!Se(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Se(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ii.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new oi}}var ri,ni=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};B&&!Se(B.crypto)&&crypto.getRandomValues&&(ni=e=>crypto.getRandomValues(e));class oi{nextUint32(){return this._buffer.length>this._cursor||(ni(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var ai=()=>li().toString(),li=()=>(ri||(ri=new si)).generate(),ui="",_i=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var di={_is_supported:()=>!!z,_error(e){Vt.error("cookieStore error: "+e)},_get:ti,_parse(e){var t;try{t=JSON.parse(di._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!z)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=z),ui)return ui;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+ai();!ui&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ui=n)}return ui}(e);if(!i){var s=(e=>{var t=e.match(_i);return t?t[0]:""})(e);s!==i&&Vt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(z.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Vt.warn("cookieStore warning: large cookie, len="+u.length),z.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=z&&z.cookie)try{di._set(e,"",-1,t)}catch(e){return}}},ci=null,hi={_is_supported(){if(!Pe(ci))return ci;var e=!0;if(Se(B))e=!1;else try{var t="__mplssupport__";hi._set(t,"xyz"),'"xyz"'!==hi._get(t)&&(e=!1),hi._remove(t)}catch(t){e=!1}return e||Vt.error("localStorage unsupported; falling back to cookie store"),ci=e,e},_error(e){Vt.error("localStorage error: "+e)},_get(e){try{return null==B?void 0:B.localStorage.getItem(e)}catch(e){hi._error(e)}return null},_parse(e){try{return JSON.parse(hi._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==B||B.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){hi._error(e)}return!1},_remove(e){try{null==B||B.localStorage.removeItem(e)}catch(e){hi._error(e)}}},pi=[n,"distinct_id",d,c,E,x,m],gi={},vi={_is_supported:()=>!0,_error(e){Vt.error("memoryStorage error: "+e)},_get:e=>gi[e]||null,_parse:e=>gi[e]||null,_set:(e,t)=>(gi[e]=t,!0),_remove(e){delete gi[e]}},fi=null,mi={_is_supported(){if(!Pe(fi))return fi;if(fi=!0,Se(B))fi=!1;else try{var e="__support__";mi._set(e,"xyz"),'"xyz"'!==mi._get(e)&&(fi=!1),mi._remove(e)}catch(e){fi=!1}return fi},_error(e){Vt.error("sessionStorage error: ",e)},_get(e){try{return null==B?void 0:B.sessionStorage.getItem(e)}catch(e){mi._error(e)}return null},_parse(e){try{return JSON.parse(mi._get(e))||null}catch(e){}return null},_set(e,t){try{return null==B||B.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){mi._error(e)}return!1},_remove(e){try{null==B||B.sessionStorage.removeItem(e)}catch(e){mi._error(e)}}};class yi{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===C||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===R}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Fe(e)?1:he(Me,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?hi:di;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?di:hi;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Fe(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==G?void 0:G.doNotTrack,null==G?void 0:G.msDoNotTrack,Z.doNotTrack].some((e=>Fe(e)))}}var bi=["next","previous","prev",">","<","+","-","−","–"];jt("[Dead Clicks]");var wi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(u)),s=e.instance.config.capture_dead_clicks;return ke(s)?s:!!be(s)||i},Si=jt("[SegmentIntegration]");var xi="posthog-js";function Ei(e,t){var s=void 0===t?{}:t,r=s.organization,n=s.projectId,o=s.prefix,a=s.severityAllowList,l=void 0===a?["error"]:a,u=s.sendExceptionsToPostHog,_=void 0===u||u;return t=>{var s,a,u,d,c;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(s=t.exception)?void 0:s.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return r&&n&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),_&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Pi{constructor(e,t,i,s,r,n){this.name=xi,this.setupOnce=function(o){o(Ei(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Ti{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Vt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==B?void 0:B.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,_=r.maxContentY;if(!(Se(n)||Se(o)||Se(a)||Se(l)||Se(u)||Se(_))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),_=Math.ceil(_);var d=n>1?Le(o/n,0,1,Vt):1,c=n>1?Le(a/n,0,1,Vt):1,h=l>1?Le(u/l,0,1,Vt):1,p=l>1?Le(_/l,0,1,Vt):1;s=Kt(s,{$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:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:_,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var Ii=["flags","surveys"],$i={[r]:{exposure:"hidden"},[a]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[l]:{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"},[u]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[_]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>Pe(e)},$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"},$sess_rec_flush_size:{exposure:"hidden"},[h]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!be(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},[p]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[g]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[v]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},[E]:{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"},[I]:{exposure:"event"},[k]:{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"}},ki=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ri=e=>{var t=$i[e];if(t)return t;for(var i of ki){var s=i[1];if(0===e.indexOf(i[0]))return s}},Ci=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return s=[],null!==(i=JSON.stringify(e,(function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(t))return"[Circular]";s.push(t)}return t}})))&&void 0!==i?i:"null"}var i,s},Oi=e=>{var t=null==z?void 0:z.createElement("a");return Se(t)?null:(t.href=e,t)},Ai=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!me(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Vt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Fi=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],_=0;l.length>_;_++){var d=l[_].split("=");me(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[_]))}var c=a;return null!=o&&(c+="?"+u.join("&")),null!=r&&(c+="#"+r),c},Mi="https?://(.*)",Li=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Di=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Li],Ui="<masked>",Ni=["li_fat_id"];function qi(e,t){var i=Di.concat(t||[]),s={};return Yt(i,(function(t){var i=Ai(e,t);s[t]=i||null})),s}function Bi(e){var t=function(e){return e?0===e.search(Mi+"google.([^/?]*)")?"google":0===e.search(Mi+"bing.com")?"bing":0===e.search(Mi+"yahoo.com")?"yahoo":0===e.search(Mi+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Pe(t)){s.$search_engine=t;var r=z?Ai(z.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Hi(){return navigator.language||navigator.userLanguage}var Gi="$direct";function zi(){return(null==z?void 0:z.referrer)||Gi}function Vi(e,t,i){void 0===i&&(i=!1);var s=e?[...Li,...t||[]]:[],r=i?Gt(null==V?void 0:V.href):null==V?void 0:V.href,n=null==r?void 0:r.substring(0,1e3);return{r:zi().substring(0,1e3),u:n?Fi(n,s,Ui):void 0}}function ji(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Gt(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==Gi?Gi:null==(i=Oi(s))?void 0:i.host};if(n){o.$current_url=n;var a=Oi(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=qi(n);Kt(o,l)}if(s){var u=Bi(s);Kt(o,u)}return o}function Wi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Yi(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Ki={flags:f,surveys:g},Ji=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Qi="main";class Xi{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&Vt.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),B){var r=()=>this.flush();ei(B,"beforeunload",r,{capture:!1}),ei(B,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ie(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Ji.indexOf(e.persistence.toLowerCase())&&(Vt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...pi,...e];return i({},hi,{_parse(e){try{var i={};try{i=di._parse(e)||{}}catch(e){}var s,r=JSON.parse(hi._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Pe(a)||""===a||(n[o]=a)}s=Kt(r,n)}else s=Kt(i,r);return hi._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=hi._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&di._set(e,l,i,r,n,o)}catch(e){hi._error(e)}return a},_remove(e,t){try{null==B||B.localStorage.removeItem(e),di._remove(e,t)}catch(e){hi._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&hi._is_supported()?(t=hi,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&mi._is_supported()?t=mi:"memory"===n?t=vi:"cookie"===n?t=di:s._is_supported()?(t=s,r=!0):t=di,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[f];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Yt(this.props,((t,i)=>{var s=Ri(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===h?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&Kt(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=Kt({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Ii){var t=hi._parse(this._groupEntryName(e));if(t&&!we(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Kt(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Ri(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Ki[e];if(!i)return!1;var s=t[i],r=this.props[i];return Ie(s)&&Ie(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Ri(e))?void 0:t.storageGroup:void 0,s=i?hi._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Se(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Se(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Qi))}_writeNowSplit(){var e=this._partitionProps(),t=e.main,i=e.groups;for(var s of(this._writeEntry(this._storage,this._name,t,Qi),Ii)){var r,n=i[s];(!we(n)||null!=(r=this._slotState[s])&&r.persisted)&&this._writeEntry(hi,this._groupEntryName(s),n,s)}}_partitionProps(){var e={},t={flags:{},surveys:{}};return Yt(this.props,((i,s)=>{var r,n=null==(r=Ri(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Qi)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Yt(e,((e,t)=>{var s;i[t]=null!=(s=Ri(t))&&s.volatile?"__volatile__":e})),JSON.stringify(i)}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Qi||r.dirty||Se(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==Qi&&(r.persisted=!0),Se(n)||(r.fingerprint=n)):this._config.debug&&Vt.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(Se(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!i&&this._ownsSplitStorage)for(var s of Ii)hi._remove(this._groupEntryName(s));i?delete this._slotState[Qi]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(be(e)){Se(t)&&(t="None"),this._expire_days=Se(i)?this._default_expiry:i;var s=!1;if(Yt(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(be(e)){this._expire_days=Se(t)?this._default_expiry:t;var i=!1;if(Yt(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=function(e,t,i){if(!z)return{};var s,r=t?[...Li,...i||[]]:[],n=qi(Fi(z.URL,r,Ui),e),o=(s={},Yt(Ni,(function(e){var t=ti(e);s[e]=t||null})),s);return Kt(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);we(Qt(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==z?void 0:z.referrer)?Bi(e):{})}update_referrer_info(){var e;this.register_once({$referrer:zi(),$referring_domain:null!=z&&z.referrer&&(null==(e=Oi(z.referrer))?void 0:e.host)||Gi},void 0)}set_initial_person_info(){this.props[w]||this.props[S]||this.register_once({[x]:Vi(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Yt([S,w],(t=>{var i=this.props[t];i&&Yt(i,(function(t,i){e["$initial_"+pe(i)]=t}))}));var t=this.props[x];if(t){var i=function(e,t){void 0===t&&(t=!1);var i=ji(e,t),s={};return Yt(i,(function(e,t){s["$initial_"+pe(t)]=e})),s}(t,this._config.disable_capture_url_hashes);Kt(e,i)}return e}safe_merge(e){return Yt(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[l]||{};i[e]=t,this._setProp(l,i),this.save()}remove_event_timer(e){var t=this.props[l]||{},i=t[e];return Se(i)||(delete t[e],this._setProp(l,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var i;this.props[e]=t,null!=(i=Ri(e))&&i.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=Ri(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Zi={GZipJS:"gzip-js",Base64:"base64"},es={Activation:"events",Cancellation:"cancelEvents"},ts={Button:"button",Tab:"tab",Selector:"selector"},is={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"},ss={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},rs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ns={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},os={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},as={Once:"once",Recurring:"recurring",Always:"always"},ls={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},us={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",SURVEY_LANGUAGE:"$survey_language"},_s={Popover:"popover",Inline:"inline"},ds={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},cs={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"},hs={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"},ps=jt("[RateLimiter]");class gs{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ps.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void ps.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(b))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(b,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var vs=jt("[RemoteConfig]");class fs{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Z._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Z.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Z.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return vs.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void vs.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return vs.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){vs.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&z&&"hidden"!==z.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||vs.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var ms=["fatal","error","warning","log","info","debug"],ys=Uint8Array,bs=Uint16Array,ws=Uint32Array,Ss=new ys([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]),xs=new ys([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]),Es=new ys([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ps=function(e,t){for(var i=new bs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new ws(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},Ts=Ps(Ss,2),Is=Ts[1];Ts[0][28]=258,Is[258]=28;for(var $s=Ps(xs,0)[1],ks=new bs(32768),Rs=0;32768>Rs;++Rs){var Cs=(43690&Rs)>>>1|(21845&Rs)<<1;ks[Rs]=((65280&(Cs=(61680&(Cs=(52428&Cs)>>>2|(13107&Cs)<<2))>>>4|(3855&Cs)<<4))>>>8|(255&Cs)<<8)>>>1}var Os=function(e,t,i){for(var s=e.length,r=0,n=new bs(t);s>r;++r)++n[e[r]-1];var o,a=new bs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new bs(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],_=t-e[r],d=a[e[r]-1]++<<_,c=d|(1<<_)-1;c>=d;++d)o[ks[d]>>>l]=u}else for(o=new bs(s),r=0;s>r;++r)o[r]=ks[a[e[r]-1]++]>>>15-e[r];return o},As=new ys(288);for(Rs=0;144>Rs;++Rs)As[Rs]=8;for(Rs=144;256>Rs;++Rs)As[Rs]=9;for(Rs=256;280>Rs;++Rs)As[Rs]=7;for(Rs=280;288>Rs;++Rs)As[Rs]=8;var Fs=new ys(32);for(Rs=0;32>Rs;++Rs)Fs[Rs]=5;var Ms=Os(As,9,0),Ls=Os(Fs,5,0),Ds=function(e){return(e/8>>0)+(7&e&&1)},Us=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof bs?bs:e instanceof ws?ws:ys)(i-t);return s.set(e.subarray(t,i)),s},Ns=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},qs=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Bs=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new ys(0),0];if(1==r){var o=new ys(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,_=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};_!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=_&&i[d].f>i[u].f?u++:d++],i[_++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new bs(c+1),p=Hs(i[_-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new ys(h),p]},Hs=function(e,t,i){return-1==e.s?Math.max(Hs(e.l,t,i+1),Hs(e.r,t,i+1)):t[e.s]=i},Gs=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new bs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},zs=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Vs=function(e,t,i){var s=i.length,r=Ds(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},js=function(e,t,i,s,r,n,o,a,l,u,_){Ns(t,_++,i),++r[256];for(var d=Bs(r,15),c=d[0],h=d[1],p=Bs(n,15),g=p[0],v=p[1],f=Gs(c),m=f[0],y=f[1],b=Gs(g),w=b[0],S=b[1],x=new bs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var P=Bs(x,7),T=P[0],I=P[1],k=19;k>4&&!T[Es[k-1]];--k);var R,C,O,A,F=u+5<<3,M=zs(r,As)+zs(n,Fs)+o,L=zs(r,c)+zs(n,g)+o+14+3*k+zs(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&L>=F)return Vs(t,_,e.subarray(l,l+u));if(Ns(t,_,1+(M>L)),_+=2,M>L){R=Os(c,h,0),C=c,O=Os(g,v,0),A=g;var D=Os(T,I,0);for(Ns(t,_,y-257),Ns(t,_+5,S-1),Ns(t,_+10,k-4),_+=14,E=0;k>E;++E)Ns(t,_+3*E,T[Es[E]]);_+=3*k;for(var U=[m,w],N=0;2>N;++N){var q=U[N];for(E=0;q.length>E;++E)Ns(t,_,D[B=31&q[E]]),_+=T[B],B>15&&(Ns(t,_,q[E]>>>5&127),_+=q[E]>>>12)}}else R=Ms,C=As,O=Ls,A=Fs;for(E=0;a>E;++E)if(s[E]>255){var B;qs(t,_,R[257+(B=s[E]>>>18&31)]),_+=C[B+257],B>7&&(Ns(t,_,s[E]>>>23&31),_+=Ss[B]);var H=31&s[E];qs(t,_,O[H]),_+=A[H],H>3&&(qs(t,_,s[E]>>>5&8191),_+=xs[H])}else qs(t,_,R[s[E]]),_+=C[s[E]];return qs(t,_,R[256]),_+C[256]},Ws=new ws([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ys=function(){for(var e=new ws(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Ks=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Js(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=Ys[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new ys(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var _=0;o>=_;_+=65535){var d=_+65535;o>d?u=Vs(l,u,e.subarray(_,d)):(l[_]=!0,u=Vs(l,u,e.subarray(_,o)))}else{for(var c=Ws[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new bs(32768),f=new bs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new ws(25e3),S=new bs(288),x=new bs(32),E=0,P=0,T=(_=0,0),I=0,k=0;o>_;++_){var R=b(_),C=32767&_,O=f[R];if(v[C]=O,f[R]=C,_>=I){var A=o-_;if((E>7e3||T>24576)&&A>423){u=js(e,l,0,w,S,x,P,T,k,_-k,u),T=E=P=0,k=_;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,L=0,D=p,U=C-O&32767;if(A>2&&R==b(_-U))for(var N=Math.min(h,A)-1,q=Math.min(32767,_),B=Math.min(258,A);q>=U&&--D&&C!=O;){if(e[_+M]==e[_+M-U]){for(var H=0;B>H&&e[_+H]==e[_+H-U];++H);if(H>M){if(M=H,L=U,H>N)break;var G=Math.min(U,H-2),z=0;for(F=0;G>F;++F){var V=_-U+F+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,O=V)}}}U+=(C=O)-(O=v[C])+32768&32767}if(L){w[T++]=268435456|Is[M]<<18|$s[L];var W=31&Is[M],Y=31&$s[L];P+=Ss[W]+xs[Y],++S[257+W],++x[Y],I=_+M,++E}else w[T++]=e[_],++S[e[_]]}}u=js(e,l,!0,w,S,x,P,T,k,_-k,u)}return Us(a,0,s+Ds(u)+r)}(n=e,null==(o=t).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,l)),_=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Ks(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),Ks(u,_-8,i.d()),Ks(u,_-4,s),u}var Qs=!!W||!!j,Xs="text/plain",Zs=!1,er=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},tr=function(e,t,s){var r;void 0===s&&(s=!0);var n=e.split("?"),o=n[0],a=n[1],l=i({},t),u=null!==(r=null==a?void 0:a.split("&").map((e=>{var t,i=e.split("="),r=i[0],n=s&&null!==(t=l[r])&&void 0!==t?t:i[1];return delete l[r],r+"="+n})))&&void 0!==r?r:[],_=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Yt(e,(function(e,t){Se(e)||Se(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(l);return _&&u.push(_),u.length>0?o+"?"+u.join("&"):o},ir=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===Zi.GZipJS){var s=Js(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ys(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ys(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Us(s,0,r)}(Ci(t)),{mtime:0});return{contentType:Xs,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===Zi.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Ci(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ci(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ci(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},sr=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:tr(e.url,{compression:Zi.Base64}),encodedBody:ir(i({},e,{compression:Zi.Base64,_encodedBody:void 0}))}:{url:er(e.url,"compression"),encodedBody:ir(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=ir(e)}catch(t){if(oe(e.compression,Ai(e.url,"compression")))return Vt.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&oe(e.compression,Ai(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?ne(new Uint8Array(s)):ArrayBuffer.isView(s)&&ne(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Zs=!0,r()):{url:e.url,encodedBody:t}},rr=e=>{try{return sr(e)}catch(t){return Vt.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},nr=function(){var e=t((function*(e){var t=Ci(e.data),r=yield function(e,t,i){return _e.apply(this,arguments)}(t,s.DEBUG,{rethrow:!0});if(!r)return e;var n=yield r.arrayBuffer();return i({},e,{_encodedBody:{contentType:Xs,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),or=/Failed to fetch|NetworkError|Load failed/i,ar=e=>{var t=rr(e);if(t){var s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,u=new Headers;Yt(e.headers,(function(e,t){u.append(t,e)})),o&&u.append("Content-Type",o);var _=null,d=!1;if(Y){var c=new Y;_={signal:c.signal,timeout:setTimeout((()=>{var t,i;d=!0,c.abort((t=e.timeout,(i=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",i))}),e.timeout)}}var h=t=>{d&&"AbortError"===(null==t?void 0:t.name)||(e=>"TypeError"===(null==e?void 0:e.name)&&or.test((null==e?void 0:e.message)||""))(t)?Vt.warn(t):Vt.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var p;j(s,i({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(p=_)?void 0:p.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Vt.error(e)}null==e.callback||e.callback(s)})))).catch(h).finally((()=>_?clearTimeout(_.timeout):null))}catch(e){_&&clearTimeout(_.timeout),h(e)}}},lr=e=>{try{var t,s=sr(e),r=s.url,n=s.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(G.sendBeacon(r,u))return;var _=me(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(me(_)&&_.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(_.length/2),c=t=>me(e.data)?t:i({},e.data,{batch:t});return lr(i({},e,{data:c(_.slice(0,d))})),void lr(i({},e,{data:c(_.slice(d))}))}Vt.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ar(i({},e,{_keepaliveDisabled:!0}))}catch(e){Vt.warn("Beacon send failed",e)}},ur=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return tr(s===Zi.GZipJS?er(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===Zi.GZipJS?{}:{compression:s}))},_r=[];j&&_r.push({transport:"fetch",method:ar}),W&&_r.push({transport:"XHR",method(e){var t=rr(e);if(t){var i=new W,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;Yt(e.headers,(function(e,t){i.setRequestHeader(t,e)})),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(o)}}}),null!=G&&G.sendBeacon&&_r.push({transport:"sendBeacon",method:lr});var dr=3e3;class cr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Le((null==t?void 0:t.flush_interval_ms)||dr,250,5e3,Vt.createLogger("flush interval"),dr),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequestSafely(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&me(i.data)&&Yt(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequestSafely(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Vt.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Yt(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Se(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var hr=["retriesPerformedSoFar"];class pr{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Se(B)&&"onLine"in B.navigator&&(this._areWeOnline=B.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ei(B,"online",this._onlineListener),ei(B,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,hr);$e(t)&&(s.url=tr(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Vt.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),Vt.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Se(B)||(this._onlineListener&&(B.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(B.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(e){Vt.error(e)}}this._queue=[]}}class gr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ei(B,"scroll",this._updateScrollData,{capture:!0}),ei(B,"scrollend",this._updateScrollData,{capture:!0}),ei(B,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==B?void 0:B.document.documentElement;var e=me(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==B?void 0:B.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return B?"y"===e?B.scrollY||B.pageYOffset||B.document.documentElement.scrollTop||0:B.scrollX||B.pageXOffset||B.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var vr=e=>Vi(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class fr{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[y]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||vr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[y]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?ji(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Yt(Qt(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+pe(i)]=t})),e}}class mr{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}constructor(){this._events={}}}var yr=jt("[SessionId]");class br{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new mr,this._sessionHasBeenIdleTooLong=(e,t)=>!(!$e(e)||!$e(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===C)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||ai,this._windowIdGenerator=i||ai;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Le(this._config.session_idle_timeout_seconds||1800,60,36e3,yr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=mi._parse(this._window_id_storage_key),o=mi._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:mi._remove(this._window_id_storage_key),mi._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){yr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Se(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&mi._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&mi._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?mi._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Pe(t)&&!Pe(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[d]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return $e(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(d):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Pe(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[d]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=$e(e)?e:0,i=$e(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[d];return me(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&B&&(B.removeEventListener(L,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&mi._remove(this._primary_window_exists_storage_key)},ei(B,L,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===C)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this._getSessionId(),r=s[1],n=s[2],o=this._freshestActivityTimestamp(),a=this._getWindowId(),l=$e(n)&&Math.abs(i-n)>864e5,u=!1,_=!1,d=!r,c=r,h=!d&&!e&&this._sessionHasBeenIdleTooLong(i,o);if(h){(h=this._isSessionIdleAfterCrossTabRefresh(i))||yr.info("cross-tab refresh kept the session alive",{sessionId:r});var p=this._getSessionId();r=p[1],n=p[2]}d||h||l?(r=this._sessionIdGenerator(),a=this._windowIdGenerator(),yr.info("new session ID generated",{sessionId:r,windowId:a,changeReason:{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this._windowIdGenerator(),u=!0),(_=r!==c)&&(yr.info("adopted cross-tab session id",{sessionId:r,windowId:a}),u=!0));var g=$e(o)&&e&&!l?o:i,v=$e(n)?n:(new Date).getTime();this._setWindowId(a),this._setSessionId(r,g,v),e||this._resetIdleTimer();var f={noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l,crossTabAdoption:_};return u&&this._sessionIdChangedHandlers.forEach((e=>e(r,a,f))),{sessionId:r,windowId:a,sessionStartTimestamp:v,changeReason:u?f:void 0,lastActivityTimestamp:o}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}function wr(){return(wr=t((function*(){var e=null==G?void 0:G.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return xe(i)&&i.length>0?i:void 0}catch(e){return void Vt.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}))).apply(this,arguments)}function Sr(e,t,i){return Ci({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var xr="custom",Er="i.posthog.com",Pr=/^\/static\//;class Tr{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Er,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":xr),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Pr.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===xr)return this.apiHost+t;var s=Er+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var Ir=jt("[Surveys]"),$r={ignoreConditions:!1,ignoreDelay:!1,displayType:_s.Popover},kr=jt("[PostHog ExternalIntegrations]"),Rr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cr{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Z.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return kr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,s,r,n=i[0],o=i[1];!o||null!=(t=Z.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(Rr[n],(()=>{var t;null==(t=Z.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)})),!o&&null!=(s=Z.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=Z.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())};for(var i of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t()}}}var Or,Ar={},Fr=0,Mr=()=>{},Lr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Dr="Surveys module not available",Ur="sanitize_properties is deprecated. Use before_send instead",Nr="Invalid value for property_denylist config: ",qr=["token","distinct_id",T],Br="posthog",Hr=!Qs&&-1===(null==J?void 0:J.indexOf("MSIE"))&&-1===(null==J?void 0:J.indexOf("Mozilla")),Gr=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Zt(null==z?void 0:z.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Mr,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,__preview_cookie_wins_on_conflict:!1,debug:V&&xe(null==V?void 0:V.search)&&-1!==V.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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==B||null==(t=B.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Vt.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:F,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:dr},error_tracking:{},_onCapture:Mr},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:bi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)}))(e))},zr=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Vr=e=>{var t={};for(var i of zr){var s=i[0],r=i[1];Se(e[s])||(t[r]=e[s])}var n=Kt({},t,e),o=e.__preview_external_dependency_versioned_paths;return Se(o)||(Se(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),xe(o)&&Se(e.asset_host)&&(n.asset_host=o)),me(e.property_blacklist)&&(Se(e.property_denylist)?n.property_denylist=e.property_blacklist:me(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Vt.error(Nr+e.property_denylist)),n};class jr{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Vt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Wr{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===C||this.config.cookieless_mode===R&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new jr,this._personProcessingSetOncePropertiesSent=!1,this.version=s.LIB_VERSION,this._internalEventEmitter=new mr,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Gr(),this.SentryIntegration=Pi,this.sentryIntegration=e=>function(e,t){var i=Ei(e,t);return{name:xi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new gr(this),this.pageViewManager=new Ti(this),this.rateLimiter=new gs(this),this.requestRouter=new Tr(this),this.consent=new yi(this),this.externalIntegrations=new Cr(this);var t=null!==(e=Wr.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=xe(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=xe(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Vt.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Br){var s,r=null!==(s=Ar[i])&&void 0!==s?s:new Wr;return r._init(e,t,i),Ar[i]=r,Ar[Br][i]=r,r}return this._init(e,t,i)}_init(e,t,r){var n,a;void 0===t&&(t={});var l=xe(e)?e.trim():"";if(!l)return Vt.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=Gr(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var u=Gr(t.defaults),_=Vr(t),d=Kt({},u,_,{name:r,token:l});be(u.rageclick)&&be(_.rageclick)&&(d.rageclick=Kt({},u.rageclick,_.rageclick)),be(u.session_recording)&&be(_.session_recording)&&(d.session_recording=Kt({},u.session_recording,_.session_recording)),this.set_config(d),this.config.on_xhr_error&&Vt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Zi.GZipJS;var c=this._is_persistence_disabled();this.persistence=new Xi(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xi(i({},this.config,{persistence:"sessionStorage"}),c,!1);var h=i({},this.persistence.props),p=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new cr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new pr(this),this.__request_queue=[];var g=this._inCookielessMode();if(g||(this.sessionManager=new br(this),this.sessionPropsManager=new fr(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Vt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(g)}),0)):(Vt.info("Initializing extensions synchronously"),this._initExtensions(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Vt.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:h,s:p}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(a=t.bootstrap)?void 0:a.distinctID)){var v=t.bootstrap.distinctID,f=this.get_distinct_id(),y=this.persistence.get_property(m);if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===O)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===A)Vt.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 b=this.config.get_device_id(ai()),w=t.bootstrap.isIdentifiedID?b:v;this.persistence.set_property(m,t.bootstrap.isIdentifiedID?A:O),this.register({distinct_id:v,$device_id:w})}}if(g)this.register_once({distinct_id:P,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(ai());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(m,O)}return ei(B,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||ai();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(m,A)),t()},r=i.user();"then"in r&&ye(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||Si.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Si.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Si.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,D),identify:e=>t(e,N),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),ye(this.config._onCapture)&&this.config._onCapture!==Mr&&(Vt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Vt.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.config.disableDeviceModel||function(){return wr.apply(this,arguments)}().then((e=>{e&&this.register({[o]:e})})).catch(Mr),this}_initExtensions(e){var t,s,r,n,o,a,l,u,_=performance.now(),d=i({},Wr.__defaultExtensionClasses,this.config.__extensionClasses),c=[];d.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new d.featureFlags(this)),d.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new d.exceptions(this)),d.historyAutocapture&&this._extensions.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this._extensions.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this._extensions.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this._extensions.push(this.autocapture=new d.autocapture(this)),d.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this)),d.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this)),d.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this._extensions.push(this.productTours=new d.productTours(this)),d.heatmaps&&this._extensions.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this._extensions.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,wi)),d.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this._extensions.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this._extensions.forEach((e=>{e.initialize&&c.push((()=>{null==e.initialize||e.initialize()}))})),c.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(c,_)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Vt.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[I]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[k]:s}),this.config.__preview_deferred_init_extensions&&Vt.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){if(!z||!z.body)return Vt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var t,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=he(i.supportedCompression,Zi.GZipJS)?Zi.GZipJS:he(i.supportedCompression,Zi.Base64)?Zi.Base64:void 0),null!=(t=i.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:F}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Vt.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=V&&V.hostname){var e=V.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new fs(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Wt(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,r;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(U),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(U,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Hr?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Se(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4;var o,a,l,u,_,d=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Se(n.compression)&&n.data&&(n.compression=Zi.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(_=(u=me(o=n.data)?o:[o])[0])||null==(l=_.properties)?void 0:l.token)&&void 0!==a?a:null==_?void 0:_.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),me(e)?e.map((e=>i({},e,{sent_at:t}))):i({},e,{sent_at:t})}(n.data))),n.url=ur(n.url,n.method,n.compression,n.timestampMode);var c=_r.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),h=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===d)return e[i]}(c))?void 0:r.method)&&void 0!==s?s:c[0].method;if(!h)throw new Error("No available transport method");"sendBeacon"!==d&&n.data&&n.compression===Zi.GZipJS&&K&&"undefined"!=typeof Promise&&!Zs?nr(n).then((e=>{h(e)})).catch((t=>{if(ae(t))return Zs=!0,void h(i({},n,{compression:void 0,url:ur(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return ae(e)||t===re})(t)&&(Zs=!0),h(n)})):h(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Fr++;try{var t,i=[],s=[],r=[];Wt(e,(e=>{if(e)if(me(t=e[0]))r.push(e);else if(ye(e))try{e.call(this)}catch(t){Vt.error("Error executing queued PostHog call",e,t)}else me(e)&&"alias"===t?i.push(e):me(e)&&-1!==t.indexOf("capture")&&ye(this[t])?r.push(e):s.push(e)}));var n=function(e,t){Wt(e,(function(e){try{if(me(e[0])){var i=t;Yt(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Vt.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Fr--}}push(e){if(Fr>0&&me(e)&&xe(e[0])){var t=Wr.prototype[e[0]];ye(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Se(e)&&xe(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var _=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==_||!_.isRateLimited){null!=t&&t.$current_url&&!xe(null==t?void 0:t.$current_url)&&(Vt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Vt.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 d=new Date,c=(null==s?void 0:s.timestamp)||d,h=Ht(null==s?void 0:s.uuid,ai),g={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},c,h)};e===D&&this.config.__preview_capture_bot_pageviews&&u&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),_&&(g.properties.$lib_rate_limit_remaining_tokens=_.remainingTokens);var v="$feature_flag_called"===e&&!1===g.properties.$feature_flag_has_experiment&&!0===this.get_property(p);(null==s?void 0:s.$set)&&!v&&(g.$set=null==s?void 0:s.$set);var f=null==s?void 0:s.$unset;f&&(g.$unset=f);var m,y,b,w=v?void 0:this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==q,e===N);if(w&&(g.$set_once=w),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=g,a=e=>xe(e)?e.slice(0,n):e,l=new Set,g=function e(t,i){if(t!==Object(t))return a?a(t):t;if(!l.has(t)){var s;if(l.add(t),me(t))s=[],Wt(t,(t=>{s.push(e(t))}));else{var r={};Yt(t,((t,i)=>{l.has(t)||(r[i]=e(t,i))})),s=r}return s}}(o)),g.timestamp=c,Se(null==s?void 0:s.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=d),v&&(g.properties=function(e,t){void 0===t&&(t=[]);var i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return ee.forEach(s),t.forEach(s),i}(g.properties,qr)),e===ls.DISMISSED||e===ls.SENT){var S=null==t?void 0:t[us.SURVEY_ID],x=null==t?void 0:t[us.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>"seenSurvey_"+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){Ir.error("Failed to persist survey seen state",e)}})({id:S,current_iteration:x}),g.$set=i({},g.$set,{[(m={id:S,current_iteration:x},y=e===ls.SENT?"responded":"dismissed",b="$survey_"+y+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(b="$survey_"+y+"/"+m.id+"/"+m.current_iteration),b)]:!0})}else e===ls.SHOWN&&(g.$set=i({},g.$set,{[us.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===cs.SHOWN){var E=null==t?void 0:t[hs.TOUR_TYPE];E&&(g.$set=i({},g.$set,{[hs.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var P=i({},g.properties.$set,g.$set);if(we(P)||this.setPersonPropertiesForFlags(P),!Te(this.config.before_send)){var T=this._runBeforeSend(g);if(!T)return;(g=T).uuid=Ht(g.uuid,ai)}this._internalEventEmitter.emit("eventCaptured",g);var I=null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),k={method:"POST",url:I,data:g,compression:"best-available",timestampMode:"recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(I)?"body":"capture-body",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(k):this._requestQueue.enqueue(k),g}Vt.critical("This capture call is ignored due to client rate limiting.")}}else Vt.error("No event name provided to posthog.capture")}else Vt.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l[T]=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!xe(l.distinct_id)&&!Ie(l.distinct_id)||Ee(l.distinct_id))&&Vt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var _,d=function(e,t,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!J)return{};var u,_=e?[...Li,...t||[]]:[],d=function(e){for(var t=0;Nt.length>t;t++){var i=Nt[t],s=i[1],r=i[0].exec(e),n=r&&(ye(s)?s(r,e):s);if(n)return n}return["",""]}(J),c=d[0],h=d[1],p=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},g={};Se(i)||(g.detectGoogleSearchApp=i);var v={},f=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,y=null==B||null==(a=B.screen)?void 0:a.width,b=null==B||null==(l=B.screen)?void 0:l.height,w=null==B?void 0:B.devicePixelRatio;Se(f)||(v.userAgentDataPlatform=f),Se(m)||(v.maxTouchPoints=m),Se(y)||(v.screenWidth=y),Se(b)||(v.screenHeight=b),Se(w)||(v.devicePixelRatio=w);var S,x,E,P,T,I,k,R,C=Kt(Qt({$os:c,$os_version:h,$browser:Lt(J,navigator.vendor,p,g),$device:qt(J),$device_type:(x=J,E=v,R=qt(x),R===He||R===Be||"Kobo"===R||"Kindle Fire"===R||R===mt?qe:R===at||R===ut||R===lt||R===gt?"Console":R===ze?"Wearable":R?De:"Android"===(null==E?void 0:E.userAgentDataPlatform)&&(null!==(P=null==E?void 0:E.maxTouchPoints)&&void 0!==P?P:0)>0?600>Math.min(null!==(T=null==E?void 0:E.screenWidth)&&void 0!==T?T:0,null!==(I=null==E?void 0:E.screenHeight)&&void 0!==I?I:0)/(null!==(k=null==E?void 0:E.devicePixelRatio)&&void 0!==k?k:1)?De:qe:"Desktop"),$timezone:Wi(),$timezone_offset:Yi()}),{$current_url:Fi(r?Gt(null==V?void 0:V.href):null==V?void 0:V.href,_,Ui),$host:null==V?void 0:V.host,$pathname:null==V?void 0:V.pathname,$raw_user_agent:J.length>1e3?J.substring(0,997)+"...":J,$browser_version:Ut(J,navigator.vendor,p,g),$browser_language:Hi(),$browser_language_prefix:(S=Hi(),"string"==typeof S?S.split("-")[0]:void 0),$screen_height:null==B?void 0:B.screen.height,$screen_width:null==B?void 0:B.screen.width,$viewport_height:null==B?void 0:B.innerHeight,$viewport_width:null==B?void 0:B.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=s.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime()),h=c.windowId;l.$session_id=c.sessionId,l.$window_id=h}this.sessionPropsManager&&Kt(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Kt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===xr&&(l.$lib_custom_api_host=this.config.api_host),_=e!==D||o?e!==U||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Kt(l,_),e===D&&z&&(l.title=z.title),!Se(a)){var g=r.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}J&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var v=this.persistence.properties(),f=this.sessionPersistence.properties();Yt(["$referrer","$referring_domain"],(e=>{e in v&&delete f[e]})),(l=Kt({},d,v,f,l)).$is_identified=this._isIdentified(),me(this.config.property_denylist)?Yt(this.config.property_denylist,(function(e){delete l[e]})):Vt.error(Nr+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(Vt.error(Ur),l=m(l,e));var y=this._hasPersonProcessing();return l.$process_person_profile=y,y&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=Kt({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Vt.error(Ur),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),we(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Dr}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Dr})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Dr})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=$r),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Dr}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Dr})}_validateIdentifyId(e){return!e||Ee(e)?(Vt.critical("Unique user id has not been set in posthog.identify"),!1):e===P?(Vt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Vt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Vt.uninitializedWarning("posthog.identify");if(Ie(e)&&(e=e.toString(),Vt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(n)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(a)&&(this.unregister(a),this.register({distinct_id:e}));var r,o=(this.persistence.get_property(m)||O)===O;e!==s&&o?(this.persistence.set_property(m,A),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(N,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=Sr(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(v))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=Sr(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Vt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(me(e)?e:[e]).filter((e=>xe(e)&&e.length>0));0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(q,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else Vt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,a,l,u,d,c,h;if(Vt.info("reset"),!this.__loaded)return Vt.uninitializedWarning("posthog.reset");var p,g=this.get_property(n),v=this.get_property(o),f=this.get_property(_);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),Se(f)||null==(p=this.persistence)||p.register({[_]:f}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(a=this.featureFlags)||a.reset(),null==(l=this.conversations)||l.reset(),null==(u=this.logs)||u.reset(),null==(d=this.metrics)||d.reset(),null==(c=this.persistence)||c.set_property(m,O),null==(h=this.sessionManager)||h.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===C)this.register_once({distinct_id:P,$device_id:null},"");else{var y=this.config.get_device_id(ai());this.register_once({distinct_id:y,$device_id:e?y:g},""),e||Se(v)||this.register({[o]:v})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var i=this;return t((function*(){var e,t,s,r,n;i.__loaded?(null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(t=i.metrics)||t.flush("sendBeacon"),null==(s=i._requestQueue)||s.unload(),null==(r=i._retryQueue)||r.unload(),null==(n=i.featureFlags)||n.destroy()):Vt.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(r)?(Vt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Se(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Vt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(be(e)){var r,n,o,a,l,u,_,d,c,h,p;Kt(this.config,Vr(e));var g=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xi(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);ke(v)&&(this.config.debug=v),ke(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,hi._is_supported()&&hi._set("ph_debug",!0),Vt.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(s.DEBUG=!1,hi._is_supported()&&hi._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(_=this.heatmaps)||_.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){s.LIB_NAME=e,s.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.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 e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Wr._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Br;return t!==Br&&(t=Br+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(m))===A||(null==(t=this.sessionPersistence)?void 0:t.get_property(m))===A}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===F&&!this._isIdentified()&&we(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[a])&&(null==(t=this.persistence)||null==(t=t.props)||!t[E]))}_shouldCapturePageleave(){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._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Vt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(E,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==R)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==C){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new br(this),this.pageViewManager=new Ti(this),this.persistence&&(this.sessionPropsManager=new fr(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=Wr.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,_;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==R&&(null==(u=this.surveys)||u.loadIfEnabled()),(Se(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(_=null==e?void 0:e.captureEventName)&&void 0!==_?_:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Vt.warn(Lr)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==C?(this.config.cookieless_mode===R&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===R&&(this.register({distinct_id:P,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Vt.warn(Lr)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===C||(this.config.cookieless_mode===R?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return G?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ce(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>ce(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver}(G,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){z&&("visible"===z.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(D,{title:z.title},{send_instantly:!0}),this._visibilityStateListener&&(z.removeEventListener(M,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ei(z,M,this._visibilityStateListener)))}debug(e){!1===e?(null==B||B.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==B||B.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}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Vt.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):function(e,t,i,s,r){var n=t in e&&!Te(e[t]),o=i in e&&!Te(e[i]);return n?e[t]:!!o&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Vt)}_runBeforeSend(e){var t;if(Te(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Oe),s=me(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(r=n(r),Te(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Ce(e.event)?Vt.warn(o+". This can cause unexpected behavior."):Vt.info(o),null}r.properties&&!we(r.properties)||Vt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&Te(r.properties[a]))return Vt.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=ke(e)&&!e,i=hi._is_supported()&&"true"===hi._get("ph_debug");return!t&&(!!i||e)}}Wr.__defaultExtensionClasses={},Wr._noopLogger={trace:Or=()=>{},debug:Or,info:Or,warn:Or,error:Or,fatal:Or},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Jt(e.prototype[t[i]])}(Wr,["identify"]);var Yr=function(){s.SDK_DIST_CHANNEL="npm";var e=Ar[Br]=new Wr;return function(){function e(){e.done||(e.done=!0,Hr=!1,Yt(Ar,(function(e){e._dom_loaded()})))}null!=z&&z.addEventListener?"complete"===z.readyState?e():ei(z,"DOMContentLoaded",e,{capture:!1}):B&&Vt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Zi as Compression,ds as DEFAULT_PRODUCT_TOUR_APPEARANCE,_s as DisplaySurveyType,Wr as PostHog,cs as ProductTourEventName,hs as ProductTourEventProperties,ls as SurveyEventName,us as SurveyEventProperties,es as SurveyEventType,is as SurveyPosition,os as SurveyQuestionBranchingType,ns as SurveyQuestionType,as as SurveySchedule,ss as SurveyTabPosition,rs as SurveyType,ts as SurveyWidgetType,Yr as default,Yr as posthog,ms as severityLevels};
|
|
1
|
+
function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}var s={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.407.8",s.LIB_NAME="web";var r="$people_distinct_id",n="$device_id",o="$device_model",a="__alias",l="__timers",u="$dead_clicks_enabled_server_side",_="$session_recording_remote_config",d="$sesid",c="$session_is_sampled",h="$enabled_feature_flags",p="$minimal_flag_called_events",g="$surveys_loaded_at",v="$flag_call_reported",f="$feature_flag_evaluated_at",m="$user_state",y="$client_session_props",b="$capture_rate_limit",w="$initial_campaign_params",S="$initial_referrer_info",x="$initial_person_info",E="$epp",P="$posthog_cookieless",T="$cookieless_mode",I="$sdk_debug_extensions_init_method",k="$sdk_debug_extensions_init_time_ms",R="on_reject",C="always",O="anonymous",A="identified",F="identified_only",M="visibilitychange",L="beforeunload",D="$pageview",U="$pageleave",N="$identify",q="$groupidentify",B="undefined"!=typeof window?window:void 0,H="undefined"!=typeof globalThis?globalThis:B,G=null==H?void 0:H.navigator,z=null==H?void 0:H.document,V=null==H?void 0:H.location,j=null==H?void 0:H.fetch,W=null!=H&&H.XMLHttpRequest&&"withCredentials"in new H.XMLHttpRequest?H.XMLHttpRequest:void 0,Y=null==H?void 0:H.AbortController,K=null==H?void 0:H.CompressionStream,J=null==G?void 0:G.userAgent,Q="undefined"!=typeof globalThis?globalThis:B;Q&&"undefined"==typeof self&&(Q.self=Q),Q&&"undefined"==typeof File&&(Q.File=function(){});var X,Z=null!=B?B:{},ee=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],te=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ie=["$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"],se=["token"],re="NativeGzipValidationError",ne=e=>e.length>=2&&31===e[0]&&139===e[1],oe=(e,t)=>e===te.GZipJS||t===te.GZipJS||"gzip"===t,ae=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),le=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=re,t},ue=function(){var e=t((function*(e,t){18>e.size&&le("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ne(i)&&8===i[2]||le("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(X)return X;X=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;X[e]=t>>>0}return X})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&le("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&le("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function _e(){return _e=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield ue(u,r),u}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),_e.apply(this,arguments)}var de=["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"],ce=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return de.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function he(e,t){return-1!==e.indexOf(t)}var pe=function(e){return e.replace(/^\$/,"")},ge=Object.prototype,ve=ge.hasOwnProperty,fe=ge.toString,me=Array.isArray||function(e){return"[object Array]"===fe.call(e)},ye=e=>"function"==typeof e,be=e=>e===Object(e)&&!me(e),we=e=>{if(be(e)){for(var t in e)if(ve.call(e,t))return!1;return!0}return!1},Se=e=>void 0===e,xe=e=>"[object String]"==fe.call(e),Ee=e=>xe(e)&&0===e.trim().length,Pe=e=>null===e,Te=e=>Se(e)||Pe(e),Ie=e=>"[object Number]"==fe.call(e)&&e==e,$e=e=>Ie(e)&&e>0,ke=e=>"[object Boolean]"===fe.call(e),Re=e=>e instanceof FormData,Ce=e=>he(ie,e),Oe=e=>he(se,e),Ae=[!0,"true",1,"1","yes"],Fe=e=>he(Ae,e),Me=[!1,"false",0,"0","no"];function Le(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Ie(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Le(r||i,t,i,s))}var De="Mobile",Ue="iOS",Ne="Android",qe="Tablet",Be=Ne+" "+qe,He="iPad",Ge="Apple",ze=Ge+" Watch",Ve="Safari",je="BlackBerry",We="Samsung",Ye=We+"Browser",Ke=We+" Internet",Je="Chrome",Qe=Je+" OS",Xe=Je+" "+Ue,Ze="Internet Explorer",et=Ze+" "+De,tt="Opera",it=tt+" Mini",st="Edge",rt="Microsoft "+st,nt="Firefox",ot=nt+" "+Ue,at="Nintendo",lt="PlayStation",ut="Xbox",_t=Ne+" "+De,dt=De+" "+Ve,ct="Windows",ht=ct+" Phone",pt="Nokia",gt="Ouya",vt="Generic",ft=vt+" "+De.toLowerCase(),mt=vt+" "+qe.toLowerCase(),yt="Konqueror",bt="Oculus Browser",wt="Vivaldi",St="Yandex",xt="Whale",Et="DuckDuckGo",Pt="Pale Moon",Tt="Waterfox",It="Brave",$t="Google Search App",kt="(\\d+(\\.\\d+)?)",Rt=new RegExp("Version/"+kt),Ct=new RegExp(ut,"i"),Ot=new RegExp(lt+" \\w+","i"),At=new RegExp(at+" \\w+","i"),Ft=new RegExp(je+"|PlayBook|BB10","i"),Mt={"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"},Lt=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?It:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&he(e,"GSA/")?$t:he(e," OPR/")&&he(e,"Mini")?it:he(e," OPR/")?tt:Ft.test(e)?je:he(e,"IE"+De)||he(e,"WPDesktop")?et:he(e,"OculusBrowser")?bt:he(e,Ye)?Ke:he(e,st)||he(e,"Edg/")?rt:he(e,wt+"/")?wt:he(e,"YaBrowser/")?St:he(e,xt+"/")?xt:he(e,Et+"/")||he(e,"Ddg/")?Et:he(e,"FBIOS")?"Facebook "+De:he(e,"UCWEB")||he(e,"UCBrowser")?"UC Browser":he(e,"CriOS")?Xe:he(e,"CrMo")||he(e,Je)?Je:he(e,Ne)&&he(e,Ve)?_t:he(e,"FxiOS")?ot:he(e.toLowerCase(),yt.toLowerCase())?yt:he(e,It+"/")?It:((e,t)=>t&&he(t,Ge)||function(e){return he(e,Ve)&&!he(e,Je)&&!he(e,Ne)}(e))(e,t)?he(e,De)?dt:Ve:he(e,"PaleMoon/")?Pt:he(e,Tt+"/")?Tt:he(e,nt)?nt:he(e,"MSIE")||he(e,"Trident/")?Ze:he(e,"Gecko")?nt:"")},Dt={[et]:[new RegExp("rv:"+kt)],[rt]:[new RegExp(st+"?\\/"+kt)],[Je]:[new RegExp("("+Je+"|CrMo)\\/"+kt)],[Xe]:[new RegExp("CriOS\\/"+kt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+kt)],[Ve]:[Rt],[dt]:[Rt],[tt]:[new RegExp("(Opera|OPR)\\/"+kt)],[nt]:[new RegExp(nt+"\\/"+kt)],[ot]:[new RegExp("FxiOS\\/"+kt)],[yt]:[new RegExp("Konqueror[:/]?"+kt,"i")],[je]:[new RegExp(je+" "+kt),Rt],[_t]:[new RegExp("android\\s"+kt,"i")],[Ke]:[new RegExp(Ye+"\\/"+kt)],[bt]:[new RegExp("OculusBrowser\\/"+kt)],[wt]:[new RegExp(wt+"\\/"+kt)],[St]:[new RegExp("YaBrowser\\/"+kt)],[xt]:[new RegExp(xt+"\\/"+kt)],[It]:[new RegExp(It+"\\/"+kt)],[Et]:[new RegExp("(DuckDuckGo|Ddg)\\/"+kt)],[Pt]:[new RegExp("PaleMoon\\/"+kt)],[Tt]:[new RegExp(Tt+"\\/"+kt)],[$t]:[new RegExp("GSA\\/"+kt)],[Ze]:[new RegExp("(rv:|MSIE )"+kt)],Mozilla:[new RegExp("rv:"+kt)]},Ut=function(e,t,i,s){var r=Lt(e,t,i,s),n=Dt[r];if(Se(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Nt=[[new RegExp(ut+"; "+ut+" (.*?)[);]","i"),e=>[ut,e&&e[1]||""]],[new RegExp(at,"i"),[at,""]],[new RegExp(lt,"i"),[lt,""]],[Ft,[je,""]],[new RegExp(ct,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ht,""];if(new RegExp(De).test(t)&&!/IEMobile\b/.test(t))return[ct+" "+De,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Mt[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ct,s]}return[ct,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ue,[e[3],e[4],e[5]||"0"].join(".")]:[Ue,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ne+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ne+")","i"),e=>e&&e[2]?[Ne,[e[2],e[3],e[4]||"0"].join(".")]:[Ne,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Qe,""]],[/Linux|debian/i,["Linux",""]]],qt=function(e){return At.test(e)?at:Ot.test(e)?lt:Ct.test(e)?ut:new RegExp(gt,"i").test(e)?gt:new RegExp("("+ht+"|WPDesktop)","i").test(e)?ht:/iPad/.test(e)?He:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ze:Ft.test(e)?je:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(pt,"i").test(e)?pt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(De).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ne:Be:new RegExp("(pda|"+De+")","i").test(e)?ft:new RegExp(qe,"i").test(e)&&!new RegExp(qe+" pc","i").test(e)?mt:""},Bt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ht(e,t){return"string"==typeof(i=e)&&Bt.test(i)?e:t();var i}function Gt(e){return e?e.split("#")[0]:e}var zt=function(e,t){var i=(void 0===t?{}:t).debugEnabled,r={_log(t){if(B&&(s.DEBUG||B.POSTHOG_DEBUG||i)&&!Se(B.console)&&B.console){for(var r=("__rrweb_original__"in B.console[t]?B.console[t].__rrweb_original__:B.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>zt(e+" "+t,i)};return r},Vt=zt("[PostHog.js]"),jt=Vt.createLogger;function Wt(e,t){me(e)&&e.forEach(t)}function Yt(e,t){if(!Te(e))if(me(e))e.forEach(t);else if(Re(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)ve.call(e,i)&&t(e[i],i)}var Kt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},Jt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Vt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vt.critical(e)}}},Qt=function(e){var t={};return Yt(e,(function(e,i){(xe(e)&&e.length>0||Ie(e))&&(t[i]=e)})),t};var Xt=["herokuapp.com","vercel.app","netlify.app"];function Zt(e){var t=null==e?void 0:e.hostname;if(!xe(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Xt)if(i===s)return!1;return!0}function ei(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var ti=e=>{if(z){try{for(var t=e+"=",i=z.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ie(e)&&isFinite(e)&&Math.floor(e)===e});class ii{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new ii(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ii(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class si{generate(){var e=this.generateOrAbort();if(!Se(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Se(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ii.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new oi}}var ri,ni=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};B&&!Se(B.crypto)&&crypto.getRandomValues&&(ni=e=>crypto.getRandomValues(e));class oi{nextUint32(){return this._buffer.length>this._cursor||(ni(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var ai=()=>li().toString(),li=()=>(ri||(ri=new si)).generate(),ui="",_i=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var di={_is_supported:()=>!!z,_error(e){Vt.error("cookieStore error: "+e)},_get:ti,_parse(e){var t;try{t=JSON.parse(di._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!z)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=z),ui)return ui;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+ai();!ui&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ui=n)}return ui}(e);if(!i){var s=(e=>{var t=e.match(_i);return t?t[0]:""})(e);s!==i&&Vt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(z.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Vt.warn("cookieStore warning: large cookie, len="+u.length),z.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=z&&z.cookie)try{di._set(e,"",-1,t)}catch(e){return}}},ci=null,hi={_is_supported(){if(!Pe(ci))return ci;var e=!0;if(Se(B))e=!1;else try{var t="__mplssupport__";hi._set(t,"xyz"),'"xyz"'!==hi._get(t)&&(e=!1),hi._remove(t)}catch(t){e=!1}return e||Vt.error("localStorage unsupported; falling back to cookie store"),ci=e,e},_error(e){Vt.error("localStorage error: "+e)},_get(e){try{return null==B?void 0:B.localStorage.getItem(e)}catch(e){hi._error(e)}return null},_parse(e){try{return JSON.parse(hi._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==B||B.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){hi._error(e)}return!1},_remove(e){try{null==B||B.localStorage.removeItem(e)}catch(e){hi._error(e)}}},pi=[n,"distinct_id",d,c,E,x,m],gi={},vi={_is_supported:()=>!0,_error(e){Vt.error("memoryStorage error: "+e)},_get:e=>gi[e]||null,_parse:e=>gi[e]||null,_set:(e,t)=>(gi[e]=t,!0),_remove(e){delete gi[e]}},fi=null,mi={_is_supported(){if(!Pe(fi))return fi;if(fi=!0,Se(B))fi=!1;else try{var e="__support__";mi._set(e,"xyz"),'"xyz"'!==mi._get(e)&&(fi=!1),mi._remove(e)}catch(e){fi=!1}return fi},_error(e){Vt.error("sessionStorage error: ",e)},_get(e){try{return null==B?void 0:B.sessionStorage.getItem(e)}catch(e){mi._error(e)}return null},_parse(e){try{return JSON.parse(mi._get(e))||null}catch(e){}return null},_set(e,t){try{return null==B||B.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){mi._error(e)}return!1},_remove(e){try{null==B||B.sessionStorage.removeItem(e)}catch(e){mi._error(e)}}};class yi{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===C||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===R}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Fe(e)?1:he(Me,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?hi:di;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?di:hi;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Fe(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==G?void 0:G.doNotTrack,null==G?void 0:G.msDoNotTrack,Z.doNotTrack].some((e=>Fe(e)))}}var bi=["next","previous","prev",">","<","+","-","−","–"];jt("[Dead Clicks]");var wi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(u)),s=e.instance.config.capture_dead_clicks;return ke(s)?s:!!be(s)||i},Si=jt("[SegmentIntegration]");var xi="posthog-js";function Ei(e,t){var s=void 0===t?{}:t,r=s.organization,n=s.projectId,o=s.prefix,a=s.severityAllowList,l=void 0===a?["error"]:a,u=s.sendExceptionsToPostHog,_=void 0===u||u;return t=>{var s,a,u,d,c;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(s=t.exception)?void 0:s.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return r&&n&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),_&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Pi{constructor(e,t,i,s,r,n){this.name=xi,this.setupOnce=function(o){o(Ei(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Ti{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Vt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==B?void 0:B.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,_=r.maxContentY;if(!(Se(n)||Se(o)||Se(a)||Se(l)||Se(u)||Se(_))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),_=Math.ceil(_);var d=n>1?Le(o/n,0,1,Vt):1,c=n>1?Le(a/n,0,1,Vt):1,h=l>1?Le(u/l,0,1,Vt):1,p=l>1?Le(_/l,0,1,Vt):1;s=Kt(s,{$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:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:_,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var Ii=["flags","surveys"],$i={[r]:{exposure:"hidden"},[a]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[l]:{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"},[u]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[_]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>Pe(e)},$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"},$sess_rec_flush_size:{exposure:"hidden"},[h]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!be(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},[p]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[g]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[v]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},[E]:{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"},[I]:{exposure:"event"},[k]:{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"}},ki=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ri=e=>{var t=$i[e];if(t)return t;for(var i of ki){var s=i[1];if(0===e.indexOf(i[0]))return s}},Ci=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return s=[],null!==(i=JSON.stringify(e,(function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(t))return"[Circular]";s.push(t)}return t}})))&&void 0!==i?i:"null"}var i,s},Oi=e=>{var t=null==z?void 0:z.createElement("a");return Se(t)?null:(t.href=e,t)},Ai=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!me(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Vt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Fi=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],_=0;l.length>_;_++){var d=l[_].split("=");me(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[_]))}var c=a;return null!=o&&(c+="?"+u.join("&")),null!=r&&(c+="#"+r),c},Mi="https?://(.*)",Li=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Di=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Li],Ui="<masked>",Ni=["li_fat_id"];function qi(e,t){var i=Di.concat(t||[]),s={};return Yt(i,(function(t){var i=Ai(e,t);s[t]=i||null})),s}function Bi(e){var t=function(e){return e?0===e.search(Mi+"google.([^/?]*)")?"google":0===e.search(Mi+"bing.com")?"bing":0===e.search(Mi+"yahoo.com")?"yahoo":0===e.search(Mi+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Pe(t)){s.$search_engine=t;var r=z?Ai(z.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Hi(){return navigator.language||navigator.userLanguage}var Gi="$direct";function zi(){return(null==z?void 0:z.referrer)||Gi}function Vi(e,t,i){void 0===i&&(i=!1);var s=e?[...Li,...t||[]]:[],r=i?Gt(null==V?void 0:V.href):null==V?void 0:V.href,n=null==r?void 0:r.substring(0,1e3);return{r:zi().substring(0,1e3),u:n?Fi(n,s,Ui):void 0}}function ji(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Gt(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==Gi?Gi:null==(i=Oi(s))?void 0:i.host};if(n){o.$current_url=n;var a=Oi(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=qi(n);Kt(o,l)}if(s){var u=Bi(s);Kt(o,u)}return o}function Wi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Yi(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Ki={flags:f,surveys:g},Ji=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Qi="main";class Xi{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&Vt.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),B){var r=()=>this.flush();ei(B,"beforeunload",r,{capture:!1}),ei(B,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ie(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Ji.indexOf(e.persistence.toLowerCase())&&(Vt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...pi,...e];return i({},hi,{_parse(e){try{var i={};try{i=di._parse(e)||{}}catch(e){}var s,r=JSON.parse(hi._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Pe(a)||""===a||(n[o]=a)}s=Kt(r,n)}else s=Kt(i,r);return hi._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=hi._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&di._set(e,l,i,r,n,o)}catch(e){hi._error(e)}return a},_remove(e,t){try{null==B||B.localStorage.removeItem(e),di._remove(e,t)}catch(e){hi._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&hi._is_supported()?(t=hi,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&mi._is_supported()?t=mi:"memory"===n?t=vi:"cookie"===n?t=di:s._is_supported()?(t=s,r=!0):t=di,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[f];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Yt(this.props,((t,i)=>{var s=Ri(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===h?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&Kt(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=Kt({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of Ii){var t=hi._parse(this._groupEntryName(e));if(t&&!we(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Kt(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Ri(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Ki[e];if(!i)return!1;var s=t[i],r=this.props[i];return Ie(s)&&Ie(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Ri(e))?void 0:t.storageGroup:void 0,s=i?hi._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Se(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Se(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Qi))}_writeNowSplit(){var e=this._partitionProps(),t=e.main,i=e.groups;for(var s of(this._writeEntry(this._storage,this._name,t,Qi),Ii)){var r,n=i[s];(!we(n)||null!=(r=this._slotState[s])&&r.persisted)&&this._writeEntry(hi,this._groupEntryName(s),n,s)}}_partitionProps(){var e={},t={flags:{},surveys:{}};return Yt(this.props,((i,s)=>{var r,n=null==(r=Ri(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Qi)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Yt(e,((e,t)=>{var s;i[t]=null!=(s=Ri(t))&&s.volatile?"__volatile__":e})),JSON.stringify(i)}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Qi||r.dirty||Se(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==Qi&&(r.persisted=!0),Se(n)||(r.fingerprint=n)):this._config.debug&&Vt.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(Se(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!i&&this._ownsSplitStorage)for(var s of Ii)hi._remove(this._groupEntryName(s));i?delete this._slotState[Qi]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(be(e)){Se(t)&&(t="None"),this._expire_days=Se(i)?this._default_expiry:i;var s=!1;if(Yt(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(be(e)){this._expire_days=Se(t)?this._default_expiry:t;var i=!1;if(Yt(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=function(e,t,i){if(!z)return{};var s,r=t?[...Li,...i||[]]:[],n=qi(Fi(z.URL,r,Ui),e),o=(s={},Yt(Ni,(function(e){var t=ti(e);s[e]=t||null})),s);return Kt(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);we(Qt(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==z?void 0:z.referrer)?Bi(e):{})}update_referrer_info(){var e;this.register_once({$referrer:zi(),$referring_domain:null!=z&&z.referrer&&(null==(e=Oi(z.referrer))?void 0:e.host)||Gi},void 0)}set_initial_person_info(){this.props[w]||this.props[S]||this.register_once({[x]:Vi(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Yt([S,w],(t=>{var i=this.props[t];i&&Yt(i,(function(t,i){e["$initial_"+pe(i)]=t}))}));var t=this.props[x];if(t){var i=function(e,t){void 0===t&&(t=!1);var i=ji(e,t),s={};return Yt(i,(function(e,t){s["$initial_"+pe(t)]=e})),s}(t,this._config.disable_capture_url_hashes);Kt(e,i)}return e}safe_merge(e){return Yt(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[l]||{};i[e]=t,this._setProp(l,i),this.save()}remove_event_timer(e){var t=this.props[l]||{},i=t[e];return Se(i)||(delete t[e],this._setProp(l,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var i;this.props[e]=t,null!=(i=Ri(e))&&i.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=Ri(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Zi={GZipJS:"gzip-js",Base64:"base64"},es={Activation:"events",Cancellation:"cancelEvents"},ts={Button:"button",Tab:"tab",Selector:"selector"},is={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"},ss={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},rs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ns={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},os={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},as={Once:"once",Recurring:"recurring",Always:"always"},ls={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},us={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",SURVEY_LANGUAGE:"$survey_language"},_s={Popover:"popover",Inline:"inline"},ds={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},cs={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"},hs={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"},ps=jt("[RateLimiter]");class gs{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ps.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void ps.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(b))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(b,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var vs=jt("[RemoteConfig]");class fs{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Z._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Z.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Z.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return vs.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void vs.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return vs.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){vs.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&z&&"hidden"!==z.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||vs.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var ms=["fatal","error","warning","log","info","debug"],ys=Uint8Array,bs=Uint16Array,ws=Uint32Array,Ss=new ys([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]),xs=new ys([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]),Es=new ys([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ps=function(e,t){for(var i=new bs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new ws(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},Ts=Ps(Ss,2),Is=Ts[1];Ts[0][28]=258,Is[258]=28;for(var $s=Ps(xs,0)[1],ks=new bs(32768),Rs=0;32768>Rs;++Rs){var Cs=(43690&Rs)>>>1|(21845&Rs)<<1;ks[Rs]=((65280&(Cs=(61680&(Cs=(52428&Cs)>>>2|(13107&Cs)<<2))>>>4|(3855&Cs)<<4))>>>8|(255&Cs)<<8)>>>1}var Os=function(e,t,i){for(var s=e.length,r=0,n=new bs(t);s>r;++r)++n[e[r]-1];var o,a=new bs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new bs(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],_=t-e[r],d=a[e[r]-1]++<<_,c=d|(1<<_)-1;c>=d;++d)o[ks[d]>>>l]=u}else for(o=new bs(s),r=0;s>r;++r)o[r]=ks[a[e[r]-1]++]>>>15-e[r];return o},As=new ys(288);for(Rs=0;144>Rs;++Rs)As[Rs]=8;for(Rs=144;256>Rs;++Rs)As[Rs]=9;for(Rs=256;280>Rs;++Rs)As[Rs]=7;for(Rs=280;288>Rs;++Rs)As[Rs]=8;var Fs=new ys(32);for(Rs=0;32>Rs;++Rs)Fs[Rs]=5;var Ms=Os(As,9,0),Ls=Os(Fs,5,0),Ds=function(e){return(e/8>>0)+(7&e&&1)},Us=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof bs?bs:e instanceof ws?ws:ys)(i-t);return s.set(e.subarray(t,i)),s},Ns=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},qs=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Bs=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new ys(0),0];if(1==r){var o=new ys(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,_=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};_!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=_&&i[d].f>i[u].f?u++:d++],i[_++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new bs(c+1),p=Hs(i[_-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new ys(h),p]},Hs=function(e,t,i){return-1==e.s?Math.max(Hs(e.l,t,i+1),Hs(e.r,t,i+1)):t[e.s]=i},Gs=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new bs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},zs=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Vs=function(e,t,i){var s=i.length,r=Ds(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},js=function(e,t,i,s,r,n,o,a,l,u,_){Ns(t,_++,i),++r[256];for(var d=Bs(r,15),c=d[0],h=d[1],p=Bs(n,15),g=p[0],v=p[1],f=Gs(c),m=f[0],y=f[1],b=Gs(g),w=b[0],S=b[1],x=new bs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var P=Bs(x,7),T=P[0],I=P[1],k=19;k>4&&!T[Es[k-1]];--k);var R,C,O,A,F=u+5<<3,M=zs(r,As)+zs(n,Fs)+o,L=zs(r,c)+zs(n,g)+o+14+3*k+zs(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&L>=F)return Vs(t,_,e.subarray(l,l+u));if(Ns(t,_,1+(M>L)),_+=2,M>L){R=Os(c,h,0),C=c,O=Os(g,v,0),A=g;var D=Os(T,I,0);for(Ns(t,_,y-257),Ns(t,_+5,S-1),Ns(t,_+10,k-4),_+=14,E=0;k>E;++E)Ns(t,_+3*E,T[Es[E]]);_+=3*k;for(var U=[m,w],N=0;2>N;++N){var q=U[N];for(E=0;q.length>E;++E)Ns(t,_,D[B=31&q[E]]),_+=T[B],B>15&&(Ns(t,_,q[E]>>>5&127),_+=q[E]>>>12)}}else R=Ms,C=As,O=Ls,A=Fs;for(E=0;a>E;++E)if(s[E]>255){var B;qs(t,_,R[257+(B=s[E]>>>18&31)]),_+=C[B+257],B>7&&(Ns(t,_,s[E]>>>23&31),_+=Ss[B]);var H=31&s[E];qs(t,_,O[H]),_+=A[H],H>3&&(qs(t,_,s[E]>>>5&8191),_+=xs[H])}else qs(t,_,R[s[E]]),_+=C[s[E]];return qs(t,_,R[256]),_+C[256]},Ws=new ws([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ys=function(){for(var e=new ws(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Ks=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Js(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=Ys[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new ys(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var _=0;o>=_;_+=65535){var d=_+65535;o>d?u=Vs(l,u,e.subarray(_,d)):(l[_]=!0,u=Vs(l,u,e.subarray(_,o)))}else{for(var c=Ws[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new bs(32768),f=new bs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new ws(25e3),S=new bs(288),x=new bs(32),E=0,P=0,T=(_=0,0),I=0,k=0;o>_;++_){var R=b(_),C=32767&_,O=f[R];if(v[C]=O,f[R]=C,_>=I){var A=o-_;if((E>7e3||T>24576)&&A>423){u=js(e,l,0,w,S,x,P,T,k,_-k,u),T=E=P=0,k=_;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,L=0,D=p,U=C-O&32767;if(A>2&&R==b(_-U))for(var N=Math.min(h,A)-1,q=Math.min(32767,_),B=Math.min(258,A);q>=U&&--D&&C!=O;){if(e[_+M]==e[_+M-U]){for(var H=0;B>H&&e[_+H]==e[_+H-U];++H);if(H>M){if(M=H,L=U,H>N)break;var G=Math.min(U,H-2),z=0;for(F=0;G>F;++F){var V=_-U+F+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,O=V)}}}U+=(C=O)-(O=v[C])+32768&32767}if(L){w[T++]=268435456|Is[M]<<18|$s[L];var W=31&Is[M],Y=31&$s[L];P+=Ss[W]+xs[Y],++S[257+W],++x[Y],I=_+M,++E}else w[T++]=e[_],++S[e[_]]}}u=js(e,l,!0,w,S,x,P,T,k,_-k,u)}return Us(a,0,s+Ds(u)+r)}(n=e,null==(o=t).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,l)),_=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Ks(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),Ks(u,_-8,i.d()),Ks(u,_-4,s),u}var Qs=!!W||!!j,Xs="text/plain",Zs=!1,er=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},tr=function(e,t,s){var r;void 0===s&&(s=!0);var n=e.split("?"),o=n[0],a=n[1],l=i({},t),u=null!==(r=null==a?void 0:a.split("&").map((e=>{var t,i=e.split("="),r=i[0],n=s&&null!==(t=l[r])&&void 0!==t?t:i[1];return delete l[r],r+"="+n})))&&void 0!==r?r:[],_=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Yt(e,(function(e,t){Se(e)||Se(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(l);return _&&u.push(_),u.length>0?o+"?"+u.join("&"):o},ir=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===Zi.GZipJS){var s=Js(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ys(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ys(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Us(s,0,r)}(Ci(t)),{mtime:0});return{contentType:Xs,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===Zi.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Ci(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ci(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ci(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},sr=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:tr(e.url,{compression:Zi.Base64}),encodedBody:ir(i({},e,{compression:Zi.Base64,_encodedBody:void 0}))}:{url:er(e.url,"compression"),encodedBody:ir(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=ir(e)}catch(t){if(oe(e.compression,Ai(e.url,"compression")))return Vt.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&oe(e.compression,Ai(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?ne(new Uint8Array(s)):ArrayBuffer.isView(s)&&ne(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Zs=!0,r()):{url:e.url,encodedBody:t}},rr=e=>{try{return sr(e)}catch(t){return Vt.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},nr=function(){var e=t((function*(e){var t=Ci(e.data),r=yield function(e,t,i){return _e.apply(this,arguments)}(t,s.DEBUG,{rethrow:!0});if(!r)return e;var n=yield r.arrayBuffer();return i({},e,{_encodedBody:{contentType:Xs,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),or=/Failed to fetch|NetworkError|Load failed/i,ar=e=>{var t=rr(e);if(t){var s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,u=new Headers;Yt(e.headers,(function(e,t){u.append(t,e)})),o&&u.append("Content-Type",o);var _=null,d=!1;if(Y){var c=new Y;_={signal:c.signal,timeout:setTimeout((()=>{var t,i;d=!0,c.abort((t=e.timeout,(i=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",i))}),e.timeout)}}var h=t=>{d&&"AbortError"===(null==t?void 0:t.name)||(e=>"TypeError"===(null==e?void 0:e.name)&&or.test((null==e?void 0:e.message)||""))(t)?Vt.warn(t):Vt.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var p;j(s,i({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(p=_)?void 0:p.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Vt.error(e)}null==e.callback||e.callback(s)})))).catch(h).finally((()=>_?clearTimeout(_.timeout):null))}catch(e){_&&clearTimeout(_.timeout),h(e)}}},lr=e=>{try{var t,s=sr(e),r=s.url,n=s.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(G.sendBeacon(r,u))return;var _=me(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(me(_)&&_.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(_.length/2),c=t=>me(e.data)?t:i({},e.data,{batch:t});return lr(i({},e,{data:c(_.slice(0,d))})),void lr(i({},e,{data:c(_.slice(d))}))}Vt.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ar(i({},e,{_keepaliveDisabled:!0}))}catch(e){Vt.warn("Beacon send failed",e)}},ur=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return tr(s===Zi.GZipJS?er(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===Zi.GZipJS?{}:{compression:s}))},_r=[];j&&_r.push({transport:"fetch",method:ar}),W&&_r.push({transport:"XHR",method(e){var t=rr(e);if(t){var i=new W,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;Yt(e.headers,(function(e,t){i.setRequestHeader(t,e)})),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(o)}}}),null!=G&&G.sendBeacon&&_r.push({transport:"sendBeacon",method:lr});var dr=3e3;class cr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Le((null==t?void 0:t.flush_interval_ms)||dr,250,5e3,Vt.createLogger("flush interval"),dr),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequestSafely(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&me(i.data)&&Yt(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequestSafely(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Vt.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Yt(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Se(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var hr=["retriesPerformedSoFar"];class pr{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Se(B)&&"onLine"in B.navigator&&(this._areWeOnline=B.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ei(B,"online",this._onlineListener),ei(B,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,hr);$e(t)&&(s.url=tr(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Vt.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),Vt.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Se(B)||(this._onlineListener&&(B.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(B.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(e){Vt.error(e)}}this._queue=[]}}class gr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ei(B,"scroll",this._updateScrollData,{capture:!0}),ei(B,"scrollend",this._updateScrollData,{capture:!0}),ei(B,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==B?void 0:B.document.documentElement;var e=me(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==B?void 0:B.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return B?"y"===e?B.scrollY||B.pageYOffset||B.document.documentElement.scrollTop||0:B.scrollX||B.pageXOffset||B.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var vr=e=>Vi(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class fr{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[y]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||vr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[y]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?ji(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Yt(Qt(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+pe(i)]=t})),e}}class mr{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}constructor(){this._events={}}}var yr=jt("[SessionId]");class br{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new mr,this._sessionHasBeenIdleTooLong=(e,t)=>!(!$e(e)||!$e(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===C)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||ai,this._windowIdGenerator=i||ai;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Le(this._config.session_idle_timeout_seconds||1800,60,36e3,yr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=mi._parse(this._window_id_storage_key),o=mi._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:mi._remove(this._window_id_storage_key),mi._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){yr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Se(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&mi._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&mi._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?mi._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Pe(t)&&!Pe(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[d]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return $e(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(d):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Pe(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[d]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=$e(e)?e:0,i=$e(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[d];return me(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&B&&(B.removeEventListener(L,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&mi._remove(this._primary_window_exists_storage_key)},ei(B,L,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===C)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this._getSessionId(),r=s[1],n=s[2],o=this._freshestActivityTimestamp(),a=this._getWindowId(),l=$e(n)&&Math.abs(i-n)>864e5,u=!1,_=!1,d=!r,c=r,h=!d&&!e&&this._sessionHasBeenIdleTooLong(i,o);if(h){(h=this._isSessionIdleAfterCrossTabRefresh(i))||yr.info("cross-tab refresh kept the session alive",{sessionId:r});var p=this._getSessionId();r=p[1],n=p[2]}d||h||l?(r=this._sessionIdGenerator(),a=this._windowIdGenerator(),yr.info("new session ID generated",{sessionId:r,windowId:a,changeReason:{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this._windowIdGenerator(),u=!0),(_=r!==c)&&(yr.info("adopted cross-tab session id",{sessionId:r,windowId:a}),u=!0));var g=$e(o)&&e&&!l?o:i,v=$e(n)?n:(new Date).getTime();this._setWindowId(a),this._setSessionId(r,g,v),e||this._resetIdleTimer();var f={noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l,crossTabAdoption:_};return u&&this._sessionIdChangedHandlers.forEach((e=>e(r,a,f))),{sessionId:r,windowId:a,sessionStartTimestamp:v,changeReason:u?f:void 0,lastActivityTimestamp:o}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}function wr(){return(wr=t((function*(){var e=null==G?void 0:G.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return xe(i)&&i.length>0?i:void 0}catch(e){return void Vt.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}))).apply(this,arguments)}function Sr(e,t,i){return Ci({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var xr="custom",Er="i.posthog.com",Pr=/^\/static\//;class Tr{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Er,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":xr),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Pr.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===xr)return this.apiHost+t;var s=Er+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var Ir=jt("[Surveys]"),$r={ignoreConditions:!1,ignoreDelay:!1,displayType:_s.Popover},kr=jt("[PostHog ExternalIntegrations]"),Rr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cr{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Z.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return kr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,s,r,n=i[0],o=i[1];!o||null!=(t=Z.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(Rr[n],(()=>{var t;null==(t=Z.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)})),!o&&null!=(s=Z.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=Z.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())};for(var i of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t()}}}var Or,Ar={},Fr=0,Mr=()=>{},Lr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Dr="Surveys module not available",Ur="sanitize_properties is deprecated. Use before_send instead",Nr="Invalid value for property_denylist config: ",qr=["token","distinct_id",T],Br="posthog",Hr=!Qs&&-1===(null==J?void 0:J.indexOf("MSIE"))&&-1===(null==J?void 0:J.indexOf("Mozilla")),Gr=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Zt(null==z?void 0:z.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Mr,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,__preview_cookie_wins_on_conflict:!1,debug:V&&xe(null==V?void 0:V.search)&&-1!==V.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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==B||null==(t=B.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Vt.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:F,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:dr},error_tracking:{},_onCapture:Mr},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:bi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)}))(e))},zr=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Vr=e=>{var t={};for(var i of zr){var s=i[0],r=i[1];Se(e[s])||(t[r]=e[s])}var n=Kt({},t,e),o=e.__preview_external_dependency_versioned_paths;return Se(o)||(Se(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),xe(o)&&Se(e.asset_host)&&(n.asset_host=o)),me(e.property_blacklist)&&(Se(e.property_denylist)?n.property_denylist=e.property_blacklist:me(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Vt.error(Nr+e.property_denylist)),n};class jr{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Vt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Wr{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===C||this.config.cookieless_mode===R&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new jr,this._personProcessingSetOncePropertiesSent=!1,this.version=s.LIB_VERSION,this._internalEventEmitter=new mr,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Gr(),this.SentryIntegration=Pi,this.sentryIntegration=e=>function(e,t){var i=Ei(e,t);return{name:xi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new gr(this),this.pageViewManager=new Ti(this),this.rateLimiter=new gs(this),this.requestRouter=new Tr(this),this.consent=new yi(this),this.externalIntegrations=new Cr(this);var t=null!==(e=Wr.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=xe(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=xe(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Vt.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Br){var s,r=null!==(s=Ar[i])&&void 0!==s?s:new Wr;return r._init(e,t,i),Ar[i]=r,Ar[Br][i]=r,r}return this._init(e,t,i)}_init(e,t,r){var n,a;void 0===t&&(t={});var l=xe(e)?e.trim():"";if(!l)return Vt.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=Gr(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var u=Gr(t.defaults),_=Vr(t),d=Kt({},u,_,{name:r,token:l});be(u.rageclick)&&be(_.rageclick)&&(d.rageclick=Kt({},u.rageclick,_.rageclick)),be(u.session_recording)&&be(_.session_recording)&&(d.session_recording=Kt({},u.session_recording,_.session_recording)),this.set_config(d),this.config.on_xhr_error&&Vt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Zi.GZipJS;var c=this._is_persistence_disabled();this.persistence=new Xi(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xi(i({},this.config,{persistence:"sessionStorage"}),c,!1);var h=i({},this.persistence.props),p=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new cr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new pr(this),this.__request_queue=[];var g=this._inCookielessMode();if(g||(this.sessionManager=new br(this),this.sessionPropsManager=new fr(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Vt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(g)}),0)):(Vt.info("Initializing extensions synchronously"),this._initExtensions(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Vt.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:h,s:p}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(a=t.bootstrap)?void 0:a.distinctID)){var v=t.bootstrap.distinctID,f=this.get_distinct_id(),y=this.persistence.get_property(m);if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===O)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===A)Vt.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 b=this.config.get_device_id(ai()),w=t.bootstrap.isIdentifiedID?b:v;this.persistence.set_property(m,t.bootstrap.isIdentifiedID?A:O),this.register({distinct_id:v,$device_id:w})}}if(g)this.register_once({distinct_id:P,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(ai());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(m,O)}return ei(B,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||ai();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(m,A)),t()},r=i.user();"then"in r&&ye(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||Si.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Si.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Si.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,D),identify:e=>t(e,N),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),ye(this.config._onCapture)&&this.config._onCapture!==Mr&&(Vt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Vt.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.config.disableDeviceModel||function(){return wr.apply(this,arguments)}().then((e=>{e&&this.register({[o]:e})})).catch(Mr),this}_initExtensions(e){var t,s,r,n,o,a,l,u,_=performance.now(),d=i({},Wr.__defaultExtensionClasses,this.config.__extensionClasses),c=[];d.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new d.featureFlags(this)),d.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new d.exceptions(this)),d.historyAutocapture&&this._extensions.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this._extensions.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this._extensions.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this._extensions.push(this.autocapture=new d.autocapture(this)),d.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this)),d.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this)),d.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this._extensions.push(this.productTours=new d.productTours(this)),d.heatmaps&&this._extensions.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this._extensions.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,wi)),d.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this._extensions.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new d.experiments(this)),this._extensions.forEach((e=>{e.initialize&&c.push((()=>{null==e.initialize||e.initialize()}))})),c.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(c,_)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Vt.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[I]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[k]:s}),this.config.__preview_deferred_init_extensions&&Vt.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){if(!z||!z.body)return Vt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var t,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=he(i.supportedCompression,Zi.GZipJS)?Zi.GZipJS:he(i.supportedCompression,Zi.Base64)?Zi.Base64:void 0),null!=(t=i.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:F}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Vt.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=V&&V.hostname){var e=V.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new fs(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Wt(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,r;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(U),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(U,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Hr?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(Se(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4;var o,a,l,u,_,d=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Se(n.compression)&&n.data&&(n.compression=Zi.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(_=(u=me(o=n.data)?o:[o])[0])||null==(l=_.properties)?void 0:l.token)&&void 0!==a?a:null==_?void 0:_.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),me(e)?e.map((e=>i({},e,{sent_at:t}))):i({},e,{sent_at:t})}(n.data))),n.url=ur(n.url,n.method,n.compression,n.timestampMode);var c=_r.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),h=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===d)return e[i]}(c))?void 0:r.method)&&void 0!==s?s:c[0].method;if(!h)throw new Error("No available transport method");"sendBeacon"!==d&&n.data&&n.compression===Zi.GZipJS&&K&&"undefined"!=typeof Promise&&!Zs?nr(n).then((e=>{h(e)})).catch((t=>{if(ae(t))return Zs=!0,void h(i({},n,{compression:void 0,url:ur(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return ae(e)||t===re})(t)&&(Zs=!0),h(n)})):h(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Fr++;try{var t,i=[],s=[],r=[];Wt(e,(e=>{if(e)if(me(t=e[0]))r.push(e);else if(ye(e))try{e.call(this)}catch(t){Vt.error("Error executing queued PostHog call",e,t)}else me(e)&&"alias"===t?i.push(e):me(e)&&-1!==t.indexOf("capture")&&ye(this[t])?r.push(e):s.push(e)}));var n=function(e,t){Wt(e,(function(e){try{if(me(e[0])){var i=t;Yt(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Vt.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Fr--}}push(e){if(Fr>0&&me(e)&&xe(e[0])){var t=Wr.prototype[e[0]];ye(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Se(e)&&xe(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var _=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==_||!_.isRateLimited){null!=t&&t.$current_url&&!xe(null==t?void 0:t.$current_url)&&(Vt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Vt.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 d=new Date,c=(null==s?void 0:s.timestamp)||d,h=Ht(null==s?void 0:s.uuid,ai),g={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},c,h)};e===D&&this.config.__preview_capture_bot_pageviews&&u&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),_&&(g.properties.$lib_rate_limit_remaining_tokens=_.remainingTokens);var v="$feature_flag_called"===e&&!1===g.properties.$feature_flag_has_experiment&&!0===this.get_property(p);(null==s?void 0:s.$set)&&!v&&(g.$set=null==s?void 0:s.$set);var f=null==s?void 0:s.$unset;f&&(g.$unset=f);var m,y,b,w=v?void 0:this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==q,e===N);if(w&&(g.$set_once=w),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=g,a=e=>xe(e)?e.slice(0,n):e,l=new Set,g=function e(t,i){if(t!==Object(t))return a?a(t):t;if(!l.has(t)){var s;if(l.add(t),me(t))s=[],Wt(t,(t=>{s.push(e(t))}));else{var r={};Yt(t,((t,i)=>{l.has(t)||(r[i]=e(t,i))})),s=r}return s}}(o)),g.timestamp=c,Se(null==s?void 0:s.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=d),v&&(g.properties=function(e,t){void 0===t&&(t=[]);var i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return ee.forEach(s),t.forEach(s),i}(g.properties,qr)),e===ls.DISMISSED||e===ls.SENT){var S=null==t?void 0:t[us.SURVEY_ID],x=null==t?void 0:t[us.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>"seenSurvey_"+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){Ir.error("Failed to persist survey seen state",e)}})({id:S,current_iteration:x}),g.$set=i({},g.$set,{[(m={id:S,current_iteration:x},y=e===ls.SENT?"responded":"dismissed",b="$survey_"+y+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(b="$survey_"+y+"/"+m.id+"/"+m.current_iteration),b)]:!0})}else e===ls.SHOWN&&(g.$set=i({},g.$set,{[us.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===cs.SHOWN){var E=null==t?void 0:t[hs.TOUR_TYPE];E&&(g.$set=i({},g.$set,{[hs.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var P=i({},g.properties.$set,g.$set);if(we(P)||this.setPersonPropertiesForFlags(P),!Te(this.config.before_send)){var T=this._runBeforeSend(g);if(!T)return;(g=T).uuid=Ht(g.uuid,ai)}this._internalEventEmitter.emit("eventCaptured",g);var I=null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),k={method:"POST",url:I,data:g,compression:"best-available",timestampMode:"recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(I)?"body":"capture-body",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(k):this._requestQueue.enqueue(k),g}Vt.critical("This capture call is ignored due to client rate limiting.")}}else Vt.error("No event name provided to posthog.capture")}else Vt.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l[T]=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!xe(l.distinct_id)&&!Ie(l.distinct_id)||Ee(l.distinct_id))&&Vt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var _,d=function(e,t,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!J)return{};var u,_=e?[...Li,...t||[]]:[],d=function(e){for(var t=0;Nt.length>t;t++){var i=Nt[t],s=i[1],r=i[0].exec(e),n=r&&(ye(s)?s(r,e):s);if(n)return n}return["",""]}(J),c=d[0],h=d[1],p=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},g={};Se(i)||(g.detectGoogleSearchApp=i);var v={},f=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,y=null==B||null==(a=B.screen)?void 0:a.width,b=null==B||null==(l=B.screen)?void 0:l.height,w=null==B?void 0:B.devicePixelRatio;Se(f)||(v.userAgentDataPlatform=f),Se(m)||(v.maxTouchPoints=m),Se(y)||(v.screenWidth=y),Se(b)||(v.screenHeight=b),Se(w)||(v.devicePixelRatio=w);var S,x,E,P,T,I,k,R,C=Kt(Qt({$os:c,$os_version:h,$browser:Lt(J,navigator.vendor,p,g),$device:qt(J),$device_type:(x=J,E=v,R=qt(x),R===He||R===Be||"Kobo"===R||"Kindle Fire"===R||R===mt?qe:R===at||R===ut||R===lt||R===gt?"Console":R===ze?"Wearable":R?De:"Android"===(null==E?void 0:E.userAgentDataPlatform)&&(null!==(P=null==E?void 0:E.maxTouchPoints)&&void 0!==P?P:0)>0?600>Math.min(null!==(T=null==E?void 0:E.screenWidth)&&void 0!==T?T:0,null!==(I=null==E?void 0:E.screenHeight)&&void 0!==I?I:0)/(null!==(k=null==E?void 0:E.devicePixelRatio)&&void 0!==k?k:1)?De:qe:"Desktop"),$timezone:Wi(),$timezone_offset:Yi()}),{$current_url:Fi(r?Gt(null==V?void 0:V.href):null==V?void 0:V.href,_,Ui),$host:null==V?void 0:V.host,$pathname:null==V?void 0:V.pathname,$raw_user_agent:J.length>1e3?J.substring(0,997)+"...":J,$browser_version:Ut(J,navigator.vendor,p,g),$browser_language:Hi(),$browser_language_prefix:(S=Hi(),"string"==typeof S?S.split("-")[0]:void 0),$screen_height:null==B?void 0:B.screen.height,$screen_width:null==B?void 0:B.screen.width,$viewport_height:null==B?void 0:B.innerHeight,$viewport_width:null==B?void 0:B.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=s.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime()),h=c.windowId;l.$session_id=c.sessionId,l.$window_id=h}this.sessionPropsManager&&Kt(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Kt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===xr&&(l.$lib_custom_api_host=this.config.api_host),_=e!==D||o?e!==U||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Kt(l,_),e===D&&z&&(l.title=z.title),!Se(a)){var g=r.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}J&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var v=this.persistence.properties(),f=this.sessionPersistence.properties();Yt(["$referrer","$referring_domain"],(e=>{e in v&&delete f[e]})),(l=Kt({},d,v,f,l)).$is_identified=this._isIdentified(),me(this.config.property_denylist)?Yt(this.config.property_denylist,(function(e){delete l[e]})):Vt.error(Nr+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(Vt.error(Ur),l=m(l,e));var y=this._hasPersonProcessing();return l.$process_person_profile=y,y&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=Kt({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Vt.error(Ur),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),we(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Dr}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Dr})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Dr})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=$r),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Dr}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Dr})}_validateIdentifyId(e){return!e||Ee(e)?(Vt.critical("Unique user id has not been set in posthog.identify"),!1):e===P?(Vt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Vt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Vt.uninitializedWarning("posthog.identify");if(Ie(e)&&(e=e.toString(),Vt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(n)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(a)&&(this.unregister(a),this.register({distinct_id:e}));var r,o=(this.persistence.get_property(m)||O)===O;e!==s&&o?(this.persistence.set_property(m,A),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(N,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=Sr(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(v))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=Sr(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Vt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(me(e)?e:[e]).filter((e=>xe(e)&&e.length>0));0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(q,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else Vt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,a,l,u,d,c,h;if(Vt.info("reset"),!this.__loaded)return Vt.uninitializedWarning("posthog.reset");var p,g=this.get_property(n),v=this.get_property(o),f=this.get_property(_);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),Se(f)||null==(p=this.persistence)||p.register({[_]:f}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(a=this.featureFlags)||a.reset(),null==(l=this.conversations)||l.reset(),null==(u=this.logs)||u.reset(),null==(d=this.metrics)||d.reset(),null==(c=this.persistence)||c.set_property(m,O),null==(h=this.sessionManager)||h.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===C)this.register_once({distinct_id:P,$device_id:null},"");else{var y=this.config.get_device_id(ai());this.register_once({distinct_id:y,$device_id:e?y:g},""),e||Se(v)||this.register({[o]:v})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var i=this;return t((function*(){var e,t,s,r,n;i.__loaded?(null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(t=i.metrics)||t.flush("sendBeacon"),null==(s=i._requestQueue)||s.unload(),null==(r=i._retryQueue)||r.unload(),null==(n=i.featureFlags)||n.destroy()):Vt.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(r)?(Vt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Se(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Vt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(be(e)){var r,n,o,a,l,u,_,d,c,h,p;Kt(this.config,Vr(e));var g=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Xi(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);ke(v)&&(this.config.debug=v),ke(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,hi._is_supported()&&hi._set("ph_debug",!0),Vt.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(s.DEBUG=!1,hi._is_supported()&&hi._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(_=this.heatmaps)||_.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){s.LIB_NAME=e,s.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.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 e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Wr._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Br;return t!==Br&&(t=Br+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(m))===A||(null==(t=this.sessionPersistence)?void 0:t.get_property(m))===A}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===F&&!this._isIdentified()&&we(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[a])&&(null==(t=this.persistence)||null==(t=t.props)||!t[E]))}_shouldCapturePageleave(){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._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Vt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(E,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==R)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==C){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new br(this),this.pageViewManager=new Ti(this),this.persistence&&(this.sessionPropsManager=new fr(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=Wr.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,_;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==R&&(null==(u=this.surveys)||u.loadIfEnabled()),(Se(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(_=null==e?void 0:e.captureEventName)&&void 0!==_?_:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Vt.warn(Lr)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==C?(this.config.cookieless_mode===R&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===R&&(this.register({distinct_id:P,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Vt.warn(Lr)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===C||(this.config.cookieless_mode===R?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return G?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ce(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>ce(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver}(G,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){z&&("visible"===z.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(D,{title:z.title},{send_instantly:!0}),this._visibilityStateListener&&(z.removeEventListener(M,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ei(z,M,this._visibilityStateListener)))}debug(e){!1===e?(null==B||B.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==B||B.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}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Vt.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):function(e,t,i,s,r){var n=t in e&&!Te(e[t]),o=i in e&&!Te(e[i]);return n?e[t]:!!o&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Vt)}_runBeforeSend(e){var t;if(Te(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Oe),s=me(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(r=n(r),Te(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Ce(e.event)?Vt.warn(o+". This can cause unexpected behavior."):Vt.info(o),null}r.properties&&!we(r.properties)||Vt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&Te(r.properties[a]))return Vt.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=ke(e)&&!e,i=hi._is_supported()&&"true"===hi._get("ph_debug");return!t&&(!!i||e)}}Wr.__defaultExtensionClasses={},Wr._noopLogger={trace:Or=()=>{},debug:Or,info:Or,warn:Or,error:Or,fatal:Or},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Jt(e.prototype[t[i]])}(Wr,["identify"]);var Yr=function(){s.SDK_DIST_CHANNEL="npm";var e=Ar[Br]=new Wr;return function(){function e(){e.done||(e.done=!0,Hr=!1,Yt(Ar,(function(e){e._dom_loaded()})))}null!=z&&z.addEventListener?"complete"===z.readyState?e():ei(z,"DOMContentLoaded",e,{capture:!1}):B&&Vt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Zi as Compression,ds as DEFAULT_PRODUCT_TOUR_APPEARANCE,_s as DisplaySurveyType,Wr as PostHog,cs as ProductTourEventName,hs as ProductTourEventProperties,ls as SurveyEventName,us as SurveyEventProperties,es as SurveyEventType,is as SurveyPosition,os as SurveyQuestionBranchingType,ns as SurveyQuestionType,as as SurveySchedule,ss as SurveyTabPosition,rs as SurveyType,ts as SurveyWidgetType,Yr as default,Yr as posthog,ms as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.no-external.js.map
|