tokentracker-cli 0.87.12 → 0.87.13

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.
Files changed (97) hide show
  1. package/dashboard/dist/assets/AchievementBadge-ea7qapyL.js +1 -0
  2. package/dashboard/dist/assets/{AchievementsPage-DdE-PvdD.js → AchievementsPage-DoOYRLD5.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-j8gj_nYR.js → AchievementsSection-B7uvcdxK.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-HtyWTb3Y.js → BadgeDetailModal-1KF-h3Cm.js} +1 -1
  5. package/dashboard/dist/assets/{Card-B7pwNMNG.js → Card-DQgKBViP.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-Bkh3Fjze.js → ClawdAnimated-CbKk5C9F.js} +1 -1
  7. package/dashboard/dist/assets/{CommandPalette-qwGrZiaK.js → CommandPalette-MIRqk8Dp.js} +1 -1
  8. package/dashboard/dist/assets/{CommunityStatsModal-xActA7oW.js → CommunityStatsModal-CgHWU_T1.js} +1 -1
  9. package/dashboard/dist/assets/{ConfirmModal-ce7m5kbY.js → ConfirmModal-D05J-QUB.js} +1 -1
  10. package/dashboard/dist/assets/{Controls-ZF7RAlv8.js → Controls-D5LSYH96.js} +1 -1
  11. package/dashboard/dist/assets/{DashboardPage-DjAqcPbt.js → DashboardPage-H2Bl3Bwo.js} +1 -1
  12. package/dashboard/dist/assets/{DevicePage-C5M18HP8.js → DevicePage-TtCdnGIm.js} +1 -1
  13. package/dashboard/dist/assets/{DialogClose-D9dEiIrM.js → DialogClose-BfCS-Ntd.js} +1 -1
  14. package/dashboard/dist/assets/DialogDescription-DVH6GzL7.js +1 -0
  15. package/dashboard/dist/assets/{DialogTitle-BzF6VDdV.js → DialogTitle-O5nTArna.js} +1 -1
  16. package/dashboard/dist/assets/{FadeIn-CDCRfuK2.js → FadeIn-CigBazQo.js} +1 -1
  17. package/dashboard/dist/assets/{HeaderGithubStar-B9pwWkZX.js → HeaderGithubStar-DeMyqNpO.js} +1 -1
  18. package/dashboard/dist/assets/{HoverTooltip-Syqp_rdT.js → HoverTooltip-tOIlqXjb.js} +1 -1
  19. package/dashboard/dist/assets/{IpCheckPage-DDCJs34b.js → IpCheckPage-CCeG4lE9.js} +1 -1
  20. package/dashboard/dist/assets/{LandingPage-B-BRXVvv.js → LandingPage-33uNffc7.js} +2 -2
  21. package/dashboard/dist/assets/{LeaderboardAvatar-SM1rZD0T.js → LeaderboardAvatar-BRJKEfhb.js} +1 -1
  22. package/dashboard/dist/assets/{LeaderboardPage-BVZW-aOv.js → LeaderboardPage-_Fs74yLu.js} +2 -2
  23. package/dashboard/dist/assets/{LeaderboardProfileModal-BMo8dmT4.js → LeaderboardProfileModal-CFt90SC6.js} +3 -3
  24. package/dashboard/dist/assets/{LeaderboardProfilePage-CMaoZz79.js → LeaderboardProfilePage-CC9315s4.js} +1 -1
  25. package/dashboard/dist/assets/{LimitsPage-Bz1p1fI8.js → LimitsPage-fNLiGJas.js} +1 -1
  26. package/dashboard/dist/assets/{LocalOnlyNotice-DVqqppGu.js → LocalOnlyNotice-DJWlZgug.js} +1 -1
  27. package/dashboard/dist/assets/{LoginCard-DSI5qiwZ.js → LoginCard-B6zjmb6m.js} +1 -1
  28. package/dashboard/dist/assets/{LoginModal-bZgy6vVi.js → LoginModal-D7VtT-pA.js} +1 -1
  29. package/dashboard/dist/assets/{LoginPage-BEnSdTSO.js → LoginPage-CmKUywl4.js} +1 -1
  30. package/dashboard/dist/assets/{PetPage-Dj2OPBJo.js → PetPage-U28hAlPp.js} +1 -1
  31. package/dashboard/dist/assets/{PopoverPopup-BhXFfaac.js → PopoverPopup-DREcMHrJ.js} +1 -1
  32. package/dashboard/dist/assets/{ProviderIcon-CBmpx1uF.js → ProviderIcon-CxpFegpD.js} +1 -1
  33. package/dashboard/dist/assets/{ResetPasswordPage-DfdzG02N.js → ResetPasswordPage-XjbWpa4B.js} +1 -1
  34. package/dashboard/dist/assets/{SegmentedControl-DFEBI9gn.js → SegmentedControl-BUZrG_65.js} +1 -1
  35. package/dashboard/dist/assets/{Select-Cg0q9TwB.js → Select-Coxp19gW.js} +1 -1
  36. package/dashboard/dist/assets/{SelectItemText-BIfAByNj.js → SelectItemText-Dw-zi_PN.js} +1 -1
  37. package/dashboard/dist/assets/{ServiceStatusPage-CbQ7EApL.js → ServiceStatusPage-c4Gz9ND_.js} +1 -1
  38. package/dashboard/dist/assets/{SessionsPage-3AD3xDBi.js → SessionsPage-CJUJDivQ.js} +1 -1
  39. package/dashboard/dist/assets/{SettingsPage-Di6egC3t.js → SettingsPage-BoUeuTQk.js} +1 -1
  40. package/dashboard/dist/assets/{SkillsPage-CiE7tmhj.js → SkillsPage-Chv4kDY_.js} +1 -1
  41. package/dashboard/dist/assets/{TokenGalaxy-CA8DtXji.js → TokenGalaxy-UtsDkqN-.js} +1 -1
  42. package/dashboard/dist/assets/{ToolbarRootContext-Def90ZdR.js → ToolbarRootContext-D3Xvbsmu.js} +1 -1
  43. package/dashboard/dist/assets/{TrendMonitor-D_KwleIY.js → TrendMonitor-hjyZhVhp.js} +1 -1
  44. package/dashboard/dist/assets/{WidgetsPage-B3TlH8la.js → WidgetsPage-BaJJOspc.js} +1 -1
  45. package/dashboard/dist/assets/{WrappedPage-aQUlSHgU.js → WrappedPage-BdBZXCyS.js} +1 -1
  46. package/dashboard/dist/assets/{__vite-browser-external-L2HadaWR.js → __vite-browser-external-CU0HL6hY.js} +2 -2
  47. package/dashboard/dist/assets/{agent-logos-Dd2epVvG.js → agent-logos-D15jo0lu.js} +1 -1
  48. package/dashboard/dist/assets/{arrow-up-right-BYW8TxaE.js → arrow-up-right-C6W_K-fZ.js} +1 -1
  49. package/dashboard/dist/assets/{check-DjA9wjvH.js → check-D1DIUZ3y.js} +1 -1
  50. package/dashboard/dist/assets/{chevron-right-ChdXf-I7.js → chevron-right-DaZ6r6U5.js} +1 -1
  51. package/dashboard/dist/assets/{copy-DMD9VvI7.js → copy-DGTadiXw.js} +1 -1
  52. package/dashboard/dist/assets/{download-AY9DU1FN.js → download-CBYnlCsF.js} +1 -1
  53. package/dashboard/dist/assets/{external-link-CSwc4MMQ.js → external-link-BDjUPxFn.js} +1 -1
  54. package/dashboard/dist/assets/{flame-C0H6XAnq.js → flame-BSTr9RX6.js} +1 -1
  55. package/dashboard/dist/assets/{format-tokens-Cu8Q9KUB.js → format-tokens-CxjDlh0r.js} +1 -1
  56. package/dashboard/dist/assets/{icons-BlhiKkjO.js → icons-pOJhx7lO.js} +1 -1
  57. package/dashboard/dist/assets/{index-DTHLk-aT.js → index-Bym1hEGy.js} +1 -1
  58. package/dashboard/dist/assets/{index-Ca6uzmWw.js → index-CbpwbfY1.js} +1 -1
  59. package/dashboard/dist/assets/{index-Ck60l_u8.js → index-XCZRFozo.js} +1 -1
  60. package/dashboard/dist/assets/{info-DfeZe41U.js → info-DlZkEw5y.js} +1 -1
  61. package/dashboard/dist/assets/{limits-providers-D7KHzRsf.js → limits-providers-DOW-oPEP.js} +1 -1
  62. package/dashboard/dist/assets/{link-2-DaC-FMcZ.js → link-2-BaAMrLia.js} +1 -1
  63. package/dashboard/dist/assets/{loader-circle-DMfnuZaq.js → loader-circle-BvEjzy5k.js} +1 -1
  64. package/dashboard/dist/assets/{maximize-2-BLYlrp5S.js → maximize-2-DNjgO_My.js} +1 -1
  65. package/dashboard/dist/assets/{modifiers.esm-DKWwsA47.js → modifiers.esm-DpXL6h3m.js} +1 -1
  66. package/dashboard/dist/assets/module-CzlIpkuW.js +2 -0
  67. package/dashboard/dist/assets/{monitor-smartphone-CoZaLWA1.js → monitor-smartphone-DPmp8gGF.js} +1 -1
  68. package/dashboard/dist/assets/{provider-display-kfWeaovO.js → provider-display-YTGYyKIU.js} +1 -1
  69. package/dashboard/dist/assets/{react-uUvzHQm5.js → react-CBi7M7dK.js} +1 -1
  70. package/dashboard/dist/assets/{search-CQo3iV6X.js → search-MLfdUv_4.js} +1 -1
  71. package/dashboard/dist/assets/{skills-api-LQd25VfD.js → skills-api-C4jX9Owj.js} +1 -1
  72. package/dashboard/dist/assets/{sortable.esm-CZtmM7Tp.js → sortable.esm-YyExnyg0.js} +1 -1
  73. package/dashboard/dist/assets/{store-Bl3-sCXx.js → store-PiuqLY56.js} +1 -1
  74. package/dashboard/dist/assets/{terminal-DlcACqJp.js → terminal-DQkiIx3c.js} +1 -1
  75. package/dashboard/dist/assets/{trash-2-CQo1tgFy.js → trash-2-qoXweL8H.js} +1 -1
  76. package/dashboard/dist/assets/{use-community-stats-BQCn4wL0.js → use-community-stats-ByIG8K-M.js} +1 -1
  77. package/dashboard/dist/assets/{use-limits-display-prefs-Bl4NPX34.js → use-limits-display-prefs-CpW6_ZBo.js} +1 -1
  78. package/dashboard/dist/assets/{use-ordered-list-D1wNYgOm.js → use-ordered-list--ijka38Z.js} +1 -1
  79. package/dashboard/dist/assets/use-reduced-motion-DW0-IRCM.js +1 -0
  80. package/dashboard/dist/assets/{use-session-efficiency-pref-Btxlws5g.js → use-session-efficiency-pref-Di41rY7h.js} +1 -1
  81. package/dashboard/dist/assets/{use-transform-COsyA62D.js → use-transform-CKw05one.js} +1 -1
  82. package/dashboard/dist/assets/{use-usage-limits-DufOQF6m.js → use-usage-limits-DxAyfksJ.js} +1 -1
  83. package/dashboard/dist/assets/{useCurrency-Dr4F-MZe.js → useCurrency-DKrZtU2Z.js} +1 -1
  84. package/dashboard/dist/assets/{useScrollLock-7UUKbtyh.js → useScrollLock-D2roJGoE.js} +1 -1
  85. package/dashboard/dist/assets/{useTokenFormat-BHmT3c4D.js → useTokenFormat-C8hwTvLr.js} +1 -1
  86. package/dashboard/dist/assets/{zap-hfkDgLPJ.js → zap-BcmVPhUG.js} +1 -1
  87. package/dashboard/dist/index.html +1 -1
  88. package/dashboard/dist/ip-check.html +1 -1
  89. package/dashboard/dist/leaderboard.html +1 -1
  90. package/dashboard/dist/share.html +1 -1
  91. package/package.json +1 -1
  92. package/src/lib/pricing/curated-overrides.json +11 -11
  93. package/src/lib/pricing/seed-snapshot.json +1 -1
  94. package/dashboard/dist/assets/AchievementBadge-CeJiDzOv.js +0 -1
  95. package/dashboard/dist/assets/DialogDescription-CRaQgXyp.js +0 -1
  96. package/dashboard/dist/assets/module-Ci-Lrj0I.js +0 -2
  97. package/dashboard/dist/assets/use-reduced-motion-mkOJFv1A.js +0 -1
@@ -1,2 +0,0 @@
1
- var g=typeof window<"u"?window:void 0,ce=typeof globalThis<"u"?globalThis:g,ve=ce?.navigator,P=ce?.document,se=ce?.location,cr=ce?.fetch,Ts=ce!=null&&ce.XMLHttpRequest&&"withCredentials"in new ce.XMLHttpRequest?ce.XMLHttpRequest:void 0,Rr=ce?.AbortController,bo=ce?.CompressionStream,me=ve?.userAgent;function Ln(){return!(!g||g.navigator.onLine===!1)}var It=typeof globalThis<"u"?globalThis:g;It&&typeof self>"u"&&(It.self=It),It&&typeof File>"u"&&(It.File=function(){});var $=g??{},q={DEBUG:!1,LIB_VERSION:"0.2.4",LIB_NAME:"browser-common"};function Cr(i,e,t,s,r,n,a){try{var o=i[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(s,r)}function ie(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function a(l){Cr(n,s,r,a,o,"next",l)}function o(l){Cr(n,s,r,a,o,"throw",l)}a(void 0)}))}}function y(){return y=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},y.apply(null,arguments)}function Dn(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}var Or=i=>{if(typeof i!="string")return i;try{return JSON.parse(i)}catch{return i}};function Ar(i){return typeof i=="string"||i}function Lr(i){return typeof i=="string"?i:void 0}var Mt,wo=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],He=(function(i){return i.AnonymousId="anonymous_id",i.DistinctId="distinct_id",i.Props="props",i.EnablePersonProcessing="enable_person_processing",i.PersonMode="person_mode",i.FeatureFlagDetails="feature_flag_details",i.FeatureFlags="feature_flags",i.FeatureFlagPayloads="feature_flag_payloads",i.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",i.BootstrapFeatureFlags="bootstrap_feature_flags",i.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",i.OverrideFeatureFlags="override_feature_flags",i.Queue="queue",i.AiQueue="ai_queue",i.LogsQueue="logs_queue",i.OptedOut="opted_out",i.SessionId="session_id",i.SessionStartTimestamp="session_start_timestamp",i.SessionLastTimestamp="session_timestamp",i.PersonProperties="person_properties",i.GroupProperties="group_properties",i.InstalledAppBuild="installed_app_build",i.InstalledAppVersion="installed_app_version",i.SessionReplay="session_replay",i.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",i.SurveyLastSeenDate="survey_last_seen_date",i.SurveysSeen="surveys_seen",i.Surveys="surveys",i.RemoteConfig="remote_config",i.FlagsEndpointWasHit="flags_endpoint_was_hit",i.DeviceId="device_id",i})({}),Dr=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),xo=["$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"],Eo=["token"],Nn="NativeGzipValidationError",Fs=i=>i.length>=2&&i[0]===31&&i[1]===139,Nr=(i,e)=>i===Dr.GZipJS||e===Dr.GZipJS||e==="gzip",jr=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",oi=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=Nn,e},ko=(function(){var i=ie((function*(e,t){18>e.size&&oi("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Fs(s)&&s[2]===8||oi("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Mt)return Mt;Mt=[];for(var h=0;256>h;h++){for(var c=h,p=0;8>p;p++)c=1&c?3988292384^c>>>1:c>>>1;Mt[h]=c>>>0}return Mt})(),l=4294967295,u=0;a.length>u;u++)l=o[255&(l^a[u])]^l>>>8;return(4294967295^l)>>>0})(t)&&oi("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&oi("invalid-size")}));return function(e,t){return i.apply(this,arguments)}})();function $s(){return $s=ie((function*(i,e,t){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(i),r=new globalThis.CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(s).then((()=>n.close())).catch((function(){var u=ie((function*(h){try{yield n.abort(h)}catch{}throw h}));return function(h){return u.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield ko(l,s),l}catch(u){if(t!=null&&t.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}})),$s.apply(this,arguments)}var So=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],qr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return So.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))};function R(i,e){return i.indexOf(e)!==-1}var Ki=function(i){return i.trim()},Is=function(i){return i.replace(/^\$/,"")};function jn(i){var e,t=[];return(e=JSON.stringify(i,(function(s,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(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(r))return"[Circular]";t.push(r)}return r}})))!==null&&e!==void 0?e:"null"}var qn=Object.prototype,Hn=qn.hasOwnProperty,Ji=qn.toString,C=Array.isArray||function(i){return Ji.call(i)==="[object Array]"},Re=i=>typeof i=="function",K=i=>i===Object(i)&&!C(i),Je=i=>{if(K(i)){for(var e in i)if(Hn.call(i,e))return!1;return!0}return!1},w=i=>i===void 0,G=i=>Ji.call(i)=="[object String]",Ms=i=>G(i)&&i.trim().length===0,ge=i=>i===null,O=i=>w(i)||ge(i),ue=i=>Ji.call(i)=="[object Number]"&&i==i,je=i=>ue(i)&&i>0,Ce=i=>Ji.call(i)==="[object Boolean]",Po=i=>i instanceof FormData,To=i=>R(xo,i),Fo=i=>R(Eo,i);function Gn(i){return i===null||typeof i!="object"}function ki(i,e){return{}.toString.call(i)==="[object "+e+"]"}function dr(i){return typeof Event<"u"&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var $o=[!0,"true",1,"1","yes"],Qi=i=>R($o,i),Io=[!1,"false",0,"0","no"];function Ae(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),ue(i)?i>t?(s.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Ae(r||t,e,t,s))}class Mo{constructor(e){this.$e={},this.ze=e.ze,this.Ze=Ae(e.bucketSize,0,100,e.Ge),this.Qe=Ae(e.refillRate,0,this.Ze,e.Ge),this.Je=Ae(e.refillInterval,0,864e5,e.Ge)}Ke(e,t){var s=Math.floor((t-e.lastAccess)/this.Je);s>0&&(e.tokens=Math.min(e.tokens+s*this.Qe,this.Ze),e.lastAccess=e.lastAccess+s*this.Je)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.$e[r];return n?this.Ke(n,s):this.$e[r]=n={tokens:this.Ze,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.ze)==null||t.call(this,e)),n.tokens===0)}stop(){this.$e={}}}var Ee="Mobile",Si="iOS",Ve="Android",xt="Tablet",zn=Ve+" "+xt,Bn="iPad",Un="Apple",Vn=Un+" Watch",Vt="Safari",Et="BlackBerry",Wn="Samsung",Kn=Wn+"Browser",Jn=Wn+" Internet",lt="Chrome",Ro=lt+" OS",Yn=lt+" "+Si,pr="Internet Explorer",Zn=pr+" "+Ee,vr="Opera",Co=vr+" Mini",gr="Edge",Xn="Microsoft "+gr,bt="Firefox",Qn=bt+" "+Si,Xt="Nintendo",Qt="PlayStation",wt="Xbox",ea=Ve+" "+Ee,ta=Ee+" "+Vt,Ht="Windows",Rs=Ht+" Phone",Hr="Nokia",Cs="Ouya",ia="Generic",Oo=ia+" "+Ee.toLowerCase(),sa=ia+" "+xt.toLowerCase(),Os="Konqueror",ra="Oculus Browser",Pi="Vivaldi",na="Yandex",Ti="Whale",As="DuckDuckGo",aa="Pale Moon",Fi="Waterfox",Wt="Brave",oa="Google Search App",ee="(\\d+(\\.\\d+)?)",es=new RegExp("Version/"+ee),Ao=new RegExp(wt,"i"),Lo=new RegExp(Qt+" \\w+","i"),Do=new RegExp(Xt+" \\w+","i"),fr=new RegExp(Et+"|PlayBook|BB10","i"),No={"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"},la=function(i,e,t,s){e=e||"";var r=(function(n){return n!=null&&n.brave?Wt:null})(t);return r||(s!=null&&s.detectGoogleSearchApp&&R(i,"GSA/")?oa:R(i," OPR/")&&R(i,"Mini")?Co:R(i," OPR/")?vr:fr.test(i)?Et:R(i,"IE"+Ee)||R(i,"WPDesktop")?Zn:R(i,"OculusBrowser")?ra:R(i,Kn)?Jn:R(i,gr)||R(i,"Edg/")?Xn:R(i,Pi+"/")?Pi:R(i,"YaBrowser/")?na:R(i,Ti+"/")?Ti:R(i,As+"/")||R(i,"Ddg/")?As:R(i,"FBIOS")?"Facebook "+Ee:R(i,"UCWEB")||R(i,"UCBrowser")?"UC Browser":R(i,"CriOS")?Yn:R(i,"CrMo")||R(i,lt)?lt:R(i,Ve)&&R(i,Vt)?ea:R(i,"FxiOS")?Qn:R(i.toLowerCase(),Os.toLowerCase())?Os:R(i,Wt+"/")?Wt:((n,a)=>a&&R(a,Un)||(function(o){return R(o,Vt)&&!R(o,lt)&&!R(o,Ve)})(n))(i,e)?R(i,Ee)?ta:Vt:R(i,"PaleMoon/")?aa:R(i,Fi+"/")?Fi:R(i,bt)?bt:R(i,"MSIE")||R(i,"Trident/")?pr:R(i,"Gecko")?bt:"")},jo={[Zn]:[new RegExp("rv:"+ee)],[Xn]:[new RegExp(gr+"?\\/"+ee)],[lt]:[new RegExp("("+lt+"|CrMo)\\/"+ee)],[Yn]:[new RegExp("CriOS\\/"+ee)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ee)],[Vt]:[es],[ta]:[es],[vr]:[new RegExp("(Opera|OPR)\\/"+ee)],[bt]:[new RegExp(bt+"\\/"+ee)],[Qn]:[new RegExp("FxiOS\\/"+ee)],[Os]:[new RegExp("Konqueror[:/]?"+ee,"i")],[Et]:[new RegExp(Et+" "+ee),es],[ea]:[new RegExp("android\\s"+ee,"i")],[Jn]:[new RegExp(Kn+"\\/"+ee)],[ra]:[new RegExp("OculusBrowser\\/"+ee)],[Pi]:[new RegExp(Pi+"\\/"+ee)],[na]:[new RegExp("YaBrowser\\/"+ee)],[Ti]:[new RegExp(Ti+"\\/"+ee)],[Wt]:[new RegExp(Wt+"\\/"+ee)],[As]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ee)],[aa]:[new RegExp("PaleMoon\\/"+ee)],[Fi]:[new RegExp(Fi+"\\/"+ee)],[oa]:[new RegExp("GSA\\/"+ee)],[pr]:[new RegExp("(rv:|MSIE )"+ee)],Mozilla:[new RegExp("rv:"+ee)]},qo=function(i,e,t,s){var r=la(i,e,t,s),n=jo[r];if(w(n))return null;for(var a=0;n.length>a;a++){var o=i.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},Gr=[[new RegExp(wt+"; "+wt+" (.*?)[);]","i"),i=>[wt,i&&i[1]||""]],[new RegExp(Xt,"i"),[Xt,""]],[new RegExp(Qt,"i"),[Qt,""]],[fr,[Et,""]],[new RegExp(Ht,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Rs,""];if(new RegExp(Ee).test(e)&&!/IEMobile\b/.test(e))return[Ht+" "+Ee,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=No[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[Ht,s]}return[Ht,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[Si,[i[3],i[4],i[5]||"0"].join(".")]:[Si,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=w(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+Ve+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ve+")","i"),i=>i&&i[2]?[Ve,[i[2],i[3],i[4]||"0"].join(".")]:[Ve,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ro,""]],[/Linux|debian/i,["Linux",""]]],zr=function(i){return Do.test(i)?Xt:Lo.test(i)?Qt:Ao.test(i)?wt:new RegExp(Cs,"i").test(i)?Cs:new RegExp("("+Rs+"|WPDesktop)","i").test(i)?Rs:/iPad/.test(i)?Bn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Vn:fr.test(i)?Et:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Hr,"i").test(i)?Hr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(Ee).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?Ve:zn:new RegExp("(pda|"+Ee+")","i").test(i)?Oo:new RegExp(xt,"i").test(i)&&!new RegExp(xt+" pc","i").test(i)?sa:""},Ho=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Br(i,e){return typeof(t=i)=="string"&&Ho.test(t)?i:e();var t}function Ye(i){return i&&i.split("#")[0]}function _i(i,e){var t=setTimeout(i,e);return t?.unref&&t?.unref(),t}var Go=i=>i instanceof Error,ua={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}},zo=ua.info;function ha(i){if(Ce(i))return{boolValue:i};if(typeof i=="number")return Number.isFinite(i)?Number.isInteger(i)?{intValue:i}:{doubleValue:i}:{stringValue:String(i)};if(typeof i=="string")return{stringValue:i};if(C(i))return{arrayValue:{values:i.map((e=>ha(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function $i(i){var e=[];for(var t in i){var s=i[t];ge(s)||w(s)||e.push({key:t,value:ha(s)})}return e}function Bo(i,e){var t=ua[i.level||"info"]||zo,s=t.text,r=t.number,n=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),O(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),O(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var o=y({},a,i.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:r,severityText:s,body:{stringValue:i.body},attributes:$i(o)};return i.trace_id&&(l.traceId=i.trace_id),i.span_id&&(l.spanId=i.span_id),w(i.trace_flags)||(l.flags=i.trace_flags),l}function ca(i,e,t){return y({},i.resourceAttributes,{"service.name":i.serviceName||"unknown_service"},i.environment&&{"deployment.environment":i.environment},i.serviceVersion&&{"service.version":i.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":t})}function da(i,e,t,s){return{resourceLogs:[{resource:{attributes:$i(e)},scopeLogs:[{scope:{name:t,version:s},logRecords:i}]}]}}let Uo=class{constructor(i,e,t,s,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=i,this.Te=e,this.Ge=t,this.Ye=s,this.Xe=r,this.et=n,this.tt=a,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=e.maxBufferSize,this.dt=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.ct=e.flushIntervalMs,this.vt=e.maxBatchRecordsPerPost,this.ft=e.rateCapWindowMs,this.yt=e.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(i){if(!this._instance.isDisabled&&!this._instance.optedOut&&i!=null&&i.body){var e=this.wt(i);if(e!==null)if(e.body){if(this.xt()){var t={record:Bo(e,this.Ye())};this.Xe((()=>this.kt(t)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(i){var e=this.Te.beforeSend;if(!e)return i;var t=C(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.Ge.info("Log was rejected in beforeSend function"),null;s=n}catch(a){return this.Ge.error("Error in beforeSend function for log:",a),null}return s}xt(){if(this.yt===void 0)return!0;var i=Date.now(),e=i-this.st;return this.ft>e&&e>=0||(this.st=i,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var i=this;return ie((function*(){if(!i._instance.isDisabled)return i.rt||(i.rt=i.St().finally((()=>{i.rt=null}))),i.rt}))()}St(){var i=this;return ie((function*(){var e;i.bt();var t=(e=i._instance.getPersistedProperty(He.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var s=t.length,r=0;t.length>0&&s>r;){var n,a;i.it=0;var o=Math.min(t.length,i.vt),l=t.slice(0,o),u=da(l.map((c=>c.record)),i.Ct(),(n=i.tt)!==null&&n!==void 0?n:i._instance.getLibraryId(),i._instance.getLibraryVersion()),h=yield i._instance.Tt(u);if(h.kind==="too-large"&&l.length>1)i.vt=Math.max(1,Math.floor(l.length/2)),i.Ge.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+i.vt);else if(h.kind==="retry-later"||(h.kind==="too-large"?i.Ge.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&i.Te.maxBatchRecordsPerPost>i.vt&&(i.vt=Math.min(i.Te.maxBatchRecordsPerPost,i.vt+1)),yield i.It(l.length),t=(a=i._instance.getPersistedProperty(He.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,h.kind==="fatal"))throw h.error}}))()}It(i){var e=this;return ie((function*(){var t,s=Math.max(0,i-e.it),r=(t=e._instance.getPersistedProperty(He.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(He.LogsQueue,r.slice(s)),yield e.et()}))()}Ct(){return ca(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(i){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(He.LogsQueue))!==null&&e!==void 0?e:[];this.dt>t.length||(t.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),t.push(i),this._instance.setPersistedProperty(He.LogsQueue,t),this.ht>t.length?this.Mt():this._t()}}Mt(i){i===void 0&&(i=this.ct),this.Et||(this.Et=_i((()=>{this.Et=void 0,this._t()}),i))}Rt(){var i=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,i)}Pt(){var i=this._instance.getPersistedProperty(He.LogsQueue);return!!i&&i.length>0}shutdown(i){var e=this;return ie((function*(){e.bt();var t=e.flush().catch((()=>{}));i!==void 0?yield Promise.race([t,new Promise((s=>_i(s,i)))]):yield t}))()}flushWithTimeout(i){var e=this;return ie((function*(){var t=!1,s=e.flush(),r=new Promise((n=>_i((()=>{t=!0,n()}),i)));try{yield Promise.race([s,r])}finally{t&&s.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(i=>{this.nt++,this.Ge.error("PostHog logs flush failed:",i)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}};var ts=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ur(i){return String(i)+"000000"}function Vr(i,e,t,s){var r="";return s&&(r=Object.keys(s).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(s[n]))).join(",")),i+"\0"+e+"\0"+(t??"")+"\0"+r}let Vo=class{constructor(i,e,t){this._instance=i,this.Te=e,this.Ge=t,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(i,e,t){e===void 0&&(e=1),this.Nt({name:i,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(i,e,t){this.Nt({name:i,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(i,e,t){this.Nt({name:i,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var i=this,e=this.rt,t=(function(){var r=ie((function*(){e&&(yield e.catch((()=>{}))),yield i.Dt()}));return function(){return r.apply(this,arguments)}})(),s=t().finally((()=>{this.rt===s&&(this.rt=null)}));return this.rt=s,s}drainWindow(){if(this.Ot.size===0)return null;var i=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(i)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(i){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.wt(i);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.Ge.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t,s;try{t=e.attributes?y({},e.attributes):void 0,s=Vr(e.type,e.name,e.unit,t)}catch(a){return void this.Ge.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var r=this.Ot.get(s);if(!r){if(!this.jt())return;r={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.Ot.set(s,r)}var n=this.Lt.get(e.name);n===void 0?this.Lt.set(e.name,e.type):n===e.type||this.$t.has(e.name)||(this.$t.add(e.name),this.Ge.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(r,e.value),this.Mt()}else this.Ge.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(i,e){var t;switch(i.type){case"count":i.total=((t=i.total)!==null&&t!==void 0?t:0)+e;break;case"gauge":i.last=e;break;case"histogram":i.hist||(i.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(ts.length+1).fill(0)});var s=i.hist;s.count+=1,s.sum+=e,s.min=Math.min(s.min,e),s.max=Math.max(s.max,e),s.bucketCounts[(function(r,n){for(var a=0;n.length>a;a++)if(n[a]>=r)return a;return n.length})(e,ts)]+=1}}wt(i){var e=this.Te.beforeSend;if(!e)return i;var t=C(e)?e:[e],s=i;for(var r of t)try{var n=r(s);if(!n)return this.Ge.info("Metric was rejected in beforeSend function"),null;s=n}catch(a){return this.Ge.error("Error in beforeSend function for metric:",a),null}return s}Mt(){this.Et||(this.Et=_i((()=>{this.Et=void 0,this.flush().catch((i=>{this.Ge.error("Metrics flush failed:",i)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var i=this;return ie((function*(){if(i.Ot.size!==0){var e=i.Ot;i.Ot=new Map,i.Ft=!1,i.Lt=new Map,i.$t=new Set;var t=i.At,s=yield i._instance.Bt(i.qt(e));if(t===i.At)switch(s.kind){case"ok":return;case"retry-later":return i.Ut(e),void i.Mt();case"too-large":return void i.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void i.Ge.error("Failed to send metrics batch:",s.error)}}}))()}qt(i){return e=this.zt(i),t=(function(n,a,o){return y({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$i(t)},scopeMetrics:[{scope:{name:s,version:r},metrics:e}]}]};var e,t,s,r}zt(i){var e=Ur(Date.now()),t=new Map;for(var s of i.values()){var r,n=Vr(s.type,s.name,s.unit,void 0),a=t.get(n);a||(a=y({name:s.name},s.unit&&{unit:s.unit}),s.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:s.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,a));var o=$i((r=s.attributes)!==null&&r!==void 0?r:{}),l=Ur(s.windowStartMs);if(s.type==="count"){var u,h={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(u=s.total)!==null&&u!==void 0?u:0};a.sum.dataPoints.push(h)}else if(s.type==="gauge"){var c,p={attributes:o,timeUnixNano:e,asDouble:(c=s.last)!==null&&c!==void 0?c:0};a.gauge.dataPoints.push(p)}else s.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:ts})}return Array.from(t.values())}Ut(i){var e,t;for(var s of i){var r=s[0],n=s[1],a=this.Ot.get(r);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=((e=a.total)!==null&&e!==void 0?e:0)+((t=n.total)!==null&&t!==void 0?t:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.jt()&&this.Ot.set(r,n)}}};var li,Wr,is;function Wo(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return is&&t.length===Wr||(Wr=t.length,is=t.reduce(((s,r)=>{li||(li={});var n=li[r];if(n)s[n[0]]=n[1];else for(var a=i(r),o=a.length-1;o>=0;o--){var l=a[o],u=l?.filename,h=e[r];if(u&&h){s[u]=h,li[r]=[u,h];break}}return s}),{})),is}}class Ko{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var t=this;return ie((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&C(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),y({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ie((function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,t){var s,r,n,a={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Wo(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return y({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}}var kt="?";function Ls(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?kt:t,in_app:!0};return w(s)||(n.lineno=s),w(r)||(n.colno=r),n}var pa=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:kt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Jo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Yo=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zo=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xo=(i,e)=>{var t=Jo.exec(i);if(t)return Ls(e,t[1],kt,+t[2],+t[3]);var s=Yo.exec(i);if(s){if(s[2]&&s[2].indexOf("eval")===0){var r=Zo.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=pa(s[1]||kt,s[2]);return Ls(e,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Qo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,el=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tl=(i,e)=>{var t=Qo.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=el.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||kt,a=pa(n,r);return Ls(e,r=a[1],n=a[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Kr=/\(error: (.*)\)/;class il{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=G(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){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return ki(e,"DOMException")}isDOMError(e){return ki(e,"DOMError")}}class sl{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}}class rl{constructor(){}match(e){return ki(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var nl=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class al{match(e){return typeof e=="string"}coerce(e,t){var s,r=this.getInfos(e),n=r[0],a=r[1];return{type:n??"Error",value:a??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(nl);return r&&(t=r[1],s=r[2]),[t,s]}}var ol=["fatal","error","warning","log","info","debug"];function va(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class ll{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return dr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+va(e)}isSeverityLevel(e){return G(e)&&!Ms(e)&&ol.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(Go(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class ul{match(e){return dr(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+va(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class hl{match(e){return Gn(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class cl{match(e){return ki(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!dr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return Gn(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}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}}var Ii="$message",Mi="$timestamp",dl=new Set([Ii,Mi]),ss={enabled:!0,max_bytes:32768};function Ri(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:ss.enabled,max_bytes:vl(i.max_bytes,ss.max_bytes)}:y({},ss)}class pl{constructor(e){this.Vt=[],this.Wt=0,this.Te=Ri(e)}setConfig(e){this.Te=Ri(e),this.Zt()}add(e){var t=(function(r){var n;try{n=jn(r)}catch{return}try{var a=JSON.parse(n);if(!K(a))return;var o=a,l=o[Ii],u=o[Mi];return!G(l)||l.trim().length===0||!G(u)&&!ue(u)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var s=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),a=0,o=0;n.length>o;o++)n[o]==="%"?(a+=1,o+=2):a+=1;return a})(t.json);s>this.Te.max_bytes||(this.Vt.push({step:t.step,bytes:s}),this.Wt+=s,this.Zt())}}getAttachable(){return this.Vt.map((e=>e.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var e=this.Vt.shift();e&&(this.Wt-=e.bytes)}}}function vl(i,e){if(!ue(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var ga=function(i,e){var t=(e===void 0?{}:e).debugEnabled,s={k(r){if(g&&(q.DEBUG||g.POSTHOG_DEBUG||t)&&!w(g.console)&&g.console){for(var n=("__rrweb_original__"in g.console[r])?g.console[r].__rrweb_original__:g.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(i,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>ga(i+" "+r,n)};return s},x=ga("[PostHog.js]"),Y=x.createLogger,gl=Y("[ExternalScriptsLoader]"),rs=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return gl.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=P?.querySelectorAll("script");if(s){for(var r,n=function(){if(s[a].src===e){var l=s[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},a=0;s.length>a;a++)if(r=n())return r.v}var o=()=>{if(!P)return t("document not found");var l=P.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)},l.onerror=c=>t(c),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")P.head.appendChild(l);else{var u,h=P.querySelectorAll("body > script");h.length>0?(u=h[0].parentNode)==null||u.insertBefore(l,h[0]):P.body.appendChild(l)}};P!=null&&P.body?o():P?.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s;if(i.config.strict_script_versioning)s=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}s=i.requestRouter.endpointFor("assets",r)}rs(i,s,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");rs(i,a,t)}},$.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);rs(i,s,t)};q.DEBUG=!1,q.LIB_VERSION="1.407.6",q.LIB_NAME="web";var fa="$people_distinct_id",Ci="$device_id",ns="$device_model",Gt="__alias",zt="__timers",Ds="$autocapture_disabled_server_side",Ns="$heatmaps_enabled_server_side",js="$exception_capture_enabled_server_side",qs="$error_tracking_suppression_rules",Hs="$error_tracking_capture_extension_exceptions",Gs="$web_vitals_enabled_server_side",_r="$dead_clicks_enabled_server_side",mr="$product_tours_enabled_server_side",zs="$web_vitals_allowed_metrics",ot="$session_recording_remote_config",_a="$replay_sample_rate",ma="$replay_override_sampling",ya="$replay_override_linked_flag",ba="$replay_override_url_trigger",wa="$replay_override_event_trigger",mt="$sesid",yr="$session_is_sampled",at="$enabled_feature_flags",mi="$active_feature_flags",Bt="$early_access_features",Bs="$feature_flag_details",yi="$feature_flag_payloads",Us="$feature_flag_request_id",Oi="$minimal_flag_called_events",qe="$override_feature_flags",gt="$override_feature_flag_payloads",st="$stored_person_properties",rt="$stored_group_properties",Vs="$surveys",Ai="$surveys_loaded_at",Ws="$surveys_activated",bi="$surveys_activated_session",Ut="ph_product_tours",Kt="$flag_call_reported",Ks="$flag_call_reported_session_id",Js="$feature_flag_errors",ei="$feature_flag_evaluated_at",Me="$user_state",Ys="$client_session_props",Zs="$capture_rate_limit",Xs="$initial_campaign_params",Qs="$initial_referrer_info",Li="$initial_person_info",Di="$epp",ui="$posthog_cookieless",xa="$cookieless_mode",Ea="$sdk_debug_extensions_init_method",ka="$sdk_debug_extensions_init_time_ms",Sa="$sdk_debug_recording_script_not_loaded",br="PostHog loadExternalDependency extension not found.",nt="on_reject",ze="always",ht="anonymous",ct="identified",er="identified_only",Ni="visibilitychange",ji="beforeunload",ft="$pageview",as="$pageleave",os="$identify",Jr="$groupidentify";function hi(i,e){C(i)&&i.forEach(e)}function z(i,e){if(!O(i))if(C(i))i.forEach(e);else if(Po(i))i.forEach(((s,r)=>e(s,r)));else for(var t in i)Hn.call(i,t)&&e(i[t],t)}var W=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function wi(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Yr=function(i){try{return i()}catch{return}},fl=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){x.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),x.critical(r)}}},wr=function(i){var e={};return z(i,(function(t,s){(G(t)&&t.length>0||ue(t))&&(e[s]=t)})),e},_l=["herokuapp.com","vercel.app","netlify.app"];function ml(i){var e=i?.hostname;if(!G(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of _l)if(t===s)return!1;return!0}function te(i,e,t,s){var r=s??{},n=r.capture,a=r.passive;i?.addEventListener(e,t,{capture:n!==void 0&&n,passive:a===void 0||a})}function Pa(i){return i.name==="ph_toolbar_internal"}var Ta=i=>{if(P){try{for(var e=i+"=",t=P.cookie.split(";").filter((n=>n.length)),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return ue(i)&&isFinite(i)&&Math.floor(i)===i});class qi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new qi(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new qi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}}class yl{generate(){var e=this.generateOrAbort();if(!w(e))return e;this.S=0;var t=this.generateOrAbort();if(w(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return qi.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new bl}}var Zr,Fa=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};g&&!w(g.crypto)&&crypto.getRandomValues&&(Fa=i=>crypto.getRandomValues(i));class bl{nextUint32(){return this.R.length>this.O||(Fa(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Ge=()=>wl().toString(),wl=()=>(Zr||(Zr=new yl)).generate(),Rt="",xl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Be={N:()=>!!P,D(i){x.error("cookieStore error: "+i)},A:Ta,F(i){var e;try{e=JSON.parse(Be.A(i))||{}}catch{}return e},q(i,e,t,s,r){if(!P)return!1;try{var n="",a="",o=(function(h,c){if(c){var p=(function(d,f){if(f===void 0&&(f=P),Rt)return Rt;if(!f||["localhost","127.0.0.1"].includes(d))return"";for(var m=d.split("."),_=Math.min(m.length,8),k="dmn_chk_"+Ge();!Rt&&_--;){var E=m.slice(_).join("."),S=k+"=1;domain=."+E+";path=/";f.cookie=S+";max-age=3",f.cookie.includes(k)&&(f.cookie=S+";max-age=0",Rt=E)}return Rt})(h);if(!p){var v=(d=>{var f=d.match(xl);return f?f[0]:""})(h);v!==p&&x.info("Warning: cookie subdomain discovery mismatch",v,p),p=v}return p?"; domain=."+p:""}return""})(P.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&x.warn("cookieStore warning: large cookie, len="+u.length),P.cookie=u,!0}catch{return!1}},P(i,e){if(P!=null&&P.cookie)try{Be.q(i,"",-1,e)}catch{return}}},ls=null,U={N(){if(!ge(ls))return ls;var i=!0;if(w(g))i=!1;else try{var e="__mplssupport__";U.q(e,"xyz"),U.A(e)!=='"xyz"'&&(i=!1),U.P(e)}catch{i=!1}return i||x.error("localStorage unsupported; falling back to cookie store"),ls=i,i},D(i){x.error("localStorage error: "+i)},A(i){try{return g?.localStorage.getItem(i)}catch(e){U.D(e)}return null},F(i){try{return JSON.parse(U.A(i))||{}}catch{}return null},q(i,e){try{return g?.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){U.D(t)}return!1},P(i){try{g?.localStorage.removeItem(i)}catch(e){U.D(e)}}},El=[Ci,"distinct_id",mt,yr,Di,Li,Me],ci={},kl={N:()=>!0,D(i){x.error("memoryStorage error: "+i)},A:i=>ci[i]||null,F:i=>ci[i]||null,q:(i,e)=>(ci[i]=e,!0),P(i){delete ci[i]}},Xe=null,le={N(){if(!ge(Xe))return Xe;if(Xe=!0,w(g))Xe=!1;else try{var i="__support__";le.q(i,"xyz"),le.A(i)!=='"xyz"'&&(Xe=!1),le.P(i)}catch{Xe=!1}return Xe},D(i){x.error("sessionStorage error: ",i)},A(i){try{return g?.sessionStorage.getItem(i)}catch(e){le.D(e)}return null},F(i){try{return JSON.parse(le.A(i))||null}catch{}return null},q(i,e){try{return g?.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){le.D(t)}return!1},P(i){try{g?.sessionStorage.removeItem(i)}catch(e){le.D(e)}}};class Sl{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===ze||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===nt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Jt.q(this.Kt,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var e=this._instance.config,t=e.token,s=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(s?s+t:"__ph_opt_in_out_"+t)}get Qt(){var e=this.Jt.A(this.Kt);return Qi(e)?1:R(Io,e)?0:-1}get Jt(){var e=this.Te.opt_out_capturing_persistence_type,t=e==="localStorage"?U:Be;if(!this.Yt||this.Yt!==t){this.Yt=t;var s=e==="localStorage"?Be:U;s.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Qi(s.A(this.Kt))),s.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[ve?.doNotTrack,ve?.msDoNotTrack,$.doNotTrack].some((e=>Qi(e)))}}function $a(i,e){var t,s=i==null||(t=i.config)==null?void 0:t.get_current_url;if(!Re(s))return e;try{var r=s(e);return G(r)&&r?r:e}catch(n){return x.error("Error in get_current_url, falling back to window.location.href",n),e}}var Ia="__POSTHOG_TOOLBAR__",Pl=1,Tl=3,Fl=11;function Xr(i){return i instanceof Element&&(i.id===Ia||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Ze(i){return!!i&&i.nodeType===Pl}function xe(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Ma(i){return!!i&&i.nodeType===Tl}function Ra(i){return!!i&&i.nodeType===Fl&&Ze(i.host)}var Ca=1e3;function xr(i){return i?Ki(i).split(/\s+/):[]}function Qr(i,e){var t=(function(s){var r,n=g==null||(r=g.location)==null?void 0:r.href;return w(n)?void 0:$a(s,n)})(e);return!!(t&&i&&i.some((s=>t.match(s))))}function Hi(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return xr(e)}function Oa(i){return O(i)?null:Ki(i).split(/(\s+)/).filter((e=>Jt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ti(i){var e="";return ir(i)&&!Na(i)&&i.childNodes&&i.childNodes.length&&z(i.childNodes,(function(t){var s;Ma(t)&&t.textContent&&(e+=(s=Oa(t.textContent))!==null&&s!==void 0?s:"")})),Ki(e)}function us(i){var e;return w(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null}var Er=["a","button","form","input","select","textarea","label"];function tr(i,e){if(w(e))return!0;var t,s=function(n){if(e.some((a=>(function(o,l){var u=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!u&&u.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function Aa(i){var e=i.parentNode;return!(!e||!Ze(e))&&e}var $l=[".ph-no-autocapture","[data-ph-no-autocapture]"],La=["next","previous","prev",">","<"],Il=[...La,"+","-","−","–"],en=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,tn=[".ph-no-rageclick",".ph-no-capture"],Ml=["","text","search","email","password","url","tel","number"];function sn(i,e){if(!g||kr(i))return!1;var t,s,r,n,a;if(Ce(e)?(t=!!e&&tn,s=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:tn,s=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!Ze(l))&&(!!xe(l,"textarea")||(xe(l,"input")?R(Ml,(l.getAttribute("type")||"").toLowerCase()):(function(u){if(u.isContentEditable)return!0;var h=u.getAttribute==null?void 0:u.getAttribute("contenteditable");return h==="true"||h===""})(l)))})(i))return!1;var o=Da(i,!1).targetElementList;return!(function(l,u){if(l===!1||w(l))return!1;var h;if(l===!0)h=La;else{if(!C(l))return!1;if(l.length>10)return x.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;h=l.map((c=>c.toLowerCase()))}return u.some((c=>{var p=c.safeText,v=c.ariaLabel;return h.some((d=>en(p,d)||en(v,d)))}))})(s,o.map((l=>{var u;return{safeText:ti(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))==null?void 0:u.toLowerCase().trim())||""}})))&&!tr(o,t)}var kr=i=>!i||xe(i,"html")||!Ze(i),Da=(i,e)=>{if(!g||kr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!xe(r,"body");)if(Ra(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Aa(r);if(!n)break;if(e||Er.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var a=g.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch{}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function ir(i){for(var e=new Set,t=0,s=i;s.parentNode&&!xe(s,"body");s=s.parentNode){if(t++>=Ca||e.has(s))return!1;e.add(s);var r=Hi(s);if(R(r,"ph-sensitive")||R(r,"ph-no-capture"))return!1}if(R(Hi(i),"ph-include"))return!0;var n=i.type||"";if(G(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=i.name||i.id||"";return!G(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function Na(i){return!!(xe(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||xe(i,"select")||xe(i,"textarea")||i.getAttribute("contenteditable")==="true")}var ja="(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})",Rl=new RegExp("^(?:"+ja+")$"),Cl=new RegExp(ja),qa="\\d{3}-?\\d{2}-?\\d{4}",Ol=new RegExp("^("+qa+")$"),Al=new RegExp("("+qa+")");function Jt(i,e){return e===void 0&&(e=!0),!(O(i)||G(i)&&(i=Ki(i),(e?Rl:Cl).test((i||"").replace(/[- ]/g,""))||(e?Ol:Al).test(i)))}function rn(i){var e=ti(i);return Jt(e=(e+" "+Ha(i)).trim())?e:""}function Ha(i){var e="";return i&&i.childNodes&&i.childNodes.length&&z(i.childNodes,(function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=ti(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ha(t)).trim())}catch(n){x.error("[AutoCapture]",n)}})),e}function nn(i){return i.replace(/"|\\"/g,'\\"')}function Ll(i){var e=i.attr__class;if(e)return C(e)?e:xr(e)}var di=Y("[Dead Clicks]"),Dl=()=>!0,Nl=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(_r)),s=i.instance.config.capture_dead_clicks;return Ce(s)?s:!!K(s)||t};class an{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[_r]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?di.error("failed to load script",r):e()}))}tr(){var e;if(P){if(!this.Xt&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=K(this.instance.config.capture_dead_clicks)?y({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Xt=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Xt.start(P),di.info("starting...")}}else di.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,di.info("stopping..."))}}var hs=Y("[SegmentIntegration]"),Ga="posthog-js";function za(i,e){var t=e===void 0?{}:e,s=t.organization,r=t.projectId,n=t.prefix,a=t.severityAllowList,o=a===void 0?["error"]:a,l=t.sendExceptionsToPostHog,u=l===void 0||l;return h=>{var c,p,v,d,f;if(o!=="*"&&!o.includes(h.level)||!i.__loaded)return h;h.tags||(h.tags={});var m=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());h.tags["PostHog Person URL"]=m,i.sessionRecordingStarted()&&(h.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var _,k=((c=h.exception)==null?void 0:c.values)||[],E=k.map((F=>y({},F,{stacktrace:F.stacktrace?y({},F.stacktrace,{type:"raw",frames:(F.stacktrace.frames||[]).map((N=>y({},N,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((p=k[0])==null?void 0:p.value)||h.message,$exception_type:(v=k[0])==null?void 0:v.type,$exception_level:h.level,$exception_list:E,$sentry_event_id:h.event_id,$sentry_exception:h.exception,$sentry_exception_message:((d=k[0])==null?void 0:d.value)||h.message,$sentry_exception_type:(f=k[0])==null?void 0:f.type,$sentry_tags:h.tags};return s&&r&&(S.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+h.event_id),u&&((_=i.exceptions)==null||_.sendExceptionEvent(S)),h}}class jl{constructor(e,t,s,r,n,a){this.name=Ga,this.setupOnce=function(o){o(za(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class on{constructor(e){this.rr=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(x.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.rr)}destroy(){var e;(e=this.sr)==null||e.call(this),this.sr=void 0}doPageView(e,t){var s,r=this.ar(e,t);return this.ir={pathname:(s=g?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.ar(e,(t=this.ir)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ir)==null?void 0:e.pageViewId}}ar(e,t){var s=this.ir;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var a=n.maxScrollHeight,o=n.lastScrollY,l=n.maxScrollY,u=n.maxContentHeight,h=n.lastContentY,c=n.maxContentY;if(!(w(a)||w(o)||w(l)||w(u)||w(h)||w(c))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h),c=Math.ceil(c);var p=a>1?Ae(o/a,0,1,x):1,v=a>1?Ae(l/a,0,1,x):1,d=u>1?Ae(h/u,0,1,x):1,f=u>1?Ae(c/u,0,1,x):1;r=W(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:f})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var cs=["flags","surveys"],ql={[fa]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ds]:{exposure:"event"},[Ns]:{exposure:"hidden"},[js]:{exposure:"event"},[qs]:{exposure:"hidden"},[Hs]:{exposure:"event"},[Gs]:{exposure:"event"},[_r]:{exposure:"event"},[mr]:{exposure:"hidden"},[zs]:{exposure:"event"},[ot]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yr]:{exposure:"event"},[_a]:{exposure:"event",shouldSkipFromEventProperties:i=>ge(i)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[at]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!K(i))return{};for(var e={},t=Object.keys(i),s=0;t.length>s;s++)e["$feature/"+t[s]]=i[t[s]];return e}},[mi]:{exposure:"event",storageGroup:"flags"},[Bt]:{exposure:"hidden"},[Bs]:{exposure:"hidden",storageGroup:"flags"},[yi]:{exposure:"event",storageGroup:"flags"},[Us]:{exposure:"event",storageGroup:"flags",volatile:!0},[Oi]:{exposure:"hidden",storageGroup:"flags"},[qe]:{exposure:"event"},[gt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[Vs]:{exposure:"hidden",storageGroup:"surveys"},[Ai]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ws]:{exposure:"event"},[bi]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Kt]:{exposure:"hidden"},[Ks]:{exposure:"hidden"},[Js]:{exposure:"hidden"},[ei]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Me]:{exposure:"hidden"},[Ys]:{exposure:"hidden"},[Zs]:{exposure:"hidden"},[Xs]:{exposure:"hidden"},[Qs]:{exposure:"hidden"},[Li]:{exposure:"hidden"},[Di]:{exposure:"hidden"},[ma]:{exposure:"event"},[ya]:{exposure:"event"},[ba]:{exposure:"event"},[wa]:{exposure:"event"},[Ea]:{exposure:"event"},[ka]:{exposure:"event"},[Sa]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Hl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Qe=i=>{var e=ql[i];if(e)return e;for(var t of Hl){var s=t[1];if(i.indexOf(t[0])===0)return s}},yt=(i,e)=>{try{return JSON.stringify(i,((t,s)=>typeof s=="bigint"?s.toString():s),e)}catch{return jn(i)}},Gi=i=>{var e=P?.createElement("a");return w(e)?null:(e.href=i,e)},St=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!C(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{x.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},ii=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],h=0;l.length>h;h++){var c=l[h].split("=");C(c)&&(e.includes(c[0])?u.push(c[0]+"="+t):u.push(l[h]))}var p=o;return a!=null&&(p+="?"+u.join("&")),r!=null&&(p+="#"+r),p},zi=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Ba=(i,e)=>i>=e&&Ln(),Ua=(i,e,t,s)=>{if(i===0){if(Ln()){var r=e+1;return r===t&&s(),r}return e}return 0},pi="https?://(.*)",Pt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Gl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Pt],si="<masked>",zl=["li_fat_id"];function Va(i,e,t){if(!P)return{};var s,r=e?[...Pt,...t||[]]:[],n=Wa(ii(P.URL,r,si),i),a=(s={},z(zl,(function(o){var l=Ta(o);s[o]=l||null})),s);return W(a,n)}function Wa(i,e){var t=Gl.concat(e||[]),s={};return z(t,(function(r){var n=St(i,r);s[r]=n||null})),s}function Ka(i){var e=(function(n){return n?n.search(pi+"google.([^/?]*)")===0?"google":n.search(pi+"bing.com")===0?"bing":n.search(pi+"yahoo.com")===0?"yahoo":n.search(pi+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!ge(e)){s.$search_engine=e;var r=P?St(P.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function ln(){return navigator.language||navigator.userLanguage}var Bi="$direct";function Ja(){return P?.referrer||Bi}function Ya(i,e,t){t===void 0&&(t=!1);var s=i?[...Pt,...e||[]]:[],r=t?Ye(se?.href):se?.href,n=r?.substring(0,1e3);return{r:Ja().substring(0,1e3),u:n?ii(n,s,si):void 0}}function Za(i,e){var t;e===void 0&&(e=!1);var s=i.r,r=i.u,n=e?Ye(r):r,a={$referrer:s,$referring_domain:s==null?void 0:s==Bi?Bi:(t=Gi(s))==null?void 0:t.host};if(n){a.$current_url=n;var o=Gi(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=Wa(n);W(a,l)}if(s){var u=Ka(s);W(a,u)}return a}function Xa(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Bl(){try{return new Date().getTimezoneOffset()}catch{return}}var Ul={flags:ei,surveys:Ai},Vl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],dt="main";class ds{constructor(e,t,s){if(s===void 0&&(s=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=s,this.props={},this.cr=!1,this.vr=(n=>{var a="";return n.token&&(a=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+a+"_posthog"})(e),this.Jt=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&x.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save(),g){var r=()=>this.flush();te(g,"beforeunload",r,{capture:!1}),te(g,"pagehide",r,{capture:!1})}}mr(){var e,t=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return ue(t)&&t>0?t:0}isDisabled(){return!!this.yr}pr(e){Vl.indexOf(e.persistence.toLowerCase())===-1&&(x.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...El,...a];return y({},U,{F(u){try{var h={};try{h=Be.F(u)||{}}catch{}var c,p=JSON.parse(U.A(u)||"{}");if(o){var v={};for(var d in h){var f=h[d];ge(f)||f===""||(v[d]=f)}c=W(p,v)}else c=W(h,p);return U.q(u,c),c}catch{}return null},q(u,h,c,p,v,d){var f=U.q(u,h,void 0,void 0,d);try{var m={};l.forEach((_=>{h[_]&&(m[_]=h[_])})),Object.keys(m).length&&Be.q(u,m,c,p,v,d)}catch(_){U.D(_)}return f},P(u,h){try{g?.localStorage.removeItem(u),Be.P(u,h)}catch(c){U.D(c)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&U.N()?(t=U,r=!0):n==="localstorage+cookie"&&s.N()?(t=s,r=!0):n==="sessionstorage"&&le.N()?t=le:n==="memory"?t=kl:n==="cookie"?t=Be:s.N()?(t=s,r=!0):t=Be,this.ur=r,t}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var t=e??this.Te.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[ei];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return z(this.props,((t,s)=>{var r=Qe(s);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,s===at?()=>this._r():()=>!1))return;r.transformToEventProperties&&W(e,r.transformToEventProperties(t))}else if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,(()=>!1)))return;e[s]=t}})),e}load(){if(!this.yr){var e=this.Jt.F(this.vr);e&&(this.props=W({},e)),this.hr&&this.wr()}}wr(){for(var e of cs){var t=U.F(this.br(e));if(t&&!Je(t)){var s=this.kr(e);s.persisted=!0,this.Sr(e)||(s.fingerprint=this.Cr(t,e)),this.Tr(e,t)||W(this.props,t)}}}Sr(e){return Object.keys(this.props).some((t=>{var s;return((s=Qe(t))==null?void 0:s.storageGroup)===e}))}Tr(e,t){var s=Ul[e];if(!s)return!1;var r=t[s],n=this.props[s];return ue(r)&&ue(n)&&n>r}refreshKey(e){var t;if(!this.yr){var s=this.hr?(t=Qe(e))==null?void 0:t.storageGroup:void 0,r=s?U.F(this.br(s)):this.Jt.F(this.vr);if(r&&e in r)this.Ir(e,r[e]);else{if(s){var n=this.Jt.F(this.vr);if(n&&e in n)return void this.Ir(e,n[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?w(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),e)):this.Rr()}}flush(){w(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,dt))}Pr(){var e=this.Fr(),t=e.main,s=e.groups;for(var r of(this.Or(this.Jt,this.vr,t,dt),cs)){var n,a=s[r];(!Je(a)||(n=this.lr[r])!=null&&n.persisted)&&this.Or(U,this.br(r),a,r)}}Fr(){var e={},t={flags:{},surveys:{}};return z(this.props,((s,r)=>{var n,a=(n=Qe(r))==null?void 0:n.storageGroup;a?t[a][r]=s:e[r]=s})),{main:e,groups:t}}Cr(e,t){if(t===dt)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var s={};return z(e,((r,n)=>{var a;s[n]=(a=Qe(n))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(s)}Or(e,t,s,r){var n=this.kr(r);if(r===dt||n.dirty||w(n.fingerprint)){var a;try{if((a=this.Cr(s,r))===n.fingerprint)return void(n.dirty=!1)}catch{a=void 0}e.q(t,s,this.Lr,this.$r,this.Ar,this.Te.debug)?(n.dirty=!1,r!==dt&&(n.persisted=!0),w(a)||(n.fingerprint=a)):this.Te.debug&&x.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,s=t!==void 0&&t;if(w(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!s&&this.dr)for(var r of cs)U.P(this.br(r));s?delete this.lr[dt]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,t,s){if(K(e)){w(t)&&(t="None"),this.Lr=w(s)?this.Nr:s;var r=!1;if(z(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.Ir(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(K(e)){this.Lr=w(t)?this.Nr:t;var s=!1;if(z(e,((r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.Ir(n,r),s=!0)})),s)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Mr(e),this.save())}update_campaign_params(){if(!this.cr){var e=Va(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Je(wr(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=P?.referrer)?Ka(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ja(),$referring_domain:P!=null&&P.referrer&&((e=Gi(P.referrer))==null?void 0:e.host)||Bi},void 0)}set_initial_person_info(){this.props[Xs]||this.props[Qs]||this.register_once({[Li]:Ya(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};z([Qs,Xs],(r=>{var n=this.props[r];n&&z(n,(function(a,o){e["$initial_"+Is(o)]=a}))}));var t=this.props[Li];if(t){var s=(function(r,n){n===void 0&&(n=!1);var a=Za(r,n),o={};return z(a,(function(l,u){o["$initial_"+Is(u)]=l})),o})(t,this.Te.disable_capture_url_hashes);W(e,s)}return e}safe_merge(e){return z(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==t.persistence||!((l,u)=>{if(l.length!==u.length)return!1;var h=[...l].sort(),c=[...u].sort();return h.every(((p,v)=>p===c[v]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=r?this.pr(e):this.Jt,a=this.gr(e);if(r||a!==this.hr){var o=this.props;this.clear(),this.Jt=n,this.hr=a,this.props=o,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ar&&(this.Ar=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var s=this.props[zt]||{};s[e]=t,this.Ir(zt,s),this.save()}remove_event_timer(e){var t=this.props[zt]||{},s=t[e];return w(s)||(delete t[e],this.Ir(zt,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.Ir(e,t),this.save()}Ir(e,t){var s;this.props[e]=t,(s=Qe(e))!=null&&s.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var t,s=(t=Qe(e))==null?void 0:t.storageGroup;s&&(this.kr(s).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}}var pe={GZipJS:"gzip-js",Base64:"base64"},Ct={Activation:"events",Cancellation:"cancelEvents"},ps={Popover:"popover",API:"api",Widget:"widget"},Ue={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},vs={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},sr={Popover:"popover",Inline:"inline"},Wl={SHOWN:"product tour shown"},un={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},hn=Y("[RateLimiter]");class Kl{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{hn.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void hn.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(Zs))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var u=1>l.tokens;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(r=this.instance.persistence)==null||r.set_property(Zs,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Ot=Y("[RemoteConfig]");class Qa{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}qr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return Ot.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void Ot.warn("Remote config is disabled. Falling back to local config.");this.qr((e=>{if(!e)return Ot.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((t=>{this.Hr(t),this.Br()}));this.Hr(e),this.Br()}))}catch(e){Ot.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&P&&P.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.zr=setInterval((()=>{this.refresh()}),t))}}Hr(e){var t;e||Ot.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}}var Fe=Uint8Array,ye=Uint16Array,Tt=Uint32Array,Sr=new Fe([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]),Pr=new Fe([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]),cn=new Fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eo=function(i,e){for(var t=new ye(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new Tt(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},to=eo(Sr,2),rr=to[1];to[0][28]=258,rr[258]=28;for(var dn=eo(Pr,0)[1],io=new ye(32768),J=0;32768>J;++J){var pt=(43690&J)>>>1|(21845&J)<<1;io[J]=((65280&(pt=(61680&(pt=(52428&pt)>>>2|(13107&pt)<<2))>>>4|(3855&pt)<<4))>>>8|(255&pt)<<8)>>>1}var Yt=function(i,e,t){for(var s=i.length,r=0,n=new ye(e);s>r;++r)++n[i[r]-1];var a,o=new ye(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new ye(s),r=0;s>r;++r)a[r]=io[o[i[r]-1]++]>>>15-i[r];return a},ut=new Fe(288);for(J=0;144>J;++J)ut[J]=8;for(J=144;256>J;++J)ut[J]=9;for(J=256;280>J;++J)ut[J]=7;for(J=280;288>J;++J)ut[J]=8;var Ui=new Fe(32);for(J=0;32>J;++J)Ui[J]=5;var Jl=Yt(ut,9),Yl=Yt(Ui,5),so=function(i){return(i/8>>0)+(7&i&&1)},ro=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof ye?ye:i instanceof Tt?Tt:Fe)(t-e);return s.set(i.subarray(e,t)),s},Le=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},At=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},gs=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new Fe(0),0];if(r==1){var a=new Fe(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(F,N){return F.f-N.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,h=1,c=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=t[t[c].f>t[u].f?u++:c++],l=t[u!=h&&t[c].f>t[u].f?u++:c++],t[h++]={s:-1,f:o.f+l.f,l:o,r:l};var p=n[0].s;for(s=1;r>s;++s)n[s].s>p&&(p=n[s].s);var v=new ye(p+1),d=nr(t[h-1],v,0);if(d>e){s=0;var f=0,m=d-e,_=1<<m;for(n.sort((function(F,N){return v[N.s]-v[F.s]||F.f-N.f}));r>s;++s){var k=n[s].s;if(e>=v[k])break;f+=_-(1<<d-v[k]),v[k]=e}for(f>>>=m;f>0;){var E=n[s].s;e>v[E]?f-=1<<e-v[E]++-1:++s}for(;s>=0&&f;--s){var S=n[s].s;v[S]==e&&(--v[S],++f)}d=e}return[new Fe(v),d]},nr=function(i,e,t){return i.s==-1?Math.max(nr(i.l,e,t+1),nr(i.r,e,t+1)):e[i.s]=t},pn=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new ye(++e),s=0,r=i[0],n=1,a=function(l){t[s++]=l},o=1;e>=o;++o)if(i[o]==r&&o!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=i[o]}return[t.subarray(0,s),e]},Lt=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},ar=function(i,e,t){var s=t.length,r=so(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},vn=function(i,e,t,s,r,n,a,o,l,u,h){Le(e,h++,t),++r[256];for(var c=gs(r,15),p=c[0],v=c[1],d=gs(n,15),f=d[0],m=d[1],_=pn(p),k=_[0],E=_[1],S=pn(f),F=S[0],N=S[1],L=new ye(19),b=0;k.length>b;++b)L[31&k[b]]++;for(b=0;F.length>b;++b)L[31&F[b]]++;for(var T=gs(L,7),I=T[0],A=T[1],M=19;M>4&&!I[cn[M-1]];--M);var D,Z,B,j,V=u+5<<3,X=Lt(r,ut)+Lt(n,Ui)+a,be=Lt(r,p)+Lt(n,f)+a+14+3*M+Lt(L,I)+(2*L[16]+3*L[17]+7*L[18]);if(X>=V&&be>=V)return ar(e,h,i.subarray(l,l+u));if(Le(e,h,1+(X>be)),h+=2,X>be){D=Yt(p,v),Z=p,B=Yt(f,m),j=f;var ke=Yt(I,A);for(Le(e,h,E-257),Le(e,h+5,N-1),Le(e,h+10,M-4),h+=14,b=0;M>b;++b)Le(e,h+3*b,I[cn[b]]);h+=3*M;for(var fe=[k,F],we=0;2>we;++we){var Q=fe[we];for(b=0;Q.length>b;++b)Le(e,h,ke[ne=31&Q[b]]),h+=I[ne],ne>15&&(Le(e,h,Q[b]>>>5&127),h+=Q[b]>>>12)}}else D=Jl,Z=ut,B=Yl,j=Ui;for(b=0;o>b;++b)if(s[b]>255){var ne;At(e,h,D[257+(ne=s[b]>>>18&31)]),h+=Z[ne+257],ne>7&&(Le(e,h,s[b]>>>23&31),h+=Sr[ne]);var ae=31&s[b];At(e,h,B[ae]),h+=j[ae],ae>3&&(At(e,h,s[b]>>>5&8191),h+=Pr[ae])}else At(e,h,D[s[b]]),h+=Z[s[b]];return At(e,h,D[256]),h+Z[256]},Zl=new Tt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xl=(function(){for(var i=new Tt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),fs=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function Ql(i,e){e===void 0&&(e={});var t=(function(){var c=4294967295;return{p(p){for(var v=c,d=0;p.length>d;++d)v=Xl[255&v^p[d]]^v>>>8;c=v},d(){return 4294967295^c}}})(),s=i.length;t.p(i);var r,n,a,o,l,u=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(c,p,v,d,f,m){var _=c.length,k=new Fe(d+_+5*(1+Math.floor(_/7e3))+f),E=k.subarray(d,k.length-f),S=0;if(!p||8>_)for(var F=0;_>=F;F+=65535){var N=F+65535;_>N?S=ar(E,S,c.subarray(F,N)):(E[F]=!0,S=ar(E,S,c.subarray(F,_)))}else{for(var L=Zl[p-1],b=L>>>13,T=8191&L,I=(1<<v)-1,A=new ye(32768),M=new ye(I+1),D=Math.ceil(v/3),Z=2*D,B=function(Xi){return(c[Xi]^c[Xi+1]<<D^c[Xi+2]<<Z)&I},j=new Tt(25e3),V=new ye(288),X=new ye(32),be=0,ke=0,fe=(F=0,0),we=0,Q=0;_>F;++F){var ne=B(F),ae=32767&F,oe=M[ne];if(A[ae]=oe,M[ne]=ae,F>=we){var We=_-F;if((be>7e3||fe>24576)&&We>423){S=vn(c,E,0,j,V,X,ke,fe,Q,F-Q,S),fe=be=ke=0,Q=F;for(var de=0;286>de;++de)V[de]=0;for(de=0;30>de;++de)X[de]=0}var $e=2,Ke=0,_e=T,Ie=ae-oe&32767;if(We>2&&ne==B(F-Ie))for(var ri=Math.min(b,We)-1,Ft=Math.min(32767,F),ni=Math.min(258,We);Ft>=Ie&&--_e&&ae!=oe;){if(c[F+$e]==c[F+$e-Ie]){for(var Se=0;ni>Se&&c[F+Se]==c[F+Se-Ie];++Se);if(Se>$e){if($e=Se,Ke=Ie,Se>ri)break;var ai=Math.min(Ie,Se-2),$t=0;for(de=0;ai>de;++de){var Zi=F-Ie+de+32768&32767,$r=Zi-A[Zi]+32768&32767;$r>$t&&($t=$r,oe=Zi)}}}Ie+=(ae=oe)-(oe=A[ae])+32768&32767}if(Ke){j[fe++]=268435456|rr[$e]<<18|dn[Ke];var Ir=31&rr[$e],Mr=31&dn[Ke];ke+=Sr[Ir]+Pr[Mr],++V[257+Ir],++X[Mr],we=F+$e,++be}else j[fe++]=c[F],++V[c[F]]}}S=vn(c,E,!0,j,V,X,ke,fe,Q,F-Q,S)}return ro(k,0,d+so(S)+f)})(n=i,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),h=u.length;return(function(c,p){var v=p.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>p.level?4:p.level==9?2:0,c[9]=3,p.mtime!=0&&fs(c,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),v){c[3]=8;for(var d=0;v.length>=d;++d)c[d+10]=v.charCodeAt(d)}})(u,e),fs(u,h-8,t.d()),fs(u,h-4,s),u}var eu=!!Ts||!!cr,no="text/plain",xi=!1,ao=(i,e)=>{var t=i.split("#"),s=t[1],r=t[0].split("?"),n=r[0],a=r[1];if(!a)return i;var o=a.split("&").filter((l=>l.split("=")[0]!==e)).join("&");return n+(o?"?"+o:"")+(s?"#"+s:"")},Tr=function(i,e,t){var s;t===void 0&&(t=!0);var r=i.split("?"),n=r[0],a=r[1],o=y({},e),l=(s=a?.split("&").map((h=>{var c,p=h.split("="),v=p[0],d=t&&(c=o[v])!==null&&c!==void 0?c:p[1];return delete o[v],v+"="+d})))!==null&&s!==void 0?s:[],u=(function(h,c){var p,v;c===void 0&&(c="&");var d=[];return z(h,(function(f,m){w(f)||w(m)||m==="undefined"||(p=encodeURIComponent((_=>_ instanceof File)(f)?f.name:f.toString()),v=encodeURIComponent(m),d[d.length]=v+"="+p)})),d.join(c)})(o);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},_s=i=>{if(i.Vr)return i.Vr;var e=i.data,t=i.compression;if(e){if(t===pe.GZipJS){var s=Ql((function(o,l){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var h=new Fe(o.length+(o.length>>>1)),c=0,p=function(m){h[c++]=m},v=0;u>v;++v){if(c+5>h.length){var d=new Fe(c+8+(u-v<<1));d.set(h),h=d}var f=o.charCodeAt(v);128>f?p(f):2048>f?(p(192|f>>>6),p(128|63&f)):f>55295&&57344>f?(p(240|(f=65536+(1047552&f)|1023&o.charCodeAt(++v))>>>18),p(128|f>>>12&63),p(128|f>>>6&63),p(128|63&f)):(p(224|f>>>12),p(128|f>>>6&63),p(128|63&f))}return ro(h,0,c)})(yt(e)),{mtime:0});return{contentType:no,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===pe.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(yt(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:yt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=yt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},oo=i=>{var e,t,s=()=>i.transport==="sendBeacon"?{url:Tr(i.url,{compression:pe.Base64}),encodedBody:_s(y({},i,{compression:pe.Base64,Vr:void 0}))}:{url:ao(i.url,"compression"),encodedBody:_s(y({},i,{compression:void 0,Vr:void 0}))};try{e=_s(i)}catch(r){if(Nr(i.compression,St(i.url,"compression")))return x.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return e&&Nr(i.compression,St(i.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?Fs(new Uint8Array(t)):ArrayBuffer.isView(t)&&Fs(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(xi=!0,s()):{url:i.url,encodedBody:e}},lo=i=>{try{return oo(i)}catch(e){return x.error(e),void(i.callback==null||i.callback({statusCode:0,error:e}))}},tu=(function(){var i=ie((function*(e){var t=yt(e.data),s=yield(function(n,a,o){return $s.apply(this,arguments)})(t,q.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return y({},e,{Vr:{contentType:no,body:r,estimatedSize:r.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),iu=/Failed to fetch|NetworkError|Load failed/i,uo=i=>{var e=lo(i);if(e){var t=e.url,s=e.encodedBody,r=s??{},n=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;z(i.headers,(function(d,f){l.append(f,d)})),n&&l.append("Content-Type",n);var u=null,h=!1;if(Rr){var c=new Rr;u={signal:c.signal,timeout:setTimeout((()=>{var d,f;h=!0,c.abort((d=i.timeout,(f=new Error("PostHog request timed out"+(d?" after "+d+"ms":""))).name="AbortError",f))}),i.timeout)}}var p=d=>{h&&d?.name==="AbortError"||(f=>f?.name==="TypeError"&&iu.test(f?.message||""))(d)?x.warn(d):x.error(d),i.callback==null||i.callback({statusCode:0,error:d})};try{var v;cr(t,y({method:i?.method||"GET",headers:l,keepalive:i.method==="POST"&&!i.Wr&&52428.8>(o||0),body:a,signal:(v=u)==null?void 0:v.signal},i.fetchOptions)).then((d=>d.text().then((f=>{var m={statusCode:d.status,text:f};if(d.status===200)try{m.json=JSON.parse(f)}catch(_){x.error(_)}i.callback==null||i.callback(m)})))).catch(p).finally((()=>u?clearTimeout(u.timeout):null))}catch(d){u&&clearTimeout(u.timeout),p(d)}}},or=i=>{try{var e,t=oo(i),s=t.url,r=t.encodedBody,n=r??{},a=n.body,o=n.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:n.contentType});if(ve.sendBeacon(s,l))return;var u=C(i.data)?i.data:(e=i.data)==null?void 0:e.batch;if(C(u)&&u.length>1&&(o??0)>16384){var h=Math.ceil(u.length/2),c=p=>C(i.data)?p:y({},i.data,{batch:p});return or(y({},i,{data:c(u.slice(0,h))})),void or(y({},i,{data:c(u.slice(h))}))}x.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),uo(y({},i,{Wr:!0}))}catch(p){x.warn("Beacon send failed",p)}},gn=(i,e,t,s)=>{var r=s==="query"?e==="POST"?"sent_at":"_":void 0;return Tr(t===pe.GZipJS?ao(i,"compression"):i,y({},r?{[r]:Date.now().toString()}:{},t===pe.GZipJS?{}:{compression:t}))},Ei=[];cr&&Ei.push({transport:"fetch",method:uo}),Ts&&Ei.push({transport:"XHR",method(i){var e=lo(i);if(e){var t=new Ts,s=e.encodedBody;t.open(i.method||"GET",e.url,!0);var r=s??{},n=r.contentType,a=r.body;z(i.headers,(function(o,l){t.setRequestHeader(l,o)})),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(o)}},t.send(a)}}}),ve!=null&&ve.sendBeacon&&Ei.push({transport:"sendBeacon",method:or});var lr=3e3;class su{constructor(e,t){this.Zr=!0,this.Gr=[],this.Qr=Ae(t?.flush_interval_ms||lr,250,5e3,x.createLogger("flush interval"),lr),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=this.Gr.length>0?this.ei():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.ti(y({},s,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var t=this.ei(),s=function(){var n=t[r],a=new Date().getTime();n.data&&C(n.data)&&z(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.ti(n)};for(var r in t)s()}}),this.Qr))}ti(e){try{this.Jr(e)}catch(t){x.error(t)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var e={};return z(this.Gr,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;w(e[n])&&(e[n]=y({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)})),this.Gr=[],e}}var ru=["retriesPerformedSoFar"];class nu{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!w(g)&&"onLine"in g.navigator&&(this.ni=g.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},te(g,"online",this.si),te(g,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=Dn(e,ru);je(t)&&(s.url=Tr(s.url,{retry_count:t})),this._instance._send_request(y({},s,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(t??0))return void this.kt(y({retriesPerformedSoFar:t},s));r.statusCode===0&&x.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(t??0)+" retries.")}s.callback==null||s.callback(r)}}))}kt(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),h=Math.random()-.5;return Math.ceil(u+h*(u-l))})(t),r=Date.now()+s;this.Gr.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),x.warn(n),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var e=Date.now(),t=[],s=this.Gr.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Gr=t,s.length>0)for(var r of s)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,w(g)||(this.si&&(g.removeEventListener("online",this.si),this.si=void 0),this.ai&&(g.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var t=e.requestOptions;try{this._instance._send_request(y({},t,{transport:"sendBeacon"}))}catch(s){x.error(s)}}this.Gr=[]}}class au{constructor(e){this.hi=()=>{var t,s,r,n;this.di||(this.di={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),h=a?.scrollHeight||0;this.di.lastScrollY=Math.ceil(o),this.di.maxScrollY=Math.max(o,(t=this.di.maxScrollY)!==null&&t!==void 0?t:0),this.di.maxScrollHeight=Math.max(l,(s=this.di.maxScrollHeight)!==null&&s!==void 0?s:0),this.di.lastContentY=u,this.di.maxContentY=Math.max(u,(r=this.di.maxContentY)!==null&&r!==void 0?r:0),this.di.maxContentHeight=Math.max(h,(n=this.di.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){te(g,"scroll",this.hi,{capture:!0}),te(g,"scrollend",this.hi,{capture:!0}),te(g,"resize",this.hi)}scrollElement(){if(!this.ci)return g?.document.documentElement;var e=C(this.ci)?this.ci:[this.ci];for(var t of e){var s=g?.document.querySelector(t);if(s)return s}}vi(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.ci){var s=this.scrollElement();return s&&s[t]||0}return g?e==="y"?g.scrollY||g.pageYOffset||g.document.documentElement.scrollTop||0:g.scrollX||g.pageXOffset||g.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var ou=i=>Ya(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties,i?.config.disable_capture_url_hashes);class fn{constructor(e,t,s,r){this.fi=n=>{var a=this.pi();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.gi(this._instance)};this.mi.register({[Ys]:o})}},this._instance=e,this.yi=t,this.mi=s,this.gi=r||ou,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[Ys]}getSetOnceProps(){var e,t=(e=this.pi())==null?void 0:e.props;return t?"r"in t?Za(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return z(wr(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+Is(s)]=t})),e}}class Fr{on(e,t){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(t),()=>{this.bi[e]=this.bi[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.bi[e]||[])s(t);for(var r of this.bi["*"]||[])r(e,t)}constructor(){this.bi={}}}var Dt=Y("[SessionId]");class _n{on(e,t){return this.wi.on(e,t)}constructor(e,t,s){var r;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new Fr,this.Ti=(u,h)=>!(!je(u)||!je(h))&&Math.abs(u-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ze)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=t||Ge,this.Ri=s||Ge;var n=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*Ae(this.Te.session_idle_timeout_seconds||1800,60,36e3,Dt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+n+"_window_id",this.Fi="ph_"+n+"_primary_window_exists",this.Li()){var a=le.F(this.Oi),o=le.F(this.Fi);a&&!o?this.Ii=a:le.P(this.Oi),le.q(this.Fi,!0)}if((r=this.Te.bootstrap)!=null&&r.sessionID)try{var l=(u=>{var h=this.Te.bootstrap.sessionID.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,new Date().getTime(),l)}catch(u){Dt.error("Invalid sessionID in bootstrap",u)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return w(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((t=>t!==e))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&le.N()}Ni(e){e!==this.Ii&&(this.Ii=e,this.Li()&&le.q(this.Oi,e))}Di(){return this.Ii?this.Ii:this.Li()?le.F(this.Oi):null}qi(e){var t=this.xi;return!ge(t)&&!ge(e)&&5e3>Math.abs(e-t)}$i(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Mi||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Mi=e,n&&!r||n&&this.qi(t)||(this.xi=t,this.mi.register({[mt]:[t,e,s]}))}ji(){var e,t=(e=this.Te)==null?void 0:e.persistence_save_debounce_ms;return je(t)&&t>0}Hi(){this.ji()?this.mi.refreshKey(mt):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!ge(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var t=this.Ui();t[1]===this.Mi&&t[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[mt]:[this._sessionActivityTimestamp,(e=this.Mi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],t=je(e)?e:0,s=je(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Vi(e){return this.Hi(),this.Ti(e,this.zi())}Ui(){var e=this.mi.props[mt];return C(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&g&&(g.removeEventListener(ji,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&le.P(this.Fi)},te(g,ji,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Te.cookieless_mode===ze)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),r=this.Ui(),n=r[1],a=r[2],o=this.zi(),l=this.Di(),u=je(a)&&Math.abs(s-a)>864e5,h=!1,c=!1,p=!n,v=n,d=!p&&!e&&this.Ti(s,o);if(d){(d=this.Vi(s))||Dt.info("cross-tab refresh kept the session alive",{sessionId:n});var f=this.Ui();n=f[1],a=f[2]}p||d||u?(n=this.Ei(),l=this.Ri(),Dt.info("new session ID generated",{sessionId:n,windowId:l,changeReason:{noSessionId:p,activityTimeout:d,sessionPastMaximumLength:u}}),a=s,h=!0):(l||(l=this.Ri(),h=!0),(c=n!==v)&&(Dt.info("adopted cross-tab session id",{sessionId:n,windowId:l}),h=!0));var m=je(o)&&e&&!u?o:s,_=je(a)?a:new Date().getTime();this.Ni(l),this.$i(n,m,_),e||this.Pi();var k={noSessionId:p,activityTimeout:d,sessionPastMaximumLength:u,crossTabAdoption:c};return h&&this.ki.forEach((E=>E(n,l,k))),{sessionId:n,windowId:l,sessionStartTimestamp:_,changeReason:h?k:void 0,lastActivityTimestamp:o}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var e=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var ho=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&qr(t,e))return!0;try{var s=i?.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>qr(r?.brand,e))))return!0}catch{}return!!i.webdriver};function co(){return(co=ie((function*(){var i=ve?.userAgentData;if(i!=null&&i.getHighEntropyValues)try{var e=yield i.getHighEntropyValues(["model"]),t=e?.model;return G(t)&&t.length>0?t:void 0}catch(s){return void x.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}var Vi=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function mn(i,e,t){return yt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var po={exact:(i,e)=>e.some((t=>i.some((s=>t===s)))),is_not:(i,e)=>e.every((t=>i.every((s=>t!==s)))),regex:(i,e)=>e.some((t=>i.some((s=>Vi(t,s))))),not_regex:(i,e)=>e.every((t=>i.every((s=>!Vi(t,s))))),icontains:(i,e)=>e.map(vi).some((t=>i.map(vi).some((s=>t.includes(s))))),not_icontains:(i,e)=>e.map(vi).every((t=>i.map(vi).every((s=>!t.includes(s))))),gt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s>parseFloat(r)))})),lt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s<parseFloat(r)))}))},vi=i=>i.toLowerCase();function vo(i,e){return!i||Object.entries(i).every((t=>{var s=t[1],r=e?.[t[0]];if(w(r)||ge(r))return!1;var n=[String(r)],a=po[s.operator];return!!a&&a(s.values,n)}))}var ur="custom",yn="i.posthog.com",lu=/^\/static\//;class uu{constructor(e){this.Zi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+yn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Zi[this.apiHost]||(this.Zi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":ur),this.Zi[this.apiHost]}Gi(e){if(lu.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var s=this.Gi(t);if(s)return""+s+t}if(this.region===ur)return this.apiHost+t;var r=yn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}function go(i){var e;return!((e=i.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var H=Y("[Surveys]"),fo="seenSurvey_",_o=i=>{try{var e=(t=>((s,r)=>""+fo+(function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id})(r))(0,t))(i);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){H.error("Failed to persist survey seen state",t)}},hu=[ps.Popover,ps.Widget,ps.API],cu={ignoreConditions:!1,ignoreDelay:!1,displayType:sr.Popover},du=Y("[PostHog ExternalIntegrations]"),pu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class vu{constructor(e){this._instance=e}er(e,t){var s;(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return du.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var n,a,o,l=s[0],u=s[1];!u||(n=$.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.er(pu[l],(()=>{var h;(h=$.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[l])==null||h.start(e._instance)})),!u&&(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=$.__PosthogExtensions__)==null||(o=o.integrations)==null||(o=o[l])==null||o.stop())};for(var s of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;t()}}}var Zt={},ms=0,Wi=()=>{},bn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Nt="Surveys module not available",wn="sanitize_properties is deprecated. Use before_send instead",mo="Invalid value for property_denylist config: ",gu=["token","distinct_id",xa],_t="posthog",yo=!eu&&me?.indexOf("MSIE")===-1&&me?.indexOf("Mozilla")===-1,ys=i=>{var e;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ml(P?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Wi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:se&&G(se?.search)&&se.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,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(g==null||(e=g.location)==null?void 0:e.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(t){x.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:er,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:lr},error_tracking:{},_onCapture:Wi},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Il,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t)}))(i))},fu=[["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"]],xn=i=>{var e={};for(var t of fu){var s=t[0],r=t[1];w(i[s])||(e[r]=i[s])}var n=W({},e,i),a=i.__preview_external_dependency_versioned_paths;return w(a)||(w(i.strict_script_versioning)&&(n.strict_script_versioning=!!a),G(a)&&w(i.asset_host)&&(n.asset_host=a)),C(i.property_blacklist)&&(w(i.property_denylist)?n.property_denylist=i.property_blacklist:C(i.property_denylist)?n.property_denylist=[...i.property_blacklist,...i.property_denylist]:x.error(mo+i.property_denylist)),n};class _u{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){x.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Te{Ji(e,t){if(e){var s=this.Ki.indexOf(e);s!==-1&&this.Ki.splice(s,1)}return this.Ki.push(t),t.initialize==null||t.initialize(),t}Yi(){return this.config.cookieless_mode===ze||this.config.cookieless_mode===nt&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new _u,this.Xi=!1,this.version=q.LIB_VERSION,this.en=new Fr,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ys(),this.SentryIntegration=jl,this.sentryIntegration=s=>(function(r,n){var a=za(r,n);return{name:Ga,processEvent:o=>a(o)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new au(this),this.pageViewManager=new on(this),this.rateLimiter=new Kl(this),this.requestRouter=new uu(this),this.consent=new Sl(this),this.externalIntegrations=new vu(this);var t=(e=Te.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(s,r,n)=>{var a=G(s)?{[s]:r}:s;this.setPersonProperties(a),n?.({})},set_once:(s,r,n)=>{var a=G(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(s=>x.info('send "'+s?.event+'"',s)))}init(e,t,s){if(s&&s!==_t){var r,n=(r=Zt[s])!==null&&r!==void 0?r:new Te;return n._init(e,t,s),Zt[s]=n,Zt[_t][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n;t===void 0&&(t={});var a=G(e)?e.trim():"";if(!a)return x.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=ys(t.defaults),t.debug=this.an(t.debug),this.ln=t,this.un=[],t.person_profiles?this.nn=t.person_profiles:t.process_person&&(this.nn=t.process_person);var o=ys(t.defaults),l=xn(t),u=W({},o,l,{name:s,token:a});K(o.rageclick)&&K(l.rageclick)&&(u.rageclick=W({},o.rageclick,l.rageclick)),K(o.session_recording)&&K(l.session_recording)&&(u.session_recording=W({},o.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&x.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:pe.GZipJS;var h=this.hn();this.persistence=new ds(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ds(y({},this.config,{persistence:"sessionStorage"}),h,!1);var c=y({},this.persistence.props),p=y({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new su((S=>this.cn(S)),this.config.request_queue_config),this.vn=new nu(this),this.__request_queue=[];var v=this.Yi();if(v||(this.sessionManager=new _n(this),this.sessionPropsManager=new fn(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(x.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(v)}),0)):(x.info("Initializing extensions synchronously"),this.fn(v)),q.DEBUG=q.DEBUG||this.config.debug,q.DEBUG&&x.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:c,s:p}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=y({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var d=t.bootstrap.distinctID,f=this.get_distinct_id(),m=this.persistence.get_property(Me);if(t.bootstrap.isIdentifiedID&&f!=null&&f!==d&&m===ht)this.identify(d);else if(t.bootstrap.isIdentifiedID&&f!=null&&f!==d&&m===ct)x.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var _=this.config.get_device_id(Ge()),k=t.bootstrap.isIdentifiedID?_:d;this.persistence.set_property(Me,t.bootstrap.isIdentifiedID?ct:ht),this.register({distinct_id:d,$device_id:k})}}if(v)this.register_once({distinct_id:ui,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(Ge());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Me,ht)}return te(g,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(S,F){var N=S.config.segment;if(!N)return F();(function(L,b){var T=L.config.segment;if(!T)return b();var I=M=>{var D=()=>M.anonymousId()||Ge();L.config.get_device_id=D,M.id()&&(L.register({distinct_id:M.id(),$device_id:D()}),L.persistence.set_property(Me,ct)),b()},A=T.user();"then"in A&&Re(A.then)?A.then(I):I(A)})(S,(()=>{N.register((L=>{typeof Promise<"u"&&Promise.resolve||hs.warn("This browser does not have Promise support, and can not use the segment integration");var b=(T,I)=>{if(!I)return T;T.event.userId||T.event.anonymousId===L.get_distinct_id()||(hs.info("No userId set, resetting PostHog"),L.reset()),T.event.userId&&T.event.userId!==L.get_distinct_id()&&(hs.info("UserId set, identifying with PostHog"),L.identify(T.event.userId));var A=L.calculateEventProperties(I,T.event.properties);return T.event.properties=Object.assign({},A,T.event.properties),T};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:T=>b(T,T.event.event),page:T=>b(T,ft),identify:T=>b(T,os),screen:T=>b(T,"$screen")}})(S)).then((()=>{F()}))}))})(this,(()=>this.pn())):this.pn(),Re(this.config._onCapture)&&this.config._onCapture!==Wi&&(x.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(S=>this.config._onCapture(S.event,S)))),this.config.ip&&x.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 co.apply(this,arguments)})().then((S=>{S&&this.register({[ns]:S})})).catch(Wi),this}fn(e){var t,s,r,n,a,o,l,u,h=performance.now(),c=y({},Te.__defaultExtensionClasses,this.config.__extensionClasses),p=[];c.featureFlags&&this.Ki.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new c.featureFlags(this)),c.exceptions&&this.Ki.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new c.exceptions(this)),c.historyAutocapture&&this.Ki.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ki.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this.Ki.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ki.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||p.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this.Ki.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ki.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new c.surveys(this)),c.logs&&this.Ki.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new c.logs(this)),c.metrics&&this.Ki.push(this.metrics=(a=this.metrics)!==null&&a!==void 0?a:new c.metrics(this)),c.conversations&&this.Ki.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.Ki.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ki.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ki.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Nl)),c.toolbar&&this.Ki.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new c.toolbar(this)),c.experiments&&this.Ki.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new c.experiments(this)),this.Ki.forEach((v=>{v.initialize&&p.push((()=>{v.initialize==null||v.initialize()}))})),p.push((()=>{if(this.gn){var v=this.gn;this.gn=void 0,this.Hr(v)}})),this.mn(p,h)}mn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.mn(e,t)}),0);var s=e.shift();if(s)try{s()}catch(n){x.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[Ea]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ka]:r}),this.config.__preview_deferred_init_extensions&&x.info("PostHog extensions initialized ("+r+"ms)")}Hr(e){if(!P||!P.body)return x.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=e),this.yn=e,this.compression=void 0,e.ok){var t,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=R(s.supportedCompression,pe.GZipJS)?pe.GZipJS:R(s.supportedCompression,pe.Base64)?pe.Base64:void 0),(t=s.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:er}),this.Ki.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e)))}pn(){try{this.config.loaded(this)}catch(s){x.critical("`loaded` function failed",s)}if(this.bn(),this.config.internal_or_test_user_hostname&&se!=null&&se.hostname){var e=se.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()}),1),this.wn=new Qa(this),this.wn.load()}bn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.dn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&hi(this.__request_queue,(e=>this.cn(e))),this.__request_queue=[],this.bn()}_handle_unload(){var e,t,s,r,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(as),(s=this.logs)==null||s.flushLogs("sendBeacon"),(r=this.dn)==null||r.unload(),(n=this.vn)==null||n.unload()):this.xn()&&this.capture(as,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?yo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=y({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(w(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var s,r,n,a=y({},t);a.timeout=a.timeout||6e4;var o,l,u,h,c,p=(s=a.transport)!==null&&s!==void 0?s:"fetch";p==="sendBeacon"&&w(a.compression)&&a.data&&(a.compression=pe.Base64),a.method==="POST"&&a.data&&(a.timestampMode==="capture-body"?a.data={api_key:(l=(c=(h=C(o=a.data)?o:[o])[0])==null||(u=c.properties)==null?void 0:u.token)!==null&&l!==void 0?l:c?.token,batch:h,sent_at:new Date().toISOString()}:a.timestampMode==="body"&&(a.data=(function(f,m){return m===void 0&&(m=new Date().toISOString()),C(f)?f.map((_=>y({},_,{sent_at:m}))):y({},f,{sent_at:m})})(a.data))),a.url=gn(a.url,a.method,a.compression,a.timestampMode);var v=Ei.filter((f=>!a.disableTransport||!f.transport||!a.disableTransport.includes(f.transport))),d=(r=(n=(function(f,m){for(var _=0;f.length>_;_++)if(f[_].transport===p)return f[_]})(v))==null?void 0:n.method)!==null&&r!==void 0?r:v[0].method;if(!d)throw new Error("No available transport method");p!=="sendBeacon"&&a.data&&a.compression===pe.GZipJS&&bo&&typeof Promise<"u"&&!xi?tu(a).then((f=>{d(f)})).catch((f=>{if(jr(f))return xi=!0,void d(y({},a,{compression:void 0,url:gn(t.url,t.method,void 0,t.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;var _="name"in m?String(m.name):"";return jr(m)||_===Nn})(f)&&(xi=!0),d(a)})):d(a)})(y({},e,{callback:t=>{var s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,t),e.callback==null||e.callback(t)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}cn(e){this.vn?this.vn.retriableRequest(e):this._send_request(e)}_execute_array(e){ms++;try{var t,s=[],r=[],n=[];hi(e,(o=>{if(o)if(C(t=o[0]))n.push(o);else if(Re(o))try{o.call(this)}catch(l){x.error("Error executing queued PostHog call",o,l)}else C(o)&&t==="alias"?s.push(o):C(o)&&t.indexOf("capture")!==-1&&Re(this[t])?n.push(o):r.push(o)}));var a=function(o,l){hi(o,(function(u){try{if(C(u[0])){var h=l;z(u,(function(c){h=h[c[0]].apply(h,c.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}catch(c){x.error("Error executing queued PostHog call",u,c)}}))};a(s,this),a(r,this),a(n,this)}finally{ms--}}push(e){if(ms>0&&C(e)&&G(e[0])){var t=Te.prototype[e[0]];Re(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!w(e)&&G(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h==null||!h.isRateLimited){t!=null&&t.$current_url&&!G(t?.$current_url)&&(x.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.kn||x.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,p=s?.timestamp||c,v=Br(s?.uuid,Ge),d={uuid:v,event:e,properties:this.calculateEventProperties(e,t||{},p,v)};e===ft&&this.config.__preview_capture_bot_pageviews&&u&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),h&&(d.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var f=e==="$feature_flag_called"&&d.properties.$feature_flag_has_experiment===!1&&this.get_property(Oi)===!0;s?.$set&&!f&&(d.$set=s?.$set);var m=s?.$unset;m&&(d.$unset=m);var _,k,E,S=f?void 0:this.Sn(s?.$set_once,e!==Jr,e===os);if(S&&(d.$set_once=S),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,a=d,o=M=>G(M)?M.slice(0,n):M,l=new Set,d=(function M(D,Z){if(D!==Object(D))return o?o(D):D;if(!l.has(D)){var B;if(l.add(D),C(D))B=[],hi(D,(V=>{B.push(M(V))}));else{var j={};z(D,((V,X)=>{l.has(V)||(j[X]=M(V))})),B=j}return B}})(a)),d.timestamp=p,w(s?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=c),f&&(d.properties=(function(M,D){D===void 0&&(D=[]);var Z={},B=j=>{M[j]!==void 0&&(Z[j]=M[j])};return wo.forEach(B),D.forEach(B),Z})(d.properties,gu)),e===Ue.DISMISSED||e===Ue.SENT){var F=t?.[vs.SURVEY_ID],N=t?.[vs.SURVEY_ITERATION];_o({id:F,current_iteration:N}),d.$set=y({},d.$set,{[(_={id:F,current_iteration:N},k=e===Ue.SENT?"responded":"dismissed",E="$survey_"+k+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(E="$survey_"+k+"/"+_.id+"/"+_.current_iteration),E)]:!0})}else e===Ue.SHOWN&&(d.$set=y({},d.$set,{[vs.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Wl.SHOWN){var L=t?.[un.TOUR_TYPE];L&&(d.$set=y({},d.$set,{[un.TOUR_LAST_SEEN_DATE+"/"+L]:new Date().toISOString()}))}var b=y({},d.properties.$set,d.$set);if(Je(b)||this.setPersonPropertiesForFlags(b),!O(this.config.before_send)){var T=this.wt(d);if(!T)return;(d=T).uuid=Br(d.uuid,Ge)}this.en.emit("eventCaptured",d);var I=(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A={method:"POST",url:I,data:d,compression:"best-available",timestampMode:s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(I)?"body":"capture-body",batchKey:s?._batchKey,transport:s?.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.cn(A):this.dn.enqueue(A),d}x.critical("This capture call is ignored due to client rate limiting.")}}else x.error("No event name provided to posthog.capture")}else x.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=y({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Yi()&&(o[xa]=!0),e==="$snapshot"){var l=y({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!G(o.distinct_id)&&!ue(o.distinct_id)||Ms(o.distinct_id))&&x.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,h=(function(E,S,F,N){var L,b,T,I;if(N===void 0&&(N=!1),!me)return{};var A,M=E?[...Pt,...S||[]]:[],D=(function(ri){for(var Ft=0;Gr.length>Ft;Ft++){var ni=Gr[Ft],Se=ni[1],ai=ni[0].exec(ri),$t=ai&&(Re(Se)?Se(ai,ri):Se);if($t)return $t}return["",""]})(me),Z=D[0],B=D[1],j=(A=typeof navigator<"u"?navigator:void 0)!=null&&A.brave?{brave:!0}:{},V={};w(F)||(V.detectGoogleSearchApp=F);var X={},be=(L=navigator)==null||(L=L.userAgentData)==null?void 0:L.platform,ke=(b=navigator)==null?void 0:b.maxTouchPoints,fe=g==null||(T=g.screen)==null?void 0:T.width,we=g==null||(I=g.screen)==null?void 0:I.height,Q=g?.devicePixelRatio;w(be)||(X.userAgentDataPlatform=be),w(ke)||(X.maxTouchPoints=ke),w(fe)||(X.screenWidth=fe),w(we)||(X.screenHeight=we),w(Q)||(X.devicePixelRatio=Q);var ne,ae,oe,We,de,$e,Ke,_e,Ie=W(wr({$os:Z,$os_version:B,$browser:la(me,navigator.vendor,j,V),$device:zr(me),$device_type:(ae=me,oe=X,_e=zr(ae),_e===Bn||_e===zn||_e==="Kobo"||_e==="Kindle Fire"||_e===sa?xt:_e===Xt||_e===wt||_e===Qt||_e===Cs?"Console":_e===Vn?"Wearable":_e?Ee:oe?.userAgentDataPlatform==="Android"&&((We=oe?.maxTouchPoints)!==null&&We!==void 0?We:0)>0?600>Math.min((de=oe?.screenWidth)!==null&&de!==void 0?de:0,($e=oe?.screenHeight)!==null&&$e!==void 0?$e:0)/((Ke=oe?.devicePixelRatio)!==null&&Ke!==void 0?Ke:1)?Ee:xt:"Desktop"),$timezone:Xa(),$timezone_offset:Bl()}),{$current_url:ii(N?Ye(se?.href):se?.href,M,si),$host:se?.host,$pathname:se?.pathname,$raw_user_agent:me.length>1e3?me.substring(0,997)+"...":me,$browser_version:qo(me,navigator.vendor,j,V),$browser_language:ln(),$browser_language_prefix:(ne=ln(),typeof ne=="string"?ne.split("-")[0]:void 0),$screen_height:g?.screen.height,$screen_width:g?.screen.width,$viewport_height:g?.innerHeight,$viewport_width:g?.innerWidth,$lib:q.LIB_NAME,$lib_version:q.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return q.SDK_DIST_CHANNEL&&(Ie.$sdk_dist_channel=q.SDK_DIST_CHANNEL),Ie})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime()),p=c.windowId;o.$session_id=c.sessionId,o.$window_id=p}this.sessionPropsManager&&W(o,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&W(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(v=this.vn)==null?void 0:v.length}catch(E){o.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===ur&&(o.$lib_custom_api_host=this.config.api_host),u=e!==ft||n?e!==as||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=W(o,u),e===ft&&P&&(o.title=P.title),!w(a)){var d=s.getTime()-a;o.$duration=parseFloat((d/1e3).toFixed(3))}me&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var f=this.persistence.properties(),m=this.sessionPersistence.properties();z(["$referrer","$referring_domain"],(E=>{E in f&&delete m[E]})),(o=W({},h,f,m,o)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?z(this.config.property_denylist,(function(E){delete o[E]})):x.error(mo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(x.error(wn),o=_(o,e));var k=this.Cn();return o.$process_person_profile=k,k&&!n&&this.Tn("_calculate_event_properties"),o}Sn(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.Cn()||this.Xi&&!s)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=W({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(x.error(wn),o=l(o,"$set_once")),t&&(this.Xi=!0),Je(o)?void 0:o}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}In(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,t){var s,r;return(s=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t))!==null&&s!==void 0?s:t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.en.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Nt}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Nt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Nt})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;t===void 0&&(t=cu),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:Nt}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Nt})}Mn(e){return!e||Ms(e)?(x.critical("Unique user id has not been set in posthog.identify"),!1):e===ui?(x.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(x.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,s){if(!this.__loaded||!this.persistence)return x.uninitializedWarning("posthog.identify");if(ue(e)&&(e=e.toString(),x.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(e)&&this.Tn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Ci)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(Gt)&&(this.unregister(Gt),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(Me)||ht)===ht;e!==r&&a?(this.persistence.set_property(Me,ct),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(os,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.sn=mn(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r)):(t||s)&&this.setPersonProperties(t,s),e!==r&&(this.reloadFeatureFlags(),this.unregister(Kt))}}setPersonProperties(e,t){if((e||t)&&this.Tn("posthog.setPersonProperties")){var s=mn(this.get_distinct_id(),e,t);this.sn!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.sn=s):x.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,s=(C(e)?e:[e]).filter((r=>G(r)&&r.length>0));s.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.sn=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},r,{[e]:t})}),n||s){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(Jr,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else x.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.Tn("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,s,r,n,a,o,l,u,h,c;if(x.info("reset"),!this.__loaded)return x.uninitializedWarning("posthog.reset");var p,v=this.get_property(Ci),d=this.get_property(ns),f=this.get_property(ot);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(s=this.sessionPersistence)==null||s.clear(),w(f)||(p=this.persistence)==null||p.register({[ot]:f}),(r=this.surveys)==null||r.reset(),(n=this.wn)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.logs)==null||l.reset(),(u=this.metrics)==null||u.reset(),(h=this.persistence)==null||h.set_property(Me,ht),(c=this.sessionManager)==null||c.resetSessionId(),this.sn=null,this.config.cookieless_mode===ze)this.register_once({distinct_id:ui,$device_id:null},"");else{var m=this.config.get_device_id(Ge());this.register_once({distinct_id:m,$device_id:e?m:v},""),e||w(d)||this.register({[ns]:d})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return ie((function*(){var s,r,n,a,o;t.__loaded?((s=t.logs)==null||s.flushLogs("sendBeacon"),(r=t.metrics)==null||r.flush("sendBeacon"),(n=t.dn)==null||n.unload(),(a=t.vn)==null||a.unload(),(o=t.featureFlags)==null||o.destroy()):x.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var s;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.En()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(e!=null&&e.withTimestamp&&s){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(fa)?(x.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(w(t)&&(t=this.get_distinct_id()),e!==t?(this.In(Gt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(x.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(K(e)){var s,r,n,a,o,l,u,h,c,p,v;W(this.config,xn(e));var d=this.hn();(s=this.persistence)==null||s.update_config(this.config,t,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ds(y({},this.config,{persistence:"sessionStorage"}),d,!1);var f=this.an(this.config.debug);Ce(f)&&(this.config.debug=f),Ce(this.config.debug)&&(this.config.debug?(q.DEBUG=!0,U.N()&&U.q("ph_debug",!0),x.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(q.DEBUG=!1,U.N()&&U.P("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(h=this.exceptionObserver)==null||h.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(p=this.surveys)==null||p.loadIfEnabled(),this.Pn(),(v=this.externalIntegrations)==null||v.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){q.LIB_NAME=e,q.LIB_VERSION=t}startSessionRecording(e){var t,s,r,n,a,o=e===!0,l={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(y({},r,t))}}addExceptionStep(e,t){var s;(s=this.exceptions)==null||s.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:Te.On}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:_t;return t!==_t&&(t=_t+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Me))===ct||((t=this.sessionPersistence)==null?void 0:t.get_property(Me))===ct}Cn(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===er&&!this._isIdentified()&&Je(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Gt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Di]))}xn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(e){return this.config.person_profiles==="never"?(x.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(Di,!0),!0)}hn(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==nt)}Pn(){var e,t,s,r,n=this.hn();return((e=this.persistence)==null?void 0:e.yr)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.yr)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==ze){if(this.Yi()){var s,r,n,a,o;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new _n(this),this.pageViewManager=new on(this),this.persistence&&(this.sessionPropsManager=new fn(this,this.sessionManager,this.persistence));var l,u=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=Te.__defaultExtensionClasses)==null?void 0:o.sessionRecording;u&&(this.sessionRecording=this.Ji(this.sessionRecording,new u(this)),this.yn&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.yn)))}var h,c;this.consent.optInOut(!0),this.Pn(),this.bn(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==nt&&((h=this.surveys)==null||h.loadIfEnabled()),(w(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e?.captureEventName)!==null&&c!==void 0?c:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else x.warn(bn)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==ze?(this.config.cookieless_mode===nt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===nt&&(this.register({distinct_id:ui,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):x.warn(bn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ze||(this.config.cookieless_mode===nt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return ve?ho(ve,this.config.custom_blocked_useragents):void 0}_n(){P&&(P.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(ft,{title:P.title},{send_instantly:!0}),this.rn&&(P.removeEventListener(Ni,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),te(P,Ni,this.rn)))}debug(e){e===!1?(g?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(g?.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}))}Ur(){var e=this.ln||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(x.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(t,s,r,n,a){var o=s in t&&!O(t[s]),l=r in t&&!O(t[r]);return o?t[s]:!!l&&(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+s+"' instead. The old field will be removed in a future major version."),t[r])})(e,"advanced_disable_flags","advanced_disable_decide",0,x)}wt(e){var t;if(O(this.config.before_send))return e;var s=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(Fo),r=C(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of r){if(n=a(n),O(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return To(e.event)?x.warn(o+". This can cause unexpected behavior."):x.info(o),null}n.properties&&!Je(n.properties)||x.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var l of s)if(n.properties&&O(n.properties[l]))return x.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return(e=this.pageViewManager.ir)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}an(e){var t=Ce(e)&&!e,s=U.N()&&U.A("ph_debug")==="true";return!t&&(!!s||e)}}Te.__defaultExtensionClasses={},Te.On=(()=>{var i=()=>{};return{trace:i,debug:i,info:i,warn:i,error:i,fatal:i}})(),(function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=fl(i.prototype[e[t]])})(Te,["identify"]);class En{constructor(e){this.disabled=e===!1;var t=K(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;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>s-r.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}}var bs="$copy_autocapture",ws=Y("[AutoCapture]");function xs(i,e){return e.length>i?e.slice(0,i)+"...":e}function mu(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Ze(e));return e}function yu(i,e){var t,s,r=e.e,n=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Ze(i))return{props:{}};for(var h=[i],c=new Set([i]),p=i;p.parentNode&&!xe(p,"body")&&Ca>h.length;)if(Ra(p.parentNode)){var v=p.parentNode.host;if(c.has(v))break;c.add(v),h.push(v),p=v}else{if(!Ze(p.parentNode)||c.has(p.parentNode))break;c.add(p.parentNode),h.push(p.parentNode),p=p.parentNode}var d,f,m=[],_={},k=!1,E=!1;if(z(h,(b=>{var T=ir(b);if(xe(b,"a")){var I=b.getAttribute("href");k=!!(T&&I&&Jt(I))&&(u?Ye(I):I)}R(Hi(b),"ph-no-capture")&&(E=!0),m.push((function(M,D,Z,B,j){j===void 0&&(j=!1);var V=M.tagName.toLowerCase(),X={tag_name:V};Er.indexOf(V)>-1&&!Z&&(X.$el_text=V.toLowerCase()==="a"||V.toLowerCase()==="button"?xs(1024,rn(M)):xs(1024,ti(M)));var be=Hi(M);be.length>0&&(X.classes=be.filter((function(Q){return Q!==""}))),z(M.attributes,(function(Q){var ne;if((!Na(M)||["name","id","class","aria-label"].indexOf(Q.name)!==-1)&&(B==null||!B.includes(Q.name))&&!D&&Jt(Q.value)&&(!G(ne=Q.name)||ne.substring(0,10)!=="_ngcontent"&&ne.substring(0,7)!=="_nghost")){var ae=Q.value;Q.name==="class"&&(ae=xr(ae).join(" ")),X["attr__"+Q.name]=xs(1024,Q.name==="href"&&j?Ye(ae):ae)}}));for(var ke=1,fe=1,we=M;we=mu(we);)ke++,we.tagName===M.tagName&&fe++;return X.nth_child=ke,X.nth_of_type=fe,X})(b,n,a,o,u));var A=(function(M){if(!ir(M))return{};var D={};return z(M.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var B=Z.name.replace("data-ph-capture-attribute-",""),j=Z.value;B&&j&&Jt(j)&&(D[B]=j)}})),D})(b);W(_,A)})),E)return{props:{},explicitNoCapture:E};if(a||(m[0].$el_text=xe(i,"a")||xe(i,"button")?rn(i):ti(i)),k){var S,F;m[0].attr__href=k;var N=(S=Gi(k))==null?void 0:S.host,L=g==null||(F=g.location)==null?void 0:F.host;N&&L&&N!==L&&(d=k)}return{props:W({$event_type:r.type,$ce_version:1},l?{}:{$elements:m},{$elements_chain:(f=m,(function(b){return b.map((T=>{var I,A,M="";if(T.tag_name&&(M+=T.tag_name),T.attr_class)for(var D of(T.attr_class.sort(),T.attr_class))M+="."+D.replace(/"/g,"");var Z=y({},T.text?{text:T.text}:{},{"nth-child":(I=T.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(A=T.nth_of_type)!==null&&A!==void 0?A:0},T.href?{href:T.href}:{},T.attr_id?{attr_id:T.attr_id}:{},T.attributes),B={};return wi(Z).sort(((j,V)=>j[0].localeCompare(V[0]))).forEach((j=>{var V=j[1];return B[nn(j[0].toString())]=nn(V.toString())})),(M+=":")+wi(B).map((j=>j[0]+'="'+j[1]+'"')).join("")})).join(";")})((function(b){return b.map((T=>{var I,A,M={text:(I=T.$el_text)==null?void 0:I.slice(0,400),tag_name:T.tag_name,href:(A=T.attr__href)==null?void 0:A.slice(0,2048),attr_class:Ll(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return wi(T).filter((D=>D[0].indexOf("attr__")===0)).forEach((D=>M.attributes[D[0]]=D[1])),M}))})(f)))},(t=m[0])!=null&&t.$el_text?{$el_text:(s=m[0])==null?void 0:s.$el_text}:{},d&&r.type==="click"?{$external_click_url:d}:{},_)}}var jt=Y("[ExceptionAutocapture]"),kn=()=>{},bu=Y("[TracingHeaders]"),et=Y("[Web Vitals]"),Sn=9e5,Pn="disabled",Tn="lazy_loading",qt="awaiting_config",gi="missing_config";Y("[SessionRecording]"),Y("[SessionRecording]");var hr="[SessionRecording]",De=Y(hr),wu=Y("[Heatmaps]");function Es(i){return K(i)&&"clientX"in i&&"clientY"in i&&ue(i.clientX)&&ue(i.clientY)}var ks=Y("[Product Tours]"),Ss=i=>{var e;return!i.config.disable_product_tours&&!((e=i.persistence)==null||!e.get_property(mr))},xu=["$set_once","$set"],Oe=Y("[SiteApps]"),Fn="Error while initializing PostHog app with config id ";function vt(i,e,t){if(O(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class Eu{constructor(e){this.Fn=new Fr,this.Ln=(t,s)=>this.$n(t,s)&&this.An(t,s)&&this.Nn(t,s)&&this.Dn(t,s),this.$n=(t,s)=>s==null||!s.event||t?.event===s?.event,this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,t;w((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((s,r)=>{this.on(s,r)}))}register(e){var t,s;if(!w((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.jn)==null||o.add(a),(l=a.steps)==null||l.forEach((u=>{var h;(h=this.qn)==null||h.add(u?.event||"")}))})),(s=this._instance)!=null&&s.autocapture)){var r,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(n)}}on(e,t){var s;t!=null&&e.length!=0&&(this.qn.has(e)||this.qn.has(t.event))&&this.jn&&((s=this.jn)==null?void 0:s.size)>0&&this.jn.forEach((r=>{this.Hn(t,r)&&this.Fn.emit("actionCaptured",r.name)}))}Bn(e){this.onAction("actionCaptured",(t=>e(t)))}Hn(e,t){if(t?.steps==null)return!1;for(var s of t.steps)if(this.Ln(e,s))return!0;return!1}onAction(e,t){return this.Fn.on(e,t)}An(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!vt(r,t.url,t.url_matching||"contains"))return!1}return!0}Nn(e,t){return!!this.Un(e,t)&&!!this.zn(e,t)&&!!this.Vn(e,t)}Un(e,t){var s;if(t==null||!t.href)return!0;var r=this.Wn(e);if(r.length>0)return r.some((o=>vt(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&vt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}zn(e,t){var s;if(t==null||!t.text)return!0;var r=this.Wn(e);if(r.length>0)return r.some((u=>vt(u.text,t.text,t.text_matching||"exact")||vt(u.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=(function(u){for(var h,c=[],p=/(?::|")text="(.*?)"/g;!O(h=p.exec(u));)c.includes(h[1])||c.push(h[1]);return c})(l),a=t.text,o=t.text_matching||"exact",n.some((u=>vt(u,a,o))))}Vn(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Wn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Dn(e,t){return t==null||!t.properties||t.properties.length===0||vo(t.properties.reduce(((s,r)=>{var n=C(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s}),{}),e?.properties)}}class ku{constructor(e){var t;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(t=this._instance)==null||t.onSessionId==null||t.onSessionId((s=>this.Kn(s)))}Yn(e,t){return!!e&&vo(e.propertyFilters,t?.properties)}Xn(e,t){var s=new Map;return e.forEach((r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=s.get(a.name)||[];o.push(r.id),s.set(a.name,o)}}))})),s}es(e,t,s){var r=(s===Ct.Activation?this.Gn:this.Qn).get(e),n=[];return this.ts((a=>{n=a.filter((o=>r?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[s])==null||(o=o.values)==null?void 0:o.find((u=>u.name===e));return this.Yn(l,t)}))}register(e){var t;w((t=this._instance)==null?void 0:t._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var t=e.filter((s=>{var r,n;return((r=s.conditions)==null?void 0:r.actions)&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.ss==null&&(this.ss=new Eu(this._instance),this.ss.init(),this.ss.Bn((s=>{this.onAction(s)}))),t.forEach((s=>{var r,n,a,o,l;s.conditions&&(r=s.conditions)!=null&&r.actions&&(n=s.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=s.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.ss)==null||o.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var h=this.Jn.get(u.name);h&&h.push(s.id),this.Jn.set(u.name,h||[s.id])}})))})))}rs(e){var t,s=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),r=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));s.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((n,a)=>{this.onEvent(n,a)})),this.Gn=this.Xn(e,Ct.Activation),this.Qn=this.Xn(e,Ct.Cancellation))}onEvent(e,t){var s,r,n=this.os(),a=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.ls(e,a);if(o==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.us([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),void this.hs(a)}if(this.Qn.has(e)){var l=this.es(e,t,Ct.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((h=>h.id))}),this.us(l.map((h=>h.id))),l.forEach((h=>this.ds(h.id))))}if(this.Gn.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.Gn.get(e)});var u=this.es(e,t,Ct.Activation);this.cs(u.map((h=>h.id)))}}onAction(e){this.Jn.has(e)&&this.cs(this.Jn.get(e)||[])}cs(e){e.length!==0&&(this.Zn=[...new Set([...this.Zn,...e])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(e){this.Zn=this.Zn.filter((s=>s!==e));var t=this.vs();t.includes(e)||(this.fs([...t,e]),this.ps())}us(e){var t=new Set(e);this.Zn=this.Zn.filter((n=>!t.has(n)));var s=this.gs(),r=s.filter((n=>!t.has(n)));r.length!==s.length&&(this.fs(r),r.length===0&&this.ys())}gs(){var e,t=this.bs();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}vs(){var e,t,s=this.gs();if(s.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this._s()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&r===n?s:[]}ps(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.ws(t)}ys(){this.xs()}Kn(e){var t,s=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this._s()];s&&s!==e&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((e=>!this.ks(e)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class Su extends ku{constructor(e){super(e)}bs(){return Ws}_s(){return bi}Cs(){return Ue.SHOWN}ts(e){var t;(t=this._instance)==null||t.getSurveys(e)}ds(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}os(){return H}fs(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ws]:e})}ws(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[bi]:e})}xs(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(bi)}ks(){return!1}ls(e,t){var s;this.ts((n=>{s=n.find((a=>a.id===t))}));var r=!s||(function(n){var a;return go(n)&&!((a=n.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||n.schedule==="always"})(s);return r?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()}}var fi="SDK is not enabled or survey functionality is not yet loaded",$n="Disabled. Not loading surveys.",Pu=g!=null&&g.location?zi(g.location.hash,"__posthog")||zi(location.hash,"state"):null,In="_postHogToolbarParams",Mn=Y("[Toolbar]"),re=Y("[FeatureFlags]"),tt=Y("[FeatureFlags]",{debugEnabled:!0}),Ps=`" failed. Feature flags didn't load in time.`,Rn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},Cn=i=>{var e={};for(var t of wi(i||{})){var s=t[1];s&&(e[t[0]]=s)}return e},Ne=Y("[Error tracking]"),On="Refusing to render web experiment since the viewer is a likely bot",Tu={icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>e.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>Vi(e,i),not_regex:(i,e)=>!Vi(e,i),exact:(i,e)=>e===i,is_not:(i,e)=>e!==i};class he{get Te(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments((r=>{he.Ts("retrieved web experiments from the server"),t.Is=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.Is&&(he.Ts("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Is)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);G(o)&&n.variants[o]&&t.Ms(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];he.Es(u,t._instance)&&t.Ms(n.name,l,u.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())he.Ts(On);else if(!this.Te.disable_web_experiments){if(O(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();he.Ts("applying feature flags",e),e.forEach((t=>{var s;if(this.Is&&(s=this.Is)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.Is)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.Ms(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=he.getWindowLocation();if(e!=null&&e.search){var t=St(e?.search,"__experiment_id"),s=St(e?.search,"__experiment_variant");t&&s&&(he.Ts("previewing web experiments "+t+" && "+s),this.getWebExperiments((r=>{this.Rs(parseInt(t),s,r)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.Te.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}Rs(e,t,s){var r=s.filter((n=>n.id===e));r&&r.length>0&&(he.Ts("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Ms(r[0].name,t,r[0].variants[t].transforms))}static Es(e,t){return!O(e.conditions)&&he.Ps(e,t)&&he.Os(e)}static Ps(e,t){var s;if(O(e.conditions)||O((s=e.conditions)==null?void 0:s.url))return!0;var r=he.getWindowLocation();if(r){var n,a,o,l=$a(t,r.href);return(n=e.conditions)==null||!n.url||Tu[(a=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,l)}return!1}static getWindowLocation(){return g?.location}static Os(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.utm))return!0;var s=Va();if(s.utm_source){var r,n,a,o,l,u,h,c,p=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,v=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==s.utm_source,d=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==s.utm_medium,f=(h=e.conditions)==null||(h=h.utm)==null||!h.utm_term||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_term)==s.utm_term;return p&&d&&f&&v}return!1}static Ts(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];x.info("[WebExperiments] "+e,s)}Ms(e,t,s){this._is_bot()?he.Ts(On):t!=="control"?s.forEach((r=>{if(r.selector){var n;he.Ts("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(n=document)==null?void 0:n.querySelectorAll(r.selector);a?.forEach((o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):he.Ts("Control variants leave the page unmodified.")}_is_bot(){return ve&&this._instance?ho(ve,this.Te.custom_blocked_useragents):void 0}}var Pe=Y("[Conversations]"),it="Conversations not available yet.",An="console",Yi={featureFlags:class{constructor(i){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var e=this.Us();this.Hs=0,e&&this.reloadFeatureFlags()},this._instance=i,this.featureFlagEventHandlers=[],g&&te(g,"online",this.Bs)}destroy(){g?.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(i){return this._instance.get_property(i)}Vs(){var i,e;return(i=(e=this.mi)==null?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,re.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var i,e=(i=this.Te.evaluation_contexts)!==null&&i!==void 0?i:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(re.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),e!=null&&e.length?e.filter((t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||re.error("Invalid evaluation context found:",t,"Expected non-empty string"),s})):[]}Gs(){return this.Zs().length>0}Qs(){var i=this.Te.flag_keys;if(!w(i)){if(C(i))return i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||re.error("Invalid flag key found:",e,"Expected non-empty string"),t}));re.error("Invalid flag_keys found:",i,"Expected array of non-empty strings")}}initialize(){var i,e,t=this._instance.config,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(s).filter((u=>!!s[u])).reduce(((u,h)=>(u[h]=s[h]||!1,u)),{}),l=Object.keys(a).filter((u=>o[u])).reduce(((u,h)=>(a[h]&&(u[h]=a[h]),u)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var s,r,n=t!=null&&t.merge&&(s=this.zs(at))!==null&&s!==void 0?s:{},a=t!=null&&t.merge&&(r=this.zs(yi))!==null&&r!==void 0?r:{},o=y({},n,i),l=y({},a,e),u={};for(var h of Object.entries(o)){var c=h[0],p=h[1];u[c]={key:c,enabled:Ar(p),variant:Lr(p),reason:void 0,metadata:w(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.zs(Bs),e=this.zs(qe),t=this.zs(gt);if(!t&&!e)return i||{};var s=W({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=s[n],u=e?.[n],h=w(u)?(a=l?.enabled)!==null&&a!==void 0&&a:!!u,c=w(u)?l.variant:typeof u=="string"?u:void 0,p=t?.[n],v=y({},l,{enabled:h,variant:h?c??l?.variant:void 0});h!==l?.enabled&&(v.original_enabled=l?.enabled),c!==l?.variant&&(v.original_variant=l?.variant),p&&(v.metadata=y({},l?.metadata,{payload:p,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[n]=v}return this.Fs||(re.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.Fs=!0),s}getAllFeatureFlags(){var i=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(i).map((t=>{var s=i[t];return{key:t,enabled:Ar(s),variant:Lr(s),payload:Or(e[t])}}))}getFlagVariants(){var i=this.zs(at),e=this.zs(qe);if(!e)return i||{};for(var t=W({},i),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Fs||(re.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.Fs=!0),t}getFlagPayloads(){var i=this.zs(yi),e=this.zs(gt);if(!e)return i||{};for(var t=W({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Fs||(re.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.Fs=!0),t}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.As=i}Ks(i){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var t=this.Te.token,s=this.zs(Ci),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},((e=this.mi)==null?void 0:e.get_initial_props())||{},this.zs(st)||{},{$lib:q.LIB_NAME,$lib_version:q.LIB_VERSION}),group_properties:this.zs(rt),timezone:Xa()};ge(s)||w(s)||(r.$device_id=s),(i!=null&&i.disableFlags||this.Te.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Gs()&&(r.evaluation_contexts=this.Zs());var n=this.Qs();w(n)||(r.flag_keys=n);var a=!!this.Te.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this.Te.disable_compression?void 0:pe.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:l=>{var u,h,c,p=!0;if(this.Xs(l.statusCode),l.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),p=!1),this.$s=!1,!r.disable_flags||this.Ns){this.Ds=!p;var v=[];l.error?l.error instanceof Error?v.push(l.error.name==="AbortError"?"timeout":"connection_error"):v.push("unknown_error"):l.statusCode!==200&&v.push("api_error_"+l.statusCode),(u=l.json)!=null&&u.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");var d,f=!((h=l.json)==null||(h=h.quotaLimited)==null||!h.includes("feature_flags"));f&&v.push("quota_limited"),(c=this.mi)==null||c.register({[Js]:v}),f?re.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags((d=l.json)!==null&&d!==void 0?d:{},p,{partialResponse:a}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return Ba(this.Hs,3)}Xs(i){this.Hs=Ua(i,this.Hs,3,(()=>re.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(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var s=this.getFeatureFlagResult(i,e);return(t=s?.variant)!==null&&t!==void 0?t:s?.enabled}}else re.warn('getFeatureFlag for key "'+i+Ps)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e?.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var t=this.getFlagVariants(),s=i in t,r=t[i],n=this.getFlagPayloads()[i],a=String(r),o=this.zs(Us)||void 0,l=this.zs(ei)||void 0,u=this.zs(Kt)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var h,c=this._instance.get_session_id(),p=this.zs(Ks);c&&c!==p&&(u={},(h=this.mi)==null||h.register({[Kt]:u,[Ks]:c}))}if((e.send_event||!("send_event"in e))&&(!(i in u)||!u[i].includes(a))){var v,d,f,m,_,k,E,S,F,N,L;C(u[i])?u[i].push(a):u[i]=[a],(v=this.mi)==null||v.register({[Kt]:u});var b=this.getFeatureFlagDetails(i),T=[...(d=this.zs(Js))!==null&&d!==void 0?d:[]];w(r)&&T.push("flag_missing");var I={$feature_flag:i,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((f=this.Te.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[i])||null,$feature_flag_bootstrapped_payload:((m=this.Te.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[i])||null,$used_bootstrap_value:!this.Ds};w(b==null||(_=b.metadata)==null?void 0:_.has_experiment)||(I.$feature_flag_has_experiment=b.metadata.has_experiment),w(b==null||(k=b.metadata)==null?void 0:k.version)||(I.$feature_flag_version=b.metadata.version);var A,M=(E=b==null||(S=b.reason)==null?void 0:S.description)!==null&&E!==void 0?E:b==null||(F=b.reason)==null?void 0:F.code;M&&(I.$feature_flag_reason=M),b!=null&&(N=b.metadata)!=null&&N.id&&(I.$feature_flag_id=b.metadata.id),w(b?.original_variant)&&w(b?.original_enabled)||(I.$feature_flag_original_response=w(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(L=b.metadata)!=null&&L.original_payload&&(I.$feature_flag_original_payload=b==null||(A=b.metadata)==null?void 0:A.original_payload),T.length&&(I.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",I)}if(s)return{key:i,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:Or(n)}}}else re.warn('getFeatureFlagResult for key "'+i+Ps)}getRemoteConfigPayload(i,e){var t=this.Te.token,s={distinct_id:this._instance.get_distinct_id(),token:t,person_properties:{$lib:q.LIB_NAME,$lib_version:q.LIB_VERSION}};this.Gs()&&(s.evaluation_contexts=this.Zs());var r=this.Qs();w(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Te.disable_compression?void 0:pe.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),e.fresh&&!this.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return re.warn('isFeatureEnabled for key "'+i+Ps),e.defaultValue;var t=this.getFeatureFlag(i,e);return w(t)?e.defaultValue:!!t}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.mi){this.Ls=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,h,c){l===void 0&&(l={}),u===void 0&&(u={}),h===void 0&&(h={});var p=(b=>{var T=b.flags;return T?(b.featureFlags=Object.fromEntries(Object.keys(T).map((I=>{var A;return[I,(A=T[I].variant)!==null&&A!==void 0?A:T[I].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(T).filter((I=>T[I].enabled)).filter((I=>{var A;return(A=T[I].metadata)==null?void 0:A.payload})).map((I=>{var A;return[I,(A=T[I].metadata)==null?void 0:A.payload]})))):b.featureFlags&&re.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(a),v=p.flags,d=p.featureFlags,f=p.featureFlagPayloads;if(d){var m=a.requestId,_=a.evaluatedAt;if(C(d)){re.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var k={};if(d)for(var E=0;d.length>E;E++)k[d[E]]=!0;o&&o.register({[mi]:d,[at]:k,[Oi]:!1})}else{var S=d,F=f,N=v;if(c!=null&&c.partialResponse)S=y({},l,S),F=y({},u,F),N=y({},h,N);else if(a.errorsWhileComputingFlags)if(v){var L=new Set(Object.keys(v).filter((b=>{var T;return!((T=v[b])!=null&&T.failed)})));S=y({},l,Object.fromEntries(Object.entries(S).filter((b=>L.has(b[0]))))),F=y({},u,Object.fromEntries(Object.entries(F||{}).filter((b=>L.has(b[0]))))),N=y({},h,Object.fromEntries(Object.entries(N||{}).filter((b=>L.has(b[0])))))}else S=y({},l,S),F=y({},u,F),N=y({},h,N);o&&o.register(y({[mi]:Object.keys(Cn(S)),[at]:S||{},[yi]:F||{},[Bs]:N||{},[Oi]:a.minimalFlagCalledEvents===!0},m?{[Us]:m}:{},_?{[ei]:_}:{}))}}})(i,this.mi,s,r,n,t),e||(this.js=!1),this.eo(e)}}override(i,e){e===void 0&&(e=!1),re.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){if(!this._instance.__loaded||!this.mi)return re.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.mi.unregister(qe),this.mi.unregister(gt),this.eo(),tt.info("All overrides cleared");if(C(i)){var e=Rn(i);return this.mi.register({[qe]:e}),this.eo(),tt.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,s=i;if(this.Fs=!!((t=s.suppressWarning)!==null&&t!==void 0&&t),"flags"in s){if(s.flags===!1)this.mi.unregister(qe),tt.info("Flag overrides cleared");else if(s.flags){if(C(s.flags)){var r=Rn(s.flags);this.mi.register({[qe]:r})}else this.mi.register({[qe]:s.flags});tt.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.mi.unregister(gt),tt.info("Payload overrides cleared")):s.payloads&&(this.mi.register({[gt]:s.payloads}),tt.info("Payload overrides set",{payloads:s.payloads}))),void this.eo()}if(i&&typeof i=="object")return this.mi.register({[qe]:i}),this.eo(),tt.info("Flag overrides set",{flags:i});re.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.Ls){var e=this.ro(),t=e.flags,s=e.flagVariants;try{i(t,s)}catch(r){re.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.zs(Bt)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},a={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(a.$early_access_feature_name=r.name),t&&(a.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=y({},this.getFlagVariants(),{[i]:e});(s=this.mi)==null||s.register({[mi]:Object.keys(Cn(o)),[at]:o}),this.eo()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.zs(Bt),r=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(s&&!e)return i(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+r),method:"GET",timestampMode:"query",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.mi)==null||a.unregister(Bt),(o=this.mi)==null||o.register({[Bt]:l}),i(l)}}})}ro(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,s)=>(t[s]=e[s],t)),{})}}eo(i){var e=this.ro(),t=e.flags,s=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(t,s,{errorsLoading:i})}catch(n){re.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.zs(st)||{},s=i?.$set||(i!=null&&i.$set_once?{}:i),r=i?.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this._instance.register({[st]:y({},t,n,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=y({},this.zs(st)||{});i.forEach((s=>{delete t[s]})),this._instance.register({[st]:t}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(i){i===void 0&&(i=!0),this._instance.unregister(st),i&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.zs(rt)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((s=>{t[s]=y({},t[s],i[s]),delete i[s]})),this._instance.register({[rt]:y({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.zs(rt)||{};this._instance.register({[rt]:y({},e,{[i]:{}})})}else this._instance.unregister(rt)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},Fu={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var i;return!((i=this.io)==null||!i.isStarted)}get status(){var i,e;return this.no===qt||this.no===gi?this.no:(i=(e=this.io)==null?void 0:e.status)!==null&&i!==void 0?i:this.no}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=Pn,this.so=void 0,this._instance=i,!this._instance.sessionManager)throw De.error("started without valid sessionManager"),new Error(hr+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===ze)throw new Error(hr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var i,e=!((i=this._instance.get_property(ot))==null||!i.enabled),t=!this.Te.disable_session_recording,s=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return g&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!this.oo||(e=this.io)==null||!e.isStarted){var t=!w(Object.assign)&&!w(Array.from);this.oo&&t?(this.ao(i),De.info("starting")):(this.no=Pn,this.stopRecording())}}ao(i){var e,t,s;this.oo&&(this.no!==qt&&this.no!==gi&&(this.no=Tn),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=$.__PosthogExtensions__)!=null&&t.initSessionRecording?this.lo(i):(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.uo,(r=>{if(r)return De.error("could not load recorder",r);this.lo(i)})))}stopRecording(){var i,e;(i=this.so)==null||i.call(this),this.so=void 0,(e=this.io)==null||e.stop()}ho(){var i,e;(i=this.so)==null||i.call(this),this.so=void 0,(e=this.io)==null||e.discard()}do(){var i,e;(i=this.mi)==null||i.unregister(yr),(e=this.mi)==null||e.unregister(_a)}co(i,e){if(O(i))return null;var t,s=ue(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(De.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}vo(i){if(this.mi){var e,t,s=this.mi,r=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.co((n=this.Te.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.co(a?.sampleRate,"remote config sampleRate"),u=o??l;O(u)&&this.do();var h=a?.minimumDurationMilliseconds;s.register({[ot]:y({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:y({capturePerformance:i.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:w(h)?null:h,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.so)==null||e.call(this),this.so=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){var e=i.ok?i.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===qt&&(this.no=gi,De.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.io)!=null&&t.log?this.io.log(i,e):De.warn("log called before recorder was ready")}get uo(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(ot);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}fo(){var i,e,t=this._instance.get_property(ot);if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(r){return De.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var s=(i=e.cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-s}lo(i){var e,t;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return De.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Sa]:!0});if(this.io||(this.io=(t=$.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===gi||this.no===qt?void 0:(this.no=qt,De.info("persisted remote config is stale, requesting fresh config before starting"),void new Qa(this._instance).load());this.no=Tn,this.io.start(i)}onRRwebEmit(i){var e;(e=this.io)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.io||(e=this.mi)==null||e.register({[ya]:!0}),(i=this.io)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.io||(e=this.mi)==null||e.register({[ma]:!0}),(i=this.io)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.io||(t=this.mi)==null||t.register({[i==="url"?ba:wa]:!0}),(e=this.io)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.io)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.io)==null||!t.tryAddCustomEvent(i,e))}}},$u={autocapture:class{constructor(i){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=i,this.rageclicks=new En(i.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var i,e,t=K(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((s=>new RegExp(s))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((s=>new RegExp(s))),t}wo(){if(this.isBrowserSupported()){if(g&&P){var i=t=>{t=t||g?.event;try{this.xo(t)}catch(s){ws.error("Failed to capture event",s)}};if(te(P,"submit",i,{capture:!0}),te(P,"change",i,{capture:!0}),te(P,"click",i,{capture:!0}),this.Te.capture_copied_text){var e=t=>{t=t||g?.event;try{this.xo(t,bs)}catch(s){ws.error("Failed to capture copy/cut event",s)}};te(P,"copy",e,{capture:!0}),te(P,"cut",e,{capture:!0})}}}else ws.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(i){if(this.yo=!0,i.ok){var e=i.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var t=e.autocapture_opt_out;Ce(t)&&(this.instance.persistence&&this.instance.persistence.register({[Ds]:t}),this.mo=t),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(i){this._o=i}getElementSelectors(i){var e,t=[];return(e=this._o)==null||e.forEach((s=>{var r=P?.querySelectorAll(s);r?.forEach((n=>{i===n&&t.push(s)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[Ds],s=this.mo,r=this.instance.Ur()&&!this.yo;if(ge(s)&&!Ce(t)&&!r)return!1;var n=(e=this.mo)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!n}xo(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=us(i);Ma(s)&&(s=s.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&sn(s,this.instance.config.rageclick)&&this.xo(i,"$rageclick");var r=e===bs;if(s&&(function(c,p,v,d,f,m){var _;if(!g||kr(c)||v!=null&&v.url_allowlist&&!Qr(v.url_allowlist,m)||v!=null&&v.url_ignorelist&&Qr(v.url_ignorelist,m))return!1;if(v!=null&&v.dom_event_allowlist){var k=v.dom_event_allowlist;if(k&&!k.some((b=>p.type===b)))return!1}var E=Da(c,d),S=E.parentIsUsefulElement,F=E.targetElementList;if(!(function(b,T){var I=T?.element_allowlist;if(w(I))return!0;var A,M=function(Z){if(I.some((B=>Z.tagName.toLowerCase()===B)))return{v:!0}};for(var D of b)if(A=M(D))return A.v;return!1})(F,v)||!tr(F,v?.css_selector_allowlist)||tr(F,(_=v?.css_selector_ignorelist)!==null&&_!==void 0?_:$l))return!1;try{var N=g.getComputedStyle(c);if(N&&N.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0}catch{}var L=c.tagName.toLowerCase();switch(L){case"html":return!1;case"form":return(f||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(f||["change","click"]).indexOf(p.type)>=0;default:return S?(f||["click"]).indexOf(p.type)>=0:(f||["click"]).indexOf(p.type)>=0&&(Er.indexOf(L)>-1||c.getAttribute("contenteditable")==="true")}})(s,i,this.Te,r,r?["copy","cut"]:void 0,this.instance)){var n=yu(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),a=n.props;if(n.explicitNoCapture)return!1;var o=this.getElementSelectors(s);if(o&&o.length>0&&(a.$element_selectors=o),e===bs){var l,u=Oa(g==null||(l=g.getSelection())==null?void 0:l.toString()),h=i.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=h}return this.instance.capture(e,a),!0}}}isBrowserSupported(){return Re(P?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ko=(g==null||(e=g.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(x.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,x.info("History API monitoring stopped")}monitorHistoryChanges(){g&&g.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(i){var e;if(g&&((e=g.history[i])==null||!e.__posthog_wrapped__)){var t=this;(function(s,r,n){try{if(!(r in s))return kn;var a={next:s[r]},o=n((function(){for(var l=arguments.length,u=new Array(l),h=0;l>h;h++)u[h]=arguments[h];return a.next.apply(this,u)}));return Re(o)&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:a}})),s[r]=o,()=>{if(s[r]!==o)for(var l=s[r];Re(l)&&l.__posthog_layer__;){var u=l.__posthog_layer__;if(u.next===o)return void(u.next=a.next);l=u.next}else s[r]=a.next}}catch{return kn}})(g.history,i,(s=>function(r,n,a){s.call(this,r,n,a),t.Io(i)}))}}Io(i){try{var e,t=g==null||(e=g.location)==null?void 0:e.pathname;if(!t)return;t!==this.ko&&this.isEnabled&&this._instance.capture(ft,{navigation_type:i}),this.ko=t}catch(s){x.error("Error capturing "+i+" pageview",s)}}To(){if(!this.So){var i=()=>{this.Io("popstate")};te(g,"popstate",i),this.So=()=>{g&&g.removeEventListener("popstate",i)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(i){var e;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=i,this.Mo=!((e=this.instance.persistence)==null||!e.props[Ns]),this.rageclicks=new En(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return K(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(i=this.Te.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return O(this.Te.capture_heatmaps)?O(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;wu.info("starting..."),this.Ro(),this.ke()}else{var i;clearInterval((i=this.Eo)!==null&&i!==void 0?i:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(i){if(i.ok){var e=i.config;if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ns]:t}),this.Mo=t,this.startIfEnabled()}}}getAndClearBuffer(){var i=this.R;return this.R=void 0,i}Oo(i){Es(i.originalEvent)&&this.pe(i.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=P?.visibilityState==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){g&&P&&(this.Fo=this.oi.bind(this),te(g,ji,this.Fo),this.Lo=i=>this.pe(i||g?.event),te(P,"click",this.Lo,{capture:!0}),this.$o=i=>this.Ao(i||g?.event),te(P,"mousemove",this.$o,{capture:!0}),this.No=new an(this.instance,Dl,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),te(P,Ni,this.Do),this.po=!0)}Po(){var i;g&&P&&(this.Fo&&g.removeEventListener(ji,this.Fo),this.Lo&&P.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&P.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&P.removeEventListener(Ni,this.Do),clearTimeout(this.qo),(i=this.No)==null||i.stop(),this.po=!1)}jo(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var u=a;u&&Ze(u)&&!xe(u,"body");){if(u===l)return!1;var h=void 0;try{var c,p,v;h=(c=(p=(v=u.ownerDocument)==null?void 0:v.defaultView)!==null&&p!==void 0?p:g)==null?void 0:c.getComputedStyle(u).position}catch{return!1}if(R(o,h))return!0;u=Aa(u)}return!1})(us(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}pe(i,e){var t;if(e===void 0&&(e="click"),!Xr(i.target)&&Es(i)){var s=this.jo(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&sn(us(i),this.instance.config.rageclick)&&this.Nt(y({},s,{type:"rageclick"})),this.Nt(s)}}Ao(i){!Xr(i.target)&&Es(i)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(i,"mousemove"))}),500))}Nt(i){if(g){var e=this.Te.disable_capture_url_hashes?Ye(g.location.href):g.location.href,t=this.Te.custom_personal_data_properties,s=this.Te.mask_personal_data_properties?[...Pt,...t||[]]:[],r=ii(e,s,si);this.R=this.R||{},this.R[r]||(this.R[r]=[]),this.R[r].push(i)}}oi(){this.R&&!Je(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:an,webVitalsAutocapture:class{constructor(i){var e;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,s)=>y({},t,{["$web_vitals_"+s.name+"_event"]:y({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=t=>{var s;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.zo();if(!w(r))if(O(t?.name)||O(t?.value))et.error("Invalid metric received",t);else if(!this.Vo||this.Vo>t.value){this.R.url!==r&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),w(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=w(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),a=y({},t,{$current_url:r,timestamp:Date.now()});w(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.R.metrics.push(a),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else et.error("Ignoring metric with value >= "+this.Vo,t)},this.Wo=()=>{if(!this.po){var t,s,r,n,a=$.__PosthogExtensions__;if(!w(a)&&!w(a.postHogWebVitalsCallbacks)){var o=a.postHogWebVitalsCallbacks;t=o.onLCP,s=o.onCLS,r=o.onFCP,n=o.onINP}t&&s&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.Uo.bind(this)),this.po=!0):et.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Mo=!((e=this._instance.persistence)==null||!e.props[Gs]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=K(this.Zo)?(i=this.Zo)==null?void 0:i.web_vitals_allowed_metrics:void 0;return O(t)?((e=this._instance.persistence)==null?void 0:e.props[zs])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(K(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=K(this.Zo)?this.Zo.web_vitals_attribution:void 0;return i!=null&&i}get Vo(){var i=K(this.Zo)&&ue(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:Sn;return i>0&&6e4>=i?Sn:i}get isEnabled(){var i=se?.protocol;if(i!=="http:"&&i!=="https:")return et.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=K(this.Zo)?this.Zo.web_vitals:Ce(this.Zo)?this.Zo:void 0;return Ce(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(et.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(i){if(i.ok){var e=i.config;if("capturePerformance"in e){var t=K(e.capturePerformance)&&!!e.capturePerformance.web_vitals,s=K(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Gs]:t}),this._instance.persistence.register({[zs]:s})),this.Mo=t,this.startIfEnabled()}}}er(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?et.error("failed to load script",s):i()}))}zo(){var i=g?this._instance.config.disable_capture_url_hashes?Ye(g.location.href):g.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...Pt,...e||[]]:[];return ii(i,t,si)}et.error("Could not determine current URL")}}},Iu={exceptionObserver:class{constructor(i){var e;this.Wo=()=>{var t;if(g&&this.isEnabled&&(t=$.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var s=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=s(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=r(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=n(this.captureException.bind(this)))}catch(a){jt.error("failed to start",a),this.Ko()}}},this._instance=i,this.Yo=!((e=this._instance.persistence)==null||!e.props[js]),this.Xo=new Mo(y({},(function(t){var s,r,n,a;return t===void 0&&(t={}),{refillRate:(s=(r=t.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:t.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(n=(a=t.exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:t.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:jt})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return K(i)?e=y({},e,i):(w(i)?this.Yo:i)&&(e=y({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(jt.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return jt.error("failed to load script",s);i()}))}Ko(){var i,e,t;(i=this.Go)==null||i.call(this),this.Go=void 0,(e=this.Qo)==null||e.call(this),this.Qo=void 0,(t=this.Jo)==null||t.call(this),this.Jo=void 0}onRemoteConfig(i){if(i.ok){var e=i.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[js]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.Xo.consumeRateLimit(r)?jt.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.ta=[],this.ra=new Ko([new il,new cl,new rl,new sl,new ul,new ll,new al,new hl],(function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var u=[],h=o.split(`
2
- `),c=l;h.length>c;c++){var p=h[c];if(1024>=p.length){var v=Kr.test(p)?p.replace(Kr,"$1"):p;if(!v.match(/\S*Error: /)){for(var d of n){var f=d(v,s);if(f){u.push(f);break}}if(u.length>=50)break}}}return(function(m){if(!m.length)return[];var _=Array.from(m);return _.reverse(),_.slice(0,50).map((k=>{return y({},k,{filename:k.filename||(E=_,E[E.length-1]||{}).filename,function:k.function||kt});var E}))})(u)}})("web:javascript",Xo,tl)),this._instance=i,this.ta=(e=(t=this._instance.persistence)==null?void 0:t.get_property(qs))!==null&&e!==void 0?e:[],this.ia=Ri(this.na()),this.sa=new pl(this.ia)}onConfigChange(){this.ia=Ri(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(i){var e,t,s;if(i.ok){var r=i.config;if("errorTracking"in r){var n=(e=(t=r.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],a=(s=r.errorTracking)==null?void 0:s.captureExtensionExceptions;this.ta=n,this._instance.persistence&&this._instance.persistence.register({[qs]:this.ta,[Hs]:a})}}}get oa(){var i,e=!!this._instance.get_property(Hs),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.ra.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(i,e){if(this.ia.enabled)try{if(!G(i)||i.trim().length===0)return void Ne.warn("Ignoring exception step because message must be a non-empty string");var t=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(n).reduce(((o,l)=>dl.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.aa(e)),s=t.sanitizedProperties,r=t.droppedKeys;r.length>0&&Ne.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.sa.add(y({[Ii]:i,[Mi]:new Date().toISOString()},s))}catch(n){Ne.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void Ne.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void Ne.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Ne.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.ia.enabled&&O(i.$exception_steps)?this.va(i):i;try{var s=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return s&&this.sa.clear(),s}catch(r){return Ne.error("Failed to capture exception event. Dropping this exception.",r),void this.sa.clear()}}catch(r){return void Ne.error("Failed to process exception event. Ignoring this exception.",r)}}va(i){try{var e=this.sa.getAttachable();return e.length===0?i:y({},i,{$exception_steps:e})}catch(t){return Ne.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}ha(i){this.ia.enabled&&this.sa.add({[Ii]:i,[Mi]:new Date().toISOString()})}aa(i){return K(i)?y({},i):{}}na(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}ua(i){if(i.length===0)return!1;var e=i.reduce(((t,s)=>{var r=s.type,n=s.value;return G(r)&&r.length>0&&t.$exception_types.push(r),G(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.ta.some((t=>{var s=t.values.map((r=>{var n,a=po[r.operator],o=C(r.value)?r.value:[r.value],l=(n=e[r.key])!==null&&n!==void 0?n:[];return o.length>0&&a(o,l)}));return t.type==="OR"?s.some(Boolean):s.every(Boolean)}))}da(i){return i.flatMap((e=>{var t,s;return(t=(s=e.stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ca(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(s=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}la(i){return!O(i)&&C(i)}}},Mu=y({productTours:class{get mi(){return this._instance.persistence}constructor(i){this.fa=null,this.pa=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(i.ok){var e=i.config;if("productTours"in e){var t,s;if(this.mi&&this.mi.register({[mr]:!!e.productTours}),!Ss(this._instance))return!this.fa&&O((t=this.mi)==null?void 0:t.props[Ut])||ks.info("product tours disabled; stopping and clearing cached tours"),(s=this.fa)==null||s.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&Ss(this._instance)&&this.er((()=>this.ga()))}er(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(s=>{s?ks.error("Could not load product tours script",s):i()}))}ga(){var i;!this.fa&&(i=$.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.fa=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!C(this.pa)||e){var t=this.mi;if(t){var s=t.props[Ut];if(C(s)&&!e)return this.pa=s,void i(s,{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:r=>{if(Ss(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return ks.error(a),void i([],{isLoaded:!1,error:a})}var o=C(r.json.product_tours)?r.json.product_tours:[];this.pa=o,t&&t.register({[Ut]:o}),i(o,{isLoaded:!0})}else i([],{isLoaded:!0})}})}else i(this.pa,{isLoaded:!0})}getActiveProductTours(i){O(this.fa)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(i)}showProductTour(i){var e;(e=this.fa)==null||e.showTourById(i)}previewTour(i){this.fa?this.fa.previewTour(i):this.er((()=>{var e;this.ga(),(e=this.fa)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.fa)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.fa)==null||i.nextStep()}previousStep(){var i;(i=this.fa)==null||i.previousStep()}clearCache(){var i;this.pa=null,(i=this.mi)==null||i.unregister(Ut)}resetTour(i){var e;(e=this.fa)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.fa)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.fa)==null||e.cancelPendingTour(i)}}},Yi),Ru={siteApps:class{constructor(i){this.ma=0,this._instance=i,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(i,e){if(e){var t=this.globalsForEvent(e);this.ya.push(t),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var i;return(i=$._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{i(),this.ya=[],this._a=void 0}}}globalsForEvent(i){var e,t,s,r,n,a,o;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(h)){var p=c[0];l[p]={id:u[p],type:p,properties:c[1]}}var v=i.$set_once,d=i.$set;return{event:y({},Dn(i,xu),{properties:y({},i.properties,d?{$set:y({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},d)}:{},v?{$set_once:y({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},v)}:{}),elements_chain:(n=(a=i.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=i.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}wa(i){var e,t=(e=i.tagName)==null?void 0:e.toLowerCase();return t==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(i)||(Oe.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(i)||(Oe.error("prepare_external_dependency_script returned null"),null):i}xa(){var i,e,t,s,r,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=P?.defaultView,u=l==null||(i=l.Node)==null?void 0:i.prototype;if(!l||!u)return()=>{};if(this.ma++,this.ka)return this.Sa();var h=[],c=this,p=new WeakSet,v=(m,_,k)=>{if(m!=null&&m[_]){var E=m[_];m[_]=k(E),h.push((()=>{m[_]=E}))}},d=m=>{if(p.has(m))return m;var _=c.wa(m);return _&&p.add(_),_},f=m=>m.map((_=>typeof _=="string"?_:d(_))).filter((_=>!ge(_)));return v(u,"appendChild",(m=>function(_){var k=d(_);return k?m.call(this,k):_})),v(u,"insertBefore",(m=>function(_,k){var E=d(_);return E?m.call(this,E,k):_})),v(u,"replaceChild",(m=>function(_,k){var E=d(_);return E?m.call(this,E,k):k})),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(s=l.DocumentFragment)==null?void 0:s.prototype].forEach((m=>{v(m,"append",(_=>function(){for(var k=arguments.length,E=new Array(k),S=0;k>S;S++)E[S]=arguments[S];return _.apply(this,f(E))})),v(m,"prepend",(_=>function(){for(var k=arguments.length,E=new Array(k),S=0;k>S;S++)E[S]=arguments[S];return _.apply(this,f(E))}))})),[(r=l.Element)==null?void 0:r.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(a=l.DocumentType)==null?void 0:a.prototype].forEach((m=>{v(m,"before",(_=>function(){for(var k=arguments.length,E=new Array(k),S=0;k>S;S++)E[S]=arguments[S];return _.apply(this,f(E))})),v(m,"after",(_=>function(){for(var k=arguments.length,E=new Array(k),S=0;k>S;S++)E[S]=arguments[S];return _.apply(this,f(E))})),v(m,"replaceWith",(_=>function(){for(var k=arguments.length,E=new Array(k),S=0;k>S;S++)E[S]=arguments[S];var F=f(E);return E.length&&!F.length?void 0:_.apply(this,F)}))})),v((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(m=>function(_,k){var E=d(k);return E?m.call(this,_,E):null})),this.ka=()=>{h.forEach((m=>m())),this.ka=void 0},this.Sa()}Sa(){var i=!1;return()=>{var e;i||(i=!0,this.ma--,this.ma===0&&((e=this.ka)==null||e.call(this)))}}Ca(i,e){e===void 0&&(e=!0);var t=this.xa();try{var s=i(t);return e&&t(),s}catch(r){throw t(),r}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var a;!e.errored&&this.ya.length&&(Oe.info("Processing "+this.ya.length+" events for site app with id "+i.id),this.ya.forEach((o=>this.Ca((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this._a)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,Oe.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),s&&t()};try{var n=this.Ca((a=>i.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;n&&(e.processEvent=n),s=!0}catch(a){Oe.error(Fn+i.id,a),r(!1)}if(s&&e.loaded)try{t()}catch(a){Oe.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}Ta(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}Ia(i){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(i),s=function(n){try{e.Ca((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){Oe.error("Error while processing event "+i.event+" for site app "+n.id,a)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(i){var e,t,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(l=>this.Ia(l)))):void Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this._a)==null||t.call(this),i.ok){var n=i.config;if((s=n.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(){var l,u=o.id,h=o.url;$["__$$ph_site_app_"+u]=r._instance,(l=$.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,h,(c=>{if(c)return Oe.error(Fn+u,c)}))};for(var o of n.siteApps)a()}else Oe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Cu={tracingHeaders:class{constructor(i){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var e,t,s=this.Pa();s?(w(this.Ma)&&(this.Ma=(e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),w(this.Ea)&&(this.Ea=(t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=i}initialize(){this.startIfEnabledOrStop()}er(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return bu.error("failed to load script",s);i()}))}Oa(){var i,e;return(i=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&i!==void 0?i:this._instance.config.__add_tracing_headers}Pa(){var i=this.Oa();return C(i)?(C(this.Ra)?this.Ra.splice(0,this.Ra.length,...i):this.Ra=[...i],i.length>0?this.Ra:void 0):(C(this.Ra)&&this.Ra.splice(0),this.Ra=i||void 0,this.Ra)}Ko(){var i,e;(i=this.Ma)==null||i.call(this),(e=this.Ea)==null||e.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},Ou=y({surveys:class{get Te(){return this._instance.config}constructor(i){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Te.disable_surveys){if(!i.ok)return H.warn("Remote config unavailable. Not loading surveys.");var e=i.config.surveys;if(O(e))return H.warn("Flags not loaded yet. Not loading surveys.");var t=C(e);this.Fa=t?e.length>0:e,H.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var i;(i=this._surveyEventReceiver)==null||i.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var s=localStorage.key(t);(s!=null&&s.startsWith(fo)||s!=null&&s.startsWith("inProgressSurvey_"))&&e.push(s)}e.forEach((r=>localStorage.removeItem(r)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)H.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)H.info($n);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())H.info("Not loading surveys in cookieless mode without consent.");else{var i=$?.__PosthogExtensions__;if(i){if(!w(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var t=i.generateSurveys;if(t)return void this.Da(t,e);var s=i.loadExternalDependency;if(!s)return void this.qa(br);s(this._instance,"surveys",(r=>{r||!i.generateSurveys?this.qa("Could not load surveys script",r):this.Da(i.generateSurveys,e)}))}catch(r){throw this.qa("Error initializing surveys",r),r}finally{this.La=!1}}}else H.error("PostHog Extensions not found.")}}Da(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Su(this._instance),H.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(i,e){H.error(i,e),this.ja({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.$a.push(i),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Te.disable_surveys)return H.info($n),i([]);var t,s=this._instance.get_property(Vs);if(s&&!e)return i(s,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((r=>i(r.surveys,r.context))):(typeof Promise<"u"&&(this.Aa=new Promise((r=>{t=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:r=>{var n;this.Aa=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;H.error(o),this.Na=Date.now();var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}this.Na=null;var u,h=r.json.surveys||[],c=h.filter((v=>(function(d){return!(!d.start_date||d.end_date)})(v)&&(go(v)||(function(d){var f;return!((f=d.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(v))));c.length>0&&((u=this._surveyEventReceiver)==null||u.register(c)),(n=this._instance.persistence)==null||n.register({[Vs]:h,[Ai]:Date.now()});var p={isLoaded:!0};i(h,p),t?.({surveys:h,context:p})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var i=this._instance.get_property(Ai);return ue(i)&&Date.now()-i>3e5}Ua(){return ue(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(i,e){var t,s={id:i,current_iteration:(t=e?.iteration)!==null&&t!==void 0?t:null};_o(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(i){for(var e of this.$a)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){H.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);H.warn("init was not called")}za(i){var e=null;return this.getSurveys((t=>{var s;e=(s=t.find((r=>r.id===i)))!==null&&s!==void 0?s:null})),e}Va(i){if(O(this._surveyManager))return{eligible:!1,reason:fi};var e=typeof i=="string"?this.za(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wa(i){if(O(this._surveyManager))return{eligible:!1,reason:fi};var e=typeof i=="string"?this.za(i):i;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(O(this._surveyManager))return H.warn("init was not called"),{visible:!1,disabledReason:fi};var e=this.Wa(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return O(this._surveyManager)?(H.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fi})):new Promise((t=>{this.getSurveys((s=>{var r,n=(r=s.find((o=>o.id===i)))!==null&&r!==void 0?r:null;if(n){var a=this.Wa(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var s;if(O(this._surveyManager))H.warn("init was not called");else{var r=typeof i=="string"?this.za(i):i;if(r!=null&&r.id)if(hu.includes(r.type)){var n=P?.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(H.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;H.info("Rendering survey "+r.id+" with delay of "+((a=r.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(r,n,t),H.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);H.warn("Survey element not found")}else H.warn("Surveys of type "+r.type+" cannot be rendered in the app");else H.warn("Survey not found")}}displaySurvey(i,e){var t;if(O(this._surveyManager))H.warn("init was not called");else{var s=this.za(i);if(s){var r=s;if((t=s.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=y({},s,{appearance:y({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==sr.Popover&&e.initialResponses&&H.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.Va(s);if(!n.eligible)return void H.warn("Survey is not eligible to be displayed: ",n.reason)}e.displayType!==sr.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else H.warn("Survey not found")}}cancelPendingSurvey(i){O(this._surveyManager)?H.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload==null||i.handlePageUnload()}}},Yi),Au={toolbar:class{constructor(i){this.instance=i}Za(i){$.ph_toolbar_state=i}Ga(){var i;return(i=$.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),Pa(this.instance.config)||!g||!P)return!1;i=i??g.location,t=t??g.history;try{if(!e){try{g.localStorage.setItem("test","test"),g.localStorage.removeItem("test")}catch{return!1}e=g?.localStorage}var s,r=Pu||zi(i.hash,"__posthog")||zi(i.hash,"state"),n=r?Yr((()=>JSON.parse(atob(decodeURIComponent(r)))))||Yr((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(In)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Qa(i){var e=$.ph_load_toolbar||$.ph_load_editor;!O(e)&&Re(e)?e(i,this.instance):Mn.warn("No toolbar load function found")}loadToolbar(i){var e=!(P==null||!P.getElementById(Ia));if(!g||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=y({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(g.localStorage.setItem(In,JSON.stringify(y({},s,{source:void 0}))),this.Ga()===2)this.Qa(s);else if(this.Ga()===0){var r;this.Za(1),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Mn.error("[Toolbar] Failed to load",n),void this.Za(0);this.Za(2),this.Qa(s)})),te(g,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(s)}))}return!0}Ja(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},Lu=y({experiments:he},Yi),Du={conversations:class{constructor(i){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations&&i.ok){var e=i.config.conversations;O(e)||(Ce(e)?this.Ka=e:(this.Ka=e.enabled,this.Xa=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||Pa(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=$?.__PosthogExtensions__;if(i&&!w(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var e=i.initConversations;if(e)return this.el(e),void(this.Ya=!1);var t=i.loadExternalDependency;if(!t)return void this.tl(br);t(this._instance,"conversations",(s=>{s||!i.initConversations?this.tl("Could not load conversations script",s):this.el(i.initConversations),this.Ya=!1}))}catch(s){this.tl("Error initializing conversations",s),this.Ya=!1}}else Pe.error("Conversations enabled but missing token in remote config.")}}el(i){if(this.Xa)try{this._conversationsManager=i(this.Xa,this._instance),Pe.info("Conversations loaded successfully")}catch(e){this.tl("Error completing conversations initialization",e)}else Pe.error("Cannot complete initialization: remote config is null")}tl(i,e){Pe.error(i,e),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Pe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!ge(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return ie((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(Pe.warn(it),null)}))()}getMessages(i,e){var t=this;return ie((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(Pe.warn(it),null)}))()}markAsRead(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(Pe.warn(it),null)}))()}getTickets(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(Pe.warn(it),null)}))()}requestRestoreLink(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(Pe.warn(it),null)}))()}restoreFromToken(i){var e=this;return ie((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(Pe.warn(it),null)}))()}restoreFromUrlToken(){var i=this;return ie((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(Pe.warn(it),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}En(){var i;(i=this._conversationsManager)==null||i.setIdentity()}Rn(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Nu={logs:class{constructor(i){var e;this.rl=!1,this.il=!1,this.Ge=Y("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var t,s;this.Hs=0,(t=this.ol)==null||t.onReconnect(),(s=this.al)==null||s.onReconnect()},this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.rl=!0),g&&te(g,"online",this.sl)}ll(i,e,t,s){var r,n=(function(a,o){var l,u,h,c,p,v,d,f=(l=a?.flushIntervalMs)!==null&&l!==void 0?l:3e3,m=(u=a?.maxBufferSize)!==null&&u!==void 0?u:100,_=o!=null&&o.consoleCapture?void 0:(h=a?.maxLogsPerInterval)!==null&&h!==void 0?h:1e3,k=w(_)?Math.max(m,2048):Math.max(m,_),E=a?.resourceAttributes;return{serviceName:(c=(p=E?.["service.name"])!==null&&p!==void 0?p:a?.serviceName)!==null&&c!==void 0?c:o?.serviceNameDefault,serviceVersion:(v=E?.["service.version"])!==null&&v!==void 0?v:a?.serviceVersion,environment:(d=E?.["deployment.environment"])!==null&&d!==void 0?d:a?.environment,resourceAttributes:E,beforeSend:a?.beforeSend,flushIntervalMs:f,maxBufferSize:m,maxQueueSize:k,maxBatchRecordsPerPost:100,rateCapWindowMs:f,maxLogsPerInterval:_,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new Uo(this.ul(i,e),n,this.Ge,(()=>this.hl()),(a=>a()),void 0,s),n]}dl(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.ol||this.cl!==e){var t;(t=this.ol)==null||t.reset(),this.cl=e;var s=this.ll((()=>this.Gr),(r=>{this.Gr=r}));this.ol=s[0],this.vl=s[1]}return this.ol}fl(){var i,e=(i=this._instance)==null||(i=i.config)==null?void 0:i.logs;if(!this.al||this.pl!==e){var t;(t=this.al)==null||t.reset(),this.pl=e;var s=this.ll((()=>this.nl),(r=>{this.nl=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},An);this.al=s[0],this.gl=s[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e;if(i.ok){var t=(e=i.config.logs)==null?void 0:e.captureConsoleLogs;!O(t)&&t&&(this.rl=!0,this.loadIfEnabled())}}reset(){var i,e;this.Gr=[],(i=this.ol)==null||i.reset(),this.nl=[],(e=this.al)==null||e.reset(),this.Hs=0}captureLog(i){this.dl().captureLog(i)}le(i){this.fl().captureLog(i)}get logger(){return this.ml||(this.ml={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.ml}flushLogs(i){i?this.yl(i):(this.ol&&this.ol.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))),this.al&&this.al.flush().catch((e=>this.Ge.error("PostHog logs flush failed:",e))))}loadIfEnabled(){if(this.rl&&!this.il){var i=$?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.Ge.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(br)}else this.Ge.error("PostHog Extensions not found.")}}ul(i,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:s=>s===He.LogsQueue?i():void 0,setPersistedProperty(s,r){var n;s===He.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},Tt:s=>this.Tt(s),getLibraryId:()=>q.LIB_NAME,getLibraryVersion:()=>q.LIB_VERSION}}Tt(i){return new Promise((e=>{if(Ba(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var t=!1,s=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout((()=>s({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:i,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this._l(a),a>=200&&300>a)s({kind:"ok"});else if(a===413)s({kind:"too-large"});else if(a!==0&&a!==429&&500>a)s({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;s({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}_l(i){(i!==0||this._instance.__loaded)&&(this.Hs=Ua(i,this.Hs,3,(()=>this.Ge.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."))))}yl(i){this.Gr.length>0&&this.wl(i,this.Gr,this.vl,q.LIB_NAME,(e=>{this.Gr=e})),this.nl.length>0&&this.wl(i,this.nl,this.gl,An,(e=>{this.nl=e}))}wl(i,e,t,s,r){if(e.length!==0){var n=e.map((o=>o.record));r([]);var a=da(n,ca(t,q.LIB_NAME,q.LIB_VERSION),s,q.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:a,compression:"best-available",batchKey:"logs",transport:i})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var t=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=t.windowId,r=t.sessionStartTimestamp,n=t.lastActivityTimestamp;e.sessionId=t.sessionId,e.windowId=s,O(r)||(e.sessionStartTimestamp=r),O(n)||(e.lastActivityTimestamp=n)}if($!=null&&(i=$.location)!=null&&i.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Ye($.location.href):$.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},ju={metrics:class{constructor(i){this.Ge=Y("[metrics]"),this._instance=i}initialize(){}dl(){var i,e,t=(i=this._instance)==null||(i=i.config)==null?void 0:i.metrics;return this.ol&&this.cl===t||((e=this.ol)==null||e.reset(),this.cl=t,this.ol=new Vo(this.ul(),(function(s){var r,n,a,o,l,u=s?.resourceAttributes;return{serviceName:(r=u?.["service.name"])!==null&&r!==void 0?r:s?.serviceName,serviceVersion:(n=u?.["service.version"])!==null&&n!==void 0?n:s?.serviceVersion,environment:(a=u?.["deployment.environment"])!==null&&a!==void 0?a:s?.environment,resourceAttributes:u,beforeSend:s?.beforeSend,flushIntervalMs:(o=s?.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.Ge)),this.ol}count(i,e,t){e===void 0&&(e=1),this.dl().count(i,e,t)}gauge(i,e,t){this.dl().gauge(i,e,t)}histogram(i,e,t){this.dl().histogram(i,e,t)}flush(i){if(!this.ol)return Promise.resolve();if(i){var e=this.ol.drainWindow();return e&&this.Bt(e,i),Promise.resolve()}return this.ol.flush().catch((t=>this.Ge.error("PostHog metrics flush failed:",t)))}reset(){var i;(i=this.ol)==null||i.reset()}ul(){var i=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},Bt:t=>e.Bt(t),getLibraryId:()=>q.LIB_NAME,getLibraryVersion:()=>q.LIB_VERSION}}Bt(i,e){return new Promise((t=>{var s=!1,r=a=>{s||(s=!0,clearTimeout(n),t(a))},n=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(y({method:"POST",url:this.xl(),data:i,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var o=a.statusCode;if(o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==429&&500>o)r({kind:"fatal",error:new Error("metrics request failed with status "+o)});else{var l;r({kind:"retry-later",error:(l=a.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+o)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},qu=y({},Yi,Fu,$u,Iu,Mu,Ru,Ou,Cu,Au,Lu,Du,Nu,ju);Te.__defaultExtensionClasses=y({},qu);var Hu=(function(){q.SDK_DIST_CHANNEL="npm";var i=Zt[_t]=new Te;return(function(){function e(){e.done||(e.done=!0,yo=!1,z(Zt,(function(t){t._dom_loaded()})))}P!=null&&P.addEventListener?P.readyState==="complete"?e():te(P,"DOMContentLoaded",e,{capture:!1}):g&&x.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i})();export{pe as Compression,sr as DisplaySurveyType,Te as PostHog,Wl as ProductTourEventName,un as ProductTourEventProperties,Ue as SurveyEventName,vs as SurveyEventProperties,Ct as SurveyEventType,ps as SurveyType,Hu as default,Hu as posthog};