tokentracker-cli 1.0.3 → 1.0.5
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/dashboard/dist/assets/{AchievementBadge-CfrOOWr0.js → AchievementBadge-Cvzhs6pY.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-DZadM8EE.js → AchievementsPage-C7BPBZV3.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-OMIpXwJk.js → AchievementsSection-Caq7GXWH.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-v3377bKe.js → BadgeDetailModal-CNyhrYnI.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-GCo67YPA.js → BotAnimated-CbdhTKLO.js} +1 -1
- package/dashboard/dist/assets/{Card-iqEbVAfe.js → Card-63pzm8aU.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-B8fGvOHx.js → ClawdAnimated-D6R7x8lK.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-CgYa-NtI.js → CommandPalette-CE7p2oa_.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-COFETX1P.js → CommunityStatsModal-D_bb4w1I.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-Cx5mtvz6.js → ConfirmModal-DrejafJF.js} +1 -1
- package/dashboard/dist/assets/{Controls-DHWyRlq3.js → Controls-T3TIbrLI.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-CJD5K2X9.js +1 -0
- package/dashboard/dist/assets/{DevicePage-CM-4nA1v.js → DevicePage-CH0Y9OHH.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-D_1o5m1F.js → DialogClose-BcPHsqpR.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DmyWlOfj.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-BoaOKLSJ.js → DialogTitle-Dv2oDI5S.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CxwhEKXW.js → FadeIn-DIS2Hg_z.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BJzs3QLE.js → HeaderGithubStar-zCGj7NYl.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-BzdCtjWo.js → HoverTooltip-xu93BCaJ.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-0HHz8md4.js → IpCheckPage-CpkJr3km.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CNfuMWtV.js → LandingPage-Eyn9uYxu.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-DSAZn4YX.js → LeaderboardAvatar-CkmxdKjb.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BF-1H1eP.js → LeaderboardPage-CKIkMDP1.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-h2f2CTkt.js → LeaderboardProfileModal-X9M1rppQ.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BwvuBBZl.js → LeaderboardProfilePage-CIl5kkOV.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CTgaMuET.js → LimitsPage-B4knUk-Q.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-FR9Wj4QT.js → LocalOnlyNotice-Dn6VNOeU.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-CdSIIy3e.js → LoginCard-C7PuEJfF.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-BR3i3sXm.js → LoginModal-DniAEAmY.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-D687glZU.js → LoginPage-CQGtpRcn.js} +1 -1
- package/dashboard/dist/assets/{PetPage-C1uTVM2e.js → PetPage-CuWgQq4k.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-Drcc1xD1.js → PopoverPopup-DGzNxyIb.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-7d_LVYcv.js → ProviderIcon-DQaFWAeK.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-DrZJeONd.js → ResetPasswordPage-DChkikDi.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-DG5jBPS0.js → SegmentedControl-B5dAFpXY.js} +1 -1
- package/dashboard/dist/assets/{Select-4-cstVvW.js → Select-yR95Ye8E.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-CO_do6nR.js → SelectItemText-D0HFmSxi.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-rn0d9dsS.js → ServiceStatusPage-BIOYCpJC.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-Cn4CqYmt.js → SessionsPage-CgMiH2OU.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-Dqd8Ncnd.js → SettingsPage-C8RyB9Ix.js} +2 -2
- package/dashboard/dist/assets/{SkillsPage-BLy1vi_w.js → SkillsPage-DECls0UK.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-BTiE7B_8.js → TokenGalaxy-Bq7myuhW.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-CafyxmdR.js → ToolbarRootContext-B6Vylv9F.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-DBSGxLJV.js → TrendMonitor-BKIz_wQr.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CxyDku5l.js → WidgetsPage-nzeiYO4K.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-B9csDYcE.js → WrappedPage-BAmyIzRK.js} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-Bt5e-Los.js +45 -0
- package/dashboard/dist/assets/{agent-logos-CzzdWcaf.js → agent-logos-4obZkQVl.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-Cf9m5Be_.js → arrow-up-right-CY1_kE5T.js} +1 -1
- package/dashboard/dist/assets/{check-2wRTN-2x.js → check-BxviipT2.js} +1 -1
- package/dashboard/dist/assets/{composite-Hz3JVLzf.js → composite-2hzXjsh4.js} +1 -1
- package/dashboard/dist/assets/{copy-CG3vduol.js → copy-CfMNihj_.js} +1 -1
- package/dashboard/dist/assets/{download-DxBn-C10.js → download-DZzFxl-w.js} +1 -1
- package/dashboard/dist/assets/{external-link-DNcwAE5i.js → external-link-CQuz6Zgz.js} +1 -1
- package/dashboard/dist/assets/{flame-CwqypgfJ.js → flame-VeZV_lsg.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-De-sHnD0.js → format-tokens-Ja_zmwX2.js} +1 -1
- package/dashboard/dist/assets/{icons-B5sEXhR4.js → icons-DkgZ7tvc.js} +1 -1
- package/dashboard/dist/assets/{index-CKjqeTQj.js → index-BN84EpDx.js} +1 -1
- package/dashboard/dist/assets/{index-CoNvDrj0.js → index-BvEF22jP.js} +1 -1
- package/dashboard/dist/assets/{index-CXA8TnTs.js → index-CrhRL4Df.js} +1 -1
- package/dashboard/dist/assets/{info-CMp9ACH-.js → info-Br_ApCog.js} +1 -1
- package/dashboard/dist/assets/{link-2-Dm302oj0.js → link-2-DWCwqx7W.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-SlBtH5TG.js → loader-circle-C90Vw-cp.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-CiIWPrQ2.js → maximize-2-CpX7FEW3.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-D8BCzmrS.js → modifiers.esm-BawFoZCU.js} +1 -1
- package/dashboard/dist/assets/module-DtWfRKM4.js +3 -0
- package/dashboard/dist/assets/{monitor-smartphone-CLAubcs0.js → monitor-smartphone-BKl8Af4G.js} +1 -1
- package/dashboard/dist/assets/{plus-6nrWkB1Y.js → plus-0tGsqhX-.js} +1 -1
- package/dashboard/dist/assets/{provider-display-Ra0EHFlp.js → provider-display-BaoN5oxN.js} +1 -1
- package/dashboard/dist/assets/{react-CyomPCCK.js → react-hi31R77i.js} +1 -1
- package/dashboard/dist/assets/{search-lc4LXypo.js → search-BVlP62JL.js} +1 -1
- package/dashboard/dist/assets/{skills-api-evIIP6w0.js → skills-api-B6OC9Ae6.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-BgQvewIC.js → sortable.esm-CUEUZVOz.js} +1 -1
- package/dashboard/dist/assets/{store-BPDfl_l_.js → store-DKMSwePW.js} +1 -1
- package/dashboard/dist/assets/{terminal-BjUyS36q.js → terminal-nBcu5xGC.js} +1 -1
- package/dashboard/dist/assets/{trash-CXPaNUTL.js → trash-BK5kjpsC.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-DZ3Kv1TE.js → use-community-stats-CJxOcXiQ.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-DTtX39vo.js → use-latest-request-guard-DOd1FZ5E.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-BmDtzK0h.js → use-limits-display-prefs-X1zw8WNj.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-BNRaIsQe.js → use-ordered-list-Bv-QAuvj.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-CeRLYRBr.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-6XugQQRj.js → use-session-efficiency-pref-Dykjc4jE.js} +1 -1
- package/dashboard/dist/assets/{use-transform-Dac51TaR.js → use-transform-38jb3h3B.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-Ct9sYCCP.js → use-usage-limits-2qMzPRSo.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-T-89bgd6.js → useCurrency-ljHbvu9k.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-B-6FYPqM.js → useTokenFormat-Dp98mQOv.js} +1 -1
- package/dashboard/dist/assets/{zap-DYg3Pa0u.js → zap-BkzmS0sj.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/grok-limits.js +36 -4
- package/src/lib/pricing/curated-overrides.json +30 -0
- package/src/lib/pricing/index.js +2 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/usage-limits.js +1 -1
- package/dashboard/dist/assets/DashboardPage-CTE9GiWg.js +0 -1
- package/dashboard/dist/assets/DialogDescription-s4flb7nP.js +0 -1
- package/dashboard/dist/assets/__vite-browser-external-DDhG0Kxe.js +0 -45
- package/dashboard/dist/assets/module-B5tW98jG.js +0 -3
- package/dashboard/dist/assets/use-reduced-motion-CL8VjeJs.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const y="u">typeof window?window:void 0,ye="u">typeof globalThis?globalThis:y,de=ye?.navigator,w=ye?.document,ee=ye?.location,ns=ye?.fetch,_r=ye?.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest?ye.XMLHttpRequest:void 0,Br=ye?.AbortController,El=ye?.CompressionStream,we=de?.userAgent;function uo(){return!(!y||y.navigator.onLine===!1)}const Dt=typeof globalThis<"u"?globalThis:y;Dt&&typeof self>"u"&&(Dt.self=Dt),Dt&&typeof File>"u"&&(Dt.File=function(){});const I=y??{},Sl="0.8.3",Je={DEBUG:!1,LIB_VERSION:Sl,LIB_NAME:"browser-common"};var je=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),ji=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const Pl=["$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"],Ml=["token"];function R(e,t){return e.indexOf(t)!==-1}const Xs=function(e){return e.trim()},Bi=function(e){return e.replace(/^\$/,"")};function co(e){var t;const s=[];return(t=JSON.stringify(e,function(i,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(r))return"[Circular]";s.push(r)}return r}}))!==null&&t!==void 0?t:"null"}const ho=Object.prototype,mr=ho.hasOwnProperty,Ys=ho.toString,C=Array.isArray||function(e){return Ys.call(e)==="[object Array]"},ve=e=>typeof e=="function",A=e=>e===Object(e)&&!C(e),ke=e=>{if(A(e)){for(const t in e)if(mr.call(e,t))return!1;return!0}return!1},b=e=>e===void 0,L=e=>Ys.call(e)=="[object String]",Jt=e=>L(e)&&e.trim().length===0,ie=e=>e===null,T=e=>b(e)||ie(e),re=e=>Ys.call(e)=="[object Number]"&&e==e,Ve=e=>re(e)&&e>0,$e=e=>Ys.call(e)==="[object Boolean]",Fl=e=>R(Pl,e),Ol=e=>R(Ml,e);function po(e){return e===null||typeof e!="object"}function Cs(e,t){return{}.toString.call(e)===`[object ${t}]`}function ps(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return fo(e,Error)}}function yr(e){return"u">typeof Event&&fo(e,Event)}function fo(e,t){try{return e instanceof t}catch{return!1}}const Il=[!0,"true",1,"1","yes"],ii=e=>R(Il,e),Cl=[!1,"false",0,"0","no"];function Hr(e,t,s,i,r,n,o){try{var a=e[n](o),l=a.value}catch(u){return void s(u)}a.done?t(l):Promise.resolve(l).then(i,r)}function X(e){return function(){var t=this,s=arguments;return new Promise(function(i,r){var n=e.apply(t,s);function o(l){Hr(n,i,r,o,a,"next",l)}function a(l){Hr(n,i,r,o,a,"throw",l)}o(void 0)})}}const Rl=["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","pinterestbot","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"],zr=function(e,t=[]){if(!e)return!1;const s=e.toLowerCase();return Rl.concat(t).some(i=>{const r=i.toLowerCase();return s.indexOf(r)!==-1})};function Be(e,t,s,i,r){return t>s&&(i.warn("min cannot be greater than max."),t=s),re(e)?e>s?(i.warn(" cannot be greater than max: "+s+". Using max value instead."),s):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+s+", fallback: "+r),Be(r??s,t,s,i))}var Tl=class{constructor(e){this.C={},this.I=e.I,this.R=Be(e.bucketSize,0,100,e.$),this.A=Be(e.refillRate,0,this.R,e.$),this.O=Be(e.refillInterval,0,864e5,e.$)}F(e,t){const s=Math.floor((t-e.lastAccess)/this.O);s>0&&(e.tokens=Math.min(e.tokens+s*this.A,this.R),e.lastAccess=e.lastAccess+s*this.O)}consumeRateLimit(e){var t;const s=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,s):(r={tokens:this.R,lastAccess:s},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),r.tokens===0)}stop(){this.C={}}};const It="Mobile",os="Android",Rs="Tablet",vo="Android Tablet",go="iPad",_o="Apple Watch",Ss="Safari",Zs="BlackBerry",mo="Samsung Internet",Ps="Chrome",yo="Chrome iOS",bo="Internet Explorer",wo="Internet Explorer Mobile",xo="Opera",$o="Microsoft Edge",Ms="Firefox",ko="Firefox iOS",Ts="Nintendo",As="PlayStation",Qs="Xbox",Eo="Android Mobile",So="Mobile Safari",ri="Windows",Po="Windows Phone",qr="Nokia",Hi="Ouya",Al="Generic "+It.toLowerCase(),Mo="Generic "+Rs.toLowerCase(),zi="Konqueror",Fo="Oculus Browser",Oo="Vivaldi",Io="Yandex",Co="Whale",Ro="DuckDuckGo",To="Pale Moon",Ao="Waterfox",qi="Brave",Lo="Claude",Do="Codex",No="ChatGPT",jo="Google Search App",ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),oi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ll=new RegExp(Qs,"i"),Dl=new RegExp("PlayStation \\w+","i"),Nl=new RegExp("Nintendo \\w+","i"),br=new RegExp("BlackBerry|PlayBook|BB10","i"),jl={"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"},Bo=function(e,t,s,i){return t=t||"",(function(n){return n?.brave?qi:null})(s)||(i?.detectGoogleSearchApp&&R(e,"GSA/")?jo:R(e," OPR/")&&R(e,"Mini")?"Opera Mini":R(e," OPR/")?xo:br.test(e)?Zs:R(e,"IEMobile")||R(e,"WPDesktop")?wo:R(e,"OculusBrowser")?Fo:R(e,"SamsungBrowser")?mo:R(e,"Edge")||R(e,"Edg/")?$o:R(e,"Vivaldi/")?Oo:R(e,"YaBrowser/")?Io:R(e,"Whale/")?Co:R(e,"DuckDuckGo/")||R(e,"Ddg/")?Ro:R(e,"Claude/")?Lo:R(e,"Codex/")?Do:R(e,"ChatGPT/")?No:R(e,"FBIOS")?"Facebook Mobile":R(e,"UCWEB")||R(e,"UCBrowser")?"UC Browser":R(e,"CriOS")?yo:R(e,"CrMo")||R(e,Ps)?Ps:R(e,os)&&R(e,Ss)?Eo:R(e,"FxiOS")?ko:R(e.toLowerCase(),zi.toLowerCase())?zi:R(e,"Brave/")?qi:((n,o)=>o&&R(o,"Apple")||(function(a){return R(a,Ss)&&!R(a,Ps)&&!R(a,os)})(n))(e,t)?R(e,It)?So:Ss:R(e,"PaleMoon/")?To:R(e,"Waterfox/")?Ao:R(e,Ms)?Ms:R(e,"MSIE")||R(e,"Trident/")?bo:R(e,"Gecko")?Ms:"")},Bl={[wo]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[$o]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ps]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[yo]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ss]:[ni],[So]:[ni],[xo]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Ms]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ko]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[zi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Zs]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ni],[Eo]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[mo]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Fo]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Oo]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Io]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Co]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[qi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Lo]:[oi],[Do]:[oi],[No]:[oi],[Ro]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[To]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ao]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[jo]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[bo]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Hl=function(e,t,s,i){const r=Bo(e,t,s,i),n=Bl[r];if(b(n))return null;for(let o=0;n.length>o;o++){const a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Vr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Qs,e&&e[1]||""]],[new RegExp(Ts,"i"),[Ts,""]],[new RegExp(As,"i"),[As,""]],[br,[Zs,""]],[new RegExp(ri,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Po,""];if(new RegExp(It).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const s=/Windows NT ([0-9.]+)/i.exec(t);if(s&&s[1]){let i=jl[s[1]]||"";return/arm/i.test(t)&&(i="RT"),[ri,i]}return[ri,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=b(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[os,[e[2],e[3],e[4]||"0"].join(".")]:[os,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ho=function(e){for(let t=0;Vr.length>t;t++){const[s,i]=Vr[t],r=s.exec(e),n=r&&(ve(i)?i(r,e):i);if(n)return n}return["",""]},zo=function(e){return Nl.test(e)?Ts:Dl.test(e)?As:Ll.test(e)?Qs:new RegExp(Hi,"i").test(e)?Hi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Po:/iPad/.test(e)?go:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?_o:br.test(e)?Zs:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(qr,"i").test(e)?qr:/(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(It).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)?os:vo:new RegExp("(pda|Mobile)","i").test(e)?Al:new RegExp(Rs,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Mo:""},zl=function(e,t){var s;const i=zo(e);return i===go||i===vo||i==="Kobo"||i==="Kindle Fire"||i===Mo?Rs:i===Ts||i===Qs||i===As||i===Hi?"Console":i===_o?"Wearable":i?It:t?.userAgentDataPlatform==="Android"&&((s=t?.maxTouchPoints)!==null&&s!==void 0?s:0)>0?600>Math.min((r=t?.screenWidth)!==null&&r!==void 0?r:0,(n=t?.screenHeight)!==null&&n!==void 0?n:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?It:Rs:"Desktop";var r,n,o},ai=/\bFBAV\/(\d+(?:\.\d+)*)/i,Wr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ai],[/\bFBAN\/EMA\b/i,"Facebook Lite",ai],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ai],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Vi="[Truncated]",fs="[Unserializable]";function Ft(e){let t="";for(let s=0;e.length>s;s++){const i=e.charCodeAt(s);if(55296>i||i>56319)t+=56320>i||i>57343?e[s]:"�";else{const r=e.charCodeAt(s+1);56320>r||r>57343?t+="�":(t+=e[s]+e[s+1],s++)}}return t}function qo(e,t){if(!t)return e;let s=[];try{s=Object.keys(t)}catch{s=[]}for(const i of s){let r;try{r=t[i]}catch{r=fs}Object.defineProperty(e,i,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}const ql=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ur(e,t){return typeof(s=e)=="string"&&ql.test(s)?e:t();var s}function Vo(e,t){const s=new Error(t);try{Object.defineProperty(s,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return s}function ot(e){return e&&e.split("#")[0]}function Gr(e){try{return e()}catch{return}}function Wo(e,t){const s=setTimeout(e,t);return s!=null&&s.unref&&s?.unref(),s}function Kr(e,t,s){return Uo.apply(this,arguments)}function Uo(){return(Uo=X(function*(e,t,s){let i;try{return yield Promise.race([e,new Promise((r,n)=>{i=Wo(()=>{try{s?.(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let gs,Jr,li;function Vl(e){const t=globalThis._posthogChunkIds;if(!t)return;const s=Object.keys(t);return li&&s.length===Jr||(Jr=s.length,li=s.reduce((i,r)=>{gs||(gs={});const n=gs[r];if(n)i[n[0]]=n[1];else{const o=e(r);for(let a=o.length-1;a>=0;a--){const l=o[a],u=l?.filename,c=t[r];if(u&&c){i[u]=c,gs[r]=[u,c];break}}}return i},{})),li}function Xt(e){return Xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xt(e)}function Wl(e,t,s){return(t=(function(i){var r=(function(n){if(Xt(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(Xt(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)})(i);return Xt(r)=="symbol"?r:r+""})(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Xr(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,i)}return s}function f(e){for(var t=1;arguments.length>t;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Xr(Object(s),!0).forEach(function(i){Wl(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Xr(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}var Ul=class{constructor(e,t,s=[]){this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t={}){const s=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(s,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(n,s),$exception_level:"error"}}modifyFrames(e){var t=this;return X(function*(){for(const s of e)s.stacktrace&&s.stacktrace.frames&&C(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){let s,i;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),f(f({},e),{},{cause:s,stack:i})}applyChunkIds(e,t){return e.map(s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s))}applyCoercers(e,t){for(const s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return X(function*(){let s=e;for(const i of t.modifiers)s=yield i(s);return s})()}convertToExceptionList(e,t){var s,i,r;const n={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(r=e.synthetic)!==null&&r!==void 0&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});const o=[n];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,f(f({},t),{},{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Vl(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s=0){const i=(r,n)=>{if(4>=n){const o=this.buildCoercingContext(e,t,n);return this.applyCoercers(r,o)}};return f(f({},t),{},{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:r=>i(r,s),next:r=>i(r,s+1)})}};const Gl=/^([a-z][a-z0-9.+-]+):/i,Kl=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Jl(e){if(!e||e==="<anonymous>")return!1;const t=Gl.exec(e);return!t||Kl.includes(t[1].toLowerCase())}function Wi(e,t,s,i,r){const n={platform:e,filename:t,function:s==="<anonymous>"?"?":s,in_app:Jl(t)};return b(i)||(n.lineno=i),b(r)||(n.colno=r),n}const Go=(e,t)=>{const s=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return s||i?[e.indexOf("@")!==-1?e.split("@")[0]:"?",s?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Xl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Yl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ql=(e,t)=>{const s=Xl.exec(e);if(s){const[,r,n,o]=s;return Wi(t,r,"?",+n,+o)}const i=Yl.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const o=Zl.exec(i[2]);o&&(i[2]=o[1],i[3]=o[2],i[4]=o[3])}const[r,n]=Go(i[1]||"?",i[2]);return Wi(t,n,r,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},eu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,su=(e,t)=>{const s=eu.exec(e);if(s){if(s[3]&&s[3].indexOf(" > eval")>-1){const n=tu.exec(s[3]);n&&(s[1]=s[1]||"eval",s[3]=n[1],s[4]=n[2],s[5]="")}let i=s[3],r=s[1]||"?";return[r,i]=Go(r,i),Wi(t,i,r,s[4]?+s[4]:void 0,s[5]?+s[5]:void 0)}},Yr=/\(error: (.*)\)/;function wr(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function iu(e){for(let t=1;10>=t;t++){const s=e.length-2*t;if(0>s)break;let i=!0;for(let r=0;t>r;r++)if(!wr(e[s+r],e[s+t+r])){i=!1;break}if(i){for(let r=0;t>r;r++)e[s+r]=e[s+t+r];return e.length=s+t,{start:s,length:t}}}}function ru(e,t){const s=t.start+t.length,i=Jo(e,t);i&&e.splice(s+i===e.length?s:t.start,i)}function Ko(e,t){let s=t.start;for(;s>0&&wr(e[s-1],e[s-1+t.length]);)s--;return t.start-s}function Jo(e,t){const s=t.start+t.length;let i=s;for(;e.length>i&&wr(e[i],e[i-t.length]);)i++;return i-s}function nu(e,t){const s=t[0];let i=e.length-(s?Ko(e,s):0);for(const r of t)i-=Jo(e,r);return i}function ou(e,t,s){for(let i=0;e.length>i;i++){const r=e[(t+i)%e.length],n=e[(s+i)%e.length];if(r!==n)return n>r}return!1}var au=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const s=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Cs(e,"DOMException")}isDOMError(e){return Cs(e,"DOMError")}},lu=class{match(e){return ps(e)}coerce(e,t){var s;const i=this.getStack(e),r=i===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??((s=t.syntheticException)===null||s===void 0?void 0:s.stack),cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}},uu=class{match(e){return!!Cs(e,"ErrorEvent")&&(e.error!=null||this.lr(e))}coerce(e,t){var s;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return f(f({},i),{},{stack:(s=this.ur(e))!==null&&s!==void 0?s:i.stack,synthetic:!0})}lr(e){return L(e.message)&&e.message.length>0}ur(e){var t,s;const i=e,r=(t=i.lineno)!==null&&t!==void 0?t:0,n=(s=i.colno)!==null&&s!==void 0?s:0;if(L(i.filename)&&i.filename.length!==0&&r!==0)return`Error
|
|
2
|
-
at ${i.filename}:${r}:${n}`}};const cu=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var hu=class{match(e){return typeof e=="string"}coerce(e,t){var s;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}getInfos(e){let t="Error",s=e;const i=e.match(cu);return i&&(t=i[1],s=i[2]),[t,s]}};const du=["fatal","error","warning","log","info","debug"];function Xo(e,t=40){const s=Object.keys(e);if(s.sort(),!s.length)return"[object has no keys]";for(let i=s.length;i>0;i--){const r=s.slice(0,i).join(", ");if(t>=r.length)return i===s.length?r:r.length>t?`${r.slice(0,t)}...`:r}return""}var pu=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,i;const r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=this.getStack(e))!==null&&s!==void 0?s:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(yr(e))return e.constructor.name;const t="name"in e?e.name:void 0;return L(t)&&!Jt(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let s=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(s+=` with message: '${e.message}'`),s}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${Xo(e)}`}isSeverityLevel(e){return L(e)&&!Jt(e)&&du.indexOf(e)>=0}getStack(e){try{return L(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:L(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const s=e[t];if(ps(s))return s}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},fu=class{match(e){return yr(e)}coerce(e,t){var s;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${Xo(e)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}},vu=class{match(e){return po(e)}coerce(e,t){var s;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}},gu=class{match(e){return Cs(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!yr(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s;const i=this.getUnhandledRejectionReason(e);return po(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const Ls="$message",Ds="$timestamp",_u=new Set([Ls,Ds]),ui={enabled:!0,max_bytes:32768};function Ns(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:ui.enabled,max_bytes:yu(e.max_bytes,ui.max_bytes)}:f({},ui)}var mu=class{constructor(e){this.ts=[],this.es=0,this.Mr=Ns(e)}setConfig(e){this.Mr=Ns(e),this.ns()}add(e){const t=(function(i){let r;try{r=co(i)}catch{return}try{const n=JSON.parse(r);if(!A(n))return;const o=n,a=o[Ls],l=o[Ds];return!L(a)||a.trim().length===0||!L(l)&&!re(l)?void 0:{step:o,json:r}}catch{return}})(e);if(!t)return;const s=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let n=0;for(let o=0;r.length>o;o++)r[o]==="%"?(n+=1,o+=2):n+=1;return n})(t.json);s>this.Mr.max_bytes||(this.ts.push({step:t.step,bytes:s}),this.es+=s,this.ns())}getAttachable(){return this.ts.map(e=>e.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const e=this.ts.shift();e&&(this.es-=e.bytes)}}};function yu(e,t){if(!re(e)||e===1/0||e===-1/0)return t;const s=Math.floor(e);return 0>s?t:s}const Zr=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Qr(e){return typeof e=="string"||e}function en(e){return typeof e=="string"?e:void 0}const bu=["$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","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Yo="NativeGzipValidationError",Ui=e=>e.length>=2&&e[0]===31&&e[1]===139,tn=(e,t)=>e===ji.GZipJS||t===ji.GZipJS||t==="gzip",sn=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let Nt;const _s=e=>{throw Vo(Yo,`Native gzip produced invalid output: ${e}`)},wu=(rn=X(function*(e,t){18>e.size&&_s("too-short");const s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ui(s)&&s[2]===8||_s("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(n=>{const o=(()=>{if(Nt)return Nt;Nt=[];for(let l=0;256>l;l++){let u=l;for(let c=0;8>c;c++)u=1&u?3988292384^u>>>1:u>>>1;Nt[l]=u>>>0}return Nt})();let a=4294967295;for(let l=0;n.length>l;l++)a=o[255&(a^n[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&_s("invalid-crc");const r=t.length>>>0;i.getUint32(4,!0)!==r&&_s("invalid-size")}),function(e,t){return rn.apply(this,arguments)});var rn;function Gi(){return Gi=X(function*(e,t=!0,s){try{const r=new TextEncoder().encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch((i=X(function*(c){try{yield o.abort(c)}catch{}throw c}),function(c){return i.apply(this,arguments)})),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield wu(u,r),u}catch(r){if(s?.rethrow)throw r;return t&&console.error("Failed to gzip compress data",r),null}var i}),Gi.apply(this,arguments)}const ci=3e5;var Zo=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),s=Date.now(),i=Math.min(e.retryAfterMs,ci);if(!t)return this.ss=s,void(this.rs=s+i);this.rs=Math.max(this.rs,Math.min(s+i,this.ss+ci))}remainingMs(){const e=Date.now();if(this.ss-5e3>e)return this.reset(),0;const t=Math.min(ci,Math.max(0,this.rs-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function Qo(e,t){if(e==null)return{};var s,i,r=(function(o,a){if(o==null)return{};var l={};for(var u in o)if({}.hasOwnProperty.call(o,u)){if(a.includes(u))continue;l[u]=o[u]}return l})(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;n.length>i;i++)t.includes(s=n[i])||{}.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}const xu={}.propertyIsEnumerable;function js(e,t){try{return ea(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function xr(e,t,s,i){if(0>=s.remainingNodes)return{stringValue:Vi};if(s.remainingNodes--,$e(e))return{boolValue:e};if(typeof e=="bigint")return(function(r,n){const o=r.toString(),a=BigInt("9223372036854775808");return r>=a||-a>r?(n?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const r=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${r} is outside the int64 range; encoding it as a string`),{stringValue:r}):{intValue:r}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Ft(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(s.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:Vi};if(e instanceof Date){const r=e.getTime(),n=Number.isFinite(r)?e.toISOString():String(e);return{stringValue:typeof n=="string"?Ft(n):String(n)}}s.ancestors.add(e);try{try{const r=e.toJSON;if(typeof r=="function")return xr(r.call(e),t,s,i+1)}catch{}return C(e)?{arrayValue:{values:$u(e,t,s,i+1)}}:{kvlistValue:{values:ea(e,t,s,i+1)}}}finally{s.ancestors.delete(e)}}return{stringValue:Ft(String(e))}}function $u(e,t,s,i){const r=[],n=Math.min(e.length,1e3);let o=0;for(;n>o&&s.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(T(a))continue;r.push(xr(a,t,s,i))}catch{r.push({stringValue:fs})}return e.length>o&&r.push({stringValue:Vi}),r}function ea(e,t,s,i){const r=[];for(const n in e)if(xu.call(e,n)){if(!n){t?.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=s.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[n];if(ie(o)||b(o))continue;r.push({key:Ft(n),value:xr(o,t,s,i)})}catch{r.push({key:Ft(n),value:{stringValue:fs}})}}return r}function ta(e,t,s){return f(f(f(f({},qo({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":s})}const ku=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function sa(e,t){const s=qo({},e),i={};for(const r of ku)({}).hasOwnProperty.call(s,r)&&(i[r]=s[r],delete s[r]);return[...js(s,t),...js(i,t)]}const nn={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},ia={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Eu=ia.info;function Su(e){try{return Ft(String(e))}catch{return fs}}function Pu(e,t,s,i){const r=e.level||"info",{text:n,number:o}=ia[r]||Eu,a=(function(p=Date.now()){return String(p)+"000000"})(re(i)?i:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),T(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),T(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const u=f({},l),c=e.attributes;if(c){let p=[];try{p=Object.keys(c)}catch{p=[]}for(const d of p){let g;try{g=c[d]}catch{g=fs}Object.defineProperty(u,d,{value:g,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:Su(e.body)},attributes:js(u,s)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),b(e.trace_flags)||(h.flags=e.trace_flags),h}function ra(e,t,s){return ta(e,t,s)}function na(e,t,s,i){return{resourceLogs:[{resource:{attributes:sa(t)},scopeLogs:[{scope:{name:s,version:i},logRecords:e}]}]}}var oa=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=Wo(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function aa(){return .75+.5*Math.random()}function la(e,t,s,i){const r=Math.min(Math.max(0,t-1),6),n=e*Math.pow(2,r);return Math.round(Math.min(n,Math.max(i,e))*s)}var Mu=class{constructor(e,t,s,i,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Mr=t,this.$=s,this.cs=i,this.ds=r,this.vs=n,this.fs=o,this.ps=new oa(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Zo,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(je.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var s;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:Pu(i,(s=t?.context)!==null&&s!==void 0?s:this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const s=C(t)?t:[t];let i=e;for(const r of s)try{const n=r(i);if(!n)return this.$.info("Log was rejected in beforeSend function"),null;i=n}catch(n){return this.$.error("Error in beforeSend function for log:",n),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return X(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return X(function*(){var t;e.ps.clear();let s=(t=e._instance.getPersistedProperty(je.LogsQueue))!==null&&t!==void 0?t:[];if(s.length===0)return;const i=s.length;let r=0;for(;s.length>0&&i>r;){var n,o;const a=e._s;e.bs=0;const l=Math.min(s.length,e.Es),u=s.slice(0,l),c=na(u.map(p=>p.record),e.qs(),(n=e.fs)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.js(c);if(e._s!==a)return;if(h.kind==="too-large"&&u.length>1)e.Es=Math.max(1,Math.floor(u.length/2)),e.$.warn(`Logs batch of size ${u.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),s=(o=e._instance.getPersistedProperty(je.LogsQueue))!==null&&o!==void 0?o:[],r+=u.length,h.kind==="fatal"))throw h.error}})()}Bs(e){var t=this;return X(function*(){var s;const i=Math.max(0,e-t.bs),r=(s=t._instance.getPersistedProperty(je.LogsQueue))!==null&&s!==void 0?s:[];t._instance.setPersistedProperty(je.LogsQueue,r.slice(i)),yield t.vs()})()}qs(){return ra(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const s=(t=this._instance.getPersistedProperty(je.LogsQueue))!==null&&t!==void 0?t:[];this.Is>s.length||(s.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),s.push(e),this._instance.setPersistedProperty(je.LogsQueue,s),this.Ts>s.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(la(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(je.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return X(function*(){t.ps.clear();const s=t.flush().catch(()=>{});e!==void 0?yield Kr(s,e):yield s})()}flushWithTimeout(e){var t=this;return X(function*(){const s=t.flush();yield Kr(s,e,()=>{s.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=aa(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const hi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function on(e){return String(e)+"000000"}function an(e,t,s,i){let r="";return i&&(r=Object.keys(i).sort().map(n=>`${JSON.stringify(n)}:${JSON.stringify(i[n])}`).join(",")),`${e}\0${t}\0${s??""}\0${r}`}var Fu=class{constructor(e,t,s){this._instance=e,this.Mr=t,this.$=s,this.zs=new Map,this.ps=new oa(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Zo,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,s){this.Zs({name:e,type:"count",value:t,unit:s?.unit,attributes:s?.attributes})}gauge(e,t,s){this.Zs({name:e,type:"gauge",value:t,unit:s?.unit,attributes:s?.attributes})}histogram(e,t,s){this.Zs({name:e,type:"histogram",value:t,unit:s?.unit,attributes:s?.attributes})}flush(){var e=this;const t=this.ys,s=(function(){var i=X(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===s&&(this.ys=null)});return this.ys=s,s}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let s,i;try{s=t.attributes?f({},t.attributes):void 0,i=an(t.type,t.name,t.unit,s)}catch(o){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:t.name,type:t.type,unit:t.unit,attributes:s,windowStartMs:Date.now()},this.zs.set(i,r)}const n=this.Ws.get(t.name);n===void 0?this.Ws.set(t.name,t.type):n===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${n}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(r,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(e,t){switch(e.type){case"count":var s;e.total=((s=e.total)!==null&&s!==void 0?s:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(hi.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(r,n){for(let o=0;n.length>o;o++)if(n[o]>=r)return o;return n.length})(t,hi)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const s=C(t)?t:[t];let i=e;for(const r of s)try{const n=r(i);if(!n)return this.$.info("Metric was rejected in beforeSend function"),null;i=n}catch(n){return this.$.error("Error in beforeSend function for metric:",n),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(la(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return X(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const s=e.Gs,i=yield e._instance.Xs(e.Js(t));if(s===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=aa()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.lo(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return t=this.ao(e),s=(function(n,o,a){return ta(n,o,a)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:sa(s)},scopeMetrics:[{scope:{name:i,version:r},metrics:t}]}]};var t,s,i,r}ao(e){const t=on(Date.now()),s=new Map;for(const o of e.values()){var i;const a=an(o.type,o.name,o.unit,void 0);let l=s.get(a);l||(l=f({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},s.set(a,l));const u=js((i=o.attributes)!==null&&i!==void 0?i:{},this.$),c=on(o.windowStartMs);if(o.type==="count"){var r;const h={attributes:u,startTimeUnixNano:c,timeUnixNano:t,asDouble:(r=o.total)!==null&&r!==void 0?r:0};l.sum.dataPoints.push(h)}else if(o.type==="gauge"){var n;const h={attributes:u,timeUnixNano:t,asDouble:(n=o.last)!==null&&n!==void 0?n:0};l.gauge.dataPoints.push(h)}else o.hist&&l.histogram.dataPoints.push({attributes:u,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:hi})}return Array.from(s.values())}lo(e){for(const[i,r]of e){const n=this.zs.get(i);if(n)switch(n.windowStartMs=Math.min(n.windowStartMs,r.windowStartMs),n.type){case"count":var t,s;n.total=((t=n.total)!==null&&t!==void 0?t:0)+((s=r.total)!==null&&s!==void 0?s:0);break;case"gauge":break;case"histogram":if(r.hist)if(n.hist){n.hist.count+=r.hist.count,n.hist.sum+=r.hist.sum,n.hist.min=Math.min(n.hist.min,r.hist.min),n.hist.max=Math.max(n.hist.max,r.hist.max);for(let o=0;n.hist.bucketCounts.length>o;o++)n.hist.bucketCounts[o]+=r.hist.bucketCounts[o]}else n.hist=r.hist}else this.Ks()&&this.zs.set(i,r)}}};const ua=(e,{debugEnabled:t}={})=>{const s={N(i,...r){y&&(Je.DEBUG||y.POSTHOG_DEBUG||t)&&!b(y.console)&&y.console&&("__rrweb_original__"in y.console[i]?y.console[i].__rrweb_original__:y.console[i])(e,...r)},debug(...i){s.N("debug",...i)},info(...i){s.N("log",...i)},warn(...i){s.N("warn",...i)},error(...i){s.N("error",...i)},critical(...i){console.error(e,...i)},uninitializedWarning(i){s.error(`You must initialize PostHog before calling ${i}`)},createLogger:(i,r)=>ua(`${e} ${i}`,r)};return s},E=ua("[PostHog.js]"),ne=E.createLogger,Ou=ne("[ExternalScriptsLoader]"),Bs=e=>{const t=w?.querySelectorAll("script");if(t){for(let s=0;t.length>s;s++)if(t[s].src===e||t[s].getAttribute("src")===e)return t[s]}},dt=(e,t,s)=>{if(e.config.disable_external_dependency_loading)return Ou.warn(`${t} was requested but loading of external scripts is disabled.`),s("Loading of external scripts is disabled");const i=Bs(t);if(i){if(i.__posthog_loading_callback_fired)return s();const n=i.__posthog_loading_error;return n?s(n):(i.addEventListener("load",o=>{i.__posthog_loading_callback_fired=!0,s(void 0,o)}),void i.addEventListener("error",o=>{i.__posthog_loading_error=o,s(o)}))}const r=()=>{if(!w)return s("document not found");if(Bs(t))return dt(e,t,s);let n=w.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=t,n.onload=a=>{n.__posthog_loading_callback_fired=!0,s(void 0,a)},n.onerror=a=>{n.__posthog_loading_error=a,s(a)},e.config.prepare_external_dependency_script&&(n=e.config.prepare_external_dependency_script(n)),!n)return s("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")w.head.appendChild(n);else{const a=w.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(n,a[0]):w.body.appendChild(n)}};w?.body?r():w?.addEventListener("DOMContentLoaded",r)},di={},ln=(e,t)=>{let s=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(s=`${s}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",s)};I.__PosthogExtensions__=I.__PosthogExtensions__||{},I.__PosthogExtensions__.loadExternalDependency=(e,t,s)=>{if(t==="remote-config"){const r=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void dt(e,r,s)}const i=e.config.strict_script_versioning;if(i){const r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=di[r];if(i==="fallback"&&n){if(Bs(n))return void dt(e,n,s);delete di[r]}return void dt(e,r,i==="fallback"?(o,a)=>{if(o)if(typeof o=="string")s(o);else{var l;const u=ln(e,t);di[r]=u;const c=Bs(r);c==null||(l=c.parentNode)===null||l===void 0||l.removeChild(c),dt(e,u,s)}else s(void 0,a)}:s)}dt(e,ln(e,t),s)},I.__PosthogExtensions__.loadSiteApp=(e,t,s)=>{const i=e.requestRouter.endpointFor("api",t);dt(e,i,s)},Je.DEBUG=!1,Je.LIB_VERSION="1.430.3",Je.LIB_NAME="web";var ce=Je;const Iu="$people_distinct_id",Re="distinct_id",$r="$device_id",pi="$device_model",Hs="__alias",Cu="__cmpns",ms="$fbc",Te="$fbc_persistence",Ki="__timers",ca="$autocapture_disabled_server_side",Ji="$heatmaps_enabled_server_side",Xi="$exception_capture_enabled_server_side",ha="$error_tracking_suppression_rules",Yi="$error_tracking_capture_extension_exceptions",Zi="$web_vitals_enabled_server_side",kr="$dead_clicks_enabled_server_side",Er="$product_tours_enabled_server_side",da="$logs_capture_enabled_server_side",pa="$web_vitals_allowed_metrics",Yt="$session_recording_remote_config",Ru="$session_recording_enabled_server_side",Tu="$replay_sample_rate",Au="$replay_override_sampling",Lu="$replay_override_linked_flag",Du="$replay_override_url_trigger",Nu="$replay_override_event_trigger",Et="$sesid",fa="$session_is_sampled",ju="$session_past_minimum_duration",Bu="$session_recording_url_trigger_activated_session",Hu="$session_recording_event_trigger_activated_session",zu="$debug_first_full_snapshot_timestamp",qu="$sess_rec_flush_size",Ae="$enabled_feature_flags",Ue="$active_feature_flags",Qi="$early_access_features",vt="$feature_flag_details",tt="$feature_flag_payloads",gt="$feature_flag_request_id",Zt="$minimal_flag_called_events",Ne="$override_feature_flags",pt="$override_feature_flag_payloads",st="$stored_person_properties",it="$stored_group_properties",va="$groups",er="$surveys",zs="$surveys_loaded_at",ga="$surveys_activated",_a="$surveys_activated_session",ma="$surveys_activated_timestamps",tr="ph_product_tours",Vu="$product_tours_activated",Wu="$product_tours_activated_session",Uu="$conversations_widget_session_id",Gu="$conversations_ticket_id",Ku="$conversations_widget_state",Ju="$conversations_user_traits",rt="$flag_call_reported",Gt="$flag_call_reported_session_id",as="$feature_flag_errors",nt="$feature_flag_evaluated_at",xe="$user_state",sr="$client_session_props",Xu="$capture_rate_limit",ya="$initial_campaign_params",ba="$initial_referrer_info",St="$initial_person_info",Sr="$epp",fi="$posthog_cookieless",wa="$cookieless_mode",xa="$sdk_debug_extensions_init_method",$a="$sdk_debug_extensions_init_time_ms",ka="$sdk_debug_recording_script_not_loaded",Yu="$sdk_debug_replay_event_trigger_status",Zu="$sdk_debug_replay_linked_flag_trigger_status",Qu="$sdk_debug_replay_matched_recording_trigger_groups",ec="$sdk_debug_replay_pending_trigger_conditions",tc="$sdk_debug_replay_remote_trigger_matching_config",sc="$sdk_debug_replay_trigger_groups_count",ic="$sdk_debug_replay_url_trigger_status",rc="$session_recording_start_reason",Pr="PostHog loadExternalDependency extension not found.",Ge="anonymous",Fs="identified",Ea="identified_only",ls="visibilitychange",qs="beforeunload",Mr="$pageview",un="$pageleave",ir="$identify",cn="$groupidentify";function Pt(e,t){C(e)&&e.forEach(t)}function V(e,t){if(!T(e))if(C(e))e.forEach(t);else if((s=>s instanceof FormData)(e))e.forEach((s,i)=>t(s,i));else for(const s in e)mr.call(e,s)&&t(e[s],s)}const J=function(e,...t){for(const s of t)for(const i in s)s[i]!==void 0&&(e[i]=s[i]);return e};function Os(e){const t=Object.keys(e);let s=t.length;const i=new Array(s);for(;s--;)i[s]=[t[s],e[t[s]]];return i}const nc=function(e){return function(...t){try{return e.apply(this,t)}catch(s){E.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),E.critical(s)}}},Fr=function(e){const t={};return V(e,function(s,i){(L(s)&&s.length>0||re(s))&&(t[i]=s)}),t};function Sa(e){const t=f({},e);for(const s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch{}return t}const oc=["herokuapp.com","vercel.app","netlify.app"];function ac(e){const t=e?.hostname;if(!L(t))return!1;const s=t.split(".").slice(-2).join(".");for(const i of oc)if(s===i)return!1;return!0}function W(e,t,s,i){const{capture:r=!1,passive:n=!0}=i??{};e?.addEventListener(t,s,{capture:r,passive:n})}function rr(e){return e.name==="ph_toolbar_internal"}const nr=e=>{if(w){try{const t=e+"=",s=w.cookie.split(";").filter(i=>i.length);for(let i=0;s.length>i;i++){let r=s[i];for(;r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return re(e)&&isFinite(e)&&Math.floor(e)===e});var lc=class or{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,s,i,r){if(!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>s||0>i||0>r||t>0xffffffffffff||s>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");const n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|s>>>8,n[7]=s,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new or(n)}toString(){let t="";for(let s=0;this.bytes.length>s;s++)t=t+(this.bytes[s]>>>4).toString(16)+(15&this.bytes[s]).toString(16),s!==3&&s!==5&&s!==7&&s!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new or(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let s=0;16>s;s++){const i=this.bytes[s]-t.bytes[s];if(i!==0)return Math.sign(i)}return 0}},uc=class{generate(){const e=this.generateOrAbort();if(!b(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(b(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return re(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return lc.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new cc}};let Pa=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};y&&!b(y.crypto)&&crypto.getRandomValues&&(Pa=e=>crypto.getRandomValues(e));var cc=class{nextUint32(){return this.Rt.length>this.$t||(Pa(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let hn;const Le=()=>hc().toString(),hc=()=>(hn||(hn=new uc)).generate();let jt="";const dc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let mt=null;const Q={Et(){if(!ie(mt))return mt;if(mt=!1,w)try{const e=`__ph_cookie_support_${Le()}`;Q.At(e,"xyz"),mt=nr(e)==='"xyz"',Q.Lt(e)}catch{mt=!1}return mt},Pt(e){E.error("cookieStore error: "+e)},Ot:nr,Dt(e){let t;try{t=JSON.parse(Q.Ot(e))||{}}catch{}return t},At(e,t,s,i,r){if(!w)return!1;try{let n="",o="";const a=(function(u,c){if(c){let h=(function(p,d=w){if(jt)return jt;if(!d||["localhost","127.0.0.1"].includes(p))return"";const g=p.split(".");let m=Math.min(g.length,8);const v="dmn_chk_"+Le();for(;!jt&&m--;){const _=g.slice(m).join("."),x=v+"=1;domain=."+_+";path=/";d.cookie=x+";max-age=3",d.cookie.includes(v)&&(d.cookie=x+";max-age=0",jt=_)}return jt})(u);if(!h){const p=(d=>{const g=d.match(dc);return g?g[0]:""})(u);p!==h&&E.info("Warning: cookie subdomain discovery mismatch",p,h),h=p}return h?"; domain=."+h:""}return""})(w.location.hostname,i);if(s){const u=new Date;u.setTime(u.getTime()+864e5*s),n="; expires="+u.toUTCString()}r&&(o="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&E.warn("cookieStore warning: large cookie, len="+l.length),w.cookie=l,!0}catch{return!1}},Lt(e,t){if(w?.cookie)try{Q.At(e,"",-1,t)}catch{return}}};let vi=null;const N={Et(){if(!ie(vi))return vi;let e=!0;if(b(y))e=!1;else try{const t="__mplssupport__";N.At(t,"xyz"),N.Ot(t)!=='"xyz"'&&(e=!1),N.Lt(t)}catch{e=!1}return e||E.error("localStorage unsupported; falling back to cookie store"),vi=e,e},Pt(e){E.error("localStorage error: "+e)},Ot(e){try{return y?.localStorage.getItem(e)}catch(t){N.Pt(t)}return null},Dt(e){try{return JSON.parse(N.Ot(e))||{}}catch{}return null},At(e,t){try{return y?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(s){N.Pt(s)}return!1},Lt(e){try{y?.localStorage.removeItem(e)}catch(t){N.Pt(t)}}},gi=[st,Ue,Ae,vt,tt,gt,nt,as,rt],ft=[$r,Re,Et,fa,Sr,St,Te,xe],Vs=e=>e+"_cpm",pc=["__proto__","constructor","prototype"],_i=e=>{if(!A(e))return{};const t={};return Object.keys(e).forEach(s=>{pc.indexOf(s)===-1&&(t[s]=e[s])}),t},mi=(e,t=[])=>{const s={};return[...ft,...t].forEach(i=>{const r=e[i];b(r)||ie(r)||r===""||(s[i]=r)}),s},Ma=e=>{let t=5381,s=2166136261;for(let i=0;e.length>i;i++){const r=e.charCodeAt(i);t=33*t^r,s=Math.imul(s^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(s>>>0).toString(36)},dn=(e,t)=>({p:t,f:Ma(JSON.stringify(e))}),pn=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const s=Q.Dt(Vs(e)),i=s?.f===Ma(t)&&C(s.p);return{properties:i?s.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},yi=(e,t)=>t+"|"+(Q.Ot(Vs(e))||""),yt={},ar={Et:()=>!0,Pt(e){E.error("memoryStorage error: "+e)},Ot:e=>e in yt?yt[e]:null,Dt:e=>e in yt?yt[e]:null,At:(e,t)=>(yt[e]=t,!0),Lt(e){delete yt[e]}};let lt=null;const K={Et(){if(!ie(lt))return lt;if(lt=!0,b(y))lt=!1;else try{const e="__support__";K.At(e,"xyz"),K.Ot(e)!=='"xyz"'&&(lt=!1),K.Lt(e)}catch{lt=!1}return lt},Pt(e){E.error("sessionStorage error: ",e)},Ot(e){try{return y?.sessionStorage.getItem(e)}catch(t){K.Pt(t)}return null},Dt(e){try{return JSON.parse(K.Ot(e))||null}catch{}return null},At(e,t){try{return y?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(s){K.Pt(s)}return!1},Lt(e){try{y?.sessionStorage.removeItem(e)}catch(t){K.Pt(t)}}};var fc=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.Fo.At(this.Oo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get Ao(){const e=this.Fo.Ot(this.Oo);return ii(e)?1:R(Cl,e)?0:-1}get Fo(){const e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?N:Q,s=t.Et()?t:ar;if(!this.Do||this.Do!==s){this.Do=s;const i=e==="localStorage"?Q:N;i.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(ii(i.Ot(this.Oo))),i.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[de?.doNotTrack,de?.msDoNotTrack,I.doNotTrack,de?.globalPrivacyControl].some(e=>ii(e))}};function Fa(e,t){var s;const i=e==null||(s=e.config)===null||s===void 0?void 0:s.get_current_url;if(!ve(i))return t;try{const r=i(t);return L(r)&&r?r:t}catch(r){return E.error("Error in get_current_url, falling back to window.location.href",r),t}}function fn(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function He(e){return!!e&&e.nodeType===1}function ge(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Oa(e){return!!e&&e.nodeType===3}function Or(e){return!!e&&e.nodeType===11&&He(e.host)}function Ir(e){return e?Xs(e).split(/\s+/):[]}function vn(e,t){const s=(function(i){var r;const n=y==null||(r=y.location)===null||r===void 0?void 0:r.href;return b(n)?void 0:Fa(i,n)})(t);return!!(s&&e&&e.some(i=>s.match(i)))}function Ct(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ir(t)}function Ia(e){return T(e)?null:Xs(e).split(/(\s+)/).filter(t=>es(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function us(e){let t="";return Ot(e)&&!cs(e)&&e.childNodes&&e.childNodes.length&&V(e.childNodes,function(s){var i;Oa(s)&&s.textContent&&(t+=(i=Ia(s.textContent))!==null&&i!==void 0?i:"")}),Xs(t)}function Qt(e){var t;return b(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Cr=["a","button","form","input","select","textarea","label"];function lr(e,t){const s=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!s&&s.call(e,t)}catch{return!1}}function ur(e,t){if(b(t))return!0;for(const s of e)if(t.some(i=>lr(s,i)))return!0;return!1}function Ca(e){const t=e.parentNode;return!(!t||!He(t))&&t}const bi=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ra=["next","previous","prev",">","<"],vc=[...Ra,"+","-","−","–"],gn=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,_n=[".ph-no-rageclick",".ph-no-capture"],gc=["","text","search","email","password","url","tel","number"];function Ta(e,t){if(!y||Rr(e))return!1;let s,i,r;var n,o;if($e(t)?(s=!!t&&_n,i=void 0,r=!1):(s=(n=t?.css_selector_ignorelist)!==null&&n!==void 0?n:_n,i=t?.content_ignorelist,r=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),s===!1||r&&(function(l){return!(!l||!He(l))&&(!!ge(l,"textarea")||(ge(l,"input")?R(gc,(l.getAttribute("type")||"").toLowerCase()):(function(u){var c;if(u.isContentEditable)return!0;const h=(c=u.getAttribute)===null||c===void 0?void 0:c.call(u,"contenteditable");return h==="true"||h===""})(l)))})(e))return!1;const{targetElementList:a}=Aa(e,!1);return!(function(l,u){if(l===!1||b(l))return!1;let c;if(l===!0)c=Ra;else{if(!C(l))return!1;if(l.length>10)return E.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(h=>h.toLowerCase())}return u.some(({safeText:h,ariaLabel:p})=>c.some(d=>gn(h,d)||gn(p,d)))})(i,a.map(l=>{var u;return{safeText:us(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!ur(a,s)}const Rr=e=>!e||ge(e,"html")||!He(e),Aa=(e,t)=>{if(!y||Rr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const i=[e];let r=e;for(;r.parentNode&&!ge(r,"body");){if(Or(r.parentNode)){i.push(r.parentNode.host),r=r.parentNode.host;continue}const n=Ca(r);if(!n)break;if(t||Cr.indexOf(n.tagName.toLowerCase())>-1)s=!0;else try{const o=y.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(s=!0)}catch{}i.push(n),r=n}return{parentIsUsefulElement:s,targetElementList:i}};function Ot(e){const t=new Set;let s=0;for(let n=e;n.parentNode&&!ge(n,"body");n=n.parentNode){if(s++>=1e3||t.has(n))return!1;t.add(n);const o=Ct(n);if(R(o,"ph-sensitive")||R(o,"ph-no-capture"))return!1}if(R(Ct(e),"ph-include"))return!0;const i=e.type||"";if(L(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const r=e.name||e.id||"";return!L(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function cs(e){return!!(ge(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ge(e,"select")||ge(e,"textarea")||e.getAttribute("contenteditable")==="true")}const mn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),yn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,_c=[16,15,14,13],mc=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),bn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),wn=/[0-9A-Za-z_]/;function yc(e){let t=0,s=!1;for(let i=e.length-1;i>=0;i--){let r=e.charCodeAt(i)-48;s&&(r*=2,r>9&&(r-=9)),t+=r,s=!s}return t%10==0}function es(e,t=!0){return!(T(e)||L(e)&&(e=Xs(e),(t?mn.test((e||"").replace(/[- ]/g,"")):(function(s){let i;for(yn.lastIndex=0;i=yn.exec(s);){const r=i[2];if(!r)continue;const n=r.replace(/[- ]/g,"");for(let o=0;n.length>o;o++)for(const a of _c){const l=o+a;if(n.length>=l){const u=n.slice(o,l);if(mn.test(u)&&yc(u))return!0}}}return!1})(e))||(t?mc.test(e):(function(s){let i;for(bn.lastIndex=0;i=bn.exec(s);){const r=i[1],n=i[3];if(!(r&&n&&wn.test(r)&&wn.test(n)))return!0}return!1})(e))))}function xn(e){let t=us(e);return t=`${t} ${La(e)}`.trim(),es(t)?t:""}function La(e){let t="";return e&&e.childNodes&&e.childNodes.length&&V(e.childNodes,function(s){var i;if(s&&((i=s.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const r=us(s);t=`${t} ${r}`.trim(),s.childNodes&&s.childNodes.length&&(t=`${t} ${La(s)}`.trim())}catch(r){E.error("[AutoCapture]",r)}}),t}function $n(e){return e.replace(/"|\\"/g,'\\"')}function bc(e){const t=e.attr__class;if(t)return C(t)?t:Ir(t)}const ys=ne("[Dead Clicks]"),wc=()=>!0,xc=e=>{var t;const s=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(kr)),i=e.instance.config.capture_dead_clicks;return $e(i)?i:!!A(i)||s};var kn=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[kr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(e){var t,s,i;!((t=I.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(s=I.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this.instance,"dead-clicks-autocapture",r=>{r?ys.error("failed to load script",r):e()})}qo(){var e;if(w){if(!this.Lo&&(!((e=I.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=A(this.instance.config.capture_dead_clicks)?f({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=I.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(w),ys.info("starting...")}}else ys.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,ys.info("stopping..."))}};const Bt=ne("[SegmentIntegration]");function En(e,t,s=!0){const i=e.config.segment;if(!i)return t();const{analytics:r,filterProperties:n}=(a=>ve(a.register))(o=i)?{analytics:o}:o;var o;(function(a,l,u,c){const h=d=>{const g=()=>d.anonymousId()||Le();a.config.get_device_id=g,c&&d.id()&&(a.register({distinct_id:d.id(),$device_id:g()}),a.persistence.set_property(xe,Fs)),u(c?void 0:d.anonymousId()||void 0)},p=l.user();"then"in p&&ve(p.then)?p.then(h):h(p)})(e,r,a=>{r.register(((l,u,{filterProperties:c}={})=>{typeof Promise<"u"&&Promise.resolve||Bt.warn("This browser does not have Promise support, and can not use the segment integration");const h=(p,d)=>{if(!d)return p;const g=!!u&&p.event.anonymousId===u&&!p.event.userId;g||p.event.userId||p.event.anonymousId===l.get_distinct_id()||(Bt.info("No userId set, resetting PostHog"),l.reset()),g||(u=void 0),p.event.userId&&p.event.userId!==l.get_distinct_id()&&(Bt.info("UserId set, identifying with PostHog"),l.identify(p.event.userId));let m=l.calculateEventProperties(d,p.event.properties);if(!T(c)){const v=p.event.properties||{},_={};for(const $ of Object.keys(m))mr.call(v,$)||(_[$]=m[$]);const x=(($,O)=>{const k=C($)?$:[$];let M=f({},O);for(const F of k)try{if(M=F(M),T(M))return null}catch(S){return Bt.error("Error in Segment filterProperties:",S),null}return M})(c,_);if(T(x))return p;m=x}return p.event.properties=Object.assign({},m,p.event.properties),p};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(p){return h(p,p.event.event)},page(p){return h(p,Mr)},identify(p){return h(p,ir)},screen(p){return h(p,"$screen")}}})(e,a,{filterProperties:n})).then(()=>{t()},l=>{Bt.error("Failed to register the Segment integration",l),t()})},s)}const Da="posthog-js";function Na(e,{organization:t,projectId:s,prefix:i,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,c,h;if(r!=="*"&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const p=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const d=((a=o.exception)===null||a===void 0?void 0:a.values)||[],g=d.map(_=>f(f({},_),{},{stacktrace:_.stacktrace?f(f({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(x=>f(f({},x),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=d[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(u=d[0])===null||u===void 0?void 0:u.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((c=d[0])===null||c===void 0?void 0:c.value)||o.message,$sentry_exception_type:(h=d[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var v;return t&&s&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+o.event_id),n&&((v=e.exceptions)===null||v===void 0||v.sendExceptionEvent(m)),o}}var $c=class{constructor(e,t,s,i,r,n){this.name=Da,this.setupOnce=function(o){o(Na(e,{organization:t,projectId:s,prefix:i,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},Sn=class{constructor(e){this.jo=(t,s,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(E.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ho()}Ho(){var e;this.zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.jo)}destroy(){var e;(e=this.zo)===null||e===void 0||e.call(this),this.zo=void 0}doPageView(e,t){var s;const i=this.Uo(e,t);return this.Bo={pathname:(s=y?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Uo(e,(t=this.Bo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Bo)===null||e===void 0?void 0:e.pageViewId}}Uo(e,t){const s=this.Bo;if(!s)return{$pageview_id:t};let i={$pageview_id:t,$prev_pageview_id:s.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(b(n)||b(o)||b(a)||b(l)||b(u)||b(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);const h=n>1?Be(o/n,0,1,E):1,p=n>1?Be(a/n,0,1,E):1,d=l>1?Be(u/l,0,1,E):1,g=l>1?Be(c/l,0,1,E):1;i=J(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:g})}}return s.pathname&&(i.$prev_pageview_pathname=s.pathname),s.timestamp&&(i.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),i}};const Ht=["flags","surveys"],kc={[Iu]:{exposure:"hidden"},[Hs]:{exposure:"hidden"},[Cu]:{exposure:"hidden"},[Ki]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[ca]:{exposure:"event"},[Ji]:{exposure:"hidden"},[da]:{exposure:"hidden"},[Xi]:{exposure:"event"},[ha]:{exposure:"hidden"},[Yi]:{exposure:"event"},[Zi]:{exposure:"event"},[kr]:{exposure:"event"},[Er]:{exposure:"hidden"},[pa]:{exposure:"event"},[Yt]:{exposure:"hidden"},[Ru]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[fa]:{exposure:"event"},[Tu]:{exposure:"event",shouldSkipFromEventProperties:e=>ie(e)},[ju]:{exposure:"event"},[Bu]:{exposure:"event"},[Hu]:{exposure:"event"},[zu]:{exposure:"event"},[qu]:{exposure:"hidden"},[Ae]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"hidden",storageGroup:"flags"},[Qi]:{exposure:"hidden"},[vt]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Zt]:{exposure:"hidden",storageGroup:"flags"},[Ne]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[it]:{exposure:"hidden"},[er]:{exposure:"hidden",storageGroup:"surveys"},[zs]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ga]:{exposure:"event"},[_a]:{exposure:"hidden"},[ma]:{exposure:"hidden"},[tr]:{exposure:"hidden"},[Vu]:{exposure:"hidden"},[Wu]:{exposure:"hidden"},[Uu]:{exposure:"event"},[Gu]:{exposure:"event"},[Ku]:{exposure:"event"},[Ju]:{exposure:"event"},[rt]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[va]:{exposure:"event"},[as]:{exposure:"hidden"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xe]:{exposure:"hidden"},[sr]:{exposure:"hidden"},[Xu]:{exposure:"hidden"},[ya]:{exposure:"hidden"},[ba]:{exposure:"hidden"},[St]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},[Au]:{exposure:"event"},[Lu]:{exposure:"event"},[Du]:{exposure:"event"},[Nu]:{exposure:"event"},[xa]:{exposure:"event"},[$a]:{exposure:"event"},[ka]:{exposure:"event"},[Yu]:{exposure:"event"},[Zu]:{exposure:"event"},[Qu]:{exposure:"event"},[ec]:{exposure:"event"},[tc]:{exposure:"event"},[sc]:{exposure:"event"},[ic]:{exposure:"event"},[rc]:{exposure:"event"}},Ec=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],pe=e=>{const t=kc[e];if(t)return t;for(const[s,i]of Ec)if(e.indexOf(s)===0)return i},Mt=(e,t)=>{try{let s;return JSON.stringify(e,(i,r)=>{var n;return ps(r)?((n=s)!==null&&n!==void 0||(s=new WeakMap),s.has(r)||s.set(r,Sa(r)),s.get(r)):typeof r=="bigint"?r.toString():r},t)}catch{return co(e)}},Rt=e=>{const t=w?.createElement("a");return b(t)?null:(t.href=e,t)},Tt=function(e,t){const s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let r=0;s.length>r;r++){const n=s[r].split("=");if(n[0]===t){i=n;break}}if(!C(i)||2>i.length)return"";{let r=i[1];try{r=decodeURIComponent(r)}catch{E.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")}},hs=function(e,t,s){if(!e||!t||!t.length)return e;const i=e.split("#"),r=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[];for(let h=0;l.length>h;h++){const p=l[h].split("=");C(p)&&(t.includes(p[0])?u.push(p[0]+"="+s):u.push(l[h]))}let c=a;return o!=null&&(c+="?"+u.join("&")),r!=null&&(c+="#"+r),c},Ws=function(e,t){const s=e.match(new RegExp(t+"=([^&]*)"));return s?s[1]:null},ja=(e,t)=>e>=t&&uo(),Ba=(e,t,s,i)=>{if(e===0){if(uo()){const r=t+1;return r===s&&i(),r}return t}return 0},At=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Sc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...At],ds="<masked>",Pc=["li_fat_id"];function Ha(e,t,s){if(!w)return{};const i=t?[...At,...s||[]]:[],r=za(hs(w.URL,i,ds),e),n=(function(){const o={};return V(Pc,function(a){const l=nr(a);o[a]=l||null}),o})();return J(n,r)}function za(e,t){const s=Sc.concat(t||[]),i={};return V(s,function(r){const n=Tt(e,r);i[r]=n||null}),i}function qa(e){const t=(function(r){return r?r.search("https?://(.*)google.([^/?]*)")===0?"google":r.search("https?://(.*)bing.com")===0?"bing":r.search("https?://(.*)yahoo.com")===0?"yahoo":r.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),s=t!="yahoo"?"q":"p",i={};if(!ie(t)){i.$search_engine=t;const r=w?Tt(w.referrer,s):"";r.length&&(i.ph_keyword=r)}return i}function Va(){return navigator.language||navigator.userLanguage}function Mc(){const e=Va();return typeof e=="string"?e.split("-")[0]:void 0}const Us="$direct";function Wa(){return w?.referrer||Us}function Ua(e,t,s=!1){const i=e?[...At,...t||[]]:[],r=s?ot(ee?.href):ee?.href,n=r?.substring(0,1e3);return{r:Wa().substring(0,1e3),u:n?hs(n,i,ds):void 0}}function Ga(e,t=!1){var s;const{r:i,u:r}=e,n=t?ot(r):r,o={$referrer:i,$referring_domain:i==null?void 0:i==Us?Us:(s=Rt(i))===null||s===void 0?void 0:s.host};if(n){o.$current_url=n;const a=Rt(n);o.$host=a?.host,o.$pathname=a?.pathname;const l=za(n);J(o,l)}if(i){const a=qa(i);J(o,a)}return o}function Ka(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Fc(){try{return new Date().getTimezoneOffset()}catch{return}}const Oc={flags:nt,surveys:zs},Ic=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bs=e=>`${e}_cookie_identity_change_pending`,ws=e=>{let t="",s=0;for(const i of e){const r=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(s+r>1e3)break;t+=i,s+=r}return t},ue="main",We=[Ae,Ue,vt,tt,gt,nt,Zt,st],wi=e=>We.indexOf(e)!==-1,Ze=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},bt=e=>{if(!e)return{};const t=JSON.parse(e);return A(t)?t:{}},Pn=(e,t)=>{V(e,(s,i)=>{const r=pe(i);r&&r.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var xi=class{constructor(e,t,s=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Yo=!1,this.Xo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=s,this.props={},this.sl=void 0,this.rl=(i=>{let r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&E.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save(),y){const i=()=>this.flush();W(y,"beforeunload",i,{capture:!1}),W(y,"pagehide",i,{capture:!1}),this.ul=r=>{if(this.Vo&&(!r.storageArea||r.storageArea===y?.localStorage)&&r.key)if(r.key!==this.rl){if(this.Zo){const n=Ht.find(o=>r.key===this.hl(o));n&&this.cl(r.key,n)}}else this.cl(r.key,ue)},W(y,"storage",this.ul)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,s])=>{const i=this.Ko.get(t);if(!wi(t)||i===!0)return;if(s===!0)return void this.dl(t,!0);const r=new Set(i||[]);s.forEach(n=>r.add(n)),r.size&&this.dl(t,r)})}onCrossTabFeatureFlagChange(e){return this.il.add(e),()=>this.il.delete(e)}destroy(){this.ul&&y&&(y.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(e,t,s=!0){if(this.pi)return!1;let i,r;try{if(r=N.Ot(e),ie(r)){const a=this.vl(t);return a.storageValue=null,t!==ue&&(a.persisted=!1),!1}i=bt(r)}catch{return!1}const n=t===ue?i:N.Dt(this.rl);if(n&&this.fl(n))return!1;const o=this.pl(i,t,s);return t===ue&&this.Zo&&!Ze(this.gl().main,i)||this.ml(i,t,!0,r),o}fl(e){const t=this.props[Re],s=e[Re];return!b(t)&&!b(s)&&t!==s}ml(e,t,s,i){const r=this.vl(t);r.storageValue=i,t!==ue&&(r.persisted=s);try{r.fingerprint=this.yl(e,t)}catch{r.fingerprint=void 0}}pl(e,t,s){let i=!1;return We.forEach(r=>{var n;const o=(n=pe(r))===null||n===void 0?void 0:n.storageGroup;if(t===ue&&this.Zo&&o||t!==ue&&o!==t)return;const a=r in e,l=this.bl(r,a?e[r]:void 0),u=this.Ko.has(r)?r in this.props:a;u===r in this.props&&Ze(l,this.props[r])||(u?this._l(r,l,!1):this.wl(r,!1),i=!0)}),i&&s&&this.il.forEach(r=>r()),i}kl(){if(!this.Vo)return!1;try{this.tl=!1;const e=N.Ot(this.rl),t=this.vl(ue);let s,i=!1,r=!1;if(e!==t.storageValue)if(ie(e))t.storageValue=null;else{if(s=bt(e),this.tl=!this.Xo&&this.fl(s),this.tl)return!1;r=this.pl(s,ue,!1),!this.Zo||Ze(this.gl().main,s)?this.ml(s,ue,!0,e):t.storageValue=e,i=!0}return this.Zo&&Ht.forEach(n=>{const o=N.Ot(this.hl(n)),a=this.vl(n),l=s||{},u=i&&We.some(h=>{var p;return((p=pe(h))===null||p===void 0?void 0:p.storageGroup)===n&&h in l});if(o===a.storageValue&&!u)return;if(ie(o))return a.storageValue=null,a.persisted=!1,void(u&&(r=this.pl(l,n,!1)||r));const c=bt(o);r=this.pl(c,n,!1)||r,this.ml(c,n,!0,o)}),r}catch{return!1}}dl(e,t){this.Ko.set(e,t);const s=pe(e);s?.volatile||(this.vl((this.Zo?s?.storageGroup:void 0)||ue).fingerprint=void 0,this.Sl(e))}xl(){We.forEach(e=>this.Ko.set(e,!0))}al(){if(this.Vo)try{const e=N.Ot(this.rl),t=bt(e);this.vl(ue).storageValue=e,We.forEach(s=>{var i;const r=this.Zo?(i=pe(s))===null||i===void 0?void 0:i.storageGroup:void 0,n=r?N.Ot(this.hl(r)):null;if(r){const a=this.vl(r);a.storageValue=n,a.persisted=!ie(n)}const o=r&&!ie(n)?bt(n):t;s in this.props?this.Cl(s,o[s],this.props[s]):s in o&&this.dl(s,!0)})}catch{}}bl(e,t){const s=this.Ko.get(e);if(!s)return t;if(s===!0)return this.props[e];if(e==="$active_feature_flags"){const n=new Set(C(t)?t:[]),o=new Set(C(this.props[e])?this.props[e]:[]);return s.forEach(a=>o.has(a)?n.add(a):n.delete(a)),Array.from(n)}const i=A(t)?f({},t):{},r=A(this.props[e])?this.props[e]:{};return s.forEach(n=>{n in r?i[n]=r[n]:delete i[n]}),i}Cl(e,t,s){if(!wi(e))return;const i=this.Ko.get(e);if(i===!0)return;let r=t;if(this.Vo)try{var n;const a=this.Zo?(n=pe(e))===null||n===void 0?void 0:n.storageGroup:void 0,l=a?this.hl(a):this.rl;r=bt(N.Ot(l))[e]}catch{}const o=new Set(i||[]);if(e==="$active_feature_flags"){if(!b(t)&&!C(t)||!b(r)&&!C(r)||!C(s))return void this.dl(e,!0);const a=new Set(t||[]),l=new Set(r||[]),u=new Set(s);new Set([...a,...u]).forEach(c=>{a.has(c)!==u.has(c)&&o.add(c)}),o.forEach(c=>{l.has(c)===u.has(c)&&o.delete(c)})}else{if(!A(s))return void(Ze(r,s)?this.Ko.delete(e):this.dl(e,!0));{if(!b(t)&&!A(t)||b(t)&&ke(s)&&b(r))return void this.dl(e,!0);const a=A(t)?t:{},l=A(r)?r:{};new Set([...Object.keys(a),...Object.keys(s)]).forEach(u=>{u in a==u in s&&Ze(a[u],s[u])||o.add(u)}),o.forEach(u=>{u in l==u in s&&Ze(l[u],s[u])&&o.delete(u)})}}o.size?this.dl(e,o):this.Ko.delete(e)}$l(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return re(t)&&t>0?t:0}Tl(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=mi(e,this.Mr.cookie_persisted_properties||[]),s=dn(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(s),r=Q.Ot(this.rl)||void 0;r&&yi(this.rl,r)===i&&(this.Il=i,this.Ml=r)}catch{}else try{const t=Q.Ot(this.rl)||void 0;this.Il=t?yi(this.rl,t):void 0,this.Ml=t}catch{}}syncCookieProperties(){return this.El(this.Mr)}El(e,t=!1){if(this.pi&&!t||this.Jo||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let s;try{s=Q.Ot(this.rl)||void 0}catch{}if(!s||s===this.Ml)return!1;const i=yi(this.rl,s);let r;try{r=_i(JSON.parse(s))}catch{return!1}if((Q.Ot(this.rl)||void 0)!==s)return!1;this.Il=i,this.Ml=s;const n=pn(this.rl,s),o=[...ft,...n.properties],a={};if(Object.keys(r).forEach(m=>{const v=r[m];(b(v)||ie(v)||v===""||m==="$user_state"&&v!=="anonymous"&&v!=="identified")&&(a[m]=!0,delete r[m])}),ke(r))return!1;const l="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",u=this.props,c=u[Re],h=u[xe],p=J({},u);[...ft,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){const v=p[m];(n.isValid||ft.indexOf(m)===-1||v!==!1&&v!==0)&&delete p[m]}}),this.props=J(p,r),We.forEach(m=>{const v=m in this.props;m in u===v&&Ze(u[m],this.props[m])||(v?this.Cl(m,u[m],this.props[m]):this.dl(m,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this._l(xe,Ge);const d=this.props[Re],g=this.props[xe];return!l||d===c&&g===h||(this.Xo=!0,this.Qo=!0,K.At(bs(this.rl),!0),this.wl(st),this.wl(Ue),this.wl(Ae),this.wl(vt),this.wl(tt),this.wl(gt),this.wl(nt),this.wl(as),this.wl(rt),g!=="anonymous"||h!=="identified"&&r.$user_state!=="anonymous"&&(b(c)||d===c)||(Pn(this.props,r),this.wl(it)),g==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.wl(Hs)),!0}consumeCookieIdentityChange(){const e=bs(this.rl),t=this.Qo||!!K.Ot(e);return this.Qo=!1,t&&K.Lt(e),t}Pl(e=!1){return!(this.Jo||this.pi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.Jo=!0,0))}Rl(){this.Jo&&(b(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[ue],this.Fl(!0))}Ol(e=!0){if(this.Jo)try{e?this.Rl():b(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){Ic.indexOf(e.persistence.toLowerCase())===-1&&(E.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const l=[...ft,...o];return f(f({},N),{},{Dt(u){try{let h,p={};try{h=Q.Ot(u)||void 0,p=h?_i(JSON.parse(h)):{}}catch{}const d=JSON.parse(N.Ot(u)||"{}");let g;if(a){const m=pn(u,h),v=[...ft,...m.properties],_={};Object.keys(p).forEach($=>{const O=p[$];ie(O)||O===""||$==="$user_state"&&O!=="anonymous"&&O!=="identified"||(_[$]=O)});const x="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var c;const $=d[Re],O=(c=d.$user_state)!==null&&c!==void 0?c:Ge;l.forEach(k=>{if(v.indexOf(k)!==-1&&!(k in p)&&(x||k!=="distinct_id"&&k!=="$user_state")){const M=d[k];(m.isValid||ft.indexOf(k)===-1||M!==!1&&M!==0)&&delete d[k]}}),!x||"$user_state"in p||"$user_state"in d||(d[xe]=Ge),!x||("distinct_id"in _?_[Re]:d[Re])===$&&("$user_state"in _?_[xe]:d[xe])===O||(gi.forEach(k=>delete d[k]),_.$user_state==="identified"&&"distinct_id"in _?d.$user_id=_[Re]:delete d.$user_id,_.$user_state!=="identified"&&(delete d[va],delete d[it]),delete d.__alias)}g=J(d,_)}else g=J(p,d);return N.At(u,g),g}catch{}return null},At(u,c,h,p,d,g){const m=N.At(u,c,void 0,void 0,g);try{const v=mi(c,o);if(Object.keys(v).length){if(a){const _=Vs(u),x=dn(v,o);if(Q.At(_,x,h,p,d,g),Q.Ot(_)!==JSON.stringify(x)){Q.Lt(_,p);const $=mi(c);return Q.At(u,$,h,p,d,g),m}}Q.At(u,v,h,p,d,g)}}catch(v){N.Pt(v)}return m},Lt(u,c){try{y?.localStorage.removeItem(u),Q.Lt(u,c),Q.Lt(Vs(u),c)}catch(h){N.Pt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let s,i=!1,r=!1;const n=e.persistence.toLowerCase();return n==="localstorage"&&N.Et()?(s=N,r=!0):n==="localstorage+cookie"&&t.Et()?(s=t,r=!0,i=!0):n==="sessionstorage"&&K.Et()?s=K:n==="memory"?s=ar:n==="cookie"&&Q.Et()?(s=Q,i=!0):t.Et()?(s=t,r=!0,i=!0):Q.Et()?(s=Q,i=!0):s=ar,this.Vo=r,this.Go=i,s}hl(e){return`${this.rl}__${e}`}ll(e){return this.Vo&&!!e.split_storage}properties(){const e={};return V(this.props,(t,s)=>{const i=pe(s);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,t))return;e[s]=t}}),e}load(e=!1){if(this.pi&&!e)return;const t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",s=t?N.Dt(this.rl):null;let i={};if(t)try{i=_i(Q.Dt(this.rl)),V(i,(a,l)=>{(b(a)||ie(a)||a==="")&&delete i[l]})}catch{}const r=this.Fo.Dt(this.rl);if(r&&(this.props=J({},r)),this.Zo&&this.Dl(),t&&r){var n,o;const a=s?.[Re],l=(n=s?.$user_state)!==null&&n!==void 0?n:Ge,u=r[Re],c=(o=r.$user_state)!==null&&o!==void 0?o:Ge;if(u!==a||c!==l){this.Qo=!0,K.At(bs(this.rl),!0);const h=J({},this.props);gi.forEach(d=>delete h[d]),c!=="anonymous"||l!=="identified"&&i.$user_state!=="anonymous"&&(b(a)||u===a)||(Pn(h,i),delete h[it]),this.props=h;const p=new Set;gi.forEach(d=>{var g;const m=(g=pe(d))===null||g===void 0?void 0:g.storageGroup;m&&p.add(m)}),p.forEach(d=>{const g={};V(this.props,(m,v)=>{var _;((_=pe(v))===null||_===void 0?void 0:_.storageGroup)===d&&(g[v]=m)}),ke(g)?(N.Lt(this.hl(d)),this.Wo[d]={}):N.At(this.hl(d),g)&&(this.Wo[d]={persisted:!0,fingerprint:this.yl(g,d)})})}}K.Ot(bs(this.rl))&&(this.Qo=!0)}Dl(){for(const e of Ht){const t=N.Dt(this.hl(e));if(t&&!ke(t)){const s=this.vl(e);s.persisted=!0,this.Ll(e)||(s.fingerprint=this.yl(t,e)),this.Nl(e,t)||J(this.props,t)}}}Ll(e){return Object.keys(this.props).some(t=>{var s;return((s=pe(t))===null||s===void 0?void 0:s.storageGroup)===e})}Nl(e,t){const s=Oc[e];if(!s)return!1;const i=t[s],r=this.props[s];return re(i)&&re(r)&&r>i}refreshKey(e){var t;if(this.pi||e==="$fbc_persistence"&&this.el)return;const s=this.Zo?(t=pe(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=s?N.Dt(this.hl(s)):this.Fo.Dt(this.rl);if(i&&e in i)this._l(e,i[e],!1);else{if(s){const r=this.Fo.Dt(this.rl);if(r&&e in r)return void this._l(e,r[e],!1)}this.wl(e,!1)}}save(){if(this.pi)return;const e=this.$l();e>0?b(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},e)):this.Fl()}flush(){b(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(e=!1){if(this.pi||this.Jo&&!e)return;e||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(Te));const t=!e&&!this.Yo;t||(this.tl=!1);const s=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&E.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(s&&this.il.forEach(r=>r()));const i=this.jl(this.Fo,this.rl,this.props,ue);i==="written"&&this.Tl(this.props),i!=="failed"&&(this.Ko.clear(),this.Xo=!1,this.el=!1),s&&this.il.forEach(r=>r())}ql(){const{main:e,groups:t}=this.gl(),s=this.jl(this.Fo,this.rl,e,ue);s==="written"&&this.Tl(e),s!=="failed"&&(this.Xo=!1,this.el=!1,We.forEach(r=>{var n;!((n=pe(r))===null||n===void 0)&&n.storageGroup||this.Ko.delete(r)}));for(const r of Ht){var i;const n=t[r];if(ke(n)&&!(!((i=this.Wo[r])===null||i===void 0)&&i.persisted)){We.forEach(a=>{var l;((l=pe(a))===null||l===void 0?void 0:l.storageGroup)===r&&this.Ko.delete(a)});continue}const o=this.jl(N,this.hl(r),n,r);o!=="failed"&&We.forEach(a=>{const l=pe(a);l?.storageGroup!==r||o!=="written"&&l.volatile||this.Ko.delete(a)})}}gl(){const e={},t={flags:{},surveys:{}};return V(this.props,(s,i)=>{var r;const n=(r=pe(i))===null||r===void 0?void 0:r.storageGroup;n?t[n][i]=s:e[i]=s}),{main:e,groups:t}}yl(e,t){if(t===ue)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const s={};return V(e,(i,r)=>{var n;s[r]=!((n=pe(r))===null||n===void 0)&&n.volatile?"__volatile__":i}),JSON.stringify(s)}jl(e,t,s,i){const r=this.vl(i);if(i!==ue&&!r.dirty&&!b(r.fingerprint))return"skipped";let n;try{if(n=this.yl(s,i),n===r.fingerprint)return r.dirty=!1,"skipped"}catch{n=void 0}return e.At(t,s,this.Bl,this.Hl,this.zl,this.Mr.debug)?(r.dirty=!1,i!==ue&&(r.persisted=!0),b(n)||(r.fingerprint=n),this.Vo&&(r.storageValue=N.Ot(t)),"written"):(this.Mr.debug&&E.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.xl(),b(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!e&&this.nl)for(const t of Ht)N.Lt(this.hl(t));e?delete this.Wo[ue]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(e,t,s){if(A(e)){this.syncCookieProperties(),b(t)&&(t="None"),this.Bl=b(s)?this.Ul:s;let i=!1;if(V(e,(r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this._l(n,r),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(A(e)){this.syncCookieProperties(),this.Bl=b(t)?this.Ul:t;let s=!1;if(V(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||A(i)||C(i))&&(this._l(r,i),s=!0)}),s)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let s=!1;for(const i of t)i in this.props&&(this.wl(i),s=!0);s&&this.save()}update_campaign_params(){const e=w?.URL;if(e===this.sl)return;const t=Ha(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),s=!ke(Fr(t));return s&&this.register(t),this.sl=e,s?t:void 0}update_search_keyword(){this.register((function(){const e=w?.referrer;return e?qa(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Wa(),$referring_domain:w?.referrer&&((e=Rt(w.referrer))===null||e===void 0?void 0:e.host)||Us},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Ua(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[St]:this.Go?{r:ws(e.r),u:e.u?ws(e.u):void 0}:e},void 0)}get_initial_props(){const e={};V([ba,ya],s=>{const i=this.props[s];i&&V(i,function(r,n){e["$initial_"+Bi(n)]=r})});const t=this.props[St];if(t){const s=(function(i,r=!1){const n=Ga(i,r),o={};return V(n,function(a,l){o[`$initial_${Bi(l)}`]=a}),o})(t,this.Mr.disable_capture_url_hashes);J(e,s)}return e}safe_merge(e){return V(this.props,function(t,s){s in e||(e[s]=t)}),e}update_config(e,t,s){const i=e.persistence!==t.persistence,r=!((d,g)=>{if(d.length!==g.length)return!1;const m=[...d].sort(),v=[...g].sort();return m.every((_,x)=>_===v[x])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=i||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!s,l=!!this.pi&&!a;a||this.El(t,l),this.Mr=e,!a&&(i||r||o)&&(this.Il=void 0,this.Ml=void 0,this.El(f(f({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const u=n||o?this.ol(e):this.Fo;this.Wl();const c=this.ll(e),h=n||c!==this.Zo,p=!a&&(h||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(l);this.Yo=h;try{if(this.Ul=this.Bl=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){const d=this.props;this.clear(),this.Fo=u,this.Zo=c,this.props=d,this.save()}else o&&(this.Fo=u,a||(delete this.Wo[ue],this.Fl()))}finally{this.Yo=!1,p&&this.Ol()}}Wl(){const e=this.props[St];if(!this.Go||!A(e)||typeof e.r!="string")return;const t=ws(e.r),s=typeof e.u=="string"?ws(e.u):e.u;t===e.r&&s===e.u||this._l(St,f(f({},e),{},{r:t,u:s}))}set_disabled(e){this.pi=e,this.pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Hl&&(this.Hl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const s=this.props.__timers||{};s[e]=t,this._l(Ki,s),this.save()}remove_event_timer(e){const t=this.props.__timers||{},s=t[e];return b(s)||(delete t[e],this._l(Ki,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this._l(e,t),this.save()}_l(e,t,s=!0){var i;const r=this.props[e];this.props[e]=t,s&&(e!=="distinct_id"&&e!=="$user_state"||r===t||(this.Xo=!0),e!=="$fbc_persistence"||Ze(r,t)||(this.el=!0),this.Cl(e,r,t),!((i=pe(e))===null||i===void 0)&&i.volatile||this.Sl(e))}wl(e,t=!0){delete this.props[e],t&&(wi(e)&&this.dl(e,!0),e==="$fbc_persistence"&&(this.el=!0),this.Sl(e))}Sl(e){var t;const s=(t=pe(e))===null||t===void 0?void 0:t.storageGroup;s&&(this.vl(s).dirty=!0)}vl(e){return this.Wo[e]||(this.Wo[e]={})}};const Pe={GZipJS:"gzip-js",Base64:"base64"},zt={Activation:"events",Cancellation:"cancelEvents"},$i={Popover:"popover",API:"api",Widget:"widget"},Ke={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},ki={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},cr={Popover:"popover",Inline:"inline"};function xs(e){let t=!0;return{dispose(){if(t){t=!1;const s=e();s&&ve(s.then)&&s.then(void 0,()=>{})}}}}const Cc={SHOWN:"product tour shown"},Mn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Fn=ne("[RateLimiter]");var Rc=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(i=>{Fn.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void Fn.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,s,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=new Date().getTime(),a=(t=(s=this.instance.persistence)===null||s===void 0?void 0:s.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const u=(re(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Vl(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Gl(e){const t=this.instance.config.property_denylist;return!C(t)||!t.includes(e)}Zl(){var e;if(this.Gl("$current_url")&&this.Gl("$pathname")&&ee?.pathname)return`${(e=ee.origin)!==null&&e!==void 0?e:""}${ee.pathname}`}Vl(e){var t,s;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,n=this.Zl(),o=this.Gl("$session_id")?(t=(s=this.instance).get_session_id)===null||t===void 0?void 0:t.call(s):void 0,a=[`${e} event(s) dropped since the last warning`,n?`triggered on ${n}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const Qe=ne("[RemoteConfig]");var Ja=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=I._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ql(e){var t,s,i;!((t=I.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(s=I.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Jl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Qe.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Yl())return void Qe.warn("Remote config is disabled. Falling back to local config.");this.Ql(e=>{if(!e)return Qe.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(e)})}catch(e){Qe.error("Error loading remote config",e),this.Kl()}}Kl(e,t){!e&&t&&(t.statusCode===0?t.error||Qe.warn("Failed to fetch remote config from PostHog."):Qe.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(i){Qe.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var s;(s=this._instance.featureFlags)===null||s===void 0||s.ensureFlagsLoaded()}catch(i){Qe.error("Error loading feature flags",i)}}},Oe=Uint8Array,Ee=Uint16Array,Lt=Uint32Array,Tr=new Oe([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]),Ar=new Oe([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]),On=new Oe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xa=function(e,t){for(var s=new Ee(31),i=0;31>i;++i)s[i]=t+=1<<e[i-1];var r=new Lt(s[30]);for(i=1;30>i;++i)for(var n=s[i];s[i+1]>n;++n)r[n]=n-s[i]<<5|i;return[s,r]},Ya=Xa(Tr,2),hr=Ya[1];Ya[0][28]=258,hr[258]=28;for(var In=Xa(Ar,0)[1],Za=new Ee(32768),te=0;32768>te;++te){var wt=(43690&te)>>>1|(21845&te)<<1;Za[te]=((65280&(wt=(61680&(wt=(52428&wt)>>>2|(13107&wt)<<2))>>>4|(3855&wt)<<4))>>>8|(255&wt)<<8)>>>1}var ts=function(e,t,s){for(var i=e.length,r=0,n=new Ee(t);i>r;++r)++n[e[r]-1];var o,a=new Ee(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;for(o=new Ee(i),r=0;i>r;++r)o[r]=Za[a[e[r]-1]++]>>>15-e[r];return o},_t=new Oe(288);for(te=0;144>te;++te)_t[te]=8;for(te=144;256>te;++te)_t[te]=9;for(te=256;280>te;++te)_t[te]=7;for(te=280;288>te;++te)_t[te]=8;var Gs=new Oe(32);for(te=0;32>te;++te)Gs[te]=5;var Tc=ts(_t,9),Ac=ts(Gs,5),Qa=function(e){return(e/8|0)+(7&e&&1)},el=function(e,t,s){(s==null||s>e.length)&&(s=e.length);var i=new(e instanceof Ee?Ee:e instanceof Lt?Lt:Oe)(s-t);return i.set(e.subarray(t,s)),i},ze=function(e,t,s){var i=t/8|0;e[i]|=s<<=7&t,e[i+1]|=s>>>8},qt=function(e,t,s){var i=t/8|0;e[i]|=s<<=7&t,e[i+1]|=s>>>8,e[i+2]|=s>>>16},Ei=function(e,t){for(var s=[],i=0;e.length>i;++i)e[i]&&s.push({s:i,f:e[i]});var r=s.length,n=s.slice();if(!r)return[new Oe(0),0];if(r==1){var o=new Oe(s[0].s+1);return o[s[0].s]=1,[o,1]}s.sort(function(k,M){return k.f-M.f}),s.push({s:-1,f:25001});var a=s[0],l=s[1],u=0,c=1,h=2;for(s[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=s[s[h].f>s[u].f?u++:h++],l=s[u!=c&&s[h].f>s[u].f?u++:h++],s[c++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(i=1;r>i;++i)n[i].s>p&&(p=n[i].s);var d=new Ee(p+1),g=dr(s[c-1],d,0);if(g>t){i=0;var m=0,v=g-t,_=1<<v;for(n.sort(function(k,M){return d[M.s]-d[k.s]||k.f-M.f});r>i;++i){var x=n[i].s;if(t>=d[x])break;m+=_-(1<<g-d[x]),d[x]=t}for(m>>>=v;m>0;){var $=n[i].s;t>d[$]?m-=1<<t-d[$]++-1:++i}for(;i>=0&&m;--i){var O=n[i].s;d[O]==t&&(--d[O],++m)}g=t}return[new Oe(d),g]},dr=function(e,t,s){return e.s==-1?Math.max(dr(e.l,t,s+1),dr(e.r,t,s+1)):t[e.s]=s},Cn=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new Ee(++t),i=0,r=e[0],n=1,o=function(l){s[i++]=l},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[s.subarray(0,i),t]},Vt=function(e,t){for(var s=0,i=0;t.length>i;++i)s+=e[i]*t[i];return s},pr=function(e,t,s){var i=s.length,r=Qa(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;i>n;++n)e[r+n+4]=s[n];return 8*(r+4+i)},Rn=function(e,t,s,i,r,n,o,a,l,u,c){ze(t,c++,s),++r[256];for(var h=Ei(r,15),p=h[0],d=h[1],g=Ei(n,15),m=g[0],v=g[1],_=Cn(p),x=_[0],$=_[1],O=Cn(m),k=O[0],M=O[1],F=new Ee(19),S=0;x.length>S;++S)F[31&x[S]]++;for(S=0;k.length>S;++S)F[31&k[S]]++;for(var P=Ei(F,7),D=P[0],j=P[1],H=19;H>4&&!D[On[H-1]];--H);var U,G,oe,Y,ae=u+5<<3,le=Vt(r,_t)+Vt(n,Gs)+o,Z=Vt(r,p)+Vt(n,m)+o+14+3*H+Vt(F,D)+(2*F[16]+3*F[17]+7*F[18]);if(le>=ae&&Z>=ae)return pr(t,c,e.subarray(l,l+u));if(ze(t,c,1+(le>Z)),c+=2,le>Z){U=ts(p,d),G=p,oe=ts(m,v),Y=m;var B=ts(D,j);for(ze(t,c,$-257),ze(t,c+5,M-1),ze(t,c+10,H-4),c+=14,S=0;H>S;++S)ze(t,c+3*S,D[On[S]]);c+=3*H;for(var se=[x,k],_e=0;2>_e;++_e){var he=se[_e];for(S=0;he.length>S;++S)ze(t,c,B[z=31&he[S]]),c+=D[z],z>15&&(ze(t,c,he[S]>>>5&127),c+=he[S]>>>12)}}else U=Tc,G=_t,oe=Ac,Y=Gs;for(S=0;a>S;++S)if(i[S]>255){var z;qt(t,c,U[257+(z=i[S]>>>18&31)]),c+=G[z+257],z>7&&(ze(t,c,i[S]>>>23&31),c+=Tr[z]);var me=31&i[S];qt(t,c,oe[me]),c+=Y[me],me>3&&(qt(t,c,i[S]>>>5&8191),c+=Ar[me])}else qt(t,c,U[i[S]]),c+=G[i[S]];return qt(t,c,U[256]),c+G[256]},Lc=new Lt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Dc=(function(){for(var e=new Lt(256),t=0;256>t;++t){for(var s=t,i=9;--i;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e})(),Si=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function Nc(e,t){t===void 0&&(t={});var s=(function(){var h=4294967295;return{p(p){for(var d=h,g=0;p.length>g;++g)d=Dc[255&d^p[g]]^d>>>8;h=d},d(){return 4294967295^h}}})(),i=e.length;s.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,(function(h,p,d,g,m,v){var _=h.length,x=new Oe(g+_+5*(1+Math.floor(_/7e3))+m),$=x.subarray(g,x.length-m),O=0;if(!p||8>_)for(var k=0;_>=k;k+=65535){var M=k+65535;_>M?O=pr($,O,h.subarray(k,M)):($[k]=v,O=pr($,O,h.subarray(k,_)))}else{for(var F=Lc[p-1],S=F>>>13,P=8191&F,D=(1<<d)-1,j=new Ee(32768),H=new Ee(D+1),U=Math.ceil(d/3),G=2*U,oe=function(si){return(h[si]^h[si+1]<<U^h[si+2]<<G)&D},Y=new Lt(25e3),ae=new Ee(288),le=new Ee(32),Z=0,B=0,se=(k=0,0),_e=0,he=0;_>k;++k){var z=oe(k),me=32767&k,Se=H[z];if(j[me]=Se,H[z]=me,k>=_e){var Ie=_-k;if((Z>7e3||se>24576)&&Ie>423){O=Rn(h,$,0,Y,ae,le,B,se,he,k-he,O),se=Z=B=0,he=k;for(var fe=0;286>fe;++fe)ae[fe]=0;for(fe=0;30>fe;++fe)le[fe]=0}var Me=2,at=0,bl=P,Xe=me-Se&32767;if(Ie>2&&z==oe(k-Xe))for(var wl=Math.min(S,Ie)-1,xl=Math.min(32767,k),$l=Math.min(258,Ie);xl>=Xe&&--bl&&me!=Se;){if(h[k+Me]==h[k+Me-Xe]){for(var Ye=0;$l>Ye&&h[k+Ye]==h[k+Ye-Xe];++Ye);if(Ye>Me){if(Me=Ye,at=Xe,Ye>wl)break;var kl=Math.min(Xe,Ye-2),Lr=0;for(fe=0;kl>fe;++fe){var ti=k-Xe+fe+32768&32767,Dr=ti-j[ti]+32768&32767;Dr>Lr&&(Lr=Dr,Se=ti)}}}Xe+=(me=Se)-(Se=j[me])+32768&32767}if(at){Y[se++]=268435456|hr[Me]<<18|In[at];var Nr=31&hr[Me],jr=31&In[at];B+=Tr[Nr]+Ar[jr],++ae[257+Nr],++le[jr],_e=k+Me,++Z}else Y[se++]=h[k],++ae[h[k]]}}O=Rn(h,$,v,Y,ae,le,B,se,he,k-he,O)}return el(x,0,g+Qa(O)+m)})(n=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!0)),c=u.length;return(function(h,p){var d=p.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>p.level?4:p.level==9?2:0,h[9]=3,p.mtime!=0&&Si(h,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),d){h[3]=8;for(var g=0;d.length>=g;++g)h[g+10]=d.charCodeAt(g)}})(u,t),Si(u,c-8,s.d()),Si(u,c-4,i),u}const jc=!!_r||!!ns,tl="text/plain";let Is=!1;const sl=(e,t)=>{const[s,i]=e.split("#"),[r,n]=s.split("?");if(!n)return e;const o=n.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${r}${o?`?${o}`:""}${i?`#${i}`:""}`},vs=(e,t,s=!0)=>{var i;const[r,n]=e.split("?"),o=f({},t),a=(i=n?.split("&").map(u=>{var c;const[h,p]=u.split("="),d=s&&(c=o[h])!==null&&c!==void 0?c:p;return delete o[h],`${h}=${d}`}))!==null&&i!==void 0?i:[],l=(function(u,c="&"){let h,p;const d=[];return V(u,function(g,m){b(g)||b(m)||m==="undefined"||(h=encodeURIComponent((v=>v instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(m),d[d.length]=p+"="+h)}),d.join(c)})(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},Pi=e=>{if(e.Xl)return e.Xl;const{data:t,compression:s}=e;if(!t)return;if(s===Pe.GZipJS){const r=Nc((function(n){var o=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var a=new Oe(n.length+(n.length>>>1)),l=0,u=function(d){a[l++]=d},c=0;o>c;++c){if(l+5>a.length){var h=new Oe(l+8+(o-c<<1));h.set(a),a=h}var p=n.charCodeAt(c);128>p?u(p):2048>p?(u(192|p>>>6),u(128|63&p)):p>55295&&57344>p?(u(240|(p=65536+(1047552&p)|1023&n.charCodeAt(++c))>>>18),u(128|p>>>12&63),u(128|p>>>6&63),u(128|63&p)):(u(224|p>>>12),u(128|p>>>6&63),u(128|63&p))}return el(a,0,l)})(Mt(t)),{mtime:0});return{contentType:tl,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(s===Pe.Base64){const r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Mt(t)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Mt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const i=Mt(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},il=e=>{const t=()=>e.transport==="sendBeacon"?{url:vs(e.url,{compression:Pe.Base64}),encodedBody:Pi(f(f({},e),{},{compression:Pe.Base64,Xl:void 0}))}:{url:sl(e.url,"compression"),encodedBody:Pi(f(f({},e),{},{compression:void 0,Xl:void 0}))};let s;try{s=Pi(e)}catch(r){if(tn(e.compression,Tt(e.url,"compression")))return E.error("Failed to gzip request body, sending uncompressed payload",r),t();throw r}return s&&tn(e.compression,Tt(e.url,"compression"))&&!((i=s.body)instanceof ArrayBuffer?Ui(new Uint8Array(i)):ArrayBuffer.isView(i)&&Ui(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Is=!0,t()):{url:e.url,encodedBody:s};var i},rl=e=>{try{return il(e)}catch(s){var t;return E.error(s),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:s}))}},Bc=(function(){var e=X(function*(t){const s=yield(function(r){return Gi.apply(this,arguments)})(Mt(t.data),ce.DEBUG,{rethrow:!0});if(!s)return t;const i=yield s.arrayBuffer();return f(f({},t),{},{Xl:{contentType:tl,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),Hc=/Failed to fetch|NetworkError|Load failed/i,nl=e=>e?.name==="TypeError"&&Hc.test(e?.message||""),ol=e=>{const t=rl(e);if(!t)return;const s=new _r,{url:i,encodedBody:r}=t;s.open(e.method||"GET",i,!0);const{contentType:n,body:o}=r??{};V(e.headers,function(a,l){s.setRequestHeader(l,a)}),n&&s.setRequestHeader("Content-Type",n),e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{if(s.readyState===4){var a;const l={statusCode:s.status,text:s.responseText};if(s.status===200)try{l.json=JSON.parse(s.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l)}},s.send(o)},al=e=>{const t=rl(e);if(!t)return;const{url:s,encodedBody:i}=t,{contentType:r,body:n,estimatedSize:o}=i??{},a=new Headers;V(e.headers,function(h,p){a.append(p,h)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(Br){const h=new Br;l={signal:h.signal,timeout:setTimeout(()=>{var p;u=!0,h.abort(Vo("AbortError","PostHog request timed out"+((p=e.timeout)?` after ${p}ms`:"")))},e.timeout)}}const c=h=>{var p;u&&h?.name==="AbortError"||nl(h)?E.warn(h):E.error(h),(p=e.callback)===null||p===void 0||p.call(e,{statusCode:0,error:h})};try{ns(s,f({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&!e.ta&&52428.8>(o||0),body:n,signal:l?.signal},e.fetchOptions)).then(h=>h.text().then(p=>{var d;const g={statusCode:h.status,text:p};if(h.status===200)try{g.json=JSON.parse(p)}catch(m){E.error(m)}(d=e.callback)===null||d===void 0||d.call(e,g)})).catch(c).finally(()=>l?clearTimeout(l.timeout):null)}catch(h){l&&clearTimeout(l.timeout),c(h)}},fr=e=>{try{var t;const{url:s,encodedBody:i}=il(e),{contentType:r,body:n,estimatedSize:o}=i??{};if(!n)return;const a=n instanceof Blob?n:new Blob([n],{type:r});if(de.sendBeacon(s,a))return;const l=C(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(C(l)&&l.length>1&&(o??0)>16384){const u=Math.ceil(l.length/2),c=h=>C(e.data)?h:f(f({},e.data),{},{batch:h});return fr(f(f({},e),{},{data:c(l.slice(0,u))})),void fr(f(f({},e),{},{data:c(l.slice(u))}))}E.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${ns?"fetch":"XHR"}`),ns?al(f(f({},e),{},{ta:!0})):ol(e)}catch(s){E.warn("Beacon send failed",s)}},Tn=(e,t,s,i)=>{const r=i==="query"?t==="POST"?"sent_at":"_":void 0;return vs(s===Pe.GZipJS?sl(e,"compression"):e,f(f({},r?{[r]:Date.now().toString()}:{}),s===Pe.GZipJS?{}:{compression:s}))},zc=(()=>{const e=[];return ns&&e.push({transport:"fetch",method:al}),_r&&e.push({transport:"XHR",method:ol}),de?.sendBeacon&&e.push({transport:"sendBeacon",method:fr}),e})();var qc=class{constructor(e,t){this.ea=!0,this.ia=[],this.na=Be(t?.flush_interval_ms||3e3,250,5e3,E.createLogger("flush interval"),3e3),this.sa=e}enqueue(e){this.ia.push(e),this.ra||this.oa()}unload(){this.la();const e=this.ia.length>0?this.aa():{},t=Object.values(e);[...t.filter(s=>s.url.indexOf("/e")===0),...t.filter(s=>s.url.indexOf("/e")!==0)].map(s=>{this.ua(f(f({},s),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const e=this.aa();for(const t in e)this.ua(e[t])}},this.na))}ua(e){try{this.sa(e)}catch(t){E.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const e={};return V(this.ia,t=>{var s;const i=t,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");b(e[r])&&(e[r]=f(f({},i),{},{data:[]})),(s=e[r].data)===null||s===void 0||s.push(i.data)}),this.ia=[],e}};const Vc=["retriesPerformedSoFar"];var Wc=class{constructor(e){this._instance=e,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!b(y)&&"onLine"in y.navigator){if(this.da=y.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},W(y,"online",this.va),W(y,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,s=Qo(e,Vc);Ve(t)&&(s.url=vs(s.url,{retry_count:t})),this._instance._send_request(f(f({},s),{},{callback:i=>{var r;if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(t??0))return void this.Ls(f({retriesPerformedSoFar:t},s));i.statusCode===0&&E.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${t??0} retries.`)}(r=s.callback)===null||r===void 0||r.call(s,i)}}))}Ls(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const s=(function(n){const o=3e3*Math.pow(2,n),a=o/2,l=Math.min(18e5,o),u=(Math.random()-.5)*(l-a);return Math.ceil(l+u)})(t),i=Date.now()+s;this.ia.push({retryAt:i,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),E.warn(r),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),this.ia.length===0)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const e=Date.now(),t=[],s=this.ia.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ia=t,s.length>0)for(const{requestOptions:i}of s)this.retriableRequest(i)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,b(y)||(this.va&&(y.removeEventListener("online",this.va),this.va=void 0),this.pa&&(y.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:e}of this.ia)try{this._instance._send_request(f(f({},e),{},{transport:"sendBeacon"}))}catch(t){E.error(t)}this.ia=[]}},Uc=class{constructor(e){this._instance=e,this.ya=()=>{var t,s,i,r;this.ba||(this.ba={});const n=this.scrollElement(),o=this.scrollY(),a=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=o+(n?.clientHeight||0),u=n?.scrollHeight||0;this.ba.lastScrollY=Math.ceil(o),this.ba.maxScrollY=Math.max(o,(t=this.ba.maxScrollY)!==null&&t!==void 0?t:0),this.ba.maxScrollHeight=Math.max(a,(s=this.ba.maxScrollHeight)!==null&&s!==void 0?s:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,(i=this.ba.maxContentY)!==null&&i!==void 0?i:0),this.ba.maxContentHeight=Math.max(u,(r=this.ba.maxContentHeight)!==null&&r!==void 0?r:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const e=this.ba;return this.ba=void 0,setTimeout(this.ya,0),e}startMeasuringScrollPosition(){W(y,"scroll",this.ya,{capture:!0}),W(y,"scrollend",this.ya,{capture:!0}),W(y,"resize",this.ya)}scrollElement(){if(this._a){const s=C(this._a)?this._a:[this._a];for(const i of s){var e;const r=y==null||(e=y.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var t;return y==null||(t=y.document)===null||t===void 0?void 0:t.documentElement}wa(e){var t,s;const i=e==="y"?"scrollTop":"scrollLeft";if(this._a){const r=this.scrollElement();return r&&r[i]||0}return y?e==="y"?y.scrollY||y.pageYOffset||((t=y.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:y.scrollX||y.pageXOffset||((s=y.document)===null||s===void 0||(s=s.documentElement)===null||s===void 0?void 0:s.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const Gc=e=>Ua(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes);var An=class{constructor(e,t,s,i){this.je=r=>{const n=this.ka();if(n&&n.sessionId===r)return;const o={sessionId:r,props:this.Sa(this._instance)};this.xa.register({[sr]:o})},this._instance=e,this.Ca=t,this.xa=s,this.Sa=i||Gc,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[sr]}getSetOnceProps(){var e;const t=(e=this.ka())===null||e===void 0?void 0:e.props;return t?"r"in t?Ga(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(){const e={};return V(Fr(this.getSetOnceProps()),(t,s)=>{s==="$current_url"&&(s="url"),e[`$session_entry_${Bi(s)}`]=t}),e}},Ks=class{on(e,t){return this.$a[e]||(this.$a[e]=[]),this.$a[e].push(t),()=>{this.$a[e]=this.$a[e].filter(s=>s!==t)}}emit(e,t){for(const s of this.$a[e]||[])s(t);for(const s of this.$a["*"]||[])s(e,t)}constructor(){this.$a={}}};const xt=ne("[SessionId]"),Ln=864e5;var Dn=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,s){var i;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Ks,this.Aa=(n,o)=>!(!Ve(n)||!Ve(o))&&Math.abs(n-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.xa=e.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=t||Le,this.Da=s||Le;const r=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Be(this.Mr.session_idle_timeout_seconds||1800,60,36e3,xt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+r+"_window_id",this.qa="ph_"+r+"_primary_window_exists",this.ja()){const n=K.Dt(this.Na),o=K.Dt(this.qa);n&&!o?this.Be=n:K.Lt(this.Na),K.At(this.qa,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return b(this.Ea)&&(this.Ea=[]),this.Ea.push(e),this.Xt&&e(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(t=>t!==e)}}ja(){return this.Mr.persistence!=="memory"&&!this.xa.pi&&K.Et()}Ha(e){e!==this.Be&&(this.Be=e,this.ja()&&K.At(this.Na,e))}za(){return this.Be?this.Be:this.ja()?K.Dt(this.Na):null}Ua(e){const t=this.Ia;return!ie(t)&&!ie(e)&&5e3>Math.abs(e-t)}Wa(e,t,s){const i=t!==this._sessionActivityTimestamp,r=!(e!==this.Xt||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Xt=e,r&&!i||r&&this.Ua(t)||(this.Ia=t,this.xa.register({[Et]:[t,e,s]}))}Va(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Ve(t)&&t>0}Ga(){this.Va()?this.xa.refreshKey(Et):(this.xa.flush(),this.xa.load())}Za(){var e;if(ie(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,t,s]=this.Qa();t===this.Xt&&s===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[Et]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[e]=this.Qa(),t=Ve(e)?e:0,s=Ve(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Ka(e){return this.Ga(),this.Aa(e,this.Ja())}Qa(){const e=this.xa.props[Et];return C(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Ya),this.Ya=void 0,this.Wa(null,null,null)}setBootstrapSessionId(e,t=!1){const s=((i,r=new Date().getTime())=>{try{const n=(o=>{const a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(i);return n>r+6e4?void xt.error("Bootstrap sessionID cannot be in the future"):n}catch(n){return void xt.error("Invalid sessionID in bootstrap",n)}})(e);return!b(s)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:s}:this.Wa(e,new Date().getTime(),s),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Ya),this.Ya=void 0,this.Pa&&y&&(y.removeEventListener(qs,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&K.Lt(this.qa)},W(y,qs,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,s=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=t||new Date().getTime(),r=this.Xt;if(s)this.Ma=i;else if(ie(this.Ma)||this.Ma>i||i-this.Ma>=1e3){var n,o;(n=(o=this.xa).syncCookieProperties)===null||n===void 0||n.call(o),this.Ma=i}let[,a,l]=this.Qa();const u=!b(r)&&a!==r,c=this.Ja();let h=this.za();const p=this.Fa,d=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>Ln),g=p?d:Ve(l)&&Math.abs(i-l)>Ln;let m=!1,v=u;const _=!a||!!p,x=a;let $=!_&&!e&&this.Aa(i,c);if($&&($=this.Ka(i),$||xt.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Qa()),_||$||g){v=!1;const F=p&&!d;a=F?p.sessionId:this.Oa(),h=this.Da(),xt.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!F,changeReason:{noSessionId:_,activityTimeout:$,sessionPastMaximumLength:g}}),l=F?p.sessionStartTimestamp:i,this.Fa=void 0,m=!0}else h||(h=this.Da(),m=!0),v=v||a!==x,v&&(xt.info("adopted cross-tab session id",{sessionId:a,windowId:h}),m=!0);const O=Ve(c)&&e&&!g?c:i,k=Ve(l)?l:new Date().getTime();this.Ha(h),this.Wa(a,O,k),e||this.La();const M={noSessionId:_,activityTimeout:$,sessionPastMaximumLength:g,crossTabAdoption:v};return m&&this.Ea.forEach(F=>F(a,h,M)),{sessionId:a,windowId:h,sessionStartTimestamp:k,changeReason:m?M:void 0,lastActivityTimestamp:c}}La(){this.Ra||(clearTimeout(this.Ya),this.Ya=setTimeout(()=>{if(!this.Ra)if(this.Ka(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:e})}else this.La()},1.1*this.sessionTimeoutMs))}};const ll=function(e,t){if(!e)return!1;const s=e.userAgent;if(s&&zr(s,t))return!0;try{const i=e?.userAgentData;if(i?.brands&&i.brands.some(r=>zr(r?.brand,t)))return!0}catch{}return!!e.webdriver};function ul(){return(ul=X(function*(){const e=de?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),s=t?.model;return L(s)&&s.length>0?s:void 0}catch(t){return void E.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Kc(e,t){let s=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(s=`$survey_${t}/${e.id}/${e.current_iteration}`),s}function cl(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}const Js=(e,t)=>{if(!(s=>{try{new RegExp(s)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},$s=e=>e.toLowerCase(),hl={exact:(e,t)=>t.some(s=>e.some(i=>s===i)),is_not:(e,t)=>t.every(s=>e.every(i=>s!==i)),regex:(e,t)=>t.some(s=>e.some(i=>Js(s,i))),not_regex:(e,t)=>t.every(s=>e.every(i=>!Js(s,i))),icontains:(e,t)=>t.map($s).some(s=>e.map($s).some(i=>s.includes(i))),not_icontains:(e,t)=>t.map($s).every(s=>e.map($s).every(i=>!s.includes(i))),gt:(e,t)=>t.some(s=>{const i=parseFloat(s);return!isNaN(i)&&e.some(r=>i>parseFloat(r))}),lt:(e,t)=>t.some(s=>{const i=parseFloat(s);return!isNaN(i)&&e.some(r=>i<parseFloat(r))})};function dl(e,t){return!e||Object.entries(e).every(([s,i])=>{const r=t?.[s];if(r==null)return!1;const n=hl[i.operator];return!!n&&n(i.values,[String(r)])})}function Mi(e,t,s){return Mt({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:s})}const vr="custom",Nn="i.posthog.com",Jc=/^\/static\//,Xc=["/s/","/e/","/i/"];var Yc=class{constructor(e){this.Xa={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${Nn}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Xa[this.apiHost]||(this.Xa[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":vr),this.Xa[this.apiHost]}tu(e){if(!Jc.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}eu(e){const t=Rt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}iu(e,t,s){if(e==="ui")return s;let i=s;const r=this.instance.config.rewriteRequestPath;if(r){var n;const o=((n=Rt(s))===null||n===void 0?void 0:n.href)||s;i=r(new URL(o)).toString()}if(r&&e==="api"&&Xc.some(o=>t.indexOf(o)===0)){const o=this.eu(i);if(o){const a=this.apiHost;let l=this.nu;l?.apiHost===a&&l.rewriteRequestPath===r||(l={apiHost:a,rewriteRequestPath:r,urls:new Set},this.nu=l),l.urls.add(o)}}return i}isIngestionEndpoint(e){const t=this.nu,s=this.eu(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!s&&t.urls.has(s)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.iu(e,t,this.uiHost+t);if(e==="flags")return this.iu(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.tu(t);if(i)return this.iu(e,t,`${i}${t}`)}if(this.region===vr)return this.iu(e,t,this.apiHost+t);const s=Nn+t;switch(e){case"assets":return this.iu(e,t,`https://${this.region}-assets.${s}`);case"api":return this.iu(e,t,`https://${this.region}.${s}`)}}};const q=ne("[Surveys]"),pl=e=>{try{const t=(s=>((i,r)=>`seenSurvey_${(function(n){return n.current_iteration&&n.current_iteration>0?`${n.id}_${n.current_iteration}`:n.id})(r)}`)(0,s))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){q.error("Failed to persist survey seen state",t)}},Zc=[$i.Popover,$i.Widget,$i.API],Qc={ignoreConditions:!1,ignoreDelay:!1,displayType:cr.Popover},eh=ne("[PostHog ExternalIntegrations]"),th={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var sh=class{constructor(e){this._instance=e}No(e,t){var s,i;(s=I.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,e,r=>{if(r)return eh.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e;for(const[r,n]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,s,i;n&&!(!((t=I.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[r])&&this.No(th[r],()=>{var o;(o=I.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[r])===null||o===void 0||o.start(this._instance)}),!n&&(!((s=I.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0)&&s[r])&&((i=I.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},ih=class{constructor(e,t){this.$=e,this.po=t,this.su=new Map,this.So=!1}add(e){var t=this;return X(function*(){if(t.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.su.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.su.set(e.name,e);try{const s=e.setup(t.po);s&&(yield s)}catch(s){const i=t.su.get(e.name)===e;i&&t.su.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,s),i&&t.ru(e)}})()}getExtension(e){return this.su.get(e)}dispose(){if(this.So)return;this.So=!0;const e=Array.from(this.su.values()).reverse();this.su.clear();for(const t of e)this.ru(t)}ru(e){try{var t;const s=(t=e.dispose)===null||t===void 0?void 0:t.call(e);s&&ve(s.then)&&s.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(s){this.$.error(`Failed to dispose browser extension "${e.name}"`,s)}}},rh=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);const s={};for(const i of e){const r=t?.get_property(i);b(r)||(s[i]=r)}return s}set(e,t){var s;(s=this._instance.persistence)===null||s===void 0||s.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}};const jn="extensionsRemoteConfig";var nh=class{constructor(e){this.instance=e,this.So=!1,this.$=E,this.ou=e.lu,this.kv=new rh(e),this.onEvent=t=>xs(this.instance.on("eventCaptured",s=>{try{t({event:s.event,properties:s.properties})}catch(i){this.$.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=t=>{if(this.So)return xs(()=>{});const s=r=>{try{t(r)}catch(n){this.$.error("Browser extension remote config listener failed",n)}},i=this.instance.au.on(jn,s);return this.ou&&s(this.ou),xs(i)},this.uu=new ih(E.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property($r);return typeof e=="string"?e:void 0}get library(){return{name:ce.LIB_NAME,version:ce.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,s,i;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=r?.sessionId)!==null&&t!==void 0?t:"",windowId:(s=r?.windowId)!==null&&s!==void 0?s:"",sessionStartTimestamp:(i=r?.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.uu.add(e)}getExtension(e){return this.uu.getExtension(e)}capture(e,t,s){var i=this;return X(function*(){s?i.instance.capture(e,t,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):i.instance.capture(e,t)})()}registerDynamicEventProperties(e){return xs(this.instance.hu(e))}handleRemoteConfig(e){this.So||(this.ou=e,this.instance.au.emit(jn,e))}sendRequest(e){var t=this;return X(function*(s,i={}){var r;const n=t.instance.requestRouter.endpointFor((r=i.target)!==null&&r!==void 0?r:"api",s),o={method:i.method,url:i.query?vs(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?ji.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const ss={};let Fi=0;const is=()=>{},Bn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Wt="Surveys module not available",Hn="sanitize_properties is deprecated. Use before_send instead",fl="Invalid value for property_denylist config: ",oh=/^[A-Za-z0-9_-]{1,400}$/,Oi=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,ah=["token","distinct_id",wa],Kt="posthog";let vl=!jc&&we?.indexOf("MSIE")===-1&&we?.indexOf("Mozilla")===-1;const lh=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Ii=e=>{var t;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ac(w?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:is,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ee&&L(ee?.search)&&ee.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(y==null||(t=y.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(s){E.error("Bad HTTP status: "+s.statusCode+" "+s.text)},get_device_id:s=>s,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Ea,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:is},(s=>({rageclick:s&&s>="2026-05-30"?{content_ignorelist:vc,ignore_text_selection:!0}:!s||"2025-11-30">s||{content_ignorelist:!0},capture_pageview:!s||"2025-05-24">s||"history_change",session_recording:lh(s),external_scripts_inject_target:s&&s>="2026-01-30"?"head":"body",internal_or_test_user_hostname:s&&s>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:s&&s>="2026-05-30"?250:0,split_storage:!(!s||"2026-05-30">s),detect_google_search_app:!(!s||"2026-05-30">s),disable_capture_url_hashes:!(!s||"2026-06-25">s),cookieWinsOnConflict:!(!s||s==="unset"||"2026-08-29">s)}))(e))},uh=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],zn=e=>{const t={};for(const[r,n]of uh)b(e[r])||(t[n]=e[r]);const s=J({},t,e),i=e.__preview_external_dependency_versioned_paths;return b(i)||(b(e.strict_script_versioning)&&(s.strict_script_versioning=!!i),L(i)&&b(e.asset_host)&&(s.asset_host=i)),C(e.property_blacklist)&&(b(e.property_denylist)?s.property_denylist=e.property_blacklist:C(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:E.error(fl+e.property_denylist)),s};var ch=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(e){E.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},rs=class et{du(t){if(!t)return;const s=this.su.indexOf(t);s!==-1&&this.su.splice(s,1)}vu(t,s){var i;return this.du(t),this.su.push(s),(i=s.initialize)===null||i===void 0||i.call(s),s}fu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}pu(){if(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.mu)return;let s,i,r;t?(s=`persistence is set to '${this.config.persistence}'`,i=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(s="persistence is disabled (disable_persistence is true)",i="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",`${s} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${r}`)}yu(){if(this.fu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const s=this.get_distinct_id();if(!s||s==="$posthog_cookieless"){const i=this.config.get_device_id(Le());this.register({distinct_id:i,$device_id:i}),t.set_property(xe,Ge)}this._u()}get decideEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)===null||s===void 0?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)===null||s===void 0?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new ch,this.Su=!1,this.version=ce.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Ks,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ii(),this.SentryIntegration=$c,this.sentryIntegration=i=>(function(r,n){const o=Na(r,n);return{name:Da,processEvent:a=>o(a)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Uc(this),this.pageViewManager=new Sn(this),this.rateLimiter=new Rc(this),this.requestRouter=new Yc(this),this.consent=new fc(this),this.externalIntegrations=new sh(this);const s=(t=et.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(i,r,n)=>{const o=L(i)?{[i]:r}:i;this.setPersonProperties(o),n?.({})},set_once:(i,r,n)=>{const o=L(i)?{[i]:r}:i;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",i=>E.info(`send "${i?.event}"`,i))}init(t,s,i){if(i&&i!==Kt){var r;const n=(r=ss[i])!==null&&r!==void 0?r:new et;return n._init(t,s,i),ss[i]=n,ss[Kt][i]=n,n}return this._init(t,s,i)}_init(t,s={},i){var r,n,o;const a=L(t)?t.trim():"";if(!a)return E.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ii(s.defaults),s.debug=this.Pu(s.debug),this.Ru=s,this.Au=[],s.person_profiles?this.Mu=s.person_profiles:s.process_person&&(this.Mu=s.process_person);const u=Ii(s.defaults),c=zn(s),h=J({},u,c,{name:i,token:a});A(u.rageclick)&&A(c.rageclick)&&(h.rageclick=J({},u.rageclick,c.rageclick)),A(u.session_recording)&&A(c.session_recording)&&(h.session_recording=J({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&E.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:Pe.GZipJS;const p=this.bu();if(this.persistence=new xi(this.config,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xi(f(f({},this.config),{},{persistence:"sessionStorage"}),p,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!p&&K.Et()){const _=K.Dt(this.Cu);C(_)&&_.forEach(x=>{L(x)&&this.xu.add(x)})}else K.Lt(this.Cu);const d=f({},this.persistence.props),g=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Fu=new qc(_=>this.Ou(_),this.config.request_queue_config),this.Du=new Wc(this),this.__request_queue=[];const m=this.fu();m||(this.sessionManager=new Dn(this),this.sessionPropsManager=new An(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,x,$)=>{($?.activityTimeout||$?.sessionPastMaximumLength||$?.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(E.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(m)},0)):(E.info("Initializing extensions synchronously"),this.qu(m)),ce.DEBUG=ce.DEBUG||this.config.debug,ce.DEBUG&&E.info("Starting in debug mode",{this:this,config:s,thisC:f({},this.config),p:d,s:g}),this.config.identity_distinct_id&&!(!((r=s.bootstrap)===null||r===void 0)&&r.distinctID)&&(s.bootstrap=f(f({},s.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=(n=s.bootstrap)===null||n===void 0?void 0:n.distinctID;if(this.mu=!!v&&!Jt(v),(o=s.bootstrap)===null||o===void 0?void 0:o.distinctID){const _=s.bootstrap.distinctID,x=this.get_distinct_id(),$=this.persistence.get_property(xe);if(s.bootstrap.isIdentifiedID&&x!=null&&x!==_&&$==="anonymous")this.identify(_);else if(s.bootstrap.isIdentifiedID&&x!=null&&x!==_&&$==="identified")E.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{const O=this.config.get_device_id(Le()),k=s.bootstrap.isIdentifiedID?O:_;this.persistence.set_property(xe,s.bootstrap.isIdentifiedID?Fs:Ge),this.register({distinct_id:_,$device_id:k})}}if(m)this.register_once({distinct_id:fi,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(Le());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(xe,Ge)}return W(y,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),W(y,"pageshow",()=>{var _;this.wu=!1,this.ku||(_=this.Du)===null||_===void 0||_.resume()}),s.segment?En(this,()=>this.ju()):this.ju(),ve(this.config._onCapture)&&this.config._onCapture!==is&&(E.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&E.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 ul.apply(this,arguments)})().then(_=>{_&&this.register({[pi]:_})}).catch(is),this}Bu(t){const s=t;return L(s.name)&&ve(s.setup)}Hu(t,s){this.Bu(t)?s.push(()=>{this.zu().add(t).catch(()=>{var i;return(i=t.dispose)===null||i===void 0?void 0:i.call(t)}).catch(i=>{E.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.su.push(t)}Nu(){var t,s,i;const r=(t=(s=this.config.__extensionClasses)===null||s===void 0?void 0:s.featureFlags)!==null&&t!==void 0?t:(i=et.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var n,o,a;r&&(this.featureFlags&&this.featureFlags instanceof r||((n=this.Uu)===null||n===void 0||n.call(this),this.Uu=void 0,this.featureFlags=new r(this)),ve(this.featureFlags.onReloading)&&ve(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}qu(t){const s=performance.now(),i=f(f({},et.__defaultExtensionClasses),this.config.__extensionClasses),r=[];var n,o,a,l,u,c,h;i.exceptions&&this.su.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new i.exceptions(this)),i.historyAutocapture&&this.su.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.su.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.su.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.su.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Hu(this.autocapture=new i.autocapture(this),r),i.surveys&&this.Hu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new i.surveys(this),r),i.logs&&this.Hu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new i.logs(this),r),i.metrics&&this.su.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new i.metrics(this)),i.conversations&&this.su.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new i.conversations(this)),i.productTours&&this.su.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.su.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.su.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,xc)),i.toolbar&&this.su.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new i.toolbar(this)),i.experiments&&this.su.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new i.experiments(this)),this.su.forEach(p=>{p.initialize&&r.push(()=>{var d;(d=p.initialize)===null||d===void 0||d.call(p)})}),r.push(()=>{if(this.Wu){const p=this.Wu;this.Wu=void 0,this.su.forEach(d=>{var g;return(g=d.onRemoteConfig)===null||g===void 0?void 0:g.call(d,p)})}}),this.Vu(r,s)}Vu(t,s){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-s>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,s)},0);const r=t.shift();if(r)try{r()}catch(n){E.error("Error initializing extension:",n)}}const i=Math.round(performance.now()-s);this.register_for_session({[xa]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[$a]:i}),this.config.__preview_deferred_init_extensions&&E.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var s;if(!w||!w.body)return E.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=R(r.supportedCompression,Pe.GZipJS)?Pe.GZipJS:R(r.supportedCompression,Pe.Base64)?Pe.Base64:void 0),!((i=r.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Ea}),(s=this.Gu)===null||s===void 0||s.handleRemoteConfig(t),this.su.forEach(r=>{var n;return(n=r.onRemoteConfig)===null||n===void 0?void 0:n.call(r,t)})}ju(){try{this.config.loaded(this)}catch(t){E.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&ee?.hostname){const t=ee.hostname,s=this.config.internal_or_test_user_hostname;(typeof s=="string"?t===s:s.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new Ja(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Fu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Pt(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,s,i,r,n,o;this.wu=!0,(t=this.surveys)===null||t===void 0||(s=t.handlePageUnload)===null||s===void 0||s.call(t),(i=this.metrics)===null||i===void 0||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(un),(r=this.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=this.Fu)===null||n===void 0||n.unload(),(o=this.Du)===null||o===void 0||o.unload()):this.Ku()&&this.capture(un,null,{transport:"sendBeacon"})}_send_request(t){var s,i,r;this.__loaded?vl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((i=t.callback)===null||i===void 0||i.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=f(f({},this.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=this.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(b(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var o,a,l;const u=f({},n);u.timeout=u.timeout||6e4;const c=(o=u.transport)!==null&&o!==void 0?o:"fetch";c==="sendBeacon"&&b(u.compression)&&u.data&&(u.compression=Pe.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data=(g=>{var m,v;const _=(C(g)?g:[g]).map($=>f(f({},$),$.timestamp instanceof Date&&!isNaN($.timestamp.getTime())?{timestamp:$.timestamp.toISOString()}:{})),x=_[0];return{api_key:(m=x==null||(v=x.properties)===null||v===void 0?void 0:v.token)!==null&&m!==void 0?m:x?.token,batch:_,sent_at:new Date().toISOString()}})(u.data):u.timestampMode==="body"&&(u.data=((g,m=new Date().toISOString())=>C(g)?g.map(v=>f(f({},v),{},{sent_at:m})):f(f({},g),{},{sent_at:m}))(u.data))),u.url=Tn(u.url,u.method,u.compression,u.timestampMode);const h=zc.filter(g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport)),p=(a=(l=(function(g,m){for(let v=0;g.length>v;v++)if(m(g[v]))return g[v]})(h,g=>g.transport===c))===null||l===void 0?void 0:l.method)!==null&&a!==void 0?a:h[0].method;if(!p)throw new Error("No available transport method");const d=g=>{try{p(g)}catch(v){var m;nl(v)?E.warn(v):E.error(v),(m=u.callback)===null||m===void 0||m.call(u,{statusCode:0,error:v})}};c!=="sendBeacon"&&u.data&&u.compression===Pe.GZipJS&&El&&typeof Promise<"u"&&!Is?Bc(u).then(g=>{d(g)}).catch(g=>{if(sn(g))return Is=!0,void d(f(f({},u),{},{compression:void 0,url:Tn(n.url,n.method,void 0,n.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;const v="name"in m?String(m.name):"";return sn(m)||v===Yo})(g)&&(Is=!0),d(u)}):p(u)})(f(f({},t),{},{callback:n=>{var o,a,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(a=(l=this.config).on_request_error)===null||a===void 0||a.call(l,n),(o=t.callback)===null||o===void 0||o.call(t,n)}}))):t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){Fi++;try{let s;const i=[],r=[],n=[];Pt(t,a=>{if(a)if(s=a[0],C(s))n.push(a);else if(ve(a))try{a.call(this)}catch(l){E.error("Error executing queued PostHog call",a,l)}else C(a)&&s==="alias"?i.push(a):C(a)&&s.indexOf("capture")!==-1&&ve(this[s])?n.push(a):r.push(a)});const o=function(a,l){Pt(a,function(u){try{if(C(u[0])){let c=l;V(u,function(h){c=c[h[0]].apply(c,h.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(c){E.error("Error executing queued PostHog call",u,c)}})};o(i,this),o(r,this),o(n,this)}finally{Fi--}}push(t){if(Fi>0&&C(t)&&L(t[0])){const s=et.prototype[t[0]];return void(ve(s)&&s.apply(this,t.slice(1)))}this._execute_array([t])}Yu(){var t;const s=(t=this.persistence)===null||t===void 0?void 0:t.get_property(Te);return L(s)&&Oi.test(s)?{value:s,delivered:!1}:A(s)&&L(s.value)&&Oi.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}Xu(t,s,i,r){if(!this.persistence)return;this.persistence.refreshKey(Te);const n=this.Yu();if(!r){if(i)return L(s)&&Oi.test(s)?(s!==n?.value&&this.persistence.register({[Te]:{value:s,delivered:!1}}),{value:s,pending:s!==n?.value||!n.delivered}):void this.persistence.unregister(Te);if(L(t)&&oh.test(t)){if(n?.value.split(".")[3]===t)return{value:n.value,pending:!n.delivered};const o=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[Te]:{value:o,delivered:!1}}),{value:o,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(Te)}th(t){if(!this.persistence)return;this.persistence.refreshKey(Te);const s=this.Yu();s?.value!==t||s.delivered||this.persistence.register({[Te]:{value:t,delivered:!0}})}capture(t,s,i){var r,n,o,a,l,u;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void E.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(b(t)||!L(t))return void E.error("No event name provided to posthog.capture");this.yu();const c=!this.config.opt_out_useragent_filter&&this._is_bot();if(c&&!this.config.__preview_capture_bot_pageviews)return;const h=i?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h?.isRateLimited)return void E.critical("This capture call is ignored due to client rate limiting.");let p;s?.$current_url&&!L(s?.$current_url)&&(E.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),s==null||delete s.$current_url),t!=="$exception"||i?.eh||E.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&&(p=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();const d=new Date,g=i?.timestamp||d,m=Ur(i?.uuid,Le);let v={uuid:m,event:t,properties:this.calculateEventProperties(t,s||{},g,m)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&c&&(v.event="$bot_pageview",v.properties.$browser_type="bot"),h&&(v.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const _=t==="$feature_flag_called"&&v.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i?.$set&&!_&&(v.$set=i?.$set);const x=A(s?.$set)?s.$set:void 0,$=!!i?.$set&&"$fbc"in i.$set,O=$||!!x&&"$fbc"in x,k=$?i==null||(r=i.$set)===null||r===void 0?void 0:r[ms]:x?.[ms],M=C(s?.$unset)?s.$unset:[],F=i?.$unset||[],S=M.indexOf("$fbc")!==-1||F.indexOf("$fbc")!==-1,P=this.Xu(p?.fbclid,k,O,S);P&&v.properties.$process_person_profile===!0&&P.pending&&!O&&!_&&(v.$set=f({[ms]:P.value},v.$set));const D=i?.$unset;D&&(v.$unset=D);const j=_?void 0:this.ih(i?.$set_once,t!==cn,t===ir);if(j&&(v.$set_once=j),i?._noTruncate||(H=this.config.properties_string_max_length,v=(function(B,se){const _e=new Set;return(function he(z,me){if(z!==Object(z))return se?se(z):z;if(_e.has(z))return;let Se;if(_e.add(z),C(z))Se=[],Pt(z,Ie=>{Se.push(he(Ie))});else{const Ie={};V(ps(z)?Sa(z):z,(fe,Me)=>{_e.has(fe)||(Ie[Me]=he(fe))}),Se=Ie}return Se})(B)})(v,B=>L(B)?B.slice(0,H):B)),v.timestamp=g,b(i?.timestamp)||(v.properties.$event_time_override_provided=!0,v.properties.$event_time_override_system_time=d),_&&(v.properties=((B,se=[])=>{const _e={},he=z=>{B[z]!==void 0&&(_e[z]=B[z])};return bu.forEach(he),se.forEach(he),_e})(v.properties,ah)),t===Ke.DISMISSED||t===Ke.SENT){const B=s?.[ki.SURVEY_ID],se=s?.[ki.SURVEY_ITERATION];pl({id:B,current_iteration:se}),v.$set=f(f({},v.$set),{},{[Kc({id:B,current_iteration:se},t===Ke.SENT?"responded":"dismissed")]:!0})}else t===Ke.SHOWN&&(v.$set=f(f({},v.$set),{},{[ki.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var H;if(t===Cc.SHOWN){const B=s?.[Mn.TOUR_TYPE];B&&(v.$set=f(f({},v.$set),{},{[`${Mn.TOUR_LAST_SEEN_DATE}/${B}`]:new Date().toISOString()}))}const U=f(f({},v.properties.$set),v.$set);if(ke(U)||this.setPersonPropertiesForFlags(U),!T(this.config.before_send)){const B=this.Os(v);if(!B)return;v=B,v.uuid=Ur(v.uuid,Le)}const G=(n=(o=v.$set)===null||o===void 0?void 0:o.$fbc)!==null&&n!==void 0?n:A((a=v.properties)===null||a===void 0?void 0:a.$set)?v.properties.$set[ms]:void 0,oe=P?.pending&&G===P.value?P.value:void 0;this.au.emit("eventCaptured",v);const Y=(l=i?._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),ae=i?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Y),le=f(f(f({method:"POST",url:Y,data:v,compression:"best-available",timestampMode:ae?"body":"capture-body",batchKey:i?._batchKey},ae&&(!((u=v.properties)===null||u===void 0)&&u.$session_id)?{batchGroup:v.properties.$session_id}:{}),i?.transport?{transport:i.transport}:{}),oe?{fireCallbackOnDrop:!0,callback:B=>{B.statusCode>=200&&300>B.statusCode&&this.th(oe)}}:{});var Z;return!this.config.request_batching||i&&!i?._batchKey||i?.send_instantly||oe?(!le.transport&&!le.callback&&ke((Z=this.config.request_headers)!==null&&Z!==void 0?Z:{})&&this.wu&&(le.transport="sendBeacon"),this.Ou(le)):this.Fu.enqueue(le),v}_addCaptureHook(t){return this.on("eventCaptured",s=>t(s.event,s))}getExtension(t){var s;return(s=this.Gu)===null||s===void 0?void 0:s.getExtension(t)}zu(){var t;return(t=this.Gu)!==null&&t!==void 0?t:this.Gu=new nh(this)}hu(t){this.$u.push(t);let s=!0;return()=>{if(!s)return;s=!1;const i=this.$u.indexOf(t);i!==-1&&this.$u.splice(i,1)}}nh(t=!0){var s,i,r;return!!(!((s=this.persistence)===null||s===void 0)&&s.consumeCookieIdentityChange())&&(this.Eu=null,this.persistence.get_property("$user_state")==="anonymous"&&((r=this.sessionPersistence)===null||r===void 0||r.clear(),this.xu.clear(),this.sh()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,s,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return s;this.persistence.syncCookieProperties(),this.nh();const o=n?void 0:this.persistence.remove_event_timer(t);let a=f({},s);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.fu()&&(a[wa]=!0),t==="$snapshot"){const x=f(f({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=x.distinct_id,(!L(a.distinct_id)&&!re(a.distinct_id)||Jt(a.distinct_id))&&E.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const l=(function(x,$,O,k=!1){var M,F,S,P;if(!we)return{};const D=x?[...At,...$||[]]:[],[j,H]=Ho(we),[U,G]=(function(z){for(let me=0;Wr.length>me;me++){const[Se,Ie,fe]=Wr[me],Me=z.match(Se);if(Me){const at=fe&&z.match(fe)||Me;return[Ie,at?.[1]||""]}}return["",""]})(we),oe=(function(){const z="u">typeof navigator?navigator:void 0;return z?.brave?{brave:!0}:{}})(),Y={};b(O)||(Y.detectGoogleSearchApp=O);const ae={},le=(M=navigator)===null||M===void 0||(M=M.userAgentData)===null||M===void 0?void 0:M.platform,Z=(F=navigator)===null||F===void 0?void 0:F.maxTouchPoints,B=y==null||(S=y.screen)===null||S===void 0?void 0:S.width,se=y==null||(P=y.screen)===null||P===void 0?void 0:P.height,_e=y?.devicePixelRatio;b(le)||(ae.userAgentDataPlatform=le),b(Z)||(ae.maxTouchPoints=Z),b(B)||(ae.screenWidth=B),b(se)||(ae.screenHeight=se),b(_e)||(ae.devicePixelRatio=_e);const he=J(Fr({$os:j,$os_version:H,$browser:Bo(we,navigator.vendor,oe,Y),$webview_app:U,$webview_app_version:G,$device:zo(we),$device_type:zl(we,ae),$timezone:Ka(),$timezone_offset:Fc()}),{$current_url:hs(k?ot(ee?.href):ee?.href,D,ds),$host:ee?.host,$pathname:ee?.pathname,$raw_user_agent:we.length>1e3?we.substring(0,997)+"...":we,$browser_version:Hl(we,navigator.vendor,oe,Y),$browser_language:Va(),$browser_language_prefix:Mc(),$screen_height:y?.screen.height,$screen_width:y?.screen.width,$viewport_height:y?.innerHeight,$viewport_width:y?.innerWidth,$lib:Je.LIB_NAME,$lib_version:Je.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Je.SDK_DIST_CHANNEL&&(he.$sdk_dist_channel=Je.SDK_DIST_CHANNEL),he})(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){const{sessionId:x,windowId:$}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime(),!0);a.$session_id=x,a.$window_id=$}this.sessionPropsManager&&J(a,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&J(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(u=this.Du)===null||u===void 0?void 0:u.length}catch(x){a.$sdk_debug_error_capturing_properties=String(x)}let c;if(this.requestRouter.region===vr&&(a.$lib_custom_api_host=this.config.api_host),c=t!=="$pageview"||n?t!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=J(a,c),t==="$pageview"&&w&&(a.title=w.title),!b(o)){const x=i.getTime()-o;a.$duration=parseFloat((x/1e3).toFixed(3))}we&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const h=this.persistence.properties(),p=this.sessionPersistence.properties(),d=a.$groups,g=h.$groups;A(d)&&!ke(d)&&(a.$groups=f(f({},A(g)?g:{}),d)),V(["$referrer","$referring_domain"],x=>{x in h&&delete p[x]});const m={};if(this.$u.length>0)for(const x of this.$u.slice())try{J(m,x())}catch($){E.error("Failed to produce browser extension event properties",$)}a=J({},l,h,p,f(f({},m),a)),a.$is_identified=this._isIdentified(),C(this.config.property_denylist)?V(this.config.property_denylist,function(x){delete a[x]}):E.error(fl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const v=this.config.sanitize_properties;v&&(E.error(Hn),a=v(a,t));const _=this.rh();return a.$process_person_profile=_,_&&!n&&this.oh("_calculate_event_properties"),a}ih(t,s=!0,i=!1){var r;if(!this.persistence||!this.rh()||this.Su&&!i)return t;const n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)===null||r===void 0?void 0:r.getSetOnceProps();let a=J({},n,o||{},t||{});const l=this.config.sanitize_properties;return l&&(E.error(Hn),a=l(a,"$set_once")),s&&(this.Su=!0),ke(a)?void 0:a}register(t,s){var i;(i=this.persistence)===null||i===void 0||i.register(t,s)}register_once(t,s,i){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,s,i)}register_for_session(t){var s,i;(s=this.persistence)===null||s===void 0||s.syncCookieProperties(),this.nh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(r=>this.xu.add(r)),this.sh()}unregister(t){var s;(s=this.persistence)===null||s===void 0||s.unregister(t)}unregister_for_session(t){var s;(s=this.sessionPersistence)===null||s===void 0||s.unregister(t),this.xu.delete(t),this.sh()}ah(t,s){this.register({[t]:s})}Lu(){this.xu.forEach(t=>{var s;(s=this.sessionPersistence)===null||s===void 0||s.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.pi||!K.Et())return void K.Lt(this.Cu);const s=[];this.xu.forEach(i=>s.push(i)),s.length>0?K.At(this.Cu,s):K.Lt(this.Cu)}getFeatureFlag(t,s){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlag(t,s)}getFeatureFlagPayload(t){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagPayload(t)}getFeatureFlagResult(t,s){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagResult(t,s)}getAllFeatureFlags(){var t,s;return(t=(s=this.featureFlags)===null||s===void 0?void 0:s.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,s){var i,r;return(i=(r=this.featureFlags)===null||r===void 0?void 0:r.isFeatureEnabled(t,s))!==null&&i!==void 0?i:s?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,s,i){var r;(r=this.featureFlags)===null||r===void 0||r.updateFlags(t,s,i)}updateEarlyAccessFeatureEnrollment(t,s,i){var r;(r=this.featureFlags)===null||r===void 0||r.updateEarlyAccessFeatureEnrollment(t,s,i)}getEarlyAccessFeatures(t,s=!1,i){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getEarlyAccessFeatures(t,s,i)}on(t,s){return this.au.on(t,s)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Wt}),()=>{})}onSessionId(t){var s,i;return(s=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(t))!==null&&s!==void 0?s:()=>{}}getSurveys(t,s=!1){this.surveys?this.surveys.getSurveys(t,s):t([],{isLoaded:!1,error:Wt})}getActiveMatchingSurveys(t,s=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,s):t([],{isLoaded:!1,error:Wt})}renderSurvey(t,s){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,s)}displaySurvey(t,s=Qc){var i;(i=this.surveys)===null||i===void 0||i.displaySurvey(t,s)}cancelPendingSurvey(t){var s;(s=this.surveys)===null||s===void 0||s.cancelPendingSurvey(t)}canRenderSurvey(t){var s,i;return(s=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurvey(t))!==null&&s!==void 0?s:{visible:!1,disabledReason:Wt}}canRenderSurveyAsync(t,s=!1){var i,r;return(i=(r=this.surveys)===null||r===void 0?void 0:r.canRenderSurveyAsync(t,s))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Wt})}uh(t){return!t||Jt(t)?(E.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(E.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(E.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,s,i){if(!this.__loaded||!this.persistence)return E.uninitializedWarning("posthog.identify");if(re(t)&&(t=t.toString(),E.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t)||!this.oh("posthog.identify"))return;this.yu();const r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.nh(!1),a=this.persistence.Pl();let l=!1;try{const c=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:c},""),t!==c&&t!==this.get_property("__alias")&&(this.unregister(Hs),this.register({distinct_id:t}));const h=(this.persistence.get_property("$user_state")||"anonymous")===Ge,p=t!==c,d=!p&&h;if(p&&h){var u;const g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:c};this.persistence.set_property(xe,Fs),this.setPersonPropertiesForFlags({$set:s||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(ir,g,{$set:s||{},$set_once:i||{}}),this.Eu=Mi(t,s,i),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:c)}else if(d){this.persistence.set_property(xe,Fs);const g=s||{},m=i||{};this.setPersonPropertiesForFlags({$set:g,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:g,$set_once:m}),this.Eu=Mi(t,s,i)}else(s||i)&&this.setPersonProperties(s,i);p||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(rt)):d&&(s||i)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Ol(l)}}setPersonProperties(t,s){if(!t&&!s||!this.oh("posthog.setPersonProperties"))return;const i=Mi(this.get_distinct_id(),t,s);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!0),this.capture("$set",{$set:t||{},$set_once:s||{}}),this.Eu=i):E.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var s;const i=(C(t)?t:[t]).filter(r=>L(r)&&r.length>0);i.length!==0&&this.oh("posthog.unsetPersonProperties")&&((s=this.featureFlags)===null||s===void 0||s.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,s,i){var r;if(!t||!s)return void E.error("posthog.group requires a group type and group key");(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.nh();const n=this.getGroups(),o=n[t]!==s;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f(f({},n),{},{[t]:s})}),(o||i)&&this.rh()){const a={$group_type:t,$group_key:s};i&&(a.$group_set=i),this.capture(cn,a)}i&&this.setGroupPropertiesForFlags({[t]:i}),o&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,s=!0){var i;(i=this.featureFlags)===null||i===void 0||i.setPersonPropertiesForFlags(t,s)}resetPersonPropertiesForFlags(t=!0){var s;(s=this.featureFlags)===null||s===void 0||s.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,s=!0){var i;this.oh("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)===null||i===void 0||i.setGroupPropertiesForFlags(t,s))}resetGroupPropertiesForFlags(t){var s;(s=this.featureFlags)===null||s===void 0||s.resetGroupPropertiesForFlags(t)}reset(t){const s=$e(t)?t:t?.resetDeviceID,i=$e(t)||t==null?void 0:t.bootstrap;this.hh(s,!1,i)}hh(t,s=!1,i){var r,n,o,a,l,u;if(E.info("reset"),!this.__loaded)return E.uninitializedWarning("posthog.reset");const c=i?.sessionID;this.config.bootstrap=i||((r=this.Ru)===null||r===void 0?void 0:r.bootstrap)||{},(n=this.featureFlags)===null||n===void 0||(o=n.updateConfig)===null||o===void 0||o.call(n,this.config,this.Yl());const h=this.get_property($r),p=this.get_property(pi),d=this.get_property(Yt);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const g=this.is_capturing();this.consent.reset(),s||!g||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const m=(l=this.persistence)===null||l===void 0||(u=l.Pl)===null||u===void 0?void 0:u.call(l);let v=!1;try{var _,x,$,O,k,M,F,S,P,D,j,H,U;if((_=this.persistence)===null||_===void 0||_.clear(),(x=this.sessionPersistence)===null||x===void 0||x.clear(),this.xu.clear(),this.sh(),b(d)||(D=this.persistence)===null||D===void 0||D.register({$session_recording_remote_config:d}),($=this.surveys)===null||$===void 0||$.reset(),(O=this.featureFlags)===null||O===void 0||O.reset(),(k=this.conversations)===null||k===void 0||k.reset(),(M=this.logs)===null||M===void 0||M.reset(),(F=this.metrics)===null||F===void 0||F.reset(),(S=this.persistence)===null||S===void 0||S.set_property("$user_state","anonymous"),(P=this.sessionManager)===null||P===void 0||P.resetSessionId(),this.Eu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:fi,$device_id:null},"");else{const Y=this.config.get_device_id(Le());this.register_once({distinct_id:Y,$device_id:t?Y:h},""),t||b(p)||this.register({[pi]:p})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.fu()&&((U=this.persistence)===null||U===void 0||U.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(j=this.featureFlags)===null||j===void 0||j.initialize(),!T(c)&&!(!((H=this.sessionManager)===null||H===void 0)&&H.setBootstrapSessionId(c,!0)))){const Y=f({},i);delete Y.sessionID,this.config.bootstrap=Y}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var G,oe;m&&((G=this.persistence)===null||G===void 0||(oe=G.Ol)===null||oe===void 0||oe.call(G,v))}this.reloadFeatureFlags()}shutdown(t){var s=this;return X(function*(){var i,r,n,o,a,l,u;if(s.__loaded){s.ku=!0,s.zu().dispose(),(i=s.sessionRecording)===null||i===void 0||i.dispose(),(r=s.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=s.metrics)===null||n===void 0||n.flush("sendBeacon"),(o=s.Fu)===null||o===void 0||o.unload(),(a=s.Du)===null||a===void 0||a.unload();try{var c;(c=s.featureFlags)===null||c===void 0||c.destroy()}catch(h){E.error("Error while destroying feature flags",h)}(l=s.persistence)===null||l===void 0||l.destroy(),(u=s.sessionPersistence)===null||u===void 0||u.destroy()}else E.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,s){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=s,this.alias(t),(i=this.conversations)===null||i===void 0||i.dh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.fh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,s;return(t=(s=this.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:s,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let r=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${s}`);if(t?.withTimestamp&&i){var n;const o=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return r;r+=`?t=${Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}`}return r}alias(t,s){return t===this.get_property("$people_distinct_id")?(E.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(b(s)&&(s=this.get_distinct_id()),t!==s?(this.ah(Hs,t),this.capture("$create_alias",{alias:t,distinct_id:s})):(E.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const s=f({},this.config);if(A(t)){var i,r,n,o,a,l,u,c,h,p,d,g,m;J(this.config,zn(t));const _=this.bu();(i=this.persistence)===null||i===void 0||i.update_config(this.config,s,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xi(f(f({},this.config),{},{persistence:"sessionStorage"}),_,!1);const x=this.Pu(this.config.debug);var v;$e(x)&&(this.config.debug=x),$e(this.config.debug)&&(this.config.debug?(ce.DEBUG=!0,N.Et()&&N.At("ph_debug",!0),E.info("set_config",{config:t,oldConfig:s,newConfig:f({},this.config)})):(ce.DEBUG=!1,N.Et()&&N.Lt("ph_debug"))),(r=this.featureFlags)===null||r===void 0||(n=r.updateConfig)===null||n===void 0||n.call(r,this.config,this.Yl()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(l=this.sessionRecording)===null||l===void 0||l.startIfEnabledOrStop(),(u=this.tracingHeaders)===null||u===void 0||u.startIfEnabledOrStop(),(c=this.autocapture)===null||c===void 0||c.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((v=this.historyAutocapture)===null||v===void 0||v.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(g=this.surveys)===null||g===void 0||g.loadIfEnabled(),this._u(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!s.segment&&this.config.segment&&this.persistence&&En(this,is,!1)}}_overrideSDKInfo(t,s){ce.LIB_NAME=t,ce.LIB_VERSION=s}startSessionRecording(t){const s=t===!0,i={sampling:s||!!t?.sampling,linked_flag:s||!!t?.linked_flag,url_trigger:s||!!t?.url_trigger,event_trigger:s||!!t?.event_trigger};var r,n,o,a,l;Object.values(i).some(Boolean)&&((r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)===null||n===void 0||n.overrideSampling()),i.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,s){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(f(f({},i),s))}catch{return}}addExceptionStep(t,s){var i;(i=this.exceptions)===null||i===void 0||i.addExceptionStep(t,s)}captureLog(t){var s;(s=this.logs)===null||s===void 0||s.captureLog(t)}get logger(){var t,s;return(t=(s=this.logs)===null||s===void 0?void 0:s.logger)!==null&&t!==void 0?t:et.ph}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var s,i;return(s=(i=this.toolbar)===null||i===void 0?void 0:i.loadToolbar(t))!==null&&s!==void 0&&s}get_property(t){var s;return(s=this.persistence)===null||s===void 0?void 0:s.props[t]}getSessionProperty(t){var s;return(s=this.sessionPersistence)===null||s===void 0?void 0:s.props[t]}toString(){var t;let s=(t=this.config.name)!==null&&t!==void 0?t:Kt;return s!==Kt&&(s="posthog."+s),s}_isIdentified(){var t,s;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((s=this.sessionPersistence)===null||s===void 0?void 0:s.get_property("$user_state"))==="identified"}rh(){var t,s;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ke(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((s=this.persistence)===null||s===void 0||(s=s.props)===null||s===void 0)&&s.$epp))}Ku(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return this.config.person_profiles==="never"?(E.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(Sr,!0),!0)}bu(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}_u(){var t,s;const i=this.bu();var r,n,o;return this.is_capturing()||(r=this.logs)===null||r===void 0||r.gh(),((t=this.persistence)===null||t===void 0?void 0:t.pi)!==i&&((n=this.persistence)===null||n===void 0||n.set_disabled(i)),((s=this.sessionPersistence)===null||s===void 0?void 0:s.pi)!==i&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(i)),i&&(this.xu.clear(),this.sh()),i}opt_in_capturing(t){var s;if(this.config.cookieless_mode!=="always"){if(this.fu()){var i,r,n,o,a,l;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=new Dn(this),this.pageViewManager=new Sn(this),this.persistence&&(this.sessionPropsManager=new An(this,this.sessionManager,this.persistence));const d=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=et.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var u,c;d&&(this.sessionRecording=this.vu(this.sessionRecording,new d(this)),this.lu&&((u=this.sessionRecording)===null||u===void 0||(c=u.onRemoteConfig)===null||c===void 0||c.call(u,this.lu)))}var h,p;this.consent.optInOut(!0),this._u(),this.Zu(),(s=this.sessionRecording)===null||s===void 0||s.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled()),(b(t?.captureEventName)||t?.captureEventName)&&this.capture((p=t?.captureEventName)!==null&&p!==void 0?p:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else E.warn(Bn)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void E.warn(Bn);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var s,i;t?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:fi,$device_id:null}),this.du(t),this.sessionRecording=void 0,(s=this.sessionManager)===null||s===void 0||s.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return de?ll(de,this.config.custom_blocked_useragents):void 0}Qu(){w&&(w.visibilityState==="visible"?this.Tu||(this.Tu=!0,this.capture(Mr,{title:w.title},{send_instantly:!0}),this.Iu&&(w.removeEventListener(ls,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),W(w,ls,this.Iu)))}debug(t){t===!1?(y?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(y?.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}))}Yl(){const t=this.Ru||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(E.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(s,i,r,n,o){const a=i in s&&!T(s[i]),l=r in s&&!T(s[r]);return a?s[i]:!!l&&(o&&o.warn(`Config field '${r}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),s[r])})(t,"advanced_disable_flags","advanced_disable_decide",0,E)}Os(t){var s;if(T(this.config.before_send))return t;const i=Object.keys((s=t.properties)!==null&&s!==void 0?s:{}).filter(Ol),r=C(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const o of r)try{if(n=o(n),T(n)){const a=`Event '${t.event}' was rejected in beforeSend function`;return Fl(t.event)?E.warn(`${a}. This can cause unexpected behavior.`):E.info(a),null}n.properties&&!ke(n.properties)||E.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return E.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of i)if(n.properties&&T(n.properties[o]))return E.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return(t=this.pageViewManager.Bo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,s){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:s})}captureTraceMetric(t,s,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:s,$ai_metric_value:String(i)})}Pu(t){const s=$e(t)&&!t,i=N.Et()&&N.Ot("ph_debug")==="true";return!s&&(!!i||t)}};rs.__defaultExtensionClasses={},rs.ph=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let s=0;t.length>s;s++)e.prototype[t[s]]=nc(e.prototype[t[s]])})(rs,["identify"]);var gl=class{constructor(e){this.disabled=e===!1;const t=A(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,s){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>s-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}};const Ci="$copy_autocapture",ks=ne("[AutoCapture]");function Ri(e,t){return t.length>e?t.slice(0,e)+"...":t}function hh(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!He(t));return t}function dh(e,{e:t,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:r,elementsChainAsString:n,disableCaptureUrlHashes:o}){var a,l;if(!He(e))return{props:{}};const u=[e],c=new Set([e]);let h=e;for(;h.parentNode&&!ge(h,"body")&&1e3>u.length;){if(Or(h.parentNode)){const M=h.parentNode.host;if(c.has(M))break;c.add(M),u.push(M),h=M;continue}if(!He(h.parentNode)||c.has(h.parentNode))break;c.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex(M=>ge(M,"button")||ge(M,"a")):-1;p>0&&(i=i||u.slice(0,p+1).some(M=>!Ot(M)||cs(M)));const d=[],g={};let m,v=!1,_=!1;if(V(u,M=>{const F=Ot(M);if(ge(M,"a")){const S=M.getAttribute("href");v=!!(F&&S&&es(S))&&(o?ot(S):S)}R(Ct(M),"ph-no-capture")&&(_=!0),d.push((function(S,P,D,j,H=!1){const U=S.tagName.toLowerCase(),G={tag_name:U};Cr.indexOf(U)>-1&&!D&&(G.$el_text=U.toLowerCase()==="a"||U.toLowerCase()==="button"?Ri(1024,xn(S)):Ri(1024,us(S)));const oe=Ct(S);oe.length>0&&(G.classes=oe.filter(function(Z){return Z!==""})),V(S.attributes,function(Z){var B;if((!cs(S)||["name","id","class","aria-label"].indexOf(Z.name)!==-1)&&!j?.includes(Z.name)&&!P&&es(Z.value)&&(!L(B=Z.name)||B.substring(0,10)!=="_ngcontent"&&B.substring(0,7)!=="_nghost")){let se=Z.value;Z.name==="class"&&(se=Ir(se).join(" ")),G["attr__"+Z.name]=Ri(1024,Z.name==="href"&&H?ot(se):se)}});let Y=1,ae=1,le=S;for(;le=hh(le);)Y++,le.tagName===S.tagName&&ae++;return G.nth_child=Y,G.nth_of_type=ae,G})(M,s,i,r,o)),V((function(S){if(!Ot(S))return{};const P={};return V(S.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){const j=D.name.replace("data-ph-capture-attribute-",""),H=D.value;j&&H&&es(H)&&(P[j]=H)}}),P})(M),(S,P)=>{({}).hasOwnProperty.call(g,P)||(g[P]=S)})}),_)return{props:{},explicitNoCapture:_};if(p>0&&(e=u[p],d.splice(0,p)),i||(d[0].$el_text=ge(e,"a")||ge(e,"button")?xn(e):us(e)),v){var x,$;d[0].attr__href=v;const M=(x=Rt(v))===null||x===void 0?void 0:x.host,F=y==null||($=y.location)===null||$===void 0?void 0:$.host;M&&F&&M!==F&&(m=v)}return{props:J((k=t.type,{$event_type:k,$ce_version:1}),n?{}:{$elements:d},{$elements_chain:(O=d,C(O)?(function(M){return M.map(F=>{var S,P;let D="";if(F.tag_name&&(D+=F.tag_name),F.attr_class){F.attr_class.sort();for(const U of F.attr_class)D+=`.${U.replace(/"/g,"")}`}const j=f(f(f(f({},F.text?{text:F.text}:{}),{},{"nth-child":(S=F.nth_child)!==null&&S!==void 0?S:0,"nth-of-type":(P=F.nth_of_type)!==null&&P!==void 0?P:0},F.href?{href:F.href}:{}),F.attr_id?{attr_id:F.attr_id}:{}),F.attributes),H={};return Os(j).sort(([U],[G])=>(function(oe,Y){return Y>oe?-1:oe>Y?1:0})(U,G)).forEach(([U,G])=>H[$n(U.toString())]=$n(G.toString())),D+=":",D+=Os(H).map(([U,G])=>`${U}="${G}"`).join(""),D}).join(";")})((function(M){return M.map(F=>{var S,P;const D={text:(S=F.$el_text)===null||S===void 0?void 0:S.slice(0,400),tag_name:F.tag_name,href:(P=F.attr__href)===null||P===void 0?void 0:P.slice(0,2048),attr_class:bc(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return Os(F).filter(([j])=>j.indexOf("attr__")===0).forEach(([j,H])=>D.attributes[j]=H),D})})(O)):"")},!((a=d[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=d[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},g),target:e};var O,k}var ph=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(e){var t;if(!Ot(e))return!0;const s=(t=this.vo().css_selector_ignorelist)!==null&&t!==void 0?t:bi,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const n=r,o=Ct(n);if(R(o,"ph-no-capture")||R(o,"ph-sensitive")||cs(n)||s.some(l=>lr(n,l)))return!0;const a=r.parentNode;r=Or(a)?a.host:a&&He(a)?a:null}return!1}fo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.uo();if(e.type==="pointerdown"){this.uo();const i=Qt(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&He(i)&&(this.ho={target:i,excluded:this.do(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.po)===null||t===void 0?void 0:t.distinctId}))}const s=this.ho;s&&(e.pointerId!==s.id||Math.abs(e.clientX-s.x)>5||Math.abs(e.clientY-s.y)>5?this.uo():e.type==="pointerup"&&(s.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(e){var t;const s=this.ho;this.uo();const i=Qt(e);if(s?.released&&s.target.isConnected&&s.distinctId===((t=this.po)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===s.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-s.x)&&5>=Math.abs(e.clientY-s.y)&&i&&(ge(i,"html")||ge(i,"body"))){var r;if(s.excluded)return null;const n=(r=this.vo().css_selector_ignorelist)!==null&&r!==void 0?r:bi;return[i,w?.documentElement,w?.body].some(o=>{if(!o)return!1;const a=Ct(o);return R(a,"ph-no-capture")||R(a,"ph-sensitive")||!Ot(o)||cs(o)||n.some(l=>lr(o,l))})?null:s.target}}constructor(e){this.yo=e,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new gl(this.Mr.rageclick),this.xo=null}setup(e){this.Co(),this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?t.dispose():(this.$o=t,this.startIfEnabled())}dispose(){var e;this.So||(this.So=!0,this.po=void 0,(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var e,t;return this.vo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(s=>new RegExp(s)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(s=>new RegExp(s)),this.Mr}Io(){if(!this.isBrowserSupported())return void ks.info("Disabling Automatic Event Collection because this browser is not supported");if(!y||!w)return;const e=this.Mo=t=>{t=t||y?.event;try{if(t.type==="blur")return void this.uo();if(t.type.indexOf("pointer")===0)return void this.fo(t);const s=t.type==="click"?this.mo(t):void 0;if(ie(s))return;this.Eo(t,"$autocapture",s)}catch(s){ks.error("Failed to capture event",s)}};if(W(y,"blur",e),W(w,"submit",e,{capture:!0}),W(w,"change",e,{capture:!0}),W(w,"click",e,{capture:!0}),V(["pointerdown","pointermove","pointerup","pointercancel"],t=>{W(w,t,e,{capture:!0})}),this.vo().capture_copied_text){const t=this.Po=s=>{s=s||y?.event;try{this.Eo(s,Ci)}catch(i){ks.error("Failed to capture clipboard event",i)}};W(w,"copy",t,{capture:!0}),W(w,"cut",t,{capture:!0}),W(w,"paste",t,{capture:!0})}}To(){this.uo(),this.Mo&&(y?.removeEventListener("blur",this.Mo),V(["pointerdown","pointermove","pointerup","pointercancel"],e=>{w?.removeEventListener(e,this.Mo,!0)}),w?.removeEventListener("submit",this.Mo,!0),w?.removeEventListener("change",this.Mo,!0),w?.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(w?.removeEventListener("copy",this.Po,!0),w?.removeEventListener("cut",this.Po,!0),w?.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(e){if(this.So)return;if(this.wo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.ko=t.elementsChainAsString);const s=t.autocapture_opt_out;var i;$e(s)&&((i=this.po)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",s),this._o=s),this.startIfEnabled()}setElementSelectors(e){this.xo=e}getElementSelectors(e,t){var s;const i=[];return(s=this.xo)===null||s===void 0||s.forEach(r=>{const n=w?.querySelectorAll(r);n?.forEach(o=>{e!==o&&t!==o||R(i,r)||i.push(r)})}),i}get isEnabled(){var e,t;if(this.So)return!1;const s=(e=this.po)===null||e===void 0?void 0:e.kv.get(ca),i=this._o,r=this.vo();if(!r.remoteRequestsDisabled&&!this.wo)return!1;const n=r.remoteRequestsDisabled&&!this.wo;if(ie(i)&&!$e(s)&&!n)return!1;const o=(t=this._o)!==null&&t!==void 0?t:!!s;return!!r.enabled&&!o}Eo(e,t="$autocapture",s){if(!this.isEnabled)return void this.uo();let i=s||Qt(e);Oa(i)&&(i=i.parentNode||null);const r=this.Co();var n;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Ta(i,r.rageclick)&&this.Eo(e,"$rageclick",s);const o=t===Ci,a=o?f(f({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(h,p,d,g,m,v){var _;if(!y||Rr(h)||d?.url_allowlist&&!vn(d.url_allowlist,v)||d?.url_ignorelist&&vn(d.url_ignorelist,v))return!1;if(d?.dom_event_allowlist){const k=d.dom_event_allowlist;if(k&&!k.some(M=>p.type===M))return!1}const{parentIsUsefulElement:x,targetElementList:$}=Aa(h,g);if(!(function(k,M){const F=M?.element_allowlist;if(b(F))return!0;for(const S of k)if(F.some(P=>S.tagName.toLowerCase()===P))return!0;return!1})($,d)||!ur($,d?.css_selector_allowlist)||ur($,(_=d?.css_selector_ignorelist)!==null&&_!==void 0?_:bi))return!1;try{const k=y.getComputedStyle(h);if(k&&k.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0}catch{}const O=h.tagName.toLowerCase();switch(O){case"html":return!1;case"form":return(m||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(p.type)>=0;default:return x?(m||["click"]).indexOf(p.type)>=0:(m||["click"]).indexOf(p.type)>=0&&(Cr.indexOf(O)>-1||h.getAttribute("contenteditable")==="true")}})(i,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var l;const{props:h,explicitNoCapture:p,target:d}=dh(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(p)return!1;const g=this.getElementSelectors(i,d);if(g&&g.length>0&&(h.$element_selectors=g),t===Ci){const m=e.type||"clipboard";if(m!=="paste"){var u,c;const v=y==null||(u=y.getSelection())===null||u===void 0?void 0:u.toString(),_=Ia(v);if(!_)return!1;h.$selected_content=_,h.$clipboard_text_length=(c=v?.length)!==null&&c!==void 0?c:0}h.$copy_type=m}return(l=this.po)===null||l===void 0||l.capture(t,h).catch(m=>ks.error("Failed to capture event",m)),!0}}isBrowserSupported(){return ve(w?.querySelectorAll)}},fh=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,s=A(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.Yl(),e.url_allowlist=s?.url_allowlist,e.url_ignorelist=s?.url_ignorelist,e.dom_event_allowlist=s?.dom_event_allowlist,e.element_allowlist=s?.element_allowlist,e.css_selector_allowlist=s?.css_selector_allowlist,e.css_selector_ignorelist=s?.css_selector_ignorelist,e.element_attribute_ignorelist=s?.element_attribute_ignorelist,e.capture_copied_text=s?.capture_copied_text}};const Ut=ne("[ExceptionAutocapture]"),qn=()=>{},Vn=e=>{var t;if(ve(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function _l(e,t,s){try{if(!(t in e))return qn;const i={next:e[t]},r=s(function(...n){return i.next.apply(this,n)});return ve(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=i.next);let n=e[t],o=Vn(n);for(;o;){if(o.next===r)return void(o.next=i.next);n=o.next,o=Vn(n)}}}catch{return qn}}const vh=ne("[TracingHeaders]"),ut=ne("[Web Vitals]"),Wn=9e5,Un=["CLS","FCP","INP","LCP"],gh=["INP","LCP"],_h=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Ti="disabled",Gn="lazy_loading",qe=ne("[SessionRecording]"),mh=ne("[Heatmaps]");function Ai(e){return A(e)&&"clientX"in e&&"clientY"in e&&re(e.clientX)&&re(e.clientY)}const Es=ne("[Product Tours]"),Li=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Er))},yh=["$set_once","$set"],De=ne("[SiteApps]"),Kn="Error while initializing PostHog app with config id ",ml=(e,t)=>e?.then?e.then(t):t(e),$t="SDK is not enabled or survey functionality is not yet loaded",Jn="Disabled. Not loading surveys.";var bh=class{constructor(e,t){this.yo=e,this.mh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=s=>{if(this.So||this.Mr.disableSurveys)return;if(!s.ok)return q.warn("Remote config unavailable. Not loading surveys.");const i=s.config.surveys;if(T(i))return q.warn("Flags not loaded yet. Not loading surveys.");this.Sh=$e(i)?i:i.length>0,q.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(e){if(!this.So)return this.xh=e,ml(e.kv.initialize(),()=>{if(this.xh!==e||this.So)return;this.xh=void 0,this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.So?t.dispose():(this.$o=t,this.loadIfEnabled())})}dispose(){var e,t,s,i;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(s=this._surveyManager)===null||s===void 0||(i=s.dispose)===null||i===void 0||i.call(s),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(r=>clearTimeout(r)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)===null||e===void 0||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let s=0;s<localStorage.length;s++){const i=localStorage.key(s);(i?.startsWith("seenSurvey_")||i?.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach(s=>localStorage.removeItem(s))}catch{}}loadIfEnabled(){if(this.So||!this.po)return;const e=this.Mr;if(this._surveyManager)return;if(this.yh)return void q.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void q.info(Jn);if(e.cookielessMode&&this.yo.isOptedOut())return void q.info("Not loading surveys in cookieless mode without consent.");const t=this.yo.getExtensions();if(!t)return void q.error("PostHog Extensions not found.");if(b(this.Sh)&&!e.advancedEnableSurveys)return;const s=this.Sh||e.advancedEnableSurveys;this.yh=!0;try{const i=t.generateSurveys;if(i)return this.Ch(i,s),void(this.yh=!1);const r=t.loadExternalDependency;if(!r)return this.$h(Pr),void(this.yh=!1);r(n=>{try{if(this.So)return;const o=this.yo.getExtensions();n||!o?.generateSurveys?this.$h("Could not load surveys script",n):this.Ch(o.generateSurveys,s)}finally{this.yh=!1}})}catch(i){throw this.yh=!1,this.$h("Error initializing surveys",i),i}}Ch(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),q.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(e,t){q.error(e,t),this.Th({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.bh.push(e),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(t=>t!==e)}}getSurveys(e,t=!1){var s;const i=(s=this.po)!==null&&s!==void 0?s:this.mh;if(!i||this.So)return;if(this.Mr.disableSurveys)return q.info(Jn),e([]);const r=i.kv.get(er);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:a,context:l})=>{this.So||e(a,l)}).catch(a=>q.error("Error in survey callback",a));const n=this.Mh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(a=>{try{return this.Eh(i,a)}catch(l){return q.error("Error processing surveys response",l),this.Eh(i,{statusCode:0,error:l})}},a=>this.Eh(i,{statusCode:0,error:a}));this._h=n;const o=()=>{this._h===n&&(this._h=null)};n.then(a=>{o(),this.So||e(a.surveys,a.context)},o).catch(a=>q.error("Error in survey callback",a))}Mh(e,t){const s=this.po;return s?s.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error($t)}))}Eh(e,t){if(this.So)return{surveys:[],context:{isLoaded:!1,error:$t}};const s=t.statusCode;if(s!==200||!t.json){const o=`Surveys API could not be loaded, status: ${s}`;return s!==0?q.error(o):t.error||q.warn(o),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.wh=null;const i=t.json.surveys||[],r=i.filter(o=>(function(a){return!(!a.start_date||a.end_date)})(o)&&(cl(o)||(function(a){var l;return!!(!((l=a.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0)&&l.length)})(o)));var n;return r.length>0&&((n=this._surveyEventReceiver)===null||n===void 0||n.register(r)),e.kv.set({[er]:i,[zs]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var e,t;const s=(e=(t=this.po)!==null&&t!==void 0?t:this.mh)===null||e===void 0?void 0:e.kv.get(zs);return re(s)&&Date.now()-s>3e5}Rh(){return re(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(e,t){var s;const i={id:e,current_iteration:(s=t?.iteration)!==null&&s!==void 0?s:null};pl(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Th(e){for(const t of this.bh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(s){q.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,t=!1){if(!T(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);q.warn("init was not called")}Ah(e){let t=null;return this.getSurveys(s=>{var i;t=(i=s.find(r=>r.id===e))!==null&&i!==void 0?i:null}),t}Fh(e){if(T(this._surveyManager))return{eligible:!1,reason:$t};const t=typeof e=="string"?this.Ah(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Oh(e){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(T(this._surveyManager))return{eligible:!1,reason:$t};const t=typeof e=="string"?this.Ah(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(T(this._surveyManager))return q.warn("init was not called"),{visible:!1,disabledReason:$t};const t=this.Oh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return T(this._surveyManager)?(q.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:$t})):new Promise(s=>{this.getSurveys(i=>{var r;const n=(r=i.find(o=>o.id===e))!==null&&r!==void 0?r:null;if(n){const o=this.Oh(n);s({visible:o.eligible,disabledReason:o.reason})}else s({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,s){var i;if(!this.yo.isCapturing())return;if(T(this._surveyManager))return void q.warn("init was not called");const r=typeof e=="string"?this.Ah(e):e;if(!r?.id)return void q.warn("Survey not found");if(!Zc.includes(r.type))return void q.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const n=w?.querySelector(t);if(n){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){q.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,l;this.kh.delete(o),!this.So&&this.yo.isCapturing()&&(q.info(`Rendering survey ${r.id} with delay of ${(a=r.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(r,n,s),q.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.kh.add(o)}this._surveyManager.renderSurvey(r,n,s)}else q.warn("Survey element not found")}displaySurvey(e,t){var s;if(!this.yo.isCapturing())return;if(T(this._surveyManager))return void q.warn("init was not called");const i=this.Ah(e);if(!i)return void q.warn("Survey not found");let r=i;if(!((s=i.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=f(f({},i),{},{appearance:f(f({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==cr.Popover&&t.initialResponses&&q.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const n=this.Fh(i);if(!n.eligible)return void q.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==cr.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){T(this._surveyManager)?q.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function kt(e,t,s){if(T(e))return!1;switch(s){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var wh=class{constructor(e){this._instance=e,this.Dh=new Set,this.Lh=new Set,this.Nh=new Ks,this.qh=(t,s)=>this.jh(t,s)&&this.Bh(t,s)&&this.Hh(t,s)&&this.zh(t,s),this.jh=(t,s)=>!s?.event||t?.event===s?.event}init(){var e,t;b((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.Uh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((s,i)=>{this.on(s,i)}))}dispose(){var e;(e=this.Uh)===null||e===void 0||e.call(this),this.Uh=void 0,this.Nh=new Ks}register(e){var t,s;if(!b((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var r;this.Dh.add(i),(r=i.steps)===null||r===void 0||r.forEach(n=>{this.Lh.add(n?.event||"")})}),(s=this._instance)===null||s===void 0?void 0:s.autocapture)){const i=new Set;this.Dh.forEach(r=>{var n;(n=r.steps)===null||n===void 0||n.forEach(o=>{o?.selector&&i.add(o.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Dh.clear(),this.Lh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Lh.has(e)||this.Lh.has(t.event))&&this.Dh.forEach(s=>{this.Wh(t,s)&&this.Nh.emit("actionCaptured",s.name)})}Vh(e){this.onAction("actionCaptured",t=>e(t))}Wh(e,t){if(t?.steps==null)return!1;for(const s of t.steps)if(this.qh(e,s))return!0;return!1}onAction(e,t){return this.Nh.on(e,t)}Bh(e,t){if(t?.url){var s;const i=e==null||(s=e.properties)===null||s===void 0?void 0:s.$current_url;if(!i||typeof i!="string"||!kt(i,t.url,t.url_matching||"contains"))return!1}return!0}Hh(e,t){return!!this.Gh(e,t)&&!!this.Zh(e,t)&&!!this.Qh(e,t)}Gh(e,t){var s;if(!t?.href)return!0;const i=this.Jh(e);if(i.length>0)return i.some(n=>kt(n.href,t.href,t.href_matching||"exact"));const r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";return!!r&&kt((function(n){const o=n.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(r),t.href,t.href_matching||"exact")}Zh(e,t){var s;if(!t?.text)return!0;const i=this.Jh(e);if(i.length>0)return i.some(l=>kt(l.text,t.text,t.text_matching||"exact")||kt(l.$el_text,t.text,t.text_matching||"exact"));const r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";return!!r&&(n=(function(l){const u=[],c=/(?::|")text="(.*?)"/g;let h;for(;!T(h=c.exec(l));)u.includes(h[1])||u.push(h[1]);return u})(r),o=t.text,a=t.text_matching||"exact",n.some(l=>kt(l,o,a)));var n,o,a}Qh(e,t){var s,i;if(!t?.selector)return!0;const r=e==null||(s=e.properties)===null||s===void 0?void 0:s.$element_selectors;if(r?.includes(t.selector))return!0;const n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}Jh(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}zh(e,t){return!t?.properties||t.properties.length===0||dl(t.properties.reduce((s,i)=>{const r=C(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return s[i.key]={values:r,operator:i.operator||"exact"},s},{}),e?.properties)}},xh=class{constructor(e){var t,s;this.Kh=[],this._instance=e,this.Yh=new Map,this.Xh=new Map,this.tc=new Map,this.ec=(t=this._instance)===null||t===void 0||(s=t.onSessionId)===null||s===void 0?void 0:s.call(t,i=>this.nc(i))}sc(e){return!1}rc(){return null}oc(e){}lc(){}ac(e,t){return!!e&&dl(e.propertyFilters,t?.properties)}uc(e,t){const s=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[t])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(n=>{if(n?.name){const o=s.get(n.name)||[];o.push(i.id),s.set(n.name,o)}})}),s}hc(e,t,s){const i=(s===zt.Activation?this.Yh:this.Xh).get(e);let r=[];return this.cc(n=>{r=n.filter(o=>i?.includes(o.id))}),r.filter(n=>{var o;const a=(o=n.conditions)===null||o===void 0||(o=o[s])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.ac(a,t)})}register(e){this.dc(e,!1)}replace(e){this.dc(e,!0)}dc(e,t){var s;b((s=this._instance)===null||s===void 0?void 0:s._addCaptureHook)||(this.vc(e,t),this.fc(e,t))}fc(e,t){const s=e.filter(n=>{var o;return(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var i;if(t&&this.tc.clear(),s.length===0)return void(t&&((i=this.gc)===null||i===void 0||i.replace([])));this.gc||(this.gc=new wh(this._instance),this.gc.init(),this.gc.Vh(n=>this.onAction(n)));const r=[];s.forEach(n=>{var o;(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(r.push(a),a.name){var l;const u=(l=this.tc.get(a.name))!==null&&l!==void 0?l:[];u.includes(n.id)||u.push(n.id),this.tc.set(a.name,u)}})}),t?this.gc.replace(r):this.gc.register(r)}mc(e,t){t.forEach((s,i)=>{var r;const n=(r=e.get(i))!==null&&r!==void 0?r:[];s.forEach(o=>{n.includes(o)||n.push(o)}),e.set(i,n)})}vc(e,t){var s,i;const r=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.events)&&((c=l.conditions)===null||c===void 0||(c=c.events)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),n=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((c=l.conditions)===null||c===void 0||(c=c.cancelEvents)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),o=this.uc(e,zt.Activation),a=this.uc(e,zt.Cancellation);t?(this.Yh=o,this.Xh=a):(this.mc(this.Yh,o),this.mc(this.Xh,a)),(r.length!==0||n.length!==0)&&((s=this.Uh)!==null&&s!==void 0||(this.Uh=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((l,u)=>{this.onEvent(l,u)})))}onEvent(e,t){var s,i;const r=this.yc(),n=(t==null||(s=t.properties)===null||s===void 0?void 0:s.$survey_id)||(t==null||(i=t.properties)===null||i===void 0?void 0:i.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){const a=this.bc(e,n);if(a==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._c([n]);if(a==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.wc(n),void this.kc([n])}if(this.Xh.has(e)){const a=this.hc(e,t,zt.Cancellation);a.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this._c(a.map(l=>l.id)),a.forEach(l=>this.Sc(l.id)))}if(!this.Yh.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.Yh.get(e)});const o=this.hc(e,t,zt.Activation);this.xc(o.map(a=>a.id))}onAction(e){this.tc.has(e)&&this.xc(this.tc.get(e)||[])}xc(e){var t,s;if(e.length===0)return;const i=!!(!((t=this._instance)===null||t===void 0||(s=t.get_session_id)===null||s===void 0)&&s.call(t)),r=[];for(const n of e)i&&this.sc(n)?this.wc(n)&&this.Cc(n):r.push(n);r.length>0&&(this.Kh=[...new Set([...this.Kh,...r])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(e){this.Kh=this.Kh.filter(s=>s!==e);const t=this.$c();return!t.includes(e)&&(this.Tc([...t,e]),this.Ic(),!0)}_c(e){const t=new Set(e);this.Kh=this.Kh.filter(r=>!t.has(r));const s=this.Mc(),i=s.filter(r=>!t.has(r));i.length!==s.length&&(this.Tc(i),i.length===0&&this.Ec()),this.kc(e)}Pc(){var e;const t=this.rc();if(!t)return{};const s=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return s&&typeof s=="object"?s:{}}Cc(e){if(!this.rc())return;const t=this.Pc();this.oc(f(f({},t),{},{[e]:Date.now()}))}kc(e){if(!this.rc())return;const t=this.Pc(),s={};let i=!1;for(const[r,n]of Object.entries(t))e.includes(r)?i=!0:s[r]=n;i&&(ke(s)?this.lc():this.oc(s))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(e){if(!this.$c().includes(e))return;const t=this.Pc()[e];return re(t)?t:void 0}Mc(){var e;const t=this.Ac();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}$c(){var e,t,s;const i=this.Mc();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Fc()],n=(t=this._instance)===null||t===void 0||(s=t.get_session_id)===null||s===void 0?void 0:s.call(t);return n&&r===n?i:[]}Ic(){var e,t;const s=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);s&&this.Oc(s)}Ec(){this.Dc()}nc(e){var t;const s=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Fc()];if(s&&s!==e){const i=this.Mc(),r=this.Pc();i.length>0&&(this.Tc([]),i.filter(n=>re(r[n])).forEach(n=>this.Sc(n))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(e=>!this.Lc(e))}dispose(){var e,t,s;(e=this.ec)===null||e===void 0||e.call(this),this.ec=void 0,(t=this.Uh)===null||t===void 0||t.call(this),this.Uh=void 0,(s=this.gc)===null||s===void 0||s.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Yh}Nc(){return this.gc}},$h=class extends xh{constructor(e){super(e)}Ac(){return ga}Fc(){return _a}rc(){return ma}oc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}lc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}sc(e){var t;let s;this.cc(r=>{s=r.find(n=>n.id===e)});const i=s==null||(t=s.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return re(i)&&i>0}qc(){return Ke.SHOWN}cc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Sc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}yc(){return q}Tc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Oc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Dc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Lc(){return!1}bc(e,t){let s;return this.cc(i=>{s=i.find(r=>r.id===t)}),!s||(function(i){var r;return cl(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"})(s)?e===Ke.SHOWN?"consume":"ignore":e===Ke.SHOWN?"persist":e===Ke.DISMISSED||e===Ke.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},kh=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const s of e){const i=this._instance.get_property(s);b(i)||(t[s]=i)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Eh=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=I?.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:s}=e;return{generateSurveys:t?i=>t(this._instance,i):void 0,loadExternalDependency:s?i=>s(this._instance,"surveys",i):void 0}}createEventReceiver(){return new $h(this._instance)}};const Sh=y?.location?Ws(y.location.hash,"__posthog")||Ws(location.hash,"state"):null,Xn="_postHogToolbarParams",Yn=ne("[Toolbar]"),Zn=ne("[FeatureFlags]");var Ph=class{constructor(e,t=!1){this.jc=!1,this.update(e,t)}update(e,t){this.Bc=((s,i)=>{var r,n,o,a,l,u,c;return{bootstrap:{featureFlags:(r=(n=s.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(o=(a=s.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!s.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!s.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!s.advanced_feature_flags_dedup_per_session,cacheTtlMs:s.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=s.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:b(s.remote_config_refresh_interval_ms),requestTimeoutMs:s.feature_flag_request_timeout_ms,compression:s.disable_compression?void 0:"best-available",evaluationContexts:(u=(c=s.evaluation_contexts)!==null&&c!==void 0?c:s.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:C(s.flag_keys)?s.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.jc||(Zn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),b(e.flag_keys)||C(e.flag_keys)||Zn.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const Qn=ne("[FeatureFlags]"),ct=ne("[FeatureFlags]",{debugEnabled:!0}),Di=`" failed. Feature flags didn't load in time.`,eo=["click","keydown","wheel","touchstart","pointerdown"],to="connection_error",so=e=>{const t={};for(let s=0;e.length>s;s++)t[e[s]]=!0;return t},io=e=>{const t={};for(const[s,i]of Os(e||{}))i&&(t[s]=i);return t},ro=e=>ps(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Ce=ne("[Error tracking]"),gr="webkit-masked-url:",Mh=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Fh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",gr],Oh=["__firefox__","__gCrWeb"],no="Refusing to render web experiment since the viewer is a likely bot",Ih={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Js(t,e),not_regex:(e,t)=>!Js(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Fe=ne("[Conversations]"),ht="Conversations not available yet.";function oo(e,t){var s,i,r,n,o,a,l;const u=(s=e?.flushIntervalMs)!==null&&s!==void 0?s:3e3,c=(i=e?.maxBufferSize)!==null&&i!==void 0?i:100,h=t?.consoleCapture?void 0:(r=e?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,p=b(h)?Math.max(c,2048):Math.max(c,h),d=f(f({},(function(){let g="",m="";try{const v=de?.userAgent;v&&([g,m]=Ho(v))}catch{}return(function(v,_){const x=(function($){if($)return{}.hasOwnProperty.call(nn,$)?nn[$]:$})(v);return f(f({},x?{"os.name":x}:{}),_?{"os.version":_}:{})})(g,m)})()),e?.resourceAttributes);return{serviceName:(n=(o=d?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&n!==void 0?n:t?.serviceNameDefault,serviceVersion:(a=d?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=d?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:d,beforeSend:e?.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Ch=["debug","log","warn","error","info"],Rh=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},ao="console",yl="__posthogHandledLogsRequestError",Ni=(e,t)=>{const s=e instanceof Error?e:new Error(t);return s[yl]=!0,s},lo=e=>!!e&&typeof e=="object"&&e[yl]===!0,ei={featureFlags:class{constructor(e){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=Qn,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Yc=!1,this.Xc=0,this.td=!1,this.sn=()=>{const t=this.ed();this.Xc=0,t&&this.reloadFeatureFlags()},this.nd=()=>{var t,s;const i=this.sd,r=(t=this.rd)!==null&&t!==void 0?t:i;b(i)||b(r)||this.Mr.remoteRequestsDisabled||!w||w.visibilityState==="hidden"||Date.now()-((s=this.od)!==null&&s!==void 0?s:0)<r||(this.rd=this.td||!this.Mr.idleRefreshBackoff?i:Math.min(2*r,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{w?.visibilityState==="visible"&&this.ud()},"get"in e?this.yo=e:(this._instance=e,this.hd=new Ph(e.config,e.Yl()),this.yo=this.hd)}updateConfig(e,t){var s;(s=this.hd)===null||s===void 0||s.update(e,t),this.po&&this.dd()}setup(e){return this.xh=e,this.$=e.logger.createLogger("[FeatureFlags]"),ml(e.kv.initialize(),()=>{this.xh===e&&(this.xh=void 0,this.po=e,this.vd(e))})}vd(e){var t;if(this.po===e)return y&&W(y,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const e=this.Mr.refreshIntervalMs,t=!this.Mr.remoteRequestsDisabled&&w&&!b(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.rd=t),t!==this.sd&&(this._d(),b(t)||(this.sd=t,this.rd=t,this.ld(),w?.addEventListener&&(W(w,ls,this.an),Pt(eo,s=>{W(w,s,this.ad,{capture:!0})}))))}ld(){b(this.sd)||(b(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var e;b(this.wd)||(clearInterval(this.wd),this.wd=void 0,w==null||(e=w.removeEventListener)===null||e===void 0||e.call(w,"visibilitychange",this.an),Pt(eo,t=>{var s;w==null||(s=w.removeEventListener)===null||s===void 0||s.call(w,t,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var e,t;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),(e=this.fd)===null||e===void 0||e.dispose(),this.fd=void 0,(t=this.gd)===null||t===void 0||t.call(this),this.gd=void 0,this.Wc=[],y?.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(e){var t;return this.Cd&&e in this.Cd?this.Cd[e]:(t=this.po)===null||t===void 0?void 0:t.kv.get(e)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var e;return!b((e=this.po)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.md()}At(e){this.Td(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.set(e)})}Id(e,t,s){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const r=this.xd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:s&&!C(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),c=this.xd("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},p=l||s?u:Array.from(new Set([...Object.keys(c),...Object.keys(h)])),d=!l&&!s,g=!!d||u,m=!!d||p,v={[Ue]:g,[Ae]:g,[tt]:m};e.$feature_flag_details&&(v[vt]=g);for(const _ of[gt,nt,Zt])b(e[_])||(v[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}Lt(e){this.Td(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.remove(e)})}Td(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}yd(){const e={};for(const i of[Ue,tt,gt,Ne]){const r=this.xd(i);b(r)||(e[i]=r)}this.zc=e;const t=f({},e),s=this.xd(Ae);if(s)for(const[i,r]of Object.entries(s))t[`$feature/${i}`]=r;this.Uc=t}pd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.xd(nt);return typeof t!="number"||Date.now()-t>e}Md(){return!!this.pd()&&(this.Yc||this.Gc||(this.Yc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){const e=this.Mr.evaluationContexts;return e?.length?e.filter(t=>{const s=t&&typeof t=="string"&&t.trim().length>0;return s||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),s}):[]}Pd(){const e=this.Mr.flagKeys;if(!b(e))return e.filter(t=>{const s=t&&typeof t=="string"&&t.trim().length>0;return s||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),s})}initialize(){var e,t;const s=this.Mr,i=(e=(t=s.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var r,n;const o=(r=(n=s.bootstrap)===null||n===void 0?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(i).filter(u=>!b(i[u])).reduce((u,c)=>(u[c]=i[c],u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,c)=>(u[c]=o[c],u),{});return this.Rd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,s){var i,r;const n=s?.merge&&(i=this.xd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},o=s?.merge&&(r=this.xd("$feature_flag_payloads"))!==null&&r!==void 0?r:{},a=f(f({},n),e),l=f(f({},o),t),u={};for(const[c,h]of Object.entries(a))u[c]={key:c,enabled:Qr(h),variant:en(h),reason:void 0,metadata:b(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.xd(vt),t=this.xd(Ne),s=this.xd(pt);if(!s&&!t)return e||{};const i=J({},e||{}),r=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(const a of r){var n;const l=i[a],u=t?.[a],c=b(u)?(n=l?.enabled)!==null&&n!==void 0&&n:!!u,h=b(u)?l?.variant:typeof u=="string"?u:void 0,p=s?.[a],d=f(f({},l),{},{enabled:c,variant:c?h??l?.variant:void 0});var o;c!==l?.enabled&&(d.original_enabled=l?.enabled),h!==l?.variant&&(d.original_variant=l?.variant),p&&(d.metadata=f(f({},l?.metadata),{},{payload:p,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),i[a]=d}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:i}),this.Hc=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(s=>{const i=e[s];return{key:s,enabled:Qr(i),variant:en(i),payload:Zr(t[s])}})}getFlagVariants(){const e=this.xd(Ae),t=this.xd(Ne);if(!t)return e||{};const s=J({},e||{}),i=Object.keys(t);for(let r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:s}),this.Hc=!0),s}getFlagPayloads(){const e=this.xd(tt),t=this.xd(pt);if(!t)return e||{};const s=J({},e||{}),i=Object.keys(t);for(let r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:s}),this.Hc=!0),s}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(e){return this.Wc.push(e),()=>{this.Wc=this.Wc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Qc=e}resetFlagCallReported(){this.Lt(rt)}Fd(e){this.Sd();const t=this.po;if(!t||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!0);const s={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:f(f(f({},t.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.xd(it),timezone:Ka()};b(t.deviceId)||(s.$device_id=t.deviceId),(e?.disableFlags||this.Mr.featureFlagsDisabled)&&(s.disable_flags=!0);const i=this.Ed();i.length&&(s.evaluation_contexts=i);const r=this.Pd();b(r)||(s.flag_keys=r);const n=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.Zc;this.Gc=!0;const l=()=>{this.Jc&&(this.Jc=!1,this.Fd())},u=h=>{var p,d;const g=(p=h.json)!==null&&p!==void 0?p:{},m=h.statusCode!==200;if(this.Gc=!1,a!==this.Zc)return void l();if(this.Od(h.statusCode),m||this.Jc||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Jc)return;this.Kc=!m;const v=[];h.error?v.push(h.error instanceof Error&&h.error.name==="AbortError"?"timeout":h.error instanceof Error?to:"unknown_error"):h.statusCode!==200&&v.push(`api_error_${h.statusCode}`),g.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");const _=!!(!((d=g.quotaLimited)===null||d===void 0)&&d.includes("feature_flags"));_&&v.push("quota_limited"),this.At({[as]:v}),_?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):s.disable_flags||this.Rd(g,m,{partialResponse:n}),l()},c=h=>{this.Gc=!1,a===this.Zc&&(this.At({[as]:[to]}),this.$.error("Feature flag request failed",h),this.$d()&&this.bd(!0)),l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:s,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(c)}catch(h){c(h)}}ed(){return ja(this.Xc,3)}Od(e){this.Xc=Ba(e,this.Xc,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var s;if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Di);if(this.Md())return;const i=this.getFeatureFlagResult(e,t);return(s=i?.variant)!==null&&s!==void 0?s:i?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Di);if(this.Md())return;const s=this.getFlagVariants(),i=e in s,r=s[e],n=this.getFlagPayloads()[e],o=String(r),a=this.xd("$feature_flag_request_id")||void 0,l=this.xd("$feature_flag_evaluated_at")||void 0;let u,c=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var h;const P=(h=this.po)===null||h===void 0?void 0:h.session.sessionId,D=this.xd(Gt);P&&P!==D&&(c={},u=P)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(o))u&&this.At({[rt]:c,[Gt]:u});else{var p,d,g,m,v,_,x,$,O,k,M,F;C(c[e])?c[e].push(o):c[e]=[o],this.At(f({[rt]:c},u?{[Gt]:u}:{}));const P=this.getFeatureFlagDetails(e),D=[...(p=this.xd("$feature_flag_errors"))!==null&&p!==void 0?p:[]];b(r)&&D.push("flag_missing");const j={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(d=(g=this.Mr.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&d!==void 0?d:null,$feature_flag_bootstrapped_payload:(m=(v=this.Mr.bootstrap)===null||v===void 0||(v=v.featureFlagPayloads)===null||v===void 0?void 0:v[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.Kc};b(P==null||(_=P.metadata)===null||_===void 0?void 0:_.has_experiment)||(j.$feature_flag_has_experiment=P.metadata.has_experiment),b(P==null||(x=P.metadata)===null||x===void 0?void 0:x.version)||(j.$feature_flag_version=P.metadata.version);const H=($=P==null||(O=P.reason)===null||O===void 0?void 0:O.description)!==null&&$!==void 0?$:P==null||(k=P.reason)===null||k===void 0?void 0:k.code;var S;H&&(j.$feature_flag_reason=H),!(P==null||(M=P.metadata)===null||M===void 0)&&M.id&&(j.$feature_flag_id=P.metadata.id),b(P?.original_variant)&&b(P?.original_enabled)||(j.$feature_flag_original_response=b(P.original_variant)?P.original_enabled:P.original_variant),!(P==null||(F=P.metadata)===null||F===void 0)&&F.original_payload&&(j.$feature_flag_original_payload=P==null||(S=P.metadata)===null||S===void 0?void 0:S.original_payload),D.length&&(j.$feature_flag_error=D.join(",")),this.Dd(j)}else u&&this.At({[rt]:c,[Gt]:u});return i?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:Zr(n)}:void 0}Dd(e){try{var t;(t=this.po)===null||t===void 0||t.capture("$feature_flag_called",e).catch(s=>{this.$.error("Failed to capture feature flag call",s)})}catch(s){this.$.error("Failed to capture feature flag call",s)}}getRemoteConfigPayload(e,t){this.Ld(e,t)}Ld(e,t){var s=this;return X(function*(){const i=s.po;if(!i)return;const r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=s.Ed();n.length&&(r.evaluation_contexts=n);const o=s.Pd();let a;b(o)||(r.flag_keys=o);try{var l;const u=(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:s.Mr.compression,sentAt:"body",timeoutMs:s.Mr.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=u?.[e]||void 0}catch(u){return void s.$.error("Remote config feature flag request failed",u)}try{t(a)}catch(u){s.$.error("Remote config feature flag callback failed",u)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.Kc)return t.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Di),t.defaultValue;const s=this.getFeatureFlag(e,t);return b(s)?t.defaultValue:!!s}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,s){this.Rd(e,t,s)}Rd(e,t,s){if(!this.po)return;this.Vc=!0;const i=((r,n={},o={},a={},l,u=Qn)=>{const c=(($,O)=>{const k=$.flags;if(k){const M=Object.fromEntries(Object.keys(k).map(S=>{var P;return[S,(P=k[S].variant)!==null&&P!==void 0?P:k[S].enabled]})),F=Object.fromEntries(Object.keys(k).filter(S=>k[S].enabled).filter(S=>{var P;return!b((P=k[S].metadata)===null||P===void 0?void 0:P.payload)}).map(S=>{var P;return[S,(P=k[S].metadata)===null||P===void 0?void 0:P.payload]}));return f(f({},$),{},{featureFlags:M,featureFlagPayloads:F})}return $.featureFlags&&O.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),$})(r,u),h=c.flags,p=c.featureFlags,d=c.featureFlagPayloads;if(!p)return;const g=r.requestId,m=r.evaluatedAt;if(C(p)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const $={};if(p)for(let O=0;p.length>O;O++)$[p[O]]=!0;return{[Ue]:p,[Ae]:$,[Zt]:!1}}let v=p,_=d,x=h;if(l?.partialResponse){const $=Object.keys(v),O=_||{};v=f(f({},n),v),_=f(f({},o),O),$.forEach(k=>{k in O||_==null||delete _[k]}),x=f(f({},a),x)}else if(r.errorsWhileComputingFlags)if(h){const $=new Set(Object.keys(h).filter(k=>{var M;return!(!((M=h[k])===null||M===void 0)&&M.failed)}));v=f(f({},n),Object.fromEntries(Object.entries(v).filter(([k])=>$.has(k))));const O=Object.fromEntries(Object.entries(_||{}).filter(([k])=>$.has(k)));_=f(f({},o),O),$.forEach(k=>{k in O||_==null||delete _[k]}),x=f(f({},a),Object.fromEntries(Object.entries(x||{}).filter(([k])=>$.has(k))))}else v=f(f({},n),v),_=f(f({},o),_),x=f(f({},a),x);return f(f({[Ue]:Object.keys(io(v)),[Ae]:v||{},[tt]:_||{},[vt]:x||{},[Zt]:r.minimalFlagCalledEvents===!0},g?{[gt]:g}:{}),m?{[nt]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),s,this.$);if(i)if(s?.persist===!1){const r=!b(this.po.kv.get(Ae));this.Cd=i,r||this.At(i)}else this.md(),this.Id(i,e,!!s?.partialResponse),this.At(i);else t&&this.$d();t||(this.Yc=!1),this.bd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Nd(e)}Nd(e){if(this.po){if(e===!1)return this.Lt([Ne,pt]),this.bd(),void ct.info("All overrides cleared");if(C(e))return this.At({[Ne]:so(e)}),this.bd(),void ct.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const s=e;this.Hc=!!((t=s.suppressWarning)!==null&&t!==void 0&&t);const i={},r=s.flags,n=s.payloads;return r&&(i[Ne]=C(r)?so(r):r),n&&(i[pt]=n),Object.keys(i).length&&this.At(i),r===!1&&n===!1?this.Lt([Ne,pt]):r===!1?this.Lt(Ne):n===!1&&this.Lt(pt),this.bd(),r===!1?ct.info("Flag overrides cleared"):r&&ct.info("Flag overrides set",{flags:r}),void(n===!1?ct.info("Payload overrides cleared"):n&&ct.info("Payload overrides set",{payloads:n}))}if(e&&typeof e=="object")return this.At({[Ne]:e}),this.bd(),void ct.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Vc){const{flags:t,flagVariants:s}=this.qd();try{e(t,s)}catch(i){this.$.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var i;const r=(this.xd("$early_access_features")||[]).find(u=>u.flagKey===e),n={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),s&&(o.$feature_enrollment_stage=s);const a=f(f({},this.getFlagVariants()),{},{[e]:t});(i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(n)}),this.At({[Ue]:Object.keys(io(a)),[Ae]:a,[st]:f(f({},this.xd("$stored_person_properties")||{}),n)}),this.bd();try{var l;(l=this.po)===null||l===void 0||l.capture("$feature_enrollment_update",o).catch(u=>{this.$.error("Failed to capture early access feature enrollment",u)})}catch(u){this.$.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,s){const i=this.xd(Qi);!i||t?this.jd(e,s):e(i)}jd(e,t){var s=this;return X(function*(){const i=s.po;if(!i)return;const r=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let n;try{const o=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n=o.json.earlyAccessFeatures,s.At({[Qi]:n})}catch(o){return void s.$.error("Early access feature request failed",o)}try{e(n)}catch(o){s.$.error("Early access feature callback failed",o)}})()}qd(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(s=>t[s]),flagVariants:Object.keys(t).filter(s=>t[s]).reduce((s,i)=>(s[i]=t[i],s),{})}}bd(e){this.yd();const{flags:t,flagVariants:s}=this.qd();this.featureFlagEventHandlers.forEach(i=>{try{i(t,s,{errorsLoading:e})}catch(r){this.$.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,t=!0){this.Bd(e,t)}Bd(e,t=!0){const s=this.xd("$stored_person_properties")||{},i=e?.$set||(e?.$set_once?{}:e),r=e?.$set_once,n={};if(r)for(const o in r)({}).hasOwnProperty.call(r,o)&&(o in s||(n[o]=r[o]));this.At({[st]:f(f(f({},s),n),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const s=f({},this.xd("$stored_person_properties")||{});e.forEach(i=>{delete s[i]}),this.At({[st]:s}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(st),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const s=this.xd("$stored_group_properties")||{},i=f({},s);for(const r of Object.keys(e))i[r]=f(f({},s[r]),e[r]);this.At({[it]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.xd("$stored_group_properties")||{};this.At({[it]:f(f({},t),{},{[e]:{}})})}else this.Lt(it)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Xc=0}}},Th={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Hd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.zd==="awaiting_config"||this.zd==="missing_config"?this.zd:(e=(t=this.Hd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.zd=Ti,this.Ud=void 0,this.Wd=!1,this.Ke=(()=>{var t,s;if(!w?.visibilityState||w.visibilityState==="visible")return!0;const i=y==null||(t=y.performance)===null||t===void 0||(s=t.getEntriesByType)===null||s===void 0?void 0:s.call(t,"visibility-state");return!i?.length||i.some(r=>r.name==="visible")})(),this.an=()=>{var t,s;w?.visibilityState==="visible"&&(this.Ke=!0,(t=this.Hd)===null||t===void 0||(s=t.setDocumentWasEverVisible)===null||s===void 0||s.call(t,!0))},!this._instance.sessionManager)throw qe.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');w?.addEventListener&&W(w,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Wd=!0,w==null||(t=w.removeEventListener)===null||t===void 0||t.call(w,"visibilitychange",this.an),e?this.Vd(!0):this.stopRecording()}get Gd(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),s=!this.Mr.disable_session_recording,i=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return y&&t&&s&&!i}startIfEnabledOrStop(e){var t;if(this.Wd||this.Gd&&(!((t=this.Hd)===null||t===void 0)&&t.isStarted))return;const s=!b(Object.assign)&&!b(Array.from);this.Gd&&s?(this.Zd(e),qe.info("starting")):(this.zd=Ti,this.stopRecording())}Zd(e){var t,s;if(this.Gd)if(this.zd!=="awaiting_config"&&this.zd!=="missing_config"&&(this.zd=Gn),(I==null||(t=I.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((s=I.__PosthogExtensions__)===null||s===void 0?void 0:s.initSessionRecording))this.Qd(e);else{var i,r;const n=this._instance.sessionManager;(i=I.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this._instance,this.Jd,o=>{if(!this.Wd&&this.Gd&&this._instance.sessionManager===n)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),qe.error("could not load recorder",o)):void this.Qd(e);this.zd="disabled"})}}stopRecording(){var e,t;(e=this.Ud)===null||e===void 0||e.call(this),this.Ud=void 0,(t=this.Hd)===null||t===void 0||t.stop()}Vd(e=!1){var t,s;(t=this.Ud)===null||t===void 0||t.call(this),this.Ud=void 0,(s=this.Hd)===null||s===void 0||s.discard({discardProducerEvents:e})}Kd(){var e,t;(e=this.xa)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.xa)===null||t===void 0||t.unregister("$replay_sample_rate")}Yd(e,t){if(T(e))return null;const s=re(e)?e:parseFloat(e);return typeof(i=s)!="number"||!Number.isFinite(i)||0>i||i>1?(qe.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):s;var i}Xd(e){if(this.xa){var t,s;const i=this.xa,r=()=>{var n;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.Yd((n=this.Mr.session_recording)===null||n===void 0?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Yd(o?.sampleRate,"remote config sampleRate"),u=a??l;T(u)&&this.Kd();const c=o?.minimumDurationMilliseconds;i.register({[Yt]:f(f({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:f({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:b(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};r(),(t=this.Ud)===null||t===void 0||t.call(this),this.Ud=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.onSessionId(r)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Xd(t),void this.Vd()):(this.Xd(t),void this.startIfEnabledOrStop()):(this.zd==="awaiting_config"&&(this.zd="missing_config",qe.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var s;!((s=this.Hd)===null||s===void 0)&&s.log?this.Hd.log(e,t):qe.warn("log called before recorder was ready")}get Jd(){var e,t;const s=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Yt);return(s==null||(t=s.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}tv(){const e=this._instance.get_property(Yt);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(s){return qe.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}return!T(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Qd(e){var t,s,i;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(!((t=I.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return qe.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ka]:!0});var r;if(this.Hd||(this.Hd=(r=I.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv())return this.zd==="missing_config"||this.zd==="awaiting_config"?void 0:(this.zd="awaiting_config",qe.info("persisted remote config is stale, requesting fresh config before starting"),void new Ja(this._instance).load());this.zd=Gn,(s=(i=this.Hd).setDocumentWasEverVisible)===null||s===void 0||s.call(i,this.Ke),this.Hd.start(e)}else this.zd=Ti}onRRwebEmit(e){var t,s;(t=this.Hd)===null||t===void 0||(s=t.onRRwebEmit)===null||s===void 0||s.call(t,e)}overrideLinkedFlag(){var e,t;this.Hd||(t=this.xa)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Hd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Hd||(t=this.xa)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Hd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,s;this.Hd||(s=this.xa)===null||s===void 0||s.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Hd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Hd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var s;return!!(!((s=this.Hd)===null||s===void 0)&&s.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Hd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},Ah={autocapture:class extends ph{constructor(e){super(new fh(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.nv();return!!(e.path||e.search||this.sv(e))}startIfEnabled(){this.isEnabled&&(E.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,E.info("History API monitoring stopped")}monitorHistoryChanges(){y&&y.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(e){var t;if(!y||!((t=y.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const s=this;_l(y.history,e,i=>function(r,n,o){i.call(this,r,n,o),s.hv(e)})}iv(){const e=y?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}nv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:A(e)?e:{}}sv(e=this.nv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}dv(e){const t=this.nv(),s=this.ev;return!(!s||!(t.path&&e.pathname!==s.pathname||t.search&&e.search!==s.search||this.sv(t)&&e.hash!==s.hash))}hv(e){try{const t=this.iv();if(!t)return;this.dv(t)&&this._instance.capture(Mr,{navigation_type:e}),this.ev=t}catch(t){E.error(`Error capturing ${e} pageview`,t)}}av(){if(this.rv)return;const e=()=>{this.hv("popstate")};W(y,"popstate",e),this.rv=()=>{y&&y.removeEventListener("popstate",e)}}uv(){if(this.ov)return;const e=()=>{this.hv("hashchange")};W(y,"hashchange",e),this.ov=()=>{y&&y.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.vv=!1,this.bo=!1,this.fv=null,this.instance=e,this.vv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Ji]),this.rageclicks=new gl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return A(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return T(this.Mr.capture_heatmaps)?T(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.bo)return;mh.info("starting..."),this.pv(),this.an()}else{var e;clearInterval((e=this.fv)!==null&&e!==void 0?e:void 0),this.gv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const s=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ji]:s}),this.vv=s,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}mv(e){Ai(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv=w?.visibilityState==="visible"?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){y&&w&&(this.yv=this.fa.bind(this),W(y,qs,this.yv),this.bv=e=>this.Cr(e||y?.event),W(w,"click",this.bv,{capture:!0}),this._v=e=>this.wv(e||y?.event),W(w,"mousemove",this._v,{capture:!0}),this.Sv=new kn(this.instance,wc,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),W(w,ls,this.xv),this.bo=!0)}gv(){var e;y&&w&&(this.yv&&y.removeEventListener(qs,this.yv),this.bv&&w.removeEventListener("click",this.bv,{capture:!0}),this._v&&w.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&w.removeEventListener(ls,this.xv),clearTimeout(this.Cv),(e=this.Sv)===null||e===void 0||e.stop(),this.bo=!1)}$v(e,t){const s=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){let u=o;for(;u&&He(u)&&!ge(u,"body");){if(u===l)return!1;let d;try{var c,h,p;d=(c=(h=(p=u.ownerDocument)===null||p===void 0?void 0:p.defaultView)!==null&&h!==void 0?h:y)===null||c===void 0?void 0:c.getComputedStyle(u).position}catch{return!1}if(R(a,d))return!0;u=Ca(u)}return!1})(Qt(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:i),y:e.clientY+(n?0:s),target_fixed:n,type:t}}Cr(e,t="click"){var s;if(fn(e.target)||!Ai(e))return;const i=this.$v(e,t);!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Ta(Qt(e),this.instance.config.rageclick)&&this.Zs(f(f({},i),{},{type:"rageclick"})),this.Zs(i)}wv(e){!fn(e.target)&&Ai(e)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(e,"mousemove"))},500))}Zs(e){if(!y)return;const t=this.Mr.disable_capture_url_hashes?ot(y.location.href):y.location.href,s=this.Mr.custom_personal_data_properties,i=this.Mr.mask_personal_data_properties?[...At,...s||[]]:[],r=hs(t,i,ds);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fa(){this.Rt&&!ke(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:kn,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",f({$current_url:this.Rt.url},this.Rt.metrics.reduce((s,i)=>f(f({},s),{},{[`$web_vitals_${i.name}_event`]:f({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=s=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},T(s?.name)||T(s?.value))return void ut.error("Invalid metric received",s);const r=typeof s.navigationURL=="string"?s.navigationURL:void 0,n=this.Ev(r);if(b(n))return;const o=re(s.navigationId)||typeof s.navigationId=="string"?`navigation:${s.navigationId}`:`url:${n}`;if(this.Pv&&s.value>=this.Pv)return void ut.error("Ignoring metric with value >= "+this.Pv,s);this.Rt.navigationKey!==o&&(this.Tv(),this.Iv=setTimeout(this.Tv,this.flushToCaptureTimeoutMs)),b(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=n),this.Rt.firstMetricTimestamp=b(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),l=f(f(f({},s),r?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,A(s.attribution)&&this.attributionMetrics.indexOf(s.name)>-1){const u={};for(const c of _h){const h=c==="url"&&typeof s.attribution[c]=="string"?this.Ev(s.attribution[c]):s.attribution[c];b(h)||(u[c]=h)}l.attribution=u}else delete l.attribution;b(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.Tv()},this.Rv=()=>{if(this.bo)return;let s,i,r,n,o=!1;const a=I.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,u=l?.[this.Av]||(this.Av==="web-vitals"&&b(l)?a?.postHogWebVitalsCallbacks:void 0);if(!b(u)){const p=u.withoutAttribution,d=this.attributionMetrics;o=!b(p),s=d.indexOf("LCP")>-1?u.onLCP:p?.onLCP||u.onLCP,i=d.indexOf("CLS")>-1?u.onCLS:p?.onCLS||u.onCLS,r=d.indexOf("FCP")>-1?u.onFCP:p?.onFCP||u.onFCP,n=d.indexOf("INP")>-1?u.onINP:p?.onINP||u.onINP}if(!(s&&i&&r&&n))return void ut.error("web vitals callbacks not loaded - not starting");const c={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?f(f({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&s(this.Mv.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Mv.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Mv.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&n(this.Mv.bind(this),h),this.bo=!0},this.vv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Zi]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const s=A(this.Fv)?(e=this.Fv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return T(s)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||Un:s}get flushToCaptureTimeoutMs(){return(A(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=A(this.Fv)?this.Fv.web_vitals_attribution:void 0;return $e(e)?e?Un:[]:C(e)?e:gh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=A(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Pv(){const e=A(this.Fv)&&re(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Wn;return e>0&&6e4>=e?Wn:e}get isEnabled(){const e=ee?.protocol;if(e!=="http:"&&e!=="https:")return ut.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=A(this.Fv)?this.Fv.web_vitals:$e(this.Fv)?this.Fv:void 0;return $e(t)?t:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&(ut.info("enabled, starting..."),this.No(this.Rv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const s=A(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=A(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Zi]:s}),this._instance.persistence.register({[pa]:i})),this.vv=s,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(e){var t;const s=I.__PosthogExtensions__,i=this.Av,r=s?.postHogWebVitalsCallbacksByFlavor;r?.[i]||i==="web-vitals"&&b(r)&&s?.postHogWebVitalsCallbacks?e():s==null||(t=s.loadExternalDependency)===null||t===void 0||t.call(s,this._instance,i,n=>{n?ut.error("failed to load script",n):e()})}Ev(e){const t=e||y?.location.href;if(!t)return void ut.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?ot(t):t,i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...At,...i||[]]:[];return hs(s,r,ds)}}},Lh={exceptionObserver:class{constructor(e){var t;this.Rv=()=>{var s;if(!y||!this.isEnabled||!(!((s=I.__PosthogExtensions__)===null||s===void 0)&&s.errorWrappingFunctions))return;const i=I.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=I.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=I.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=i(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=r(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=n(this.captureException.bind(this)))}catch(o){Ut.error("failed to start",o),this.Nv()}},this._instance=e,this.qv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Xi]),this.wt=new Tl(f(f({},(function(s={}){var i,r,n,o;return{refillRate:(i=(r=s.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:s.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(n=(o=s.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:s.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Ut})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return A(e)?t=f(f({},t),e):(b(e)?this.qv:e)&&(t=f(f({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ut.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(e){var t,s,i;!((t=I.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(s=I.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"exception-autocapture",r=>{if(r)return Ut.error("failed to load script",r);e()})}Nv(){var e,t,s;(e=this.Ov)===null||e===void 0||e.call(this),this.Ov=void 0,(t=this.Dv)===null||t===void 0||t.call(this),this.Dv=void 0,(s=this.Lv)===null||s===void 0||s.call(this),this.Lv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.qv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Xi]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}captureException(e){try{var t,s,i;const r=(t=e==null||(s=e.$exception_list)===null||s===void 0||(s=s[0])===null||s===void 0?void 0:s.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(r))return void Ut.info("Skipping exception capture because of client rate limiting.",{exception:r});(i=this._instance.exceptions)===null||i===void 0||i.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,s;this.Bv=[],this.Hv=new Ul([new au,new gu,new uu,new lu,new fu,new pu,new hu,new vu],(function(i,...r){return(n,o=0)=>{const a=[],l=n.split(`
|
|
3
|
-
`),u=Math.min(l.length,o+1e3),c=[];for(let d=o;u>d;d++){const g=l[d];if(g.length>1024)continue;const m=Yr.test(g)?g.replace(Yr,"$1"):g;if(!m.match(/\S*Error: /)){for(const v of r){const _=v(m,i);if(_){a.push(_);const x=iu(a);if(x){for(let $=c.length-1;$>=0;$--){const O=c[$];if(x.start>=O.start+O.length)break;c.pop()}c.push(x)}break}}if(nu(a,c)>=50)break}}const h=[...c].sort((d,g)=>g.start-d.start),p=h[h.length-1];if(p){const d=Ko(a,p);a.splice(p.start-d,d);for(const g of h)g.start-=d}for(const d of h)ru(a,d);return c.some(d=>d.start===0&&a.length===d.length)&&(function(d){const g=d.map(v=>`${v.function}|${v.filename}|${v.lineno}|${v.colno}|${v.module}`);let m=0;for(let v=1;g.length>v;v++)ou(g,v,m)&&(m=v);d.push(...d.splice(0,m))})(a),(function(d){if(!d.length)return[];const g=Array.from(d);return g.reverse(),g.slice(0,50).map(m=>{return f(f({},m),{},{filename:m.filename||(v=g,v[v.length-1]||{}).filename,function:m.function||"?"});var v})})(a)}})("web:javascript",Ql,su)),this._instance=e,this.Bv=(t=(s=this._instance.persistence)===null||s===void 0?void 0:s.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.zv=Ns(this.Uv()),this.Wv=new mu(this.zv)}onConfigChange(){this.zv=Ns(this.Uv()),this.Wv.setConfig(this.zv)}onRemoteConfig(e){var t,s,i;if(!e.ok)return;const r=e.config;if(!("errorTracking"in r))return;const n=(t=(s=r.errorTracking)===null||s===void 0?void 0:s.suppressionRules)!==null&&t!==void 0?t:[],o=(i=r.errorTracking)===null||i===void 0?void 0:i.captureExtensionExceptions;this.Bv=n,this._instance.persistence&&this._instance.persistence.register({[ha]:this.Bv,[Yi]:o})}get Vv(){var e;const t=!!this._instance.get_property(Yi),s=this._instance.config.error_tracking.captureExtensionExceptions;return(e=s??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Hv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.zv.enabled)try{if(!L(e)||e.trim().length===0)return void Ce.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:s,droppedKeys:i}=(function(r){if(!r)return{sanitizedProperties:{},droppedKeys:[]};const n=[];return{sanitizedProperties:Object.keys(r).reduce((o,a)=>_u.has(a)?(n.push(a),o):(o[a]=r[a],o),{}),droppedKeys:n}})(this.Gv(t));i.length>0&&Ce.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Wv.add(f({[Ls]:e,[Ds]:new Date().toISOString()},s))}catch(s){Ce.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.Zv(t)){if(this.Qv(t))return this.Jv("Exception dropped: matched a suppression rule"),void Ce.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(t))return this.Jv("Exception dropped: thrown by a browser extension"),void Ce.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Yv(t))return this.Jv("Exception dropped: thrown by an injected browser script"),void Ce.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Xv(t))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void Ce.info("Skipping exception capture because it was thrown by the PostHog SDK")}const s=this.zv.enabled&&T(e.$exception_steps)?this.tf(e):e,i=(function(){const r=globalThis._posthogReleaseId;return typeof r=="string"&&r.length>0?r:void 0})();i&&(s.$release_id=i);try{const r=this._instance.capture("$exception",s,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return r&&this.Wv.clear(),r}catch(r){return ro(r)||Ce.error("Failed to capture exception event. Dropping this exception.",r),void this.Wv.clear()}}catch(t){return void(ro(t)||Ce.error("Failed to process exception event. Ignoring this exception.",t))}}tf(e){try{const t=this.Wv.getAttachable();return t.length===0?e:f(f({},e),{},{$exception_steps:t})}catch(t){return Ce.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Jv(e){this.zv.enabled&&this.Wv.add({[Ls]:e,[Ds]:new Date().toISOString()})}Gv(e){return A(e)?f({},e):{}}Uv(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Qv(e){if(e.length===0)return!1;try{const t=e.reduce((s,{type:i,value:r})=>(L(i)&&i.length>0&&s.$exception_types.push(i),L(r)&&r.length>0&&s.$exception_values.push(r),s),{$exception_types:[],$exception_values:[]});return this.Bv.some(s=>{const i=s.values.map(r=>{const n=hl[r.operator],o=t[r.key];if(!n||!o)return!1;const a=C(r.value)?r.value:[r.value];return a.length>0&&n(a,o)});return s.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return Ce.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Kv(e){const t=e.flatMap(i=>{var r,n;return(r=(n=i.stacktrace)===null||n===void 0?void 0:n.frames)!==null&&r!==void 0?r:[]}),s=t.filter(({filename:i})=>!!i&&Fh.some(r=>i.startsWith(r)));return s.length!==0&&(!s.every(({filename:i})=>!!i&&i.startsWith(gr))||e.some(({type:i,value:r})=>i==="NoResponse"||L(r)&&Mh.some(({value:n,exact:o})=>o?r===n:r.includes(n)))&&!t.some(({in_app:i,filename:r})=>i&&!r?.startsWith(gr)))}Yv(e){return e.some(({value:t})=>L(t)&&Oh.some(s=>t.includes(s)))}Xv(e){if(e.length>0){var t,s,i,r;const n=(t=(s=e[0].stacktrace)===null||s===void 0?void 0:s.frames)!==null&&t!==void 0?t:[],o=n[n.length-1];return(i=o==null||(r=o.filename)===null||r===void 0?void 0:r.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Zv(e){return!T(e)&&C(e)}}},Dh=f({productTours:class{get xa(){return this._instance.persistence}constructor(e){this.ef=null,this.if=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var s,i;if(this.xa&&this.xa.register({[Er]:!!t.productTours}),!Li(this._instance))return!this.ef&&T((s=this.xa)===null||s===void 0?void 0:s.props.ph_product_tours)||Es.info("product tours disabled; stopping and clearing cached tours"),(i=this.ef)===null||i===void 0||i.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&Li(this._instance)&&this.No(()=>this.nf())}No(e){var t,s,i;!((t=I.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(s=I.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"product-tours",r=>{r?Es.error("Could not load product tours script",r):e()})}nf(){var e;!this.ef&&(!((e=I.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.ef=I.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(C(this.if)&&!t)return void e(this.if,{isLoaded:!0});const s=this.xa;if(s){const i=s.props[tr];if(C(i)&&!t)return this.if=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!Li(this._instance))return void e([],{isLoaded:!0});const r=i.statusCode;if(r!==200||!i.json){const o=`Product Tours API could not be loaded, status: ${r}`;return r===0?i.error||Es.warn(o):Es.error(o),void e([],{isLoaded:!1,error:o})}const n=C(i.json.product_tours)?i.json.product_tours:[];this.if=n,s&&s.register({[tr]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){T(this.ef)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ef)===null||t===void 0||t.showTourById(e)}previewTour(e){this.ef?this.ef.previewTour(e):this.No(()=>{var t;this.nf(),(t=this.ef)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.ef)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.ef)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.ef)===null||e===void 0||e.previousStep()}clearCache(){var e;this.if=null,(e=this.xa)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.ef)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.ef)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ef)===null||t===void 0||t.cancelPendingTour(e)}}},ei),Nh={siteApps:class{constructor(e){this._instance=e,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(e,t){if(!t)return;const s=this.globalsForEvent(t);this.rf.push(s),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}get siteAppLoaders(){var e;return(e=I._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.lf.bind(this));this.af=()=>{e(),this.rf=[],this.af=void 0}}}globalsForEvent(e){var t,s,i,r,n,o,a;if(!e)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[d,g]of Object.entries(c))l[d]={id:u[d],type:d,properties:g};const{$set_once:h,$set:p}=e;return{event:f(f({},Qo(e,yh)),{},{properties:f(f(f({},e.properties),p?{$set:f(f({},(t=(s=e.properties)===null||s===void 0?void 0:s.$set)!==null&&t!==void 0?t:{}),p)}:{}),h?{$set_once:f(f({},(i=(r=e.properties)===null||r===void 0?void 0:r.$set_once)!==null&&i!==void 0?i:{}),h)}:{}),elements_chain:(n=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}uf(e){var t;const s=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return s==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(De.error("prepare_external_dependency_stylesheet returned null"),null):s==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(De.error("prepare_external_dependency_script returned null"),null):e}hf(){var e,t,s,i,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const l=w?.defaultView,u=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!u)return()=>{};if(this.sf++,this.cf)return this.df();const c=[],h=this,p=new WeakSet,d=(v,_,x)=>{if(!v?.[_])return;const $=v[_];v[_]=x($),c.push(()=>{v[_]=$})},g=v=>{if(p.has(v))return v;const _=h.uf(v);return _&&p.add(_),_},m=v=>v.map(_=>typeof _=="string"?_:g(_)).filter(_=>!ie(_));return d(u,"appendChild",v=>function(_){const x=g(_);return x?v.call(this,x):_}),d(u,"insertBefore",v=>function(_,x){const $=g(_);return $?v.call(this,$,x):_}),d(u,"replaceChild",v=>function(_,x){const $=g(_);return $?v.call(this,$,x):x}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(s=l.Document)===null||s===void 0?void 0:s.prototype,(i=l.DocumentFragment)===null||i===void 0?void 0:i.prototype].forEach(v=>{d(v,"append",_=>function(...x){return _.apply(this,m(x))}),d(v,"prepend",_=>function(...x){return _.apply(this,m(x))})}),[(r=l.Element)===null||r===void 0?void 0:r.prototype,(n=l.CharacterData)===null||n===void 0?void 0:n.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(v=>{d(v,"before",_=>function(...x){return _.apply(this,m(x))}),d(v,"after",_=>function(...x){return _.apply(this,m(x))}),d(v,"replaceWith",_=>function(...x){const $=m(x);return x.length&&!$.length?void 0:_.apply(this,$)})}),d((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",v=>function(_,x){const $=g(x);return $?v.call(this,_,$):null}),this.cf=()=>{c.forEach(v=>v()),this.cf=void 0},this.df()}df(){let e=!1;return()=>{var t;e||(e=!0,this.sf--,this.sf===0&&((t=this.cf)===null||t===void 0||t.call(this)))}}vf(e,t=!0){const s=this.hf();try{const i=e(s);return t&&s(),i}catch(i){throw s(),i}}setupSiteApp(e){const t=this.apps[e.id],s=()=>{var n;!t.errored&&this.rf.length&&(De.info(`Processing ${this.rf.length} events for site app with id ${e.id}`),this.rf.forEach(o=>this.vf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((n=this.af)===null||n===void 0||n.call(this))};let i=!1;const r=n=>{t.errored=!n,t.loaded=!0,De.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),i&&s()};try{const{processEvent:n}=this.vf(o=>e.init({posthog:this._instance,callback(a){o(),r(a)}}),!1);n&&(t.processEvent=n),i=!0}catch(n){De.error(Kn+e.id,n),r(!1)}if(i&&t.loaded)try{s()}catch(n){De.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}ff(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}pf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const s of Object.values(this.apps))try{this.vf(()=>{var i;return(i=s.processEvent)===null||i===void 0?void 0:i.call(s,t)})}catch(i){De.error(`Error while processing event ${e.event} for site app ${s.id}`,i)}}onRemoteConfig(e){var t,s,i;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.ff(),void this._instance.on("eventCaptured",a=>this.pf(a))):void De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this.af)===null||s===void 0||s.call(this),!e.ok)return;const r=e.config;if(!((i=r.siteApps)===null||i===void 0)&&i.length)if(this.isEnabled)for(const{id:a,url:l}of r.siteApps){var n,o;I[`__$$ph_site_app_${a}`]=this._instance,(n=I.__PosthogExtensions__)===null||n===void 0||(o=n.loadSiteApp)===null||o===void 0||o.call(n,this._instance,l,u=>{if(u)return De.error(Kn+a,u)})}else De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},jh={tracingHeaders:class{constructor(e){this._instance=e,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const t=this.bf();var s,i;t?(b(this.gf)&&(this.gf=(s=I.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),b(this.mf)&&(this.mf=(i=I.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Nv()}}initialize(){this.startIfEnabledOrStop()}No(e){var t,s,i;!((t=I.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(s=I.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"tracing-headers",r=>{if(r)return vh.error("failed to load script",r);e()})}_f(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}bf(){const e=this._f();return C(e)?(C(this.yf)?this.yf.splice(0,this.yf.length,...e):this.yf=[...e],e.length>0?this.yf:void 0):(C(this.yf)&&this.yf.splice(0),this.yf=e||void 0,this.yf)}Nv(){var e,t;(e=this.gf)===null||e===void 0||e.call(this),(t=this.mf)===null||t===void 0||t.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},Bh=f({surveys:class extends bh{constructor(e){var t;super(new Eh(e),(t=e,{get projectToken(){return t.config.token},kv:new kh(t)})),this._instance=e}Mh(e,t){const s=t.query?vs(e,t.query):e;return new Promise(i=>{var r;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",s),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:i})})}}},ei),Hh={toolbar:class{constructor(e){this.instance=e}wf(e){I.ph_toolbar_state=e}kf(){var e;return(e=I.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,s=void 0){var i,r;if(rr(this.instance.config)||!y||!w)return!1;e=(i=e)!==null&&i!==void 0?i:y.location,s=(r=s)!==null&&r!==void 0?r:y.history;try{if(!t){try{y.localStorage.setItem("test","test"),y.localStorage.removeItem("test")}catch{return!1}t=y?.localStorage}const n=Sh||Ws(e.hash,"__posthog")||Ws(e.hash,"state");let o;const a=n?Gr(()=>JSON.parse(atob(decodeURIComponent(n))))||Gr(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(Xn)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Sf(e){const t=I.ph_load_toolbar||I.ph_load_editor;!T(t)&&ve(t)?t(e,this.instance):Yn.warn("No toolbar load function found")}loadToolbar(e){const t=!!w?.getElementById("__POSTHOG_TOOLBAR__");if(!y||t)return!1;const s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=f(f({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(y.localStorage.setItem(Xn,JSON.stringify(f(f({},i),{},{source:void 0}))),this.kf()===2)this.Sf(i);else if(this.kf()===0){var r,n;this.wf(1),(r=I.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"toolbar",o=>{if(o)return Yn.error("[Toolbar] Failed to load",o),void this.wf(0);this.wf(2),this.Sf(i)}),W(y,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(i)})}return!0}xf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,s=void 0){return this.maybeLoadToolbar(e,t,s)}}},zh=f({experiments:class be{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(s=!1)=>{this.getWebExperiments(i=>{be.Cf("retrieved web experiments from the server"),this.$f=new Map,i.forEach(r=>{if(r.feature_flag_key){var n;this.$f&&(be.Cf("setting flag key ",r.feature_flag_key," to web experiment ",r),(n=this.$f)===null||n===void 0||n.set(r.feature_flag_key,r));const o=this._instance.getFeatureFlag(r.feature_flag_key);L(o)&&r.variants[o]&&this.Tf(r.name,o,r.variants[o].transforms)}else if(r.variants)for(const o in r.variants){const a=r.variants[o];be.If(a,this._instance)&&this.Tf(r.name,o,a.transforms)}})},s)},this._instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}initialize(){}onFeatureFlags(t){if(this._is_bot())be.Cf(no);else if(!this.Mr.disable_web_experiments){if(T(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();be.Cf("applying feature flags",t),t.forEach(s=>{var i;if(this.$f&&(!((i=this.$f)===null||i===void 0)&&i.has(s))){var r;const n=this._instance.getFeatureFlag(s),o=(r=this.$f)===null||r===void 0?void 0:r.get(s);n&&o?.variants[n]&&this.Tf(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){const t=be.getWindowLocation();if(t?.search){const s=Tt(t?.search,"__experiment_id"),i=Tt(t?.search,"__experiment_variant");s&&i&&(be.Cf(`previewing web experiments ${s} && ${i}`),this.getWebExperiments(r=>{this.Mf(parseInt(s),i,r)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,s,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const r=this._instance.get_property("$web_experiments");if(r&&!s)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Mf(t,s,i){const r=i.filter(n=>n.id===t);r&&r.length>0&&(be.Cf(`Previewing web experiment [${r[0].name}] with variant [${s}]`),this.Tf(r[0].name,s,r[0].variants[s].transforms))}static If(t,s){return!T(t.conditions)&&be.Ef(t,s)&&be.Pf(t)}static Ef(t,s){var i;if(T(t.conditions)||T((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const r=be.getWindowLocation();if(r){var n,o,a;const l=Fa(s,r.href);return!(!((n=t.conditions)===null||n===void 0)&&n.url)||Ih[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return y?.location}static Pf(t){var s;if(T(t.conditions)||T((s=t.conditions)===null||s===void 0?void 0:s.utm))return!0;const i=Ha();if(i.utm_source){var r,n,o,a,l,u,c,h;const p=!(!((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0)&&r.utm_campaign)||((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0?void 0:n.utm_campaign)==i.utm_campaign,d=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==i.utm_source,g=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_medium)==i.utm_medium,m=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==i.utm_term;return p&&g&&m&&d}return!1}static Cf(t,...s){E.info(`[WebExperiments] ${t}`,s)}Tf(t,s,i){this._is_bot()?be.Cf(no):s!=="control"?i.forEach(r=>{if(r.selector){var n;be.Cf(`applying transform of variant ${s} for experiment ${t} `,r);const o=(n=document)===null||n===void 0?void 0:n.querySelectorAll(r.selector);o?.forEach(a=>{const l=a;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):be.Cf("Control variants leave the page unmodified.")}_is_bot(){return de&&this._instance?ll(de,this.Mr.custom_blocked_useragents):void 0}}},ei),qh={conversations:class{constructor(e){this._instance=e,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Of=e.ok,!e.ok))return;const t=e.config.conversations;T(t)||($e(t)?this.Rf=t:(this.Rf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager||this.Af||this._instance.config.disable_conversations||rr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=I?.__PosthogExtensions__;if(e&&!b(this.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const t=e.initConversations;if(t)return this.Df(t),void(this.Af=!1);const s=e.loadExternalDependency;if(!s)return void this.Lf(Pr);s(this._instance,"conversations",i=>{i||!e.initConversations?this.Lf("Could not load conversations script",i):this.Df(e.initConversations),this.Af=!1})}catch(t){this.Lf("Error initializing conversations",t),this.Af=!1}}else Fe.error("Conversations enabled but missing token in remote config.")}Df(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Ff=!1,Fe.info("Conversations loaded successfully")}catch(t){this.Lf("Error completing conversations initialization",t)}else Fe.error("Cannot complete initialization: remote config is null")}Lf(e,t){Fe.error(e,t),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():Fe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rf===!0&&!ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":rr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Of===!1?"remote_config_failed":b(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?T(this.ne)||!this.ne.token?"missing_token":I?.__PosthogExtensions__?this.Af?"initializing":this.Ff?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,s){var i=this;return X(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,s):(Fe.warn(ht),null)})()}getMessages(e,t){var s=this;return X(function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,t):(Fe.warn(ht),null)})()}markAsRead(e){var t=this;return X(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Fe.warn(ht),null)})()}getTickets(e){var t=this;return X(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Fe.warn(ht),null)})()}requestRestoreLink(e){var t=this;return X(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Fe.warn(ht),null)})()}restoreFromToken(e){var t=this;return X(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Fe.warn(ht),null)})()}restoreFromUrlToken(){var e=this;return X(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Fe.warn(ht),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}dh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}fh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},Vh={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=ne("[logs]"),this.Bf=f(f({},this.$),{},{error:(...s)=>{s.some(lo)||this.$.error(...s)}}),this.ia=[],this.Hf=[],this.Xc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var s,i;this.So||(this.Xc=0,(s=this.Zf)===null||s===void 0||s.onReconnect(),(i=this.Qf)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Nf=!0),y&&W(y,"online",this.Gf)}Jf(e,t,s,i){var r;const n=oo((r=this._instance)===null||r===void 0||(r=r.config)===null||r===void 0?void 0:r.logs,s);return[new Mu(this.Kf(e,t),n,this.Bf,()=>this.Yf(),o=>o(),void 0,i),n]}Xf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var s;return this.Zf&&this.tp===t||((s=this.Zf)===null||s===void 0||s.reset(),this.tp=t,[this.Zf,this.ep]=this.Jf(()=>this.ia,i=>{this.ia=i})),this.Zf}np(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var s;return this.Qf&&this.sp===t||((s=this.Qf)===null||s===void 0||s.reset(),this.sp=t,[this.Qf,this.rp]=this.Jf(()=>this.Hf,i=>{this.Hf=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ao)),this.Qf}setup(e){var t;if(this.So)return;this.po=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();let s=!1;const i=e.onRemoteConfig(r=>{var n;s=r.ok&&((n=r.config.logs)===null||n===void 0?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)});this.So?i.dispose():(this.$o=i,s||this.loadIfEnabled())}dispose(){var e,t,s,i;this.So||(this.So=!0,this.up(),(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,y?.removeEventListener("online",this.Gf),(t=this.hp)===null||t===void 0||t.call(this),this.hp=void 0,(s=this.Zf)===null||s===void 0||s.reset(),(i=this.Qf)===null||i===void 0||i.reset())}onRemoteConfig(e){var t,s;if(this.So)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;T(i)?this.cp():((s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.register({$logs_capture_enabled_server_side:!!i}),i?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var e,t,s,i;this.up(),(e=this.Zf)===null||e===void 0||e.clearQueue(),this.ia=[],(t=this.Zf)===null||t===void 0||t.reset(),(s=this.Qf)===null||s===void 0||s.clearQueue(),this.Hf=[],(i=this.Qf)===null||i===void 0||i.reset(),this.Xc=0}captureLog(e){this.So||this.Xf().captureLog(e)}captureConsoleLog(e){this.So||this.np().captureLog(e)}captureBufferedConsoleLog(e,t,s){this.So||this.np().captureLog(e,{context:t,occurredAtMs:s})}lp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[da])}op(){var e,t,s;return!(!((e=this._instance)===null||e===void 0||(t=e.Yl)===null||t===void 0)&&t.call(e))||!!(!((s=I._POSTHOG_REMOTE_CONFIG)===null||s===void 0||(s=s[this._instance.config.token])===null||s===void 0)&&s.config)}gh(){var e;this.up(),(e=this.Qf)===null||e===void 0||e.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var e;if(this.Wf||!I?.console)return;const t=oo((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;for(const s of Ch){let i;try{i=Rh(I.console[s])}catch{continue}i&&this.Uf.push(_l(I.console,s,r=>{const n=(...o)=>{try{this.dp(s,o,t)}catch{}return r.apply(I.console,o)};return n.__rrweb_original__=i,n}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(e,t,s){var i;if(this.Wf&&!this.Vf&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(s>this.zf.length){this.Vf=!0;try{this.zf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Yf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const e of this.Uf)e();this.Uf=[]}}fp(){const e=this.zf;return this.up(),e}get logger(){return this.pp||(this.pp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.pp}flushLogs(e){e?this.gp(e):(this.Zf&&this.Zf.flush().catch(t=>this.mp(t)),this.Qf&&this.Qf.flush().catch(t=>this.mp(t)))}mp(e){lo(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const e=I?.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.up();const t=e.loadExternalDependency;if(!t)return this.$.error(Pr),void this.up();this.jf=!0;try{t(this._instance,"logs",s=>{if(this.jf=!1,this.So||!this.Nf)return;const i=e.logs;if(s||!i?.initializeLogs)this.$.error("Could not load logs script",s),this.up();else{var r;const a=this.fp();var n,o;this.hp=i.initializeLogs((r=this.po)!==null&&r!==void 0?r:this._instance),this.qf=!0,a.length>0&&((n=i.replayConsoleBuffer)===null||n===void 0||n.call(i,(o=this.po)!==null&&o!==void 0?o:this._instance,a))}})}catch(s){throw this.jf=!1,s}}Kf(e,t){const s=this._instance;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},getPersistedProperty:i=>i===je.LogsQueue?e():void 0,setPersistedProperty(i,r){var n;i===je.LogsQueue&&t((n=r)!==null&&n!==void 0?n:[])},js:i=>this.js(i),getLibraryId:()=>ce.LIB_NAME,getLibraryVersion:()=>ce.LIB_VERSION}}js(e){return new Promise(t=>{if(ja(this.Xc,3))return void t({kind:"fatal",error:Ni(void 0,"logs endpoint is unreachable, dropping batch")});let s=!1;const i=n=>{s||(s=!0,clearTimeout(r),t(n))},r=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Ni(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{const o=n.statusCode;if(this.bp(o),o>=200&&300>o)i({kind:"ok"});else if(o===413)i({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)i({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(n.error||this.$.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Ni(n.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(a=n.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}bp(e){(e!==0||this._instance.__loaded)&&(this.Xc=Ba(e,this.Xc,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}gp(e){this.ia.length>0&&this._p(e,this.ia,this.ep,ce.LIB_NAME,t=>{this.ia=t}),this.Hf.length>0&&this._p(e,this.Hf,this.rp,ao,t=>{this.Hf=t})}_p(e,t,s,i,r){if(t.length===0)return;const n=t.map(a=>a.record);r([]);const o=na(n,ra(s,ce.LIB_NAME,ce.LIB_VERSION),i,ce.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Yf(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:s,windowId:i,sessionStartTimestamp:r,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=s,t.windowId=i,T(r)||(t.sessionStartTimestamp=r),T(n)||(t.lastActivityTimestamp=n)}if(!(I==null||(e=I.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ot(I.location.href):I.location.href),this._instance.featureFlags){const s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},Wh={metrics:class{constructor(e){this._instance=e,this.$=ne("[metrics]")}initialize(){}Xf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var s;return this.Zf&&this.tp===t||((s=this.Zf)===null||s===void 0||s.reset(),this.tp=t,this.Zf=new Fu(this.Kf(),(function(i){var r,n,o,a,l;const u=i?.resourceAttributes;return{serviceName:(r=u?.["service.name"])!==null&&r!==void 0?r:i?.serviceName,serviceVersion:(n=u?.["service.version"])!==null&&n!==void 0?n:i?.serviceVersion,environment:(o=u?.["deployment.environment"])!==null&&o!==void 0?o:i?.environment,resourceAttributes:u,beforeSend:i?.beforeSend,flushIntervalMs:(a=i?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=i?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.$)),this.Zf}count(e,t=1,s){this.Xf().count(e,t,s)}gauge(e,t,s){this.Xf().gauge(e,t,s)}histogram(e,t,s){this.Xf().histogram(e,t,s)}flush(e){if(!this.Zf)return Promise.resolve();if(e){const t=this.Zf.drainWindow();return t&&this.Xs(t,e),Promise.resolve()}return this.Zf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Zf)===null||e===void 0||e.reset()}Kf(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Xs:s=>t.Xs(s),getLibraryId:()=>ce.LIB_NAME,getLibraryVersion:()=>ce.LIB_VERSION}}Xs(e,t){return new Promise(s=>{let i=!1;const r=o=>{i||(i=!0,clearTimeout(n),s(o))},n=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(f(f({method:"POST",url:this.wp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)r({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;r({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};rs.__defaultExtensionClasses=f({},f(f(f(f(f(f(f(f(f(f(f(f(f({},ei),Th),Ah),Lh),Dh),Nh),Bh),jh),Hh),zh),qh),Vh),Wh));const Uh=(function(){ce.SDK_DIST_CHANNEL="npm";const e=ss[Kt]=new rs;return(function(){function t(){t.done||(t.done=!0,vl=!1,V(ss,function(s){s._dom_loaded()}))}w?.addEventListener?w.readyState==="complete"?t():W(w,"DOMContentLoaded",t,{capture:!1}):y&&E.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var Gh=Uh;export{Pe as Compression,cr as DisplaySurveyType,rs as PostHog,Cc as ProductTourEventName,Mn as ProductTourEventProperties,Ke as SurveyEventName,ki as SurveyEventProperties,zt as SurveyEventType,$i as SurveyType,Gh as default,Uh as posthog};
|