tokentracker-cli 1.0.4 → 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-mGuF3SZV.js → AchievementBadge-Cvzhs6pY.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CqgkEdCy.js → AchievementsPage-C7BPBZV3.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-DVZBBX6U.js → AchievementsSection-Caq7GXWH.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-Cv_PJVWo.js → BadgeDetailModal-CNyhrYnI.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-CAqF-G07.js → BotAnimated-CbdhTKLO.js} +1 -1
- package/dashboard/dist/assets/{Card-yUa-1eMj.js → Card-63pzm8aU.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-CMG3gYTO.js → ClawdAnimated-D6R7x8lK.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-BENO2SWB.js → CommandPalette-CE7p2oa_.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-DrzMkmYd.js → CommunityStatsModal-D_bb4w1I.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-BzG_SVcZ.js → ConfirmModal-DrejafJF.js} +1 -1
- package/dashboard/dist/assets/{Controls-DiMs4jCI.js → Controls-T3TIbrLI.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-CJD5K2X9.js +1 -0
- package/dashboard/dist/assets/{DevicePage-JIPbcJj_.js → DevicePage-CH0Y9OHH.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-CAXMC_Ej.js → DialogClose-BcPHsqpR.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DmyWlOfj.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-BThuBA7Z.js → DialogTitle-Dv2oDI5S.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-D_7oApb1.js → FadeIn-DIS2Hg_z.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BfvlxDLm.js → HeaderGithubStar-zCGj7NYl.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-DNdNDNui.js → HoverTooltip-xu93BCaJ.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Bt2v2bcs.js → IpCheckPage-CpkJr3km.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CSlXEZtQ.js → LandingPage-Eyn9uYxu.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-Dd6Q1LT0.js → LeaderboardAvatar-CkmxdKjb.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BUf-DcVp.js → LeaderboardPage-CKIkMDP1.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-BCI81oDf.js → LeaderboardProfileModal-X9M1rppQ.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-CrE4dToF.js → LeaderboardProfilePage-CIl5kkOV.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-swNbh5fv.js → LimitsPage-B4knUk-Q.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-BDOSLg08.js → LocalOnlyNotice-Dn6VNOeU.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-BJflNfwb.js → LoginCard-C7PuEJfF.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-CxZ6cxtY.js → LoginModal-DniAEAmY.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-Ds85HImr.js → LoginPage-CQGtpRcn.js} +1 -1
- package/dashboard/dist/assets/{PetPage-DZbmph67.js → PetPage-CuWgQq4k.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-JzxAr4q_.js → PopoverPopup-DGzNxyIb.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-MDkXefRU.js → ProviderIcon-DQaFWAeK.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-CRvRNlWA.js → ResetPasswordPage-DChkikDi.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-Bbw7Dypd.js → SegmentedControl-B5dAFpXY.js} +1 -1
- package/dashboard/dist/assets/{Select-D1CFS_EY.js → Select-yR95Ye8E.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-CHj4a14t.js → SelectItemText-D0HFmSxi.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-DFJSyj3M.js → ServiceStatusPage-BIOYCpJC.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BvIA_7Db.js → SessionsPage-CgMiH2OU.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-DxiO3RuB.js → SettingsPage-C8RyB9Ix.js} +2 -2
- package/dashboard/dist/assets/{SkillsPage-C1lMnXpP.js → SkillsPage-DECls0UK.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-8ml284Vt.js → TokenGalaxy-Bq7myuhW.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-6-c1WW_C.js → ToolbarRootContext-B6Vylv9F.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-Dtb1Vw8P.js → TrendMonitor-BKIz_wQr.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DI0m4BOv.js → WidgetsPage-nzeiYO4K.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DlodZhPp.js → WrappedPage-BAmyIzRK.js} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-Bt5e-Los.js +45 -0
- package/dashboard/dist/assets/{agent-logos-D-NR9sq6.js → agent-logos-4obZkQVl.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DY2sXgRx.js → arrow-up-right-CY1_kE5T.js} +1 -1
- package/dashboard/dist/assets/{check-iVengRka.js → check-BxviipT2.js} +1 -1
- package/dashboard/dist/assets/{composite-DdGB3lqE.js → composite-2hzXjsh4.js} +1 -1
- package/dashboard/dist/assets/{copy-hls2Bt--.js → copy-CfMNihj_.js} +1 -1
- package/dashboard/dist/assets/{download-BAPBndt2.js → download-DZzFxl-w.js} +1 -1
- package/dashboard/dist/assets/{external-link-Ca5PZfay.js → external-link-CQuz6Zgz.js} +1 -1
- package/dashboard/dist/assets/{flame-D1yeuyUj.js → flame-VeZV_lsg.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-CGo6fsIE.js → format-tokens-Ja_zmwX2.js} +1 -1
- package/dashboard/dist/assets/{icons-Ba6V3IjJ.js → icons-DkgZ7tvc.js} +1 -1
- package/dashboard/dist/assets/{index-BTyWWSgS.js → index-BN84EpDx.js} +1 -1
- package/dashboard/dist/assets/{index-C93m3GcS.js → index-BvEF22jP.js} +1 -1
- package/dashboard/dist/assets/{index-CxRQ-BOI.js → index-CrhRL4Df.js} +1 -1
- package/dashboard/dist/assets/{info-DyDVFBHF.js → info-Br_ApCog.js} +1 -1
- package/dashboard/dist/assets/{link-2-gW7EnjBY.js → link-2-DWCwqx7W.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-CCBcIYQZ.js → loader-circle-C90Vw-cp.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-lQE0Y8sM.js → maximize-2-CpX7FEW3.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-Tonvsf-M.js → modifiers.esm-BawFoZCU.js} +1 -1
- package/dashboard/dist/assets/module-DtWfRKM4.js +3 -0
- package/dashboard/dist/assets/{monitor-smartphone-DxmsWtQn.js → monitor-smartphone-BKl8Af4G.js} +1 -1
- package/dashboard/dist/assets/{plus-B1xi3Vdy.js → plus-0tGsqhX-.js} +1 -1
- package/dashboard/dist/assets/{provider-display-DpZdlOXQ.js → provider-display-BaoN5oxN.js} +1 -1
- package/dashboard/dist/assets/{react-CXLTMo1j.js → react-hi31R77i.js} +1 -1
- package/dashboard/dist/assets/{search-vQged-EC.js → search-BVlP62JL.js} +1 -1
- package/dashboard/dist/assets/{skills-api-D7EpxvhF.js → skills-api-B6OC9Ae6.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-DMH9aB9A.js → sortable.esm-CUEUZVOz.js} +1 -1
- package/dashboard/dist/assets/{store-DJbKAU4R.js → store-DKMSwePW.js} +1 -1
- package/dashboard/dist/assets/{terminal-C2TY01x3.js → terminal-nBcu5xGC.js} +1 -1
- package/dashboard/dist/assets/{trash-G_ESCgKH.js → trash-BK5kjpsC.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-CIyY98uR.js → use-community-stats-CJxOcXiQ.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard--vNleRV1.js → use-latest-request-guard-DOd1FZ5E.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-BFxVkhZc.js → use-limits-display-prefs-X1zw8WNj.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-CO0krJmN.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-CS1rGoPh.js → use-session-efficiency-pref-Dykjc4jE.js} +1 -1
- package/dashboard/dist/assets/{use-transform-DxSRxn8c.js → use-transform-38jb3h3B.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DQJTSjOH.js → use-usage-limits-2qMzPRSo.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-Dk_equa7.js → useCurrency-ljHbvu9k.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-C0kEMmzx.js → useTokenFormat-Dp98mQOv.js} +1 -1
- package/dashboard/dist/assets/{zap-DNBTWu7a.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/seed-snapshot.json +1 -1
- package/src/lib/usage-limits.js +1 -1
- package/dashboard/dist/assets/DashboardPage-Bkgu9gBF.js +0 -1
- package/dashboard/dist/assets/DialogDescription-q53be2If.js +0 -1
- package/dashboard/dist/assets/__vite-browser-external-DYzNZTW8.js +0 -45
- package/dashboard/dist/assets/module-B5tW98jG.js +0 -3
- package/dashboard/dist/assets/use-reduced-motion-B3bqraBN.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const y="u">typeof window?window:void 0,fe="u">typeof globalThis?globalThis:y,ce=fe?.navigator,k=fe?.document,ee=fe?.location,as=fe?.fetch,yr=fe?.XMLHttpRequest&&"withCredentials"in new fe.XMLHttpRequest?fe.XMLHttpRequest:void 0,Vr=fe?.AbortController,Bl=fe?.CompressionStream,ye=ce?.userAgent;function mo(){return!(!y||y.navigator.onLine===!1)}const Nt=typeof globalThis<"u"?globalThis:y;Nt&&typeof self>"u"&&(Nt.self=Nt),Nt&&typeof File>"u"&&(Nt.File=function(){});const F=y??{},ql="0.9.0",We={DEBUG:!1,LIB_VERSION:ql,LIB_NAME:"browser-common"};var Le=(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.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Hi=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const Hl=["$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"],Vl=["token"];function R(e,t){return e.indexOf(t)!==-1}const Qs=function(e){return e.trim()},Vi=function(e){return e.replace(/^\$/,"")};function yo(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 bo=Object.prototype,br=bo.hasOwnProperty,ei=bo.toString,M=Array.isArray||function(e){return ei.call(e)==="[object Array]"},ue=e=>typeof e=="function",N=e=>e===Object(e)&&!M(e),ke=e=>{if(N(e)){for(const t in e)if(br.call(e,t))return!1;return!0}return!1},w=e=>e===void 0,D=e=>ei.call(e)=="[object String]",Xt=e=>D(e)&&e.trim().length===0,re=e=>e===null,A=e=>w(e)||re(e),ne=e=>ei.call(e)=="[object Number]"&&e==e,qe=e=>ne(e)&&e>0,we=e=>ei.call(e)==="[object Boolean]",zl=e=>R(Hl,e),Ul=e=>R(Vl,e);function wo(e){return e===null||typeof e!="object"}function Ms(e,t){return{}.toString.call(e)===`[object ${t}]`}function Dt(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 xo(e,Error)}}function wr(e){return"u">typeof Event&&xo(e,Event)}function xo(e,t){try{return e instanceof t}catch{return!1}}const Wl=[!0,"true",1,"1","yes"],oi=e=>R(Wl,e),Gl=[!1,"false",0,"0","no"];function zr(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 Z(e){return function(){var t=this,s=arguments;return new Promise(function(i,r){var n=e.apply(t,s);function o(l){zr(n,i,r,o,a,"next",l)}function a(l){zr(n,i,r,o,a,"throw",l)}o(void 0)})}}const Kl=["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"],Ur=function(e,t=[]){if(!e)return!1;const s=e.toLowerCase();return Kl.concat(t).some(i=>{const r=i.toLowerCase();return s.indexOf(r)!==-1})};function De(e,t,s,i,r){return t>s&&(i.warn("min cannot be greater than max."),t=s),ne(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),De(r??s,t,s,i))}var Jl=class{constructor(e){this.C={},this.I=e.I,this.R=De(e.bucketSize,0,100,e.$),this.A=De(e.refillRate,0,this.R,e.$),this.O=De(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 Tt="Mobile",ls="Android",Rs="Tablet",ko="Android Tablet",Eo="iPad",$o="Apple Watch",Ss="Safari",ti="BlackBerry",So="Samsung Internet",Is="Chrome",Io="Chrome iOS",Po="Internet Explorer",Oo="Internet Explorer Mobile",Co="Opera",Fo="Microsoft Edge",Ps="Firefox",To="Firefox iOS",As="Nintendo",Ls="PlayStation",si="Xbox",Mo="Android Mobile",Ro="Mobile Safari",ai="Windows",Ao="Windows Phone",Wr="Nokia",zi="Ouya",Xl="Generic "+Tt.toLowerCase(),Lo="Generic "+Rs.toLowerCase(),Ui="Konqueror",Do="Oculus Browser",No="Vivaldi",jo="Yandex",Bo="Whale",qo="DuckDuckGo",Ho="Pale Moon",Vo="Waterfox",Wi="Brave",zo="Claude",Uo="Codex",Wo="ChatGPT",Go="Google Search App",li=new RegExp("Version/(\\d+(\\.\\d+)?)"),ui=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Yl=new RegExp(si,"i"),Zl=new RegExp("PlayStation \\w+","i"),Ql=new RegExp("Nintendo \\w+","i"),xr=new RegExp("BlackBerry|PlayBook|BB10","i"),eu={"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"},Ko=function(e,t,s,i){return t=t||"",(function(n){return n?.brave?Wi:null})(s)||(i?.detectGoogleSearchApp&&R(e,"GSA/")?Go:R(e," OPR/")&&R(e,"Mini")?"Opera Mini":R(e," OPR/")?Co:xr.test(e)?ti:R(e,"IEMobile")||R(e,"WPDesktop")?Oo:R(e,"OculusBrowser")?Do:R(e,"SamsungBrowser")?So:R(e,"Edge")||R(e,"Edg/")?Fo:R(e,"Vivaldi/")?No:R(e,"YaBrowser/")?jo:R(e,"Whale/")?Bo:R(e,"DuckDuckGo/")||R(e,"Ddg/")?qo:R(e,"Claude/")?zo:R(e,"Codex/")?Uo:R(e,"ChatGPT/")?Wo:R(e,"FBIOS")?"Facebook Mobile":R(e,"UCWEB")||R(e,"UCBrowser")?"UC Browser":R(e,"CriOS")?Io:R(e,"CrMo")||R(e,Is)?Is:R(e,ls)&&R(e,Ss)?Mo:R(e,"FxiOS")?To:R(e.toLowerCase(),Ui.toLowerCase())?Ui:R(e,"Brave/")?Wi:((n,o)=>o&&R(o,"Apple")||(function(a){return R(a,Ss)&&!R(a,Is)&&!R(a,ls)})(n))(e,t)?R(e,Tt)?Ro:Ss:R(e,"PaleMoon/")?Ho:R(e,"Waterfox/")?Vo:R(e,Ps)?Ps:R(e,"MSIE")||R(e,"Trident/")?Po:R(e,"Gecko")?Ps:"")},tu={[Oo]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Fo]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Is]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Io]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ss]:[li],[Ro]:[li],[Co]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Ps]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[To]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ui]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ti]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),li],[Mo]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[So]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Do]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[No]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[jo]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Bo]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Wi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[zo]:[ui],[Uo]:[ui],[Wo]:[ui],[qo]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ho]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Vo]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Go]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Po]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},su=function(e,t,s,i){const r=Ko(e,t,s,i),n=tu[r];if(w(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},Gr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[si,e&&e[1]||""]],[new RegExp(As,"i"),[As,""]],[new RegExp(Ls,"i"),[Ls,""]],[xr,[ti,""]],[new RegExp(ai,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ao,""];if(new RegExp(Tt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const s=/Windows NT ([0-9.]+)/i.exec(t);if(s&&s[1]){let i=eu[s[1]]||"";return/arm/i.test(t)&&(i="RT"),[ai,i]}return[ai,""]}],[/((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=w(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ls,[e[2],e[3],e[4]||"0"].join(".")]:[ls,""]],[/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",""]]],Jo=function(e){for(let t=0;Gr.length>t;t++){const[s,i]=Gr[t],r=s.exec(e),n=r&&(ue(i)?i(r,e):i);if(n)return n}return["",""]},Xo=function(e){return Ql.test(e)?As:Zl.test(e)?Ls:Yl.test(e)?si:new RegExp(zi,"i").test(e)?zi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Ao:/iPad/.test(e)?Eo:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?$o:xr.test(e)?ti:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Wr,"i").test(e)?Wr:/(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(Tt).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)?ls:ko:new RegExp("(pda|Mobile)","i").test(e)?Xl:new RegExp(Rs,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Lo:""},iu=function(e,t){var s;const i=Xo(e);return i===Eo||i===ko||i==="Kobo"||i==="Kindle Fire"||i===Lo?Rs:i===As||i===si||i===Ls||i===zi?"Console":i===$o?"Wearable":i?Tt: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)?Tt:Rs:"Desktop";var r,n,o},ci=/\bFBAV\/(\d+(?:\.\d+)*)/i,Kr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ci],[/\bFBAN\/EMA\b/i,"Facebook Lite",ci],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ci],[/\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"]],Gi="[Truncated]",gs="[Unserializable]";function Ot(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 Yo(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=gs}Object.defineProperty(e,i,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}const Os=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,Os);if(!t)return this.ts=s,void(this.es=s+i);this.es=Math.max(this.es,Math.min(s+i,this.ts+Os))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Os,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const ru=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Jr(e,t){return typeof(s=e)=="string"&&ru.test(s)?e:t();var s}function Qo(e,t){const s=new Error(t);try{Object.defineProperty(s,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return s}function rt(e){return e&&e.split("#")[0]}function Xr(e){try{return e()}catch{return}}function ea(e,t){const s=setTimeout(e,t);return s!=null&&s.unref&&s?.unref(),s}function Yr(e,t,s){return ta.apply(this,arguments)}function ta(){return(ta=Z(function*(e,t,s){let i;try{return yield Promise.race([e,new Promise((r,n)=>{i=ea(()=>{try{s?.(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let ms,Zr,di;function nu(e){const t=globalThis._posthogChunkIds;if(!t)return;const s=Object.keys(t);return di&&s.length===Zr||(Zr=s.length,di=s.reduce((i,r)=>{ms||(ms={});const n=ms[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,ms[r]=[u,c];break}}}return i},{})),di}function Yt(e){return Yt=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},Yt(e)}function ou(e,t,s){return(t=(function(i){var r=(function(n){if(Yt(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(Yt(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)})(i);return Yt(r)=="symbol"?r:r+""})(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Qr(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 v(e){for(var t=1;arguments.length>t;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Qr(Object(s),!0).forEach(function(i){ou(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Qr(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}var au=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 Z(function*(){for(const s of e)s.stacktrace&&s.stacktrace.frames&&M(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){var s;let i,r;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return v(v({},e),{},{cause:i,stack:r,errors:(s=e.errors)===null||s===void 0?void 0:s.map(n=>this.parseStacktrace(n,t))})}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 Z(function*(){let s=e;for(const i of t.modifiers)s=yield i(s);return s})()}convertToExceptionList(e,t){const s=[],i=(r,n,o)=>{var a;const l=s.length,u=n===void 0?v(v({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:r.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:r.synthetic,exception_id:l,parent_id:n},c={type:r.type,value:r.value,mechanism:u};r.stack&&(c.stacktrace={type:"raw",frames:r.stack}),s.push(c),r.cause&&i(r.cause,l,"cause");for(const d of(a=r.errors)!==null&&a!==void 0?a:[])i(d,l,"member")};return i(e),s}buildParsingContext(e){var t;return{chunkIdMap:nu(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(Dt(e)){let s=Object.getPrototypeOf(e);for(let i=0;s&&100>i;i++){var t;const r=(t=Object.getOwnPropertyDescriptor(s,"constructor"))===null||t===void 0?void 0:t.value;if(typeof r=="function"&&r.name==="AggregateError"){const n=e.errors;return M(n)?n:void 0}s=Object.getPrototypeOf(s)}}}catch{}}buildCoercingContext(e,t,s=0){let i=0,r=0,n=!1;const o=new Set,a=[],l={},u=(h,p,g=0)=>{const m=c(p,g),_=m.apply;if(m.apply=I=>{a.push(h);try{return _(I)}finally{a.pop()}},g>4||g>0&&a.indexOf(h)!==-1)return this.coerceFallback(m);const f=typeof h=="object"&&h!==null||typeof h=="function";if(g===0&&i>=50||f&&o.has(h))return;f&&o.add(h),g===0&&i++;const b=this.getAggregateErrors(h);let x,P;n||(n=!!b);try{if(x=this.applyCoercers(h,m),!x)throw l}catch(I){if(I===l)return void(g===0&&i--);if(!n)throw I;x=this.coerceFallback(m)}if(!b||i>=50)return x;try{P=b.length}catch{return x}if(!Number.isInteger(P)||0>P||P>4294967295)return x;const E=[];for(let I=0;50>i&&1e3>r&&P>I;I++){let C;r++;try{C=m.next(b[I])}catch{i++,C=this.coerceFallback(c(p+1))}C&&E.push(C)}return v(v({},x),{},{errors:E})},c=(h,p=0)=>v(v({},t),{},{syntheticException:h==0?t.syntheticException:void 0,mechanism:h==0?e:{},apply(g){const m=u(g,h,p+1);if(!m)throw l;return m},next:g=>u(g,h+1)}),d=c(s);return v(v({},d),{},{apply:h=>{var p;return(p=u(h,s))!==null&&p!==void 0?p:this.coerceFallback(d)}})}};const lu=/^([a-z][a-z0-9.+-]+):/i,uu=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function cu(e){if(!e||e==="<anonymous>")return!1;const t=lu.exec(e);return!t||uu.includes(t[1].toLowerCase())}function Ki(e,t,s,i,r){const n={platform:e,filename:t,function:s==="<anonymous>"?"?":s,in_app:cu(t)};return w(i)||(n.lineno=i),w(r)||(n.colno=r),n}const sa=(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]},du=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pu=/\((\S*)(?::(\d+))(?::(\d+))\)/,vu=(e,t)=>{const s=du.exec(e);if(s){const[,r,n,o]=s;return Ki(t,r,"?",+n,+o)}const i=hu.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const o=pu.exec(i[2]);o&&(i[2]=o[1],i[3]=o[2],i[4]=o[3])}const[r,n]=sa(i[1]||"?",i[2]);return Ki(t,n,r,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},fu=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_u=(e,t)=>{const s=fu.exec(e);if(s){if(s[3]&&s[3].indexOf(" > eval")>-1){const n=gu.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]=sa(r,i),Ki(t,i,r,s[4]?+s[4]:void 0,s[5]?+s[5]:void 0)}},en=/\(error: (.*)\)/;function kr(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function mu(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(!kr(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 yu(e,t){const s=t.start+t.length,i=ra(e,t);i&&e.splice(s+i===e.length?s:t.start,i)}function ia(e,t){let s=t.start;for(;s>0&&kr(e[s-1],e[s-1+t.length]);)s--;return t.start-s}function ra(e,t){const s=t.start+t.length;let i=s;for(;e.length>i&&kr(e[i],e[i-t.length]);)i++;return i-s}function bu(e,t){const s=t[0];let i=e.length-(s?ia(e,s):0);for(const r of t)i-=ra(e,r);return i}function wu(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 xu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const s=D(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 Ms(e,"DOMException")}isDOMError(e){return Ms(e,"DOMError")}},ku=class{match(e){return Dt(e)}coerce(e,t){var s;const i=this.getStack(e),r=i===void 0?(s=t.syntheticException)===null||s===void 0?void 0:s.stack:void 0,n=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??r,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}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){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const s=e.stack;return typeof s=="string"&&s.length>0?s:void 0}catch{return}}},Eu=class{match(e){return!!Ms(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,t){var s;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return v(v({},i),{},{stack:(s=this.cr(e))!==null&&s!==void 0?s:i.stack,synthetic:!0})}ur(e){return D(e.message)&&e.message.length>0}cr(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(D(i.filename)&&i.filename.length!==0&&r!==0)return`Error
|
|
2
|
+
at ${i.filename}:${r}:${n}`}};const $u=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Su=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($u);return i&&(t=i[1],s=i[2]),[t,s]}};const Iu=["fatal","error","warning","log","info","debug"];function na(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(wr(e))return e.constructor.name;const t="name"in e?e.name:void 0;return D(t)&&!Xt(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: ${na(e)}`}isSeverityLevel(e){return D(e)&&!Xt(e)&&Iu.indexOf(e)>=0}getStack(e){try{return D(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:D(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(Dt(s))return s}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Ou=class{match(e){return wr(e)}coerce(e,t){var s;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${na(e)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}},Cu=class{match(e){return wo(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}}},Fu=class{match(e){return Ms(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!wr(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 wo(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 Ds="$message",Ns="$timestamp",Tu=new Set([Ds,Ns]),hi={enabled:!0,max_bytes:32768};function js(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:hi.enabled,max_bytes:Ru(e.max_bytes,hi.max_bytes)}:v({},hi)}var Mu=class{constructor(e){this.ns=[],this.ss=0,this.Ir=js(e)}setConfig(e){this.Ir=js(e),this.rs()}add(e){const t=(function(i){let r;try{r=yo(i)}catch{return}try{const n=JSON.parse(r);if(!N(n))return;const o=n,a=o[Ds],l=o[Ns];return!D(a)||a.trim().length===0||!D(l)&&!ne(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.Ir.max_bytes||(this.ns.push({step:t.step,bytes:s}),this.ss+=s,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Ru(e,t){if(!ne(e)||e===1/0||e===-1/0)return t;const s=Math.floor(e);return 0>s?t:s}const tn=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function sn(e){return typeof e=="string"||e}function rn(e){return typeof e=="string"?e:void 0}const Au=["$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"],oa="NativeGzipValidationError",Ji=e=>e.length>=2&&e[0]===31&&e[1]===139,nn=(e,t)=>e===Hi.GZipJS||t===Hi.GZipJS||t==="gzip",on=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let jt;const ys=e=>{throw Qo(oa,`Native gzip produced invalid output: ${e}`)},Lu=(an=Z(function*(e,t){18>e.size&&ys("too-short");const s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ji(s)&&s[2]===8||ys("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(n=>{const o=(()=>{if(jt)return jt;jt=[];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;jt[l]=u>>>0}return jt})();let a=4294967295;for(let l=0;n.length>l;l++)a=o[255&(a^n[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&ys("invalid-crc");const r=t.length>>>0;i.getUint32(4,!0)!==r&&ys("invalid-size")}),function(e,t){return an.apply(this,arguments)});var an;function Xi(){return Xi=Z(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=Z(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 Lu(u,r),u}catch(r){if(s?.rethrow)throw r;return t&&console.error("Failed to gzip compress data",r),null}var i}),Xi.apply(this,arguments)}function aa(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 Du={}.propertyIsEnumerable;function Bs(e,t){try{return la(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Er(e,t,s,i){if(0>=s.remainingNodes)return{stringValue:Gi};if(s.remainingNodes--,we(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:Ot(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:Gi};if(e instanceof Date){const r=e.getTime(),n=Number.isFinite(r)?e.toISOString():String(e);return{stringValue:typeof n=="string"?Ot(n):String(n)}}s.ancestors.add(e);try{try{const r=e.toJSON;if(typeof r=="function")return Er(r.call(e),t,s,i+1)}catch{}return M(e)?{arrayValue:{values:Nu(e,t,s,i+1)}}:{kvlistValue:{values:la(e,t,s,i+1)}}}finally{s.ancestors.delete(e)}}return{stringValue:Ot(String(e))}}function Nu(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(A(a))continue;r.push(Er(a,t,s,i))}catch{r.push({stringValue:gs})}return e.length>o&&r.push({stringValue:Gi}),r}function la(e,t,s,i){const r=[];for(const n in e)if(Du.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(re(o)||w(o))continue;r.push({key:Ot(n),value:Er(o,t,s,i)})}catch{r.push({key:Ot(n),value:{stringValue:gs}})}}return r}function ua(e,t,s){return v(v(v(v({},Yo({},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 ju=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function ca(e,t){const s=Yo({},e),i={};for(const r of ju)({}).hasOwnProperty.call(s,r)&&(i[r]=s[r],delete s[r]);return[...Bs(s,t),...Bs(i,t)]}const ln={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"},da={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}},Bu=da.info;function qu(e){try{return Ot(String(e))}catch{return gs}}function Hu(e,t,s,i){const r=e.level||"info",{text:n,number:o}=da[r]||Bu,a=(function(h=Date.now()){return String(h)+"000000"})(ne(i)?i:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),A(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),A(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=v({},l),c=e.attributes;if(c){let h=[];try{h=Object.keys(c)}catch{h=[]}for(const p of h){let g;try{g=c[p]}catch{g=gs}Object.defineProperty(u,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:qu(e.body)},attributes:Bs(u,s)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),w(e.trace_flags)||(d.flags=e.trace_flags),d}function ha(e,t,s){return ua(e,t,s)}function pa(e,t,s,i){return{resourceLogs:[{resource:{attributes:ca(t)},scopeLogs:[{scope:{name:s,version:i},logRecords:e}]}]}}var va=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=ea(()=>{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 fa(){return .75+.5*Math.random()}function ga(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 Vu=class{constructor(e,t,s,i,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Ir=t,this.$=s,this.cs=i,this.ds=r,this.vs=n,this.fs=o,this.ps=new va(()=>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(Le.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.Ir.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:Hu(i,(s=t?.context)!==null&&s!==void 0?s:this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const s=M(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 Z(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Z(function*(){var t;e.ps.clear();let s=(t=e._instance.getPersistedProperty(Le.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=pa(u.map(h=>h.record),e.qs(),(n=e.fs)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance.js(c);if(e._s!==a)return;if(d.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(d),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),d.kind==="retry-later"||(d.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."):d.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),s=(o=e._instance.getPersistedProperty(Le.LogsQueue))!==null&&o!==void 0?o:[],r+=u.length,d.kind==="fatal"))throw d.error}})()}Bs(e){var t=this;return Z(function*(){var s;const i=Math.max(0,e-t.bs),r=(s=t._instance.getPersistedProperty(Le.LogsQueue))!==null&&s!==void 0?s:[];t._instance.setPersistedProperty(Le.LogsQueue,r.slice(i)),yield t.vs()})()}qs(){return ha(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const s=(t=this._instance.getPersistedProperty(Le.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(Le.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(ga(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Le.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Z(function*(){t.ps.clear();const s=t.flush().catch(()=>{});e!==void 0?yield Yr(s,e):yield s})()}flushWithTimeout(e){var t=this;return Z(function*(){const s=t.flush();yield Yr(s,e,()=>{s.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=fa(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const pi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function un(e){return String(e)+"000000"}function cn(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 zu=class{constructor(e,t,s){this._instance=e,this.Ir=t,this.$=s,this.zs=new Map,this.ps=new va(()=>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=Z(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?v({},t.attributes):void 0,i=cn(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.Xs(r,t.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Ir.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(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(pi.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,pi)]+=1;break}}}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const s=M(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(ga(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Z(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.Ys(e.Js(t));if(s===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=fa()):(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.uo(e),s=(function(n,o,a){return ua(n,o,a)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ca(s)},scopeMetrics:[{scope:{name:i,version:r},metrics:t}]}]};var t,s,i,r}uo(e){const t=un(Date.now()),s=new Map;for(const o of e.values()){var i;const a=cn(o.type,o.name,o.unit,void 0);let l=s.get(a);l||(l=v({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=Bs((i=o.attributes)!==null&&i!==void 0?i:{},this.$),c=un(o.windowStartMs);if(o.type==="count"){var r;const d={attributes:u,startTimeUnixNano:c,timeUnixNano:t,asDouble:(r=o.total)!==null&&r!==void 0?r:0};l.sum.dataPoints.push(d)}else if(o.type==="gauge"){var n;const d={attributes:u,timeUnixNano:t,asDouble:(n=o.last)!==null&&n!==void 0?n:0};l.gauge.dataPoints.push(d)}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:pi})}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 _a=(e,{debugEnabled:t}={})=>{const s={N(i,...r){y&&(We.DEBUG||y.POSTHOG_DEBUG||t)&&!w(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)=>_a(`${e} ${i}`,r)};return s},$=_a("[PostHog.js]"),se=$.createLogger,Uu=se("[ExternalScriptsLoader]"),qs=e=>{const t=k?.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 Uu.warn(`${t} was requested but loading of external scripts is disabled.`),s("Loading of external scripts is disabled");const i=qs(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(!k)return s("document not found");if(qs(t))return dt(e,t,s);let n=k.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")k.head.appendChild(n);else{const a=k.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(n,a[0]):k.body.appendChild(n)}};k?.body?r():k?.addEventListener("DOMContentLoaded",r)},vi={},dn=(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)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__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=vi[r];if(i==="fallback"&&n){if(qs(n))return void dt(e,n,s);delete vi[r]}return void dt(e,r,i==="fallback"?(o,a)=>{if(o)if(typeof o=="string")s(o);else{var l;const u=dn(e,t);vi[r]=u;const c=qs(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,dn(e,t),s)},F.__PosthogExtensions__.loadSiteApp=(e,t,s)=>{const i=e.requestRouter.endpointFor("api",t);dt(e,i,s)},We.DEBUG=!1,We.LIB_VERSION="1.434.2",We.LIB_NAME="web";var le=We;const Wu="$people_distinct_id",Ce="distinct_id",$r="$device_id",fi="$device_model",Hs="__alias",Gu="__cmpns",hn="$fbc",Ct="$fbc_persistence",pn="$fbp",Zt="$fbp_persistence",Yi="__timers",ma="$autocapture_disabled_server_side",Zi="$heatmaps_enabled_server_side",Qi="$exception_capture_enabled_server_side",ya="$error_tracking_suppression_rules",er="$error_tracking_capture_extension_exceptions",tr="$web_vitals_enabled_server_side",Sr="$dead_clicks_enabled_server_side",Ir="$product_tours_enabled_server_side",ba="$logs_capture_enabled_server_side",wa="$web_vitals_allowed_metrics",Qt="$session_recording_remote_config",Ku="$session_recording_enabled_server_side",Ju="$replay_sample_rate",Xu="$replay_override_sampling",Yu="$replay_override_linked_flag",Zu="$replay_override_url_trigger",Qu="$replay_override_event_trigger",$t="$sesid",xa="$session_is_sampled",ec="$session_past_minimum_duration",tc="$session_recording_url_trigger_activated_session",sc="$session_recording_event_trigger_activated_session",ic="$debug_first_full_snapshot_timestamp",rc="$sess_rec_flush_size",Fe="$enabled_feature_flags",Ve="$active_feature_flags",sr="$early_access_features",vt="$feature_flag_details",Qe="$feature_flag_payloads",ft="$feature_flag_request_id",es="$minimal_flag_called_events",Ae="$override_feature_flags",ht="$override_feature_flag_payloads",et="$stored_person_properties",tt="$stored_group_properties",ka="$groups",ir="$surveys",Vs="$surveys_loaded_at",Ea="$surveys_activated",$a="$surveys_activated_session",Sa="$surveys_activated_timestamps",rr="ph_product_tours",nc="$product_tours_activated",oc="$product_tours_activated_session",ac="$conversations_widget_session_id",lc="$conversations_ticket_id",uc="$conversations_widget_state",cc="$conversations_user_traits",st="$flag_call_reported",Kt="$flag_call_reported_session_id",us="$feature_flag_errors",it="$feature_flag_evaluated_at",be="$user_state",nr="$client_session_props",dc="$capture_rate_limit",Ia="$initial_campaign_params",Pa="$initial_referrer_info",St="$initial_person_info",Pr="$epp",gi="$posthog_cookieless",Oa="$cookieless_mode",Ca="$sdk_debug_extensions_init_method",Fa="$sdk_debug_extensions_init_time_ms",Ta="$sdk_debug_recording_script_not_loaded",Ma="$sdk_debug_replay_stale_config",hc="$sdk_debug_replay_event_trigger_status",pc="$sdk_debug_replay_linked_flag_trigger_status",vc="$sdk_debug_replay_matched_recording_trigger_groups",fc="$sdk_debug_replay_pending_trigger_conditions",gc="$sdk_debug_replay_remote_trigger_matching_config",_c="$sdk_debug_replay_trigger_groups_count",mc="$sdk_debug_replay_url_trigger_status",yc="$session_recording_start_reason",Or="PostHog loadExternalDependency extension not found.",ze="anonymous",Cs="identified",Ra="identified_only",cs="visibilitychange",zs="beforeunload",Cr="$pageview",vn="$pageleave",Aa="$identify",fn="$groupidentify";function It(e,t){M(e)&&e.forEach(t)}function G(e,t){if(!A(e))if(M(e))e.forEach(t);else if((s=>s instanceof FormData)(e))e.forEach((s,i)=>t(s,i));else for(const s in e)br.call(e,s)&&t(e[s],s)}const Y=function(e,...t){for(const s of t)for(const i in s)s[i]!==void 0&&(e[i]=s[i]);return e};function Fs(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 bc=function(e){return function(...t){try{return e.apply(this,t)}catch(s){$.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$.critical(s)}}},Fr=function(e){const t={};return G(e,function(s,i){(D(s)&&s.length>0||ne(s))&&(t[i]=s)}),t};function La(e){const t=v({},e);for(const s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch{}return t}const wc=["herokuapp.com","vercel.app","netlify.app"];function xc(e){const t=e?.hostname;if(!D(t))return!1;const s=t.split(".").slice(-2).join(".");for(const i of wc)if(s===i)return!1;return!0}function U(e,t,s,i){const{capture:r=!1,passive:n=!0}=i??{};e?.addEventListener(t,s,{capture:r,passive:n})}function or(e){return e.name==="ph_toolbar_internal"}const Us=e=>{if(k){try{const t=e+"=",s=k.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 ne(e)&&isFinite(e)&&Math.floor(e)===e});var kc=class ar{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 ar(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 ar(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}},Ec=class{generate(){const e=this.generateOrAbort();if(!w(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(w(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return ne(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 kc.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 $c}};let Da=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&&!w(y.crypto)&&crypto.getRandomValues&&(Da=e=>crypto.getRandomValues(e));var $c=class{nextUint32(){return this.Rt.length>this.$t||(Da(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let gn;const Te=()=>Sc().toString(),Sc=()=>(gn||(gn=new Ec)).generate();let Bt="";const Ic=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let mt=null;const Q={Et(){if(!re(mt))return mt;if(mt=!1,k)try{const e=`__ph_cookie_support_${Te()}`;Q.At(e,"xyz"),mt=Us(e)==='"xyz"',Q.Lt(e)}catch{mt=!1}return mt},Pt(e){$.error("cookieStore error: "+e)},Ot:Us,Dt(e){let t;try{t=JSON.parse(Q.Ot(e))||{}}catch{}return t},At(e,t,s,i,r){if(!k)return!1;try{let n="",o="";const a=(function(u,c){if(c){let d=(function(h,p=k){if(Bt)return Bt;if(!p||["localhost","127.0.0.1"].includes(h))return"";const g=h.split(".");let m=Math.min(g.length,8);const _="dmn_chk_"+Te();for(;!Bt&&m--;){const f=g.slice(m).join("."),b=_+"=1;domain=."+f+";path=/";p.cookie=b+";max-age=3",p.cookie.includes(_)&&(p.cookie=b+";max-age=0",Bt=f)}return Bt})(u);if(!d){const h=(p=>{const g=p.match(Ic);return g?g[0]:""})(u);h!==d&&$.info("Warning: cookie subdomain discovery mismatch",h,d),d=h}return d?"; domain=."+d:""}return""})(k.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&&$.warn("cookieStore warning: large cookie, len="+l.length),k.cookie=l,!0}catch{return!1}},Lt(e,t){if(k?.cookie)try{Q.At(e,"",-1,t)}catch{return}}};let _i=null;const q={Et(){if(!re(_i))return _i;let e=!0;if(w(y))e=!1;else try{const t="__mplssupport__";q.At(t,"xyz"),q.Ot(t)!=='"xyz"'&&(e=!1),q.Lt(t)}catch{e=!1}return e||$.error("localStorage unsupported; falling back to cookie store"),_i=e,e},Pt(e){$.error("localStorage error: "+e)},Ot(e){try{return y?.localStorage.getItem(e)}catch(t){q.Pt(t)}return null},Dt(e){try{return JSON.parse(q.Ot(e))||{}}catch{}return null},At(e,t){try{return y?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(s){q.Pt(s)}return!1},Lt(e){try{y?.localStorage.removeItem(e)}catch(t){q.Pt(t)}}},mi=[et,Ve,Fe,vt,Qe,ft,it,us,st],pt=[$r,Ce,$t,xa,Pr,St,Ct,be],Ws=e=>e+"_cpm",Pc=["__proto__","constructor","prototype"],yi=e=>{if(!N(e))return{};const t={};return Object.keys(e).forEach(s=>{Pc.indexOf(s)===-1&&(t[s]=e[s])}),t},bi=(e,t=[])=>{const s={};return[...pt,...t].forEach(i=>{const r=e[i];w(r)||re(r)||r===""||(s[i]=r)}),s},Na=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)},_n=(e,t)=>({p:t,f:Na(JSON.stringify(e))}),mn=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const s=Q.Dt(Ws(e)),i=s?.f===Na(t)&&M(s.p);return{properties:i?s.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},wi=(e,t)=>t+"|"+(Q.Ot(Ws(e))||""),yt={},lr={Et:()=>!0,Pt(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 at=null;const J={Et(){if(!re(at))return at;if(at=!0,w(y))at=!1;else try{const e="__support__";J.At(e,"xyz"),J.Ot(e)!=='"xyz"'&&(at=!1),J.Lt(e)}catch{at=!1}return at},Pt(e){$.error("sessionStorage error: ",e)},Ot(e){try{return y?.sessionStorage.getItem(e)}catch(t){J.Pt(t)}return null},Dt(e){try{return JSON.parse(J.Ot(e))||null}catch{}return null},At(e,t){try{return y?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(s){J.Pt(s)}return!1},Lt(e){try{y?.sessionStorage.removeItem(e)}catch(t){J.Pt(t)}}};var Oc=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Ao()?0:this.Fo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.Oo.At(this.Do,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.Oo.Lt(this.Do,this.Ir.cross_subdomain_cookie)}get Do(){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 Fo(){const e=this.Oo.Ot(this.Do);return oi(e)?1:R(Gl,e)?0:-1}get Oo(){const e=this.Ir.opt_out_capturing_persistence_type,t=e==="localStorage"?q:Q,s=t.Et()?t:lr;if(!this.Lo||this.Lo!==s){this.Lo=s;const i=e==="localStorage"?Q:q;i.Ot(this.Do)&&(this.Lo.Ot(this.Do)||this.optInOut(oi(i.Ot(this.Do))),i.Lt(this.Do,this.Ir.cross_subdomain_cookie))}return this.Lo}Ao(){return!!this.Ir.respect_dnt&&[ce?.doNotTrack,ce?.msDoNotTrack,F.doNotTrack,ce?.globalPrivacyControl].some(e=>oi(e))}};function ja(e,t){var s;const i=e==null||(s=e.config)===null||s===void 0?void 0:s.get_current_url;if(!ue(i))return t;try{const r=i(t);return D(r)&&r?r:t}catch(r){return $.error("Error in get_current_url, falling back to window.location.href",r),t}}function yn(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 Ne(e){return!!e&&e.nodeType===1}function ve(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ba(e){return!!e&&e.nodeType===3}function Tr(e){return!!e&&e.nodeType===11&&Ne(e.host)}function Mr(e){return e?Qs(e).split(/\s+/):[]}function bn(e,t){const s=(function(i){var r;const n=y==null||(r=y.location)===null||r===void 0?void 0:r.href;return w(n)?void 0:ja(i,n)})(t);return!!(s&&e&&e.some(i=>s.match(i)))}function Mt(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 Mr(t)}function qa(e){return A(e)?null:Qs(e).split(/(\s+)/).filter(t=>ss(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ds(e){let t="";return Ft(e)&&!hs(e)&&e.childNodes&&e.childNodes.length&&G(e.childNodes,function(s){var i;Ba(s)&&s.textContent&&(t+=(i=qa(s.textContent))!==null&&i!==void 0?i:"")}),Qs(t)}function ts(e){var t;return w(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Rr=["a","button","form","input","select","textarea","label"];function ur(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 cr(e,t){if(w(t))return!0;for(const s of e)if(t.some(i=>ur(s,i)))return!0;return!1}function Ha(e){const t=e.parentNode;return!(!t||!Ne(t))&&t}const xi=[".ph-no-autocapture","[data-ph-no-autocapture]"],Va=["next","previous","prev",">","<"],Cc=[...Va,"+","-","−","–"],wn=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,xn=[".ph-no-rageclick",".ph-no-capture"],Fc=["","text","search","email","password","url","tel","number"];function za(e,t){if(!y||Ar(e))return!1;let s,i,r;var n,o;if(we(t)?(s=!!t&&xn,i=void 0,r=!1):(s=(n=t?.css_selector_ignorelist)!==null&&n!==void 0?n:xn,i=t?.content_ignorelist,r=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),s===!1||r&&(function(l){return!(!l||!Ne(l))&&(!!ve(l,"textarea")||(ve(l,"input")?R(Fc,(l.getAttribute("type")||"").toLowerCase()):(function(u){var c;if(u.isContentEditable)return!0;const d=(c=u.getAttribute)===null||c===void 0?void 0:c.call(u,"contenteditable");return d==="true"||d===""})(l)))})(e))return!1;const{targetElementList:a}=Ua(e,!1);return!(function(l,u){if(l===!1||w(l))return!1;let c;if(l===!0)c=Va;else{if(!M(l))return!1;if(l.length>10)return $.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(d=>d.toLowerCase())}return u.some(({safeText:d,ariaLabel:h})=>c.some(p=>wn(d,p)||wn(h,p)))})(i,a.map(l=>{var u;return{safeText:ds(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!cr(a,s)}const Ar=e=>!e||ve(e,"html")||!Ne(e),Ua=(e,t)=>{if(!y||Ar(e))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const i=[e];let r=e;for(;r.parentNode&&!ve(r,"body");){if(Tr(r.parentNode)){i.push(r.parentNode.host),r=r.parentNode.host;continue}const n=Ha(r);if(!n)break;if(t||Rr.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 Ft(e){const t=new Set;let s=0;for(let n=e;n.parentNode&&!ve(n,"body");n=n.parentNode){if(s++>=1e3||t.has(n))return!1;t.add(n);const o=Mt(n);if(R(o,"ph-sensitive")||R(o,"ph-no-capture"))return!1}if(R(Mt(e),"ph-include"))return!0;const i=e.type||"";if(D(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const r=e.name||e.id||"";return!D(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 hs(e){return!!(ve(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ve(e,"select")||ve(e,"textarea")||e.getAttribute("contenteditable")==="true")}const kn=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}))$"),En=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Tc=[16,15,14,13],Mc=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),$n=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Sn=/[0-9A-Za-z_]/;function Rc(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 ss(e,t=!0){return!(A(e)||D(e)&&(e=Qs(e),(t?kn.test((e||"").replace(/[- ]/g,"")):(function(s){let i;for(En.lastIndex=0;i=En.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 Tc){const l=o+a;if(n.length>=l){const u=n.slice(o,l);if(kn.test(u)&&Rc(u))return!0}}}return!1})(e))||(t?Mc.test(e):(function(s){let i;for($n.lastIndex=0;i=$n.exec(s);){const r=i[1],n=i[3];if(!(r&&n&&Sn.test(r)&&Sn.test(n)))return!0}return!1})(e))))}function In(e){let t=ds(e);return t=`${t} ${Wa(e)}`.trim(),ss(t)?t:""}function Wa(e){let t="";return e&&e.childNodes&&e.childNodes.length&&G(e.childNodes,function(s){var i;if(s&&((i=s.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const r=ds(s);t=`${t} ${r}`.trim(),s.childNodes&&s.childNodes.length&&(t=`${t} ${Wa(s)}`.trim())}catch(r){$.error("[AutoCapture]",r)}}),t}function Pn(e){return e.replace(/"|\\"/g,'\\"')}function Ac(e){const t=e.attr__class;if(t)return M(t)?t:Mr(t)}const bs=se("[Dead Clicks]"),Lc=()=>!0,Dc=e=>{var t;const s=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Sr)),i=e.instance.config.capture_dead_clicks;return we(i)?i:!!N(i)||s};var On=class{get lazyLoadedDeadClicksAutocapture(){return this.No}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({[Sr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qo(()=>{this.jo()}):this.stop()}qo(e){var t,s,i;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(s=F.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this.instance,"dead-clicks-autocapture",r=>{r?bs.error("failed to load script",r):e()})}jo(){var e;if(k){if(!this.No&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=N(this.instance.config.capture_dead_clicks)?v({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.No=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.No.start(k),bs.info("starting...")}}else bs.error("`document` not found. Cannot start.")}stop(){this.No&&(this.No.stop(),this.No=void 0,bs.info("stopping..."))}};const qt=se("[SegmentIntegration]");function Cn(e,t,s=!0){const i=e.config.segment;if(!i)return t();const{analytics:r,filterProperties:n}=(a=>ue(a.register))(o=i)?{analytics:o}:o;var o;(function(a,l,u,c){const d=p=>{const g=()=>p.anonymousId()||Te();a.config.get_device_id=g,c&&p.id()&&(a.register({distinct_id:p.id(),$device_id:g()}),a.persistence.set_property(be,Cs)),u(c?void 0:p.anonymousId()||void 0)},h=l.user();"then"in h&&ue(h.then)?h.then(d):d(h)})(e,r,a=>{r.register(((l,u,{filterProperties:c}={})=>{typeof Promise<"u"&&Promise.resolve||qt.warn("This browser does not have Promise support, and can not use the segment integration");const d=(h,p)=>{if(!p)return h;const g=!!u&&h.event.anonymousId===u&&!h.event.userId;g||h.event.userId||h.event.anonymousId===l.get_distinct_id()||(qt.info("No userId set, resetting PostHog"),l.reset()),g||(u=void 0),h.event.userId&&h.event.userId!==l.get_distinct_id()&&(qt.info("UserId set, identifying with PostHog"),l.identify(h.event.userId));let m=l.calculateEventProperties(p,h.event.properties);if(!A(c)){const _=h.event.properties||{},f={};for(const x of Object.keys(m))br.call(_,x)||(f[x]=m[x]);const b=((x,P)=>{const E=M(x)?x:[x];let I=v({},P);for(const C of E)try{if(I=C(I),A(I))return null}catch(S){return qt.error("Error in Segment filterProperties:",S),null}return I})(c,f);if(A(b))return h;m=b}return h.event.properties=Object.assign({},m,h.event.properties),h};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(h){return d(h,h.event.event)},page(h){return d(h,Cr)},identify(h){return d(h,Aa)},screen(h){return d(h,"$screen")}}})(e,a,{filterProperties:n})).then(()=>{t()},l=>{qt.error("Failed to register the Segment integration",l),t()})},s)}const Ga="posthog-js";function Ka(e,{organization:t,projectId:s,prefix:i,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,c,d;if(r!=="*"&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=((a=o.exception)===null||a===void 0?void 0:a.values)||[],g=p.map(f=>v(v({},f),{},{stacktrace:f.stacktrace?v(v({},f.stacktrace),{},{type:"raw",frames:(f.stacktrace.frames||[]).map(b=>v(v({},b),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=p[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(u=p[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=p[0])===null||c===void 0?void 0:c.value)||o.message,$sentry_exception_type:(d=p[0])===null||d===void 0?void 0:d.type,$sentry_tags:o.tags};var _;return t&&s&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+o.event_id),n&&((_=e.exceptions)===null||_===void 0||_.sendExceptionEvent(m)),o}}var Nc=class{constructor(e,t,s,i,r,n){this.name=Ga,this.setupOnce=function(o){o(Ka(e,{organization:t,projectId:s,prefix:i,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},Fn=class{constructor(e){this.Bo=(t,s,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&($.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ho=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zo()}zo(){var e;this.Uo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Bo)}destroy(){var e;(e=this.Uo)===null||e===void 0||e.call(this),this.Uo=void 0}doPageView(e,t){var s;const i=this.Wo(e,t);return this.Ho={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.Wo(e,(t=this.Ho)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ho)===null||e===void 0?void 0:e.pageViewId}}Wo(e,t){const s=this.Ho;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(!(w(n)||w(o)||w(a)||w(l)||w(u)||w(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 d=n>1?De(o/n,0,1,$):1,h=n>1?De(a/n,0,1,$):1,p=l>1?De(u/l,0,1,$):1,g=l>1?De(c/l,0,1,$):1;i=Y(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$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"],jc={[Wu]:{exposure:"hidden"},[Hs]:{exposure:"hidden"},[Gu]:{exposure:"hidden"},[Yi]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[Zt]:{exposure:"hidden"},[ma]:{exposure:"event"},[Zi]:{exposure:"hidden"},[ba]:{exposure:"hidden"},[Qi]:{exposure:"event"},[ya]:{exposure:"hidden"},[er]:{exposure:"event"},[tr]:{exposure:"event"},[Sr]:{exposure:"event"},[Ir]:{exposure:"hidden"},[wa]:{exposure:"event"},[Qt]:{exposure:"hidden"},[Ku]:{exposure:"hidden"},[$t]:{exposure:"hidden"},[xa]:{exposure:"event"},[Ju]:{exposure:"event",shouldSkipFromEventProperties:e=>re(e)},[ec]:{exposure:"event"},[tc]:{exposure:"event"},[sc]:{exposure:"event"},[ic]:{exposure:"event"},[rc]:{exposure:"hidden"},[Fe]:{exposure:"hidden",storageGroup:"flags"},[Ve]:{exposure:"hidden",storageGroup:"flags"},[sr]:{exposure:"hidden"},[vt]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden",storageGroup:"flags"},[ft]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[es]:{exposure:"hidden",storageGroup:"flags"},[Ae]:{exposure:"hidden"},[ht]:{exposure:"hidden"},[et]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[ir]:{exposure:"hidden",storageGroup:"surveys"},[Vs]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ea]:{exposure:"event"},[$a]:{exposure:"hidden"},[Sa]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[nc]:{exposure:"hidden"},[oc]:{exposure:"hidden"},[ac]:{exposure:"event"},[lc]:{exposure:"event"},[uc]:{exposure:"event"},[cc]:{exposure:"event"},[st]:{exposure:"hidden"},[Kt]:{exposure:"hidden"},[ka]:{exposure:"event"},[us]:{exposure:"hidden"},[it]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[be]:{exposure:"hidden"},[nr]:{exposure:"hidden"},[dc]:{exposure:"hidden"},[Ia]:{exposure:"hidden"},[Pa]:{exposure:"hidden"},[St]:{exposure:"hidden"},[Pr]:{exposure:"hidden"},[Xu]:{exposure:"event"},[Yu]:{exposure:"event"},[Zu]:{exposure:"event"},[Qu]:{exposure:"event"},[Ca]:{exposure:"event"},[Fa]:{exposure:"event"},[Ta]:{exposure:"event"},[Ma]:{exposure:"event"},[hc]:{exposure:"event"},[pc]:{exposure:"event"},[vc]:{exposure:"event"},[fc]:{exposure:"event"},[gc]:{exposure:"event"},[_c]:{exposure:"event"},[mc]:{exposure:"event"},[yc]:{exposure:"event"}},Bc=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],he=e=>{const t=jc[e];if(t)return t;for(const[s,i]of Bc)if(e.indexOf(s)===0)return i},Pt=(e,t)=>{try{let s;return JSON.stringify(e,(i,r)=>{var n;return Dt(r)?((n=s)!==null&&n!==void 0||(s=new WeakMap),s.has(r)||s.set(r,La(r)),s.get(r)):typeof r=="bigint"?r.toString():r},t)}catch{return yo(e)}},nt=e=>{const t=k?.createElement("a");return w(t)?null:(t.href=e,t)},Rt=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(!M(i)||2>i.length)return"";{let r=i[1];try{r=decodeURIComponent(r)}catch{$.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")}},ps=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 d=0;l.length>d;d++){const h=l[d].split("=");M(h)&&(t.includes(h[0])?u.push(h[0]+"="+s):u.push(l[d]))}let c=a;return o!=null&&(c+="?"+u.join("&")),r!=null&&(c+="#"+r),c},Gs=function(e,t){const s=e.match(new RegExp(t+"=([^&]*)"));return s?s[1]:null},Ja=(e,t)=>e>=t&&mo(),Xa=(e,t,s,i)=>{if(e===0){if(mo()){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"],qc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...At],vs="<masked>",Hc=["li_fat_id"];function Ya(e,t,s){if(!k)return{};const i=t?[...At,...s||[]]:[],r=Za(ps(k.URL,i,vs),e),n=(function(){const o={};return G(Hc,function(a){const l=Us(a);o[a]=l||null}),o})();return Y(n,r)}function Za(e,t){const s=qc.concat(t||[]),i={};return G(s,function(r){const n=Rt(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(!re(t)){i.$search_engine=t;const r=k?Rt(k.referrer,s):"";r.length&&(i.ph_keyword=r)}return i}function el(){return navigator.language||navigator.userLanguage}function Vc(){const e=el();return typeof e=="string"?e.split("-")[0]:void 0}const Ks="$direct";function tl(){return k?.referrer||Ks}function sl(e,t,s=!1){const i=e?[...At,...t||[]]:[],r=s?rt(ee?.href):ee?.href,n=r?.substring(0,1e3);return{r:tl().substring(0,1e3),u:n?ps(n,i,vs):void 0}}function il(e,t=!1){var s;const{r:i,u:r}=e,n=t?rt(r):r,o={$referrer:i,$referring_domain:i==null?void 0:i==Ks?Ks:(s=nt(i))===null||s===void 0?void 0:s.host};if(n){o.$current_url=n;const a=nt(n);o.$host=a?.host,o.$pathname=a?.pathname;const l=Za(n);Y(o,l)}if(i){const a=Qa(i);Y(o,a)}return o}function rl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function zc(){try{return new Date().getTimezoneOffset()}catch{return}}const Uc={flags:it,surveys:Vs},Wc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ws=e=>`${e}_cookie_identity_change_pending`,xs=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},ae="main",He=[Fe,Ve,vt,Qe,ft,it,es,et],ki=e=>He.indexOf(e)!==-1,nl=[Ct,Zt],Tn=e=>nl.indexOf(e)!==-1,Xe=(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 N(t)?t:{}},Mn=(e,t)=>{G(e,(s,i)=>{const r=he(i);r&&r.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var Ei=class{constructor(e,t,s=!0){if(this.Vo={},this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=!1,this.Xo=new Map,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Set,this.na=new Set,this.Ir=e,this.sa=s,this.props={},this.ra=void 0,this.oa=(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.Oo=this.aa(e),this.Qo=this.la(e),this.load(),this.ua(),e.debug&&$.info("Persistence loaded",e.persistence,v({},this.props)),this.update_config(e,e,t),this.save(),y){const i=()=>this.flush();U(y,"beforeunload",i,{capture:!1}),U(y,"pagehide",i,{capture:!1}),this.ha=r=>{if(this.Go&&(!r.storageArea||r.storageArea===y?.localStorage)&&r.key)if(r.key!==this.oa){if(this.Qo){const n=Ht.find(o=>r.key===this.ca(o));n&&this.da(r.key,n)}}else this.da(r.key,ae)},U(y,"storage",this.ha)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,s])=>{const i=this.Xo.get(t);if(!ki(t)||i===!0)return;if(s===!0)return void this.va(t,!0);const r=new Set(i||[]);s.forEach(n=>r.add(n)),r.size&&this.va(t,r)})}onCrossTabFeatureFlagChange(e){return this.na.add(e),()=>this.na.delete(e)}destroy(){this.ha&&y&&(y.removeEventListener("storage",this.ha),this.ha=void 0),this.na.clear()}da(e,t,s=!0){if(this.mi)return!1;let i,r;try{if(r=q.Ot(e),re(r)){const a=this.fa(t);return a.storageValue=null,t!==ae&&(a.persisted=!1),!1}i=bt(r)}catch{return!1}const n=t===ae?i:q.Dt(this.oa);if(n&&this.pa(n))return!1;const o=this.ga(i,t,s);return t===ae&&this.Qo&&!Xe(this.ma().main,i)||this.ya(i,t,!0,r),o}pa(e){const t=this.props[Ce],s=e[Ce];return!w(t)&&!w(s)&&t!==s}ya(e,t,s,i){const r=this.fa(t);r.storageValue=i,t!==ae&&(r.persisted=s);try{r.fingerprint=this.ba(e,t)}catch{r.fingerprint=void 0}}ga(e,t,s){let i=!1;return He.forEach(r=>{var n;const o=(n=he(r))===null||n===void 0?void 0:n.storageGroup;if(t===ae&&this.Qo&&o||t!==ae&&o!==t)return;const a=r in e,l=this._a(r,a?e[r]:void 0),u=this.Xo.has(r)?r in this.props:a;u===r in this.props&&Xe(l,this.props[r])||(u?this.wa(r,l,!1):this.ka(r,!1),i=!0)}),i&&s&&this.na.forEach(r=>r()),i}Sa(){if(!this.Go)return!1;try{this.ea=!1;const e=q.Ot(this.oa),t=this.fa(ae);let s,i=!1,r=!1;if(e!==t.storageValue)if(re(e))t.storageValue=null;else{if(s=bt(e),this.ea=!this.ta&&this.pa(s),this.ea)return!1;r=this.ga(s,ae,!1),!this.Qo||Xe(this.ma().main,s)?this.ya(s,ae,!0,e):t.storageValue=e,i=!0}return this.Qo&&Ht.forEach(n=>{const o=q.Ot(this.ca(n)),a=this.fa(n),l=s||{},u=i&&He.some(d=>{var h;return((h=he(d))===null||h===void 0?void 0:h.storageGroup)===n&&d in l});if(o===a.storageValue&&!u)return;if(re(o))return a.storageValue=null,a.persisted=!1,void(u&&(r=this.ga(l,n,!1)||r));const c=bt(o);r=this.ga(c,n,!1)||r,this.ya(c,n,!0,o)}),r}catch{return!1}}va(e,t){this.Xo.set(e,t);const s=he(e);s?.volatile||(this.fa((this.Qo?s?.storageGroup:void 0)||ae).fingerprint=void 0,this.xa(e))}Ca(){He.forEach(e=>this.Xo.set(e,!0))}ua(){if(this.Go)try{const e=q.Ot(this.oa),t=bt(e);this.fa(ae).storageValue=e,He.forEach(s=>{var i;const r=this.Qo?(i=he(s))===null||i===void 0?void 0:i.storageGroup:void 0,n=r?q.Ot(this.ca(r)):null;if(r){const a=this.fa(r);a.storageValue=n,a.persisted=!re(n)}const o=r&&!re(n)?bt(n):t;s in this.props?this.$a(s,o[s],this.props[s]):s in o&&this.va(s,!0)})}catch{}}_a(e,t){const s=this.Xo.get(e);if(!s)return t;if(s===!0)return this.props[e];if(e==="$active_feature_flags"){const n=new Set(M(t)?t:[]),o=new Set(M(this.props[e])?this.props[e]:[]);return s.forEach(a=>o.has(a)?n.add(a):n.delete(a)),Array.from(n)}const i=N(t)?v({},t):{},r=N(this.props[e])?this.props[e]:{};return s.forEach(n=>{n in r?i[n]=r[n]:delete i[n]}),i}$a(e,t,s){if(!ki(e))return;const i=this.Xo.get(e);if(i===!0)return;let r=t;if(this.Go)try{var n;const a=this.Qo?(n=he(e))===null||n===void 0?void 0:n.storageGroup:void 0,l=a?this.ca(a):this.oa;r=bt(q.Ot(l))[e]}catch{}const o=new Set(i||[]);if(e==="$active_feature_flags"){if(!w(t)&&!M(t)||!w(r)&&!M(r)||!M(s))return void this.va(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(!N(s))return void(Xe(r,s)?this.Xo.delete(e):this.va(e,!0));{if(!w(t)&&!N(t)||w(t)&&ke(s)&&w(r))return void this.va(e,!0);const a=N(t)?t:{},l=N(r)?r:{};new Set([...Object.keys(a),...Object.keys(s)]).forEach(u=>{u in a==u in s&&Xe(a[u],s[u])||o.add(u)}),o.forEach(u=>{u in l==u in s&&Xe(l[u],s[u])&&o.delete(u)})}}o.size?this.va(e,o):this.Xo.delete(e)}Ta(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return ne(t)&&t>0?t:0}Ia(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=bi(e,this.Ir.cookie_persisted_properties||[]),s=_n(t,this.Ir.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(s),r=Q.Ot(this.oa)||void 0;r&&wi(this.oa,r)===i&&(this.Ma=i,this.Ea=r)}catch{}else try{const t=Q.Ot(this.oa)||void 0;this.Ma=t?wi(this.oa,t):void 0,this.Ea=t}catch{}}syncCookieProperties(){return this.Pa(this.Ir)}Pa(e,t=!1){if(this.mi&&!t||this.Ko||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let s;try{s=Q.Ot(this.oa)||void 0}catch{}if(!s||s===this.Ea)return!1;const i=wi(this.oa,s);let r;try{r=yi(JSON.parse(s))}catch{return!1}if((Q.Ot(this.oa)||void 0)!==s)return!1;this.Ma=i,this.Ea=s;const n=mn(this.oa,s),o=[...pt,...n.properties],a={};if(Object.keys(r).forEach(m=>{const _=r[m];(w(_)||re(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="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[Ce],d=u[be],h=Y({},u);[...pt,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){const _=h[m];(n.isValid||pt.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Y(h,r),He.forEach(m=>{const _=m in this.props;m in u===_&&Xe(u[m],this.props[m])||(_?this.$a(m,u[m],this.props[m]):this.va(m,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.wa(be,ze);const p=this.props[Ce],g=this.props[be];return!l||p===c&&g===d||(this.ta=!0,this.Jo=!0,J.At(ws(this.oa),!0),this.ka(et),this.ka(Ve),this.ka(Fe),this.ka(vt),this.ka(Qe),this.ka(ft),this.ka(it),this.ka(us),this.ka(st),g!=="anonymous"||d!=="identified"&&r.$user_state!=="anonymous"&&(w(c)||p===c)||(Mn(this.props,r),this.ka(tt)),g==="identified"?this.props.$user_id=p:delete this.props.$user_id,this.ka(Hs)),!0}consumeCookieIdentityChange(){const e=ws(this.oa),t=this.Jo||!!J.Ot(e);return this.Jo=!1,t&&J.Lt(e),t}Ra(e=!1){return!(this.Ko||this.mi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.Ko=!0,0))}Aa(){this.Ko&&(w(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0),delete this.Vo[ae],this.Oa(!0))}Da(e=!0){if(this.Ko)try{e?this.Aa():w(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0)}finally{this.Ko=!1}}isDisabled(){return!!this.mi}aa(e){Wc.indexOf(e.persistence.toLowerCase())===-1&&($.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const l=[...pt,...o];return v(v({},q),{},{Dt(u){try{let d,h={};try{d=Q.Ot(u)||void 0,h=d?yi(JSON.parse(d)):{}}catch{}const p=JSON.parse(q.Ot(u)||"{}");let g;if(a){const m=mn(u,d),_=[...pt,...m.properties],f={};Object.keys(h).forEach(x=>{const P=h[x];re(P)||P===""||x==="$user_state"&&P!=="anonymous"&&P!=="identified"||(f[x]=P)});const b="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var c;const x=p[Ce],P=(c=p.$user_state)!==null&&c!==void 0?c:ze;l.forEach(E=>{if(_.indexOf(E)!==-1&&!(E in h)&&(b||E!=="distinct_id"&&E!=="$user_state")){const I=p[E];(m.isValid||pt.indexOf(E)===-1||I!==!1&&I!==0)&&delete p[E]}}),!b||"$user_state"in h||"$user_state"in p||(p[be]=ze),!b||("distinct_id"in f?f[Ce]:p[Ce])===x&&("$user_state"in f?f[be]:p[be])===P||(mi.forEach(E=>delete p[E]),f.$user_state==="identified"&&"distinct_id"in f?p.$user_id=f[Ce]:delete p.$user_id,f.$user_state!=="identified"&&(delete p[ka],delete p[tt]),delete p.__alias)}g=Y(p,f)}else g=Y(h,p);return q.At(u,g),g}catch{}return null},At(u,c,d,h,p,g){const m=q.At(u,c,void 0,void 0,g);try{const _=bi(c,o);if(Object.keys(_).length){if(a){const f=Ws(u),b=_n(_,o);if(Q.At(f,b,d,h,p,g),Q.Ot(f)!==JSON.stringify(b)){Q.Lt(f,h);const x=bi(c);return Q.At(u,x,d,h,p,g),m}}Q.At(u,_,d,h,p,g)}}catch(_){q.Pt(_)}return m},Lt(u,c){try{y?.localStorage.removeItem(u),Q.Lt(u,c),Q.Lt(Ws(u),c)}catch(d){q.Pt(d)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let s,i=!1,r=!1;const n=e.persistence.toLowerCase();return n==="localstorage"&&q.Et()?(s=q,r=!0):n==="localstorage+cookie"&&t.Et()?(s=t,r=!0,i=!0):n==="sessionstorage"&&J.Et()?s=J:n==="memory"?s=lr:n==="cookie"&&Q.Et()?(s=Q,i=!0):t.Et()?(s=t,r=!0,i=!0):Q.Et()?(s=Q,i=!0):s=lr,this.Go=r,this.Zo=i,s}ca(e){return`${this.oa}__${e}`}la(e){return this.Go&&!!e.split_storage}properties(){const e={};return G(this.props,(t,s)=>{const i=he(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.mi&&!e)return;const t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",s=t?q.Dt(this.oa):null;let i={};if(t)try{i=yi(Q.Dt(this.oa)),G(i,(a,l)=>{(w(a)||re(a)||a==="")&&delete i[l]})}catch{}const r=this.Oo.Dt(this.oa);if(r&&(this.props=Y({},r)),this.Qo&&this.La(),t&&r){var n,o;const a=s?.[Ce],l=(n=s?.$user_state)!==null&&n!==void 0?n:ze,u=r[Ce],c=(o=r.$user_state)!==null&&o!==void 0?o:ze;if(u!==a||c!==l){this.Jo=!0,J.At(ws(this.oa),!0);const d=Y({},this.props);mi.forEach(p=>delete d[p]),c!=="anonymous"||l!=="identified"&&i.$user_state!=="anonymous"&&(w(a)||u===a)||(Mn(d,i),delete d[tt]),this.props=d;const h=new Set;mi.forEach(p=>{var g;const m=(g=he(p))===null||g===void 0?void 0:g.storageGroup;m&&h.add(m)}),h.forEach(p=>{const g={};G(this.props,(m,_)=>{var f;((f=he(_))===null||f===void 0?void 0:f.storageGroup)===p&&(g[_]=m)}),ke(g)?(q.Lt(this.ca(p)),this.Vo[p]={}):q.At(this.ca(p),g)&&(this.Vo[p]={persisted:!0,fingerprint:this.ba(g,p)})})}}J.Ot(ws(this.oa))&&(this.Jo=!0)}La(){for(const e of Ht){const t=q.Dt(this.ca(e));if(t&&!ke(t)){const s=this.fa(e);s.persisted=!0,this.Na(e)||(s.fingerprint=this.ba(t,e)),this.qa(e,t)||Y(this.props,t)}}}Na(e){return Object.keys(this.props).some(t=>{var s;return((s=he(t))===null||s===void 0?void 0:s.storageGroup)===e})}qa(e,t){const s=Uc[e];if(!s)return!1;const i=t[s],r=this.props[s];return ne(i)&&ne(r)&&r>i}refreshKey(e){var t;if(this.mi||this.ia.has(e))return;const s=this.Qo?(t=he(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=s?q.Dt(this.ca(s)):this.Oo.Dt(this.oa);if(i&&e in i)this.wa(e,i[e],!1);else{if(s){const r=this.Oo.Dt(this.oa);if(r&&e in r)return void this.wa(e,r[e],!1)}this.ka(e,!1)}}save(){if(this.mi)return;const e=this.Ta();e>0?w(this.Fa)&&(this.Fa=setTimeout(()=>{this.Fa=void 0,this.Oa()},e)):this.Oa()}flush(){w(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0,this.Oa())}Oa(e=!1){if(this.mi||this.Ko&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||nl.forEach(r=>this.refreshKey(r)));const t=!e&&!this.Yo;t||(this.ea=!1);const s=!!t&&this.Sa();if(this.ea)return void(this.Ir.debug&&$.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Qo)return this.ja(),void(s&&this.na.forEach(r=>r()));const i=this.Ba(this.Oo,this.oa,this.props,ae);i==="written"&&this.Ia(this.props),i!=="failed"&&(this.Xo.clear(),this.ta=!1,this.ia.clear()),s&&this.na.forEach(r=>r())}ja(){const{main:e,groups:t}=this.ma(),s=this.Ba(this.Oo,this.oa,e,ae);s==="written"&&this.Ia(e),s!=="failed"&&(this.ta=!1,this.ia.clear(),He.forEach(r=>{var n;!((n=he(r))===null||n===void 0)&&n.storageGroup||this.Xo.delete(r)}));for(const r of Ht){var i;const n=t[r];if(ke(n)&&!(!((i=this.Vo[r])===null||i===void 0)&&i.persisted)){He.forEach(a=>{var l;((l=he(a))===null||l===void 0?void 0:l.storageGroup)===r&&this.Xo.delete(a)});continue}const o=this.Ba(q,this.ca(r),n,r);o!=="failed"&&He.forEach(a=>{const l=he(a);l?.storageGroup!==r||o!=="written"&&l.volatile||this.Xo.delete(a)})}}ma(){const e={},t={flags:{},surveys:{}};return G(this.props,(s,i)=>{var r;const n=(r=he(i))===null||r===void 0?void 0:r.storageGroup;n?t[n][i]=s:e[i]=s}),{main:e,groups:t}}ba(e,t){if(t===ae)return JSON.stringify(e)+"|"+this.Ha+"|"+this.za+"|"+this.Ua;const s={};return G(e,(i,r)=>{var n;s[r]=!((n=he(r))===null||n===void 0)&&n.volatile?"__volatile__":i}),JSON.stringify(s)}Ba(e,t,s,i){const r=this.fa(i);if(i!==ae&&!r.dirty&&!w(r.fingerprint))return"skipped";let n;try{if(n=this.ba(s,i),n===r.fingerprint)return r.dirty=!1,"skipped"}catch{n=void 0}return e.At(t,s,this.Ha,this.za,this.Ua,this.Ir.debug)?(r.dirty=!1,i!==ae&&(r.persisted=!0),w(n)||(r.fingerprint=n),this.Go&&(r.storageValue=q.Ot(t)),"written"):(this.Ir.debug&&$.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ca(),w(this.Fa)||(clearTimeout(this.Fa),this.Fa=void 0),this.Oo.Lt(this.oa,!1),this.Oo.Lt(this.oa,!0),!e&&this.sa)for(const t of Ht)q.Lt(this.ca(t));e?delete this.Vo[ae]:this.Vo={},this.Ma=void 0,this.Ea=void 0}clear(){this.remove(),this.props={}}register_once(e,t,s){if(N(e)){this.syncCookieProperties(),w(t)&&(t="None"),this.Ha=w(s)?this.Wa:s;let i=!1;if(G(e,(r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.wa(n,r),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(N(e)){this.syncCookieProperties(),this.Ha=w(t)?this.Wa:t;let s=!1;if(G(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||N(i)||M(i))&&(this.wa(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.ka(i),s=!0);s&&this.save()}update_campaign_params(){const e=k?.URL;if(e===this.ra)return;const t=Ya(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),s=!ke(Fr(t));return s&&this.register(t),this.ra=e,s?t:void 0}update_search_keyword(){this.register((function(){const e=k?.referrer;return e?Qa(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:tl(),$referring_domain:k?.referrer&&((e=nt(k.referrer))===null||e===void 0?void 0:e.host)||Ks},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=sl(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[St]:this.Zo?{r:xs(e.r),u:e.u?xs(e.u):void 0}:e},void 0)}get_initial_props(){const e={};G([Pa,Ia],s=>{const i=this.props[s];i&&G(i,function(r,n){e["$initial_"+Vi(n)]=r})});const t=this.props[St];if(t){const s=(function(i,r=!1){const n=il(i,r),o={};return G(n,function(a,l){o[`$initial_${Vi(l)}`]=a}),o})(t,this.Ir.disable_capture_url_hashes);Y(e,s)}return e}safe_merge(e){return G(this.props,function(t,s){s in e||(e[s]=t)}),e}update_config(e,t,s){const i=e.persistence!==t.persistence,r=!((p,g)=>{if(p.length!==g.length)return!1;const m=[...p].sort(),_=[...g].sort();return m.every((f,b)=>f===_[b])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=i||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!s,l=!!this.mi&&!a;a||this.Pa(t,l),this.Ir=e,!a&&(i||r||o)&&(this.Ma=void 0,this.Ea=void 0,this.Pa(v(v({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const u=n||o?this.aa(e):this.Oo;this.Va();const c=this.la(e),d=n||c!==this.Qo,h=!a&&(d||e.cross_subdomain_cookie!==this.za||e.secure_cookie!==this.Ua)&&this.Ra(l);this.Yo=d;try{if(this.Wa=this.Ha=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const p=this.props;this.clear(),this.Oo=u,this.Qo=c,this.props=p,this.save()}else o&&(this.Oo=u,a||(delete this.Vo[ae],this.Oa()))}finally{this.Yo=!1,h&&this.Da()}}Va(){const e=this.props[St];if(!this.Zo||!N(e)||typeof e.r!="string")return;const t=xs(e.r),s=typeof e.u=="string"?xs(e.u):e.u;t===e.r&&s===e.u||this.wa(St,v(v({},e),{},{r:t,u:s}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.za&&(this.za=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ua&&(this.Ua=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const s=this.props.__timers||{};s[e]=t,this.wa(Yi,s),this.save()}remove_event_timer(e){const t=this.props.__timers||{},s=t[e];return w(s)||(delete t[e],this.wa(Yi,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.wa(e,t),this.save()}wa(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.ta=!0),Tn(e)&&!Xe(r,t)&&this.ia.add(e),this.$a(e,r,t),!((i=he(e))===null||i===void 0)&&i.volatile||this.xa(e))}ka(e,t=!0){delete this.props[e],t&&(ki(e)&&this.va(e,!0),Tn(e)&&this.ia.add(e),this.xa(e))}xa(e){var t;const s=(t=he(e))===null||t===void 0?void 0:t.storageGroup;s&&(this.fa(s).dirty=!0)}fa(e){return this.Vo[e]||(this.Vo[e]={})}};const $e={GZipJS:"gzip-js",Base64:"base64"},Vt={Activation:"events",Cancellation:"cancelEvents"},$i={Popover:"popover",API:"api",Widget:"widget"},Ue={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Si={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},dr={Popover:"popover",Inline:"inline"};function ks(e){let t=!0;return{dispose(){if(t){t=!1;const s=e();s&&ue(s.then)&&s.then(void 0,()=>{})}}}}const Gc={SHOWN:"product tour shown"},Rn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},An=se("[RateLimiter]");var Kc=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=>{An.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void An.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=(ne(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Ga(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}}Za(e){const t=this.instance.config.property_denylist;return!M(t)||!t.includes(e)}Qa(){var e;if(this.Za("$current_url")&&this.Za("$pathname")&&ee?.pathname)return`${(e=ee.origin)!==null&&e!==void 0?e:""}${ee.pathname}`}Ga(e){var t,s;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,n=this.Qa(),o=this.Za("$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 Ye=se("[RemoteConfig]");var ol=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ja(e){var t,s,i;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(s=F.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Ka(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 Ye.info("Using preloaded remote config",this.remoteConfig),void this.Xa(this.remoteConfig);if(this._instance.Ya())return void Ye.warn("Remote config is disabled. Falling back to local config.");this.Ja(e=>{if(!e)return Ye.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ka(t=>{this.Xa(t.json,t)});this.Xa(e)})}catch(e){Ye.error("Error loading remote config",e),this.Xa()}}Xa(e,t){!e&&t&&(t.statusCode===0?t.error||Ye.warn("Failed to fetch remote config from PostHog."):Ye.error("Failed to fetch remote config from PostHog."));try{this._instance.Xa(e?{ok:!0,config:e}:{ok:!1})}catch(i){Ye.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){Ye.error("Error loading feature flags",i)}}},Pe=Uint8Array,Ee=Uint16Array,Lt=Uint32Array,Lr=new Pe([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]),Dr=new Pe([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]),Ln=new Pe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),al=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]},ll=al(Lr,2),hr=ll[1];ll[0][28]=258,hr[258]=28;for(var Dn=al(Dr,0)[1],ul=new Ee(32768),te=0;32768>te;++te){var wt=(43690&te)>>>1|(21845&te)<<1;ul[te]=((65280&(wt=(61680&(wt=(52428&wt)>>>2|(13107&wt)<<2))>>>4|(3855&wt)<<4))>>>8|(255&wt)<<8)>>>1}var is=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]=ul[a[e[r]-1]++]>>>15-e[r];return o},gt=new Pe(288);for(te=0;144>te;++te)gt[te]=8;for(te=144;256>te;++te)gt[te]=9;for(te=256;280>te;++te)gt[te]=7;for(te=280;288>te;++te)gt[te]=8;var Js=new Pe(32);for(te=0;32>te;++te)Js[te]=5;var Jc=is(gt,9),Xc=is(Js,5),cl=function(e){return(e/8|0)+(7&e&&1)},dl=function(e,t,s){(s==null||s>e.length)&&(s=e.length);var i=new(e instanceof Ee?Ee:e instanceof Lt?Lt:Pe)(s-t);return i.set(e.subarray(t,s)),i},je=function(e,t,s){var i=t/8|0;e[i]|=s<<=7&t,e[i+1]|=s>>>8},zt=function(e,t,s){var i=t/8|0;e[i]|=s<<=7&t,e[i+1]|=s>>>8,e[i+2]|=s>>>16},Ii=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 Pe(0),0];if(r==1){var o=new Pe(s[0].s+1);return o[s[0].s]=1,[o,1]}s.sort(function(E,I){return E.f-I.f}),s.push({s:-1,f:25001});var a=s[0],l=s[1],u=0,c=1,d=2;for(s[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=s[s[d].f>s[u].f?u++:d++],l=s[u!=c&&s[d].f>s[u].f?u++:d++],s[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(i=1;r>i;++i)n[i].s>h&&(h=n[i].s);var p=new Ee(h+1),g=pr(s[c-1],p,0);if(g>t){i=0;var m=0,_=g-t,f=1<<_;for(n.sort(function(E,I){return p[I.s]-p[E.s]||E.f-I.f});r>i;++i){var b=n[i].s;if(t>=p[b])break;m+=f-(1<<g-p[b]),p[b]=t}for(m>>>=_;m>0;){var x=n[i].s;t>p[x]?m-=1<<t-p[x]++-1:++i}for(;i>=0&&m;--i){var P=n[i].s;p[P]==t&&(--p[P],++m)}g=t}return[new Pe(p),g]},pr=function(e,t,s){return e.s==-1?Math.max(pr(e.l,t,s+1),pr(e.r,t,s+1)):t[e.s]=s},Nn=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]},Ut=function(e,t){for(var s=0,i=0;t.length>i;++i)s+=e[i]*t[i];return s},vr=function(e,t,s){var i=s.length,r=cl(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)},jn=function(e,t,s,i,r,n,o,a,l,u,c){je(t,c++,s),++r[256];for(var d=Ii(r,15),h=d[0],p=d[1],g=Ii(n,15),m=g[0],_=g[1],f=Nn(h),b=f[0],x=f[1],P=Nn(m),E=P[0],I=P[1],C=new Ee(19),S=0;b.length>S;++S)C[31&b[S]]++;for(S=0;E.length>S;++S)C[31&E[S]]++;for(var O=Ii(C,7),j=O[0],H=O[1],V=19;V>4&&!j[Ln[V-1]];--V);var K,T,B,L,X=u+5<<3,z=Ut(r,gt)+Ut(n,Js)+o,ie=Ut(r,h)+Ut(n,m)+o+14+3*V+Ut(C,j)+(2*C[16]+3*C[17]+7*C[18]);if(z>=X&&ie>=X)return vr(t,c,e.subarray(l,l+u));if(je(t,c,1+(z>ie)),c+=2,z>ie){K=is(h,p),T=h,B=is(m,_),L=m;var de=is(j,H);for(je(t,c,x-257),je(t,c+5,I-1),je(t,c+10,V-4),c+=14,S=0;V>S;++S)je(t,c+3*S,j[Ln[S]]);c+=3*V;for(var oe=[b,E],Se=0;2>Se;++Se){var ge=oe[Se];for(S=0;ge.length>S;++S)je(t,c,de[pe=31&ge[S]]),c+=j[pe],pe>15&&(je(t,c,ge[S]>>>5&127),c+=ge[S]>>>12)}}else K=Jc,T=gt,B=Xc,L=Js;for(S=0;a>S;++S)if(i[S]>255){var pe;zt(t,c,K[257+(pe=i[S]>>>18&31)]),c+=T[pe+257],pe>7&&(je(t,c,i[S]>>>23&31),c+=Lr[pe]);var _e=31&i[S];zt(t,c,B[_e]),c+=L[_e],_e>3&&(zt(t,c,i[S]>>>5&8191),c+=Dr[_e])}else zt(t,c,K[i[S]]),c+=T[i[S]];return zt(t,c,K[256]),c+T[256]},Yc=new Lt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zc=(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})(),Pi=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function Qc(e,t){t===void 0&&(t={});var s=(function(){var d=4294967295;return{p(h){for(var p=d,g=0;h.length>g;++g)p=Zc[255&p^h[g]]^p>>>8;d=p},d(){return 4294967295^d}}})(),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(d,h,p,g,m,_){var f=d.length,b=new Pe(g+f+5*(1+Math.floor(f/7e3))+m),x=b.subarray(g,b.length-m),P=0;if(!h||8>f)for(var E=0;f>=E;E+=65535){var I=E+65535;f>I?P=vr(x,P,d.subarray(E,I)):(x[E]=_,P=vr(x,P,d.subarray(E,f)))}else{for(var C=Yc[h-1],S=C>>>13,O=8191&C,j=(1<<p)-1,H=new Ee(32768),V=new Ee(j+1),K=Math.ceil(p/3),T=2*K,B=function(ni){return(d[ni]^d[ni+1]<<K^d[ni+2]<<T)&j},L=new Lt(25e3),X=new Ee(288),z=new Ee(32),ie=0,de=0,oe=(E=0,0),Se=0,ge=0;f>E;++E){var pe=B(E),_e=32767&E,Ge=V[pe];if(H[_e]=Ge,V[pe]=_e,E>=Se){var _t=f-E;if((ie>7e3||oe>24576)&&_t>423){P=jn(d,x,0,L,X,z,de,oe,ge,E-ge,P),oe=ie=de=0,ge=E;for(var xe=0;286>xe;++xe)X[xe]=0;for(xe=0;30>xe;++xe)z[xe]=0}var Me=2,ot=0,Al=O,Ke=_e-Ge&32767;if(_t>2&&pe==B(E-Ke))for(var Ll=Math.min(S,_t)-1,Dl=Math.min(32767,E),Nl=Math.min(258,_t);Dl>=Ke&&--Al&&_e!=Ge;){if(d[E+Me]==d[E+Me-Ke]){for(var Je=0;Nl>Je&&d[E+Je]==d[E+Je-Ke];++Je);if(Je>Me){if(Me=Je,ot=Ke,Je>Ll)break;var jl=Math.min(Ke,Je-2),jr=0;for(xe=0;jl>xe;++xe){var ri=E-Ke+xe+32768&32767,Br=ri-H[ri]+32768&32767;Br>jr&&(jr=Br,Ge=ri)}}}Ke+=(_e=Ge)-(Ge=H[_e])+32768&32767}if(ot){L[oe++]=268435456|hr[Me]<<18|Dn[ot];var qr=31&hr[Me],Hr=31&Dn[ot];de+=Lr[qr]+Dr[Hr],++X[257+qr],++z[Hr],Se=E+Me,++ie}else L[oe++]=d[E],++X[d[E]]}}P=jn(d,x,_,L,X,z,de,oe,ge,E-ge,P)}return dl(b,0,g+cl(P)+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(d,h){var p=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&Pi(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),p){d[3]=8;for(var g=0;p.length>=g;++g)d[g+10]=p.charCodeAt(g)}})(u,t),Pi(u,c-8,s.d()),Pi(u,c-4,i),u}const ed=!!yr||!!as,hl=new WeakMap,pl="text/plain";let Oi=0,Ts=!1;const vl=(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}`:""}`},_s=(e,t,s=!0)=>{var i;const[r,n]=e.split("?"),o=v({},t),a=(i=n?.split("&").map(u=>{var c;const[d,h]=u.split("="),p=s&&(c=o[d])!==null&&c!==void 0?c:h;return delete o[d],`${d}=${p}`}))!==null&&i!==void 0?i:[],l=(function(u,c="&"){let d,h;const p=[];return G(u,function(g,m){w(g)||w(m)||m==="undefined"||(d=encodeURIComponent((_=>_ instanceof File)(g)?g.name:g.toString()),h=encodeURIComponent(m),p[p.length]=h+"="+d)}),p.join(c)})(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},Ci=e=>{if(e.tl)return e.tl;const{data:t,compression:s}=e;if(!t)return;if(s===$e.GZipJS){const r=Qc((function(n){var o=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var a=new Pe(n.length+(n.length>>>1)),l=0,u=function(p){a[l++]=p},c=0;o>c;++c){if(l+5>a.length){var d=new Pe(l+8+(o-c<<1));d.set(a),a=d}var h=n.charCodeAt(c);128>h?u(h):2048>h?(u(192|h>>>6),u(128|63&h)):h>55295&&57344>h?(u(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++c))>>>18),u(128|h>>>12&63),u(128|h>>>6&63),u(128|63&h)):(u(224|h>>>12),u(128|h>>>6&63),u(128|63&h))}return dl(a,0,l)})(Pt(t)),{mtime:0});return{contentType:pl,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(s===$e.Base64){const r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Pt(t)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Pt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const i=Pt(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},fl=e=>{const t=()=>e.transport==="sendBeacon"?{url:_s(e.url,{compression:$e.Base64}),encodedBody:Ci(v(v({},e),{},{compression:$e.Base64,tl:void 0}))}:{url:vl(e.url,"compression"),encodedBody:Ci(v(v({},e),{},{compression:void 0,tl:void 0}))};let s;try{s=Ci(e)}catch(r){if(nn(e.compression,Rt(e.url,"compression")))return $.error("Failed to gzip request body, sending uncompressed payload",r),t();throw r}return s&&nn(e.compression,Rt(e.url,"compression"))&&!((i=s.body)instanceof ArrayBuffer?Ji(new Uint8Array(i)):ArrayBuffer.isView(i)&&Ji(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Ts=!0,t()):{url:e.url,encodedBody:s};var i},gl=e=>{try{return fl(e)}catch(s){var t;return $.error(s),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:s}))}},td=(function(){var e=Z(function*(t){const s=yield(function(r){return Xi.apply(this,arguments)})(Pt(t.data),le.DEBUG,{rethrow:!0});if(!s)return t;const i=yield s.arrayBuffer();return v(v({},t),{},{tl:{contentType:pl,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}})(),sd=/Failed to fetch|NetworkError|Load failed/i,_l=e=>e?.name==="TypeError"&&sd.test(e?.message||""),ml=e=>{try{const t=(function(s,i=Date.now()){if(typeof s!="string"||!s)return;const r=s.trim(),n=/^\d+\s*,/.test(r)?r.slice(0,r.indexOf(",")).trim():r;if(/^\d+$/.test(n)){const l=1e3*Math.min(Number(n),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const o=/^\w{3} \w{3} /.test(n)?n+" GMT":n,a=Date.parse(o)-i;return Number.isFinite(a)&&a>0?Math.min(a,Os):void 0})(e());return w(t)?void 0:Math.min(t,3e4)}catch{return}},yl=e=>{const t=gl(e);if(!t)return;const s=new yr;hl.set(s,!0);const{url:i,encodedBody:r}=t;s.open(e.method||"GET",i,!0);const{contentType:n,body:o}=r??{};G(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,ml(()=>s.getResponseHeader("Retry-After")))}},s.send(o)},bl=e=>{const t=gl(e);if(!t)return;const{url:s,encodedBody:i}=t,{contentType:r,body:n,estimatedSize:o}=i??{},a=new Headers;G(e.headers,function(g,m){a.append(m,g)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(Vr){const g=new Vr;l={signal:g.signal,timeout:setTimeout(()=>{u=!0;try{g.abort(Qo("AbortError","PostHog request timed out"+((m=e.timeout)?` after ${m}ms`:"")))}catch(_){d(_)}var m},e.timeout)}}let c=!1;const d=g=>{var m;c||(c=!0,u&&g?.name==="AbortError"||_l(g)?$.warn(g):$.error(g),(m=e.callback)===null||m===void 0||m.call(e,{statusCode:0,error:g}))};let h=0;const p=()=>{Oi-=h,h=0,l&&clearTimeout(l.timeout)};try{const g=v({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:n,signal:l?.signal},e.fetchOptions),m=o??(w(n)?0:void 0);g.keepalive=g.method==="POST"&&!e.el&&g.keepalive!==!1&&g.body===n&&!w(m)&&m>=0&&52428.8>Oi+m,g.keepalive&&(h=m,Oi+=h),as(s,g).then(_=>_.text().then(f=>{var b;if(c)return;const x={statusCode:_.status,text:f};if(_.status===200)try{x.json=JSON.parse(f)}catch(P){$.error(P)}c=!0,p(),(b=e.callback)===null||b===void 0||b.call(e,x,ml(()=>_.headers.get("Retry-After")))})).catch(_=>{p(),d(_)}).finally(p)}catch(g){p(),d(g)}},fr=e=>{try{var t;const{url:s,encodedBody:i}=fl(e),{contentType:r,body:n,estimatedSize:o}=i??{};if(!n)return;const a=n instanceof Blob?n:new Blob([n],{type:r});if(ce.sendBeacon(s,a))return;const l=M(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(M(l)&&l.length>1&&(o??0)>16384){const u=Math.ceil(l.length/2),c=d=>M(e.data)?d:v(v({},e.data),{},{batch:d});return fr(v(v({},e),{},{data:c(l.slice(0,u))})),void fr(v(v({},e),{},{data:c(l.slice(u))}))}$.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${as?"fetch":"XHR"}`),as?bl(v(v({},e),{},{el:!0})):yl(e)}catch(s){$.warn("Beacon send failed",s)}},Bn=(e,t,s,i)=>{const r=i==="query"?t==="POST"?"sent_at":"_":void 0;return _s(s===$e.GZipJS?vl(e,"compression"):e,v(v({},r?{[r]:Date.now().toString()}:{}),s===$e.GZipJS?{}:{compression:s}))},id=(()=>{const e=[];return as&&e.push({transport:"fetch",method:bl}),yr&&e.push({transport:"XHR",method:yl}),ce?.sendBeacon&&e.push({transport:"sendBeacon",method:fr}),e})();let wl=!ed&&ye?.indexOf("MSIE")===-1&&ye?.indexOf("Mozilla")===-1;function xl(e,t,s){var i,r,n;s&&(t=v(v({},t),{},{callback:o=>s(o)})),e.__loaded?wl?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=v(v({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(i=e.compression)!==null&&i!==void 0?i:t.compressionFallback:t.compression,(w(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,u,c;const d=v(v({},o),{},{callback:a??(_=>{var f;return(f=o.callback)===null||f===void 0?void 0:f.call(o,_)})});d.timeout=d.timeout||6e4;const h=(l=d.transport)!==null&&l!==void 0?l:"fetch";h==="sendBeacon"&&w(d.compression)&&d.data&&(d.compression=$e.Base64),d.method==="POST"&&d.data&&(d.timestampMode==="capture-body"?d.data=(_=>{var f,b;const x=(M(_)?_:[_]).map(E=>v(v({},E),E.timestamp instanceof Date&&!isNaN(E.timestamp.getTime())?{timestamp:E.timestamp.toISOString()}:{})),P=x[0];return{api_key:(f=P==null||(b=P.properties)===null||b===void 0?void 0:b.token)!==null&&f!==void 0?f:P?.token,batch:x,sent_at:new Date().toISOString()}})(d.data):d.timestampMode==="body"&&(d.data=((_,f=new Date().toISOString())=>M(_)?_.map(b=>v(v({},b),{},{sent_at:f})):v(v({},_),{},{sent_at:f}))(d.data))),d.url=Bn(d.url,d.method,d.compression,d.timestampMode);const p=id.filter(_=>!d.disableTransport||!_.transport||!d.disableTransport.includes(_.transport)),g=(u=(c=(function(_,f){for(let b=0;_.length>b;b++)if(f(_[b]))return _[b]})(p,_=>_.transport===h))===null||c===void 0?void 0:c.method)!==null&&u!==void 0?u:p[0].method;if(!g)throw new Error("No available transport method");const m=_=>{try{g(_)}catch(b){var f;_l(b)?$.warn(b):$.error(b),(f=d.callback)===null||f===void 0||f.call(d,{statusCode:0,error:b})}};h!=="sendBeacon"&&!d.preferSyncCompression&&d.data&&d.compression===$e.GZipJS&&Bl&&typeof Promise<"u"&&!Ts?td(d).then(_=>{m(_)}).catch(_=>{if(on(_))return Ts=!0,void m(v(v({},d),{},{compression:void 0,url:Bn(o.url,o.method,void 0,o.timestampMode)}));(f=>{if(!f||typeof f!="object")return!1;const b="name"in f?String(f.name):"";return on(f)||b===oa})(_)&&(Ts=!0),m(d)}):m(d)})(t,(o,a)=>{var l,u,c;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(u=e.config).on_request_error)===null||l===void 0||l.call(u,o),s?s(o,a):(c=t.callback)===null||c===void 0||c.call(t,o)})):t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:0}))}var rd=class{constructor(e,t){this.il=!0,this.nl=[],this.sl=De(t?.flush_interval_ms||3e3,250,5e3,$.createLogger("flush interval"),3e3),this.rl=e}enqueue(e){this.nl.push(e),this.ol||this.al()}unload(){this.ll();const e=this.nl.length>0?this.ul():{},t=Object.values(e);[...t.filter(s=>s.url.indexOf("/e")===0),...t.filter(s=>s.url.indexOf("/e")!==0)].map(s=>{this.hl(s,"sendBeacon")})}enable(){this.il=!1,this.al()}al(){this.il||(this.ol=setTimeout(()=>{if(this.ll(),this.nl.length>0){const e=this.ul();for(const t in e)this.hl(e[t])}},this.sl))}hl(e,t){try{this.rl(e,t)}catch(s){$.error(s)}}ll(){clearTimeout(this.ol),this.ol=void 0}ul(){const e={};return G(this.nl,t=>{var s;const i=t,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");w(e[r])&&(e[r]=v(v({},i),{},{data:[]})),(s=e[r].data)===null||s===void 0||s.push(i.data)}),this.nl=[],e}};const nd=["retriesPerformedSoFar"];var od=class{constructor(e){this._instance=e,this.cl=!1,this.dl=3e3,this.nl=[],this.nl=[],this.vl=!0,this.resume()}resume(){if(!w(y)&&"onLine"in y.navigator){if(this.vl=y.navigator.onLine,this.fl)return;this.fl=()=>{this.vl=!0,this.pl()},this.gl=()=>{this.vl=!1},U(y,"online",this.fl),U(y,"offline",this.gl)}}get length(){return this.nl.length}retriableRequest(e,t){let{retriesPerformedSoFar:s}=e,i=aa(e,nd);qe(s)&&(i.url=_s(i.url,{retry_count:s})),xl(this._instance,t?v(v({},i),{},{transport:t}):i,(r,n)=>{var o;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(s??0))return void this.Ls(v({retriesPerformedSoFar:s},i),n);r.statusCode===0&&$.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${s??0} retries.`)}(o=i.callback)===null||o===void 0||o.call(i,r)})}Ls(e,t){const s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;const i=Math.max((function(o){const a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(s),t??0),r=Date.now()+i;this.nl.push({retryAt:r,requestOptions:e});let n=`Enqueued failed request for retry in ${i}`;navigator.onLine||(n+=" (Browser is offline)"),$.warn(n),this.cl||(this.cl=!0,this.ml())}ml(){if(this.yl&&clearTimeout(this.yl),this.nl.length===0)return this.cl=!1,void(this.yl=void 0);this.yl=setTimeout(()=>{this.vl&&this.nl.length>0&&this.pl(),this.ml()},this.dl)}pl(){const e=Date.now(),t=[],s=this.nl.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.nl=t,s.length>0)for(const{requestOptions:i}of s)this.retriableRequest(i)}unload(){this.yl&&(clearTimeout(this.yl),this.yl=void 0),this.cl=!1,w(y)||(this.fl&&(y.removeEventListener("online",this.fl),this.fl=void 0),this.gl&&(y.removeEventListener("offline",this.gl),this.gl=void 0));for(const{requestOptions:e}of this.nl)try{this._instance._send_request(v(v({},e),{},{transport:"sendBeacon"}))}catch(t){$.error(t)}this.nl=[]}},ad=class{constructor(e){this._instance=e,this.bl=()=>{var t,s,i,r;this._l||(this._l={});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._l.lastScrollY=Math.ceil(o),this._l.maxScrollY=Math.max(o,(t=this._l.maxScrollY)!==null&&t!==void 0?t:0),this._l.maxScrollHeight=Math.max(a,(s=this._l.maxScrollHeight)!==null&&s!==void 0?s:0),this._l.lastContentY=l,this._l.maxContentY=Math.max(l,(i=this._l.maxContentY)!==null&&i!==void 0?i:0),this._l.maxContentHeight=Math.max(u,(r=this._l.maxContentHeight)!==null&&r!==void 0?r:0)}}get wl(){return this._instance.config.scroll_root_selector}getContext(){return this._l}resetContext(){const e=this._l;return this._l=void 0,setTimeout(this.bl,0),e}startMeasuringScrollPosition(){U(y,"scroll",this.bl,{capture:!0}),U(y,"scrollend",this.bl,{capture:!0}),U(y,"resize",this.bl)}scrollElement(){if(this.wl){const s=M(this.wl)?this.wl:[this.wl];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}kl(e){var t,s;const i=e==="y"?"scrollTop":"scrollLeft";if(this.wl){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.kl("y")}scrollX(){return this.kl("x")}};const ld=e=>sl(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes);var qn=class{constructor(e,t,s,i){this.Be=r=>{const n=this.Sl();if(n&&n.sessionId===r)return;const o={sessionId:r,props:this.xl(this._instance)};this.Cl.register({[nr]:o})},this._instance=e,this.$l=t,this.Cl=s,this.xl=i||ld,this.$l.onSessionId(this.Be)}Sl(){return this.Cl.props[nr]}getSetOnceProps(){var e;const t=(e=this.Sl())===null||e===void 0?void 0:e.props;return t?"r"in t?il(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 G(Fr(this.getSetOnceProps()),(t,s)=>{s==="$current_url"&&(s="url"),e[`$session_entry_${Vi(s)}`]=t}),e}},Xs=class{on(e,t){return this.Tl[e]||(this.Tl[e]=[]),this.Tl[e].push(t),()=>{this.Tl[e]=this.Tl[e].filter(s=>s!==t)}}emit(e,t){for(const s of this.Tl[e]||[])s(t);for(const s of this.Tl["*"]||[])s(e,t)}constructor(){this.Tl={}}};const xt=se("[SessionId]"),Hn=864e5;var Vn=class{on(e,t){return this.Il.on(e,t)}constructor(e,t,s){var i;if(this.Ml=null,this.El=null,this.Pl=[],this.Rl=void 0,this.Al=!1,this.Il=new Xs,this.Fl=(n,o)=>!(!qe(n)||!qe(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.Ir=e.config,this.Cl=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Ol=void 0,this._sessionActivityTimestamp=null,this.Dl=t||Te,this.Ll=s||Te;const r=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*De(this.Ir.session_idle_timeout_seconds||1800,60,36e3,xt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Nl(),this.ql="ph_"+r+"_window_id",this.jl="ph_"+r+"_primary_window_exists",this.Bl()){const n=J.Dt(this.ql),o=J.Dt(this.jl);n&&!o?this.He=n:J.Lt(this.ql),J.At(this.jl,!0)}!((i=this.Ir.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Hl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return w(this.Pl)&&(this.Pl=[]),this.Pl.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Pl=this.Pl.filter(t=>t!==e)}}Bl(){return this.Ir.persistence!=="memory"&&!this.Cl.mi&&J.Et()}zl(e){e!==this.He&&(this.He=e,this.Bl()&&J.At(this.ql,e))}Ul(){return this.He?this.He:this.Bl()?J.Dt(this.ql):null}Wl(e){const t=this.Ml;return!re(t)&&!re(e)&&5e3>Math.abs(e-t)}Vl(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.Wl(t)||(this.Ml=t,this.Cl.register({[$t]:[t,e,s]}))}Gl(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return qe(t)&&t>0}Zl(){this.Gl()?this.Cl.refreshKey($t):(this.Cl.flush(),this.Cl.load())}Ql(){var e;if(re(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ml)return;this.Zl();const[,t,s]=this.Jl();t===this.Xt&&s===this._sessionStartTimestamp&&(this.Ml=this._sessionActivityTimestamp,this.Cl.register({[$t]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Cl.flush())}Kl(){const[e]=this.Jl(),t=qe(e)?e:0,s=qe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Xl(e){return this.Zl(),this.Fl(e,this.Kl())}Jl(){const e=this.Cl.props[$t];return M(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ml=null,this.Ol=void 0,clearTimeout(this.Yl),this.Yl=void 0,this.Vl(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!w(s)&&(t?this.Ol={sessionId:e,sessionStartTimestamp:s}:this.Vl(e,new Date().getTime(),s),!0)}destroy(){this.Al=!0,this.Ql(),clearTimeout(this.Yl),this.Yl=void 0,this.Rl&&y&&(y.removeEventListener(zs,this.Rl,{capture:!1}),this.Rl=void 0),this.Pl=[]}Hl(){this.Rl=()=>{this.Ql(),this.Bl()&&J.Lt(this.jl)},U(y,zs,this.Rl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,s=!1){if(this.Ir.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.El=i;else if(re(this.El)||this.El>i||i-this.El>=1e3){var n,o;(n=(o=this.Cl).syncCookieProperties)===null||n===void 0||n.call(o),this.El=i}let[,a,l]=this.Jl();const u=!w(r)&&a!==r,c=this.Kl();let d=this.Ul();const h=this.Ol,p=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Hn),g=h?p:qe(l)&&Math.abs(i-l)>Hn;let m=!1,_=u;const f=!a||!!h,b=a;let x=!f&&!e&&this.Fl(i,c);if(x&&(x=this.Xl(i),x||xt.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Jl()),f||x||g){_=!1;const C=h&&!p;a=C?h.sessionId:this.Dl(),d=this.Ll(),xt.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!C,changeReason:{noSessionId:f,activityTimeout:x,sessionPastMaximumLength:g}}),l=C?h.sessionStartTimestamp:i,this.Ol=void 0,m=!0}else d||(d=this.Ll(),m=!0),_=_||a!==b,_&&(xt.info("adopted cross-tab session id",{sessionId:a,windowId:d}),m=!0);const P=qe(c)&&e&&!g?c:i,E=qe(l)?l:new Date().getTime();this.zl(d),this.Vl(a,P,E),e||this.Nl();const I={noSessionId:f,activityTimeout:x,sessionPastMaximumLength:g,crossTabAdoption:_};return m&&this.Pl.forEach(C=>C(a,d,I)),{sessionId:a,windowId:d,sessionStartTimestamp:E,changeReason:m?I:void 0,lastActivityTimestamp:c}}Nl(){this.Al||(clearTimeout(this.Yl),this.Yl=setTimeout(()=>{if(!this.Al)if(this.Xl(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Il.emit("forcedIdleReset",{idleSessionId:e})}else this.Nl()},1.1*this.sessionTimeoutMs))}};const kl=function(e,t){if(!e)return!1;const s=e.userAgent;if(s&&Ur(s,t))return!0;try{const i=e?.userAgentData;if(i?.brands&&i.brands.some(r=>Ur(r?.brand,t)))return!0}catch{}return!!e.webdriver};function El(){return(El=Z(function*(){const e=ce?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),s=t?.model;return D(s)&&s.length>0?s:void 0}catch(t){return void $.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function ud(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 $l(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 Ys=(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}},Es=e=>e.toLowerCase(),Sl={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=>Ys(s,i))),not_regex:(e,t)=>t.every(s=>e.every(i=>!Ys(s,i))),icontains:(e,t)=>t.map(Es).some(s=>e.map(Es).some(i=>s.includes(i))),not_icontains:(e,t)=>t.map(Es).every(s=>e.map(Es).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 Il(e,t){return!e||Object.entries(e).every(([s,i])=>{const r=t?.[s];if(r==null)return!1;const n=Sl[i.operator];return!!n&&n(i.values.map(String),[String(r)])})}function Fi(e,t,s){return Pt({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:s})}const gr="custom",zn="i.posthog.com",cd=/^\/static\//,dd=["/s/","/e/","/i/"];var hd=class{constructor(e){this.tu={},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(`.${zn}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.tu[this.apiHost]||(this.tu[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":gr),this.tu[this.apiHost]}eu(e){if(!cd.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}iu(e){const t=nt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}nu(e,t,s){if(e==="ui")return s;let i=s;const r=this.instance.config.rewriteRequestPath;if(r){var n;const o=((n=nt(s))===null||n===void 0?void 0:n.href)||s;i=r(new URL(o)).toString()}if(r&&e==="api"&&dd.some(o=>t.indexOf(o)===0)){const o=this.iu(i);if(o){const a=this.apiHost;let l=this.su;l?.apiHost===a&&l.rewriteRequestPath===r||(l={apiHost:a,rewriteRequestPath:r,urls:new Set},this.su=l),l.urls.add(o)}}return i}isIngestionEndpoint(e){const t=this.su,s=this.iu(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.nu(e,t,this.uiHost+t);if(e==="flags")return this.nu(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.eu(t);if(i)return this.nu(e,t,`${i}${t}`)}if(this.region===gr)return this.nu(e,t,this.apiHost+t);const s=zn+t;switch(e){case"assets":return this.nu(e,t,`https://${this.region}-assets.${s}`);case"api":return this.nu(e,t,`https://${this.region}.${s}`)}}};const W=se("[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){W.error("Failed to persist survey seen state",t)}},pd=[$i.Popover,$i.Widget,$i.API],vd={ignoreConditions:!1,ignoreDelay:!1,displayType:dr.Popover},fd=se("[PostHog ExternalIntegrations]"),gd={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var _d=class{constructor(e){this._instance=e}qo(e,t){var s,i;(s=F.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,e,r=>{if(r)return fd.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=F.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[r])&&this.qo(gd[r],()=>{var o;(o=F.__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=F.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0)&&s[r])&&((i=F.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},md=class{constructor(e,t){this.$=e,this.mo=t,this.ru=new Map,this.xo=!1}add(e){var t=this;return Z(function*(){if(t.xo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.ru.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.ru.set(e.name,e);try{const s=e.setup(t.mo);s&&(yield s)}catch(s){const i=t.ru.get(e.name)===e;i&&t.ru.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,s),i&&t.ou(e)}})()}getExtension(e){return this.ru.get(e)}dispose(){if(this.xo)return;this.xo=!0;const e=Array.from(this.ru.values()).reverse();this.ru.clear();for(const t of e)this.ou(t)}ou(e){try{var t;const s=(t=e.dispose)===null||t===void 0?void 0:t.call(e);s&&ue(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)}}},yd=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);w(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 Un="extensionsRemoteConfig";var bd=class{constructor(e){this.instance=e,this.xo=!1,this.$=$,this.au=e.lu,this.kv=new yd(e),this.onEvent=t=>ks(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.xo)return ks(()=>{});const s=r=>{try{t(r)}catch(n){this.$.error("Browser extension remote config listener failed",n)}},i=this.instance.uu.on(Un,s);return this.au&&s(this.au),ks(i)},this.hu=new md($.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:le.LIB_NAME,version:le.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.hu.add(e)}getExtension(e){return this.hu.getExtension(e)}capture(e,t,s){s?this.instance.capture(e,t,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return ks(this.instance.cu(e))}handleRemoteConfig(e){this.xo||(this.au=e,this.instance.uu.emit(Un,e))}sendRequest(e){var t=this;return Z(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?_s(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"?Hi.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.xo||(this.xo=!0,this.hu.dispose())}};const rs={};let Ti=0;const ns=()=>{},Wn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Wt="Surveys module not available",Gn="sanitize_properties is deprecated. Use before_send instead",Ol="Invalid value for property_denylist config: ",wd=/^[A-Za-z0-9_-]{1,400}$/,Kn=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Jn=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,xd=["token","distinct_id",Oa],Jt="posthog",kd=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},Mi=e=>{var t;return v({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xc(k?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ns,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&&D(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){$.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:Ra,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ns},(s=>({rageclick:s&&s>="2026-05-30"?{content_ignorelist:Cc,ignore_text_selection:!0}:!s||"2025-11-30">s||{content_ignorelist:!0},capture_pageview:!s||"2025-05-24">s||"history_change",session_recording:kd(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))},Ed=[["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"]],Xn=e=>{const t={};for(const[r,n]of Ed)w(e[r])||(t[n]=e[r]);const s=Y({},t,e),i=e.__preview_external_dependency_versioned_paths;return w(i)||(w(e.strict_script_versioning)&&(s.strict_script_versioning=!!i),D(i)&&w(e.asset_host)&&(s.asset_host=i)),M(e.property_blacklist)&&(w(e.property_denylist)?s.property_denylist=e.property_blacklist:M(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:$.error(Ol+e.property_denylist)),s};var $d=class{constructor(){this.__forceAllowLocalhost=!1}get du(){return this.__forceAllowLocalhost}set du(e){$.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},os=class Ze{vu(t){if(!t)return;const s=this.ru.indexOf(t);s!==-1&&this.ru.splice(s,1)}fu(t,s){var i;return this.vu(t),this.ru.push(s),(i=s.initialize)===null||i===void 0||i.call(s),s}pu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}gu(){if(this.mu||this.config.reuseAnonymousId||this.config.segment||this.pu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.yu)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.mu=!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}`)}bu(){if(this.pu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this._u()||t.load(!0);const s=this.get_distinct_id();if(!s||s==="$posthog_cookieless"){const i=this.config.get_device_id(Te());this.register({distinct_id:i,$device_id:i}),t.set_property(be,ze)}this.wu()}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.ku=!1,this.Su=!1,this.webPerformance=new $d,this.xu=!1,this.version=le.LIB_VERSION,this.Cu=new Set,this.$u="",this.uu=new Xs,this.ru=[],this.Tu=[],this.yu=!1,this.mu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mi(),this.SentryIntegration=Nc,this.sentryIntegration=i=>(function(r,n){const o=Ka(r,n);return{name:Ga,processEvent:a=>o(a)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Iu=!1,this.Mu=null,this.Eu=null,this.Pu=null,this.scrollManager=new ad(this),this.pageViewManager=new Fn(this),this.rateLimiter=new Kc(this),this.requestRouter=new hd(this),this.consent=new Oc(this),this.externalIntegrations=new _d(this);const s=(t=Ze.__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=D(i)?{[i]:r}:i;this.setPersonProperties(o),n?.({})},set_once:(i,r,n)=>{const o=D(i)?{[i]:r}:i;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",i=>$.info(`send "${i?.event}"`,i))}init(t,s,i){if(i&&i!==Jt){var r;const n=(r=rs[i])!==null&&r!==void 0?r:new Ze;return n._init(t,s,i),rs[i]=n,rs[Jt][i]=n,n}return this._init(t,s,i)}_init(t,s={},i){var r,n,o;const a=D(t)?t.trim():"";if(!a)return $.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=Mi(s.defaults),s.debug=this.Ru(s.debug),this.Au=s,this.Fu=[],s.person_profiles?this.Eu=s.person_profiles:s.process_person&&(this.Eu=s.process_person);const u=Mi(s.defaults),c=Xn(s),d=Y({},u,c,{name:i,token:a});N(u.rageclick)&&N(c.rageclick)&&(d.rageclick=Y({},u.rageclick,c.rageclick)),N(u.session_recording)&&N(c.session_recording)&&(d.session_recording=Y({},u.session_recording,c.session_recording)),this.set_config(d),this.config.on_xhr_error&&$.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:$e.GZipJS;const h=this._u();if(this.persistence=new Ei(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ei(v(v({},this.config),{},{persistence:"sessionStorage"}),h,!1),this.$u="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!h&&J.Et()){const f=J.Dt(this.$u);M(f)&&f.forEach(b=>{D(b)&&this.Cu.add(b)})}else J.Lt(this.$u);const p=v({},this.persistence.props),g=v({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ou=new rd((f,b)=>this.Du(f,b),this.config.request_queue_config),this.Lu=new od(this),this.__request_queue=[];const m=this.pu();m||(this.sessionManager=new Vn(this),this.sessionPropsManager=new qn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((f,b,x)=>{(x?.activityTimeout||x?.sessionPastMaximumLength||x?.crossTabAdoption)&&this.Nu()})),this.qu(),this.config.__preview_deferred_init_extensions?($.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.ju(m)},0)):($.info("Initializing extensions synchronously"),this.ju(m)),le.DEBUG=le.DEBUG||this.config.debug,le.DEBUG&&$.info("Starting in debug mode",{this:this,config:s,thisC:v({},this.config),p,s:g}),this.config.identity_distinct_id&&!(!((r=s.bootstrap)===null||r===void 0)&&r.distinctID)&&(s.bootstrap=v(v({},s.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=(n=s.bootstrap)===null||n===void 0?void 0:n.distinctID;if(this.yu=!!_&&!Xt(_),(o=s.bootstrap)===null||o===void 0?void 0:o.distinctID){const f=s.bootstrap.distinctID,b=this.get_distinct_id(),x=this.persistence.get_property(be);if(s.bootstrap.isIdentifiedID&&b!=null&&b!==f&&x==="anonymous")this.identify(f);else if(s.bootstrap.isIdentifiedID&&b!=null&&b!==f&&x==="identified")$.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 P=this.config.get_device_id(Te()),E=s.bootstrap.isIdentifiedID?P:f;this.persistence.set_property(be,s.bootstrap.isIdentifiedID?Cs:ze),this.register({distinct_id:f,$device_id:E})}}if(m)this.register_once({distinct_id:gi,$device_id:null},"");else if(!this.get_distinct_id()){const f=this.config.get_device_id(Te());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(be,ze)}return U(y,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),U(y,"pageshow",()=>{var f;this.ku=!1,this.Su||(f=this.Lu)===null||f===void 0||f.resume()}),s.segment?Cn(this,()=>this.Bu()):this.Bu(),ue(this.config._onCapture)&&this.config._onCapture!==ns&&($.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",f=>this.config._onCapture(f.event,f))),this.config.ip&&$.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 El.apply(this,arguments)})().then(f=>{f&&this.register({[fi]:f})}).catch(ns),this}Hu(t){const s=t;return D(s.name)&&ue(s.setup)}zu(t,s){this.Hu(t)?s.push(()=>{this.Uu().add(t).catch(()=>{var i;return(i=t.dispose)===null||i===void 0?void 0:i.call(t)}).catch(i=>{$.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.ru.push(t)}qu(){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=Ze.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var n,o,a;r&&(this.featureFlags&&this.featureFlags instanceof r||((n=this.Wu)===null||n===void 0||n.call(this),this.Wu=void 0,this.featureFlags=new r(this)),ue(this.featureFlags.onReloading)&&ue(this.featureFlags.setup)?this.Wu||(this.Wu=this.featureFlags.onReloading(()=>{this.uu.emit("featureFlagsReloading",!0)}),this.Uu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}ju(t){const s=performance.now(),i=v(v({},Ze.__defaultExtensionClasses),this.config.__extensionClasses),r=[];var n,o,a,l,u,c,d;i.exceptions&&this.ru.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new i.exceptions(this)),i.historyAutocapture&&this.ru.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.ru.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.ru.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.ru.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.zu(this.autocapture=new i.autocapture(this),r),i.surveys&&this.zu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new i.surveys(this),r),i.logs&&this.zu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new i.logs(this),r),i.metrics&&this.ru.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new i.metrics(this)),i.conversations&&this.ru.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new i.conversations(this)),i.productTours&&this.ru.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.ru.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.ru.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.ru.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.ru.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,Dc)),i.toolbar&&this.ru.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new i.toolbar(this)),i.experiments&&this.ru.push(this.experiments=(d=this.experiments)!==null&&d!==void 0?d:new i.experiments(this)),this.ru.forEach(h=>{h.initialize&&r.push(()=>{var p;(p=h.initialize)===null||p===void 0||p.call(h)})}),r.push(()=>{if(this.Vu){const h=this.Vu;this.Vu=void 0,this.ru.forEach(p=>{var g;return(g=p.onRemoteConfig)===null||g===void 0?void 0:g.call(p,h)})}}),this.Gu(r,s)}Gu(t,s){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-s>=30&&t.length>0)return void setTimeout(()=>{this.Gu(t,s)},0);const r=t.shift();if(r)try{r()}catch(n){$.error("Error initializing extension:",n)}}const i=Math.round(performance.now()-s);this.register_for_session({[Ca]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Fa]:i}),this.config.__preview_deferred_init_extensions&&$.info(`PostHog extensions initialized (${i}ms)`)}Xa(t){var s;if(!k||!k.body)return $.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Xa(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Vu=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,$e.GZipJS)?$e.GZipJS:R(r.supportedCompression,$e.Base64)?$e.Base64:void 0),!((i=r.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Eu?this.Eu:Ra}),(s=this.Zu)===null||s===void 0||s.handleRemoteConfig(t),this.ru.forEach(r=>{var n;return(n=r.onRemoteConfig)===null||n===void 0?void 0:n.call(r,t)})}Bu(){try{this.config.loaded(this)}catch(t){$.critical("`loaded` function failed",t)}if(this.Qu(),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.pu())&&this.Ju()},1),this.Ku=new ol(this),this.Ku.load()}Qu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ou)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&It(this.__request_queue,t=>this.Du(t)),this.__request_queue=[],this.Qu()}_handle_unload(){var t,s,i,r,n,o;this.ku=!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.Xu()&&this.capture(vn),(r=this.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=this.Ou)===null||n===void 0||n.unload(),(o=this.Lu)===null||o===void 0||o.unload()):this.Xu()&&this.capture(vn,null,{transport:"sendBeacon"})}_send_request(t){xl(this,t)}Du(t,s){this.Lu?this.Lu.retriableRequest(t,s):this._send_request(s?v(v({},t),{},{transport:s}):t)}_execute_array(t){Ti++;try{let s;const i=[],r=[],n=[];It(t,a=>{if(a)if(s=a[0],M(s))n.push(a);else if(ue(a))try{a.call(this)}catch(l){$.error("Error executing queued PostHog call",a,l)}else M(a)&&s==="alias"?i.push(a):M(a)&&s.indexOf("capture")!==-1&&ue(this[s])?n.push(a):r.push(a)});const o=function(a,l){It(a,function(u){try{if(M(u[0])){let c=l;G(u,function(d){c=c[d[0]].apply(c,d.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(c){$.error("Error executing queued PostHog call",u,c)}})};o(i,this),o(r,this),o(n,this)}finally{Ti--}}push(t){if(Ti>0&&M(t)&&D(t[0])){const s=Ze.prototype[t[0]];return void(ue(s)&&s.apply(this,t.slice(1)))}this._execute_array([t])}get Yu(){return{property:hn,persistenceKey:Ct,cookieName:"_fbc",pattern:Kn,register:(t,s)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[Ct]:{value:t,delivered:s}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Ct)}}}get th(){return{property:pn,persistenceKey:Zt,cookieName:"_fbp",pattern:Jn,register:(t,s)=>{var i;return(i=this.persistence)===null||i===void 0?void 0:i.register({[Zt]:{value:t,delivered:s}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Zt)}}}eh(t){var s;const i=(s=this.persistence)===null||s===void 0?void 0:s.get_property(t.persistenceKey);return D(i)&&t.pattern.test(i)?{value:i,delivered:!1}:N(i)&&D(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:i.delivered===!0}:void 0}ih(t,s,i){return s===i?.value?{value:s,pending:!i.delivered}:(t.register(s,!1),{value:s,pending:!0})}nh(t){if(!this.config.save_campaign_params||this.pu())return;const s=Us(t.cookieName);return D(s)&&t.pattern.test(s)?s:void 0}sh(t,s,i,r){if(!this.persistence)return;const n=this.Yu;this.persistence.refreshKey(n.persistenceKey);const o=this.eh(n);if(r)return void n.unregister();if(i)return D(s)&&Kn.test(s)?this.ih(n,s,o):void n.unregister();const a=D(t)&&wd.test(t)?t:void 0,l=this.nh(n);return l&&((u,c,d)=>{const h=u.split(".");if(c)return h[3]===c;if(!d)return!0;const p=d.value.split(".");return h[3]===p[3]||Number(h[2])>Number(p[2])})(l,a,o)?this.ih(n,l,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.ih(n,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}rh(t,s,i){if(!this.persistence)return;const r=this.th;this.persistence.refreshKey(r.persistenceKey);const n=this.eh(r);if(i)return void r.unregister();if(s)return D(t)&&Jn.test(t)?this.ih(r,t,n):void r.unregister();const o=this.nh(r);return o?this.ih(r,o,n):n?{value:n.value,pending:!n.delivered}:void 0}oh(t,s){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.eh(t);i?.value!==s||i.delivered||t.register(s,!0)}capture(t,s,i){var r,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ou))return void $.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(w(t)||!D(t))return void $.error("No event name provided to posthog.capture");this.bu();const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;const a=i?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void $.critical("This capture call is ignored due to client rate limiting.");let l;s?.$current_url&&!D(s?.$current_url)&&($.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?.ah||$.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&&(l=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 u=new Date,c=i?.timestamp||u,d=Jr(i?.uuid,Te);let h={uuid:d,event:t,properties:this.calculateEventProperties(t,s||{},c,d)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),a&&(h.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const p=t==="$feature_flag_called"&&h.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i?.$set&&!p&&(h.$set=i?.$set);const g=N(s?.$set)?s.$set:void 0,m=M(s?.$unset)?s.$unset:[],_=i?.$unset||[],f=T=>{var B;const L=!!i?.$set&&T in i.$set;return{hasProvided:L||!!g&&T in g,provided:L?i==null||(B=i.$set)===null||B===void 0?void 0:B[T]:g?.[T],unset:m.indexOf(T)!==-1||_.indexOf(T)!==-1}},b=f(hn),x=f(pn),P=[{channel:this.Yu,hasProvided:b.hasProvided,update:this.sh(l?.fbclid,b.provided,b.hasProvided,b.unset)},{channel:this.th,hasProvided:x.hasProvided,update:this.rh(x.provided,x.hasProvided,x.unset)}];for(const{channel:T,hasProvided:B,update:L}of P)L&&h.properties.$process_person_profile===!0&&L.pending&&!B&&!p&&(h.$set=v({[T.property]:L.value},h.$set));const E=i?.$unset;E&&(h.$unset=E);const I=p?void 0:this.uh(i?.$set_once,t!==fn,t===Aa);if(I&&(h.$set_once=I),i?._noTruncate||(C=this.config.properties_string_max_length,h=(function(T,B){const L=new Set;return(function X(z,ie){if(z!==Object(z))return B?B(z):z;if(L.has(z))return;let de;if(L.add(z),M(z))de=[],It(z,oe=>{de.push(X(oe))});else{const oe={};G(Dt(z)?La(z):z,(Se,ge)=>{L.has(Se)||(oe[ge]=X(Se))}),de=oe}return de})(T)})(h,T=>D(T)?T.slice(0,C):T)),h.timestamp=c,w(i?.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=u),p&&(h.properties=((T,B=[])=>{const L={},X=z=>{T[z]!==void 0&&(L[z]=T[z])};return Au.forEach(X),B.forEach(X),L})(h.properties,xd)),t===Ue.DISMISSED||t===Ue.SENT){const T=s?.[Si.SURVEY_ID],B=s?.[Si.SURVEY_ITERATION];Pl({id:T,current_iteration:B}),h.$set=v(v({},h.$set),{},{[ud({id:T,current_iteration:B},t===Ue.SENT?"responded":"dismissed")]:!0})}else t===Ue.SHOWN&&(h.$set=v(v({},h.$set),{},{[Si.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var C;if(t===Gc.SHOWN){const T=s?.[Rn.TOUR_TYPE];T&&(h.$set=v(v({},h.$set),{},{[`${Rn.TOUR_LAST_SEEN_DATE}/${T}`]:new Date().toISOString()}))}const S=v(v({},h.properties.$set),h.$set);if(ke(S)||this.setPersonPropertiesForFlags(S),!A(this.config.before_send)){const T=this.Os(h);if(!T)return;h=T,h.uuid=Jr(h.uuid,Te)}const O=P.filter(({channel:T,update:B})=>{var L,X,z;const ie=(L=(X=h.$set)===null||X===void 0?void 0:X[T.property])!==null&&L!==void 0?L:N((z=h.properties)===null||z===void 0?void 0:z.$set)?h.properties.$set[T.property]:void 0;return B?.pending&&ie===B.value});this.uu.emit("eventCaptured",h);const j=(r=i?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H=i?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(j),V=v(v(v({method:"POST",url:j,data:h,compression:"best-available",preferSyncCompression:i?.send_instantly,timestampMode:H?"body":"capture-body",batchKey:i?._batchKey},H&&(!((n=h.properties)===null||n===void 0)&&n.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),i?.transport?{transport:i.transport}:{}),O.length?{fireCallbackOnDrop:!0,callback:T=>{if(T.statusCode>=200&&300>T.statusCode)for(const{channel:B,update:L}of O)this.oh(B,L.value)}}:{});if(!this.config.request_batching||i&&!i?._batchKey||i?.send_instantly||O.length){var K;let T;!V.transport&&!V.callback&&ke((K=this.config.request_headers)!==null&&K!==void 0?K:{})&&this.ku&&(T="sendBeacon"),this.Du(V,T)}else this.Ou.enqueue(V);return h}_addCaptureHook(t){return this.on("eventCaptured",s=>t(s.event,s))}getExtension(t){var s;return(s=this.Zu)===null||s===void 0?void 0:s.getExtension(t)}Uu(){var t;return(t=this.Zu)!==null&&t!==void 0?t:this.Zu=new bd(this)}cu(t){this.Tu.push(t);let s=!0;return()=>{if(!s)return;s=!1;const i=this.Tu.indexOf(t);i!==-1&&this.Tu.splice(i,1)}}hh(t=!0){var s,i,r;return!!(!((s=this.persistence)===null||s===void 0)&&s.consumeCookieIdentityChange())&&(this.Pu=null,this.persistence.get_property("$user_state")==="anonymous"&&((r=this.sessionPersistence)===null||r===void 0||r.clear(),this.Cu.clear(),this.dh()),(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.hh();const o=n?void 0:this.persistence.remove_event_timer(t);let a=v({},s);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.pu()&&(a[Oa]=!0),t==="$snapshot"){const b=v(v({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=b.distinct_id,(!D(a.distinct_id)&&!ne(a.distinct_id)||Xt(a.distinct_id))&&$.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const l=(function(b,x,P,E=!1){var I,C,S,O;if(!ye)return{};const j=b?[...At,...x||[]]:[],[H,V]=Jo(ye),[K,T]=(function(pe){for(let _e=0;Kr.length>_e;_e++){const[Ge,_t,xe]=Kr[_e],Me=pe.match(Ge);if(Me){const ot=xe&&pe.match(xe)||Me;return[_t,ot?.[1]||""]}}return["",""]})(ye),B=(function(){const pe="u">typeof navigator?navigator:void 0;return pe?.brave?{brave:!0}:{}})(),L={};w(P)||(L.detectGoogleSearchApp=P);const X={},z=(I=navigator)===null||I===void 0||(I=I.userAgentData)===null||I===void 0?void 0:I.platform,ie=(C=navigator)===null||C===void 0?void 0:C.maxTouchPoints,de=y==null||(S=y.screen)===null||S===void 0?void 0:S.width,oe=y==null||(O=y.screen)===null||O===void 0?void 0:O.height,Se=y?.devicePixelRatio;w(z)||(X.userAgentDataPlatform=z),w(ie)||(X.maxTouchPoints=ie),w(de)||(X.screenWidth=de),w(oe)||(X.screenHeight=oe),w(Se)||(X.devicePixelRatio=Se);const ge=Y(Fr({$os:H,$os_version:V,$browser:Ko(ye,navigator.vendor,B,L),$webview_app:K,$webview_app_version:T,$device:Xo(ye),$device_type:iu(ye,X),$timezone:rl(),$timezone_offset:zc()}),{$current_url:ps(E?rt(ee?.href):ee?.href,j,vs),$host:ee?.host,$pathname:ee?.pathname,$raw_user_agent:ye.length>1e3?ye.substring(0,997)+"...":ye,$browser_version:su(ye,navigator.vendor,B,L),$browser_language:el(),$browser_language_prefix:Vc(),$screen_height:y?.screen.height,$screen_width:y?.screen.width,$viewport_height:y?.innerHeight,$viewport_width:y?.innerWidth,$lib:We.LIB_NAME,$lib_version:We.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return We.SDK_DIST_CHANNEL&&(ge.$sdk_dist_channel=We.SDK_DIST_CHANNEL),ge})(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:b,windowId:x}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime(),!0);a.$session_id=b,a.$window_id=x}this.sessionPropsManager&&Y(a,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&Y(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(u=this.Lu)===null||u===void 0?void 0:u.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}let c;if(this.requestRouter.region===gr&&(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=Y(a,c),t==="$pageview"&&k&&(a.title=k.title),!w(o)){const b=i.getTime()-o;a.$duration=parseFloat((b/1e3).toFixed(3))}ye&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const d=this.persistence.properties(),h=this.sessionPersistence.properties(),p=a.$groups,g=d.$groups;N(p)&&!ke(p)&&(a.$groups=v(v({},N(g)?g:{}),p)),G(["$referrer","$referring_domain"],b=>{b in d&&delete h[b]});const m={};if(this.Tu.length>0)for(const b of this.Tu.slice())try{Y(m,b())}catch(x){$.error("Failed to produce browser extension event properties",x)}a=Y({},l,d,h,v(v({},m),a)),a.$is_identified=this._isIdentified(),M(this.config.property_denylist)?G(this.config.property_denylist,function(b){delete a[b]}):$.error(Ol+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&($.error(Gn),a=_(a,t));const f=this.fh();return a.$process_person_profile=f,f&&!n&&this.ph("_calculate_event_properties"),a}uh(t,s=!0,i=!1){var r;if(!this.persistence||!this.fh()||this.xu&&!i)return t;const n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)===null||r===void 0?void 0:r.getSetOnceProps();let a=Y({},n,o||{},t||{});const l=this.config.sanitize_properties;return l&&($.error(Gn),a=l(a,"$set_once")),s&&(this.xu=!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.hh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(r=>this.Cu.add(r)),this.dh()}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.Cu.delete(t),this.dh()}gh(t,s){this.register({[t]:s})}Nu(){this.Cu.forEach(t=>{var s;(s=this.sessionPersistence)===null||s===void 0||s.unregister(t)}),this.Cu.clear(),this.dh()}dh(){var t;if(!this.$u)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.mi||!J.Et())return void J.Lt(this.$u);const s=[];this.Cu.forEach(i=>s.push(i)),s.length>0?J.At(this.$u,s):J.Lt(this.$u)}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.uu.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=vd){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})}mh(t){return!t||Xt(t)?($.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?($.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())||($.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 $.uninitializedWarning("posthog.identify");if(ne(t)&&(t=t.toString(),$.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.mh(t)||!this.ph("posthog.identify"))return;this.bu();const r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.hh(!1),a=this.persistence.Ra();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 d=(this.persistence.get_property("$user_state")||"anonymous")===ze,h=t!==c,p=!h&&d;if(h&&d){var u;const g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:c};this.persistence.set_property(be,Cs),this.setPersonPropertiesForFlags({$set:s||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Aa(),this.capture("$identify",g,{$set:s||{},$set_once:i||{}})&&(this.Pu=Fi(t,s,i)),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:c)}else if(p){this.persistence.set_property(be,Cs);const g=s||{},m=i||{};this.setPersonPropertiesForFlags({$set:g,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Aa(),this.capture("$set",{$set:g,$set_once:m})&&(this.Pu=Fi(t,s,i))}else(s||i)&&this.setPersonProperties(s,i);h||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(st)):p&&(s||i)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Da(l)}}setPersonProperties(t,s){if(!t&&!s||!this.ph("posthog.setPersonProperties"))return;const i=Fi(this.get_distinct_id(),t,s);this.Pu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!0),this.capture("$set",{$set:t||{},$set_once:s||{}})&&(this.Pu=i)):$.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var s;const i=(M(t)?t:[t]).filter(r=>D(r)&&r.length>0);i.length!==0&&this.ph("posthog.unsetPersonProperties")&&((s=this.featureFlags)===null||s===void 0||s.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Pu=null)}group(t,s,i){var r;if(!t||!s)return void $.error("posthog.group requires a group type and group key");(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.hh();const n=this.getGroups(),o=n[t]!==s;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:v(v({},n),{},{[t]:s})}),(o||i)&&this.fh()){const a={$group_type:t,$group_key:s};i&&(a.$group_set=i),this.capture(fn,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.ph("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=we(t)?t:t?.resetDeviceID,i=we(t)||t==null?void 0:t.bootstrap;this.yh(s,!1,i)}yh(t,s=!1,i){var r,n,o,a,l,u;if($.info("reset"),!this.__loaded)return $.uninitializedWarning("posthog.reset");const c=i?.sessionID;this.config.bootstrap=i||((r=this.Au)===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.Ya());const d=this.get_property($r),h=this.get_property(fi),p=this.get_property(Qt);(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.Ra)===null||u===void 0?void 0:u.call(l);let _=!1;try{var f,b,x,P,E,I,C,S,O,j,H,V,K;if((f=this.persistence)===null||f===void 0||f.clear(),(b=this.sessionPersistence)===null||b===void 0||b.clear(),this.Cu.clear(),this.dh(),w(p)||(j=this.persistence)===null||j===void 0||j.register({$session_recording_remote_config:p}),(x=this.surveys)===null||x===void 0||x.reset(),(P=this.featureFlags)===null||P===void 0||P.reset(),(E=this.conversations)===null||E===void 0||E.reset(),(I=this.logs)===null||I===void 0||I.reset(),(C=this.metrics)===null||C===void 0||C.reset(),(S=this.persistence)===null||S===void 0||S.set_property("$user_state","anonymous"),(O=this.sessionManager)===null||O===void 0||O.resetSessionId(),this.Pu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:gi,$device_id:null},"");else{const L=this.config.get_device_id(Te());this.register_once({distinct_id:L,$device_id:t?L:d},""),t||w(h)||this.register({[fi]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.pu()&&((K=this.persistence)===null||K===void 0||K.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(H=this.featureFlags)===null||H===void 0||H.initialize(),!A(c)&&!(!((V=this.sessionManager)===null||V===void 0)&&V.setBootstrapSessionId(c,!0)))){const L=v({},i);delete L.sessionID,this.config.bootstrap=L}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var T,B;m&&((T=this.persistence)===null||T===void 0||(B=T.Da)===null||B===void 0||B.call(T,_))}this.reloadFeatureFlags()}shutdown(t){var s=this;return Z(function*(){var i,r,n,o,a,l,u,c;if(s.__loaded){s.Su=!0,s.Uu().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.metrics)===null||o===void 0||o.dispose(),(a=s.Ou)===null||a===void 0||a.unload(),(l=s.Lu)===null||l===void 0||l.unload();try{var d;(d=s.featureFlags)===null||d===void 0||d.destroy()}catch(h){$.error("Error while destroying feature flags",h)}(u=s.persistence)===null||u===void 0||u.destroy(),(c=s.sessionPersistence)===null||c===void 0||c.destroy()}else $.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.bh()}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._h()}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")?($.critical("Attempting to create alias for existing People user - aborting."),-2):this.ph("posthog.alias")?(w(s)&&(s=this.get_distinct_id()),t!==s?(this.gh(Hs,t),this.capture("$create_alias",{alias:t,distinct_id:s})):($.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const s=v({},this.config);if(N(t)){var i,r,n,o,a,l,u,c,d,h,p,g,m,_;Y(this.config,Xn(t));const b=this._u();(i=this.persistence)===null||i===void 0||i.update_config(this.config,s,b),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ei(v(v({},this.config),{},{persistence:"sessionStorage"}),b,!1);const x=this.Ru(this.config.debug);var f;we(x)&&(this.config.debug=x),we(this.config.debug)&&(this.config.debug?(le.DEBUG=!0,q.Et()&&q.At("ph_debug",!0),$.info("set_config",{config:t,oldConfig:s,newConfig:v({},this.config)})):(le.DEBUG=!1,q.Et()&&q.Lt("ph_debug"))),(r=this.featureFlags)===null||r===void 0||(n=r.updateConfig)===null||n===void 0||n.call(r,this.config,this.Ya()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(l=this.metrics)===null||l===void 0||l.onConfigChange(),(u=this.sessionRecording)===null||u===void 0||u.startIfEnabledOrStop(),(c=this.tracingHeaders)===null||c===void 0||c.startIfEnabledOrStop(),(d=this.autocapture)===null||d===void 0||d.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((f=this.historyAutocapture)===null||f===void 0||f.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(g=this.deadClicksAutocapture)===null||g===void 0||g.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.wu(),(_=this.externalIntegrations)===null||_===void 0||_.startIfEnabledOrStop(),!s.segment&&this.config.segment&&this.persistence&&Cn(this,ns,!1)}}_overrideSDKInfo(t,s){le.LIB_NAME=t,le.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(v(v({},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:Ze.wh}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:Jt;return s!==Jt&&(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"}fh(){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))}Xu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.fh()||this.ph("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ph("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ph(t){return this.config.person_profiles==="never"?($.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gu(),this.gh(Pr,!0),!0)}_u(){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")}wu(){var t,s;const i=this._u();var r,n,o;return this.is_capturing()||(r=this.logs)===null||r===void 0||r.kh(),((t=this.persistence)===null||t===void 0?void 0:t.mi)!==i&&((n=this.persistence)===null||n===void 0||n.set_disabled(i)),((s=this.sessionPersistence)===null||s===void 0?void 0:s.mi)!==i&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(i)),i&&(this.Cu.clear(),this.dh()),i}opt_in_capturing(t){var s;if(this.config.cookieless_mode!=="always"){if(this.pu()){var i,r,n,o,a,l;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.yh(!0,!0),(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=new Vn(this),this.pageViewManager=new Fn(this),this.persistence&&(this.sessionPropsManager=new qn(this,this.sessionManager,this.persistence));const p=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=Ze.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var u,c;p&&(this.sessionRecording=this.fu(this.sessionRecording,new p(this)),this.lu&&((u=this.sessionRecording)===null||u===void 0||(c=u.onRemoteConfig)===null||c===void 0||c.call(u,this.lu)))}var d,h;this.consent.optInOut(!0),this.wu(),this.Qu(),(s=this.sessionRecording)===null||s===void 0||s.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((d=this.surveys)===null||d===void 0||d.loadIfEnabled()),(w(t?.captureEventName)||t?.captureEventName)&&this.capture((h=t?.captureEventName)!==null&&h!==void 0?h:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ju()}else $.warn(Wn)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void $.warn(Wn);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.yh(!0,!0),this.consent.optInOut(!1),this.wu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:gi,$device_id:null}),this.vu(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.Ju(),this.Qu())}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.wu()}_is_bot(){return ce?kl(ce,this.config.custom_blocked_useragents):void 0}Ju(){k&&(k.visibilityState==="visible"?this.Iu||(this.Iu=!0,this.capture(Cr,{title:k.title},{send_instantly:!0}),this.Mu&&(k.removeEventListener(cs,this.Mu),this.Mu=null)):this.Mu||(this.Mu=this.Ju.bind(this),U(k,cs,this.Mu)))}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}))}Ya(){const t=this.Au||{};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?($.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&&!A(s[i]),l=r in s&&!A(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,$)}Os(t){var s;if(A(this.config.before_send))return t;const i=Object.keys((s=t.properties)!==null&&s!==void 0?s:{}).filter(Ul),r=M(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),A(n)){const a=`Event '${t.event}' was rejected in beforeSend function`;return zl(t.event)?$.warn(`${a}. This can cause unexpected behavior.`):$.info(a),null}n.properties&&!ke(n.properties)||$.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return $.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of i)if(n.properties&&A(n.properties[o]))return $.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.Ho)===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)})}Ru(t){const s=we(t)&&!t,i=q.Et()&&q.Ot("ph_debug")==="true";return!s&&(!!i||t)}};os.__defaultExtensionClasses={},os.wh=(()=>{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]]=bc(e.prototype[t[s]])})(os,["identify"]);var Cl=class{constructor(e){this.disabled=e===!1;const t=N(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 Ri="$copy_autocapture",Ai=se("[AutoCapture]");function Li(e,t){return t.length>e?t.slice(0,e)+"...":t}function Sd(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Ne(t));return t}function Id(e,{e:t,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:r,elementsChainAsString:n,disableCaptureUrlHashes:o}){var a,l;if(!Ne(e))return{props:{}};const u=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!ve(d,"body")&&1e3>u.length;){if(Tr(d.parentNode)){const I=d.parentNode.host;if(c.has(I))break;c.add(I),u.push(I),d=I;continue}if(!Ne(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}const h=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex(I=>ve(I,"button")||ve(I,"a")):-1;h>0&&(i=i||u.slice(0,h+1).some(I=>!Ft(I)||hs(I)));const p=[],g={};let m,_=!1,f=!1;if(G(u,I=>{const C=Ft(I);if(ve(I,"a")&&!s&&!r?.includes("href")){const S=I.getAttribute("href");_=!!(C&&S&&ss(S))&&(o?rt(S):S)}R(Mt(I),"ph-no-capture")&&(f=!0),p.push((function(S,O,j,H,V=!1){const K=S.tagName.toLowerCase(),T={tag_name:K};Rr.indexOf(K)>-1&&!j&&(T.$el_text=K.toLowerCase()==="a"||K.toLowerCase()==="button"?Li(1024,In(S)):Li(1024,ds(S)));const B=Mt(S);O||H?.includes("class")||0>=B.length||(T.classes=B.filter(function(ie){return ie!==""})),G(S.attributes,function(ie){var de;if((!hs(S)||["name","id","class","aria-label"].indexOf(ie.name)!==-1)&&!H?.includes(ie.name)&&!O&&ss(ie.value)&&(!D(de=ie.name)||de.substring(0,10)!=="_ngcontent"&&de.substring(0,7)!=="_nghost")){let oe=ie.value;ie.name==="class"&&(oe=Mr(oe).join(" ")),T["attr__"+ie.name]=Li(1024,ie.name==="href"&&V?rt(oe):oe)}});let L=1,X=1,z=S;for(;z=Sd(z);)L++,z.tagName===S.tagName&&X++;return T.nth_child=L,T.nth_of_type=X,T})(I,s,i,r,o)),G((function(S){if(!Ft(S))return{};const O={};return G(S.attributes,function(j){if(j.name&&j.name.indexOf("data-ph-capture-attribute")===0){const H=j.name.replace("data-ph-capture-attribute-",""),V=j.value;H&&V&&ss(V)&&(O[H]=V)}}),O})(I),(S,O)=>{({}).hasOwnProperty.call(g,O)||(g[O]=S)})}),f)return{props:{},explicitNoCapture:f};if(h>0&&(e=u[h],p.splice(0,h)),i||(p[0].$el_text=ve(e,"a")||ve(e,"button")?In(e):ds(e)),_){var b,x;p[0].attr__href=_;const I=(b=nt(_))===null||b===void 0?void 0:b.host,C=y==null||(x=y.location)===null||x===void 0?void 0:x.host;I&&C&&I!==C&&(m=_)}return{props:Y((E=t.type,{$event_type:E,$ce_version:1}),n?{}:{$elements:p},{$elements_chain:(P=p,M(P)?(function(I){return I.map(C=>{var S,O;let j="";if(C.tag_name&&(j+=C.tag_name),C.attr_class){C.attr_class.sort();for(const K of C.attr_class)j+=`.${K.replace(/"/g,"")}`}const H=v(v(v(v({},C.text?{text:C.text}:{}),{},{"nth-child":(S=C.nth_child)!==null&&S!==void 0?S:0,"nth-of-type":(O=C.nth_of_type)!==null&&O!==void 0?O:0},C.href?{href:C.href}:{}),C.attr_id?{attr_id:C.attr_id}:{}),C.attributes),V={};return Fs(H).sort(([K],[T])=>(function(B,L){return L>B?-1:B>L?1:0})(K,T)).forEach(([K,T])=>V[Pn(K.toString())]=Pn(T.toString())),j+=":",j+=Fs(V).map(([K,T])=>`${K}="${T}"`).join(""),j}).join(";")})((function(I){return I.map(C=>{var S,O;const j={text:(S=C.$el_text)===null||S===void 0?void 0:S.slice(0,400),tag_name:C.tag_name,href:(O=C.attr__href)===null||O===void 0?void 0:O.slice(0,2048),attr_class:Ac(C),attr_id:C.attr__id,nth_child:C.nth_child,nth_of_type:C.nth_of_type,attributes:{}};return Fs(C).filter(([H])=>H.indexOf("attr__")===0).forEach(([H,V])=>j.attributes[H]=V),j})})(P)):"")},!((a=p[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=p[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},g),target:e};var P,E}var Pd=class{ho(){this.co=void 0,clearTimeout(this.do),this.do=void 0}vo(e){var t;if(!Ft(e))return!0;const s=(t=this.fo().css_selector_ignorelist)!==null&&t!==void 0?t:xi,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const n=r,o=Mt(n);if(R(o,"ph-no-capture")||R(o,"ph-sensitive")||hs(n)||s.some(l=>ur(n,l)))return!0;const a=r.parentNode;r=Tr(a)?a.host:a&&Ne(a)?a:null}return!1}po(e){if(!this.isEnabled||e.type==="pointercancel")return void this.ho();if(e.type==="pointerdown"){this.ho();const i=ts(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&Ne(i)&&(this.co={target:i,excluded:this.vo(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.mo)===null||t===void 0?void 0:t.distinctId}))}const s=this.co;s&&(e.pointerId!==s.id||Math.abs(e.clientX-s.x)>5||Math.abs(e.clientY-s.y)>5?this.ho():e.type==="pointerup"&&(s.released=!0,this.do=setTimeout(()=>this.ho(),0)))}yo(e){var t;const s=this.co;this.ho();const i=ts(e);if(s?.released&&s.target.isConnected&&s.distinctId===((t=this.mo)===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&&(ve(i,"html")||ve(i,"body"))){var r;if(s.excluded)return null;const n=(r=this.fo().css_selector_ignorelist)!==null&&r!==void 0?r:xi;return[i,k?.documentElement,k?.body].some(o=>{if(!o)return!1;const a=Mt(o);return R(a,"ph-no-capture")||R(a,"ph-sensitive")||!Ft(o)||hs(o)||n.some(l=>ur(o,l))})?null:s.target}}constructor(e){this.bo=e,this.name="autocapture",this._o=!1,this.wo=null,this.ko=!1,this.So=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.xo=!1,this.bo.refresh(this.Ir),this.rageclicks=new Cl(this.Ir.rageclick),this.Co=null}setup(e){this.$o(),this.mo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.xo?t.dispose():(this.To=t,this.startIfEnabled())}dispose(){var e;this.xo||(this.xo=!0,this.mo=void 0,(e=this.To)===null||e===void 0||e.dispose(),this.To=void 0,this.Io())}fo(){return this.bo.refresh(this.Ir),this.Ir}$o(){var e,t;return this.fo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(s=>new RegExp(s)),this.Ir.url_ignorelist=(t=this.Ir.url_ignorelist)===null||t===void 0?void 0:t.map(s=>new RegExp(s)),this.Ir}Mo(){if(!this.isBrowserSupported())return void Ai.info("Disabling Automatic Event Collection because this browser is not supported");if(!y||!k)return;const e=this.Eo=t=>{t=t||y?.event;try{if(t.type==="blur")return void this.ho();if(t.type.indexOf("pointer")===0)return void this.po(t);const s=t.type==="click"?this.yo(t):void 0;if(re(s))return;this.Po(t,"$autocapture",s)}catch(s){Ai.error("Failed to capture event",s)}};if(U(y,"blur",e),U(k,"submit",e,{capture:!0}),U(k,"change",e,{capture:!0}),U(k,"click",e,{capture:!0}),G(["pointerdown","pointermove","pointerup","pointercancel"],t=>{U(k,t,e,{capture:!0})}),this.fo().capture_copied_text){const t=this.Ro=s=>{s=s||y?.event;try{this.Po(s,Ri)}catch(i){Ai.error("Failed to capture clipboard event",i)}};U(k,"copy",t,{capture:!0}),U(k,"cut",t,{capture:!0}),U(k,"paste",t,{capture:!0})}}Io(){this.ho(),this.Eo&&(y?.removeEventListener("blur",this.Eo),G(["pointerdown","pointermove","pointerup","pointercancel"],e=>{k?.removeEventListener(e,this.Eo,!0)}),k?.removeEventListener("submit",this.Eo,!0),k?.removeEventListener("change",this.Eo,!0),k?.removeEventListener("click",this.Eo,!0),this.Eo=void 0),this.Ro&&(k?.removeEventListener("copy",this.Ro,!0),k?.removeEventListener("cut",this.Ro,!0),k?.removeEventListener("paste",this.Ro,!0),this.Ro=void 0),this._o=!1}startIfEnabled(){this.isEnabled||this.ho(),!this.xo&&this.mo&&this.isEnabled&&!this._o&&(this.Mo(),this._o=!0)}onRemoteConfig(e){if(this.xo)return;if(this.ko=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.So=t.elementsChainAsString);const s=t.autocapture_opt_out;var i;we(s)&&((i=this.mo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",s),this.wo=s),this.startIfEnabled()}setElementSelectors(e){this.Co=e}getElementSelectors(e,t){var s;const i=[];return(s=this.Co)===null||s===void 0||s.forEach(r=>{const n=k?.querySelectorAll(r);n?.forEach(o=>{e!==o&&t!==o||R(i,r)||i.push(r)})}),i}get isEnabled(){var e,t;if(this.xo)return!1;const s=(e=this.mo)===null||e===void 0?void 0:e.kv.get(ma),i=this.wo,r=this.fo();if(!r.remoteRequestsDisabled&&!this.ko)return!1;const n=r.remoteRequestsDisabled&&!this.ko;if(re(i)&&!we(s)&&!n)return!1;const o=(t=this.wo)!==null&&t!==void 0?t:!!s;return!!r.enabled&&!o}Po(e,t="$autocapture",s){if(!this.isEnabled)return void this.ho();let i=s||ts(e);Ba(i)&&(i=i.parentNode||null);const r=this.$o();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()))&&za(i,r.rageclick)&&this.Po(e,"$rageclick",s);const o=t===Ri,a=o?v(v({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(d,h,p,g,m,_){var f;if(!y||Ar(d)||p?.url_allowlist&&!bn(p.url_allowlist,_)||p?.url_ignorelist&&bn(p.url_ignorelist,_))return!1;if(p?.dom_event_allowlist){const E=p.dom_event_allowlist;if(E&&!E.some(I=>h.type===I))return!1}const{parentIsUsefulElement:b,targetElementList:x}=Ua(d,g);if(!(function(E,I){const C=I?.element_allowlist;if(w(C))return!0;for(const S of E)if(C.some(O=>S.tagName.toLowerCase()===O))return!0;return!1})(x,p)||!cr(x,p?.css_selector_allowlist)||cr(x,(f=p?.css_selector_ignorelist)!==null&&f!==void 0?f:xi))return!1;try{const E=y.getComputedStyle(d);if(E&&E.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const P=d.tagName.toLowerCase();switch(P){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return b?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Rr.indexOf(P)>-1||d.getAttribute("contenteditable")==="true")}})(i,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var l;const{props:d,explicitNoCapture:h,target:p}=Id(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.So,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const g=this.getElementSelectors(i,p);if(g&&g.length>0&&(d.$element_selectors=g),t===Ri){const m=e.type||"clipboard";if(m!=="paste"){var u,c;const _=y==null||(u=y.getSelection())===null||u===void 0?void 0:u.toString(),f=qa(_);if(!f)return!1;d.$selected_content=f,d.$clipboard_text_length=(c=_?.length)!==null&&c!==void 0?c:0}d.$copy_type=m}return(l=this.mo)===null||l===void 0||l.capture(t,d),!0}}isBrowserSupported(){return ue(k?.querySelectorAll)}},Od=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,s=N(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.Ya(),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 Gt=se("[ExceptionAutocapture]"),Yn=()=>{},Zn=e=>{var t;if(ue(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function fs(e,t,s){try{if(!(t in e))return Yn;const i={next:e[t]},r=s(function(...n){return i.next.apply(this,n)});return ue(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=Zn(n);for(;o;){if(o.next===r)return void(o.next=i.next);n=o.next,o=Zn(n)}}}catch{return Yn}}const Cd=se("[TracingHeaders]"),lt=se("[Web Vitals]"),Qn=9e5,eo=["CLS","FCP","INP","LCP"],Fd=["INP","LCP"],Td=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Di="disabled",to="lazy_loading",Be=se("[SessionRecording]"),Md=se("[Heatmaps]");function Ni(e){return N(e)&&"clientX"in e&&"clientY"in e&&ne(e.clientX)&&ne(e.clientY)}const $s=se("[Product Tours]"),ji=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Ir))},Rd=["$set_once","$set"],Re=se("[SiteApps]"),so="Error while initializing PostHog app with config id ",Fl=(e,t)=>e?.then?e.then(t):t(e),kt="SDK is not enabled or survey functionality is not yet loaded",io="Disabled. Not loading surveys.";var Ad=class{constructor(e,t){this.bo=e,this.Sh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.xh=!1,this.Ch=[],this.$h=null,this.Th=null,this.xo=!1,this.Ih=new Set,this.onRemoteConfig=s=>{if(this.xo||this.Ir.disableSurveys)return;if(!s.ok)return W.warn("Remote config unavailable. Not loading surveys.");const i=s.config.surveys;if(A(i))return W.warn("Flags not loaded yet. Not loading surveys.");this.Mh=we(i)?i:i.length>0,W.info(`flags response received, isSurveysEnabled: ${this.Mh}`),this.loadIfEnabled()}}setup(e){if(!this.xo)return this.Eh=e,Fl(e.kv.initialize(),()=>{if(this.Eh!==e||this.xo)return;this.Eh=void 0,this.mo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.xo?t.dispose():(this.To=t,this.loadIfEnabled())})}dispose(){var e,t,s,i;this.xo||(this.xo=!0,this.Eh=void 0,this.mo=void 0,(e=this.To)===null||e===void 0||e.dispose(),this.To=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.Ch=[],this.$h=null,this.Ih.forEach(r=>clearTimeout(r)),this.Ih.clear())}get Ir(){return this.bo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var s;(s=this._surveyEventReceiver)===null||s===void 0||s.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const n=localStorage.key(r);(n?.startsWith("seenSurvey_")||n?.startsWith("inProgressSurvey_"))&&i.push(n)}i.forEach(r=>localStorage.removeItem(r))}catch{}}loadIfEnabled(){if(this.xo||!this.mo)return;const e=this.Ir;if(this._surveyManager)return;if(this.xh)return void W.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void W.info(io);if(e.cookielessMode&&this.bo.isOptedOut())return void W.info("Not loading surveys in cookieless mode without consent.");const t=this.bo.getExtensions();if(!t)return void W.error("PostHog Extensions not found.");if(w(this.Mh)&&!e.advancedEnableSurveys)return;const s=this.Mh||e.advancedEnableSurveys;this.xh=!0;try{const i=t.generateSurveys;if(i)return this.Ph(i,s),void(this.xh=!1);const r=t.loadExternalDependency;if(!r)return this.Rh(Or),void(this.xh=!1);r(n=>{try{if(this.xo)return;const o=this.bo.getExtensions();n||!o?.generateSurveys?this.Rh("Could not load surveys script",n):this.Ph(o.generateSurveys,s)}finally{this.xh=!1}})}catch(i){throw this.xh=!1,this.Rh("Error initializing surveys",i),i}}Ph(e,t){this.xo||(this._surveyManager=e(t),this._surveyEventReceiver=this.bo.createEventReceiver(),W.info("Surveys loaded successfully"),this.Ah({isLoaded:!0}))}Rh(e,t){W.error(e,t),this.Ah({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ch.push(e),this._surveyManager&&this.Ah({isLoaded:!0}),()=>{this.Ch=this.Ch.filter(t=>t!==e)}}getSurveys(e,t=!1){var s;const i=(s=this.mo)!==null&&s!==void 0?s:this.Sh;if(!i||this.xo)return;if(this.Ir.disableSurveys)return W.info(io),e([]);const r=i.kv.get(ir);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Fh()&&this.getSurveys(()=>{},!0));if(this.$h)return void this.$h.then(({surveys:a,context:l})=>{this.xo||e(a,l)}).catch(a=>W.error("Error in survey callback",a));const n=this.Oh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(a=>{try{return this.Dh(i,a)}catch(l){return W.error("Error processing surveys response",l),this.Dh(i,{statusCode:0,error:l})}},a=>this.Dh(i,{statusCode:0,error:a}));this.$h=n;const o=()=>{this.$h===n&&(this.$h=null)};n.then(a=>{o(),this.xo||e(a.surveys,a.context)},o).catch(a=>W.error("Error in survey callback",a))}Oh(e,t){const s=this.mo;return s?s.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(kt)}))}Dh(e,t){if(this.xo)return{surveys:[],context:{isLoaded:!1,error:kt}};const s=t.statusCode;if(s!==200||!t.json){const o=`Surveys API could not be loaded, status: ${s}`;return s!==0?W.error(o):t.error||W.warn(o),this.Th=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.Th=null;const i=t.json.surveys||[],r=i.filter(o=>(function(a){return!(!a.start_date||a.end_date)})(o)&&($l(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({[ir]:i,[Vs]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Fh(){return this.Lh()&&!this.$h&&!this.Nh()}Lh(){var e,t;const s=(e=(t=this.mo)!==null&&t!==void 0?t:this.Sh)===null||e===void 0?void 0:e.kv.get(Vs);return ne(s)&&Date.now()-s>3e5}Nh(){return ne(this.Th)&&3e5>Date.now()-this.Th}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{}}Ah(e){for(const t of this.Ch)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(s){W.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,t=!1){if(!A(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);W.warn("init was not called")}qh(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}jh(e){if(A(this._surveyManager))return{eligible:!1,reason:kt};const t=typeof e=="string"?this.qh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Bh(e){if(!this.bo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(A(this._surveyManager))return{eligible:!1,reason:kt};const t=typeof e=="string"?this.qh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(A(this._surveyManager))return W.warn("init was not called"),{visible:!1,disabledReason:kt};const t=this.Bh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return A(this._surveyManager)?(W.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kt})):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.Bh(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.bo.isCapturing())return;if(A(this._surveyManager))return void W.warn("init was not called");const r=typeof e=="string"?this.qh(e):e;if(!r?.id)return void W.warn("Survey not found");if(!pd.includes(r.type))return void W.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const n=k?.querySelector(t);if(n){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){W.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,l;this.Ih.delete(o),!this.xo&&this.bo.isCapturing()&&(W.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),W.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Ih.add(o)}this._surveyManager.renderSurvey(r,n,s)}else W.warn("Survey element not found")}displaySurvey(e,t){var s;if(!this.bo.isCapturing())return;if(A(this._surveyManager))return void W.warn("init was not called");const i=this.qh(e);if(!i)return void W.warn("Survey not found");let r=i;if(!((s=i.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=v(v({},i),{},{appearance:v(v({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==dr.Popover&&t.initialResponses&&W.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const n=this.jh(i);if(!n.eligible)return void W.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==dr.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){A(this._surveyManager)?W.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 Et(e,t,s){if(A(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 Ld=class{constructor(e){this._instance=e,this.Hh=new Set,this.zh=new Set,this.Uh=new Xs,this.Wh=(t,s)=>this.Vh(t,s)&&this.Gh(t,s)&&this.Zh(t,s)&&this.Qh(t,s),this.Vh=(t,s)=>!s?.event||t?.event===s?.event}init(){var e,t;w((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.Jh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((s,i)=>{this.on(s,i)}))}dispose(){var e;(e=this.Jh)===null||e===void 0||e.call(this),this.Jh=void 0,this.Uh=new Xs}register(e){var t,s;if(!w((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>{var r;this.Hh.add(i),(r=i.steps)===null||r===void 0||r.forEach(n=>{this.zh.add(n?.event||"")})}),(s=this._instance)===null||s===void 0?void 0:s.autocapture)){const i=new Set;this.Hh.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.Hh.clear(),this.zh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.zh.has(e)||this.zh.has(t.event))&&this.Hh.forEach(s=>{this.Kh(t,s)&&this.Uh.emit("actionCaptured",s.name)})}Xh(e){this.onAction("actionCaptured",t=>e(t))}Kh(e,t){if(t?.steps==null)return!1;for(const s of t.steps)if(this.Wh(e,s))return!0;return!1}onAction(e,t){return this.Uh.on(e,t)}Gh(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"||!Et(i,t.url,t.url_matching||"contains"))return!1}return!0}Zh(e,t){return!!this.Yh(e,t)&&!!this.tc(e,t)&&!!this.ec(e,t)}Yh(e,t){var s;if(!t?.href)return!0;const i=this.nc(e);if(i.length>0)return i.some(n=>Et(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&&Et((function(n){const o=n.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(r),t.href,t.href_matching||"exact")}tc(e,t){var s;if(!t?.text)return!0;const i=this.nc(e);if(i.length>0)return i.some(l=>Et(l.text,t.text,t.text_matching||"exact")||Et(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 d;for(;!A(d=c.exec(l));)u.includes(d[1])||u.push(d[1]);return u})(r),o=t.text,a=t.text_matching||"exact",n.some(l=>Et(l,o,a)));var n,o,a}ec(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}nc(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}Qh(e,t){return!t?.properties||t.properties.length===0||Il(t.properties.reduce((s,i)=>{const r=M(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)}},Dd=class{constructor(e){var t,s;this.sc=[],this._instance=e,this.rc=new Map,this.oc=new Map,this.ac=new Map,this.lc=(t=this._instance)===null||t===void 0||(s=t.onSessionId)===null||s===void 0?void 0:s.call(t,i=>this.uc(i))}hc(e){return!1}cc(){return null}dc(e){}vc(){}fc(e,t){return!!e&&Il(e.propertyFilters,t?.properties)}gc(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}mc(e,t,s){const i=(s===Vt.Activation?this.rc:this.oc).get(e);let r=[];return this.yc(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.fc(a,t)})}register(e){this.bc(e,!1)}replace(e){this.bc(e,!0)}bc(e,t){var s;w((s=this._instance)===null||s===void 0?void 0:s._addCaptureHook)||(this._c(e,t),this.wc(e,t))}wc(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.ac.clear(),s.length===0)return void(t&&((i=this.kc)===null||i===void 0||i.replace([])));this.kc||(this.kc=new Ld(this._instance),this.kc.init(),this.kc.Xh(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.ac.get(a.name))!==null&&l!==void 0?l:[];u.includes(n.id)||u.push(n.id),this.ac.set(a.name,u)}})}),t?this.kc.replace(r):this.kc.register(r)}Sc(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)})}_c(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.gc(e,Vt.Activation),a=this.gc(e,Vt.Cancellation);t?(this.rc=o,this.oc=a):(this.Sc(this.rc,o),this.Sc(this.oc,a)),(r.length!==0||n.length!==0)&&((s=this.Jh)!==null&&s!==void 0||(this.Jh=(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.xc(),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.Cc(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.Tc(n),void this.Ic([n])}if(this.oc.has(e)){const a=this.mc(e,t,Vt.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.Mc(l.id)))}if(!this.rc.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.rc.get(e)});const o=this.mc(e,t,Vt.Activation);this.Ec(o.map(a=>a.id))}onAction(e){this.ac.has(e)&&this.Ec(this.ac.get(e)||[])}Ec(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.hc(n)?this.Tc(n)&&this.Pc(n):r.push(n);r.length>0&&(this.sc=[...new Set([...this.sc,...r])]),this.xc().info("updating activated items",{activatedItems:this.getActivatedIds()})}Tc(e){this.sc=this.sc.filter(s=>s!==e);const t=this.Rc();return!t.includes(e)&&(this.Ac([...t,e]),this.Fc(),!0)}$c(e){const t=new Set(e);this.sc=this.sc.filter(r=>!t.has(r));const s=this.Oc(),i=s.filter(r=>!t.has(r));i.length!==s.length&&(this.Ac(i),i.length===0&&this.Dc()),this.Ic(e)}Lc(){var e;const t=this.cc();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:{}}Pc(e){if(!this.cc())return;const t=this.Lc();this.dc(v(v({},t),{},{[e]:Date.now()}))}Ic(e){if(!this.cc())return;const t=this.Lc(),s={};let i=!1;for(const[r,n]of Object.entries(t))e.includes(r)?i=!0:s[r]=n;i&&(ke(s)?this.vc():this.dc(s))}Nc(){this.cc()&&this.vc()}getActivationTimestamp(e){if(!this.Rc().includes(e))return;const t=this.Lc()[e];return ne(t)?t:void 0}Oc(){var e;const t=this.qc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Rc(){var e,t,s;const i=this.Oc();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.jc()],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:[]}Fc(){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.Bc(s)}Dc(){this.Hc()}uc(e){var t;const s=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.jc()];if(s&&s!==e){const i=this.Oc(),r=this.Lc();i.length>0&&(this.Ac([]),i.filter(n=>ne(r[n])).forEach(n=>this.Mc(n))),this.Dc(),this.Nc()}}getActivatedIds(){return[...new Set([...this.Rc(),...this.sc])].filter(e=>!this.zc(e))}dispose(){var e,t,s;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(t=this.Jh)===null||t===void 0||t.call(this),this.Jh=void 0,(s=this.kc)===null||s===void 0||s.dispose(),this.kc=void 0}reset(){this.sc=[],this.Oc().length>0&&this.Ac([]),this.Dc(),this.Nc()}getEventToItemsMap(){return this.rc}Uc(){return this.kc}},Nd=class extends Dd{constructor(e){super(e)}qc(){return Ea}jc(){return $a}cc(){return Sa}dc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}hc(e){var t;let s;this.yc(r=>{s=r.find(n=>n.id===e)});const i=s==null||(t=s.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return ne(i)&&i>0}Wc(){return Ue.SHOWN}yc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Mc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}xc(){return W}Ac(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Bc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Hc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}zc(){return!1}Cc(e,t){let s;return this.yc(i=>{s=i.find(r=>r.id===t)}),!s||(function(i){var r;return $l(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"})(s)?e===Ue.SHOWN?"consume":"ignore":e===Ue.SHOWN?"persist":e===Ue.DISMISSED||e===Ue.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},jd=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);w(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)}},Bd=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=F?.__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 Nd(this._instance)}};const qd=y?.location?Gs(y.location.hash,"__posthog")||Gs(location.hash,"state"):null,ro="_postHogToolbarParams",no=se("[Toolbar]"),oo=se("[FeatureFlags]");var Hd=class{constructor(e,t=!1){this.Vc=!1,this.update(e,t)}update(e,t){this.Gc=((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:w(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:M(s.flag_keys)?s.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Vc||(oo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Vc=!0),w(e.flag_keys)||M(e.flag_keys)||oo.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Gc}};const ao=se("[FeatureFlags]"),ut=se("[FeatureFlags]",{debugEnabled:!0}),Bi=`" failed. Feature flags didn't load in time.`,lo=["click","keydown","wheel","touchstart","pointerdown"],uo="connection_error",co=e=>{const t={};for(let s=0;e.length>s;s++)t[e[s]]=!0;return t},ho=e=>{const t={};for(const[s,i]of Fs(e||{}))i&&(t[s]=i);return t},po=e=>Dt(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Oe=se("[Error tracking]"),_r="webkit-masked-url:",Vd=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],zd=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",_r],Ud=["__firefox__","__gCrWeb"],vo="Refusing to render web experiment since the viewer is a likely bot",Wd={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Ys(t,e),not_regex:(e,t)=>!Ys(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Ie=se("[Conversations]"),ct="Conversations not available yet.";function fo(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,d=t?.consoleCapture?void 0:(r=e?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,h=w(d)?Math.max(c,2048):Math.max(c,d),p=v(v({},(function(){let g="",m="";try{const _=ce?.userAgent;_&&([g,m]=Jo(_))}catch{}return(function(_,f){const b=(function(x){if(x)return{}.hasOwnProperty.call(ln,x)?ln[x]:x})(_);return v(v({},b?{"os.name":b}:{}),f?{"os.version":f}:{})})(g,m)})()),e?.resourceAttributes);return{serviceName:(n=(o=p?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&n!==void 0?n:t?.serviceNameDefault,serviceVersion:(a=p?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=p?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:p,beforeSend:e?.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Gd=["debug","log","warn","error","info"],Kd=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},go="console",Tl="__posthogHandledLogsRequestError",qi=(e,t)=>{const s=e instanceof Error?e:new Error(t);return s[Tl]=!0,s},_o=e=>!!e&&typeof e=="object"&&e[Tl]===!0,Zs=se("[NetworkMetrics]"),Nr=()=>{var e;return!(y==null||(e=y.performance)===null||e===void 0)&&e.now?y.performance.now():Date.now()},Jd={"http:":80,"https:":443},Xd=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Ml=(e,t)=>{var s;const i=String(t);return{method:String(e).toUpperCase(),url:((s=nt(i))===null||s===void 0?void 0:s.href)||i}},mr=(e,t,s,i,r,n,o=!1)=>{try{var a,l;const u=r();if(!u)return;const c=s||void 0,d=Nr()-i,h=nt(t.url);if(h&&h.protocol!=="http:"&&h.protocol!=="https:")return;const p={url:h?.href||t.url,method:t.method},g=ue(u.name)?u.name(p):D(u.name)?u.name:"http.client.request.duration";if(!g)return;const m=o&&!c?void 0:((f,b)=>f?400>f?void 0:String(f):b?.name||"_OTHER")(c,n),_=v(v(v(v(v({},(f=>{const b=Xd.has(f)?f:"_OTHER";return v({"http.request.method":b},b==="_OTHER"&&f!==b?{"http.request.method_original":f}:{})})(p.method)),h?(f=>{return{"server.address":f.hostname.startsWith("[")&&f.hostname.endsWith("]")?f.hostname.slice(1,-1):f.hostname,"server.port":Number(f.port)||Jd[f.protocol],"url.scheme":f.protocol.slice(0,-1),"url.template":(b=f.pathname,b.split("/").map(x=>(P=>/^\d+$/.test(P)||P.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(P))(x)?":id":x).join("/"))};var b})(h):{}),c?{"http.response.status_code":c}:{}),m?{"error.type":m}:{}),(a=u.attributes)===null||a===void 0?void 0:a.call(u,p,{status:c,durationMs:d}));(l=e.metrics)===null||l===void 0||l.histogram(g,d,{unit:"ms",attributes:_})}catch(u){Zs.error("Failed to record network metric",u)}},Rl=()=>{},Yd=(e,t)=>ue(y?.fetch)?fs(y,"fetch",s=>function(...i){const r=Nr(),n=s.apply(this,i);if(!t())return n;try{var o,a,l;const[u,c]=i,d=Ml((o=(a=c?.method)!==null&&a!==void 0?a:u?.method)!==null&&o!==void 0?o:"GET",(l=u?.url)!==null&&l!==void 0?l:u);return n.then(h=>(mr(e,d,h?.status,r,t,void 0,!0),h),h=>{throw mr(e,d,void 0,r,t,h),h})}catch(u){return Zs.error("Failed to observe fetch",u),n}}):Rl,Zd=(e,t)=>{var s;const i=y==null||(s=y.XMLHttpRequest)===null||s===void 0?void 0:s.prototype;if(!i)return Rl;const r=new WeakMap,n=fs(i,"open",a=>function(...l){try{hl.has(this)||r.set(this,Ml(l[0],l[1]))}catch(u){Zs.error("Failed to observe XHR open",u)}return a.apply(this,l)}),o=fs(i,"send",a=>function(...l){let u;try{const c=r.get(this);if(c&&t()){const d=Nr();u=()=>{this.removeEventListener("loadend",u),mr(e,c,this.status,d,t)},U(this,"loadend",u)}}catch(c){Zs.error("Failed to observe XHR send",c)}try{return a.apply(this,l)}catch(c){throw u&&this.removeEventListener("loadend",u),c}});return()=>{n(),o()}},ii={featureFlags:class{constructor(e){this.name="featureFlags",this.Zc=!1,this.featureFlagEventHandlers=[],this.$=ao,this.Qc={},this.Jc={},this.Kc=[],this.Xc=!1,this.Yc=!1,this.td=0,this.ed=!1,this.nd=!1,this.sd=!1,this.rd=!1,this.od=0,this.ad=!1,this.an=()=>{const t=this.ld();this.od=0,t&&this.reloadFeatureFlags()},this.ud=()=>{var t,s;const i=this.hd,r=(t=this.dd)!==null&&t!==void 0?t:i;w(i)||w(r)||this.Ir.remoteRequestsDisabled||!k||k.visibilityState==="hidden"||Date.now()-((s=this.vd)!==null&&s!==void 0?s:0)<r||(this.dd=this.ad||!this.Ir.idleRefreshBackoff?i:Math.min(2*r,36e5),this.ad=!1,this.reloadFeatureFlags(),this.fd())},this.pd=()=>{this.ad&&this.dd===this.hd||this.gd()},this.ln=()=>{k?.visibilityState==="visible"&&this.gd()},"get"in e?this.bo=e:(this._instance=e,this.md=new Hd(e.config,e.Ya()),this.bo=this.md)}updateConfig(e,t){var s;(s=this.md)===null||s===void 0||s.update(e,t),this.mo&&this.yd()}setup(e){return this.Eh=e,this.$=e.logger.createLogger("[FeatureFlags]"),Fl(e.kv.initialize(),()=>{this.Eh===e&&(this.Eh=void 0,this.mo=e,this.bd(e))})}bd(e){var t;if(this.mo===e)return y&&U(y,"online",this.an),this.yd(),this._d=e.registerDynamicEventProperties(()=>this.wd()?this.Qc:this.Jc),this.kd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Sd(),this.xd(),this.Cd()}),this.xd(),this.initialize()}gd(){this.ad=!0,this.dd=this.hd,this.ud()}yd(){const e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&k&&!w(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.dd=t),t!==this.hd&&(this.$d(),w(t)||(this.hd=t,this.dd=t,this.fd(),k?.addEventListener&&(U(k,cs,this.ln),It(lo,s=>{U(k,s,this.pd,{capture:!0})}))))}fd(){w(this.hd)||(w(this.Td)||clearInterval(this.Td),this.vd=Date.now(),this.Td=setInterval(this.ud,this.hd))}$d(){var e;w(this.Td)||(clearInterval(this.Td),this.Td=void 0,k==null||(e=k.removeEventListener)===null||e===void 0||e.call(k,"visibilitychange",this.ln),It(lo,t=>{var s;k==null||(s=k.removeEventListener)===null||s===void 0||s.call(k,t,this.pd,{capture:!0})})),this.hd=void 0,this.dd=void 0,this.ad=!1,this.vd=void 0}destroy(){this.Id()}dispose(){this.Id()}Id(){var e,t;this.$d(),this.td++,this.nd=!1,this.Eh=void 0,this.mo&&(this.Md(),(e=this._d)===null||e===void 0||e.dispose(),this._d=void 0,(t=this.kd)===null||t===void 0||t.call(this),this.kd=void 0,this.Kc=[],y?.removeEventListener("online",this.an),this.mo=void 0)}get Ir(){return this.bo.get()}Ed(e){var t;return this.Pd&&e in this.Pd?this.Pd[e]:(t=this.mo)===null||t===void 0?void 0:t.kv.get(e)}Sd(){return!!this.Pd&&(this.Pd=void 0,!0)}Rd(){var e;return!w((e=this.mo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Sd()}At(e){this.Ad(()=>{var t;return(t=this.mo)===null||t===void 0?void 0:t.kv.set(e)})}Fd(e,t,s){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const r=this.Ed("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,f])=>!f?.failed).map(([f])=>f):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:s&&!M(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),c=this.Ed("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||s?u:Array.from(new Set([...Object.keys(c),...Object.keys(d)])),p=!l&&!s,g=!!p||u,m=!!p||h,_={[Ve]:g,[Fe]:g,[Qe]:m};e.$feature_flag_details&&(_[vt]=g);for(const f of[ft,it,es])w(e[f])||(_[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}Lt(e){this.Ad(()=>{var t;return(t=this.mo)===null||t===void 0?void 0:t.kv.remove(e)})}Ad(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}xd(){const e={};for(const i of[Ve,Qe,ft,Ae]){const r=this.Ed(i);w(r)||(e[i]=r)}this.Qc=e;const t=v({},e),s=this.Ed(Fe);if(s)for(const[i,r]of Object.entries(s))t[`$feature/${i}`]=r;this.Jc=t}wd(){const e=this.Ir.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Ed(it);return typeof t!="number"||Date.now()-t>e}Od(){return!!this.wd()&&(this.rd||this.Yc||(this.rd=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Dd(){const e=this.Ir.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}):[]}Ld(){const e=this.Ir.flagKeys;if(!w(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.Ir,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=>!w(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.Nd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,s){var i,r;const n=s?.merge&&(i=this.Ed("$enabled_feature_flags"))!==null&&i!==void 0?i:{},o=s?.merge&&(r=this.Ed("$feature_flag_payloads"))!==null&&r!==void 0?r:{},a=v(v({},n),e),l=v(v({},o),t),u={};for(const[c,d]of Object.entries(a))u[c]={key:c,enabled:sn(d),variant:rn(d),reason:void 0,metadata:w(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.Nd({flags:u})}get hasLoadedFlags(){return this.Xc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Ed(vt),t=this.Ed(Ae),s=this.Ed(ht);if(!s&&!t)return e||{};const i=Y({},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=w(u)?(n=l?.enabled)!==null&&n!==void 0&&n:!!u,d=w(u)?l?.variant:typeof u=="string"?u:void 0,h=s?.[a],p=v(v({},l),{},{enabled:c,variant:c?d??l?.variant:void 0});var o;c!==l?.enabled&&(p.original_enabled=l?.enabled),d!==l?.variant&&(p.original_variant=l?.variant),h&&(p.metadata=v(v({},l?.metadata),{},{payload:h,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),i[a]=p}return this.Zc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:i}),this.Zc=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(s=>{const i=e[s];return{key:s,enabled:sn(i),variant:rn(i),payload:tn(t[s])}})}getFlagVariants(){const e=this.Ed(Fe),t=this.Ed(Ae);if(!t)return e||{};const s=Y({},e||{}),i=Object.keys(t);for(let r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Zc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:s}),this.Zc=!0),s}getFlagPayloads(){const e=this.Ed(Qe),t=this.Ed(ht);if(!t)return e||{};const s=Y({},e||{}),i=Object.keys(t);for(let r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Zc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:s}),this.Zc=!0),s}reloadFeatureFlags(){this.ed||this.Ir.featureFlagsDisabled||this.ld()||(this.Yc&&(this.nd=!0),this.qd||(this.Kc.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.qd=setTimeout(()=>{this.jd()},5)))}Md(){clearTimeout(this.qd),this.qd=void 0}onReloading(e){return this.Kc.push(e),()=>{this.Kc=this.Kc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Xc||this.Yc||this.qd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ed=e}resetFlagCallReported(){this.Lt(st)}jd(e){this.Md();const t=this.mo;if(!t||this.Ir.remoteRequestsDisabled||this.ld())return;if(this.Yc)return void(this.nd=!0);const s={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:v(v(v({},t.initialPersonProperties),this.Ed("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Ed(tt),timezone:rl()};w(t.deviceId)||(s.$device_id=t.deviceId),(e?.disableFlags||this.Ir.featureFlagsDisabled)&&(s.disable_flags=!0);const i=this.Dd();i.length&&(s.evaluation_contexts=i);const r=this.Ld();w(r)||(s.flag_keys=r);const n=this.Ir.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.td;this.Yc=!0;const l=()=>{this.nd&&(this.nd=!1,this.jd())},u=d=>{var h,p;const g=(h=d.json)!==null&&h!==void 0?h:{},m=d.statusCode!==200;if(this.Yc=!1,a!==this.td)return void l();if(this.Bd(d.statusCode),m||this.nd||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.nd)return;this.sd=!m;const _=[];d.error?_.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?uo:"unknown_error"):d.statusCode!==200&&_.push(`api_error_${d.statusCode}`),g.errorsWhileComputingFlags&&_.push("errors_while_computing_flags");const f=!!(!((p=g.quotaLimited)===null||p===void 0)&&p.includes("feature_flags"));f&&_.push("quota_limited"),this.At({[us]:_}),f?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.Nd(g,m,{partialResponse:n}),l()},c=d=>{this.Yc=!1,a===this.td&&(this.At({[us]:[uo]}),this.$.error("Feature flag request failed",d),this.Rd()&&this.Cd(!0)),l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:s,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(u).catch(c)}catch(d){c(d)}}ld(){return Ja(this.od,3)}Bd(e){this.od=Xa(e,this.od,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.sd)return;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Bi);if(this.Od())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.sd)return;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Bi);if(this.Od())return;const s=this.getFlagVariants(),i=e in s,r=s[e],n=this.getFlagPayloads()[e],o=String(r),a=this.Ed("$feature_flag_request_id")||void 0,l=this.Ed("$feature_flag_evaluated_at")||void 0;let u,c=this.Ed("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var d;const O=(d=this.mo)===null||d===void 0?void 0:d.session.sessionId,j=this.Ed(Kt);O&&O!==j&&(c={},u=O)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(o))u&&this.At({[st]:c,[Kt]:u});else{var h,p,g,m,_,f,b,x,P,E,I,C;M(c[e])?c[e].push(o):c[e]=[o],this.At(v({[st]:c},u?{[Kt]:u}:{}));const O=this.getFeatureFlagDetails(e),j=[...(h=this.Ed("$feature_flag_errors"))!==null&&h!==void 0?h:[]];w(r)&&j.push("flag_missing");const H={$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:(p=(g=this.Ir.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(m=(_=this.Ir.bootstrap)===null||_===void 0||(_=_.featureFlagPayloads)===null||_===void 0?void 0:_[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.sd};w(O==null||(f=O.metadata)===null||f===void 0?void 0:f.has_experiment)||(H.$feature_flag_has_experiment=O.metadata.has_experiment),w(O==null||(b=O.metadata)===null||b===void 0?void 0:b.version)||(H.$feature_flag_version=O.metadata.version);const V=(x=O==null||(P=O.reason)===null||P===void 0?void 0:P.description)!==null&&x!==void 0?x:O==null||(E=O.reason)===null||E===void 0?void 0:E.code;var S;V&&(H.$feature_flag_reason=V),!(O==null||(I=O.metadata)===null||I===void 0)&&I.id&&(H.$feature_flag_id=O.metadata.id),w(O?.original_variant)&&w(O?.original_enabled)||(H.$feature_flag_original_response=w(O.original_variant)?O.original_enabled:O.original_variant),!(O==null||(C=O.metadata)===null||C===void 0)&&C.original_payload&&(H.$feature_flag_original_payload=O==null||(S=O.metadata)===null||S===void 0?void 0:S.original_payload),j.length&&(H.$feature_flag_error=j.join(",")),this.Hd(H)}else u&&this.At({[st]:c,[Kt]:u});return i?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:tn(n)}:void 0}Hd(e){try{var t;(t=this.mo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(s){this.$.error("Failed to capture feature flag call",s)}}getRemoteConfigPayload(e,t){this.zd(e,t)}zd(e,t){var s=this;return Z(function*(){const i=s.mo;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.Dd();n.length&&(r.evaluation_contexts=n);const o=s.Ld();let a;w(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.Ir.compression,sentAt:"body",timeoutMs:s.Ir.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.sd)return t.defaultValue;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Bi),t.defaultValue;const s=this.getFeatureFlag(e,t);return w(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.Nd(e,t,s)}Nd(e,t,s){if(!this.mo)return;this.Xc=!0;const i=((r,n={},o={},a={},l,u=ao)=>{const c=((x,P)=>{const E=x.flags;if(E){const I=Object.fromEntries(Object.keys(E).map(S=>{var O;return[S,(O=E[S].variant)!==null&&O!==void 0?O:E[S].enabled]})),C=Object.fromEntries(Object.keys(E).filter(S=>E[S].enabled).filter(S=>{var O;return!w((O=E[S].metadata)===null||O===void 0?void 0:O.payload)}).map(S=>{var O;return[S,(O=E[S].metadata)===null||O===void 0?void 0:O.payload]}));return v(v({},x),{},{featureFlags:I,featureFlagPayloads:C})}return x.featureFlags&&P.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),x})(r,u),d=c.flags,h=c.featureFlags,p=c.featureFlagPayloads;if(!h)return;const g=r.requestId,m=r.evaluatedAt;if(M(h)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const x={};if(h)for(let P=0;h.length>P;P++)x[h[P]]=!0;return{[Ve]:h,[Fe]:x,[es]:!1}}let _=h,f=p,b=d;if(l?.partialResponse){const x=Object.keys(_),P=f||{};_=v(v({},n),_),f=v(v({},o),P),x.forEach(E=>{E in P||f==null||delete f[E]}),b=v(v({},a),b)}else if(r.errorsWhileComputingFlags)if(d){const x=new Set(Object.keys(d).filter(E=>{var I;return!(!((I=d[E])===null||I===void 0)&&I.failed)}));_=v(v({},n),Object.fromEntries(Object.entries(_).filter(([E])=>x.has(E))));const P=Object.fromEntries(Object.entries(f||{}).filter(([E])=>x.has(E)));f=v(v({},o),P),x.forEach(E=>{E in P||f==null||delete f[E]}),b=v(v({},a),Object.fromEntries(Object.entries(b||{}).filter(([E])=>x.has(E))))}else _=v(v({},n),_),f=v(v({},o),f),b=v(v({},a),b);return v(v({[Ve]:Object.keys(ho(_)),[Fe]:_||{},[Qe]:f||{},[vt]:b||{},[es]:r.minimalFlagCalledEvents===!0},g?{[ft]:g}:{}),m?{[it]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),s,this.$);if(i)if(s?.persist===!1){const r=!w(this.mo.kv.get(Fe));this.Pd=i,r||this.At(i)}else this.Sd(),this.Fd(i,e,!!s?.partialResponse),this.At(i);else t&&this.Rd();t||(this.rd=!1),this.Cd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Ud(e)}Ud(e){if(this.mo){if(e===!1)return this.Lt([Ae,ht]),this.Cd(),void ut.info("All overrides cleared");if(M(e))return this.At({[Ae]:co(e)}),this.Cd(),void ut.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const s=e;this.Zc=!!((t=s.suppressWarning)!==null&&t!==void 0&&t);const i={},r=s.flags,n=s.payloads;return r&&(i[Ae]=M(r)?co(r):r),n&&(i[ht]=n),Object.keys(i).length&&this.At(i),r===!1&&n===!1?this.Lt([Ae,ht]):r===!1?this.Lt(Ae):n===!1&&this.Lt(ht),this.Cd(),r===!1?ut.info("Flag overrides cleared"):r&&ut.info("Flag overrides set",{flags:r}),void(n===!1?ut.info("Payload overrides cleared"):n&&ut.info("Payload overrides set",{payloads:n}))}if(e&&typeof e=="object")return this.At({[Ae]:e}),this.Cd(),void ut.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.Xc){const{flags:t,flagVariants:s}=this.Wd();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.Ed("$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=v(v({},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({[Ve]:Object.keys(ho(a)),[Fe]:a,[et]:v(v({},this.Ed("$stored_person_properties")||{}),n)}),this.Cd();try{var l;(l=this.mo)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(u){this.$.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,s){const i=this.Ed(sr);!i||t?this.Vd(e,s):e(i)}Vd(e,t){var s=this;return Z(function*(){const i=s.mo;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({[sr]: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)}})()}Wd(){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),{})}}Cd(e){this.xd();const{flags:t,flagVariants:s}=this.Wd();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.Gd(e,t)}Gd(e,t=!0){const s=this.Ed("$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({[et]:v(v(v({},s),n),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const s=v({},this.Ed("$stored_person_properties")||{});e.forEach(i=>{delete s[i]}),this.At({[et]:s}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(et),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const s=this.Ed("$stored_group_properties")||{},i=v({},s);for(const r of Object.keys(e))i[r]=v(v({},s[r]),e[r]);this.At({[tt]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Ed("$stored_group_properties")||{};this.At({[tt]:v(v({},t),{},{[e]:{}})})}else this.Lt(tt)}reset(){this.td++,this.nd=!1,this.Qc={},this.Jc={},this.Pd=void 0,this.Xc=!1,this.ed=!1,this.sd=!1,this.$anon_distinct_id=void 0,this.Md(),this.Zc=!1,this.od=0}}},Qd={sessionRecording:class{get Ir(){return this._instance.config}get Cl(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Zd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.Qd==="awaiting_config"||this.Qd==="missing_config"?this.Qd:(e=(t=this.Zd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.Qd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Qd=Di,this.Jd=void 0,this.Kd=!1,this.Xe=(()=>{var t,s;if(!k?.visibilityState||k.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.ln=()=>{var t,s;k?.visibilityState==="visible"&&(this.Xe=!0,(t=this.Zd)===null||t===void 0||(s=t.setDocumentWasEverVisible)===null||s===void 0||s.call(t,!0))},!this._instance.sessionManager)throw Be.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');k?.addEventListener&&U(k,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Kd=!0,k==null||(t=k.removeEventListener)===null||t===void 0||t.call(k,"visibilitychange",this.ln),e?this.Xd(!0):this.stopRecording()}get Yd(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),s=!this.Ir.disable_session_recording,i=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return y&&t&&s&&!i}startIfEnabledOrStop(e){var t;if(this.Kd||this.Yd&&(!((t=this.Zd)===null||t===void 0)&&t.isStarted))return;const s=!w(Object.assign)&&!w(Array.from);this.Yd&&s?(this.tv(e),Be.info("starting")):(this.Qd=Di,this.stopRecording())}tv(e){var t,s;if(this.Yd)if(this.Qd!=="awaiting_config"&&this.Qd!=="missing_config"&&(this.Qd=to),(F==null||(t=F.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((s=F.__PosthogExtensions__)===null||s===void 0?void 0:s.initSessionRecording))this.ev(e);else{var i,r;const n=this._instance.sessionManager;(i=F.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this._instance,this.iv,o=>{if(!this.Kd&&this.Yd&&this._instance.sessionManager===n)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Be.error("could not load recorder",o)):void this.ev(e);this.Qd="disabled"})}}stopRecording(){var e,t;(e=this.Jd)===null||e===void 0||e.call(this),this.Jd=void 0,(t=this.Zd)===null||t===void 0||t.stop()}Xd(e=!1){var t,s;(t=this.Jd)===null||t===void 0||t.call(this),this.Jd=void 0,(s=this.Zd)===null||s===void 0||s.discard({discardProducerEvents:e})}nv(){var e,t;(e=this.Cl)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Cl)===null||t===void 0||t.unregister("$replay_sample_rate")}sv(e,t){if(A(e))return null;const s=ne(e)?e:parseFloat(e);return typeof(i=s)!="number"||!Number.isFinite(i)||0>i||i>1?(Be.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):s;var i}rv(e){if(this.Cl){var t,s;const i=this.Cl,r=()=>{var n;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.sv((n=this.Ir.session_recording)===null||n===void 0?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.sv(o?.sampleRate,"remote config sampleRate"),u=a??l;A(u)&&this.nv();const c=o?.minimumDurationMilliseconds;i.register({[Qt]:v(v({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:v({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:w(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};r(),(t=this.Jd)===null||t===void 0||t.call(this),this.Jd=(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.rv(t),void this.Xd()):(this.rv(t),void this.startIfEnabledOrStop()):(this.Qd==="awaiting_config"&&(this.Qd="missing_config",this._instance.register_for_session({[Ma]:!0}),Be.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var s;!((s=this.Zd)===null||s===void 0)&&s.log?this.Zd.log(e,t):Be.warn("log called before recorder was ready")}get iv(){var e,t;const s=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Qt);return(s==null||(t=s.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}ov(){const e=this._instance.get_property(Qt);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(s){return Be.warn("persisted remote config for session recording is invalid and will be ignored",s),!1}return!A(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}ev(e){var t,s,i;if(!this.Kd&&this.Yd&&this._instance.sessionManager){if(!(!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Be.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ta]:!0});var r;if(this.Zd||(this.Zd=(r=F.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording(this._instance,this.Xe),this.Zd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ov())return this.Qd==="missing_config"||this.Qd==="awaiting_config"?void 0:(this.Qd="awaiting_config",Be.info("persisted remote config is stale, requesting fresh config before starting"),void new ol(this._instance).load());this.Qd=to,(s=(i=this.Zd).setDocumentWasEverVisible)===null||s===void 0||s.call(i,this.Xe),this.Zd.start(e)}else this.Qd=Di}onRRwebEmit(e){var t,s;(t=this.Zd)===null||t===void 0||(s=t.onRRwebEmit)===null||s===void 0||s.call(t,e)}overrideLinkedFlag(){var e,t;this.Zd||(t=this.Cl)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Zd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Zd||(t=this.Cl)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Zd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,s;this.Zd||(s=this.Cl)===null||s===void 0||s.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Zd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Zd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var s;return!!(!((s=this.Zd)===null||s===void 0)&&s.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Zd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},eh={autocapture:class extends Pd{constructor(e){super(new Od(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.av=this.lv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.uv();return!!(e.path||e.search||this.hv(e))}startIfEnabled(){this.isEnabled&&($.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.av=this.lv(),this.startIfEnabled()}stop(){this.dv&&this.dv(),this.dv=void 0,this.vv&&this.vv(),this.vv=void 0,$.info("History API monitoring stopped")}monitorHistoryChanges(){y&&y.history&&(this.fv("pushState"),this.fv("replaceState"),this.pv(),this.hv()&&this.gv())}fv(e){var t;if(!y||!((t=y.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const s=this;fs(y.history,e,i=>function(r,n,o){i.call(this,r,n,o),s.mv(e)})}lv(){const e=y?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}uv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:N(e)?e:{}}hv(e=this.uv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}yv(e){const t=this.uv(),s=this.av;return!(!s||!(t.path&&e.pathname!==s.pathname||t.search&&e.search!==s.search||this.hv(t)&&e.hash!==s.hash))}mv(e){try{const t=this.lv();if(!t)return;this.yv(t)&&this._instance.capture(Cr,{navigation_type:e}),this.av=t}catch(t){$.error(`Error capturing ${e} pageview`,t)}}pv(){if(this.dv)return;const e=()=>{this.mv("popstate")};U(y,"popstate",e),this.dv=()=>{y&&y.removeEventListener("popstate",e)}}gv(){if(this.vv)return;const e=()=>{this.mv("hashchange")};U(y,"hashchange",e),this.vv=()=>{y&&y.removeEventListener("hashchange",e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){var t;this.bv=!1,this._o=!1,this._v=null,this.instance=e,this.bv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Zi]),this.rageclicks=new Cl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return N(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return A(this.Ir.capture_heatmaps)?A(this.Ir.enable_heatmaps)?this.bv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._o)return;Md.info("starting..."),this.wv(),this.ln()}else{var e;clearInterval((e=this._v)!==null&&e!==void 0?e:void 0),this.Sv(),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({[Zi]:s}),this.bv=s,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}xv(e){Ni(e.originalEvent)&&this.Mr(e.originalEvent,"deadclick")}ln(){this._v&&clearInterval(this._v),this._v=k?.visibilityState==="visible"?setInterval(this.pl.bind(this),this.flushIntervalMilliseconds):null}wv(){y&&k&&(this.Cv=this.pl.bind(this),U(y,zs,this.Cv),this.$v=e=>this.Mr(e||y?.event),U(k,"click",this.$v,{capture:!0}),this.Tv=e=>this.Iv(e||y?.event),U(k,"mousemove",this.Tv,{capture:!0}),this.Mv=new On(this.instance,Lc,this.xv.bind(this)),this.Mv.startIfEnabledOrStop(),this.Ev=this.ln.bind(this),U(k,cs,this.Ev),this._o=!0)}Sv(){var e;y&&k&&(this.Cv&&y.removeEventListener(zs,this.Cv),this.$v&&k.removeEventListener("click",this.$v,{capture:!0}),this.Tv&&k.removeEventListener("mousemove",this.Tv,{capture:!0}),this.Ev&&k.removeEventListener(cs,this.Ev),clearTimeout(this.Pv),(e=this.Mv)===null||e===void 0||e.stop(),this._o=!1)}Rv(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&&Ne(u)&&!ve(u,"body");){if(u===l)return!1;let p;try{var c,d,h;p=(c=(d=(h=u.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&d!==void 0?d:y)===null||c===void 0?void 0:c.getComputedStyle(u).position}catch{return!1}if(R(a,p))return!0;u=Ha(u)}return!1})(ts(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:i),y:e.clientY+(n?0:s),target_fixed:n,type:t}}Mr(e,t="click"){var s;if(yn(e.target)||!Ni(e))return;const i=this.Rv(e,t);!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,new Date().getTime())&&za(ts(e),this.instance.config.rageclick)&&this.Zs(v(v({},i),{},{type:"rageclick"})),this.Zs(i)}Iv(e){!yn(e.target)&&Ni(e)&&(clearTimeout(this.Pv),this.Pv=setTimeout(()=>{this.Zs(this.Rv(e,"mousemove"))},500))}Zs(e){if(!y)return;const t=this.Ir.disable_capture_url_hashes?rt(y.location.href):y.location.href,s=this.Ir.custom_personal_data_properties,i=this.Ir.mask_personal_data_properties?[...At,...s||[]]:[],r=ps(t,i,vs);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}pl(){this.Rt&&!ke(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:On,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.bv=!1,this._o=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Av=()=>{clearTimeout(this.Fv),this.Fv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",v({$current_url:this.Rt.url},this.Rt.metrics.reduce((s,i)=>v(v({},s),{},{[`$web_vitals_${i.name}_event`]:v({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=s=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},A(s?.name)||A(s?.value))return void lt.error("Invalid metric received",s);const r=typeof s.navigationURL=="string"?s.navigationURL:void 0,n=this.Dv(r);if(w(n))return;const o=ne(s.navigationId)||typeof s.navigationId=="string"?`navigation:${s.navigationId}`:`url:${n}`;if(this.Lv&&s.value>=this.Lv)return void lt.error("Ignoring metric with value >= "+this.Lv,s);this.Rt.navigationKey!==o&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),w(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=n),this.Rt.firstMetricTimestamp=w(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),l=v(v(v({},s),r?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,N(s.attribution)&&this.attributionMetrics.indexOf(s.name)>-1){const u={};for(const c of Td){const d=c==="url"&&typeof s.attribution[c]=="string"?this.Dv(s.attribution[c]):s.attribution[c];w(d)||(u[c]=d)}l.attribution=u}else delete l.attribution;w(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.Av()},this.Nv=()=>{if(this._o)return;let s,i,r,n,o=!1;const a=F.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,u=l?.[this.qv]||(this.qv==="web-vitals"&&w(l)?a?.postHogWebVitalsCallbacks:void 0);if(!w(u)){const h=u.withoutAttribution,p=this.attributionMetrics;o=!w(h),s=p.indexOf("LCP")>-1?u.onLCP:h?.onLCP||u.onLCP,i=p.indexOf("CLS")>-1?u.onCLS:h?.onCLS||u.onCLS,r=p.indexOf("FCP")>-1?u.onFCP:h?.onFCP||u.onFCP,n=p.indexOf("INP")>-1?u.onINP:h?.onINP||u.onINP}if(!(s&&i&&r&&n))return void lt.error("web vitals callbacks not loaded - not starting");const c={reportSoftNavs:this.useSoftNavs},d=o&&this.attributionMetrics.indexOf("INP")>-1?v(v({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&s(this.Ov.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Ov.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Ov.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&n(this.Ov.bind(this),d),this._o=!0},this.bv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[tr]),this.startIfEnabled()}get jv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const s=N(this.jv)?(e=this.jv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return A(s)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||eo:s}get flushToCaptureTimeoutMs(){return(N(this.jv)?this.jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=N(this.jv)?this.jv.web_vitals_attribution:void 0;return we(e)?e?eo:[]:M(e)?e:Fd}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=N(this.jv)?this.jv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Lv(){const e=N(this.jv)&&ne(this.jv.__web_vitals_max_value)?this.jv.__web_vitals_max_value:Qn;return e>0&&6e4>=e?Qn:e}get isEnabled(){const e=ee?.protocol;if(e!=="http:"&&e!=="https:")return lt.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=N(this.jv)?this.jv.web_vitals:we(this.jv)?this.jv:void 0;return we(t)?t:this.bv}startIfEnabled(){this.isEnabled&&!this._o&&(lt.info("enabled, starting..."),this.qo(this.Nv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const s=N(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=N(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tr]:s}),this._instance.persistence.register({[wa]:i})),this.bv=s,this.startIfEnabled()}get qv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}qo(e){var t;const s=F.__PosthogExtensions__,i=this.qv,r=s?.postHogWebVitalsCallbacksByFlavor;r?.[i]||i==="web-vitals"&&w(r)&&s?.postHogWebVitalsCallbacks?e():s==null||(t=s.loadExternalDependency)===null||t===void 0||t.call(s,this._instance,i,n=>{n?lt.error("failed to load script",n):e()})}Dv(e){const t=e||y?.location.href;if(!t)return void lt.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?rt(t):t,i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...At,...i||[]]:[];return ps(s,r,vs)}}},th={exceptionObserver:class{constructor(e){var t;this.Nv=()=>{var s;if(!y||!this.isEnabled||!(!((s=F.__PosthogExtensions__)===null||s===void 0)&&s.errorWrappingFunctions))return;const i=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Bv&&this.Ir.capture_unhandled_errors&&(this.Bv=i(this.captureException.bind(this))),!this.Hv&&this.Ir.capture_unhandled_rejections&&(this.Hv=r(this.captureException.bind(this))),!this.zv&&this.Ir.capture_console_errors&&(this.zv=n(this.captureException.bind(this)))}catch(o){Gt.error("failed to start",o),this.Uv()}},this._instance=e,this.Wv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Qi]),this.wt=new Jl(v(v({},(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,$:Gt})),this.Ir=this.Vv(),this.startIfEnabledOrStop()}Vv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return N(e)?t=v(v({},t),e):(w(e)?this.Wv:e)&&(t=v(v({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Gt.info("enabled"),this.Uv(),this.qo(this.Nv)):this.Uv()}qo(e){var t,s,i;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(s=F.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"exception-autocapture",r=>{if(r)return Gt.error("failed to load script",r);e()})}Uv(){var e,t,s;(e=this.Bv)===null||e===void 0||e.call(this),this.Bv=void 0,(t=this.Hv)===null||t===void 0||t.call(this),this.Hv=void 0,(s=this.zv)===null||s===void 0||s.call(this),this.zv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.Wv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Qi]:this.Wv}),this.Ir=this.Vv(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.Vv()}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 Gt.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.Gv=[],this.Zv=new au([new xu,new Fu,new Eu,new ku,new Ou,new Pu,new Su,new Cu],(function(i,...r){return(n,o=0)=>{const a=[],l=n.split(`
|
|
3
|
+
`),u=Math.min(l.length,o+1e3),c=[];for(let p=o;u>p;p++){const g=l[p];if(g.length>1024)continue;const m=en.test(g)?g.replace(en,"$1"):g;if(!m.match(/\S*Error: /)){for(const _ of r){const f=_(m,i);if(f){a.push(f);const b=mu(a);if(b){for(let x=c.length-1;x>=0;x--){const P=c[x];if(b.start>=P.start+P.length)break;c.pop()}c.push(b)}break}}if(bu(a,c)>=50)break}}const d=[...c].sort((p,g)=>g.start-p.start),h=d[d.length-1];if(h){const p=ia(a,h);a.splice(h.start-p,p);for(const g of d)g.start-=p}for(const p of d)yu(a,p);return c.some(p=>p.start===0&&a.length===p.length)&&(function(p){const g=p.map(_=>`${_.function}|${_.filename}|${_.lineno}|${_.colno}|${_.module}`);let m=0;for(let _=1;g.length>_;_++)wu(g,_,m)&&(m=_);p.push(...p.splice(0,m))})(a),(function(p){if(!p.length)return[];const g=Array.from(p);return g.reverse(),g.slice(0,50).map(m=>{return v(v({},m),{},{filename:m.filename||(_=g,_[_.length-1]||{}).filename,function:m.function||"?"});var _})})(a)}})("web:javascript",vu,_u)),this._instance=e,this.Gv=(t=(s=this._instance.persistence)===null||s===void 0?void 0:s.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.Qv=js(this.Jv()),this.Kv=new Mu(this.Qv)}onConfigChange(){this.Qv=js(this.Jv()),this.Kv.setConfig(this.Qv)}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.Gv=n,this._instance.persistence&&this._instance.persistence.register({[ya]:this.Gv,[er]:o})}get Xv(){var e;const t=!!this._instance.get_property(er),s=this._instance.config.error_tracking.captureExtensionExceptions;return(e=s??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Zv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Qv.enabled)try{if(!D(e)||e.trim().length===0)return void Oe.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)=>Tu.has(a)?(n.push(a),o):(o[a]=r[a],o),{}),droppedKeys:n}})(this.Yv(t));i.length>0&&Oe.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Kv.add(v({[Ds]:e,[Ns]:new Date().toISOString()},s))}catch(s){Oe.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.tf(t)){if(this.ef(t))return this.if("Exception dropped: matched a suppression rule"),void Oe.info("Skipping exception capture because a suppression rule matched");if(!this.Xv&&this.nf(t))return this.if("Exception dropped: thrown by a browser extension"),void Oe.info("Skipping exception capture because it was thrown by an extension");if(!this.Xv&&this.sf(t))return this.if("Exception dropped: thrown by an injected browser script"),void Oe.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.rf(t))return this.if("Exception dropped: thrown by the PostHog SDK"),void Oe.info("Skipping exception capture because it was thrown by the PostHog SDK")}const s=this.Qv.enabled&&A(e.$exception_steps)?this.af(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",ah:!0});return r&&this.Kv.clear(),r}catch(r){return po(r)||Oe.error("Failed to capture exception event. Dropping this exception.",r),void this.Kv.clear()}}catch(t){return void(po(t)||Oe.error("Failed to process exception event. Ignoring this exception.",t))}}af(e){try{const t=this.Kv.getAttachable();return t.length===0?e:v(v({},e),{},{$exception_steps:t})}catch(t){return Oe.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}if(e){this.Qv.enabled&&this.Kv.add({[Ds]:e,[Ns]:new Date().toISOString()})}Yv(e){return N(e)?v({},e):{}}Jv(){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:{}}ef(e){if(e.length===0)return!1;try{const t=e.reduce((s,{type:i,value:r})=>(D(i)&&i.length>0&&s.$exception_types.push(i),D(r)&&r.length>0&&s.$exception_values.push(r),s),{$exception_types:[],$exception_values:[]});return this.Gv.some(s=>{const i=s.values.map(r=>{const n=Sl[r.operator],o=t[r.key];if(!n||!o)return!1;const a=M(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 Oe.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}nf(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&&zd.some(r=>i.startsWith(r)));return s.length!==0&&(!s.every(({filename:i})=>!!i&&i.startsWith(_r))||e.some(({type:i,value:r})=>i==="NoResponse"||D(r)&&Vd.some(({value:n,exact:o})=>o?r===n:r.includes(n)))&&!t.some(({in_app:i,filename:r})=>i&&!r?.startsWith(_r)))}sf(e){return e.some(({value:t})=>D(t)&&Ud.some(s=>t.includes(s)))}rf(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}tf(e){return!A(e)&&M(e)}}},sh=v({productTours:class{get Cl(){return this._instance.persistence}constructor(e){this.lf=null,this.uf=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.Cl&&this.Cl.register({[Ir]:!!t.productTours}),!ji(this._instance))return!this.lf&&A((s=this.Cl)===null||s===void 0?void 0:s.props.ph_product_tours)||$s.info("product tours disabled; stopping and clearing cached tours"),(i=this.lf)===null||i===void 0||i.stop(),this.lf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.lf&&ji(this._instance)&&this.qo(()=>this.hf())}qo(e){var t,s,i;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(s=F.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"product-tours",r=>{r?$s.error("Could not load product tours script",r):e()})}hf(){var e;!this.lf&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.lf=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(M(this.uf)&&!t)return void e(this.uf,{isLoaded:!0});const s=this.Cl;if(s){const i=s.props[rr];if(M(i)&&!t)return this.uf=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(!ji(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||$s.warn(o):$s.error(o),void e([],{isLoaded:!1,error:o})}const n=M(i.json.product_tours)?i.json.product_tours:[];this.uf=n,s&&s.register({[rr]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){A(this.lf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.lf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.lf)===null||t===void 0||t.showTourById(e)}previewTour(e){this.lf?this.lf.previewTour(e):this.qo(()=>{var t;this.hf(),(t=this.lf)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.lf)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.lf)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.lf)===null||e===void 0||e.previousStep()}clearCache(){var e;this.uf=null,(e=this.Cl)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.lf)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.lf)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.lf)===null||t===void 0||t.cancelPendingTour(e)}}},ii),ih={siteApps:class{constructor(e){this._instance=e,this.cf=0,this.df=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}vf(e,t){if(!t)return;const s=this.globalsForEvent(t);this.df.push(s),this.df.length>1e3&&(this.df=this.df.slice(10))}get siteAppLoaders(){var e;return(e=F._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.vf.bind(this));this.ff=()=>{e(),this.df=[],this.ff=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[p,g]of Object.entries(c))l[p]={id:u[p],type:p,properties:g};const{$set_once:d,$set:h}=e;return{event:v(v({},aa(e,Rd)),{},{properties:v(v(v({},e.properties),h?{$set:v(v({},(t=(s=e.properties)===null||s===void 0?void 0:s.$set)!==null&&t!==void 0?t:{}),h)}:{}),d?{$set_once:v(v({},(i=(r=e.properties)===null||r===void 0?void 0:r.$set_once)!==null&&i!==void 0?i:{}),d)}:{}),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}}pf(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)||(Re.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)||(Re.error("prepare_external_dependency_script returned null"),null):e}gf(){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=k?.defaultView,u=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!u)return()=>{};if(this.cf++,this.mf)return this.yf();const c=[],d=this,h=new WeakSet,p=(_,f,b)=>{if(!_?.[f])return;const x=_[f];_[f]=b(x),c.push(()=>{_[f]=x})},g=_=>{if(h.has(_))return _;const f=d.pf(_);return f&&h.add(f),f},m=_=>_.map(f=>typeof f=="string"?f:g(f)).filter(f=>!re(f));return p(u,"appendChild",_=>function(f){const b=g(f);return b?_.call(this,b):f}),p(u,"insertBefore",_=>function(f,b){const x=g(f);return x?_.call(this,x,b):f}),p(u,"replaceChild",_=>function(f,b){const x=g(f);return x?_.call(this,x,b):b}),[(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(_=>{p(_,"append",f=>function(...b){return f.apply(this,m(b))}),p(_,"prepend",f=>function(...b){return f.apply(this,m(b))})}),[(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(_=>{p(_,"before",f=>function(...b){return f.apply(this,m(b))}),p(_,"after",f=>function(...b){return f.apply(this,m(b))}),p(_,"replaceWith",f=>function(...b){const x=m(b);return b.length&&!x.length?void 0:f.apply(this,x)})}),p((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",_=>function(f,b){const x=g(b);return x?_.call(this,f,x):null}),this.mf=()=>{c.forEach(_=>_()),this.mf=void 0},this.yf()}yf(){let e=!1;return()=>{var t;e||(e=!0,this.cf--,this.cf===0&&((t=this.mf)===null||t===void 0||t.call(this)))}}bf(e,t=!0){const s=this.gf();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.df.length&&(Re.info(`Processing ${this.df.length} events for site app with id ${e.id}`),this.df.forEach(o=>this.bf(()=>{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.ff)===null||n===void 0||n.call(this))};let i=!1;const r=n=>{t.errored=!n,t.loaded=!0,Re.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),i&&s()};try{const{processEvent:n}=this.bf(o=>e.init({posthog:this._instance,callback(a){o(),r(a)}}),!1);n&&(t.processEvent=n),i=!0}catch(n){Re.error(so+e.id,n),r(!1)}if(i&&t.loaded)try{s()}catch(n){Re.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}_f(){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)}wf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const s of Object.values(this.apps))try{this.bf(()=>{var i;return(i=s.processEvent)===null||i===void 0?void 0:i.call(s,t)})}catch(i){Re.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._f(),void this._instance.on("eventCaptured",a=>this.wf(a))):void Re.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this.ff)===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;F[`__$$ph_site_app_${a}`]=this._instance,(n=F.__PosthogExtensions__)===null||n===void 0||(o=n.loadSiteApp)===null||o===void 0||o.call(n,this._instance,l,u=>{if(u)return Re.error(so+a,u)})}else Re.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},rh={tracingHeaders:class{constructor(e){this._instance=e,this.kf=void 0,this.Sf=void 0,this.xf=void 0,this.Nv=()=>{const t=this.Cf();var s,i;t?(w(this.kf)&&(this.kf=(s=F.__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)),w(this.Sf)&&(this.Sf=(i=F.__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.Uv()}}initialize(){this.startIfEnabledOrStop()}qo(e){var t,s,i;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(s=F.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"tracing-headers",r=>{if(r)return Cd.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}Cf(){const e=this.$f();return M(e)?(M(this.xf)?this.xf.splice(0,this.xf.length,...e):this.xf=[...e],e.length>0?this.xf:void 0):(M(this.xf)&&this.xf.splice(0),this.xf=e||void 0,this.xf)}Uv(){var e,t;(e=this.kf)===null||e===void 0||e.call(this),(t=this.Sf)===null||t===void 0||t.call(this),this.kf=void 0,this.Sf=void 0}startIfEnabledOrStop(){this.Cf()?this.qo(this.Nv):this.Uv()}}},nh=v({surveys:class extends Ad{constructor(e){var t;super(new Bd(e),(t=e,{get projectToken(){return t.config.token},kv:new jd(t)})),this._instance=e}Oh(e,t){const s=t.query?_s(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})})}}},ii),oh={toolbar:class{constructor(e){this.instance=e}Tf(e){F.ph_toolbar_state=e}If(){var e;return(e=F.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(or(this.instance.config)||!y||!k)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=qd||Gs(e.hash,"__posthog")||Gs(e.hash,"state");let o;const a=n?Xr(()=>JSON.parse(atob(decodeURIComponent(n))))||Xr(()=>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(ro)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Mf(e){const t=F.ph_load_toolbar||F.ph_load_editor;!A(t)&&ue(t)?t(e,this.instance):no.warn("No toolbar load function found")}loadToolbar(e){const t=!!k?.getElementById("__POSTHOG_TOOLBAR__");if(!y||t)return!1;const s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=v(v({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(y.localStorage.setItem(ro,JSON.stringify(v(v({},i),{},{source:void 0}))),this.If()===2)this.Mf(i);else if(this.If()===0){var r,n;this.Tf(1),(r=F.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"toolbar",o=>{if(o)return no.error("[Toolbar] Failed to load",o),void this.Tf(0);this.Tf(2),this.Mf(i)}),U(y,"turbolinks:load",()=>{this.Tf(0),this.loadToolbar(i)})}return!0}Ef(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,s=void 0){return this.maybeLoadToolbar(e,t,s)}}},ah=v({experiments:class me{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(s=!1)=>{this.getWebExperiments(i=>{me.Pf("retrieved web experiments from the server"),this.Rf=new Map,i.forEach(r=>{if(r.feature_flag_key){var n;this.Rf&&(me.Pf("setting flag key ",r.feature_flag_key," to web experiment ",r),(n=this.Rf)===null||n===void 0||n.set(r.feature_flag_key,r));const o=this._instance.getFeatureFlag(r.feature_flag_key);D(o)&&r.variants[o]&&this.Af(r.name,o,r.variants[o].transforms)}else if(r.variants)for(const o in r.variants){const a=r.variants[o];me.Ff(a,this._instance)&&this.Af(r.name,o,a.transforms)}})},s)},this._instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}initialize(){}onFeatureFlags(t){if(this._is_bot())me.Pf(vo);else if(!this.Ir.disable_web_experiments){if(A(this.Rf))return this.Rf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();me.Pf("applying feature flags",t),t.forEach(s=>{var i;if(this.Rf&&(!((i=this.Rf)===null||i===void 0)&&i.has(s))){var r;const n=this._instance.getFeatureFlag(s),o=(r=this.Rf)===null||r===void 0?void 0:r.get(s);n&&o?.variants[n]&&this.Af(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){const t=me.getWindowLocation();if(t?.search){const s=Rt(t?.search,"__experiment_id"),i=Rt(t?.search,"__experiment_variant");s&&i&&(me.Pf(`previewing web experiments ${s} && ${i}`),this.getWebExperiments(r=>{this.Of(parseInt(s),i,r)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,s,i){if(this.Ir.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.Ir.token}`),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Of(t,s,i){const r=i.filter(n=>n.id===t);r&&r.length>0&&(me.Pf(`Previewing web experiment [${r[0].name}] with variant [${s}]`),this.Af(r[0].name,s,r[0].variants[s].transforms))}static Ff(t,s){return!A(t.conditions)&&me.Df(t,s)&&me.Lf(t)}static Df(t,s){var i;if(A(t.conditions)||A((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const r=me.getWindowLocation();if(r){var n,o,a;const l=ja(s,r.href);return!(!((n=t.conditions)===null||n===void 0)&&n.url)||Wd[(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 Lf(t){var s;if(A(t.conditions)||A((s=t.conditions)===null||s===void 0?void 0:s.utm))return!0;const i=Ya();if(i.utm_source){var r,n,o,a,l,u,c,d;const h=!(!((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,p=!(!((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)||((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0?void 0:d.utm_term)==i.utm_term;return h&&g&&m&&p}return!1}static Pf(t,...s){$.info(`[WebExperiments] ${t}`,s)}Af(t,s,i){this._is_bot()?me.Pf(vo):s!=="control"?i.forEach(r=>{if(r.selector){var n;me.Pf(`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)})}}):me.Pf("Control variants leave the page unmodified.")}_is_bot(){return ce&&this._instance?kl(ce,this.Ir.custom_blocked_useragents):void 0}}},ii),lh={conversations:class{constructor(e){this._instance=e,this.Nf=void 0,this._conversationsManager=null,this.qf=!1,this.ne=null,this.jf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Bf=e.ok,!e.ok))return;const t=e.config.conversations;A(t)||(we(t)?this.Nf=t:(this.Nf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Nf=void 0,this.ne=null,this.Bf=void 0,this.jf=!1}loadIfEnabled(){if(this._conversationsManager||this.qf||this._instance.config.disable_conversations||or(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=F?.__PosthogExtensions__;if(e&&!w(this.Nf)&&this.Nf)if(this.ne&&this.ne.token){this.qf=!0;try{const t=e.initConversations;if(t)return this.Hf(t),void(this.qf=!1);const s=e.loadExternalDependency;if(!s)return void this.zf(Or);s(this._instance,"conversations",i=>{i||!e.initConversations?this.zf("Could not load conversations script",i):this.Hf(e.initConversations),this.qf=!1})}catch(t){this.zf("Error initializing conversations",t),this.qf=!1}}else Ie.error("Conversations enabled but missing token in remote config.")}Hf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.jf=!1,Ie.info("Conversations loaded successfully")}catch(t){this.zf("Error completing conversations initialization",t)}else Ie.error("Cannot complete initialization: remote config is null")}zf(e,t){Ie.error(e,t),this._conversationsManager=null,this.qf=!1,this.jf=!0}show(){this._conversationsManager?this._conversationsManager.show():Ie.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Nf===!0&&!re(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":or(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Bf===!1?"remote_config_failed":w(this.Nf)?this.Bf?"disabled_in_project":"remote_config_pending":this.Nf?A(this.ne)||!this.ne.token?"missing_token":F?.__PosthogExtensions__?this.qf?"initializing":this.jf?"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 Z(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,s):(Ie.warn(ct),null)})()}getMessages(e,t){var s=this;return Z(function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,t):(Ie.warn(ct),null)})()}markAsRead(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ie.warn(ct),null)})()}getTickets(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ie.warn(ct),null)})()}requestRestoreLink(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ie.warn(ct),null)})()}restoreFromToken(e){var t=this;return Z(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ie.warn(ct),null)})()}restoreFromUrlToken(){var e=this;return Z(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ie.warn(ct),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}bh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}_h(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},uh={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Uf=!1,this.Wf=!1,this.Vf=!1,this.$=se("[logs]"),this.Gf=v(v({},this.$),{},{error:(...s)=>{s.some(_o)||this.$.error(...s)}}),this.nl=[],this.Zf=[],this.od=0,this.xo=!1,this.Qf=[],this.Jf=[],this.Kf=!1,this.Xf=!1,this.Yf=()=>{var s,i;this.xo||(this.od=0,(s=this.tp)===null||s===void 0||s.onReconnect(),(i=this.ep)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Uf=!0),y&&U(y,"online",this.Yf)}np(e,t,s,i){var r;const n=fo((r=this._instance)===null||r===void 0||(r=r.config)===null||r===void 0?void 0:r.logs,s);return[new Vu(this.sp(e,t),n,this.Gf,()=>this.rp(),o=>o(),void 0,i),n]}op(){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.tp&&this.ap===t||((s=this.tp)===null||s===void 0||s.reset(),this.ap=t,[this.tp,this.lp]=this.np(()=>this.nl,i=>{this.nl=i})),this.tp}up(){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.ep&&this.hp===t||((s=this.ep)===null||s===void 0||s.reset(),this.hp=t,[this.ep,this.cp]=this.np(()=>this.Zf,i=>{this.Zf=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},go)),this.ep}setup(e){var t;if(this.xo)return;this.mo=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.Uf=!0),(this.Uf||this.dp()&&this.vp())&&this.fp();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.xo?i.dispose():(this.To=i,s||this.loadIfEnabled())}dispose(){var e,t,s,i;this.xo||(this.xo=!0,this.pp(),(e=this.To)===null||e===void 0||e.dispose(),this.To=void 0,this.mo=void 0,this.Vf=!1,y?.removeEventListener("online",this.Yf),(t=this.gp)===null||t===void 0||t.call(this),this.gp=void 0,(s=this.tp)===null||s===void 0||s.reset(),(i=this.ep)===null||i===void 0||i.reset())}onRemoteConfig(e){var t,s;if(this.xo)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;A(i)?this.mp():((s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.register({$logs_capture_enabled_server_side:!!i}),i?(this.Uf=!0,this.Wf||this.fp(),this.loadIfEnabled()):this.mp())}reset(){var e,t,s,i;this.pp(),(e=this.tp)===null||e===void 0||e.clearQueue(),this.nl=[],(t=this.tp)===null||t===void 0||t.reset(),(s=this.ep)===null||s===void 0||s.clearQueue(),this.Zf=[],(i=this.ep)===null||i===void 0||i.reset(),this.od=0}captureLog(e){this.xo||this.op().captureLog(e)}captureConsoleLog(e){this.xo||this.up().captureLog(e)}captureBufferedConsoleLog(e,t,s){this.xo||this.up().captureLog(e,{context:t,occurredAtMs:s})}vp(){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[ba])}dp(){var e,t,s;return!(!((e=this._instance)===null||e===void 0||(t=e.Ya)===null||t===void 0)&&t.call(e))||!!(!((s=F._POSTHOG_REMOTE_CONFIG)===null||s===void 0||(s=s[this._instance.config.token])===null||s===void 0)&&s.config)}kh(){var e;this.pp(),(e=this.ep)===null||e===void 0||e.clearQueue(),this.Zf=[]}mp(){this.Uf||this.pp()}fp(){var e;if(this.Kf||!F?.console)return;const t=fo((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let s=!0;this.Jf.push(()=>{s=!1});for(const i of Gd){let r;try{r=Kd(F.console[i])}catch{continue}r&&this.Jf.push(fs(F.console,i,n=>{const o=(...a)=>{try{s&&this.yp(i,a,t)}catch{}return n.apply(F.console,a)};return o.__rrweb_original__=r,o}))}this.Kf=!0,this.bp=setTimeout(()=>{this.pp()},3e4)}yp(e,t,s){var i;if(this.Kf&&!this.Xf&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(s>this.Qf.length){this.Xf=!0;try{this.Qf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.rp()})}finally{this.Xf=!1}}}else this.pp()}pp(){if(this.Qf=[],this.Kf){this.Kf=!1,this.bp&&(clearTimeout(this.bp),this.bp=void 0);for(const e of this.Jf)e();this.Jf=[]}}_p(){const e=this.Qf;return this.pp(),e}get logger(){return this.wp||(this.wp={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.wp}flushLogs(e){e?this.kp(e):(this.tp&&this.tp.flush().catch(t=>this.Sp(t)),this.ep&&this.ep.flush().catch(t=>this.Sp(t)))}Sp(e){_o(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.xo||!this.Uf||this.Wf||this.Vf)return;const e=F?.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.pp();const t=e.loadExternalDependency;if(!t)return this.$.error(Or),void this.pp();this.Vf=!0;try{t(this._instance,"logs",s=>{if(this.Vf=!1,this.xo||!this.Uf)return;const i=e.logs;if(s||!i?.initializeLogs)this.$.error("Could not load logs script",s),this.pp();else{var r;const a=this._p();var n,o;this.gp=i.initializeLogs((r=this.mo)!==null&&r!==void 0?r:this._instance),this.Wf=!0,a.length>0&&((n=i.replayConsoleBuffer)===null||n===void 0||n.call(i,(o=this.mo)!==null&&o!==void 0?o:this._instance,a))}})}catch(s){throw this.Vf=!1,s}}sp(e,t){const s=this._instance;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},getPersistedProperty:i=>i===Le.LogsQueue?e():void 0,setPersistedProperty(i,r){var n;i===Le.LogsQueue&&t((n=r)!==null&&n!==void 0?n:[])},js:i=>this.js(i),getLibraryId:()=>le.LIB_NAME,getLibraryVersion:()=>le.LIB_VERSION}}js(e){return new Promise(t=>{if(Ja(this.od,3))return void t({kind:"fatal",error:qi(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:qi(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.xp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{const o=n.statusCode;if(this.Cp(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:qi(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}`)})}}})})}Cp(e){(e!==0||this._instance.__loaded)&&(this.od=Xa(e,this.od,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.")))}kp(e){this.nl.length>0&&this.$p(e,this.nl,this.lp,le.LIB_NAME,t=>{this.nl=t}),this.Zf.length>0&&this.$p(e,this.Zf,this.cp,go,t=>{this.Zf=t})}$p(e,t,s,i,r){if(t.length===0)return;const n=t.map(a=>a.record);r([]);const o=pa(n,ha(s,le.LIB_NAME,le.LIB_VERSION),i,le.LIB_VERSION);this._instance._send_request({method:"POST",url:this.xp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}xp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}rp(){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,A(r)||(t.sessionStartTimestamp=r),A(n)||(t.lastActivityTimestamp=n)}if(!(F==null||(e=F.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?rt(F.location.href):F.location.href),this._instance.featureFlags){const s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},ch={metrics:class{constructor(e){this._instance=e,this.$=se("[metrics]"),this.xo=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.xo)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Tp?this.Tp=(s=>{let i=!0;const r=()=>i?(a=>{var l;const u=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return u===!0?{}:u||void 0})(s):void 0,n=Yd(s,r),o=Zd(s,r);return()=>{i=!1,n(),o()}})(this._instance):!t&&this.Tp&&(this.Tp(),this.Tp=void 0)}op(){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.tp&&this.ap===t||((s=this.tp)===null||s===void 0||s.reset(),this.ap=t,this.tp=new zu(this.sp(),(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.tp}count(e,t=1,s){this.op().count(e,t,s)}gauge(e,t,s){this.op().gauge(e,t,s)}histogram(e,t,s){this.op().histogram(e,t,s)}flush(e){if(!this.tp)return Promise.resolve();if(e){const t=this.tp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.tp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.tp)===null||e===void 0||e.reset()}dispose(){var e,t;this.xo=!0,(e=this.Tp)===null||e===void 0||e.call(this),this.Tp=void 0,(t=this.tp)===null||t===void 0||t.reset()}sp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:s=>t.Ys(s),getLibraryId:()=>le.LIB_NAME,getLibraryVersion:()=>le.LIB_VERSION}}Ys(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(v(v({method:"POST",url:this.Ip(),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}`)})}}}))})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};os.__defaultExtensionClasses=v({},v(v(v(v(v(v(v(v(v(v(v(v(v({},ii),Qd),eh),th),sh),ih),nh),rh),oh),ah),lh),uh),ch));const dh=(function(){le.SDK_DIST_CHANNEL="npm";const e=rs[Jt]=new os;return(function(){function t(){t.done||(t.done=!0,wl=!1,G(rs,function(s){s._dom_loaded()}))}k?.addEventListener?k.readyState==="complete"?t():U(k,"DOMContentLoaded",t,{capture:!1}):y&&$.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var hh=dh;export{$e as Compression,dr as DisplaySurveyType,os as PostHog,Gc as ProductTourEventName,Rn as ProductTourEventProperties,Ue as SurveyEventName,Si as SurveyEventProperties,Vt as SurveyEventType,$i as SurveyType,hh as default,dh as posthog};
|