tokentracker-cli 0.97.2 → 0.99.0

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 (137) hide show
  1. package/dashboard/dist/assets/AchievementBadge-kRsjlB3p.js +1 -0
  2. package/dashboard/dist/assets/{AchievementsPage-CnkSNpJx.js → AchievementsPage-C3xybY0k.js} +2 -2
  3. package/dashboard/dist/assets/AchievementsSection-y5mok2w0.js +1 -0
  4. package/dashboard/dist/assets/{BadgeDetailModal-BJBrgn24.js → BadgeDetailModal-IFLXYuKp.js} +1 -1
  5. package/dashboard/dist/assets/{BotAnimated-BJM20N9T.js → BotAnimated-D6x0PDt2.js} +1 -1
  6. package/dashboard/dist/assets/{Card-BRWOMoBk.js → Card-CiKwEyVu.js} +1 -1
  7. package/dashboard/dist/assets/{ClawdAnimated-CtX8cne4.js → ClawdAnimated-BQFcAIOy.js} +2 -2
  8. package/dashboard/dist/assets/CommandPalette-BvpX8PM_.js +1 -0
  9. package/dashboard/dist/assets/CommunityStatsModal-D5rNlwfO.js +1 -0
  10. package/dashboard/dist/assets/{ConfirmModal-ZZXg_OLV.js → ConfirmModal-CR0Evu8-.js} +1 -1
  11. package/dashboard/dist/assets/{Controls-VDvgw_ed.js → Controls-lyLUkbJW.js} +1 -1
  12. package/dashboard/dist/assets/DashboardPage-X8CLr_au.js +1 -0
  13. package/dashboard/dist/assets/{DevicePage-CP5m8azV.js → DevicePage-RCIANm45.js} +1 -1
  14. package/dashboard/dist/assets/{DialogClose-8pTCallP.js → DialogClose-Bplj_718.js} +1 -1
  15. package/dashboard/dist/assets/DialogDescription-C2EzE7DU.js +1 -0
  16. package/dashboard/dist/assets/{DialogTitle-BWYdq4TT.js → DialogTitle-Ckzf1tdi.js} +1 -1
  17. package/dashboard/dist/assets/{FadeIn-CEJfaKnL.js → FadeIn-C2Jqe95f.js} +1 -1
  18. package/dashboard/dist/assets/{HeaderGithubStar-Bg2vijF8.js → HeaderGithubStar-DgE7Cd5u.js} +1 -1
  19. package/dashboard/dist/assets/{HoverTooltip-B03JQ3PO.js → HoverTooltip-CEmo0N-P.js} +1 -1
  20. package/dashboard/dist/assets/{IpCheckPage-DYZucBOf.js → IpCheckPage-BwkpsLaF.js} +1 -1
  21. package/dashboard/dist/assets/{LandingPage-m-byhnVx.js → LandingPage-CA2klwbE.js} +2 -2
  22. package/dashboard/dist/assets/{LeaderboardAvatar-JtGhJC1s.js → LeaderboardAvatar-B_PUenGZ.js} +1 -1
  23. package/dashboard/dist/assets/LeaderboardPage-D6HGW3jX.js +2 -0
  24. package/dashboard/dist/assets/{LeaderboardProfileModal-Cm4DDrcY.js → LeaderboardProfileModal-Bfo1dSsS.js} +4 -4
  25. package/dashboard/dist/assets/{LeaderboardProfilePage-bKbMm856.js → LeaderboardProfilePage-2OqwrqOs.js} +1 -1
  26. package/dashboard/dist/assets/{LimitsPage-B271tZOj.js → LimitsPage-BHrkLXHZ.js} +5 -5
  27. package/dashboard/dist/assets/{LocalOnlyNotice-DKIxuBP0.js → LocalOnlyNotice-C45MmWYt.js} +1 -1
  28. package/dashboard/dist/assets/LoginCard-BikBibax.js +1 -0
  29. package/dashboard/dist/assets/{LoginModal-PxTgIoLk.js → LoginModal-D0Aq85Zg.js} +1 -1
  30. package/dashboard/dist/assets/{LoginPage-uEUnU7NP.js → LoginPage-B-kQaDQ_.js} +1 -1
  31. package/dashboard/dist/assets/PetPage-ZgPREiwD.js +1 -0
  32. package/dashboard/dist/assets/{PopoverPopup-DWIMb8D6.js → PopoverPopup-eQgg3h1i.js} +1 -1
  33. package/dashboard/dist/assets/{ProviderIcon-DqqwXu3b.js → ProviderIcon-nDBPxn0N.js} +1 -1
  34. package/dashboard/dist/assets/{ResetPasswordPage-BVuJTR9A.js → ResetPasswordPage-CjsOtiGr.js} +1 -1
  35. package/dashboard/dist/assets/{SegmentedControl-iHtWKWtc.js → SegmentedControl-6NcttkEH.js} +1 -1
  36. package/dashboard/dist/assets/{Select-Cr9wq8mD.js → Select-CzEhPICe.js} +1 -1
  37. package/dashboard/dist/assets/{SelectItemText-BWnP4yuq.js → SelectItemText-BwvzfXwj.js} +1 -1
  38. package/dashboard/dist/assets/{ServiceStatusPage-DLuiUUYV.js → ServiceStatusPage-C35wpxrT.js} +1 -1
  39. package/dashboard/dist/assets/{SessionsPage-CBAH4ieT.js → SessionsPage-a30adkhf.js} +2 -2
  40. package/dashboard/dist/assets/SettingsPage-C_7ZPBUF.js +2 -0
  41. package/dashboard/dist/assets/SkillsPage-DsxkFnrV.js +1 -0
  42. package/dashboard/dist/assets/TokenGalaxy-D_bXRotA.js +4426 -0
  43. package/dashboard/dist/assets/ToolbarRootContext-CL7ma7ba.js +1 -0
  44. package/dashboard/dist/assets/{TrendMonitor-CCzwGDst.js → TrendMonitor-QZBF2IEY.js} +1 -1
  45. package/dashboard/dist/assets/{WidgetsPage-CcWCidAd.js → WidgetsPage-CWlxR0H-.js} +1 -1
  46. package/dashboard/dist/assets/{WrappedPage-B6dn8eyh.js → WrappedPage-D8XQ72nF.js} +1 -1
  47. package/dashboard/dist/assets/__vite-browser-external-CTGqjrCe.js +45 -0
  48. package/dashboard/dist/assets/{agent-logos-Dh2k8E_G.js → agent-logos-BscA25fS.js} +1 -1
  49. package/dashboard/dist/assets/arrow-up-right-DTxCEGbR.js +1 -0
  50. package/dashboard/dist/assets/check-CCEoh2wj.js +1 -0
  51. package/dashboard/dist/assets/{composite-CSBcryzA.js → composite-B2s880f5.js} +1 -1
  52. package/dashboard/dist/assets/copy-CJVQglwG.js +1 -0
  53. package/dashboard/dist/assets/download-Cn-OpYm6.js +1 -0
  54. package/dashboard/dist/assets/external-link-BnYlUn56.js +1 -0
  55. package/dashboard/dist/assets/flame-D4yFLV1L.js +1 -0
  56. package/dashboard/dist/assets/{format-tokens-CqiCmYtk.js → format-tokens-CBUNbBvp.js} +1 -1
  57. package/dashboard/dist/assets/{icons-DD8OvYVG.js → icons-CcgNgAvb.js} +1 -1
  58. package/dashboard/dist/assets/{index-DLLivlEh.js → index-CTjeDkbu.js} +1 -1
  59. package/dashboard/dist/assets/{index-21lDN4rA.js → index-CkELwUyg.js} +1 -1
  60. package/dashboard/dist/assets/{index-Cm8jn8Va.js → index-ZWeEKbo-.js} +1 -1
  61. package/dashboard/dist/assets/info-DoehRSQU.js +1 -0
  62. package/dashboard/dist/assets/link-2-D8xSsPqy.js +1 -0
  63. package/dashboard/dist/assets/loader-circle-DMu0-X5r.js +1 -0
  64. package/dashboard/dist/assets/maximize-2-DLyYsZvE.js +1 -0
  65. package/dashboard/dist/assets/{modifiers.esm-Cwj0l9Zb.js → modifiers.esm-Dm5Xy2jA.js} +1 -1
  66. package/dashboard/dist/assets/module-B5tW98jG.js +3 -0
  67. package/dashboard/dist/assets/monitor-smartphone-5uZGQNGJ.js +1 -0
  68. package/dashboard/dist/assets/plus-8fnU0dkt.js +1 -0
  69. package/dashboard/dist/assets/provider-display-B3ed-pSc.js +42 -0
  70. package/dashboard/dist/assets/{react-xH4nkyuj.js → react-Gft01KYk.js} +1 -1
  71. package/dashboard/dist/assets/search-jqzJg2kG.js +1 -0
  72. package/dashboard/dist/assets/{skills-api-B7lb1cjO.js → skills-api-Bwn_xcHV.js} +1 -1
  73. package/dashboard/dist/assets/{sortable.esm-BUPRsWL6.js → sortable.esm-CYjzLCp7.js} +1 -1
  74. package/dashboard/dist/assets/{store-DneqOW0h.js → store-CgJHe9jU.js} +1 -1
  75. package/dashboard/dist/assets/terminal-CZ5j8yEQ.js +1 -0
  76. package/dashboard/dist/assets/trash-DtMLjI_S.js +1 -0
  77. package/dashboard/dist/assets/{use-community-stats-DB98TGn9.js → use-community-stats-Px3dHGlR.js} +1 -1
  78. package/dashboard/dist/assets/{use-latest-request-guard-DK3KulKx.js → use-latest-request-guard-B7Vw4Wsd.js} +1 -1
  79. package/dashboard/dist/assets/{use-limits-display-prefs-BACCRUMZ.js → use-limits-display-prefs-DWWrcMPi.js} +1 -1
  80. package/dashboard/dist/assets/{use-ordered-list-DnKFdI9a.js → use-ordered-list-CevbB79U.js} +1 -1
  81. package/dashboard/dist/assets/use-reduced-motion-CCuEY-79.js +1 -0
  82. package/dashboard/dist/assets/use-session-efficiency-pref-DoIaI0vm.js +1 -0
  83. package/dashboard/dist/assets/{use-transform-DweC2iKa.js → use-transform-qRwUetOk.js} +1 -1
  84. package/dashboard/dist/assets/{use-usage-limits-CN5xWIBs.js → use-usage-limits-DlP7yg78.js} +1 -1
  85. package/dashboard/dist/assets/{useCurrency-CFjvWawL.js → useCurrency-DRUe8YoY.js} +1 -1
  86. package/dashboard/dist/assets/{useTokenFormat-Cf81HqWi.js → useTokenFormat-CmLbznUC.js} +1 -1
  87. package/dashboard/dist/assets/zap-CS80c_uN.js +1 -0
  88. package/dashboard/dist/index.html +1 -1
  89. package/dashboard/dist/ip-check.html +1 -1
  90. package/dashboard/dist/leaderboard.html +1 -1
  91. package/dashboard/dist/share.html +1 -1
  92. package/package.json +1 -1
  93. package/src/commands/sync.js +15 -4
  94. package/src/lib/cloud-account.js +120 -1
  95. package/src/lib/grok-limits.js +37 -0
  96. package/src/lib/heatmap-compact.js +114 -0
  97. package/src/lib/local-api.js +11 -10
  98. package/src/lib/opencode-config.js +20 -1
  99. package/src/lib/pricing/curated-overrides.json +22 -0
  100. package/src/lib/pricing/index.js +2 -0
  101. package/src/lib/pricing/seed-snapshot.json +1 -1
  102. package/src/lib/rollout.js +1085 -146
  103. package/src/lib/usage-limits.js +7 -1
  104. package/dashboard/dist/assets/AchievementBadge-Bf2T612R.js +0 -1
  105. package/dashboard/dist/assets/AchievementsSection-CPwsy04Y.js +0 -1
  106. package/dashboard/dist/assets/CommandPalette-C8BwOnSn.js +0 -1
  107. package/dashboard/dist/assets/CommunityStatsModal-BGMbgSjq.js +0 -1
  108. package/dashboard/dist/assets/DashboardPage-BcJGzQWK.js +0 -1
  109. package/dashboard/dist/assets/DialogDescription-DRQEfAWH.js +0 -1
  110. package/dashboard/dist/assets/LeaderboardPage-vVDKFLhl.js +0 -2
  111. package/dashboard/dist/assets/LoginCard-DA46RXDo.js +0 -1
  112. package/dashboard/dist/assets/PetPage-DDPZtxMw.js +0 -1
  113. package/dashboard/dist/assets/SettingsPage-Djku-i8K.js +0 -2
  114. package/dashboard/dist/assets/SkillsPage-DtBRoB8R.js +0 -1
  115. package/dashboard/dist/assets/TokenGalaxy-nvyPu5eV.js +0 -4314
  116. package/dashboard/dist/assets/ToolbarRootContext-DhpHv55w.js +0 -1
  117. package/dashboard/dist/assets/__vite-browser-external-sJsF0ioo.js +0 -45
  118. package/dashboard/dist/assets/arrow-up-right-BLDQog1A.js +0 -1
  119. package/dashboard/dist/assets/check-DNq_ySSn.js +0 -1
  120. package/dashboard/dist/assets/copy-DHRrNtRb.js +0 -1
  121. package/dashboard/dist/assets/download-CluyujgG.js +0 -1
  122. package/dashboard/dist/assets/external-link-Cf12tdLf.js +0 -1
  123. package/dashboard/dist/assets/flame-CJEYinxo.js +0 -1
  124. package/dashboard/dist/assets/info-dv3Y0z8Q.js +0 -1
  125. package/dashboard/dist/assets/link-2-CWHBxVuk.js +0 -1
  126. package/dashboard/dist/assets/loader-circle-9l5p9Dwa.js +0 -1
  127. package/dashboard/dist/assets/maximize-2-DQ2t3MJB.js +0 -1
  128. package/dashboard/dist/assets/module-DUSXqJtA.js +0 -3
  129. package/dashboard/dist/assets/monitor-smartphone-B-9at3iV.js +0 -1
  130. package/dashboard/dist/assets/plus-C_CTQjDD.js +0 -1
  131. package/dashboard/dist/assets/provider-display-XJQod7k9.js +0 -42
  132. package/dashboard/dist/assets/search-Ut41Fw1G.js +0 -1
  133. package/dashboard/dist/assets/terminal-DPQyZyHR.js +0 -1
  134. package/dashboard/dist/assets/trash-CVdV1bBR.js +0 -1
  135. package/dashboard/dist/assets/use-reduced-motion-BfdrKOsS.js +0 -1
  136. package/dashboard/dist/assets/use-session-efficiency-pref-BTm6RoSm.js +0 -1
  137. package/dashboard/dist/assets/zap-Vx_j5oJN.js +0 -1
@@ -1,3 +0,0 @@
1
- var _="u">typeof window?window:void 0,Ie="u">typeof globalThis?globalThis:_,be=Ie?.navigator,E=Ie?.document,ae=Ie?.location,Gr=Ie?.fetch,rr=Ie!=null&&Ie.XMLHttpRequest&&"withCredentials"in new Ie.XMLHttpRequest?Ie.XMLHttpRequest:void 0,_n=Ie?.AbortController,Cl=Ie?.CompressionStream,Ce=be?.userAgent;function La(){return!(!_||_.navigator.onLine===!1)}var is=typeof globalThis<"u"?globalThis:_;is&&typeof self>"u"&&(is.self=is),is&&typeof File>"u"&&(is.File=function(){});var O=_??{},Z={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};function mn(s,e,t,i,r,n,a){try{var o=s[n](a),l=o.value}catch(h){return void t(h)}o.done?e(l):Promise.resolve(l).then(i,r)}function X(s){return function(){var e=this,t=arguments;return new Promise((function(i,r){var n=s.apply(e,t);function a(l){mn(n,i,r,a,o,"next",l)}function o(l){mn(n,i,r,a,o,"throw",l)}a(void 0)}))}}function w(){return w=Object.assign?Object.assign.bind():function(s){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},w.apply(null,arguments)}function Na(s,e){if(s==null)return{};var t={};for(var i in s)if({}.hasOwnProperty.call(s,i)){if(e.indexOf(i)!==-1)continue;t[i]=s[i]}return t}var Al=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],yn=function(s,e){if(e===void 0&&(e=[]),!s)return!1;var t=s.toLowerCase();return Al.concat(e).some((i=>{var r=i.toLowerCase();return t.indexOf(r)!==-1}))};function M(s,e){return s.indexOf(e)!==-1}var wi=function(s){return s.trim()},nr=function(s){return s.replace(/^\$/,"")};function ja(s){var e,t=[];return(e=JSON.stringify(s,(function(i,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;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 Xe=(function(s){return s.AnonymousId="anonymous_id",s.DistinctId="distinct_id",s.Props="props",s.EnablePersonProcessing="enable_person_processing",s.PersonMode="person_mode",s.FeatureFlagDetails="feature_flag_details",s.FeatureFlags="feature_flags",s.FeatureFlagPayloads="feature_flag_payloads",s.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",s.BootstrapFeatureFlags="bootstrap_feature_flags",s.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",s.OverrideFeatureFlags="override_feature_flags",s.Queue="queue",s.AiQueue="ai_queue",s.AiCaptureQueue="ai_capture_queue",s.LogsQueue="logs_queue",s.OptedOut="opted_out",s.SessionId="session_id",s.SessionStartTimestamp="session_start_timestamp",s.SessionLastTimestamp="session_timestamp",s.PersonProperties="person_properties",s.GroupProperties="group_properties",s.InstalledAppBuild="installed_app_build",s.InstalledAppVersion="installed_app_version",s.SessionReplay="session_replay",s.PushRegistered="push_registered",s.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",s.SurveyLastSeenDate="survey_last_seen_date",s.SurveysSeen="surveys_seen",s.Surveys="surveys",s.RemoteConfig="remote_config",s.FlagsEndpointWasHit="flags_endpoint_was_hit",s.DeviceId="device_id",s})({}),ar=(function(s){return s.GZipJS="gzip-js",s.Base64="base64",s})({}),Tl=["$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"],Rl=["token"],qa=Object.prototype,Ba=qa.hasOwnProperty,xi=qa.toString,C=Array.isArray||function(s){return xi.call(s)==="[object Array]"},Fe=s=>typeof s=="function",q=s=>s===Object(s)&&!C(s),Ne=s=>{if(q(s)){for(var e in s)if(Ba.call(s,e))return!1;return!0}return!1},b=s=>s===void 0,B=s=>xi.call(s)=="[object String]",_s=s=>B(s)&&s.trim().length===0,he=s=>s===null,L=s=>b(s)||he(s),ce=s=>xi.call(s)=="[object Number]"&&s==s,nt=s=>ce(s)&&s>0,Oe=s=>xi.call(s)==="[object Boolean]",Ml=s=>s instanceof FormData,Dl=s=>M(Tl,s),Ll=s=>M(Rl,s);function Ha(s){return s===null||typeof s!="object"}function Zs(s,e){return{}.toString.call(s)==="[object "+e+"]"}function Kr(s){switch({}.toString.call(s)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Va(s,Error)}}function Jr(s){return"u">typeof Event&&Va(s,Event)}function Va(s,e){try{return s instanceof e}catch{return!1}}var Nl=[!0,"true",1,"1","yes"],Fi=s=>M(Nl,s),jl=[!1,"false",0,"0","no"];function tt(s,e,t,i,r){return e>t&&(i.warn("min cannot be greater than max."),e=t),ce(s)?s>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>s?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):s:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),tt(r??t,e,t,i))}class ql{constructor(e){this.C={},this.I=e.I,this.R=tt(e.bucketSize,0,100,e.A),this.O=tt(e.refillRate,0,this.R,e.A),this.N=tt(e.refillInterval,0,864e5,e.A)}F(e,t){var i=Math.floor((t-e.lastAccess)/this.N);i>0&&(e.tokens=Math.min(e.tokens+i*this.O,this.R),e.lastAccess=e.lastAccess+i*this.N)}consumeRateLimit(e){var t,i=Date.now(),r=String(e),n=this.C[r];return n?this.F(n,i):this.C[r]=n={tokens:this.R,lastAccess:i},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.I)==null||t.call(this,e)),n.tokens===0)}stop(){this.C={}}}var qe="Mobile",Qs="iOS",ht="Android",Jt="Tablet",za=ht+" "+Jt,Ua="iPad",Wa="Apple",Ga=Wa+" Watch",ms="Safari",Yt="BlackBerry",Ka="Samsung",Ja=Ka+"Browser",Ya=Ka+" Internet",It="Chrome",Bl=It+" OS",Za=It+" "+Qs,Yr="Internet Explorer",Qa=Yr+" "+qe,Zr="Opera",Hl=Zr+" Mini",Qr="Edge",Xa="Microsoft "+Qr,zt="Firefox",eo=zt+" "+Qs,Es="Nintendo",Ss="PlayStation",Ut="Xbox",to=ht+" "+qe,so=qe+" "+ms,vs="Windows",or=vs+" Phone",bn="Nokia",lr="Ouya",io="Generic",Vl=io+" "+qe.toLowerCase(),ro=io+" "+Jt.toLowerCase(),ur="Konqueror",no="Oculus Browser",Xs="Vivaldi",ao="Yandex",ei="Whale",hr="DuckDuckGo",oo="Pale Moon",ti="Waterfox",ys="Brave",si="Claude",ii="Codex",ri="ChatGPT",lo="Google Search App",re="(\\d+(\\.\\d+)?)",Ii=new RegExp("Version/"+re),Oi=new RegExp("("+si+"|"+ii+"|"+ri+")\\/"+re),zl=new RegExp(Ut,"i"),Ul=new RegExp(Ss+" \\w+","i"),Wl=new RegExp(Es+" \\w+","i"),Xr=new RegExp(Yt+"|PlayBook|BB10","i"),Gl={"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"},uo=function(s,e,t,i){e=e||"";var r=(function(n){return n!=null&&n.brave?ys:null})(t);return r||(i!=null&&i.detectGoogleSearchApp&&M(s,"GSA/")?lo:M(s," OPR/")&&M(s,"Mini")?Hl:M(s," OPR/")?Zr:Xr.test(s)?Yt:M(s,"IE"+qe)||M(s,"WPDesktop")?Qa:M(s,"OculusBrowser")?no:M(s,Ja)?Ya:M(s,Qr)||M(s,"Edg/")?Xa:M(s,Xs+"/")?Xs:M(s,"YaBrowser/")?ao:M(s,ei+"/")?ei:M(s,hr+"/")||M(s,"Ddg/")?hr:M(s,si+"/")?si:M(s,ii+"/")?ii:M(s,ri+"/")?ri:M(s,"FBIOS")?"Facebook "+qe:M(s,"UCWEB")||M(s,"UCBrowser")?"UC Browser":M(s,"CriOS")?Za:M(s,"CrMo")||M(s,It)?It:M(s,ht)&&M(s,ms)?to:M(s,"FxiOS")?eo:M(s.toLowerCase(),ur.toLowerCase())?ur:M(s,ys+"/")?ys:((n,a)=>a&&M(a,Wa)||(function(o){return M(o,ms)&&!M(o,It)&&!M(o,ht)})(n))(s,e)?M(s,qe)?so:ms:M(s,"PaleMoon/")?oo:M(s,ti+"/")?ti:M(s,zt)?zt:M(s,"MSIE")||M(s,"Trident/")?Yr:M(s,"Gecko")?zt:"")},Kl={[Qa]:[new RegExp("rv:"+re)],[Xa]:[new RegExp(Qr+"?\\/"+re)],[It]:[new RegExp("("+It+"|CrMo)\\/"+re)],[Za]:[new RegExp("CriOS\\/"+re)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+re)],[ms]:[Ii],[so]:[Ii],[Zr]:[new RegExp("(Opera|OPR)\\/"+re)],[zt]:[new RegExp(zt+"\\/"+re)],[eo]:[new RegExp("FxiOS\\/"+re)],[ur]:[new RegExp("Konqueror[:/]?"+re,"i")],[Yt]:[new RegExp(Yt+" "+re),Ii],[to]:[new RegExp("android\\s"+re,"i")],[Ya]:[new RegExp(Ja+"\\/"+re)],[no]:[new RegExp("OculusBrowser\\/"+re)],[Xs]:[new RegExp(Xs+"\\/"+re)],[ao]:[new RegExp("YaBrowser\\/"+re)],[ei]:[new RegExp(ei+"\\/"+re)],[ys]:[new RegExp(ys+"\\/"+re)],[si]:[Oi],[ii]:[Oi],[ri]:[Oi],[hr]:[new RegExp("(DuckDuckGo|Ddg)\\/"+re)],[oo]:[new RegExp("PaleMoon\\/"+re)],[ti]:[new RegExp(ti+"\\/"+re)],[lo]:[new RegExp("GSA\\/"+re)],[Yr]:[new RegExp("(rv:|MSIE )"+re)],Mozilla:[new RegExp("rv:"+re)]},Jl=function(s,e,t,i){var r=uo(s,e,t,i),n=Kl[r];if(b(n))return null;for(var a=0;n.length>a;a++){var o=s.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},wn=[[new RegExp(Ut+"; "+Ut+" (.*?)[);]","i"),s=>[Ut,s&&s[1]||""]],[new RegExp(Es,"i"),[Es,""]],[new RegExp(Ss,"i"),[Ss,""]],[Xr,[Yt,""]],[new RegExp(vs,"i"),(s,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[or,""];if(new RegExp(qe).test(e)&&!/IEMobile\b/.test(e))return[vs+" "+qe,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=Gl[t[1]]||"";return/arm/i.test(e)&&(i="RT"),[vs,i]}return[vs,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,s=>s&&s[3]?[Qs,[s[3],s[4],s[5]||"0"].join(".")]:[Qs,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,s=>{var e="";return s&&s.length>=3&&(e=b(s[2])?s[3]:s[2]),["watchOS",e]}],[new RegExp("("+ht+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ht+")","i"),s=>s&&s[2]?[ht,[s[2],s[3],s[4]||"0"].join(".")]:[ht,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,s=>{var e=["Mac OS X",""];return s&&s[1]&&(e[1]=[s[1],s[2],s[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Bl,""]],[/Linux|debian/i,["Linux",""]]],ho=function(s){for(var e=0;wn.length>e;e++){var t=wn[e],i=t[1],r=t[0].exec(s),n=r&&(Fe(i)?i(r,s):i);if(n)return n}return["",""]},xn=function(s){return Wl.test(s)?Es:Ul.test(s)?Ss:zl.test(s)?Ut:new RegExp(lr,"i").test(s)?lr:new RegExp("("+or+"|WPDesktop)","i").test(s)?or:/iPad/.test(s)?Ua:/iPod/.test(s)?"iPod Touch":/iPhone/.test(s)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(s)?Ga:Xr.test(s)?Yt:/(kobo)\s(ereader|touch)/i.test(s)?"Kobo":new RegExp(bn,"i").test(s)?bn:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(s)||/(kf[a-z]+)( bui|\)).+silk\//i.test(s)?"Kindle Fire":/(Android|ZTE)/i.test(s)?new RegExp(qe).test(s)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(s)||/pixel[\daxl ]{1,6}/i.test(s)&&!/pixel c/i.test(s)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(s)||/lmy47v/i.test(s)&&!/QTAQZ3/i.test(s)?ht:za:new RegExp("(pda|"+qe+")","i").test(s)?Vl:new RegExp(Jt,"i").test(s)&&!new RegExp(Jt+" pc","i").test(s)?ro:""},Yl=20,co=1e3,Zl=1e4,Ql="[Circular]",cr="[Truncated]",ki="[Unserializable]",Xl="[Function]";function Wt(s){for(var e="",t=0;s.length>t;t++){var i=s.charCodeAt(t);if(55296>i||i>56319)e+=56320>i||i>57343?s[t]:"�";else{var r=s.charCodeAt(t+1);56320>r||r>57343?e+="�":(e+=s[t]+s[t+1],t++)}}return e}var Cs,kn,$i,eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function En(s,e){return typeof(t=s)=="string"&&eu.test(t)?s:e();var t}function vo(s,e){var t=new Error(e);try{Object.defineProperty(t,"name",{value:s,writable:!0,enumerable:!0,configurable:!0})}catch{}return t}function _t(s){return s&&s.split("#")[0]}function en(s,e){var t=setTimeout(s,e);return t?.unref&&t?.unref(),t}function Sn(s,e,t){return po.apply(this,arguments)}function po(){return(po=X((function*(s,e,t){var i;try{return yield Promise.race([s,new Promise(((r,n)=>{i=en((()=>{try{t?.(),r()}catch(a){n(a)}}),e)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}function tu(s){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return $i&&t.length===kn||(kn=t.length,$i=t.reduce(((i,r)=>{Cs||(Cs={});var n=Cs[r];if(n)i[n[0]]=n[1];else for(var a=s(r),o=a.length-1;o>=0;o--){var l=a[o],h=l?.filename,u=e[r];if(h&&u){i[h]=u,Cs[r]=[h,u];break}}return i}),{})),$i}}class su{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return X((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&C(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.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 i,r;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),w({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return X((function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i}))()}convertToExceptionList(e,t){var i,r,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"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,w({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:tu(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return w({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,i),next:n=>r(n,i+1)})}}var Zt="?";function dr(s,e,t,i,r){var n={platform:s,filename:e,function:t==="<anonymous>"?Zt:t,in_app:!!e&&!e.startsWith("webkit-masked-url://")&&e!=="<anonymous>"};return b(i)||(n.lineno=i),b(r)||(n.colno=r),n}var fo=(s,e)=>{var t=s.indexOf("safari-extension")!==-1,i=s.indexOf("safari-web-extension")!==-1;return t||i?[s.indexOf("@")!==-1?s.split("@")[0]:Zt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[s,e]},iu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ru=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nu=/\((\S*)(?::(\d+))(?::(\d+))\)/,au=(s,e)=>{var t=iu.exec(s);if(t)return dr(e,t[1],Zt,+t[2],+t[3]);var i=ru.exec(s);if(i){if(i[2]&&i[2].indexOf("eval")===0){var r=nu.exec(i[2]);r&&(i[2]=r[1],i[3]=r[2],i[4]=r[3])}var n=fo(i[1]||Zt,i[2]);return dr(e,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},ou=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,uu=(s,e)=>{var t=ou.exec(s);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=lu.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],n=t[1]||Zt,a=fo(n,r);return dr(e,r=a[1],n=a[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Pn=/\(error: (.*)\)/;class hu{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=B(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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 Zs(e,"DOMException")}isDOMError(e){return Zs(e,"DOMError")}}class cu{match(e){return Kr(e)}coerce(e,t){var i,r=this.getStack(e),n=r===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:r??((i=t.syntheticException)==null?void 0:i.stack),cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class du{match(e){return!!Zs(e,"ErrorEvent")&&(e.error!=null||this.Vi(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);var r=t.apply(e.message);return w({},r,{stack:(i=this.Zi(e))!==null&&i!==void 0?i:r.stack,synthetic:!0})}Vi(e){return B(e.message)&&e.message.length>0}Zi(e){var t,i,r=e,n=(t=r.lineno)!==null&&t!==void 0?t:0,a=(i=r.colno)!==null&&i!==void 0?i:0;if(B(r.filename)&&r.filename.length!==0&&n!==0)return`Error
2
- at `+r.filename+":"+n+":"+a}}var vu=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class pu{match(e){return typeof e=="string"}coerce(e,t){var i,r=this.getInfos(e),n=r[0],a=r[1];return{type:n??"Error",value:a??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(vu);return r&&(t=r[1],i=r[2]),[t,i]}}var fu=["fatal","error","warning","log","info","debug"];function go(s,e){e===void 0&&(e=40);var t=Object.keys(s);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var r=t.slice(0,i).join(", ");if(e>=r.length)return i===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class gu{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,r,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Jr(e))return e.constructor.name;var t="name"in e?e.name:void 0;return B(t)&&!_s(t)?t:"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 i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+go(e)}isSeverityLevel(e){return B(e)&&!_s(e)&&fu.indexOf(e)>=0}getStack(e){try{return B(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:B(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(Kr(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class _u{match(e){return Jr(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+go(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class mu{match(e){return Ha(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class yu{match(e){return Zs(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Jr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return Ha(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(i=t.syntheticException)==null?void 0:i.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 ni="$message",ai="$timestamp",bu=new Set([ni,ai]),Ci={enabled:!0,max_bytes:32768};function oi(s){var e;return s?{enabled:(e=s.enabled)!==null&&e!==void 0?e:Ci.enabled,max_bytes:xu(s.max_bytes,Ci.max_bytes)}:w({},Ci)}class wu{constructor(e){this.Fn=[],this.Dn=0,this.mn=oi(e)}setConfig(e){this.mn=oi(e),this.$n()}add(e){var t=(function(r){var n;try{n=ja(r)}catch{return}try{var a=JSON.parse(n);if(!q(a))return;var o=a,l=o[ni],h=o[ai];return!B(l)||l.trim().length===0||!B(h)&&!ce(h)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var i=(function(r){if("u">typeof TextEncoder)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);i>this.mn.max_bytes||(this.Fn.push({step:t.step,bytes:i}),this.Dn+=i,this.$n())}}getAttachable(){return this.Fn.map((e=>e.step))}clear(){this.Fn=[],this.Dn=0}size(){return this.Fn.length}$n(){for(;this.Dn>this.mn.max_bytes&&this.Fn.length>0;){var e=this.Fn.shift();e&&(this.Dn-=e.bytes)}}}function xu(s,e){if(!ce(s)||s===1/0||s===-1/0)return e;var t=Math.floor(s);return 0>t?e:t}var Fn=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}};function In(s){return typeof s=="string"||s}function On(s){return typeof s=="string"?s:void 0}var rs,ku=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],_o="NativeGzipValidationError",vr=s=>s.length>=2&&s[0]===31&&s[1]===139,$n=(s,e)=>s===ar.GZipJS||e===ar.GZipJS||e==="gzip",Cn=s=>!(!s||typeof s!="object")&&("name"in s?String(s.name):"")==="NotReadableError",As=s=>{throw vo(_o,"Native gzip produced invalid output: "+s)},Eu=(function(){var s=X((function*(e,t){18>e.size&&As("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());vr(i)&&i[2]===8||As("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(rs)return rs;rs=[];for(var u=0;256>u;u++){for(var c=u,d=0;8>d;d++)c=1&c?3988292384^c>>>1:c>>>1;rs[u]=c>>>0}return rs})(),l=4294967295,h=0;a.length>h;h++)l=o[255&(l^a[h])]^l>>>8;return(4294967295^l)>>>0})(t)&&As("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&As("invalid-size")}));return function(e,t){return s.apply(this,arguments)}})();function pr(){return pr=X((function*(s,e,t){e===void 0&&(e=!0);try{var i=new TextEncoder().encode(s),r=new globalThis.CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(i).then((()=>n.close())).catch((function(){var h=X((function*(u){try{yield n.abort(u)}catch{}throw u}));return function(u){return h.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield Eu(l,i),l}catch(h){if(t!=null&&t.rethrow)throw h;return e&&console.error("Failed to gzip compress data",h),null}})),pr.apply(this,arguments)}var An=9223372036854776e3,Su="9223372036854775808",Pu={}.propertyIsEnumerable;function li(s,e){try{return mo(s,e,{ancestors:new WeakSet,remainingNodes:Zl},0)}catch{return[]}}function tn(s,e,t,i){if(0>=t.remainingNodes)return{stringValue:cr};if(t.remainingNodes--,Oe(s))return{boolValue:s};if(typeof s=="bigint")return(function(l,h){var u=l.toString(),c=BigInt(Su);return l>=c||-c>l?(h?.debug("Attribute "+u+" is outside the int64 range; encoding it as a string"),{stringValue:u}):{intValue:u}})(s,e);if(typeof s=="number"){if(!Number.isFinite(s))return{stringValue:String(s)};if(Number.isInteger(s)){if(Number.isSafeInteger(s))return{intValue:String(s)};if(typeof BigInt>"u")return{stringValue:String(s)};var r=BigInt(s).toString();return s>=An||-An>s?(e?.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}return{doubleValue:s}}if(typeof s=="string")return{stringValue:Wt(s)};if(typeof s=="function")return{stringValue:Xl};if(typeof s=="symbol")return{stringValue:String(s)};if(typeof s=="object"&&s!==null){if(t.ancestors.has(s))return{stringValue:Ql};if(i>=Yl)return{stringValue:cr};if(s instanceof Date){var n=s.getTime(),a=Number.isFinite(n)?s.toISOString():String(s);return{stringValue:typeof a=="string"?Wt(a):String(a)}}t.ancestors.add(s);try{try{var o=s.toJSON;if(typeof o=="function")return tn(o.call(s),e,t,i+1)}catch{}return C(s)?{arrayValue:{values:Fu(s,e,t,i+1)}}:{kvlistValue:{values:mo(s,e,t,i+1)}}}finally{t.ancestors.delete(s)}}return{stringValue:Wt(String(s))}}function Fu(s,e,t,i){for(var r=[],n=Math.min(s.length,co),a=0;n>a&&t.remainingNodes>0;a++)try{var o=a in s?s[a]:void 0;if(L(o))continue;r.push(tn(o,e,t,i))}catch{r.push({stringValue:ki})}return s.length>a&&r.push({stringValue:cr}),r}function mo(s,e,t,i){var r=[];for(var n in s)if(Pu.call(s,n)){if(!n){e?.debug("Dropping an attribute with an empty key");continue}if(r.length>=co||0>=t.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var a=s[n];if(he(a)||b(a))continue;r.push({key:Wt(n),value:tn(a,e,t,i)})}catch{r.push({key:Wt(n),value:{stringValue:ki}})}}return r}function yo(s,e,t){return w({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":t})}var Tn={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"},bo={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}},Iu=bo.info;function Ou(s){try{return Wt(String(s))}catch{return ki}}function $u(s,e,t,i){var r,n=bo[s.level||"info"]||Iu,a=n.text,o=n.number,l=((r=ce(i)?i:void 0)===void 0&&(r=Date.now()),String(r)+"000000"),h={};e.distinctId&&(h.posthogDistinctId=e.distinctId),e.sessionId&&(h.sessionId=e.sessionId),e.windowId&&(h["window.id"]=e.windowId),L(e.sessionStartTimestamp)||(h.sessionStartTimestamp=String(e.sessionStartTimestamp)),L(e.lastActivityTimestamp)||(h.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(h["url.full"]=e.currentUrl),e.screenName&&(h["screen.name"]=e.screenName),e.appState&&(h["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(h.feature_flags=e.activeFeatureFlags);var u=w({},h),c=s.attributes;if(c){var d=[];try{d=Object.keys(c)}catch{d=[]}for(var v of d){var p=void 0;try{p=c[v]}catch{p=ki}Object.defineProperty(u,v,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:a,body:{stringValue:Ou(s.body)},attributes:li(u,t)};return s.trace_id&&(f.traceId=s.trace_id),s.span_id&&(f.spanId=s.span_id),b(s.trace_flags)||(f.flags=s.trace_flags),f}function wo(s,e,t){return yo(s,e,t)}function xo(s,e,t,i){return{resourceLogs:[{resource:{attributes:li(e)},scopeLogs:[{scope:{name:t,version:i},logRecords:s}]}]}}let Cu=class{constructor(s,e,t,i,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=s,this.mn=e,this.A=t,this.Nn=i,this.qn=r,this.jn=n,this.Bn=a,this.Hn=null,this.zn=0,this.Un=0,this.Wn=0,this.Vn=0,this.Gn=0,this.Zn=!1,this.Qn=e.maxBufferSize,this.Jn=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.Kn=e.flushIntervalMs,this.Yn=e.maxBatchRecordsPerPost,this.Xn=e.rateCapWindowMs,this.ts=e.maxLogsPerInterval}clearQueue(){this.Un++,this._instance.setPersistedProperty(Xe.LogsQueue,[])}reset(){this.es(),this.Vn=0,this.Gn=0,this.Zn=!1,this.Wn=0,this.Yn=this.mn.maxBatchRecordsPerPost}onReconnect(){this.Wn=0,this.rs()}captureLog(s,e){var t;if(!this._instance.isDisabled&&!this._instance.optedOut&&s!=null&&s.body){var i=this.ns(s);if(i!==null)if(i.body){if(this.ss()){var r={record:$u(i,(t=e?.context)!==null&&t!==void 0?t:this.Nn(),this.A,e?.occurredAtMs)};this.qn((()=>this.os(r)))}}else this.A.info("Log was rejected in beforeSend function")}}ns(s){var e=this.mn.beforeSend;if(!e)return s;var t=C(e)?e:[e],i=s;for(var r of t)try{var n=r(i);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;i=n}catch(a){return this.A.error("Error in beforeSend function for log:",a),null}return i}ss(){if(this.ts===void 0)return!0;var s=Date.now(),e=s-this.Vn;return this.Xn>e&&e>=0||(this.Vn=s,this.Gn=0,this.Zn=!1),this.ts>this.Gn?(this.Gn++,!0):(this.Zn||(this.A.warn("captureLog dropping logs: exceeded "+this.ts+" logs per "+this.Xn+"ms"),this.Zn=!0),!1)}flush(){var s=this;return X((function*(){if(!s._instance.isDisabled)return s.Hn||(s.Hn=s.ls().finally((()=>{s.Hn=null}))),s.Hn}))()}ls(){var s=this;return X((function*(){var e;s.es();var t=(e=s._instance.getPersistedProperty(Xe.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var i=t.length,r=0;t.length>0&&i>r;){var n,a,o=s.Un;s.zn=0;var l=Math.min(t.length,s.Yn),h=t.slice(0,l),u=xo(h.map((d=>d.record)),s.us(),(n=s.Bn)!==null&&n!==void 0?n:s._instance.getLibraryId(),s._instance.getLibraryVersion()),c=yield s._instance.hs(u);if(s.Un!==o)return;if(c.kind==="too-large"&&h.length>1)s.Yn=Math.max(1,Math.floor(h.length/2)),s.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+s.Yn);else if(c.kind==="retry-later"||(c.kind==="too-large"?s.A.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."):c.kind==="ok"&&s.mn.maxBatchRecordsPerPost>s.Yn&&(s.Yn=Math.min(s.mn.maxBatchRecordsPerPost,s.Yn+1)),yield s.ds(h.length),t=(a=s._instance.getPersistedProperty(Xe.LogsQueue))!==null&&a!==void 0?a:[],r+=h.length,c.kind==="fatal"))throw c.error}}))()}ds(s){var e=this;return X((function*(){var t,i=Math.max(0,s-e.zn),r=(t=e._instance.getPersistedProperty(Xe.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(Xe.LogsQueue,r.slice(i)),yield e.jn()}))()}us(){return wo(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}os(s){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(Xe.LogsQueue))!==null&&e!==void 0?e:[];this.Jn>t.length||(t.shift(),this.zn++,this.A.info("Logs queue is full, dropping oldest record.")),t.push(s),this._instance.setPersistedProperty(Xe.LogsQueue,t),this.Qn>t.length?this.vs():this.rs()}}vs(s){s===void 0&&(s=this.Kn),this.cs||(this.cs=en((()=>{this.cs=void 0,this.rs()}),s))}fs(){var s=Math.min(Math.max(0,this.Wn-1),6);return this.Kn*Math.pow(2,s)}ps(){var s=this._instance.getPersistedProperty(Xe.LogsQueue);return!!s&&s.length>0}shutdown(s){var e=this;return X((function*(){e.es();var t=e.flush().catch((()=>{}));s!==void 0?yield Sn(t,s):yield t}))()}flushWithTimeout(s){var e=this;return X((function*(){var t=e.flush();yield Sn(t,s,(()=>{t.catch((()=>{}))}))}))()}rs(){this.flush().then((()=>{this.Wn=0}),(s=>{this.Wn++,this.A.error("PostHog logs flush failed:",s)})).finally((()=>{!this._instance.isDisabled&&this.ps()&&this.vs(this.fs())}))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};var Ai=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Rn(s){return String(s)+"000000"}function Mn(s,e,t,i){var r="";return i&&(r=Object.keys(i).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(i[n]))).join(",")),s+"\0"+e+"\0"+(t??"")+"\0"+r}let Au=class{constructor(s,e,t){this._instance=s,this.mn=e,this.A=t,this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set,this.ws=0}count(s,e,t){e===void 0&&(e=1),this.ks({name:s,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(s,e,t){this.ks({name:s,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(s,e,t){this.ks({name:s,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var s=this,e=this.Hn,t=(function(){var r=X((function*(){e&&(yield e.catch((()=>{}))),yield s.Ss()}));return function(){return r.apply(this,arguments)}})(),i=t().finally((()=>{this.Hn===i&&(this.Hn=null)}));return this.Hn=i,i}drainWindow(){if(this.gs.size===0)return null;var s=this.gs;return this.gs=new Map,this.ys=!1,this.bs=new Map,this._s=new Set,this.xs(s)}reset(){this.ws++,this.es(),this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set}ks(s){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.ns(s);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.A.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t,i;try{t=e.attributes?w({},e.attributes):void 0,i=Mn(e.type,e.name,e.unit,t)}catch(a){return void this.A.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var r=this.gs.get(i);if(!r){if(!this.Cs())return;r={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.gs.set(i,r)}var n=this.bs.get(e.name);n===void 0?this.bs.set(e.name,e.type):n===e.type||this._s.has(e.name)||(this._s.add(e.name),this.A.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.Ts(r,e.value),this.vs()}else this.A.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Cs(){return this.mn.maxSeriesPerFlush>this.gs.size||(this.ys||(this.ys=!0,this.A.warn("Metric series cap reached ("+this.mn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ts(s,e){var t;switch(s.type){case"count":s.total=((t=s.total)!==null&&t!==void 0?t:0)+e;break;case"gauge":s.last=e;break;case"histogram":s.hist||(s.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ai.length+1).fill(0)});var i=s.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[(function(r,n){for(var a=0;n.length>a;a++)if(n[a]>=r)return a;return n.length})(e,Ai)]+=1}}ns(s){var e=this.mn.beforeSend;if(!e)return s;var t=C(e)?e:[e],i=s;for(var r of t)try{var n=r(i);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;i=n}catch(a){return this.A.error("Error in beforeSend function for metric:",a),null}return i}vs(){this.cs||(this.cs=en((()=>{this.cs=void 0,this.flush().catch((s=>{this.A.error("Metrics flush failed:",s)}))}),this.mn.flushIntervalMs))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}Ss(){var s=this;return X((function*(){if(s.gs.size!==0){var e=s.gs;s.gs=new Map,s.ys=!1,s.bs=new Map,s._s=new Set;var t=s.ws,i=yield s._instance.Ms(s.xs(e));if(t===s.ws)switch(i.kind){case"ok":return;case"retry-later":return s.Is(e),void s.vs();case"too-large":return void s.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void s.A.error("Failed to send metrics batch:",i.error)}}}))()}xs(s){return e=this.Es(s),t=(function(n,a,o){return yo(n,a,o)})(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:li(t)},scopeMetrics:[{scope:{name:i,version:r},metrics:e}]}]};var e,t,i,r}Es(s){var e=Rn(Date.now()),t=new Map;for(var i of s.values()){var r,n=Mn(i.type,i.name,i.unit,void 0),a=t.get(n);a||(a=w({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,a));var o=li((r=i.attributes)!==null&&r!==void 0?r:{},this.A),l=Rn(i.windowStartMs);if(i.type==="count"){var h,u={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(h=i.total)!==null&&h!==void 0?h:0};a.sum.dataPoints.push(u)}else if(i.type==="gauge"){var c,d={attributes:o,timeUnixNano:e,asDouble:(c=i.last)!==null&&c!==void 0?c:0};a.gauge.dataPoints.push(d)}else i.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Ai})}return Array.from(t.values())}Is(s){var e,t;for(var i of s){var r=i[0],n=i[1],a=this.gs.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.Cs()&&this.gs.set(r,n)}}};var ko=function(s,e){var t=(e===void 0?{}:e).debugEnabled,i={q(r){if(_&&(Z.DEBUG||_.POSTHOG_DEBUG||t)&&!b(_.console)&&_.console){for(var n=("__rrweb_original__"in _.console[r])?_.console[r].__rrweb_original__:_.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(s,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.q("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.q("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.q("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.q("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(s,...n)},uninitializedWarning(r){i.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>ko(s+" "+r,n)};return i},S=ko("[PostHog.js]"),se=S.createLogger,Tu=se("[ExternalScriptsLoader]"),ui=s=>{var e=E?.querySelectorAll("script");if(e){for(var t=0;e.length>t;t++)if(e[t].src===s||e[t].getAttribute("src")===s)return e[t]}},Et=(s,e,t)=>{if(s.config.disable_external_dependency_loading)return Tu.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=ui(e);if(i){if(i.__posthog_loading_callback_fired)return t();var r=i.__posthog_loading_error;return r?t(r):(i.addEventListener("load",(a=>{i.__posthog_loading_callback_fired=!0,t(void 0,a)})),void i.addEventListener("error",(a=>{i.__posthog_loading_error=a,t(a)})))}var n=()=>{if(!E)return t("document not found");if(ui(e))return Et(s,e,t);var a=E.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=e,a.onload=h=>{a.__posthog_loading_callback_fired=!0,t(void 0,h)},a.onerror=h=>{a.__posthog_loading_error=h,t(h)},s.config.prepare_external_dependency_script&&(a=s.config.prepare_external_dependency_script(a)),!a)return t("prepare_external_dependency_script returned null");if(s.config.external_scripts_inject_target==="head")E.head.appendChild(a);else{var o,l=E.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)==null||o.insertBefore(a,l[0]):E.body.appendChild(a)}};E!=null&&E.body?n():E?.addEventListener("DOMContentLoaded",n)},Ti={},Dn=(s,e)=>{var t="/static/"+e+".js?v="+s.version;if(e==="toolbar"){var i=3e5;t=t+"&t="+Math.floor(Date.now()/i)*i}return s.requestRouter.endpointFor("assets",t)};O.__PosthogExtensions__=O.__PosthogExtensions__||{},O.__PosthogExtensions__.loadExternalDependency=(s,e,t)=>{if(e!=="remote-config"){var i=s.config.strict_script_versioning;if(i){var r=s.requestRouter.endpointFor("assets","/static/"+s.version+"/"+e+".js"),n=Ti[r];if(i==="fallback"&&n){if(ui(n))return void Et(s,n,t);delete Ti[r]}Et(s,r,i==="fallback"?(o,l)=>{if(o)if(typeof o=="string")t(o);else{var h,u=Dn(s,e);Ti[r]=u;var c=ui(r);c==null||(h=c.parentNode)==null||h.removeChild(c),Et(s,u,t)}else t(void 0,l)}:t)}else Et(s,Dn(s,e),t)}else{var a=s.requestRouter.endpointFor("assets","/array/"+s.config.token+"/config.js");Et(s,a,t)}},O.__PosthogExtensions__.loadSiteApp=(s,e,t)=>{var i=s.requestRouter.endpointFor("api",e);Et(s,i,t)};Z.DEBUG=!1,Z.LIB_VERSION="1.427.2",Z.LIB_NAME="web";var Eo="$people_distinct_id",we="distinct_id",Ps="$device_id",Ri="$device_model",jt="__alias",st="$fbc",Ae="$fbc_persistence",ps="__timers",fr="$autocapture_disabled_server_side",gr="$heatmaps_enabled_server_side",_r="$exception_capture_enabled_server_side",mr="$error_tracking_suppression_rules",yr="$error_tracking_capture_extension_exceptions",br="$web_vitals_enabled_server_side",sn="$dead_clicks_enabled_server_side",rn="$product_tours_enabled_server_side",wr="$logs_capture_enabled_server_side",xr="$web_vitals_allowed_metrics",Ft="$session_recording_remote_config",So="$replay_sample_rate",Po="$replay_override_sampling",Fo="$replay_override_linked_flag",Io="$replay_override_url_trigger",Oo="$replay_override_event_trigger",qt="$sesid",nn="$session_is_sampled",Ee="$enabled_feature_flags",Ve="$active_feature_flags",Us="$early_access_features",ft="$feature_flag_details",Ge="$feature_flag_payloads",gt="$feature_flag_request_id",Gt="$minimal_flag_called_events",Qe="$override_feature_flags",St="$override_feature_flag_payloads",Me="$stored_person_properties",et="$stored_group_properties",$o="$groups",kr="$surveys",hi="$surveys_loaded_at",Er="$surveys_activated",Ws="$surveys_activated_session",Gs="$surveys_activated_timestamps",fs="ph_product_tours",ot="$flag_call_reported",gs="$flag_call_reported_session_id",Kt="$feature_flag_errors",ct="$feature_flag_evaluated_at",j="$user_state",Sr="$client_session_props",Pr="$capture_rate_limit",Fr="$initial_campaign_params",Ir="$initial_referrer_info",Bt="$initial_person_info",ci="$epp",$t="$posthog_cookieless",Co="$cookieless_mode",Ao="$sdk_debug_extensions_init_method",To="$sdk_debug_extensions_init_time_ms",Or="$sdk_debug_recording_script_not_loaded",an="PostHog loadExternalDependency extension not found.",pt="on_reject",lt="always",de="anonymous",Se="identified",$r="identified_only",Qt="visibilitychange",di="beforeunload",Ht="$pageview",Mi="$pageleave",Cr="$identify",Ln="$groupidentify";function Ts(s,e){C(s)&&s.forEach(e)}function W(s,e){if(!L(s))if(C(s))s.forEach(e);else if(Ml(s))s.forEach(((i,r)=>e(i,r)));else for(var t in s)Ba.call(s,t)&&e(s[t],t)}var Q=function(s){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;e>i;i++)t[i-1]=arguments[i];for(var r of t)for(var n in r)r[n]!==void 0&&(s[n]=r[n]);return s};function Ks(s){for(var e=Object.keys(s),t=e.length,i=new Array(t);t--;)i[t]=[e[t],s[e[t]]];return i}var Nn=function(s){try{return s()}catch{return}},Ru=function(s){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];return s.apply(this,t)}catch(r){S.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),S.critical(r)}}},on=function(s){var e={};return W(s,(function(t,i){(B(t)&&t.length>0||ce(t))&&(e[i]=t)})),e},Mu=["herokuapp.com","vercel.app","netlify.app"];function Du(s){var e=s?.hostname;if(!B(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Mu)if(t===i)return!1;return!0}function K(s,e,t,i){var r=i??{},n=r.capture,a=r.passive;s?.addEventListener(e,t,{capture:n!==void 0&&n,passive:a===void 0||a})}function Ar(s){return s.name==="ph_toolbar_internal"}var Tr=s=>{if(E){try{for(var e=s+"=",t=E.cookie.split(";").filter((n=>n.length)),i=0;t.length>i;i++){for(var r=t[i];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(s){return 0>s?Math.ceil(s):Math.floor(s)}),Number.isInteger||(Number.isInteger=function(s){return ce(s)&&isFinite(s)&&Math.floor(s)===s});class vi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||0>e||0>t||0>i||0>r||e>0xffffffffffff||t>4095||i>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|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new vi(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 vi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class Lu{generate(){var e=this.generateOrAbort();if(!b(e))return e;this.Kr=0;var t=this.generateOrAbort();if(b(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.Kr)this.Kr=e,this.Xr();else{if(this.Kr>=e+1e4)return;this.ti++,this.ti>4398046511103&&(this.Kr++,this.Xr())}return vi.fromFieldsV7(this.Kr,Math.trunc(this.ti/Math.pow(2,30)),this.ti&Math.pow(2,30)-1,this.ei.nextUint32())}Xr(){this.ti=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Kr=0,this.ti=0,this.ei=new Nu}}var jn,Ro=s=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;s.length>e;e++)s[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return s};_&&!b(_.crypto)&&crypto.getRandomValues&&(Ro=s=>crypto.getRandomValues(s));class Nu{nextUint32(){return this.De.length>this.ri||(Ro(this.De),this.ri=0),this.De[this.ri++]}constructor(){this.De=new Uint32Array(8),this.ri=1/0}}var Ke=()=>ju().toString(),ju=()=>(jn||(jn=new Lu)).generate(),ns="",qu=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ct=null,ne={ii(){if(!he(Ct))return Ct;if(Ct=!1,E)try{var s="__ph_cookie_support_"+Ke();ne.ni(s,"xyz"),Ct=Tr(s)==='"xyz"',ne.oi(s)}catch{Ct=!1}return Ct},si(s){S.error("cookieStore error: "+s)},ai:Tr,ui(s){var e;try{e=JSON.parse(ne.ai(s))||{}}catch{}return e},ni(s,e,t,i,r){if(!E)return!1;try{var n="",a="",o=(function(u,c){if(c){var d=(function(p,f){if(f===void 0&&(f=E),ns)return ns;if(!f||["localhost","127.0.0.1"].includes(p))return"";for(var m=p.split("."),g=Math.min(m.length,8),y="dmn_chk_"+Ke();!ns&&g--;){var x=m.slice(g).join("."),k=y+"=1;domain=."+x+";path=/";f.cookie=k+";max-age=3",f.cookie.includes(y)&&(f.cookie=k+";max-age=0",ns=x)}return ns})(u);if(!d){var v=(p=>{var f=p.match(qu);return f?f[0]:""})(u);v!==d&&S.info("Warning: cookie subdomain discovery mismatch",v,d),d=v}return d?"; domain=."+d:""}return""})(E.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var h=s+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return h.length>3686.4&&S.warn("cookieStore warning: large cookie, len="+h.length),E.cookie=h,!0}catch{return!1}},oi(s,e){if(E!=null&&E.cookie)try{ne.ni(s,"",-1,e)}catch{return}}},Di=null,V={ii(){if(!he(Di))return Di;var s=!0;if(b(_))s=!1;else try{var e="__mplssupport__";V.ni(e,"xyz"),V.ai(e)!=='"xyz"'&&(s=!1),V.oi(e)}catch{s=!1}return s||S.error("localStorage unsupported; falling back to cookie store"),Di=s,s},si(s){S.error("localStorage error: "+s)},ai(s){try{return _?.localStorage.getItem(s)}catch(e){V.si(e)}return null},ui(s){try{return JSON.parse(V.ai(s))||{}}catch{}return null},ni(s,e){try{return _?.localStorage.setItem(s,JSON.stringify(e)),!0}catch(t){V.si(t)}return!1},oi(s){try{_?.localStorage.removeItem(s)}catch(e){V.si(e)}}},Li=[Me,Ve,Ee,ft,Ge,gt,ct,Kt,ot],Pt=[Ps,we,qt,nn,ci,Bt,Ae,j],pi=s=>s+"_cpm",Bu=["__proto__","constructor","prototype"],Ni=s=>{if(!q(s))return{};var e={};return Object.keys(s).forEach((t=>{Bu.indexOf(t)===-1&&(e[t]=s[t])})),e},ji=function(s,e){e===void 0&&(e=[]);var t={};return[...Pt,...e].forEach((i=>{var r=s[i];b(r)||he(r)||r===""||(t[i]=r)})),t},Mo=s=>{for(var e=5381,t=2166136261,i=0;s.length>i;i++){var r=s.charCodeAt(i);e=33*e^r,t=Math.imul(t^r,16777619)}return s.length.toString(36)+"."+(e>>>0).toString(36)+"."+(t>>>0).toString(36)},qn=(s,e)=>({p:e,f:Mo(JSON.stringify(s))}),Bn=(s,e)=>{if(!e)return{properties:[],isValid:!1};try{var t=ne.ui(pi(s)),i=t?.f===Mo(e)&&C(t.p);return{properties:i?t.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},qi=(s,e)=>e+"|"+(ne.ai(pi(s))||""),At={},Rr={ii:()=>!0,si(s){S.error("memoryStorage error: "+s)},ai:s=>s in At?At[s]:null,ui:s=>s in At?At[s]:null,ni:(s,e)=>(At[s]=e,!0),oi(s){delete At[s]}},bt=null,G={ii(){if(!he(bt))return bt;if(bt=!0,b(_))bt=!1;else try{var s="__support__";G.ni(s,"xyz"),G.ai(s)!=='"xyz"'&&(bt=!1),G.oi(s)}catch{bt=!1}return bt},si(s){S.error("sessionStorage error: ",s)},ai(s){try{return _?.sessionStorage.getItem(s)}catch(e){G.si(e)}return null},ui(s){try{return JSON.parse(G.ai(s))||null}catch{}return null},ni(s,e){try{return _?.sessionStorage.setItem(s,JSON.stringify(e)),!0}catch(t){G.si(t)}return!1},oi(s){try{_?.sessionStorage.removeItem(s)}catch(e){G.si(e)}}};class Hu{constructor(e){this._instance=e}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===lt||this.isRejected()||this.consent===-1&&this.mn.cookieless_mode===pt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.mn.opt_out_capturing_by_default}optInOut(e){this.Zs.ni(this.Qs,e?1:0,this.mn.cookie_expiration,this.mn.cross_subdomain_cookie,this.mn.secure_cookie)}reset(){this.Zs.oi(this.Qs,this.mn.cross_subdomain_cookie)}get Qs(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get Gs(){var e=this.Zs.ai(this.Qs);return Fi(e)?1:M(jl,e)?0:-1}get Zs(){var e=this.mn.opt_out_capturing_persistence_type,t=e==="localStorage"?V:ne,i=t.ii()?t:Rr;if(!this.Js||this.Js!==i){this.Js=i;var r=e==="localStorage"?ne:V;r.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(Fi(r.ai(this.Qs))),r.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[be?.doNotTrack,be?.msDoNotTrack,O.doNotTrack,be?.globalPrivacyControl].some((e=>Fi(e)))}}function Do(s,e){var t,i=s==null||(t=s.config)==null?void 0:t.get_current_url;if(!Fe(i))return e;try{var r=i(e);return B(r)&&r?r:e}catch(n){return S.error("Error in get_current_url, falling back to window.location.href",n),e}}var Lo="__POSTHOG_TOOLBAR__",Vu=1,zu=3,Uu=11;function Hn(s){return s instanceof Element&&(s.id===Lo||!(s.closest==null||!s.closest(".toolbar-global-fade-container")))}function mt(s){return!!s&&s.nodeType===Vu}function je(s,e){return!!s&&!!s.tagName&&s.tagName.toLowerCase()===e.toLowerCase()}function No(s){return!!s&&s.nodeType===zu}function jo(s){return!!s&&s.nodeType===Uu&&mt(s.host)}var qo=1e3;function ln(s){return s?wi(s).split(/\s+/):[]}function Vn(s,e){var t=(function(i){var r,n=_==null||(r=_.location)==null?void 0:r.href;return b(n)?void 0:Do(i,n)})(e);return!!(t&&s&&s.some((i=>t.match(i))))}function fi(s){var e="";switch(typeof s.className){case"string":e=s.className;break;case"object":e=(s.className&&"baseVal"in s.className?s.className.baseVal:null)||s.getAttribute("class")||"";break;default:e=""}return ln(e)}function Bo(s){return L(s)?null:wi(s).split(/(\s+)/).filter((e=>bs(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fs(s){var e="";return Lr(s)&&!Wo(s)&&s.childNodes&&s.childNodes.length&&W(s.childNodes,(function(t){var i;No(t)&&t.textContent&&(e+=(i=Bo(t.textContent))!==null&&i!==void 0?i:"")})),wi(e)}function Mr(s){var e;return b(s.target)?s.srcElement||null:(e=s.target)!=null&&e.shadowRoot?s.composedPath()[0]||null:s.target||null}var un=["a","button","form","input","select","textarea","label"];function Dr(s,e){if(b(e))return!0;var t,i=function(n){if(e.some((a=>(function(o,l){var h=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!h&&h.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of s)if(t=i(r))return t.v;return!1}function Ho(s){var e=s.parentNode;return!(!e||!mt(e))&&e}var Wu=[".ph-no-autocapture","[data-ph-no-autocapture]"],Vo=["next","previous","prev",">","<"],Gu=[...Vo,"+","-","−","–"],zn=(s,e)=>/[a-z0-9]/i.test(e)?s.includes(e):s===e,Un=[".ph-no-rageclick",".ph-no-capture"],Ku=["","text","search","email","password","url","tel","number"];function zo(s,e){if(!_||hn(s))return!1;var t,i,r,n,a;if(Oe(e)?(t=!!e&&Un,i=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:Un,i=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!mt(l))&&(!!je(l,"textarea")||(je(l,"input")?M(Ku,(l.getAttribute("type")||"").toLowerCase()):(function(h){if(h.isContentEditable)return!0;var u=h.getAttribute==null?void 0:h.getAttribute("contenteditable");return u==="true"||u===""})(l)))})(s))return!1;var o=Uo(s,!1).targetElementList;return!(function(l,h){if(l===!1||b(l))return!1;var u;if(l===!0)u=Vo;else{if(!C(l))return!1;if(l.length>10)return S.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=l.map((c=>c.toLowerCase()))}return h.some((c=>{var d=c.safeText,v=c.ariaLabel;return u.some((p=>zn(d,p)||zn(v,p)))}))})(i,o.map((l=>{var h;return{safeText:Fs(l).toLowerCase(),ariaLabel:((h=l.getAttribute("aria-label"))==null?void 0:h.toLowerCase().trim())||""}})))&&!Dr(o,t)}var hn=s=>!s||je(s,"html")||!mt(s),Uo=(s,e)=>{if(!_||hn(s))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[s],r=s;r.parentNode&&!je(r,"body");)if(jo(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var n=Ho(r);if(!n)break;if(e||un.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var a=_.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch{}i.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:i}};function Lr(s){for(var e=new Set,t=0,i=s;i.parentNode&&!je(i,"body");i=i.parentNode){if(t++>=qo||e.has(i))return!1;e.add(i);var r=fi(i);if(M(r,"ph-sensitive")||M(r,"ph-no-capture"))return!1}if(M(fi(s),"ph-include"))return!0;var n=s.type||"";if(B(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=s.name||s.id||"";return!B(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 Wo(s){return!!(je(s,"input")&&!["button","checkbox","submit","reset"].includes(s.type)||je(s,"select")||je(s,"textarea")||s.getAttribute("contenteditable")==="true")}var Wn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Gn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ju=[16,15,14,13],Yu=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Kn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Jn=/[0-9A-Za-z_]/;function Zu(s){for(var e=0,t=!1,i=s.length-1;i>=0;i--){var r=s.charCodeAt(i)-48;t&&(r*=2)>9&&(r-=9),e+=r,t=!t}return e%10==0}function bs(s,e){if(e===void 0&&(e=!0),L(s))return!1;if(B(s)){s=wi(s);var t=e?Wn.test((s||"").replace(/[- ]/g,"")):(function(r){var n;for(Gn.lastIndex=0;n=Gn.exec(r);){var a=n[2];if(a)for(var o=a.replace(/[- ]/g,""),l=0;o.length>l;l++)for(var h of Ju){var u=l+h;if(o.length>=u){var c=o.slice(l,u);if(Wn.test(c)&&Zu(c))return!0}}}return!1})(s);if(t)return!1;var i=e?Yu.test(s):(function(r){var n;for(Kn.lastIndex=0;n=Kn.exec(r);){var a=n[1],o=n[3];if(!(a&&o&&Jn.test(a)&&Jn.test(o)))return!0}return!1})(s);if(i)return!1}return!0}function Yn(s){var e=Fs(s);return bs(e=(e+" "+Go(s)).trim())?e:""}function Go(s){var e="";return s&&s.childNodes&&s.childNodes.length&&W(s.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var r=Fs(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Go(t)).trim())}catch(n){S.error("[AutoCapture]",n)}})),e}function Zn(s){return s.replace(/"|\\"/g,'\\"')}function Qu(s){var e=s.attr__class;if(e)return C(e)?e:ln(e)}var Rs=se("[Dead Clicks]"),Xu=()=>!0,eh=s=>{var e,t=!((e=s.instance.persistence)==null||!e.get_property(sn)),i=s.instance.config.capture_dead_clicks;return Oe(i)?i:!!q(i)||t};class Qn{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[sn]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys((()=>{this.Xs()})):this.stop()}Ys(e){var t,i;(t=O.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Rs.error("failed to load script",r):e()}))}Xs(){var e;if(E){if(!this.Ks&&(e=O.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?w({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ks=O.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ks.start(E),Rs.info("starting...")}}else Rs.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,Rs.info("stopping..."))}}var Ms=se("[SegmentIntegration]");function Xn(s,e,t){t===void 0&&(t=!0);var i=s.config.segment;if(!i)return e();(function(r,n,a){var o=r.config.segment;if(!o)return n();var l=u=>{var c=()=>u.anonymousId()||Ke();r.config.get_device_id=c,a&&u.id()&&(r.register({distinct_id:u.id(),$device_id:c()}),r.persistence.set_property(j,Se)),n(a?void 0:u.anonymousId()||void 0)},h=o.user();"then"in h&&Fe(h.then)?h.then(l):l(h)})(s,(r=>{i.register(((n,a)=>{typeof Promise<"u"&&Promise.resolve||Ms.warn("This browser does not have Promise support, and can not use the segment integration");var o=(l,h)=>{if(!h)return l;var u=!!a&&l.event.anonymousId===a&&!l.event.userId;u||l.event.userId||l.event.anonymousId===n.get_distinct_id()||(Ms.info("No userId set, resetting PostHog"),n.reset()),u||(a=void 0),l.event.userId&&l.event.userId!==n.get_distinct_id()&&(Ms.info("UserId set, identifying with PostHog"),n.identify(l.event.userId));var c=n.calculateEventProperties(h,l.event.properties);return l.event.properties=Object.assign({},c,l.event.properties),l};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(l){return o(l,l.event.event)},page(l){return o(l,Ht)},identify(l){return o(l,Cr)},screen(l){return o(l,"$screen")}}})(s,r)).then((()=>{e()}),(n=>{Ms.error("Failed to register the Segment integration",n),e()}))}),t)}var Ko="posthog-js";function Jo(s,e){var t=e===void 0?{}:e,i=t.organization,r=t.projectId,n=t.prefix,a=t.severityAllowList,o=a===void 0?["error"]:a,l=t.sendExceptionsToPostHog,h=l===void 0||l;return u=>{var c,d,v,p,f;if(o!=="*"&&!o.includes(u.level)||!s.__loaded)return u;u.tags||(u.tags={});var m=s.requestRouter.endpointFor("ui","/project/"+s.config.token+"/person/"+s.get_distinct_id());u.tags["PostHog Person URL"]=m,s.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=s.get_session_replay_url({withTimestamp:!0}));var g,y=((c=u.exception)==null?void 0:c.values)||[],x=y.map((P=>w({},P,{stacktrace:P.stacktrace?w({},P.stacktrace,{type:"raw",frames:(P.stacktrace.frames||[]).map((R=>w({},R,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((d=y[0])==null?void 0:d.value)||u.message,$exception_type:(v=y[0])==null?void 0:v.type,$exception_level:u.level,$exception_list:x,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((p=y[0])==null?void 0:p.value)||u.message,$sentry_exception_type:(f=y[0])==null?void 0:f.type,$sentry_tags:u.tags};return i&&r&&(k.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+u.event_id),h&&((g=s.exceptions)==null||g.sendExceptionEvent(k)),u}}class th{constructor(e,t,i,r,n,a){this.name=Ko,this.setupOnce=function(o){o(Jo(e,{organization:t,projectId:i,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class ea{constructor(e){this.eo=(t,i,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(S.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.io=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ro()}ro(){var e;this.no=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.eo)}destroy(){var e;(e=this.no)==null||e.call(this),this.no=void 0}doPageView(e,t){var i,r=this.so(e,t);return this.io={pathname:(i=_?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.so(e,(t=this.io)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.io)==null?void 0:e.pageViewId}}so(e,t){var i=this.io;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var a=n.maxScrollHeight,o=n.lastScrollY,l=n.maxScrollY,h=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(b(a)||b(o)||b(l)||b(h)||b(u)||b(c))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u),c=Math.ceil(c);var d=a>1?tt(o/a,0,1,S):1,v=a>1?tt(l/a,0,1,S):1,p=h>1?tt(u/h,0,1,S):1,f=h>1?tt(c/h,0,1,S):1;r=Q(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var as=["flags","surveys"],sh={[Eo]:{exposure:"hidden"},[jt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ps]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[fr]:{exposure:"event"},[gr]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[_r]:{exposure:"event"},[mr]:{exposure:"hidden"},[yr]:{exposure:"event"},[br]:{exposure:"event"},[sn]:{exposure:"event"},[rn]:{exposure:"hidden"},[xr]:{exposure:"event"},[Ft]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[qt]:{exposure:"hidden"},[nn]:{exposure:"event"},[So]:{exposure:"event",shouldSkipFromEventProperties:s=>he(s)},$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"},[Ee]:{exposure:"hidden",storageGroup:"flags"},[Ve]:{exposure:"hidden",storageGroup:"flags"},[Us]:{exposure:"hidden"},[ft]:{exposure:"hidden",storageGroup:"flags"},[Ge]:{exposure:"hidden",storageGroup:"flags"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Gt]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden"},[St]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[et]:{exposure:"hidden"},[kr]:{exposure:"hidden",storageGroup:"surveys"},[hi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Er]:{exposure:"event"},[Ws]:{exposure:"hidden"},[Gs]:{exposure:"hidden"},[fs]:{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"},[ot]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[$o]:{exposure:"event"},[Kt]:{exposure:"hidden"},[ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[j]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},[Pr]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Bt]:{exposure:"hidden"},[ci]:{exposure:"hidden"},[Po]:{exposure:"event"},[Fo]:{exposure:"event"},[Io]:{exposure:"event"},[Oo]:{exposure:"event"},[Ao]:{exposure:"event"},[To]:{exposure:"event"},[Or]:{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_pending_trigger_conditions:{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"}},ih=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xe=s=>{var e=sh[s];if(e)return e;for(var t of ih){var i=t[1];if(s.indexOf(t[0])===0)return i}},Vt=(s,e)=>{try{return JSON.stringify(s,((t,i)=>typeof i=="bigint"?i.toString():i),e)}catch{return ja(s)}},Xt=s=>{var e=E?.createElement("a");return b(e)?null:(e.href=s,e)},es=function(s,e){for(var t,i=((s.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var n=i[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{S.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Is=function(s,e,t){if(!s||!e||!e.length)return s;for(var i=s.split("#"),r=i[1],n=(i[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),h=[],u=0;l.length>u;u++){var c=l[u].split("=");C(c)&&(e.includes(c[0])?h.push(c[0]+"="+t):h.push(l[u]))}var d=o;return a!=null&&(d+="?"+h.join("&")),r!=null&&(d+="#"+r),d},gi=function(s,e){var t=s.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Yo=(s,e)=>s>=e&&La(),Zo=(s,e,t,i)=>{if(s===0){if(La()){var r=e+1;return r===t&&i(),r}return e}return 0},Ds="https?://(.*)",ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rh=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ts],Os="<masked>",nh=["li_fat_id"];function Qo(s,e,t){if(!E)return{};var i,r=e?[...ts,...t||[]]:[],n=Xo(Is(E.URL,r,Os),s),a=(i={},W(nh,(function(o){var l=Tr(o);i[o]=l||null})),i);return Q(a,n)}function Xo(s,e){var t=rh.concat(e||[]),i={};return W(t,(function(r){var n=es(s,r);i[r]=n||null})),i}function el(s){var e=(function(n){return n?n.search(Ds+"google.([^/?]*)")===0?"google":n.search(Ds+"bing.com")===0?"bing":n.search(Ds+"yahoo.com")===0?"yahoo":n.search(Ds+"duckduckgo.com")===0?"duckduckgo":null:null})(s),t=e!="yahoo"?"q":"p",i={};if(!he(e)){i.$search_engine=e;var r=E?es(E.referrer,t):"";r.length&&(i.ph_keyword=r)}return i}function ta(){return navigator.language||navigator.userLanguage}var _i="$direct";function tl(){return E?.referrer||_i}function sl(s,e,t){t===void 0&&(t=!1);var i=s?[...ts,...e||[]]:[],r=t?_t(ae?.href):ae?.href,n=r?.substring(0,1e3);return{r:tl().substring(0,1e3),u:n?Is(n,i,Os):void 0}}function il(s,e){var t;e===void 0&&(e=!1);var i=s.r,r=s.u,n=e?_t(r):r,a={$referrer:i,$referring_domain:i==null?void 0:i==_i?_i:(t=Xt(i))==null?void 0:t.host};if(n){a.$current_url=n;var o=Xt(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=Xo(n);Q(a,l)}if(i){var h=el(i);Q(a,h)}return a}function rl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ah(){try{return new Date().getTimezoneOffset()}catch{return}}var oh={flags:ct,surveys:hi},lh=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ls=s=>s+"_cookie_identity_change_pending",Ns=s=>{var e="",t=0;for(var i of s){var r=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(t+r>1e3)break;e+=i,t+=r}return e},me="main",at=[Ee,Ve,ft,Ge,gt,ct,Gt,Me],Bi=s=>at.indexOf(s)!==-1,dt=(s,e)=>{try{return JSON.stringify(s)===JSON.stringify(e)}catch{return s===e}},Tt=s=>{if(!s)return{};var e=JSON.parse(s);return q(e)?e:{}},sa=(s,e)=>{W(s,((t,i)=>{var r=xe(i);r&&r.exposure!=="event"||{}.hasOwnProperty.call(e,i)||delete s[i]}))};class Hi{constructor(e,t,i){if(i===void 0&&(i=!0),this.oo={},this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.do=!1,this.vo=new Map,this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=new Set,this.mn=e,this.bo=i,this.props={},this._o=void 0,this.wo=(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.Zs=this.ko(e),this.uo=this.So(e),this.load(),this.xo(),e.debug&&S.info("Persistence loaded",e.persistence,w({},this.props)),this.update_config(e,e,t),this.save(),_){var r=()=>this.flush();K(_,"beforeunload",r,{capture:!1}),K(_,"pagehide",r,{capture:!1}),this.Co=n=>{if(this.ao&&(!n.storageArea||n.storageArea===_?.localStorage)&&n.key)if(n.key!==this.wo){if(this.uo){var a=as.find((o=>n.key===this.To(o)));a&&this.Mo(n.key,a)}}else this.Mo(n.key,me)},K(_,"storage",this.Co)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach((t=>{var i=t[0],r=t[1],n=this.vo.get(i);if(Bi(i)&&n!==!0)if(r!==!0){var a=new Set(n||[]);r.forEach((o=>a.add(o))),a.size&&this.Io(i,a)}else this.Io(i,!0)}))}onCrossTabFeatureFlagChange(e){return this.yo.add(e),()=>this.yo.delete(e)}destroy(){this.Co&&_&&(_.removeEventListener("storage",this.Co),this.Co=void 0),this.yo.clear()}Mo(e,t,i){if(i===void 0&&(i=!0),this.Eo)return!1;var r,n;try{if(n=V.ai(e),he(n)){var a=this.Ro(t);return a.storageValue=null,t!==me&&(a.persisted=!1),!1}r=Tt(n)}catch{return!1}var o=t===me?r:V.ui(this.wo);if(o&&this.Po(o))return!1;var l=this.Ao(r,t,i);return t===me&&this.uo&&!dt(this.Fo().main,r)||this.Oo(r,t,!0,n),l}Po(e){var t=this.props[we],i=e[we];return!b(t)&&!b(i)&&t!==i}Oo(e,t,i,r){var n=this.Ro(t);n.storageValue=r,t!==me&&(n.persisted=i);try{n.fingerprint=this.Lo(e,t)}catch{n.fingerprint=void 0}}Ao(e,t,i){var r=!1;return at.forEach((n=>{var a,o=(a=xe(n))==null?void 0:a.storageGroup;if(!(t===me&&this.uo&&o||t!==me&&o!==t)){var l=n in e,h=this.Do(n,l?e[n]:void 0),u=this.vo.has(n)?n in this.props:l;u===n in this.props&&dt(h,this.props[n])||(u?this.$o(n,h,!1):this.No(n,!1),r=!0)}})),r&&i&&this.yo.forEach((n=>n())),r}qo(){if(!this.ao)return!1;try{this.po=!1;var e,t=V.ai(this.wo),i=this.Ro(me),r=!1,n=!1;if(t!==i.storageValue)if(he(t))i.storageValue=null;else{if(e=Tt(t),this.po=!this.fo&&this.Po(e),this.po)return!1;n=this.Ao(e,me,!1),!this.uo||dt(this.Fo().main,e)?this.Oo(e,me,!0,t):i.storageValue=t,r=!0}return this.uo&&as.forEach((a=>{var o=V.ai(this.To(a)),l=this.Ro(a),h=e||{},u=r&&at.some((d=>{var v;return((v=xe(d))==null?void 0:v.storageGroup)===a&&d in h}));if(o!==l.storageValue||u){if(he(o))return l.storageValue=null,l.persisted=!1,void(u&&(n=this.Ao(h,a,!1)||n));var c=Tt(o);n=this.Ao(c,a,!1)||n,this.Oo(c,a,!0,o)}})),n}catch{return!1}}Io(e,t){this.vo.set(e,t);var i=xe(e);i!=null&&i.volatile||(this.Ro((this.uo?i?.storageGroup:void 0)||me).fingerprint=void 0,this.jo(e))}Bo(){at.forEach((e=>this.vo.set(e,!0)))}xo(){if(this.ao)try{var e=V.ai(this.wo),t=Tt(e);this.Ro(me).storageValue=e,at.forEach((i=>{var r,n=this.uo?(r=xe(i))==null?void 0:r.storageGroup:void 0,a=n?V.ai(this.To(n)):null;if(n){var o=this.Ro(n);o.storageValue=a,o.persisted=!he(a)}var l=n&&!he(a)?Tt(a):t;i in this.props?this.Ho(i,l[i],this.props[i]):i in l&&this.Io(i,!0)}))}catch{}}Do(e,t){var i=this.vo.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e===Ve){var r=new Set(C(t)?t:[]),n=new Set(C(this.props[e])?this.props[e]:[]);return i.forEach((l=>n.has(l)?r.add(l):r.delete(l))),Array.from(r)}var a=q(t)?w({},t):{},o=q(this.props[e])?this.props[e]:{};return i.forEach((l=>{l in o?a[l]=o[l]:delete a[l]})),a}Ho(e,t,i){if(Bi(e)){var r=this.vo.get(e);if(r!==!0){var n=t;if(this.ao)try{var a,o=this.uo?(a=xe(e))==null?void 0:a.storageGroup:void 0,l=o?this.To(o):this.wo;n=Tt(V.ai(l))[e]}catch{}var h=new Set(r||[]);if(e===Ve){if(!b(t)&&!C(t)||!b(n)&&!C(n)||!C(i))return void this.Io(e,!0);var u=new Set(t||[]),c=new Set(n||[]),d=new Set(i);new Set([...u,...d]).forEach((f=>{u.has(f)!==d.has(f)&&h.add(f)})),h.forEach((f=>{c.has(f)===d.has(f)&&h.delete(f)}))}else{if(!q(i))return void(dt(n,i)?this.vo.delete(e):this.Io(e,!0));if(!b(t)&&!q(t)||b(t)&&Ne(i)&&b(n))return void this.Io(e,!0);var v=q(t)?t:{},p=q(n)?n:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach((f=>{f in v==f in i&&dt(v[f],i[f])||h.add(f)})),h.forEach((f=>{f in p==f in i&&dt(p[f],i[f])&&h.delete(f)}))}h.size?this.Io(e,h):this.vo.delete(e)}}}zo(){var e,t=(e=this.mn)==null?void 0:e.persistence_save_debounce_ms;return ce(t)&&t>0?t:0}Uo(e){if(this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie")if(e)try{var t=ji(e,this.mn.cookie_persisted_properties||[]),i=qn(t,this.mn.cookie_persisted_properties||[]),r=JSON.stringify(t)+"|"+JSON.stringify(i),n=ne.ai(this.wo)||void 0;n&&qi(this.wo,n)===r&&(this.Wo=r,this.Vo=n)}catch{}else try{var a=ne.ai(this.wo)||void 0;this.Wo=a?qi(this.wo,a):void 0,this.Vo=a}catch{}}syncCookieProperties(){return this.Go(this.mn)}Go(e,t){if(t===void 0&&(t=!1),this.Eo&&!t||this.do||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;var i;try{i=ne.ai(this.wo)||void 0}catch{}if(!i||i===this.Vo)return!1;var r,n=qi(this.wo,i);try{r=Ni(JSON.parse(i))}catch{return!1}if((ne.ai(this.wo)||void 0)!==i)return!1;this.Wo=n,this.Vo=i;var a=Bn(this.wo,i),o=[...Pt,...a.properties],l={};if(Object.keys(r).forEach((m=>{var g=r[m];(b(g)||he(g)||g===""||m===j&&g!==de&&g!==Se)&&(l[m]=!0,delete r[m])})),Ne(r))return!1;var h=we in r||r[j]===de||r[j]===Se,u=this.props,c=u[we],d=u[j],v=Q({},u);[...Pt,...e.cookie_persisted_properties||[]].forEach((m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!l[m]&&(h||m!==we&&m!==j)){var g=v[m];!a.isValid&&Pt.indexOf(m)!==-1&&(g===!1||g===0)||delete v[m]}})),this.props=Q(v,r),at.forEach((m=>{var g=m in this.props;m in u===g&&dt(u[m],this.props[m])||(g?this.Ho(m,u[m],this.props[m]):this.Io(m,!0))})),!h||j in r||j in this.props||this.$o(j,de);var p=this.props[we],f=this.props[j];return!h||p===c&&f===d||(this.fo=!0,this.ho=!0,G.ni(Ls(this.wo),!0),this.No(Me),this.No(Ve),this.No(Ee),this.No(ft),this.No(Ge),this.No(gt),this.No(ct),this.No(Kt),this.No(ot),f===de&&(d===Se||r[j]===de||!b(c)&&p!==c)&&(sa(this.props,r),this.No(et)),f===Se?this.props.$user_id=p:delete this.props.$user_id,this.No(jt)),!0}consumeCookieIdentityChange(){var e=Ls(this.wo),t=this.ho||!!G.ai(e);return this.ho=!1,t&&G.oi(e),t}Zo(e){return e===void 0&&(e=!1),!(this.do||this.Eo&&!e||!this.mn.cookieWinsOnConflict||this.mn.persistence.toLowerCase()!=="localstorage+cookie"||(this.do=!0,0))}Qo(){this.do&&(b(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),delete this.oo[me],this.Ko(!0))}Yo(e){if(e===void 0&&(e=!0),this.do)try{e?this.Qo():b(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0)}finally{this.do=!1}}isDisabled(){return!!this.Eo}ko(e){lh.indexOf(e.persistence.toLowerCase())===-1&&(S.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i=(function(o,l){o===void 0&&(o=[]),l===void 0&&(l=!1);var h=[...Pt,...o];return w({},V,{ui(u){try{var c,d={};try{c=ne.ai(u)||void 0,d=c?Ni(JSON.parse(c)):{}}catch{}var v,p=JSON.parse(V.ai(u)||"{}");if(l){var f=Bn(u,c),m=[...Pt,...f.properties],g={};Object.keys(d).forEach((R=>{var A=d[R];he(A)||A===""||R===j&&A!==de&&A!==Se||(g[R]=A)}));var y=we in g||g[j]===de||g[j]===Se;if(Object.keys(g).length>0){var x,k=p[we],P=(x=p[j])!==null&&x!==void 0?x:de;h.forEach((R=>{if(m.indexOf(R)!==-1&&!(R in d)&&(y||R!==we&&R!==j)){var A=p[R];!f.isValid&&Pt.indexOf(R)!==-1&&(A===!1||A===0)||delete p[R]}})),!y||j in d||j in p||(p[j]=de),!y||(we in g?g[we]:p[we])===k&&(j in g?g[j]:p[j])===P||(Li.forEach((R=>delete p[R])),g[j]===Se&&we in g?p.$user_id=g[we]:delete p.$user_id,g[j]!==Se&&(delete p[$o],delete p[et]),delete p.__alias)}v=Q(p,g)}else v=Q(d,p);return V.ni(u,v),v}catch{}return null},ni(u,c,d,v,p,f){var m=V.ni(u,c,void 0,void 0,f);try{var g=ji(c,o);if(Object.keys(g).length){if(l){var y=pi(u),x=qn(g,o);if(ne.ni(y,x,d,v,p,f),ne.ai(y)!==JSON.stringify(x)){ne.oi(y,v);var k=ji(c);return ne.ni(u,k,d,v,p,f),m}}ne.ni(u,g,d,v,p,f)}}catch(P){V.si(P)}return m},oi(u,c){try{_?.localStorage.removeItem(u),ne.oi(u,c),ne.oi(pi(u),c)}catch(d){V.si(d)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,n=!1,a=e.persistence.toLowerCase();return a==="localstorage"&&V.ii()?(t=V,n=!0):a==="localstorage+cookie"&&i.ii()?(t=i,n=!0,r=!0):a==="sessionstorage"&&G.ii()?t=G:a==="memory"?t=Rr:a==="cookie"&&ne.ii()?(t=ne,r=!0):i.ii()?(t=i,n=!0,r=!0):ne.ii()?(t=ne,r=!0):t=Rr,this.ao=n,this.lo=r,t}To(e){return this.wo+"__"+e}So(e){return this.ao&&!!e.split_storage}properties(){var e={};return W(this.props,((t,i)=>{var r=xe(i);if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t))return;e[i]=t}})),e}load(e){if(e===void 0&&(e=!1),!this.Eo||e){var t=this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie",i=t?V.ui(this.wo):null,r={};if(t)try{W(r=Ni(ne.ui(this.wo)),((p,f)=>{(b(p)||he(p)||p==="")&&delete r[f]}))}catch{}var n=this.Zs.ui(this.wo);if(n&&(this.props=Q({},n)),this.uo&&this.Xo(),t&&n){var a,o,l=i?.[we],h=(a=i?.[j])!==null&&a!==void 0?a:de,u=n[we],c=(o=n[j])!==null&&o!==void 0?o:de;if(u!==l||c!==h){this.ho=!0,G.ni(Ls(this.wo),!0);var d=Q({},this.props);Li.forEach((p=>delete d[p])),c===de&&(h===Se||r[j]===de||!b(l)&&u!==l)&&(sa(d,r),delete d[et]),this.props=d;var v=new Set;Li.forEach((p=>{var f,m=(f=xe(p))==null?void 0:f.storageGroup;m&&v.add(m)})),v.forEach((p=>{var f={};W(this.props,((m,g)=>{var y;((y=xe(g))==null?void 0:y.storageGroup)===p&&(f[g]=m)})),Ne(f)?(V.oi(this.To(p)),this.oo[p]={}):V.ni(this.To(p),f)&&(this.oo[p]={persisted:!0,fingerprint:this.Lo(f,p)})}))}}G.ai(Ls(this.wo))&&(this.ho=!0)}}Xo(){for(var e of as){var t=V.ui(this.To(e));if(t&&!Ne(t)){var i=this.Ro(e);i.persisted=!0,this.ta(e)||(i.fingerprint=this.Lo(t,e)),this.ea(e,t)||Q(this.props,t)}}}ta(e){return Object.keys(this.props).some((t=>{var i;return((i=xe(t))==null?void 0:i.storageGroup)===e}))}ea(e,t){var i=oh[e];if(!i)return!1;var r=t[i],n=this.props[i];return ce(r)&&ce(n)&&n>r}refreshKey(e){var t;if(!(this.Eo||e===Ae&&this.mo)){var i=this.uo?(t=xe(e))==null?void 0:t.storageGroup:void 0,r=i?V.ui(this.To(i)):this.Zs.ui(this.wo);if(r&&e in r)this.$o(e,r[e],!1);else{if(i){var n=this.Zs.ui(this.wo);if(n&&e in n)return void this.$o(e,n[e],!1)}this.No(e,!1)}}}save(){if(!this.Eo){var e=this.zo();e>0?b(this.Jo)&&(this.Jo=setTimeout((()=>{this.Jo=void 0,this.Ko()}),e)):this.Ko()}}flush(){b(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0,this.Ko())}Ko(e){if(e===void 0&&(e=!1),!(this.Eo||this.do&&!e)){e||(this.syncCookieProperties(),this.mo||this.mn.cookieWinsOnConflict&&this.mn.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(Ae));var t=!e&&!this.co;t||(this.po=!1);var i=!!t&&this.qo();if(this.po)this.mn.debug&&S.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.uo)return this.ia(),void(i&&this.yo.forEach((n=>n())));var r=this.ra(this.Zs,this.wo,this.props,me);r==="written"&&this.Uo(this.props),r!=="failed"&&(this.vo.clear(),this.fo=!1,this.mo=!1),i&&this.yo.forEach((n=>n()))}}}ia(){var e=this,t=this.Fo(),i=t.main,r=t.groups,n=this.ra(this.Zs,this.wo,i,me);n==="written"&&this.Uo(i),n!=="failed"&&(this.fo=!1,this.mo=!1,at.forEach((l=>{var h;(h=xe(l))!=null&&h.storageGroup||this.vo.delete(l)})));var a=function(l){var h,u=r[l];if(Ne(u)&&((h=e.oo[l])==null||!h.persisted))return at.forEach((d=>{var v;((v=xe(d))==null?void 0:v.storageGroup)===l&&e.vo.delete(d)})),1;var c=e.ra(V,e.To(l),u,l);c!=="failed"&&at.forEach((d=>{var v=xe(d);v?.storageGroup!==l||c!=="written"&&v.volatile||e.vo.delete(d)}))};for(var o of as)a(o)}Fo(){var e={},t={flags:{},surveys:{}};return W(this.props,((i,r)=>{var n,a=(n=xe(r))==null?void 0:n.storageGroup;a?t[a][r]=i:e[r]=i})),{main:e,groups:t}}Lo(e,t){if(t===me)return JSON.stringify(e)+"|"+this.na+"|"+this.sa+"|"+this.oa;var i={};return W(e,((r,n)=>{var a;i[n]=(a=xe(n))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(i)}ra(e,t,i,r){var n,a=this.Ro(r);if(r!==me&&!a.dirty&&!b(a.fingerprint))return"skipped";try{if((n=this.Lo(i,r))===a.fingerprint)return a.dirty=!1,"skipped"}catch{n=void 0}return e.ni(t,i,this.na,this.sa,this.oa,this.mn.debug)?(a.dirty=!1,r!==me&&(a.persisted=!0),b(n)||(a.fingerprint=n),this.ao&&(a.storageValue=V.ai(t)),"written"):(this.mn.debug&&S.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,i=t!==void 0&&t;if(this.Bo(),b(this.Jo)||(clearTimeout(this.Jo),this.Jo=void 0),this.Zs.oi(this.wo,!1),this.Zs.oi(this.wo,!0),!i&&this.bo)for(var r of as)V.oi(this.To(r));i?delete this.oo[me]:this.oo={},this.Wo=void 0,this.Vo=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){this.syncCookieProperties(),b(t)&&(t="None"),this.na=b(i)?this.aa:i;var r=!1;if(W(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.$o(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(q(e)){this.syncCookieProperties(),this.na=b(t)?this.aa:t;var i=!1;if(W(e,((r,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==r||q(r)||C(r))&&(this.$o(n,r),i=!0)})),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t=typeof e=="string"?[e]:e,i=!1;for(var r of t)r in this.props&&(this.No(r),i=!0);i&&this.save()}update_campaign_params(){var e=E?.URL;if(e!==this._o){var t=Qo(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),i=!Ne(on(t));return i&&this.register(t),this._o=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=E?.referrer)?el(e):{})}update_referrer_info(){var e;this.register_once({$referrer:tl(),$referring_domain:E!=null&&E.referrer&&((e=Xt(E.referrer))==null?void 0:e.host)||_i},void 0)}set_initial_person_info(){if(!this.props[Fr]&&!this.props[Ir]){var e=sl(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[Bt]:this.lo?{r:Ns(e.r),u:e.u?Ns(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};W([Ir,Fr],(r=>{var n=this.props[r];n&&W(n,(function(a,o){e["$initial_"+nr(o)]=a}))}));var t=this.props[Bt];if(t){var i=(function(r,n){n===void 0&&(n=!1);var a=il(r,n),o={};return W(a,(function(l,h){o["$initial_"+nr(h)]=l})),o})(t,this.mn.disable_capture_url_hashes);Q(e,i)}return e}safe_merge(e){return W(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){var r=e.persistence!==t.persistence,n=!((f,m)=>{if(f.length!==m.length)return!1;var g=[...f].sort(),y=[...m].sort();return g.every(((x,k)=>x===y[k]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),a=r||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!i,h=!!this.Eo&&!l;l||this.Go(t,h),this.mn=e,!l&&(r||n||o)&&(this.Wo=void 0,this.Vo=void 0,this.Go(w({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),h));var u=a||o?this.ko(e):this.Zs;this.la();var c=this.So(e),d=a||c!==this.uo,v=!l&&(d||e.cross_subdomain_cookie!==this.sa||e.secure_cookie!==this.oa)&&this.Zo(h);this.co=d;try{if(this.aa=this.na=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){var p=this.props;this.clear(),this.Zs=u,this.uo=c,this.props=p,this.save()}else o&&(this.Zs=u,l||(delete this.oo[me],this.Ko()))}finally{this.co=!1,v&&this.Yo()}}la(){var e=this.props[Bt];if(this.lo&&q(e)&&typeof e.r=="string"){var t=Ns(e.r),i=typeof e.u=="string"?Ns(e.u):e.u;t===e.r&&i===e.u||this.$o(Bt,w({},e,{r:t,u:i}))}}set_disabled(e){this.Eo=e,this.Eo?this.remove():this.save()}set_cross_subdomain(e){e!==this.sa&&(this.sa=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.oa&&(this.oa=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[ps]||{};i[e]=t,this.$o(ps,i),this.save()}remove_event_timer(e){var t=this.props[ps]||{},i=t[e];return b(i)||(delete t[e],this.$o(ps,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.$o(e,t),this.save()}$o(e,t,i){var r;i===void 0&&(i=!0);var n=this.props[e];this.props[e]=t,i&&(e!==we&&e!==j||n===t||(this.fo=!0),e!==Ae||dt(n,t)||(this.mo=!0),this.Ho(e,n,t),(r=xe(e))!=null&&r.volatile||this.jo(e))}No(e,t){t===void 0&&(t=!0),delete this.props[e],t&&(Bi(e)&&this.Io(e,!0),e===Ae&&(this.mo=!0),this.jo(e))}jo(e){var t,i=(t=xe(e))==null?void 0:t.storageGroup;i&&(this.Ro(i).dirty=!0)}Ro(e){return this.oo[e]||(this.oo[e]={})}}var De={GZipJS:"gzip-js",Base64:"base64"},os={Activation:"events",Cancellation:"cancelEvents"},Vi={Popover:"popover",API:"api",Widget:"widget"},ut={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},zi={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Nr={Popover:"popover",Inline:"inline"};function js(s){var e=!0;return{dispose(){if(e){e=!1;var t=s();t&&Fe(t.then)&&t.then(void 0,(()=>{}))}}}}var uh={SHOWN:"product tour shown"},ia={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ra=se("[RateLimiter]");class hh{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((r=>{ra.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void ra.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:i})}},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,i,r;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),l=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Pr))!==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 h=1>l.tokens;if(h||e||(l.tokens=Math.max(0,l.tokens-1)),h&&!e){var u=(ce(l.dropped)?l.dropped:0)+1;l.dropped=u,!this.lastEventRateLimited&&this.ua(u)&&(l.dropped=0)}return this.lastEventRateLimited=h,(r=this.instance.persistence)==null||r.set_property(Pr,l),{isRateLimited:h,remainingTokens:l.tokens}}ha(e){var t=this.instance.config.property_denylist;return!C(t)||!t.includes(e)}da(){var e;if(this.ha("$current_url")&&this.ha("$pathname")&&ae!=null&&ae.pathname)return""+((e=ae.origin)!==null&&e!==void 0?e:"")+ae.pathname}ua(e){var t,i,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=this.da(),o=this.ha("$session_id")?(t=(i=this.instance).get_session_id)==null?void 0:t.call(i):void 0,l=[e+" event(s) dropped since the last warning",a?"triggered on "+a:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+l+". Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var vt=se("[RemoteConfig]");class nl{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=O._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}va(e){var t,i;(t=O.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}ca(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return vt.info("Using preloaded remote config",this.remoteConfig),void this.fa(this.remoteConfig);if(this._instance.pa())return void vt.warn("Remote config is disabled. Falling back to local config.");this.va((e=>{if(!e)return vt.info("No config found after loading remote JS config. Falling back to JSON."),void this.ca((t=>{this.fa(t.json,t)}));this.fa(e)}))}catch(e){vt.error("Error loading remote config",e),this.fa()}}fa(e,t){!e&&t&&(t.statusCode===0?t.error||vt.warn("Failed to fetch remote config from PostHog."):vt.error("Failed to fetch remote config from PostHog."));try{this._instance.fa(e?{ok:!0,config:e}:{ok:!1})}catch(r){vt.error("Error applying remote config",r)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)==null||i.ensureFlagsLoaded()}catch(r){vt.error("Error loading feature flags",r)}}}var ze=Uint8Array,Te=Uint16Array,ss=Uint32Array,cn=new ze([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]),dn=new ze([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]),na=new ze([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),al=function(s,e){for(var t=new Te(31),i=0;31>i;++i)t[i]=e+=1<<s[i-1];var r=new ss(t[30]);for(i=1;30>i;++i)for(var n=t[i];t[i+1]>n;++n)r[n]=n-t[i]<<5|i;return[t,r]},ol=al(cn,2),jr=ol[1];ol[0][28]=258,jr[258]=28;for(var aa=al(dn,0)[1],ll=new Te(32768),oe=0;32768>oe;++oe){var Rt=(43690&oe)>>>1|(21845&oe)<<1;ll[oe]=((65280&(Rt=(61680&(Rt=(52428&Rt)>>>2|(13107&Rt)<<2))>>>4|(3855&Rt)<<4))>>>8|(255&Rt)<<8)>>>1}var ws=function(s,e,t){for(var i=s.length,r=0,n=new Te(e);i>r;++r)++n[s[r]-1];var a,o=new Te(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new Te(i),r=0;i>r;++r)a[r]=ll[o[s[r]-1]++]>>>15-s[r];return a},Ot=new ze(288);for(oe=0;144>oe;++oe)Ot[oe]=8;for(oe=144;256>oe;++oe)Ot[oe]=9;for(oe=256;280>oe;++oe)Ot[oe]=7;for(oe=280;288>oe;++oe)Ot[oe]=8;var mi=new ze(32);for(oe=0;32>oe;++oe)mi[oe]=5;var ch=ws(Ot,9),dh=ws(mi,5),ul=function(s){return(s/8>>0)+(7&s&&1)},hl=function(s,e,t){(t==null||t>s.length)&&(t=s.length);var i=new(s instanceof Te?Te:s instanceof ss?ss:ze)(t-e);return i.set(s.subarray(e,t)),i},it=function(s,e,t){var i=e/8>>0;s[i]|=t<<=7&e,s[i+1]|=t>>>8},ls=function(s,e,t){var i=e/8>>0;s[i]|=t<<=7&e,s[i+1]|=t>>>8,s[i+2]|=t>>>16},Ui=function(s,e){for(var t=[],i=0;s.length>i;++i)s[i]&&t.push({s:i,f:s[i]});var r=t.length,n=t.slice();if(!r)return[new ze(0),0];if(r==1){var a=new ze(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(P,R){return P.f-R.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],h=0,u=1,c=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=r-1;)o=t[t[c].f>t[h].f?h++:c++],l=t[h!=u&&t[c].f>t[h].f?h++:c++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(i=1;r>i;++i)n[i].s>d&&(d=n[i].s);var v=new Te(d+1),p=qr(t[u-1],v,0);if(p>e){i=0;var f=0,m=p-e,g=1<<m;for(n.sort((function(P,R){return v[R.s]-v[P.s]||P.f-R.f}));r>i;++i){var y=n[i].s;if(e>=v[y])break;f+=g-(1<<p-v[y]),v[y]=e}for(f>>>=m;f>0;){var x=n[i].s;e>v[x]?f-=1<<e-v[x]++-1:++i}for(;i>=0&&f;--i){var k=n[i].s;v[k]==e&&(--v[k],++f)}p=e}return[new ze(v),p]},qr=function(s,e,t){return s.s==-1?Math.max(qr(s.l,e,t+1),qr(s.r,e,t+1)):e[s.s]=t},oa=function(s){for(var e=s.length;e&&!s[--e];);for(var t=new Te(++e),i=0,r=s[0],n=1,a=function(l){t[i++]=l},o=1;e>=o;++o)if(s[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=s[o]}return[t.subarray(0,i),e]},us=function(s,e){for(var t=0,i=0;e.length>i;++i)t+=s[i]*e[i];return t},Br=function(s,e,t){var i=t.length,r=ul(e+2);s[r]=255&i,s[r+1]=i>>>8,s[r+2]=255^s[r],s[r+3]=255^s[r+1];for(var n=0;i>n;++n)s[r+n+4]=t[n];return 8*(r+4+i)},la=function(s,e,t,i,r,n,a,o,l,h,u){it(e,u++,t),++r[256];for(var c=Ui(r,15),d=c[0],v=c[1],p=Ui(n,15),f=p[0],m=p[1],g=oa(d),y=g[0],x=g[1],k=oa(f),P=k[0],R=k[1],A=new Te(19),I=0;y.length>I;++I)A[31&y[I]]++;for(I=0;P.length>I;++I)A[31&P[I]]++;for(var D=Ui(A,7),F=D[0],N=D[1],$=19;$>4&&!F[na[$-1]];--$);var T,H,J,z,ee=h+5<<3,ie=us(r,Ot)+us(n,mi)+a,ve=us(r,d)+us(n,f)+a+14+3*$+us(A,F)+(2*A[16]+3*A[17]+7*A[18]);if(ie>=ee&&ve>=ee)return Br(e,u,s.subarray(l,l+h));if(it(e,u,1+(ie>ve)),u+=2,ie>ve){T=ws(d,v),H=d,J=ws(f,m),z=f;var ke=ws(F,N);for(it(e,u,x-257),it(e,u+5,R-1),it(e,u+10,$-4),u+=14,I=0;$>I;++I)it(e,u+3*I,F[na[I]]);u+=3*$;for(var pe=[y,P],fe=0;2>fe;++fe){var te=pe[fe];for(I=0;te.length>I;++I)it(e,u,ke[ge=31&te[I]]),u+=F[ge],ge>15&&(it(e,u,te[I]>>>5&127),u+=te[I]>>>12)}}else T=ch,H=Ot,J=dh,z=mi;for(I=0;o>I;++I)if(i[I]>255){var ge;ls(e,u,T[257+(ge=i[I]>>>18&31)]),u+=H[ge+257],ge>7&&(it(e,u,i[I]>>>23&31),u+=cn[ge]);var ue=31&i[I];ls(e,u,J[ue]),u+=z[ue],ue>3&&(ls(e,u,i[I]>>>5&8191),u+=dn[ue])}else ls(e,u,T[i[I]]),u+=H[i[I]];return ls(e,u,T[256]),u+H[256]},vh=new ss([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ph=(function(){for(var s=new ss(256),e=0;256>e;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;s[e]=t}return s})(),Wi=function(s,e,t){for(;t;++e)s[e]=t,t>>>=8};function fh(s,e){e===void 0&&(e={});var t=(function(){var c=4294967295;return{p(d){for(var v=c,p=0;d.length>p;++p)v=ph[255&v^d[p]]^v>>>8;c=v},d(){return 4294967295^c}}})(),i=s.length;t.p(s);var r,n,a,o,l,h=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(c,d,v,p,f,m){var g=c.length,y=new ze(p+g+5*(1+Math.floor(g/7e3))+f),x=y.subarray(p,y.length-f),k=0;if(!d||8>g)for(var P=0;g>=P;P+=65535){var R=P+65535;g>R?k=Br(x,k,c.subarray(P,R)):(x[P]=!0,k=Br(x,k,c.subarray(P,g)))}else{for(var A=vh[d-1],I=A>>>13,D=8191&A,F=(1<<v)-1,N=new Te(32768),$=new Te(F+1),T=Math.ceil(v/3),H=2*T,J=function(Pi){return(c[Pi]^c[Pi+1]<<T^c[Pi+2]<<H)&F},z=new ss(25e3),ee=new Te(288),ie=new Te(32),ve=0,ke=0,pe=(P=0,0),fe=0,te=0;g>P;++P){var ge=J(P),ue=32767&P,Be=$[ge];if(N[ue]=Be,$[ge]=ue,P>=fe){var Je=g-P;if((ve>7e3||pe>24576)&&Je>423){k=la(c,x,0,z,ee,ie,ke,pe,te,P-te,k),pe=ve=ke=0,te=P;for(var Y=0;286>Y;++Y)ee[Y]=0;for(Y=0;30>Y;++Y)ie[Y]=0}var le=2,_e=0,Re=D,ye=ue-Be&32767;if(Je>2&&ge==J(P-ye))for(var Ye=Math.min(I,Je)-1,yt=Math.min(32767,P),$e=Math.min(258,Je);yt>=ye&&--Re&&ue!=Be;){if(c[P+le]==c[P+le-ye]){for(var Ue=0;$e>Ue&&c[P+Ue]==c[P+Ue-ye];++Ue);if(Ue>le){if(le=Ue,_e=ye,Ue>Ye)break;var $l=Math.min(ye,Ue-2),vn=0;for(Y=0;$l>Y;++Y){var Si=P-ye+Y+32768&32767,pn=Si-N[Si]+32768&32767;pn>vn&&(vn=pn,Be=Si)}}}ye+=(ue=Be)-(Be=N[ue])+32768&32767}if(_e){z[pe++]=268435456|jr[le]<<18|aa[_e];var fn=31&jr[le],gn=31&aa[_e];ke+=cn[fn]+dn[gn],++ee[257+fn],++ie[gn],fe=P+le,++ve}else z[pe++]=c[P],++ee[c[P]]}}k=la(c,x,!0,z,ee,ie,ke,pe,te,P-te,k)}return hl(y,0,p+ul(k)+f)})(n=s,(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)),u=h.length;return(function(c,d){var v=d.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>d.level?4:d.level==9?2:0,c[9]=3,d.mtime!=0&&Wi(c,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),v){c[3]=8;for(var p=0;v.length>=p;++p)c[p+10]=v.charCodeAt(p)}})(h,e),Wi(h,u-8,t.d()),Wi(h,u-4,i),h}var gh=!!rr||!!Gr,cl="text/plain",Js=!1,dl=(s,e)=>{var t=s.split("#"),i=t[1],r=t[0].split("?"),n=r[0],a=r[1];if(!a)return s;var o=a.split("&").filter((l=>l.split("=")[0]!==e)).join("&");return n+(o?"?"+o:"")+(i?"#"+i:"")},$s=function(s,e,t){var i;t===void 0&&(t=!0);var r=s.split("?"),n=r[0],a=r[1],o=w({},e),l=(i=a?.split("&").map((u=>{var c,d=u.split("="),v=d[0],p=t&&(c=o[v])!==null&&c!==void 0?c:d[1];return delete o[v],v+"="+p})))!==null&&i!==void 0?i:[],h=(function(u,c){var d,v;c===void 0&&(c="&");var p=[];return W(u,(function(f,m){b(f)||b(m)||m==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(f)?f.name:f.toString()),v=encodeURIComponent(m),p[p.length]=v+"="+d)})),p.join(c)})(o);return h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},Gi=s=>{if(s.ga)return s.ga;var e=s.data,t=s.compression;if(e){if(t===De.GZipJS){var i=fh((function(o,l){var h=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var u=new ze(o.length+(o.length>>>1)),c=0,d=function(m){u[c++]=m},v=0;h>v;++v){if(c+5>u.length){var p=new ze(c+8+(h-v<<1));p.set(u),u=p}var f=o.charCodeAt(v);128>f?d(f):2048>f?(d(192|f>>>6),d(128|63&f)):f>55295&&57344>f?(d(240|(f=65536+(1047552&f)|1023&o.charCodeAt(++v))>>>18),d(128|f>>>12&63),d(128|f>>>6&63),d(128|63&f)):(d(224|f>>>12),d(128|f>>>6&63),d(128|63&f))}return hl(u,0,c)})(Vt(e)),{mtime:0});return{contentType:cl,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(t===De.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,h)=>String.fromCharCode(parseInt(h,16)))))})(Vt(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Vt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=Vt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},vl=s=>{var e,t,i=()=>s.transport==="sendBeacon"?{url:$s(s.url,{compression:De.Base64}),encodedBody:Gi(w({},s,{compression:De.Base64,ga:void 0}))}:{url:dl(s.url,"compression"),encodedBody:Gi(w({},s,{compression:void 0,ga:void 0}))};try{e=Gi(s)}catch(r){if($n(s.compression,es(s.url,"compression")))return S.error("Failed to gzip request body, sending uncompressed payload",r),i();throw r}return e&&$n(s.compression,es(s.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?vr(new Uint8Array(t)):ArrayBuffer.isView(t)&&vr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(Js=!0,i()):{url:s.url,encodedBody:e}},pl=s=>{try{return vl(s)}catch(e){return S.error(e),void(s.callback==null||s.callback({statusCode:0,error:e}))}},_h=(function(){var s=X((function*(e){var t=Vt(e.data),i=yield(function(n,a,o){return pr.apply(this,arguments)})(t,Z.DEBUG,{rethrow:!0});if(!i)return e;var r=yield i.arrayBuffer();return w({},e,{ga:{contentType:cl,body:r,estimatedSize:r.byteLength}})}));return function(e){return s.apply(this,arguments)}})(),mh=/Failed to fetch|NetworkError|Load failed/i,fl=s=>s?.name==="TypeError"&&mh.test(s?.message||""),gl=s=>{var e=pl(s);if(e){var t=e.url,i=e.encodedBody,r=i??{},n=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;W(s.headers,(function(p,f){l.append(f,p)})),n&&l.append("Content-Type",n);var h=null,u=!1;if(_n){var c=new _n;h={signal:c.signal,timeout:setTimeout((()=>{var p;u=!0,c.abort(vo("AbortError","PostHog request timed out"+((p=s.timeout)?" after "+p+"ms":"")))}),s.timeout)}}var d=p=>{u&&p?.name==="AbortError"||fl(p)?S.warn(p):S.error(p),s.callback==null||s.callback({statusCode:0,error:p})};try{var v;Gr(t,w({method:s?.method||"GET",headers:l,keepalive:s.method==="POST"&&!s.ma&&52428.8>(o||0),body:a,signal:(v=h)==null?void 0:v.signal},s.fetchOptions)).then((p=>p.text().then((f=>{var m={statusCode:p.status,text:f};if(p.status===200)try{m.json=JSON.parse(f)}catch(g){S.error(g)}s.callback==null||s.callback(m)})))).catch(d).finally((()=>h?clearTimeout(h.timeout):null))}catch(p){h&&clearTimeout(h.timeout),d(p)}}},Hr=s=>{try{var e,t=vl(s),i=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(be.sendBeacon(i,l))return;var h=C(s.data)?s.data:(e=s.data)==null?void 0:e.batch;if(C(h)&&h.length>1&&(o??0)>16384){var u=Math.ceil(h.length/2),c=d=>C(s.data)?d:w({},s.data,{batch:d});return Hr(w({},s,{data:c(h.slice(0,u))})),void Hr(w({},s,{data:c(h.slice(u))}))}S.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),gl(w({},s,{ma:!0}))}catch(d){S.warn("Beacon send failed",d)}},ua=(s,e,t,i)=>{var r=i==="query"?e==="POST"?"sent_at":"_":void 0;return $s(t===De.GZipJS?dl(s,"compression"):s,w({},r?{[r]:Date.now().toString()}:{},t===De.GZipJS?{}:{compression:t}))},Ys=[];Gr&&Ys.push({transport:"fetch",method:gl}),rr&&Ys.push({transport:"XHR",method(s){var e=pl(s);if(e){var t=new rr,i=e.encodedBody;t.open(s.method||"GET",e.url,!0);var r=i??{},n=r.contentType,a=r.body;W(s.headers,(function(o,l){t.setRequestHeader(l,o)})),n&&t.setRequestHeader("Content-Type",n),s.timeout&&(t.timeout=s.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{}s.callback==null||s.callback(o)}},t.send(a)}}}),be!=null&&be.sendBeacon&&Ys.push({transport:"sendBeacon",method:Hr});var Vr=3e3;class yh{constructor(e,t){this.ya=!0,this.ba=[],this._a=tt(t?.flush_interval_ms||Vr,250,5e3,S.createLogger("flush interval"),Vr),this.wa=e}enqueue(e){this.ba.push(e),this.ka||this.Sa()}unload(){this.xa();var e=this.ba.length>0?this.Ca():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Ta(w({},i,{transport:"sendBeacon"}))}))}enable(){this.ya=!1,this.Sa()}Sa(){var e=this;this.ya||(this.ka=setTimeout((()=>{if(this.xa(),this.ba.length>0){var t=this.Ca(),i=function(){var n=t[r],a=new Date().getTime();n.data&&C(n.data)&&W(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.Ta(n)};for(var r in t)i()}}),this._a))}Ta(e){try{this.wa(e)}catch(t){S.error(t)}}xa(){clearTimeout(this.ka),this.ka=void 0}Ca(){var e={};return W(this.ba,(t=>{var i,r=t,n=(r?r.batchKey:null)||r.url;b(e[n])&&(e[n]=w({},r,{data:[]})),(i=e[n].data)==null||i.push(r.data)})),this.ba=[],e}}var bh=["retriesPerformedSoFar"];class wh{constructor(e){this.Ma=!1,this.Ia=3e3,this.ba=[],this._instance=e,this.ba=[],this.Ea=!0,!b(_)&&"onLine"in _.navigator&&(this.Ea=_.navigator.onLine,this.Ra=()=>{this.Ea=!0,this.Pa()},this.Aa=()=>{this.Ea=!1},K(_,"online",this.Ra),K(_,"offline",this.Aa))}get length(){return this.ba.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=Na(e,bh);nt(t)&&(i.url=$s(i.url,{retry_count:t})),this._instance._send_request(w({},i,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(t??0))return void this.os(w({retriesPerformedSoFar:t},i));r.statusCode===0&&S.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.")}i.callback==null||i.callback(r)}}))}os(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(a){var o=3e3*Math.pow(2,a),l=o/2,h=Math.min(18e5,o),u=Math.random()-.5;return Math.ceil(h+u*(h-l))})(t),r=Date.now()+i;this.ba.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),S.warn(n),this.Ma||(this.Ma=!0,this.Fa())}Fa(){if(this.Oa&&clearTimeout(this.Oa),this.ba.length===0)return this.Ma=!1,void(this.Oa=void 0);this.Oa=setTimeout((()=>{this.Ea&&this.ba.length>0&&this.Pa(),this.Fa()}),this.Ia)}Pa(){var e=Date.now(),t=[],i=this.ba.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.ba=t,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Oa&&(clearTimeout(this.Oa),this.Oa=void 0),this.Ma=!1,b(_)||(this.Ra&&(_.removeEventListener("online",this.Ra),this.Ra=void 0),this.Aa&&(_.removeEventListener("offline",this.Aa),this.Aa=void 0)),this.ba)){var t=e.requestOptions;try{this._instance._send_request(w({},t,{transport:"sendBeacon"}))}catch(i){S.error(i)}}this.ba=[]}}class xh{constructor(e){this.La=()=>{var t,i,r,n;this.Da||(this.Da={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,h=o+(a?.clientHeight||0),u=a?.scrollHeight||0;this.Da.lastScrollY=Math.ceil(o),this.Da.maxScrollY=Math.max(o,(t=this.Da.maxScrollY)!==null&&t!==void 0?t:0),this.Da.maxScrollHeight=Math.max(l,(i=this.Da.maxScrollHeight)!==null&&i!==void 0?i:0),this.Da.lastContentY=h,this.Da.maxContentY=Math.max(h,(r=this.Da.maxContentY)!==null&&r!==void 0?r:0),this.Da.maxContentHeight=Math.max(u,(n=this.Da.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get $a(){return this._instance.config.scroll_root_selector}getContext(){return this.Da}resetContext(){var e=this.Da;return setTimeout(this.La,0),e}startMeasuringScrollPosition(){K(_,"scroll",this.La,{capture:!0}),K(_,"scrollend",this.La,{capture:!0}),K(_,"resize",this.La)}scrollElement(){var e;if(!this.$a)return _==null||(e=_.document)==null?void 0:e.documentElement;var t=C(this.$a)?this.$a:[this.$a];for(var i of t){var r,n=_==null||(r=_.document)==null?void 0:r.querySelector(i);if(n)return n}}Na(e){var t,i,r=e==="y"?"scrollTop":"scrollLeft";if(this.$a){var n=this.scrollElement();return n&&n[r]||0}return _?e==="y"?_.scrollY||_.pageYOffset||((t=_.document)==null||(t=t.documentElement)==null?void 0:t.scrollTop)||0:_.scrollX||_.pageXOffset||((i=_.document)==null||(i=i.documentElement)==null?void 0:i.scrollLeft)||0:0}scrollY(){return this.Na("y")}scrollX(){return this.Na("x")}}var kh=s=>sl(s?.config.mask_personal_data_properties,s?.config.custom_personal_data_properties,s?.config.disable_capture_url_hashes);class ha{constructor(e,t,i,r){this.Te=n=>{var a=this.qa();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.ja(this._instance)};this.Ba.register({[Sr]:o})}},this._instance=e,this.Ha=t,this.Ba=i,this.ja=r||kh,this.Ha.onSessionId(this.Te)}qa(){return this.Ba.props[Sr]}getSetOnceProps(){var e,t=(e=this.qa())==null?void 0:e.props;return t?"r"in t?il(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return W(on(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+nr(i)]=t})),e}}class yi{on(e,t){return this.za[e]||(this.za[e]=[]),this.za[e].push(t),()=>{this.za[e]=this.za[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.za[e]||[])i(t);for(var r of this.za["*"]||[])r(e,t)}constructor(){this.za={}}}var Mt=se("[SessionId]"),ca=864e5;class da{on(e,t){return this.Ua.on(e,t)}constructor(e,t,i){var r;if(this.Wa=null,this.Va=null,this.Ga=[],this.Za=void 0,this.Qa=!1,this.Ua=new yi,this.Ja=(l,h)=>!(!nt(l)||!nt(h))&&Math.abs(l-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===lt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=e.config,this.Ba=e.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.Ka=void 0,this._sessionActivityTimestamp=null,this.Ya=t||Ke,this.Xa=i||Ke;var n=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*tt(this.mn.session_idle_timeout_seconds||1800,60,36e3,Mt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+n+"_window_id",this.il="ph_"+n+"_primary_window_exists",this.rl()){var a=G.ui(this.el),o=G.ui(this.il);a&&!o?this.Ie=a:G.oi(this.el),G.ni(this.il,!0)}(r=this.mn.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return b(this.Ga)&&(this.Ga=[]),this.Ga.push(e),this.Bt&&e(this.Bt,this.Ie),()=>{this.Ga=this.Ga.filter((t=>t!==e))}}rl(){return this.mn.persistence!=="memory"&&!this.Ba.Eo&&G.ii()}sl(e){e!==this.Ie&&(this.Ie=e,this.rl()&&G.ni(this.el,e))}ol(){return this.Ie?this.Ie:this.rl()?G.ui(this.el):null}al(e){var t=this.Wa;return!he(t)&&!he(e)&&5e3>Math.abs(e-t)}ll(e,t,i){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Bt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Bt=e,n&&!r||n&&this.al(t)||(this.Wa=t,this.Ba.register({[qt]:[t,e,i]}))}ul(){var e,t=(e=this.mn)==null?void 0:e.persistence_save_debounce_ms;return nt(t)&&t>0}hl(){this.ul()?this.Ba.refreshKey(qt):(this.Ba.flush(),this.Ba.load())}dl(){var e;if(!he(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wa){this.hl();var t=this.vl();t[1]===this.Bt&&t[2]===this._sessionStartTimestamp&&(this.Wa=this._sessionActivityTimestamp,this.Ba.register({[qt]:[this._sessionActivityTimestamp,(e=this.Bt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ba.flush())}}cl(){var e=this.vl()[0],t=nt(e)?e:0,i=nt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}fl(e){return this.hl(),this.Ja(e,this.cl())}vl(){var e=this.Ba.props[qt];return C(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Wa=null,this.Ka=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(e,t){t===void 0&&(t=!1);var i=(function(r,n){n===void 0&&(n=new Date().getTime());try{var a=(o=>{var l=o.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(r);return a>n+6e4?void Mt.error("Bootstrap sessionID cannot be in the future"):a}catch(o){return void Mt.error("Invalid sessionID in bootstrap",o)}})(e);return!b(i)&&(t?this.Ka={sessionId:e,sessionStartTimestamp:i}:this.ll(e,new Date().getTime(),i),!0)}destroy(){this.Qa=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Za&&_&&(_.removeEventListener(di,this.Za,{capture:!1}),this.Za=void 0),this.Ga=[]}nl(){this.Za=()=>{this.dl(),this.rl()&&G.oi(this.il)},K(_,di,this.Za,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(e===void 0&&(e=!1),t===void 0&&(t=null),i===void 0&&(i=!1),this.mn.cookieless_mode===lt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),n=this.Bt;if(i)this.Va=r;else if(he(this.Va)||this.Va>r||r-this.Va>=1e3){var a,o;(a=(o=this.Ba).syncCookieProperties)==null||a.call(o),this.Va=r}var l=this.vl(),h=l[1],u=l[2],c=!b(n)&&h!==n,d=this.cl(),v=this.ol(),p=this.Ka,f=!!p&&(p.sessionStartTimestamp>r+6e4||r-p.sessionStartTimestamp>ca),m=p?f:nt(u)&&Math.abs(r-u)>ca,g=!1,y=c,x=!h||!!p,k=h,P=!x&&!e&&this.Ja(r,d);if(P){(P=this.fl(r))||Mt.info("cross-tab refresh kept the session alive",{sessionId:h});var R=this.vl();h=R[1],u=R[2]}if(x||P||m){y=!1;var A=p&&!f;h=A?p.sessionId:this.Ya(),v=this.Xa(),Mt.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!A,changeReason:{noSessionId:x,activityTimeout:P,sessionPastMaximumLength:m}}),u=A?p.sessionStartTimestamp:r,this.Ka=void 0,g=!0}else v||(v=this.Xa(),g=!0),(y=y||h!==k)&&(Mt.info("adopted cross-tab session id",{sessionId:h,windowId:v}),g=!0);var I=nt(d)&&e&&!m?d:r,D=nt(u)?u:new Date().getTime();this.sl(v),this.ll(h,I,D),e||this.tl();var F={noSessionId:x,activityTimeout:P,sessionPastMaximumLength:m,crossTabAdoption:y};return g&&this.Ga.forEach((N=>N(h,v,F))),{sessionId:h,windowId:v,sessionStartTimestamp:D,changeReason:g?F:void 0,lastActivityTimestamp:d}}tl(){this.Qa||(clearTimeout(this.pl),this.pl=setTimeout((()=>{if(!this.Qa)if(this.fl(new Date().getTime())){var e=this.Bt;this.resetSessionId(),this.Ua.emit("forcedIdleReset",{idleSessionId:e})}else this.tl()}),1.1*this.sessionTimeoutMs))}}var _l=function(s,e){if(!s)return!1;var t=s.userAgent;if(t&&yn(t,e))return!0;try{var i=s?.userAgentData;if(i!=null&&i.brands&&i.brands.some((r=>yn(r?.brand,e))))return!0}catch{}return!!s.webdriver};function ml(){return(ml=X((function*(){var s=be?.userAgentData;if(s!=null&&s.getHighEntropyValues)try{var e=yield s.getHighEntropyValues(["model"]),t=e?.model;return B(t)&&t.length>0?t:void 0}catch(i){return void S.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}function yl(s){var e;return!((e=s.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var bi=(s,e)=>{if(!(t=>{try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(s)}catch{return!1}},qs=s=>s.toLowerCase(),bl={exact:(s,e)=>e.some((t=>s.some((i=>t===i)))),is_not:(s,e)=>e.every((t=>s.every((i=>t!==i)))),regex:(s,e)=>e.some((t=>s.some((i=>bi(t,i))))),not_regex:(s,e)=>e.every((t=>s.every((i=>!bi(t,i))))),icontains:(s,e)=>e.map(qs).some((t=>s.map(qs).some((i=>t.includes(i))))),not_icontains:(s,e)=>e.map(qs).every((t=>s.map(qs).every((i=>!t.includes(i))))),gt:(s,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&s.some((r=>i>parseFloat(r)))})),lt:(s,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&s.some((r=>i<parseFloat(r)))}))};function wl(s,e){return!s||Object.entries(s).every((t=>{var i=t[1],r=e?.[t[0]];if(r==null)return!1;var n=bl[i.operator];return!!n&&n(i.values,[String(r)])}))}function Ki(s,e,t){return Vt({distinct_id:s,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var zr="custom",va="i.posthog.com",Eh=/^\/static\//,Sh=["/s/","/e/","/i/"];class Ph{constructor(e){this.gl={},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("."+va,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.gl[this.apiHost]||(this.gl[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":zr),this.gl[this.apiHost]}ml(e){if(Eh.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}yl(e){var t=Xt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}bl(e,t,i){if(e==="ui")return i;var r=i,n=this.instance.config.rewriteRequestPath;if(n){var a,o=((a=Xt(i))==null?void 0:a.href)||i;r=n(new URL(o)).toString()}if(n&&e==="api"&&Sh.some((d=>t.indexOf(d)===0))){var l=this.yl(r);if(l){var h,u=this.apiHost,c=this._l;((h=c)==null?void 0:h.apiHost)===u&&c.rewriteRequestPath===n||(c={apiHost:u,rewriteRequestPath:n,urls:new Set},this._l=c),c.urls.add(l)}}return r}isIngestionEndpoint(e){var t=this._l,i=this.yl(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.bl(e,t,this.uiHost+t);if(e==="flags")return this.bl(e,t,this.flagsApiHost+t);if(e==="assets"){var i=this.ml(t);if(i)return this.bl(e,t,""+i+t)}if(this.region===zr)return this.bl(e,t,this.apiHost+t);var r=va+t;switch(e){case"assets":return this.bl(e,t,"https://"+this.region+"-assets."+r);case"api":return this.bl(e,t,"https://"+this.region+"."+r)}}}var U=se("[Surveys]"),xl="seenSurvey_",kl=s=>{try{var e=(t=>((i,r)=>""+xl+(function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id})(r))(0,t))(s);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){U.error("Failed to persist survey seen state",t)}},Fh=[Vi.Popover,Vi.Widget,Vi.API],Ih={ignoreConditions:!1,ignoreDelay:!1,displayType:Nr.Popover},Oh=se("[PostHog ExternalIntegrations]"),$h={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ch{constructor(e){this._instance=e}Ys(e,t){var i;(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(r=>{if(r)return Oh.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var n,a,o,l=i[0],h=i[1];!h||(n=O.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.Ys($h[l],(()=>{var u;(u=O.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[l])==null||u.start(e._instance)})),!h&&(a=O.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=O.__PosthogExtensions__)==null||(o=o.integrations)==null||(o=o[l])==null||o.stop())};for(var i of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;t()}}}class Ah{constructor(e,t){this.A=e,this.Ns=t,this.wl=new Map,this.Os=!1}add(e){var t=this;return X((function*(){if(t.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.wl.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t.wl.set(e.name,e);try{var i=e.setup(t.Ns);i&&(yield i)}catch(n){var r=t.wl.get(e.name)===e;r&&t.wl.delete(e.name),t.A.error('Failed to set up browser extension "'+e.name+'"',n),r&&t.kl(e)}}))()}getExtension(e){return this.wl.get(e)}dispose(){if(!this.Os){this.Os=!0;var e=Array.from(this.wl.values()).reverse();for(var t of(this.wl.clear(),e))this.kl(t)}}kl(e){try{var t=e.dispose==null?void 0:e.dispose();t&&Fe(t.then)&&t.then(void 0,(i=>{this.A.error('Failed to dispose browser extension "'+e.name+'"',i)}))}catch(i){this.A.error('Failed to dispose browser extension "'+e.name+'"',i)}}}class Th{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);var i={};for(var r of e){var n=t?.get_property(r);b(n)||(i[r]=n)}return i}set(e,t){var i;(i=this._instance.persistence)==null||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}}var pa="extensionsRemoteConfig";class Rh{constructor(e){this.Os=!1,this.instance=e,this.A=S,this.Sl=e.xl,this.kv=new Th(e),this.onEvent=t=>js(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(r){this.A.error("Browser extension event listener failed",r)}}))),this.onRemoteConfig=t=>{if(this.Os)return js((()=>{}));var i=n=>{try{t(n)}catch(a){this.A.error("Browser extension remote config listener failed",a)}},r=this.instance.Cl.on(pa,i);return this.Sl&&i(this.Sl),js(r)},this.Tl=new Ah(S.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(Ps))!==null&&e!==void 0?e:this.distinctId}get deviceId(){var e=this.instance.get_property(Ps);return typeof e=="string"?e:void 0}get library(){return{name:Z.LIB_NAME,version:Z.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)==null?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,r,n=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(r=n?.sessionStartTimestamp)!==null&&r!==void 0?r:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.Tl.add(e)}getExtension(e){return this.Tl.getExtension(e)}capture(e,t,i){var r=this;return X((function*(){i?r.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return js(this.instance.Ml(e))}handleRemoteConfig(e){this.Os||(this.Sl=e,this.instance.Cl.emit(pa,e))}sendRequest(e,t){var i=this;return X((function*(){var r;t===void 0&&(t={});var n=i.instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",e),a={method:t.method,url:t.query?$s(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:t.target==="flags"&&t.compression==="best-available"?ar.Base64:void 0,timestampMode:t.sentAt};return t.transport==="sendBeacon"?(i.instance._send_request(a),{statusCode:202}):new Promise((o=>{a.callback=o,i.instance._send_request(a)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var xs={},Ji=0,ks=()=>{},fa='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',hs="Surveys module not available",ga="sanitize_properties is deprecated. Use before_send instead",El="Invalid value for property_denylist config: ",Mh=/^[A-Za-z0-9_-]{1,400}$/,Yi=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Dh=["token","distinct_id",Co],Nt="posthog",Sl=!gh&&Ce?.indexOf("MSIE")===-1&&Ce?.indexOf("Mozilla")===-1,Lh=s=>{var e={};return s&&s!=="unset"&&("2025-11-30">s||(e.strictMinimumDuration=!0),"2026-05-30">s||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">s||(e.streamNetworkBody=!0),"2026-08-30">s||(e.captureJsonLd=!0)),e},Zi=s=>{var e;return w({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Du(E?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ks,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:s??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ae&&B(ae?.search)&&ae.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(_==null||(e=_.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){S.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:$r,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Vr},error_tracking:{},_onCapture:ks},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Gu,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Lh(t),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),cookieWinsOnConflict:!(!t||t==="unset"||"2026-08-29">t)}))(s))},Nh=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],_a=s=>{var e={};for(var t of Nh){var i=t[0],r=t[1];b(s[i])||(e[r]=s[i])}var n=Q({},e,s),a=s.__preview_external_dependency_versioned_paths;return b(a)||(b(s.strict_script_versioning)&&(n.strict_script_versioning=!!a),B(a)&&b(s.asset_host)&&(n.asset_host=a)),C(s.property_blacklist)&&(b(s.property_denylist)?n.property_denylist=s.property_blacklist:C(s.property_denylist)?n.property_denylist=[...s.property_blacklist,...s.property_denylist]:S.error(El+s.property_denylist)),n};class jh{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(e){S.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Le{El(e){if(e){var t=this.wl.indexOf(e);t!==-1&&this.wl.splice(t,1)}}Rl(e,t){return this.El(e),this.wl.push(t),t.initialize==null||t.initialize(),t}Pl(){return this.config.cookieless_mode===lt||this.config.cookieless_mode===pt&&this.consent.isRejected()}Al(){if(!(this.Fl||this.config.reuseAnonymousId||this.config.segment||this.Pl())){var e,t,i,r=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";(r||this.config.disable_persistence)&&(this.Ol||(r?(e="persistence is set to '"+this.config.persistence+"'",t=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Fl=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===$t){var e=this.persistence;if(e){this.Dl()||e.load(!0);var t=this.get_distinct_id();if(!t||t===$t){var i=this.config.get_device_id(Ke());this.register({distinct_id:i,$device_id:i}),e.set_property(j,de)}this.$l()}}}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 jh,this.Nl=!1,this.version=Z.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new yi,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zi(),this.SentryIntegration=th,this.sentryIntegration=i=>(function(r,n){var a=Jo(r,n);return{name:Ko,processEvent:o=>a(o)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new xh(this),this.pageViewManager=new ea(this),this.rateLimiter=new hh(this),this.requestRouter=new Ph(this),this.consent=new Hu(this),this.externalIntegrations=new Ch(this);var t=(e=Le.__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:(i,r,n)=>{var a=B(i)?{[i]:r}:i;this.setPersonProperties(a),n?.({})},set_once:(i,r,n)=>{var a=B(i)?{[i]:r}:i;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(i=>S.info('send "'+i?.event+'"',i)))}init(e,t,i){if(i&&i!==Nt){var r,n=(r=xs[i])!==null&&r!==void 0?r:new Le;return n._init(e,t,i),xs[i]=n,xs[Nt][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var r,n,a;t===void 0&&(t={});var o,l=B(e)?e.trim():"";if(!l)return S.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 l!==((o=this.config)==null?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Zi(t.defaults),t.debug=this.Vl(t.debug),this.Gl=t,this.Zl=[],t.person_profiles?this.Ul=t.person_profiles:t.process_person&&(this.Ul=t.process_person);var h=Zi(t.defaults),u=_a(t),c=Q({},h,u,{name:i,token:l});q(h.rageclick)&&q(u.rageclick)&&(c.rageclick=Q({},h.rageclick,u.rageclick)),q(h.session_recording)&&q(u.session_recording)&&(c.session_recording=Q({},h.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&S.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:De.GZipJS;var d=this.Dl();if(this.persistence=new Hi(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Hi(w({},this.config,{persistence:"sessionStorage"}),d,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&G.ii()){var v=G.ui(this.jl);C(v)&&v.forEach((I=>{B(I)&&this.ql.add(I)}))}else G.oi(this.jl);var p=w({},this.persistence.props),f=w({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ql=new yh((I=>this.Jl(I)),this.config.request_queue_config),this.Kl=new wh(this),this.__request_queue=[];var m=this.Pl();m||(this.sessionManager=new da(this),this.sessionPropsManager=new ha(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((I,D,F)=>{(F!=null&&F.activityTimeout||F!=null&&F.sessionPastMaximumLength||F!=null&&F.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(S.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(m)}),0)):(S.info("Initializing extensions synchronously"),this.tu(m)),Z.DEBUG=Z.DEBUG||this.config.debug,Z.DEBUG&&S.info("Starting in debug mode",{this:this,config:t,thisC:w({},this.config),p,s:f}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=w({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var g=(n=t.bootstrap)==null?void 0:n.distinctID;if(this.Ol=!!g&&!_s(g),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var y=t.bootstrap.distinctID,x=this.get_distinct_id(),k=this.persistence.get_property(j);if(t.bootstrap.isIdentifiedID&&x!=null&&x!==y&&k===de)this.identify(y);else if(t.bootstrap.isIdentifiedID&&x!=null&&x!==y&&k===Se)S.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 P=this.config.get_device_id(Ke()),R=t.bootstrap.isIdentifiedID?P:y;this.persistence.set_property(j,t.bootstrap.isIdentifiedID?Se:de),this.register({distinct_id:y,$device_id:R})}}if(m)this.register_once({distinct_id:$t,$device_id:null},"");else if(!this.get_distinct_id()){var A=this.config.get_device_id(Ke());this.register_once({distinct_id:A,$device_id:A},""),this.persistence.set_property(j,de)}return K(_,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?Xn(this,(()=>this.eu())):this.eu(),Fe(this.config._onCapture)&&this.config._onCapture!==ks&&(S.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(I=>this.config._onCapture(I.event,I)))),this.config.ip&&S.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 ml.apply(this,arguments)})().then((I=>{I&&this.register({[Ri]:I})})).catch(ks),this}iu(e){var t=e;return B(t.name)&&Fe(t.setup)}ru(e,t){this.iu(e)?t.push((()=>{this.nu().add(e).catch((()=>e.dispose==null?void 0:e.dispose())).catch((i=>{S.error('Failed to dispose browser extension "'+e.name+'"',i)}))})):this.wl.push(e)}Xl(){var e,t,i,r,n,a,o=(e=(t=this.config.__extensionClasses)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:(i=Le.__defaultExtensionClasses)==null?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||((r=this.su)==null||r.call(this),this.su=void 0,this.featureFlags=new o(this)),Fe(this.featureFlags.onReloading)&&Fe(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):(n=(a=this.featureFlags).initialize)==null||n.call(a))}tu(e){var t,i,r,n,a,o,l,h=performance.now(),u=w({},Le.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.exceptions&&this.wl.push(this.exceptions=(t=this.exceptions)!==null&&t!==void 0?t:new u.exceptions(this)),u.historyAutocapture&&this.wl.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.wl.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.wl.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.wl.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ru(this.autocapture=new u.autocapture(this),c),u.surveys&&this.ru(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new u.surveys(this),c),u.logs&&this.ru(this.logs=(r=this.logs)!==null&&r!==void 0?r:new u.logs(this),c),u.metrics&&this.wl.push(this.metrics=(n=this.metrics)!==null&&n!==void 0?n:new u.metrics(this)),u.conversations&&this.wl.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.wl.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.wl.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.wl.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.wl.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.wl.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,eh)),u.toolbar&&this.wl.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.wl.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.wl.forEach((d=>{d.initialize&&c.push((()=>{d.initialize==null||d.initialize()}))})),c.push((()=>{if(this.ou){var d=this.ou;this.ou=void 0,this.wl.forEach((v=>v.onRemoteConfig==null?void 0:v.onRemoteConfig(d)))}})),this.au(c,h)}au(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.au(e,t)}),0);var i=e.shift();if(i)try{i()}catch(n){S.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[Ao]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[To]:r}),this.config.__preview_deferred_init_extensions&&S.info("PostHog extensions initialized ("+r+"ms)")}fa(e){var t;if(!E||!E.body)return S.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.fa(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ou=e),this.xl=e,this.compression=void 0,e.ok){var i,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=M(r.supportedCompression,De.GZipJS)?De.GZipJS:M(r.supportedCompression,De.Base64)?De.Base64:void 0),(i=r.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:$r}),(t=this.lu)==null||t.handleRemoteConfig(e),this.wl.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}eu(){try{this.config.loaded(this)}catch(i){S.critical("`loaded` function failed",i)}if(this.uu(),this.config.internal_or_test_user_hostname&&ae!=null&&ae.hostname){var e=ae.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.Pl())&&this.hu()}),1),this.du=new nl(this),this.du.load()}uu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ql)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ts(this.__request_queue,(e=>this.Jl(e))),this.__request_queue=[],this.uu()}_handle_unload(){var e,t,i,r,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(Mi),(i=this.logs)==null||i.flushLogs("sendBeacon"),(r=this.Ql)==null||r.unload(),(n=this.Kl)==null||n.unload()):this.vu()&&this.capture(Mi,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?Sl?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=w({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?(t=this.compression)!==null&&t!==void 0?t:e.compressionFallback:e.compression,(b(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(i=>{var r,n,a,o=w({},i);o.timeout=o.timeout||6e4;var l,h,u,c,d,v=(r=o.transport)!==null&&r!==void 0?r:"fetch";v==="sendBeacon"&&b(o.compression)&&o.data&&(o.compression=De.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(h=(d=(c=(C(l=o.data)?l:[l]).map((g=>w({},g,g.timestamp instanceof Date&&!isNaN(g.timestamp.getTime())?{timestamp:g.timestamp.toISOString()}:{}))))[0])==null||(u=d.properties)==null?void 0:u.token)!==null&&h!==void 0?h:d?.token,batch:c,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=(function(g,y){return y===void 0&&(y=new Date().toISOString()),C(g)?g.map((x=>w({},x,{sent_at:y}))):w({},g,{sent_at:y})})(o.data))),o.url=ua(o.url,o.method,o.compression,o.timestampMode);var p=Ys.filter((g=>!o.disableTransport||!g.transport||!o.disableTransport.includes(g.transport))),f=(n=(a=(function(g,y){for(var x=0;g.length>x;x++)if(g[x].transport===v)return g[x]})(p))==null?void 0:a.method)!==null&&n!==void 0?n:p[0].method;if(!f)throw new Error("No available transport method");var m=g=>{try{f(g)}catch(y){fl(y)?S.warn(y):S.error(y),o.callback==null||o.callback({statusCode:0,error:y})}};v!=="sendBeacon"&&o.data&&o.compression===De.GZipJS&&Cl&&typeof Promise<"u"&&!Js?_h(o).then((g=>{m(g)})).catch((g=>{if(Cn(g))return Js=!0,void m(w({},o,{compression:void 0,url:ua(i.url,i.method,void 0,i.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;var x="name"in y?String(y.name):"";return Cn(y)||x===_o})(g)&&(Js=!0),m(o)})):f(o)})(w({},e,{callback:i=>{var r,n;this.rateLimiter.checkForLimiting(i),400>i.statusCode||(r=(n=this.config).on_request_error)==null||r.call(n,i),e.callback==null||e.callback(i)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Jl(e){this.Kl?this.Kl.retriableRequest(e):this._send_request(e)}_execute_array(e){Ji++;try{var t,i=[],r=[],n=[];Ts(e,(o=>{if(o)if(C(t=o[0]))n.push(o);else if(Fe(o))try{o.call(this)}catch(l){S.error("Error executing queued PostHog call",o,l)}else C(o)&&t==="alias"?i.push(o):C(o)&&t.indexOf("capture")!==-1&&Fe(this[t])?n.push(o):r.push(o)}));var a=function(o,l){Ts(o,(function(h){try{if(C(h[0])){var u=l;W(h,(function(c){u=u[c[0]].apply(u,c.slice(1))}))}else l[h[0]].apply(l,h.slice(1))}catch(c){S.error("Error executing queued PostHog call",h,c)}}))};a(i,this),a(r,this),a(n,this)}finally{Ji--}}push(e){if(Ji>0&&C(e)&&B(e[0])){var t=Le.prototype[e[0]];Fe(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}cu(){var e,t=(e=this.persistence)==null?void 0:e.get_property(Ae);return B(t)&&Yi.test(t)?{value:t,delivered:!1}:q(t)&&B(t.value)&&Yi.test(t.value)?{value:t.value,delivered:t.delivered===!0}:void 0}fu(e,t,i,r){if(this.persistence){this.persistence.refreshKey(Ae);var n=this.cu();if(!r){if(i)return B(t)&&Yi.test(t)?(t!==n?.value&&this.persistence.register({[Ae]:{value:t,delivered:!1}}),{value:t,pending:t!==n?.value||!n.delivered}):void this.persistence.unregister(Ae);if(B(e)&&Mh.test(e)){if(n?.value.split(".")[3]===e)return{value:n.value,pending:!n.delivered};var a="fb.1."+Date.now()+"."+e;return this.persistence.register({[Ae]:{value:a,delivered:!1}}),{value:a,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(Ae)}}pu(e){if(this.persistence){this.persistence.refreshKey(Ae);var t=this.cu();t?.value!==e||t.delivered||this.persistence.register({[Ae]:{value:e,delivered:!0}})}}capture(e,t,i){var r,n,a,o,l,h,u,c,d,v;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!b(e)&&B(e)){this.Ll();var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var f=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(f==null||!f.isRateLimited){var m;t!=null&&t.$current_url&&!B(t?.$current_url)&&(S.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"||i!=null&&i.gu||S.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&&(m=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 g=new Date,y=i?.timestamp||g,x=En(i?.uuid,Ke),k={uuid:x,event:e,properties:this.calculateEventProperties(e,t||{},y,x)};e===Ht&&this.config.__preview_capture_bot_pageviews&&p&&(k.event="$bot_pageview",k.properties.$browser_type="bot"),f&&(k.properties.$lib_rate_limit_remaining_tokens=f.remainingTokens);var P=e==="$feature_flag_called"&&k.properties.$feature_flag_has_experiment===!1&&this.get_property(Gt)===!0;i?.$set&&!P&&(k.$set=i?.$set);var R=q(t?.$set)?t.$set:void 0,A=!(i==null||!i.$set)&&st in i.$set,I=A||!!R&&st in R,D=A?i==null||(r=i.$set)==null?void 0:r[st]:R?.[st],F=C(t?.$unset)?t.$unset:[],N=i?.$unset||[],$=F.indexOf(st)!==-1||N.indexOf(st)!==-1,T=this.fu((n=m)==null?void 0:n.fbclid,D,I,$);T&&k.properties.$process_person_profile===!0&&T.pending&&!I&&!P&&(k.$set=w({[st]:T.value},k.$set));var H=i?.$unset;H&&(k.$unset=H);var J,z,ee,ie=P?void 0:this.mu(i?.$set_once,e!==Ln,e===Cr);if(ie&&(k.$set_once=ie),i!=null&&i._noTruncate||(u=this.config.properties_string_max_length,c=k,d=Y=>B(Y)?Y.slice(0,u):Y,v=new Set,k=(function Y(le,_e){if(le!==Object(le))return d?d(le):le;if(!v.has(le)){var Re;if(v.add(le),C(le))Re=[],Ts(le,(Ye=>{Re.push(Y(Ye))}));else{var ye={};W(le,((Ye,yt)=>{v.has(Ye)||(ye[yt]=Y(Ye))})),Re=ye}return Re}})(c)),k.timestamp=y,b(i?.timestamp)||(k.properties.$event_time_override_provided=!0,k.properties.$event_time_override_system_time=g),P&&(k.properties=(function(Y,le){le===void 0&&(le=[]);var _e={},Re=ye=>{Y[ye]!==void 0&&(_e[ye]=Y[ye])};return ku.forEach(Re),le.forEach(Re),_e})(k.properties,Dh)),e===ut.DISMISSED||e===ut.SENT){var ve=t?.[zi.SURVEY_ID],ke=t?.[zi.SURVEY_ITERATION];kl({id:ve,current_iteration:ke}),k.$set=w({},k.$set,{[(J={id:ve,current_iteration:ke},z=e===ut.SENT?"responded":"dismissed",ee="$survey_"+z+"/"+J.id,J.current_iteration&&J.current_iteration>0&&(ee="$survey_"+z+"/"+J.id+"/"+J.current_iteration),ee)]:!0})}else e===ut.SHOWN&&(k.$set=w({},k.$set,{[zi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===uh.SHOWN){var pe=t?.[ia.TOUR_TYPE];pe&&(k.$set=w({},k.$set,{[ia.TOUR_LAST_SEEN_DATE+"/"+pe]:new Date().toISOString()}))}var fe=w({},k.properties.$set,k.$set);if(Ne(fe)||this.setPersonPropertiesForFlags(fe),!L(this.config.before_send)){var te=this.ns(k);if(!te)return;(k=te).uuid=En(k.uuid,Ke)}var ge=(a=(o=k.$set)==null?void 0:o[st])!==null&&a!==void 0?a:q((l=k.properties)==null?void 0:l.$set)?k.properties.$set[st]:void 0,ue=T!=null&&T.pending&&ge===T.value?T.value:void 0;this.Cl.emit("eventCaptured",k);var Be=(h=i?._url)!==null&&h!==void 0?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),Je=w({method:"POST",url:Be,data:k,compression:"best-available",timestampMode:i?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Be)?"body":"capture-body",batchKey:i?._batchKey},i!=null&&i.transport?{transport:i.transport}:{},ue?{fireCallbackOnDrop:!0,callback:Y=>{Y.statusCode>=200&&300>Y.statusCode&&this.pu(ue)}}:{});return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly||ue?this.Jl(Je):this.Ql.enqueue(Je),k}S.critical("This capture call is ignored due to client rate limiting.")}}else S.error("No event name provided to posthog.capture")}else S.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}getExtension(e){var t;return(t=this.lu)==null?void 0:t.getExtension(e)}nu(){var e;return(e=this.lu)!==null&&e!==void 0?e:this.lu=new Rh(this)}Ml(e){this.Bl.push(e);var t=!0;return()=>{if(t){t=!1;var i=this.Bl.indexOf(e);i!==-1&&this.Bl.splice(i,1)}}}yu(e){var t,i,r;return e===void 0&&(e=!0),!((t=this.persistence)==null||!t.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(j)===de&&((r=this.sessionPersistence)==null||r.clear(),this.ql.clear(),this.bu()),(i=this.featureFlags)==null||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.yu();var a=n?void 0:this.persistence.remove_event_timer(e),o=w({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Pl()&&(o[Co]=!0),e==="$snapshot"){var l=w({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!B(o.distinct_id)&&!ce(o.distinct_id)||_s(o.distinct_id))&&S.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var h,u=(function(A,I,D,F){var N,$,T,H;if(F===void 0&&(F=!1),!Ce)return{};var J,z=A?[...ts,...I||[]]:[],ee=ho(Ce),ie=ee[0],ve=ee[1],ke=(J="u">typeof navigator?navigator:void 0)!=null&&J.brave?{brave:!0}:{},pe={};b(D)||(pe.detectGoogleSearchApp=D);var fe={},te=(N=navigator)==null||(N=N.userAgentData)==null?void 0:N.platform,ge=($=navigator)==null?void 0:$.maxTouchPoints,ue=_==null||(T=_.screen)==null?void 0:T.width,Be=_==null||(H=_.screen)==null?void 0:H.height,Je=_?.devicePixelRatio;b(te)||(fe.userAgentDataPlatform=te),b(ge)||(fe.maxTouchPoints=ge),b(ue)||(fe.screenWidth=ue),b(Be)||(fe.screenHeight=Be),b(Je)||(fe.devicePixelRatio=Je);var Y,le,_e,Re,ye,Ye,yt,$e,Ue=Q(on({$os:ie,$os_version:ve,$browser:uo(Ce,navigator.vendor,ke,pe),$device:xn(Ce),$device_type:(le=Ce,_e=fe,$e=xn(le),$e===Ua||$e===za||$e==="Kobo"||$e==="Kindle Fire"||$e===ro?Jt:$e===Es||$e===Ut||$e===Ss||$e===lr?"Console":$e===Ga?"Wearable":$e?qe:_e?.userAgentDataPlatform==="Android"&&((Re=_e?.maxTouchPoints)!==null&&Re!==void 0?Re:0)>0?600>Math.min((ye=_e?.screenWidth)!==null&&ye!==void 0?ye:0,(Ye=_e?.screenHeight)!==null&&Ye!==void 0?Ye:0)/((yt=_e?.devicePixelRatio)!==null&&yt!==void 0?yt:1)?qe:Jt:"Desktop"),$timezone:rl(),$timezone_offset:ah()}),{$current_url:Is(F?_t(ae?.href):ae?.href,z,Os),$host:ae?.host,$pathname:ae?.pathname,$raw_user_agent:Ce.length>1e3?Ce.substring(0,997)+"...":Ce,$browser_version:Jl(Ce,navigator.vendor,ke,pe),$browser_language:ta(),$browser_language_prefix:(Y=ta(),typeof Y=="string"?Y.split("-")[0]:void 0),$screen_height:_?.screen.height,$screen_width:_?.screen.width,$viewport_height:_?.innerHeight,$viewport_width:_?.innerWidth,$lib:Z.LIB_NAME,$lib_version:Z.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Z.SDK_DIST_CHANNEL&&(Ue.$sdk_dist_channel=Z.SDK_DIST_CHANNEL),Ue})(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,i.getTime(),!0),d=c.windowId;o.$session_id=c.sessionId,o.$window_id=d}this.sessionPropsManager&&Q(o,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&Q(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(v=this.Kl)==null?void 0:v.length}catch(A){o.$sdk_debug_error_capturing_properties=String(A)}if(this.requestRouter.region===zr&&(o.$lib_custom_api_host=this.config.api_host),h=e!==Ht||n?e!==Mi||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=Q(o,h),e===Ht&&E&&(o.title=E.title),!b(a)){var p=i.getTime()-a;o.$duration=parseFloat((p/1e3).toFixed(3))}Ce&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var f=this.persistence.properties(),m=this.sessionPersistence.properties(),g=o.$groups,y=f.$groups;q(g)&&!Ne(g)&&(o.$groups=w({},q(y)?y:{},g)),W(["$referrer","$referring_domain"],(A=>{A in f&&delete m[A]}));var x={};if(this.Bl.length>0)for(var k of this.Bl.slice())try{Q(x,k())}catch(A){S.error("Failed to produce browser extension event properties",A)}(o=Q({},u,f,m,w({},x,o))).$is_identified=this._isIdentified(),C(this.config.property_denylist)?W(this.config.property_denylist,(function(A){delete o[A]})):S.error(El+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var P=this.config.sanitize_properties;P&&(S.error(ga),o=P(o,e));var R=this._u();return o.$process_person_profile=R,R&&!n&&this.wu("_calculate_event_properties"),o}mu(e,t,i){var r;if(t===void 0&&(t=!0),i===void 0&&(i=!1),!this.persistence||!this._u()||this.Nl&&!i)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=Q({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(S.error(ga),o=l(o,"$set_once")),t&&(this.Nl=!0),Ne(o)?void 0:o}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var r;(r=this.persistence)==null||r.register_once(e,t,i)}register_for_session(e){var t,i;(t=this.persistence)==null||t.syncCookieProperties(),this.yu(),(i=this.sessionPersistence)==null||i.register(e),Object.keys(e).forEach((r=>this.ql.add(r))),this.bu()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.ql.delete(e),this.bu()}ku(e,t){this.register({[e]:t})}Yl(){this.ql.forEach((e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)})),this.ql.clear(),this.bu()}bu(){var e;if(this.jl)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.Eo||!G.ii())G.oi(this.jl);else{var t=[];this.ql.forEach((i=>t.push(i))),t.length>0?G.ni(this.jl,t):G.oi(this.jl)}}getFeatureFlag(e,t){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return(i=this.featureFlags)==null?void 0:i.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 i,r;return(i=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t))!==null&&i!==void 0?i:t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,i){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.Cl.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:hs}),()=>{})}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.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:hs})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:hs})}renderSurvey(e,t){var i;(i=this.surveys)==null||i.renderSurvey(e,t)}displaySurvey(e,t){var i;t===void 0&&(t=Ih),(i=this.surveys)==null||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return(t=(i=this.surveys)==null?void 0:i.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:hs}}canRenderSurveyAsync(e,t){var i,r;return t===void 0&&(t=!1),(i=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:hs})}Su(e){return!e||_s(e)?(S.critical("Unique user id has not been set in posthog.identify"),!1):e===$t?(S.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())||(S.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return S.uninitializedWarning("posthog.identify");if(ce(e)&&(e=e.toString(),S.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Su(e)&&this.wu("posthog.identify")){this.Ll();var r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.yu(!1),o=this.persistence.Zo(),l=!1;try{var h=this.get_distinct_id();this.register({$user_id:e}),this.get_property(Ps)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),e!==h&&e!==this.get_property(jt)&&(this.unregister(jt),this.register({distinct_id:e}));var u=(this.persistence.get_property(j)||de)===de,c=e!==h,d=!c&&u;if(c&&u){var v,p=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:h};this.persistence.set_property(j,Se),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture(Cr,p,{$set:t||{},$set_once:i||{}}),this.Wl=Ki(e,t,i),(v=this.featureFlags)==null||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:h)}else if(d){this.persistence.set_property(j,Se);var f=t||{},m=i||{};this.setPersonPropertiesForFlags({$set:f,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Qo(),this.capture("$set",{$set:f,$set_once:m}),this.Wl=Ki(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||n||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ot)):d&&(t||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Yo(l)}}}setPersonProperties(e,t){if((e||t)&&this.wu("posthog.setPersonProperties")){var i=Ki(this.get_distinct_id(),e,t);this.Wl!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Wl=i):S.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(C(e)?e:[e]).filter((r=>B(r)&&r.length>0));i.length!==0&&this.wu("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Wl=null)}group(e,t,i){var r;if(e&&t){(r=this.persistence)==null||r.syncCookieProperties(),this.yu();var n=this.getGroups(),a=n[e]!==t;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:w({},n,{[e]:t})}),(a||i)&&this._u()){var o={$group_type:e,$group_key:t};i&&(o.$group_set=i),this.capture(Ln,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),a&&!i&&this.reloadFeatureFlags()}else S.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;t===void 0&&(t=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;t===void 0&&(t=!0),this.wu("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t=Oe(e)?e:e?.resetDeviceID,i=Oe(e)||e==null?void 0:e.bootstrap;this.xu(t,!1,i)}xu(e,t,i){var r,n,a;if(t===void 0&&(t=!1),S.info("reset"),!this.__loaded)return S.uninitializedWarning("posthog.reset");var o=i?.sessionID;this.config.bootstrap=i||((r=this.Gl)==null?void 0:r.bootstrap)||{},(n=this.featureFlags)==null||n.updateConfig==null||n.updateConfig(this.config,this.pa());var l=this.get_property(Ps),h=this.get_property(Ri),u=this.get_property(Ft),c=this.is_capturing();this.consent.reset(),t||!c||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=(a=this.persistence)==null||a.Zo==null?void 0:a.Zo(),v=!1;try{var p,f,m,g,y,x,k,P,R,A,I,D,F;if((p=this.persistence)==null||p.clear(),(f=this.sessionPersistence)==null||f.clear(),this.ql.clear(),this.bu(),b(u)||(A=this.persistence)==null||A.register({[Ft]:u}),(m=this.surveys)==null||m.reset(),(g=this.featureFlags)==null||g.reset(),(y=this.conversations)==null||y.reset(),(x=this.logs)==null||x.reset(),(k=this.metrics)==null||k.reset(),(P=this.persistence)==null||P.set_property(j,de),(R=this.sessionManager)==null||R.resetSessionId(),this.Wl=null,this.config.cookieless_mode===lt)this.register_once({distinct_id:$t,$device_id:null},"");else{var N=this.config.get_device_id(Ke());this.register_once({distinct_id:N,$device_id:e?N:l},""),e||b(h)||this.register({[Ri]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID===void 0||this.Pl()||((F=this.persistence)==null||F.set_property(j,i.isIdentifiedID?Se:de),this.register({distinct_id:i.distinctID})),(I=this.featureFlags)==null||I.initialize(),!(b(o)||(D=this.sessionManager)!=null&&D.setBootstrapSessionId(o,!0)))){var $=w({},i);delete $.sessionID,this.config.bootstrap=$}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var T;d&&((T=this.persistence)==null||T.Yo==null||T.Yo(v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return X((function*(){var i,r,n,a,o,l,h;if(t.__loaded){t.nu().dispose(),(i=t.sessionRecording)==null||i.dispose(),(r=t.logs)==null||r.flushLogs("sendBeacon"),(n=t.metrics)==null||n.flush("sendBeacon"),(a=t.Ql)==null||a.unload(),(o=t.Kl)==null||o.unload();try{var u;(u=t.featureFlags)==null||u.destroy()}catch(c){S.error("Error while destroying feature flags",c)}(l=t.persistence)==null||l.destroy(),(h=t.sessionPersistence)==null||h.destroy()}else S.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(i=this.conversations)==null||i.Cu()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)==null||e.Tu()}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),i=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(Eo)?(S.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(b(t)&&(t=this.get_distinct_id()),e!==t?(this.ku(jt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(S.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=w({},this.config);if(q(e)){var i,r,n,a,o,l,h,u,c,d,v,p;Q(this.config,_a(e));var f=this.Dl();(i=this.persistence)==null||i.update_config(this.config,t,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Hi(w({},this.config,{persistence:"sessionStorage"}),f,!1);var m,g=this.Vl(this.config.debug);Oe(g)&&(this.config.debug=g),Oe(this.config.debug)&&(this.config.debug?(Z.DEBUG=!0,V.ii()&&V.ni("ph_debug",!0),S.info("set_config",{config:e,oldConfig:t,newConfig:w({},this.config)})):(Z.DEBUG=!1,V.ii()&&V.oi("ph_debug"))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.pa()),(n=this.exceptionObserver)==null||n.onConfigChange(),(a=this.exceptions)==null||a.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((m=this.historyAutocapture)==null||m.startIfEnabledOrStop()),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(v=this.surveys)==null||v.loadIfEnabled(),this.$l(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Xn(this,ks,!1)}}_overrideSDKInfo(e,t){Z.LIB_NAME=e,Z.LIB_VERSION=t}startSessionRecording(e){var t,i,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&&((i=this.sessionRecording)==null||i.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){try{if(!this.exceptions)return;var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(w({},r,t))}catch{return}}addExceptionStep(e,t){var i;(i=this.exceptions)==null||i.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:Le.Mu}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return(t=(i=this.toolbar)==null?void 0:i.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:Nt;return t!==Nt&&(t=Nt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(j))===Se||((t=this.sessionPersistence)==null?void 0:t.get_property(j))===Se}_u(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===$r&&!this._isIdentified()&&Ne(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[jt])&&((t=this.persistence)==null||(t=t.props)==null||!t[ci]))}vu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this._u()||this.wu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.wu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}wu(e){return this.config.person_profiles==="never"?(S.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Al(),this.ku(ci,!0),!0)}Dl(){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!==pt)}$l(){var e,t,i,r,n,a=this.Dl();return this.is_capturing()||(i=this.logs)==null||i.Iu(),((e=this.persistence)==null?void 0:e.Eo)!==a&&((r=this.persistence)==null||r.set_disabled(a)),((t=this.sessionPersistence)==null?void 0:t.Eo)!==a&&((n=this.sessionPersistence)==null||n.set_disabled(a)),a&&(this.ql.clear(),this.bu()),a}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==lt){if(this.Pl()){var i,r,n,a,o,l;(i=this.sessionRecording)==null||i.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),(r=this.sessionManager)==null||r.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=new da(this),this.pageViewManager=new ea(this),this.persistence&&(this.sessionPropsManager=new ha(this,this.sessionManager,this.persistence));var h,u=(a=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&a!==void 0?a:(l=Le.__defaultExtensionClasses)==null?void 0:l.sessionRecording;u&&(this.sessionRecording=this.Rl(this.sessionRecording,new u(this)),this.xl&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.xl)))}var c,d;this.consent.optInOut(!0),this.$l(),this.uu(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==pt&&((c=this.surveys)==null||c.loadIfEnabled()),(b(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e?.captureEventName)!==null&&d!==void 0?d:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hu()}else S.warn(fa)}opt_out_capturing(){if(this.config.cookieless_mode!==lt){var e,t,i=this.config.cookieless_mode===pt?this.sessionRecording:void 0;i?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===pt&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===pt&&(this.register({distinct_id:$t,$device_id:null}),this.El(i),this.sessionRecording=void 0,(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else S.warn(fa)}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===lt||(this.config.cookieless_mode===pt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return be?_l(be,this.config.custom_blocked_useragents):void 0}hu(){E&&(E.visibilityState==="visible"?this.Hl||(this.Hl=!0,this.capture(Ht,{title:E.title},{send_instantly:!0}),this.zl&&(E.removeEventListener(Qt,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),K(E,Qt,this.zl)))}debug(e){e===!1?(_?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(_?.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}))}pa(){var e=this.Gl||{};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?(S.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,i,r,n,a){var o=i in t&&!L(t[i]),l=r in t&&!L(t[r]);return o?t[i]:!!l&&(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[r])})(e,"advanced_disable_flags","advanced_disable_decide",0,S)}ns(e){var t;if(L(this.config.before_send))return e;var i=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(Ll),r=C(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of r)try{if(n=a(n),L(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Dl(e.event)?S.warn(o+". This can cause unexpected behavior."):S.info(o),null}n.properties&&!Ne(n.properties)||S.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(h){return S.error("Error in beforeSend function for event '"+e.event+"':",h),null}for(var l of i)if(n.properties&&L(n.properties[l]))return S.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.io)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Vl(e){var t=Oe(e)&&!e,i=V.ii()&&V.ai("ph_debug")==="true";return!t&&(!!i||e)}}Le.__defaultExtensionClasses={},Le.Mu=(()=>{var s=()=>{};return{trace:s,debug:s,info:s,warn:s,error:s,fatal:s}})(),(function(s,e){for(var t=0;e.length>t;t++)s.prototype[e[t]]=Ru(s.prototype[e[t]])})(Le,["identify"]);class Pl{constructor(e){this.disabled=e===!1;var t=q(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,i){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>i-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Qi="$copy_autocapture",Bs=se("[AutoCapture]");function Xi(s,e){return e.length>s?e.slice(0,s)+"...":e}function qh(s){if(s.previousElementSibling)return s.previousElementSibling;var e=s;do e=e.previousSibling;while(e&&!mt(e));return e}function Bh(s,e){var t,i,r=e.e,n=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!mt(s))return{props:{}};for(var u=[s],c=new Set([s]),d=s;d.parentNode&&!je(d,"body")&&qo>u.length;)if(jo(d.parentNode)){var v=d.parentNode.host;if(c.has(v))break;c.add(v),u.push(v),d=v}else{if(!mt(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}var p,f,m=[],g={},y=!1,x=!1;if(W(u,(I=>{var D=Lr(I);if(je(I,"a")){var F=I.getAttribute("href");y=!!(D&&F&&bs(F))&&(h?_t(F):F)}M(fi(I),"ph-no-capture")&&(x=!0),m.push((function($,T,H,J,z){z===void 0&&(z=!1);var ee=$.tagName.toLowerCase(),ie={tag_name:ee};un.indexOf(ee)>-1&&!H&&(ie.$el_text=ee.toLowerCase()==="a"||ee.toLowerCase()==="button"?Xi(1024,Yn($)):Xi(1024,Fs($)));var ve=fi($);ve.length>0&&(ie.classes=ve.filter((function(te){return te!==""}))),W($.attributes,(function(te){var ge;if((!Wo($)||["name","id","class","aria-label"].indexOf(te.name)!==-1)&&(J==null||!J.includes(te.name))&&!T&&bs(te.value)&&(!B(ge=te.name)||ge.substring(0,10)!=="_ngcontent"&&ge.substring(0,7)!=="_nghost")){var ue=te.value;te.name==="class"&&(ue=ln(ue).join(" ")),ie["attr__"+te.name]=Xi(1024,te.name==="href"&&z?_t(ue):ue)}}));for(var ke=1,pe=1,fe=$;fe=qh(fe);)ke++,fe.tagName===$.tagName&&pe++;return ie.nth_child=ke,ie.nth_of_type=pe,ie})(I,n,a,o,h));var N=(function($){if(!Lr($))return{};var T={};return W($.attributes,(function(H){if(H.name&&H.name.indexOf("data-ph-capture-attribute")===0){var J=H.name.replace("data-ph-capture-attribute-",""),z=H.value;J&&z&&bs(z)&&(T[J]=z)}})),T})(I);W(N,(($,T)=>{({}).hasOwnProperty.call(g,T)||(g[T]=$)}))})),x)return{props:{},explicitNoCapture:x};if(a||(m[0].$el_text=je(s,"a")||je(s,"button")?Yn(s):Fs(s)),y){var k,P;m[0].attr__href=y;var R=(k=Xt(y))==null?void 0:k.host,A=_==null||(P=_.location)==null?void 0:P.host;R&&A&&R!==A&&(p=y)}return{props:Q({$event_type:r.type,$ce_version:1},l?{}:{$elements:m},{$elements_chain:(f=m,C(f)?(function(I){return I.map((D=>{var F,N,$="";if(D.tag_name&&($+=D.tag_name),D.attr_class)for(var T of(D.attr_class.sort(),D.attr_class))$+="."+T.replace(/"/g,"");var H=w({},D.text?{text:D.text}:{},{"nth-child":(F=D.nth_child)!==null&&F!==void 0?F:0,"nth-of-type":(N=D.nth_of_type)!==null&&N!==void 0?N:0},D.href?{href:D.href}:{},D.attr_id?{attr_id:D.attr_id}:{},D.attributes),J={};return Ks(H).sort(((z,ee)=>{return(ve=ee[0])>(ie=z[0])?-1:ie>ve?1:0;var ie,ve})).forEach((z=>{var ee=z[1];return J[Zn(z[0].toString())]=Zn(ee.toString())})),($+=":")+Ks(J).map((z=>z[0]+'="'+z[1]+'"')).join("")})).join(";")})((function(I){return I.map((D=>{var F,N,$={text:(F=D.$el_text)==null?void 0:F.slice(0,400),tag_name:D.tag_name,href:(N=D.attr__href)==null?void 0:N.slice(0,2048),attr_class:Qu(D),attr_id:D.attr__id,nth_child:D.nth_child,nth_of_type:D.nth_of_type,attributes:{}};return Ks(D).filter((T=>T[0].indexOf("attr__")===0)).forEach((T=>$.attributes[T[0]]=T[1])),$}))})(f)):"")},(t=m[0])!=null&&t.$el_text?{$el_text:(i=m[0])==null?void 0:i.$el_text}:{},p&&r.type==="click"?{$external_click_url:p}:{},g)}}class Hh{constructor(e){this.name="autocapture",this.Rs=!1,this.Ps=null,this.As=!1,this.Fs=!1,this.mn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Os=!1,this.Ls=e,this.Ls.refresh(this.mn),this.rageclicks=new Pl(this.mn.rageclick),this.Ds=null}setup(e){this.$s(),this.Ns=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?t.dispose():(this.qs=t,this.startIfEnabled())}dispose(){var e;this.Os||(this.Os=!0,this.Ns=void 0,(e=this.qs)==null||e.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var e,t;return this.Bs(),this.mn.url_allowlist=(e=this.mn.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),this.mn.url_ignorelist=(t=this.mn.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),this.mn}Hs(){if(this.isBrowserSupported()){if(_&&E){var e=this.zs=i=>{i=i||_?.event;try{this.Us(i)}catch(r){Bs.error("Failed to capture event",r)}};if(K(E,"submit",e,{capture:!0}),K(E,"change",e,{capture:!0}),K(E,"click",e,{capture:!0}),this.Bs().capture_copied_text){var t=this.Ws=i=>{i=i||_?.event;try{this.Us(i,Qi)}catch(r){Bs.error("Failed to capture clipboard event",r)}};K(E,"copy",t,{capture:!0}),K(E,"cut",t,{capture:!0}),K(E,"paste",t,{capture:!0})}}}else Bs.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(E?.removeEventListener("submit",this.zs,!0),E?.removeEventListener("change",this.zs,!0),E?.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(E?.removeEventListener("copy",this.Ws,!0),E?.removeEventListener("cut",this.Ws,!0),E?.removeEventListener("paste",this.Ws,!0),this.Ws=void 0),this.Rs=!1}startIfEnabled(){!this.Os&&this.Ns&&this.isEnabled&&!this.Rs&&(this.Hs(),this.Rs=!0)}onRemoteConfig(e){if(!this.Os)if(this.As=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Fs=t.elementsChainAsString);var i,r=t.autocapture_opt_out;Oe(r)&&((i=this.Ns)==null||i.kv.set(fr,r),this.Ps=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Ds=e}getElementSelectors(e){var t,i=[];return(t=this.Ds)==null||t.forEach((r=>{var n=E?.querySelectorAll(r);n?.forEach((a=>{e===a&&i.push(r)}))})),i}get isEnabled(){var e,t;if(this.Os)return!1;var i=(e=this.Ns)==null?void 0:e.kv.get(fr),r=this.Ps,n=this.Bs(),a=n.remoteRequestsDisabled&&!this.As;if(he(r)&&!Oe(i)&&!a)return!1;var o=(t=this.Ps)!==null&&t!==void 0?t:!!i;return!!n.enabled&&!o}Us(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i=Mr(e);No(i)&&(i=i.parentNode||null);var r,n=this.$s();t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&zo(i,n.rageclick)&&this.Us(e,"$rageclick");var a=t===Qi,o=a?w({},n,{dom_event_allowlist:void 0}):n;if(i&&(function(g,y,x,k,P,R){var A;if(!_||hn(g)||x!=null&&x.url_allowlist&&!Vn(x.url_allowlist,R)||x!=null&&x.url_ignorelist&&Vn(x.url_ignorelist,R))return!1;if(x!=null&&x.dom_event_allowlist){var I=x.dom_event_allowlist;if(I&&!I.some((H=>y.type===H)))return!1}var D=Uo(g,k),F=D.parentIsUsefulElement,N=D.targetElementList;if(!(function(H,J){var z=J?.element_allowlist;if(b(z))return!0;var ee,ie=function(ke){if(z.some((pe=>ke.tagName.toLowerCase()===pe)))return{v:!0}};for(var ve of H)if(ee=ie(ve))return ee.v;return!1})(N,x)||!Dr(N,x?.css_selector_allowlist)||Dr(N,(A=x?.css_selector_ignorelist)!==null&&A!==void 0?A:Wu))return!1;try{var $=_.getComputedStyle(g);if($&&$.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0}catch{}var T=g.tagName.toLowerCase();switch(T){case"html":return!1;case"form":return(P||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(P||["change","click"]).indexOf(y.type)>=0;default:return F?(P||["click"]).indexOf(y.type)>=0:(P||["click"]).indexOf(y.type)>=0&&(un.indexOf(T)>-1||g.getAttribute("contenteditable")==="true")}})(i,e,o,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=Bh(i,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Fs,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(u.$element_selectors=c),t===Qi){var d=e.type||"clipboard";if(d!=="paste"){var v,p,f=_==null||(v=_.getSelection())==null?void 0:v.toString(),m=Bo(f);if(!m)return!1;u.$selected_content=m,u.$clipboard_text_length=(p=f?.length)!==null&&p!==void 0?p:0}u.$copy_type=d}return(l=this.Ns)==null||l.capture(t,u).catch((g=>Bs.error("Failed to capture event",g))),!0}}}isBrowserSupported(){return Fe(E?.querySelectorAll)}}class Vh{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,i=q(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.pa(),e.url_allowlist=i?.url_allowlist,e.url_ignorelist=i?.url_ignorelist,e.dom_event_allowlist=i?.dom_event_allowlist,e.element_allowlist=i?.element_allowlist,e.css_selector_allowlist=i?.css_selector_allowlist,e.css_selector_ignorelist=i?.css_selector_ignorelist,e.element_attribute_ignorelist=i?.element_attribute_ignorelist,e.capture_copied_text=i?.capture_copied_text}}var cs=se("[ExceptionAutocapture]"),ma=()=>{},ya=s=>{var e;if(Fe(s))return(e=s.__posthog_layer__)!==null&&e!==void 0?e:s.__rrweb_layer__};function Fl(s,e,t){try{if(!(e in s))return ma;var i={next:s[e]},r=t((function(){for(var n=arguments.length,a=new Array(n),o=0;n>o;o++)a[o]=arguments[o];return i.next.apply(this,a)}));return Fe(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),s[e]=r,()=>{if(s[e]!==r)for(var n=s[e],a=ya(n);a;){if(a.next===r)return void(a.next=i.next);a=ya(n=a.next)}else s[e]=i.next}}catch{return ma}}var zh=se("[TracingHeaders]"),wt=se("[Web Vitals]"),ba=9e5,wa=["CLS","FCP","INP","LCP"],Uh=["INP","LCP"],Wh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Hs="disabled",xa="lazy_loading",ds="awaiting_config",Vs="missing_config";se("[SessionRecording]"),se("[SessionRecording]");var Ur="[SessionRecording]",rt=se(Ur),Gh=se("[Heatmaps]");function er(s){return q(s)&&"clientX"in s&&"clientY"in s&&ce(s.clientX)&&ce(s.clientY)}var zs=se("[Product Tours]"),tr=s=>{var e;return!s.config.disable_product_tours&&!((e=s.persistence)==null||!e.get_property(rn))},Kh=["$set_once","$set"],Ze=se("[SiteApps]"),ka="Error while initializing PostHog app with config id ",Il=(s,e)=>s!=null&&s.then?s.then(e):e(s),Dt="SDK is not enabled or survey functionality is not yet loaded",Ea="Disabled. Not loading surveys.";class Jh{constructor(e,t){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Eu=!1,this.Ru=[],this.Pu=null,this.Au=null,this.Os=!1,this.Fu=new Set,this.onRemoteConfig=i=>{if(!this.Os&&!this.mn.disableSurveys){if(!i.ok)return U.warn("Remote config unavailable. Not loading surveys.");var r=i.config.surveys;if(L(r))return U.warn("Flags not loaded yet. Not loading surveys.");this.Ou=Oe(r)?r:r.length>0,U.info("flags response received, isSurveysEnabled: "+this.Ou),this.loadIfEnabled()}},this.Ls=e,this.Lu=t}setup(e){if(!this.Os)return this.Du=e,Il(e.kv.initialize(),(()=>{if(this.Du===e&&!this.Os){this.Du=void 0,this.Ns=e;var t=e.onRemoteConfig(this.onRemoteConfig);this.Os?t.dispose():(this.qs=t,this.loadIfEnabled())}}))}dispose(){var e,t,i;this.Os||(this.Os=!0,this.Du=void 0,this.Ns=void 0,(e=this.qs)==null||e.dispose(),this.qs=void 0,(t=this._surveyEventReceiver)==null||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)==null||i.dispose==null||i.dispose(),this._surveyManager=null,this.Ru=[],this.Pu=null,this.Fu.forEach((r=>clearTimeout(r))),this.Fu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(r!=null&&r.startsWith(xl)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((n=>localStorage.removeItem(n)))}catch{}}loadIfEnabled(){if(!this.Os&&this.Ns){var e=this.mn;if(!this._surveyManager)if(this.Eu)U.info("Already initializing surveys, skipping...");else if(e.disableSurveys)U.info(Ea);else if(e.cookielessMode&&this.Ls.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var t=this.Ls.getExtensions();if(t){if(!b(this.Ou)||e.advancedEnableSurveys){var i=this.Ou||e.advancedEnableSurveys;this.Eu=!0;try{var r=t.generateSurveys;if(r)return this.$u(r,i),void(this.Eu=!1);var n=t.loadExternalDependency;if(!n)return this.Nu(an),void(this.Eu=!1);n((a=>{try{if(this.Os)return;var o=this.Ls.getExtensions();a||o==null||!o.generateSurveys?this.Nu("Could not load surveys script",a):this.$u(o.generateSurveys,i)}finally{this.Eu=!1}}))}catch(a){throw this.Eu=!1,this.Nu("Error initializing surveys",a),a}}}else U.error("PostHog Extensions not found.")}}}$u(e,t){this.Os||(this._surveyManager=e(t),this._surveyEventReceiver=this.Ls.createEventReceiver(),U.info("Surveys loaded successfully"),this.qu({isLoaded:!0}))}Nu(e,t){U.error(e,t),this.qu({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ru.push(e),this._surveyManager&&this.qu({isLoaded:!0}),()=>{this.Ru=this.Ru.filter((t=>t!==e))}}getSurveys(e,t){var i;t===void 0&&(t=!1);var r=(i=this.Ns)!==null&&i!==void 0?i:this.Lu;if(r&&!this.Os){if(this.mn.disableSurveys)return U.info(Ea),e([]);var n=r.kv.get(kr);if(n&&!t)return e(n,{isLoaded:!0}),void(this.ju()&&this.getSurveys((()=>{}),!0));if(this.Pu)this.Pu.then((l=>{this.Os||e(l.surveys,l.context)})).catch((l=>U.error("Error in survey callback",l)));else{var a=this.Bu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then((l=>{try{return this.Hu(r,l)}catch(h){return U.error("Error processing surveys response",h),this.Hu(r,{statusCode:0,error:h})}}),(l=>this.Hu(r,{statusCode:0,error:l})));this.Pu=a;var o=()=>{this.Pu===a&&(this.Pu=null)};a.then((l=>{o(),this.Os||e(l.surveys,l.context)}),o).catch((l=>U.error("Error in survey callback",l)))}}}Bu(e,t){var i=this.Ns;return i?i.sendRequest(e,t):new Promise((r=>r({statusCode:0,error:new Error(Dt)})))}Hu(e,t){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:Dt}};var i=t.statusCode;if(i!==200||!t.json){var r="Surveys API could not be loaded, status: "+i;return i!==0?U.error(r):t.error||U.warn(r),this.Au=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Au=null;var n,a=t.json.surveys||[],o=a.filter((l=>(function(h){return!(!h.start_date||h.end_date)})(l)&&(yl(l)||(function(h){var u;return!((u=h.conditions)==null||(u=u.actions)==null||(u=u.values)==null||!u.length)})(l))));return o.length>0&&((n=this._surveyEventReceiver)==null||n.register(o)),e.kv.set({[kr]:a,[hi]:Date.now()}),{surveys:a,context:{isLoaded:!0}}}ju(){return this.zu()&&!this.Pu&&!this.Uu()}zu(){var e,t,i=(e=(t=this.Ns)!==null&&t!==void 0?t:this.Lu)==null?void 0:e.kv.get(hi);return ce(i)&&Date.now()-i>3e5}Uu(){return ce(this.Au)&&3e5>Date.now()-this.Au}markSurveyAsSeen(e,t){var i,r={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};kl(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}qu(e){for(var t of this.Ru)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){U.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);U.warn("init was not called")}Wu(e){var t=null;return this.getSurveys((i=>{var r;t=(r=i.find((n=>n.id===e)))!==null&&r!==void 0?r:null})),t}Vu(e){if(L(this._surveyManager))return{eligible:!1,reason:Dt};var t=typeof e=="string"?this.Wu(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Gu(e){if(L(this._surveyManager))return{eligible:!1,reason:Dt};var t=typeof e=="string"?this.Wu(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(L(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:Dt};var t=this.Gu(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Dt})):new Promise((i=>{this.getSurveys((r=>{var n,a=(n=r.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(a){var o=this.Gu(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var r;if(L(this._surveyManager))U.warn("init was not called");else{var n=typeof e=="string"?this.Wu(e):e;if(n!=null&&n.id)if(Fh.includes(n.type)){var a=E?.querySelector(t);if(a)if((r=n.appearance)!=null&&r.surveyPopupDelaySeconds){U.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var l,h;this.Fu.delete(o),this.Os||(U.info("Rendering survey "+n.id+" with delay of "+((l=n.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(h=this._surveyManager)==null||h.renderSurvey(n,a,i),U.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.Fu.add(o)}else this._surveyManager.renderSurvey(n,a,i);else U.warn("Survey element not found")}else U.warn("Surveys of type "+n.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(e,t){var i;if(L(this._surveyManager))U.warn("init was not called");else{var r=this.Wu(e);if(r){var n=r;if((i=r.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=w({},r,{appearance:w({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Nr.Popover&&t.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var a=this.Vu(r);if(!a.eligible)return void U.warn("Survey is not eligible to be displayed: ",a.reason)}t.displayType!==Nr.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(e){L(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}function Lt(s,e,t){if(L(s))return!1;switch(t){case"exact":return s===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(s);case"regex":try{return new RegExp(e).test(s)}catch{return!1}default:return!1}}class Yh{constructor(e){this.Zu=new Set,this.Qu=new Set,this.Ju=new yi,this.Ku=(t,i)=>this.Yu(t,i)&&this.Xu(t,i)&&this.th(t,i)&&this.eh(t,i),this.Yu=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e}init(){var e,t;b((e=this._instance)==null?void 0:e._addCaptureHook)||(this.ih=(t=this._instance)==null?void 0:t._addCaptureHook(((i,r)=>{this.on(i,r)})))}dispose(){var e;(e=this.ih)==null||e.call(this),this.ih=void 0,this.Ju=new yi}register(e){var t,i;if(!b((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((n=>{var a;this.Zu.add(n),(a=n.steps)==null||a.forEach((o=>{this.Qu.add(o?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var r=new Set;this.Zu.forEach((n=>{var a;(a=n.steps)==null||a.forEach((o=>{o!=null&&o.selector&&r.add(o.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(e){this.Zu.clear(),this.Qu.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Qu.has(e)||this.Qu.has(t.event))&&this.Zu.forEach((i=>{this.rh(t,i)&&this.Ju.emit("actionCaptured",i.name)}))}nh(e){this.onAction("actionCaptured",(t=>e(t)))}rh(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.Ku(e,i))return!0;return!1}onAction(e,t){return this.Ju.on(e,t)}Xu(e,t){if(t!=null&&t.url){var i,r=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!r||typeof r!="string"||!Lt(r,t.url,t.url_matching||"contains"))return!1}return!0}th(e,t){return!!this.sh(e,t)&&!!this.oh(e,t)&&!!this.ah(e,t)}sh(e,t){var i;if(t==null||!t.href)return!0;var r=this.lh(e);if(r.length>0)return r.some((o=>Lt(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!a&&Lt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}oh(e,t){var i;if(t==null||!t.text)return!0;var r=this.lh(e);if(r.length>0)return r.some((h=>Lt(h.text,t.text,t.text_matching||"exact")||Lt(h.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(h){for(var u,c=[],d=/(?::|")text="(.*?)"/g;!L(u=d.exec(h));)c.includes(u[1])||c.push(u[1]);return c})(l),a=t.text,o=t.text_matching||"exact",n.some((h=>Lt(h,a,o))))}ah(e,t){var i,r;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$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}lh(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}eh(e,t){return t==null||!t.properties||t.properties.length===0||wl(t.properties.reduce(((i,r)=>{var n=C(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return i[r.key]={values:n,operator:r.operator||"exact"},i}),{}),e?.properties)}}class Zh{constructor(e){var t;this.uh=[],this._instance=e,this.hh=new Map,this.dh=new Map,this.fh=new Map,this.ph=(t=this._instance)==null||t.onSessionId==null?void 0:t.onSessionId((i=>this.gh(i)))}mh(e){return!1}yh(){return null}bh(e){}_h(){}wh(e,t){return!!e&&wl(e.propertyFilters,t?.properties)}kh(e,t){var i=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=i.get(a.name)||[];o.push(r.id),i.set(a.name,o)}}))})),i}Sh(e,t,i){var r=(i===os.Activation?this.hh:this.dh).get(e),n=[];return this.xh((a=>{n=a.filter((o=>r?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[i])==null||(o=o.values)==null?void 0:o.find((h=>h.name===e));return this.wh(l,t)}))}register(e){this.Ch(e,!1)}replace(e){this.Ch(e,!0)}Ch(e,t){var i;b((i=this._instance)==null?void 0:i._addCaptureHook)||(this.Th(e,t),this.Mh(e,t))}Mh(e,t){var i=e.filter((a=>{var o;return(o=a.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length}));if(t&&this.fh.clear(),i.length!==0){this.Ih||(this.Ih=new Yh(this._instance),this.Ih.init(),this.Ih.nh((a=>this.onAction(a))));var r=[];i.forEach((a=>{var o;(o=a.conditions)==null||(o=o.actions)==null||o.values.forEach((l=>{if(r.push(l),l.name){var h,u=(h=this.fh.get(l.name))!==null&&h!==void 0?h:[];u.includes(a.id)||u.push(a.id),this.fh.set(l.name,u)}}))})),t?this.Ih.replace(r):this.Ih.register(r)}else{var n;t&&((n=this.Ih)==null||n.replace([]))}}Eh(e,t){t.forEach(((i,r)=>{var n,a=(n=e.get(r))!==null&&n!==void 0?n:[];i.forEach((o=>{a.includes(o)||a.push(o)})),e.set(r,a)}))}Th(e,t){var i,r,n=e.filter((h=>{var u,c;return((u=h.conditions)==null?void 0:u.events)&&((c=h.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),a=e.filter((h=>{var u,c;return((u=h.conditions)==null?void 0:u.cancelEvents)&&((c=h.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0})),o=this.kh(e,os.Activation),l=this.kh(e,os.Cancellation);t?(this.hh=o,this.dh=l):(this.Eh(this.hh,o),this.Eh(this.dh,l)),(n.length!==0||a.length!==0)&&((i=this.ih)!==null&&i!==void 0||(this.ih=(r=this._instance)==null?void 0:r._addCaptureHook(((h,u)=>{this.onEvent(h,u)}))))}onEvent(e,t){var i,r,n=this.Rh(),a=(t==null||(i=t.properties)==null?void 0:i.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.Ph(e,a);if(o==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.Ah([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),this.Fh(a),void this.Oh([a])}if(this.dh.has(e)){var l=this.Sh(e,t,os.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((u=>u.id))}),this.Ah(l.map((u=>u.id))),l.forEach((u=>this.Lh(u.id))))}if(this.hh.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.hh.get(e)});var h=this.Sh(e,t,os.Activation);this.Dh(h.map((u=>u.id)))}}onAction(e){this.fh.has(e)&&this.Dh(this.fh.get(e)||[])}Dh(e){var t;if(e.length!==0){var i=!((t=this._instance)==null||t.get_session_id==null||!t.get_session_id()),r=[];for(var n of e)i&&this.mh(n)?this.Fh(n)&&this.$h(n):r.push(n);r.length>0&&(this.uh=[...new Set([...this.uh,...r])]),this.Rh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Fh(e){this.uh=this.uh.filter((i=>i!==e));var t=this.Nh();return!t.includes(e)&&(this.qh([...t,e]),this.jh(),!0)}Ah(e){var t=new Set(e);this.uh=this.uh.filter((n=>!t.has(n)));var i=this.Bh(),r=i.filter((n=>!t.has(n)));r.length!==i.length&&(this.qh(r),r.length===0&&this.Hh()),this.Oh(e)}zh(){var e,t=this.yh();if(!t)return{};var i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i&&typeof i=="object"?i:{}}$h(e){if(this.yh()){var t=this.zh();this.bh(w({},t,{[e]:Date.now()}))}}Oh(e){if(this.yh()){var t=this.zh(),i={},r=!1;for(var n of Object.entries(t)){var a=n[0],o=n[1];e.includes(a)?r=!0:i[a]=o}r&&(Ne(i)?this._h():this.bh(i))}}Uh(){this.yh()&&this._h()}getActivationTimestamp(e){if(this.Nh().includes(e)){var t=this.zh()[e];return ce(t)?t:void 0}}Bh(){var e,t=this.Wh();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}Nh(){var e,t,i=this.Bh();if(i.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Vh()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&r===n?i:[]}jh(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.Gh(t)}Hh(){this.Zh()}gh(e){var t,i=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Vh()];if(i&&i!==e){var r=this.Bh(),n=this.zh();r.length>0&&(this.qh([]),r.filter((a=>ce(n[a]))).forEach((a=>this.Lh(a)))),this.Hh(),this.Uh()}}getActivatedIds(){return[...new Set([...this.Nh(),...this.uh])].filter((e=>!this.Qh(e)))}dispose(){var e,t,i;(e=this.ph)==null||e.call(this),this.ph=void 0,(t=this.ih)==null||t.call(this),this.ih=void 0,(i=this.Ih)==null||i.dispose(),this.Ih=void 0}reset(){this.uh=[],this.Bh().length>0&&this.qh([]),this.Hh(),this.Uh()}getEventToItemsMap(){return this.hh}Jh(){return this.Ih}}class Qh extends Zh{constructor(e){super(e)}Wh(){return Er}Vh(){return Ws}yh(){return Gs}bh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Gs]:e})}_h(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Gs)}mh(e){var t,i;this.xh((n=>{i=n.find((a=>a.id===e))}));var r=(t=i)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return ce(r)&&r>0}Kh(){return ut.SHOWN}xh(e){var t;(t=this._instance)==null||t.getSurveys(e)}Lh(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Rh(){return U}qh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Er]:e})}Gh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ws]:e})}Zh(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Ws)}Qh(){return!1}Ph(e,t){var i;this.xh((n=>{i=n.find((a=>a.id===t))}));var r=!i||(function(n){var a;return yl(n)&&!((a=n.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||n.schedule==="always"})(i);return r?e===ut.SHOWN?"consume":"ignore":e===ut.SHOWN?"persist":e===ut.DISMISSED||e===ut.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Xh{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);var t={};for(var i of e){var r=this._instance.get_property(i);b(r)||(t[i]=r)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach((t=>this._instance.unregister(t))):this._instance.unregister(e)}}class ec{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=O?.__PosthogExtensions__;if(e){var t=e.generateSurveys,i=e.loadExternalDependency;return{generateSurveys:t?r=>t(this._instance,r):void 0,loadExternalDependency:i?r=>i(this._instance,"surveys",r):void 0}}}createEventReceiver(){return new Qh(this._instance)}}var tc=_!=null&&_.location?gi(_.location.hash,"__posthog")||gi(location.hash,"state"):null,Sa="_postHogToolbarParams",Pa=se("[Toolbar]"),Fa=se("[FeatureFlags]");class sc{constructor(e,t){t===void 0&&(t=!1),this.Yh=!1,this.update(e,t)}update(e,t){this.Xh=((i,r)=>{var n,a,o,l,h;return{bootstrap:{featureFlags:(n=i.bootstrap)==null?void 0:n.featureFlags,featureFlagPayloads:(a=i.bootstrap)==null?void 0:a.featureFlagPayloads},remoteRequestsDisabled:r,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(o=i.remote_config_refresh_interval_ms)!==null&&o!==void 0?o:3e5,requestTimeoutMs:i.feature_flag_request_timeout_ms,compression:i.disable_compression?void 0:"best-available",evaluationContexts:(l=(h=i.evaluation_contexts)!==null&&h!==void 0?h:i.evaluation_environments)!==null&&l!==void 0?l:[],flagKeys:C(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Yh||(Fa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yh=!0),b(e.flag_keys)||C(e.flag_keys)||Fa.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Xh}}var Ia=se("[FeatureFlags]"),xt=se("[FeatureFlags]",{debugEnabled:!0}),sr=`" failed. Feature flags didn't load in time.`,Oa="connection_error",$a=s=>{for(var e={},t=0;s.length>t;t++)e[s[t]]=!0;return e},Ca=s=>{var e={};for(var t of Ks(s||{})){var i=t[1];i&&(e[t[0]]=i)}return e},Aa=s=>Kr(s)&&(s.name==="RangeError"&&s.message.indexOf("Maximum call stack size exceeded")===0||s.name==="InternalError"&&s.message==="too much recursion"),We=se("[Error tracking]"),Wr="webkit-masked-url:",ic=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Wr],rc=["__firefox__","__gCrWeb"],Ta="Refusing to render web experiment since the viewer is a likely bot",nc={icontains:(s,e)=>e.toLowerCase().indexOf(s.toLowerCase())>-1,not_icontains:(s,e)=>e.toLowerCase().indexOf(s.toLowerCase())===-1,regex:(s,e)=>bi(e,s),not_regex:(s,e)=>!bi(e,s),exact:(s,e)=>e===s,is_not:(s,e)=>e!==s};class Pe{get mn(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((r=>{Pe.td("retrieved web experiments from the server"),t.ed=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.ed&&(Pe.td("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.ed)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);B(o)&&n.variants[o]&&t.rd(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var h=n.variants[l];Pe.nd(h,t._instance)&&t.rd(n.name,l,h.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Pe.td(Ta);else if(!this.mn.disable_web_experiments){if(L(this.ed))return this.ed=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Pe.td("applying feature flags",e),e.forEach((t=>{var i;if(this.ed&&(i=this.ed)!=null&&i.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.ed)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.rd(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=Pe.getWindowLocation();if(e!=null&&e.search){var t=es(e?.search,"__experiment_id"),i=es(e?.search,"__experiment_variant");t&&i&&(Pe.td("previewing web experiments "+t+" && "+i),this.getWebExperiments((r=>{this.sd(parseInt(t),i,r)}),!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.mn.disable_web_experiments&&!i)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.mn.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}sd(e,t,i){var r=i.filter((n=>n.id===e));r&&r.length>0&&(Pe.td("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.rd(r[0].name,t,r[0].variants[t].transforms))}static nd(e,t){return!L(e.conditions)&&Pe.od(e,t)&&Pe.ad(e)}static od(e,t){var i;if(L(e.conditions)||L((i=e.conditions)==null?void 0:i.url))return!0;var r=Pe.getWindowLocation();if(r){var n,a,o,l=Do(t,r.href);return(n=e.conditions)==null||!n.url||nc[(a=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,l)}return!1}static getWindowLocation(){return _?.location}static ad(e){var t;if(L(e.conditions)||L((t=e.conditions)==null?void 0:t.utm))return!0;var i=Qo();if(i.utm_source){var r,n,a,o,l,h,u,c,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.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)==i.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==i.utm_medium,f=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_term)==i.utm_term;return d&&p&&f&&v}return!1}static td(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];S.info("[WebExperiments] "+e,i)}rd(e,t,i){this._is_bot()?Pe.td(Ta):t!=="control"?i.forEach((r=>{if(r.selector){var n;Pe.td("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)}))}})):Pe.td("Control variants leave the page unmodified.")}_is_bot(){return be&&this._instance?_l(be,this.mn.custom_blocked_useragents):void 0}}var He=se("[Conversations]"),kt="Conversations not available yet.";function Ra(s,e){var t,i,r,n,a,o,l,h=(t=s?.flushIntervalMs)!==null&&t!==void 0?t:3e3,u=(i=s?.maxBufferSize)!==null&&i!==void 0?i:100,c=e!=null&&e.consoleCapture?void 0:(r=s?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,d=b(c)?Math.max(u,2048):Math.max(u,c),v=w({},(function(){var p="",f="";try{var m=be?.userAgent;if(m){var g=ho(m);p=g[0],f=g[1]}}catch{}return(function(y,x){var k=(function(P){if(P)return{}.hasOwnProperty.call(Tn,P)?Tn[P]:P})(y);return w({},k?{"os.name":k}:{},x?{"os.version":x}:{})})(p,f)})(),s?.resourceAttributes);return{serviceName:(n=(a=v?.["service.name"])!==null&&a!==void 0?a:s?.serviceName)!==null&&n!==void 0?n:e?.serviceNameDefault,serviceVersion:(o=v?.["service.version"])!==null&&o!==void 0?o:s?.serviceVersion,environment:(l=v?.["deployment.environment"])!==null&&l!==void 0?l:s?.environment,resourceAttributes:v,beforeSend:s?.beforeSend,flushIntervalMs:h,maxBufferSize:u,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var ac=["debug","log","warn","error","info"],Ma="console",Ol="__posthogHandledLogsRequestError",ir=(s,e)=>{var t=s instanceof Error?s:new Error(e);return t[Ol]=!0,t},Da=s=>!!s&&typeof s=="object"&&s[Ol]===!0,Ei={featureFlags:class{constructor(s){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=Ia,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.We=()=>{var e=this.wd();this._d=0,e&&this.reloadFeatureFlags()},this.kd=()=>{var e,t=this.Sd;b(t)||this.mn.remoteRequestsDisabled||!E||E.visibilityState==="hidden"||Date.now()-((e=this.xd)!==null&&e!==void 0?e:0)<t||(this.reloadFeatureFlags(),this.Cd())},this.Ve=()=>{E?.visibilityState==="visible"&&this.kd()},"get"in s?this.Ls=s:(this._instance=s,this.Td=new sc(s.config,s.pa()),this.Ls=this.Td)}updateConfig(s,e){var t;(t=this.Td)==null||t.update(s,e),this.Ns&&this.Md()}setup(s){return this.Du=s,this.A=s.logger.createLogger("[FeatureFlags]"),Il(s.kv.initialize(),(()=>{this.Du===s&&(this.Du=void 0,this.Ns=s,this.Id(s))}))}Id(s){var e;if(this.Ns===s)return _&&K(_,"online",this.We),this.Md(),this.Ed=s.registerDynamicEventProperties((()=>this.Rd()?this.ud:this.hd)),this.Pd=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.onCrossTabFeatureFlagChange((()=>{this.Ad(),this.Fd(),this.Od()})),this.Fd(),this.initialize()}Md(){var s=this.mn.refreshIntervalMs,e=!this.mn.remoteRequestsDisabled&&E&&!b(s)&&s>0?s:void 0;e!==this.Sd&&(this.Ld(),b(e)||(this.Sd=e,this.Cd(),E!=null&&E.addEventListener&&K(E,Qt,this.Ve)))}Cd(){b(this.Sd)||(b(this.Dd)||clearInterval(this.Dd),this.xd=Date.now(),this.Dd=setInterval(this.kd,this.Sd))}Ld(){b(this.Dd)||(clearInterval(this.Dd),this.Dd=void 0,E==null||E.removeEventListener==null||E.removeEventListener(Qt,this.Ve)),this.Sd=void 0,this.xd=void 0}destroy(){this.$d()}dispose(){this.$d()}$d(){var s,e;this.Ld(),this.pd++,this.md=!1,this.Du=void 0,this.Ns&&(this.Nd(),(s=this.Ed)==null||s.dispose(),this.Ed=void 0,(e=this.Pd)==null||e.call(this),this.Pd=void 0,this.dd=[],_?.removeEventListener("online",this.We),this.Ns=void 0)}get mn(){return this.Ls.get()}qd(s){var e;return this.jd&&s in this.jd?this.jd[s]:(e=this.Ns)==null?void 0:e.kv.get(s)}Ad(){return!!this.jd&&(this.jd=void 0,!0)}Bd(){var s;return!b((s=this.Ns)==null?void 0:s.kv.get(Ee))&&this.Ad()}ni(s){this.Hd((()=>{var e;return(e=this.Ns)==null?void 0:e.kv.set(s)}))}zd(s,e,t){var i;if((i=this._instance)!=null&&i.persistence&&s[Ee]){var r=this.qd(Ee)||{},n=s[Ee]||{},a=e.flags||e.featureFlags,o=e.flags?Object.entries(e.flags).filter((g=>{var y=g[1];return!(y!=null&&y.failed)})).map((g=>g[0])):[],l=!!e.errorsWhileComputingFlags&&!!e.flags,h=l?o:t&&!C(a)?Object.keys(a||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),u=this.qd(Ge)||{},c=s[Ge]||{},d=l||t?h:Array.from(new Set([...Object.keys(u),...Object.keys(c)])),v=!l&&!t,p=!!v||h,f={[Ve]:p,[Ee]:p,[Ge]:!!v||d};for(var m of(s[ft]&&(f[ft]=p),[gt,ct,Gt]))b(s[m])||(f[m]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(f)}}oi(s){this.Hd((()=>{var e;return(e=this.Ns)==null?void 0:e.kv.remove(s)}))}Hd(s){try{s()}catch(e){this.A.error("Failed to update feature flag persistence",e)}}Fd(){var s={};for(var e of[Ve,Ge,gt,Qe]){var t=this.qd(e);b(t)||(s[e]=t)}this.ud=s;var i=w({},s),r=this.qd(Ee);if(r)for(var n of Object.entries(r))i["$feature/"+n[0]]=n[1];this.hd=i}Rd(){var s=this.mn.cacheTtlMs;if(!s||0>=s)return!1;var e=this.qd(ct);return typeof e!="number"||Date.now()-e>s}Ud(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Wd(){var s=this.mn.evaluationContexts;return s!=null&&s.length?s.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.A.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}Vd(){var s=this.mn.flagKeys;if(!b(s))return s.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.A.error("Invalid flag key found:",e,"Expected non-empty string"),t}))}initialize(){var s,e,t=this.mn,i=(s=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&s!==void 0?s:{};if(Object.keys(i).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(i).filter((h=>!b(i[h]))).reduce(((h,u)=>(h[u]=i[u],h)),{}),l=Object.keys(a).filter((h=>o[h])).reduce(((h,u)=>(h[u]=a[u],h)),{});return this.Gd({featureFlags:o,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(s,e,t){var i,r,n=t!=null&&t.merge&&(i=this.qd(Ee))!==null&&i!==void 0?i:{},a=t!=null&&t.merge&&(r=this.qd(Ge))!==null&&r!==void 0?r:{},o=w({},n,s),l=w({},a,e),h={};for(var u of Object.entries(o)){var c=u[0],d=u[1];h[c]={key:c,enabled:In(d),variant:On(d),reason:void 0,metadata:b(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.Gd({flags:h})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var s=this.qd(ft),e=this.qd(Qe),t=this.qd(St);if(!t&&!e)return s||{};var i=Q({},s||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=i[n],h=e?.[n],u=b(h)?(a=l?.enabled)!==null&&a!==void 0&&a:!!h,c=b(h)?l?.variant:typeof h=="string"?h:void 0,d=t?.[n],v=w({},l,{enabled:u,variant:u?c??l?.variant:void 0});u!==l?.enabled&&(v.original_enabled=l?.enabled),c!==l?.variant&&(v.original_variant=l?.variant),d&&(v.metadata=w({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),i[n]=v}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:s,overriddenPayloads:t,finalDetails:i}),this.ld=!0),i}getAllFeatureFlags(){var s=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(s).map((t=>{var i=s[t];return{key:t,enabled:In(i),variant:On(i),payload:Fn(e[t])}}))}getFlagVariants(){var s=this.qd(Ee),e=this.qd(Qe);if(!e)return s||{};for(var t=Q({},s||{}),i=Object.keys(e),r=0;i.length>r;r++)t[i[r]]=e[i[r]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:s,overriddenFlags:e,finalFlags:t}),this.ld=!0),t}getFlagPayloads(){var s=this.qd(Ge),e=this.qd(St);if(!e)return s||{};for(var t=Q({},s||{}),i=Object.keys(e),r=0;i.length>r;r++)t[i[r]]=e[i[r]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:s,overriddenPayloads:e,finalPayloads:t}),this.ld=!0),t}reloadFeatureFlags(){this.gd||this.mn.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Zd||(this.dd.slice().forEach((s=>{try{s()}catch(e){this.A.error("Error while running feature flags reloading callback",e)}})),this.Zd=setTimeout((()=>{this.Qd()}),5)))}Nd(){clearTimeout(this.Zd),this.Zd=void 0}onReloading(s){return this.dd.push(s),()=>{this.dd=this.dd.filter((e=>e!==s))}}ensureFlagsLoaded(){this.vd||this.fd||this.Zd||this.reloadFeatureFlags()}setAnonymousDistinctId(s){this.$anon_distinct_id=s}setReloadingPaused(s){this.gd=s}resetFlagCallReported(){this.oi(ot)}Qd(s){this.Nd();var e=this.Ns;if(e&&!this.mn.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var t={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:w({},e.initialPersonProperties,this.qd(Me)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.qd(et),timezone:rl()};b(e.deviceId)||(t.$device_id=e.deviceId),(s!=null&&s.disableFlags||this.mn.featureFlagsDisabled)&&(t.disable_flags=!0);var i=this.Wd();i.length&&(t.evaluation_contexts=i);var r=this.Vd();b(r)||(t.flag_keys=r);var n=this.mn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),o=this.pd;this.fd=!0;var l=()=>{this.md&&(this.md=!1,this.Qd())},h=u=>{this.fd=!1,o===this.pd&&(this.ni({[Kt]:[Oa]}),this.A.error("Feature flag request failed",u),this.Bd()&&this.Od(!0)),l()};try{e.sendRequest(a,{target:"flags",method:"POST",body:t,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then((u=>{var c,d,v=(c=u.json)!==null&&c!==void 0?c:{},p=u.statusCode!==200;if(this.fd=!1,o===this.pd){if(this.Jd(u.statusCode),p||this.md||(this.$anon_distinct_id=void 0),!t.disable_flags||this.md){this.yd=!p;var f=[];u.error?f.push(u.error instanceof Error&&u.error.name==="AbortError"?"timeout":u.error instanceof Error?Oa:"unknown_error"):u.statusCode!==200&&f.push("api_error_"+u.statusCode),v.errorsWhileComputingFlags&&f.push("errors_while_computing_flags");var m=!((d=v.quotaLimited)==null||!d.includes("feature_flags"));m&&f.push("quota_limited"),this.ni({[Kt]:f}),m?this.A.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."):t.disable_flags||this.Gd(v,p,{partialResponse:n}),l()}}else l()})).catch(h)}catch(u){h(u)}}}wd(){return Yo(this._d,3)}Jd(s){this._d=Zo(s,this._d,3,(()=>this.A.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(s,e){var t;if(e===void 0&&(e={}),!e.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var i=this.getFeatureFlagResult(s,e);return(t=i?.variant)!==null&&t!==void 0?t:i?.enabled}}else this.A.warn('getFeatureFlag for key "'+s+sr)}getFeatureFlagDetails(s){return this.getFlagsWithDetails()[s]}getFeatureFlagPayload(s){var e=this.getFeatureFlagResult(s,{send_event:!1});return e?.payload}getFeatureFlagResult(s,e){if(e===void 0&&(e={}),!e.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var t,i=this.getFlagVariants(),r=s in i,n=i[s],a=this.getFlagPayloads()[s],o=String(n),l=this.qd(gt)||void 0,h=this.qd(ct)||void 0,u=this.qd(ot)||{};if(this.mn.deduplicateCallsPerSession){var c,d=(c=this.Ns)==null?void 0:c.session.sessionId,v=this.qd(gs);d&&d!==v&&(u={},t=d)}if(e.send_event||!("send_event"in e))if(s in u&&u[s].includes(o))t&&this.ni({[ot]:u,[gs]:t});else{var p,f,m,g,y,x,k,P,R,A,I,D;C(u[s])?u[s].push(o):u[s]=[o],this.ni(w({[ot]:u},t?{[gs]:t}:{}));var F=this.getFeatureFlagDetails(s),N=[...(p=this.qd(Kt))!==null&&p!==void 0?p:[]];b(n)&&N.push("flag_missing");var $={$feature_flag:s,$feature_flag_response:n,$feature_flag_payload:a??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:(f=(m=this.mn.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[s])!==null&&f!==void 0?f:null,$feature_flag_bootstrapped_payload:(g=(y=this.mn.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[s])!==null&&g!==void 0?g:null,$used_bootstrap_value:!this.yd};b(F==null||(x=F.metadata)==null?void 0:x.has_experiment)||($.$feature_flag_has_experiment=F.metadata.has_experiment),b(F==null||(k=F.metadata)==null?void 0:k.version)||($.$feature_flag_version=F.metadata.version);var T,H=(P=F==null||(R=F.reason)==null?void 0:R.description)!==null&&P!==void 0?P:F==null||(A=F.reason)==null?void 0:A.code;H&&($.$feature_flag_reason=H),F!=null&&(I=F.metadata)!=null&&I.id&&($.$feature_flag_id=F.metadata.id),b(F?.original_variant)&&b(F?.original_enabled)||($.$feature_flag_original_response=b(F.original_variant)?F.original_enabled:F.original_variant),F!=null&&(D=F.metadata)!=null&&D.original_payload&&($.$feature_flag_original_payload=F==null||(T=F.metadata)==null?void 0:T.original_payload),N.length&&($.$feature_flag_error=N.join(",")),this.Kd($)}else t&&this.ni({[ot]:u,[gs]:t});if(r)return{key:s,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:Fn(a)}}}else this.A.warn('getFeatureFlagResult for key "'+s+sr)}Kd(s){try{var e;(e=this.Ns)==null||e.capture("$feature_flag_called",s).catch((t=>{this.A.error("Failed to capture feature flag call",t)}))}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(s,e){this.Yd(s,e)}Yd(s,e){var t=this;return X((function*(){var i=t.Ns;if(i){var r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=t.Wd();n.length&&(r.evaluation_contexts=n);var a,o=t.Vd();b(o)||(r.flag_keys=o);try{var l,h=(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:t.mn.compression,sentAt:"body",timeoutMs:t.mn.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;a=h?.[s]||void 0}catch(u){return void t.A.error("Remote config feature flag request failed",u)}try{e(a)}catch(u){t.A.error("Remote config feature flag callback failed",u)}}}))()}isFeatureEnabled(s,e){if(e===void 0&&(e={}),e.fresh&&!this.yd)return e.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+s+sr),e.defaultValue;var t=this.getFeatureFlag(s,e);return b(t)?e.defaultValue:!!t}addFeatureFlagsHandler(s){this.featureFlagEventHandlers.push(s)}removeFeatureFlagsHandler(s){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==s))}receivedFeatureFlags(s,e,t){this.Gd(s,e,t)}Gd(s,e,t){if(this.Ns){this.vd=!0;var i=(function(n,a,o,l,h,u){a===void 0&&(a={}),o===void 0&&(o={}),l===void 0&&(l={}),u===void 0&&(u=Ia);var c=((F,N)=>{var $=F.flags;return $?w({},F,{featureFlags:Object.fromEntries(Object.keys($).map((T=>{var H;return[T,(H=$[T].variant)!==null&&H!==void 0?H:$[T].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys($).filter((T=>$[T].enabled)).filter((T=>{var H;return!b((H=$[T].metadata)==null?void 0:H.payload)})).map((T=>{var H;return[T,(H=$[T].metadata)==null?void 0:H.payload]})))}):(F.featureFlags&&N.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),F)})(n,u),d=c.flags,v=c.featureFlags,p=c.featureFlagPayloads;if(v){var f=n.requestId,m=n.evaluatedAt;if(C(v)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var g={};if(v)for(var y=0;v.length>y;y++)g[v[y]]=!0;return{[Ve]:v,[Ee]:g,[Gt]:!1}}var x=v,k=p,P=d;if(h!=null&&h.partialResponse){var R=Object.keys(x),A=k||{};x=w({},a,x),k=w({},o,A),R.forEach((F=>{var N;F in A||(N=k)==null||delete N[F]})),P=w({},l,P)}else if(n.errorsWhileComputingFlags)if(d){var I=new Set(Object.keys(d).filter((F=>{var N;return!((N=d[F])!=null&&N.failed)})));x=w({},a,Object.fromEntries(Object.entries(x).filter((F=>I.has(F[0])))));var D=Object.fromEntries(Object.entries(k||{}).filter((F=>I.has(F[0]))));k=w({},o,D),I.forEach((F=>{var N;F in D||(N=k)==null||delete N[F]})),P=w({},l,Object.fromEntries(Object.entries(P||{}).filter((F=>I.has(F[0])))))}else x=w({},a,x),k=w({},o,k),P=w({},l,P);return w({[Ve]:Object.keys(Ca(x)),[Ee]:x||{},[Ge]:k||{},[ft]:P||{},[Gt]:n.minimalFlagCalledEvents===!0},f?{[gt]:f}:{},m?{[ct]:m}:{})}})(s,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),t,this.A);if(i)if(t?.persist===!1){var r=!b(this.Ns.kv.get(Ee));this.jd=i,r||this.ni(i)}else this.Ad(),this.zd(i,s,!(t==null||!t.partialResponse)),this.ni(i);else e&&this.Bd();e||(this.bd=!1),this.Od(e)}}override(s,e){e===void 0&&(e=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:s,suppressWarning:e})}overrideFeatureFlags(s){this.Xd(s)}Xd(s){if(this.Ns){if(s===!1)return this.oi([Qe,St]),this.Od(),void xt.info("All overrides cleared");if(C(s))return this.ni({[Qe]:$a(s)}),this.Od(),void xt.info("Flag overrides set",{flags:s});if(s&&typeof s=="object"&&("flags"in s||"payloads"in s)){var e,t=s;this.ld=!!((e=t.suppressWarning)!==null&&e!==void 0&&e);var i={},r=t.flags,n=t.payloads;return r&&(i[Qe]=C(r)?$a(r):r),n&&(i[St]=n),Object.keys(i).length&&this.ni(i),r===!1&&n===!1?this.oi([Qe,St]):r===!1?this.oi(Qe):n===!1&&this.oi(St),this.Od(),r===!1?xt.info("Flag overrides cleared"):r&&xt.info("Flag overrides set",{flags:r}),void(n===!1?xt.info("Payload overrides cleared"):n&&xt.info("Payload overrides set",{payloads:n}))}if(s&&typeof s=="object")return this.ni({[Qe]:s}),this.Od(),void xt.info("Flag overrides set",{flags:s});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:s})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(s){if(this.addFeatureFlagsHandler(s),this.vd){var e=this.tv(),t=e.flags,i=e.flagVariants;try{s(t,i)}catch(r){this.A.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(s)}updateEarlyAccessFeatureEnrollment(s,e,t){var i,r=(this.qd(Us)||[]).find((h=>h.flagKey===s)),n={["$feature_enrollment/"+s]:e},a={$feature_flag:s,$feature_enrollment:e,$set:n};r&&(a.$early_access_feature_name=r.name),t&&(a.$feature_enrollment_stage=t);var o=w({},this.getFlagVariants(),{[s]:e});(i=this._instance)==null||(i=i.persistence)==null||i.markCrossTabFeatureFlagChanges({[Ve]:[s],[Ee]:[s],[Me]:Object.keys(n)}),this.ni({[Ve]:Object.keys(Ca(o)),[Ee]:o,[Me]:w({},this.qd(Me)||{},n)}),this.Od();try{var l;(l=this.Ns)==null||l.capture("$feature_enrollment_update",a).catch((h=>{this.A.error("Failed to capture early access feature enrollment",h)}))}catch(h){this.A.error("Failed to capture early access feature enrollment",h)}}getEarlyAccessFeatures(s,e,t){e===void 0&&(e=!1);var i=this.qd(Us);!i||e?this.ev(s,t):s(i)}ev(s,e){var t=this;return X((function*(){var i=t.Ns;if(i){var r,n=e?"&"+e.map((o=>"stage="+o)).join("&"):"";try{var a=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;t.ni({[Us]:r=a.json.earlyAccessFeatures})}catch(o){return void t.A.error("Early access feature request failed",o)}try{s(r)}catch(o){t.A.error("Early access feature callback failed",o)}}}))()}tv(){var s=this.getFlags(),e=this.getFlagVariants();return{flags:s.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}Od(s){this.Fd();var e=this.tv(),t=e.flags,i=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(t,i,{errorsLoading:s})}catch(n){this.A.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(s,e){e===void 0&&(e=!0),this.iv(s,e)}iv(s,e){e===void 0&&(e=!0);var t=this.qd(Me)||{},i=s?.$set||(s!=null&&s.$set_once?{}:s),r=s?.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this.ni({[Me]:w({},t,n,i)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(s,e){e===void 0&&(e=!0);var t=w({},this.qd(Me)||{});s.forEach((i=>{delete t[i]})),this.ni({[Me]:t}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(s){s===void 0&&(s=!0),this.oi(Me),s&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(s,e){e===void 0&&(e=!0);var t=this.qd(et)||{},i=w({},t);for(var r of Object.keys(s))i[r]=w({},t[r],s[r]);this.ni({[et]:i}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(s){if(s){var e=this.qd(et)||{};this.ni({[et]:w({},e,{[s]:{}})})}else this.oi(et)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.jd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Nd(),this.ld=!1,this._d=0}}},oc={sessionRecording:class{get mn(){return this._instance.config}get Ba(){return this._instance.persistence}get started(){var s;return!((s=this.rv)==null||!s.isStarted)}get status(){var s,e;return this.nv===ds||this.nv===Vs?this.nv:(s=(e=this.rv)==null?void 0:e.status)!==null&&s!==void 0?s:this.nv}constructor(s){if(this._forceAllowLocalhostNetworkCapture=!1,this.nv=Hs,this.sv=void 0,this.ov=!1,this.je=(()=>{var e;if(E==null||!E.visibilityState||E.visibilityState==="visible")return!0;var t=_==null||(e=_.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(t!=null&&t.length)||t.some((i=>i.name==="visible"))})(),this.Ve=()=>{var e;E?.visibilityState==="visible"&&(this.je=!0,(e=this.rv)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=s,!this._instance.sessionManager)throw rt.error("started without valid sessionManager"),new Error(Ur+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===lt)throw new Error(Ur+' cannot be used with cookieless_mode="always"');E!=null&&E.addEventListener&&K(E,"visibilitychange",this.Ve)}initialize(){this.startIfEnabledOrStop()}dispose(s){var e=(s===void 0?{}:s).discardBufferedEvents,t=e!==void 0&&e;this.ov=!0,E==null||E.removeEventListener==null||E.removeEventListener("visibilitychange",this.Ve),t?this.av(!0):this.stopRecording()}get lv(){var s,e=!((s=this._instance.get_property(Ft))==null||!s.enabled),t=!this.mn.disable_session_recording,i=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return _&&e&&t&&!i}startIfEnabledOrStop(s){var e;if(!(this.ov||this.lv&&(e=this.rv)!=null&&e.isStarted)){var t=!b(Object.assign)&&!b(Array.from);this.lv&&t?(this.uv(s),rt.info("starting")):(this.nv=Hs,this.stopRecording())}}uv(s){var e,t;if(this.lv)if(this.nv!==ds&&this.nv!==Vs&&(this.nv=xa),O!=null&&(e=O.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=O.__PosthogExtensions__)!=null&&t.initSessionRecording)this.hv(s);else{var i,r=this._instance.sessionManager;(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.dv,(n=>{if(!this.ov&&this.lv&&this._instance.sessionManager===r)return n?(this._instance.register_for_session({[Or]:!0}),rt.error("could not load recorder",n)):void this.hv(s);this.nv=Hs}))}}stopRecording(){var s,e;(s=this.sv)==null||s.call(this),this.sv=void 0,(e=this.rv)==null||e.stop()}av(s){var e,t;s===void 0&&(s=!1),(e=this.sv)==null||e.call(this),this.sv=void 0,(t=this.rv)==null||t.discard({discardProducerEvents:s})}vv(){var s,e;(s=this.Ba)==null||s.unregister(nn),(e=this.Ba)==null||e.unregister(So)}fv(s,e){if(L(s))return null;var t,i=ce(s)?s:parseFloat(s);return typeof(t=i)!="number"||!Number.isFinite(t)||0>t||t>1?(rt.warn(e+" must be between 0 and 1. Ignoring invalid value:",s),null):i}pv(s){if(this.Ba){var e,t,i=this.Ba,r=()=>{var n,a=s.sessionRecording===!1?void 0:s.sessionRecording,o=this.fv((n=this.mn.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.fv(a?.sampleRate,"remote config sampleRate"),h=o??l;L(h)&&this.vv();var u=a?.minimumDurationMilliseconds;i.register({[Ft]:w({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:w({capturePerformance:s.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:h,minimumDurationMilliseconds:b(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.sv)==null||e.call(this),this.sv=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(s){var e=s.ok?s.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.pv(e),void this.av()):(this.pv(e),void this.startIfEnabledOrStop()):(this.nv===ds&&(this.nv=Vs,rt.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(s,e){var t;e===void 0&&(e="log"),(t=this.rv)!=null&&t.log?this.rv.log(s,e):rt.warn("log called before recorder was ready")}get dv(){var s,e,t=(s=this._instance)==null||(s=s.persistence)==null?void 0:s.get_property(Ft);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}gv(){var s,e=this._instance.get_property(Ft);if(!e)return!1;try{s=typeof e=="object"?e:JSON.parse(e)}catch(t){return rt.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!L(s.cache_timestamp)&&36e5>=Date.now()-s.cache_timestamp}hv(s){var e,t,i;if(!this.ov&&this.lv&&this._instance.sessionManager){if((e=O.__PosthogExtensions__)==null||!e.initSessionRecording)return rt.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Or]:!0});var r;if(this.rv||(this.rv=(r=O.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance,this.je),this.rv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.gv())return this.nv===Vs||this.nv===ds?void 0:(this.nv=ds,rt.info("persisted remote config is stale, requesting fresh config before starting"),void new nl(this._instance).load());this.nv=xa,(t=(i=this.rv).setDocumentWasEverVisible)==null||t.call(i,this.je),this.rv.start(s)}else this.nv=Hs}onRRwebEmit(s){var e;(e=this.rv)==null||e.onRRwebEmit==null||e.onRRwebEmit(s)}overrideLinkedFlag(){var s,e;this.rv||(e=this.Ba)==null||e.register({[Fo]:!0}),(s=this.rv)==null||s.overrideLinkedFlag()}overrideSampling(){var s,e;this.rv||(e=this.Ba)==null||e.register({[Po]:!0}),(s=this.rv)==null||s.overrideSampling()}overrideTrigger(s){var e,t;this.rv||(t=this.Ba)==null||t.register({[s==="url"?Io:Oo]:!0}),(e=this.rv)==null||e.overrideTrigger(s)}get sdkDebugProperties(){var s;return((s=this.rv)==null?void 0:s.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(s,e){var t;return!((t=this.rv)==null||!t.tryAddCustomEvent(s,e))}}},lc={autocapture:class extends Hh{constructor(s){super(new Vh(s)),this.instance=s}},historyAutocapture:class{constructor(s){this._instance=s,this.mv=this.yv()}initialize(){this.startIfEnabled()}get isEnabled(){var s=this.bv();return!!(s.path||s.search||this._v(s))}startIfEnabled(){this.isEnabled&&(S.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.mv=this.yv(),this.startIfEnabled()}stop(){this.wv&&this.wv(),this.wv=void 0,this.Sv&&this.Sv(),this.Sv=void 0,S.info("History API monitoring stopped")}monitorHistoryChanges(){_&&_.history&&(this.xv("pushState"),this.xv("replaceState"),this.Cv(),this._v()&&this.Tv())}xv(s){var e;if(_&&((e=_.history[s])==null||!e.__posthog_wrapped__)){var t=this;Fl(_.history,s,(i=>function(r,n,a){i.call(this,r,n,a),t.Mv(s)}))}}yv(){var s=_?.location;if(s!=null&&s.pathname)return{pathname:s.pathname,search:s.search,hash:s.hash}}bv(){var s=this._instance.config.capture_pageview;return s==="history_change"?{path:!0}:q(s)?s:{}}_v(s){return s===void 0&&(s=this.bv()),!!s.hash&&!this._instance.config.disable_capture_url_hashes}Iv(s){var e=this.bv(),t=this.mv;return!(!t||!(e.path&&s.pathname!==t.pathname||e.search&&s.search!==t.search||this._v(e)&&s.hash!==t.hash))}Mv(s){try{var e=this.yv();if(!e)return;this.Iv(e)&&this._instance.capture(Ht,{navigation_type:s}),this.mv=e}catch(t){S.error("Error capturing "+s+" pageview",t)}}Cv(){if(!this.wv){var s=()=>{this.Mv("popstate")};K(_,"popstate",s),this.wv=()=>{_&&_.removeEventListener("popstate",s)}}}Tv(){if(!this.Sv){var s=()=>{this.Mv("hashchange")};K(_,"hashchange",s),this.Sv=()=>{_&&_.removeEventListener("hashchange",s)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(s){var e;this.Ev=!1,this.Rs=!1,this.Rv=null,this.instance=s,this.Ev=!((e=this.instance.persistence)==null||!e.props[gr]),this.rageclicks=new Pl(s.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var s=5e3;return q(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(s=this.mn.capture_heatmaps.flush_interval_milliseconds),s}get isEnabled(){return L(this.mn.capture_heatmaps)?L(this.mn.enable_heatmaps)?this.Ev:this.mn.enable_heatmaps:this.mn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Gh.info("starting..."),this.Pv(),this.Ve()}else{var s;clearInterval((s=this.Rv)!==null&&s!==void 0?s:void 0),this.Av(),this.getAndClearBuffer()}}onRemoteConfig(s){if(s.ok){var e=s.config;if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[gr]:t}),this.Ev=t,this.startIfEnabled()}}}getAndClearBuffer(){var s=this.De;return this.De=void 0,s}Fv(s){er(s.originalEvent)&&this.Xi(s.originalEvent,"deadclick")}Ve(){this.Rv&&clearInterval(this.Rv),this.Rv=E?.visibilityState==="visible"?setInterval(this.Pa.bind(this),this.flushIntervalMilliseconds):null}Pv(){_&&E&&(this.Ov=this.Pa.bind(this),K(_,di,this.Ov),this.Lv=s=>this.Xi(s||_?.event),K(E,"click",this.Lv,{capture:!0}),this.Dv=s=>this.$v(s||_?.event),K(E,"mousemove",this.Dv,{capture:!0}),this.Nv=new Qn(this.instance,Xu,this.Fv.bind(this)),this.Nv.startIfEnabledOrStop(),this.qv=this.Ve.bind(this),K(E,Qt,this.qv),this.Rs=!0)}Av(){var s;_&&E&&(this.Ov&&_.removeEventListener(di,this.Ov),this.Lv&&E.removeEventListener("click",this.Lv,{capture:!0}),this.Dv&&E.removeEventListener("mousemove",this.Dv,{capture:!0}),this.qv&&E.removeEventListener(Qt,this.qv),clearTimeout(this.jv),(s=this.Nv)==null||s.stop(),this.Rs=!1)}Bv(s,e){var t=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var h=a;h&&mt(h)&&!je(h,"body");){if(h===l)return!1;var u=void 0;try{var c,d,v;u=(c=(d=(v=h.ownerDocument)==null?void 0:v.defaultView)!==null&&d!==void 0?d:_)==null?void 0:c.getComputedStyle(h).position}catch{return!1}if(M(o,u))return!0;h=Ho(h)}return!1})(Mr(s),["fixed","sticky"],r);return{x:s.clientX+(n?0:i),y:s.clientY+(n?0:t),target_fixed:n,type:e}}Xi(s,e){var t;if(e===void 0&&(e="click"),!Hn(s.target)&&er(s)){var i=this.Bv(s,e);(t=this.rageclicks)!=null&&t.isRageClick(s.clientX,s.clientY,new Date().getTime())&&zo(Mr(s),this.instance.config.rageclick)&&this.ks(w({},i,{type:"rageclick"})),this.ks(i)}}$v(s){!Hn(s.target)&&er(s)&&(clearTimeout(this.jv),this.jv=setTimeout((()=>{this.ks(this.Bv(s,"mousemove"))}),500))}ks(s){if(_){var e=this.mn.disable_capture_url_hashes?_t(_.location.href):_.location.href,t=this.mn.custom_personal_data_properties,i=this.mn.mask_personal_data_properties?[...ts,...t||[]]:[],r=Is(e,i,Os);this.De=this.De||{},this.De[r]||(this.De[r]=[]),this.De[r].push(s)}}Pa(){this.De&&!Ne(this.De)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Qn,webVitalsAutocapture:class{constructor(s){var e;this.Ev=!1,this.Rs=!1,this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hv=()=>{clearTimeout(this.zv),this.zv=void 0,this.De.metrics.length!==0&&(this._instance.capture("$web_vitals",w({$current_url:this.De.url},this.De.metrics.reduce(((t,i)=>w({},t,{["$web_vitals_"+i.name+"_event"]:w({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uv=t=>{var i;if(this.De=this.De||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},L(t?.name)||L(t?.value))wt.error("Invalid metric received",t);else{var r=typeof t.navigationURL=="string"?t.navigationURL:void 0,n=this.Wv(r);if(!b(n)){var a=ce(t.navigationId)||typeof t.navigationId=="string"?"navigation:"+t.navigationId:"url:"+n;if(!this.Vv||this.Vv>t.value){this.De.navigationKey!==a&&(this.Hv(),this.zv=setTimeout(this.Hv,this.flushToCaptureTimeoutMs)),b(this.De.navigationKey)&&(this.De.navigationKey=a,this.De.url=n),this.De.firstMetricTimestamp=b(this.De.firstMetricTimestamp)?Date.now():this.De.firstMetricTimestamp;var o=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),l=w({},t,r?{navigationURL:n}:{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,q(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var h={};for(var u of Wh){var c=u==="url"&&typeof t.attribution[u]=="string"?this.Wv(t.attribution[u]):t.attribution[u];b(c)||(h[u]=c)}l.attribution=h}else delete l.attribution;b(o)||(l.$session_id=o.sessionId,l.$window_id=o.windowId),this.De.metrics.push(l),this.De.metrics.length===this.allowedMetrics.length&&this.Hv()}else wt.error("Ignoring metric with value >= "+this.Vv,t)}}},this.Gv=()=>{if(!this.Rs){var t,i,r,n,a=!1,o=O.__PosthogExtensions__,l=o?.postHogWebVitalsCallbacksByFlavor,h=l?.[this.Zv]||(this.Zv==="web-vitals"&&b(l)?o?.postHogWebVitalsCallbacks:void 0);if(!b(h)){var u=h.withoutAttribution,c=this.attributionMetrics;a=!b(u),t=c.indexOf("LCP")>-1?h.onLCP:u?.onLCP||h.onLCP,i=c.indexOf("CLS")>-1?h.onCLS:u?.onCLS||h.onCLS,r=c.indexOf("FCP")>-1?h.onFCP:u?.onFCP||h.onFCP,n=c.indexOf("INP")>-1?h.onINP:u?.onINP||h.onINP}if(t&&i&&r&&n){var d={reportSoftNavs:this.useSoftNavs},v=a&&this.attributionMetrics.indexOf("INP")>-1?w({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Uv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&n(this.Uv.bind(this),v),this.Rs=!0}else wt.error("web vitals callbacks not loaded - not starting")}},this._instance=s,this.Ev=!((e=this._instance.persistence)==null||!e.props[br]),this.startIfEnabled()}get Qv(){return this._instance.config.capture_performance}get allowedMetrics(){var s,e,t=q(this.Qv)?(s=this.Qv)==null?void 0:s.web_vitals_allowed_metrics:void 0;return L(t)?((e=this._instance.persistence)==null?void 0:e.props[xr])||wa:t}get flushToCaptureTimeoutMs(){return(q(this.Qv)?this.Qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var s=q(this.Qv)?this.Qv.web_vitals_attribution:void 0;return Oe(s)?s?wa:[]:C(s)?s:Uh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var s=q(this.Qv)?this.Qv.__preview_web_vitals_soft_navs:void 0;return s!=null&&s}get Vv(){var s=q(this.Qv)&&ce(this.Qv.__web_vitals_max_value)?this.Qv.__web_vitals_max_value:ba;return s>0&&6e4>=s?ba:s}get isEnabled(){var s=ae?.protocol;if(s!=="http:"&&s!=="https:")return wt.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=q(this.Qv)?this.Qv.web_vitals:Oe(this.Qv)?this.Qv:void 0;return Oe(e)?e:this.Ev}startIfEnabled(){this.isEnabled&&!this.Rs&&(wt.info("enabled, starting..."),this.Ys(this.Gv))}onRemoteConfig(s){if(s.ok){var e=s.config;if("capturePerformance"in e){var t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[br]:t}),this._instance.persistence.register({[xr]:i})),this.Ev=t,this.startIfEnabled()}}}get Zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ys(s){var e=O.__PosthogExtensions__,t=this.Zv,i=e?.postHogWebVitalsCallbacksByFlavor;i!=null&&i[t]||t==="web-vitals"&&b(i)&&e!=null&&e.postHogWebVitalsCallbacks?s():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,t,(r=>{r?wt.error("failed to load script",r):s()}))}Wv(s){var e=s||_?.location.href;if(e){var t=this._instance.config.disable_capture_url_hashes?_t(e):e,i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...ts,...i||[]]:[];return Is(t,r,Os)}wt.error("Could not determine current URL")}}},uc={exceptionObserver:class{constructor(s){var e;this.Gv=()=>{var t;if(_&&this.isEnabled&&(t=O.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var i=O.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=O.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=O.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Jv&&this.mn.capture_unhandled_errors&&(this.Jv=i(this.captureException.bind(this))),!this.Kv&&this.mn.capture_unhandled_rejections&&(this.Kv=r(this.captureException.bind(this))),!this.Yv&&this.mn.capture_console_errors&&(this.Yv=n(this.captureException.bind(this)))}catch(a){cs.error("failed to start",a),this.Xv()}}},this._instance=s,this.tc=!((e=this._instance.persistence)==null||!e.props[_r]),this.wt=new ql(w({},(function(t){var i,r,n,a;return t===void 0&&(t={}),{refillRate:(i=(r=t.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:t.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i: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,A:cs})),this.mn=this.ec(),this.startIfEnabledOrStop()}ec(){var s=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(s)?e=w({},e,s):(b(s)?this.tc:s)&&(e=w({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(cs.info("enabled"),this.Xv(),this.Ys(this.Gv)):this.Xv()}Ys(s){var e,t;(e=O.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?s():(t=O.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return cs.error("failed to load script",i);s()}))}Xv(){var s,e,t;(s=this.Jv)==null||s.call(this),this.Jv=void 0,(e=this.Kv)==null||e.call(this),this.Kv=void 0,(t=this.Yv)==null||t.call(this),this.Yv=void 0}onRemoteConfig(s){if(s.ok){var e=s.config;"autocaptureExceptions"in e&&(this.tc=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_r]:this.tc}),this.mn=this.ec(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.ec()}captureException(s){try{var e,t,i,r=(e=s==null||(t=s.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(r))return void cs.info("Skipping exception capture because of client rate limiting.",{exception:r});(i=this._instance.exceptions)==null||i.sendExceptionEvent(s)}catch{}}},exceptions:class{constructor(s){var e,t;this.ic=[],this.rc=new su([new hu,new yu,new du,new cu,new _u,new gu,new pu,new mu],(function(i){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 h=[],u=o.split(`
3
- `),c=l;u.length>c;c++){var d=u[c];if(1024>=d.length){var v=Pn.test(d)?d.replace(Pn,"$1"):d;if(!v.match(/\S*Error: /)){for(var p of n){var f=p(v,i);if(f){h.push(f);break}}if(h.length>=50)break}}}return(function(m){if(!m.length)return[];var g=Array.from(m);return g.reverse(),g.slice(0,50).map((y=>{return w({},y,{filename:y.filename||(x=g,x[x.length-1]||{}).filename,function:y.function||Zt});var x}))})(h)}})("web:javascript",au,uu)),this._instance=s,this.ic=(e=(t=this._instance.persistence)==null?void 0:t.get_property(mr))!==null&&e!==void 0?e:[],this.nc=oi(this.sc()),this.oc=new wu(this.nc)}onConfigChange(){this.nc=oi(this.sc()),this.oc.setConfig(this.nc)}onRemoteConfig(s){var e,t,i;if(s.ok){var r=s.config;if("errorTracking"in r){var n=(e=(t=r.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],a=(i=r.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ic=n,this._instance.persistence&&this._instance.persistence.register({[mr]:this.ic,[yr]:a})}}}get ac(){var s,e=!!this._instance.get_property(yr),t=this._instance.config.error_tracking.captureExtensionExceptions;return(s=t??e)!==null&&s!==void 0&&s}buildProperties(s,e){return this.rc.buildFromUnknown(s,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(s,e){if(this.nc.enabled)try{if(!B(s)||s.trim().length===0)return void We.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)=>bu.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.lc(e)),i=t.sanitizedProperties,r=t.droppedKeys;r.length>0&&We.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.oc.add(w({[ni]:s,[ai]:new Date().toISOString()},i))}catch(n){We.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(s){try{var e=s.$exception_list;if(this.uc(e)){if(this.hc(e))return this.dc("Exception dropped: matched a suppression rule"),void We.info("Skipping exception capture because a suppression rule matched");if(!this.ac&&this.vc(e))return this.dc("Exception dropped: thrown by a browser extension"),void We.info("Skipping exception capture because it was thrown by an extension");if(!this.ac&&this.cc(e))return this.dc("Exception dropped: thrown by an injected browser script"),void We.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.fc(e))return this.dc("Exception dropped: thrown by the PostHog SDK"),void We.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.nc.enabled&&L(s.$exception_steps)?this.gc(s):s,i=typeof(n=globalThis._posthogReleaseId)=="string"&&n.length>0?n:void 0;i&&(t.$release_id=i);try{var r=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",gu:!0});return r&&this.oc.clear(),r}catch(a){return Aa(a)||We.error("Failed to capture exception event. Dropping this exception.",a),void this.oc.clear()}}catch(a){return void(Aa(a)||We.error("Failed to process exception event. Ignoring this exception.",a))}var n}gc(s){try{var e=this.oc.getAttachable();return e.length===0?s:w({},s,{$exception_steps:e})}catch(t){return We.error("Failed to read buffered exception steps. Capturing exception without steps.",t),s}}dc(s){this.nc.enabled&&this.oc.add({[ni]:s,[ai]:new Date().toISOString()})}lc(s){return q(s)?w({},s):{}}sc(){var s,e;return(s=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&s!==void 0?s:{}}hc(s){if(s.length===0)return!1;try{var e=s.reduce(((t,i)=>{var r=i.type,n=i.value;return B(r)&&r.length>0&&t.$exception_types.push(r),B(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.ic.some((t=>{var i=t.values.map((r=>{var n=bl[r.operator],a=e[r.key];if(!n||!a)return!1;var o=C(r.value)?r.value:[r.value];return o.length>0&&n(o,a)}));return t.type==="OR"?i.some(Boolean):i.every(Boolean)}))}catch(t){return We.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}vc(s){var e=s.flatMap((i=>{var r,n;return(r=(n=i.stacktrace)==null?void 0:n.frames)!==null&&r!==void 0?r:[]})),t=e.filter((i=>{var r=i.filename;return!!r&&ic.some((n=>r.startsWith(n)))}));return t.length!==0&&(!t.every((i=>{var r=i.filename;return!!r&&r.startsWith(Wr)}))||s.some((i=>{var r=i.value;return B(r)&&r.includes("isolatedAPI.contexts.topHostname")}))&&!e.some((i=>{var r=i.filename;return i.in_app&&!(r!=null&&r.startsWith(Wr))})))}cc(s){return s.some((e=>{var t=e.value;return B(t)&&rc.some((i=>t.includes(i)))}))}fc(s){if(s.length>0){var e,t,i,r,n=(e=(t=s[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(i=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}uc(s){return!L(s)&&C(s)}}},hc=w({productTours:class{get Ba(){return this._instance.persistence}constructor(s){this.mc=null,this.yc=null,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(s.ok){var e=s.config;if("productTours"in e){var t,i;if(this.Ba&&this.Ba.register({[rn]:!!e.productTours}),!tr(this._instance))return!this.mc&&L((t=this.Ba)==null?void 0:t.props[fs])||zs.info("product tours disabled; stopping and clearing cached tours"),(i=this.mc)==null||i.stop(),this.mc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.mc&&tr(this._instance)&&this.Ys((()=>this.bc()))}Ys(s){var e,t;(e=O.__PosthogExtensions__)!=null&&e.generateProductTours?s():(t=O.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(i=>{i?zs.error("Could not load product tours script",i):s()}))}bc(){var s;!this.mc&&(s=O.__PosthogExtensions__)!=null&&s.generateProductTours&&(this.mc=O.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(s,e){if(e===void 0&&(e=!1),!C(this.yc)||e){var t=this.Ba;if(t){var i=t.props[fs];if(C(i)&&!e)return this.yc=i,void s(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:r=>{if(tr(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return n===0?r.error||zs.warn(a):zs.error(a),void s([],{isLoaded:!1,error:a})}var o=C(r.json.product_tours)?r.json.product_tours:[];this.yc=o,t&&t.register({[fs]:o}),s(o,{isLoaded:!0})}else s([],{isLoaded:!0})}})}else s(this.yc,{isLoaded:!0})}getActiveProductTours(s){L(this.mc)?s([],{isLoaded:!1,error:"Product tours not loaded"}):this.mc.getActiveProductTours(s)}showProductTour(s){var e;(e=this.mc)==null||e.showTourById(s)}previewTour(s){this.mc?this.mc.previewTour(s):this.Ys((()=>{var e;this.bc(),(e=this.mc)==null||e.previewTour(s)}))}dismissProductTour(){var s;(s=this.mc)==null||s.dismissTour("user_clicked_skip")}nextStep(){var s;(s=this.mc)==null||s.nextStep()}previousStep(){var s;(s=this.mc)==null||s.previousStep()}clearCache(){var s;this.yc=null,(s=this.Ba)==null||s.unregister(fs)}resetTour(s){var e;(e=this.mc)==null||e.resetTour(s)}resetAllTours(){var s;(s=this.mc)==null||s.resetAllTours()}cancelPendingTour(s){var e;(e=this.mc)==null||e.cancelPendingTour(s)}}},Ei),cc={siteApps:class{constructor(s){this._c=0,this._instance=s,this.wc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}kc(s,e){if(e){var t=this.globalsForEvent(e);this.wc.push(t),this.wc.length>1e3&&(this.wc=this.wc.slice(10))}}get siteAppLoaders(){var s;return(s=O._POSTHOG_REMOTE_CONFIG)==null||(s=s[this._instance.config.token])==null?void 0:s.siteApps}initialize(){if(this.isEnabled){var s=this._instance._addCaptureHook(this.kc.bind(this));this.Sc=()=>{s(),this.wc=[],this.Sc=void 0}}}globalsForEvent(s){var e,t,i,r,n,a,o;if(!s)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(u)){var d=c[0];l[d]={id:h[d],type:d,properties:c[1]}}var v=s.$set_once,p=s.$set;return{event:w({},Na(s,Kh),{properties:w({},s.properties,p?{$set:w({},(e=(t=s.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},p)}:{},v?{$set_once:w({},(i=(r=s.properties)==null?void 0:r.$set_once)!==null&&i!==void 0?i:{},v)}:{}),elements_chain:(n=(a=s.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=s.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}xc(s){var e,t=(e=s.tagName)==null?void 0:e.toLowerCase();return t==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(s)||(Ze.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(s)||(Ze.error("prepare_external_dependency_script returned null"),null):s}Cc(){var s,e,t,i,r,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=E?.defaultView,h=l==null||(s=l.Node)==null?void 0:s.prototype;if(!l||!h)return()=>{};if(this._c++,this.Tc)return this.Mc();var u=[],c=this,d=new WeakSet,v=(m,g,y)=>{if(m!=null&&m[g]){var x=m[g];m[g]=y(x),u.push((()=>{m[g]=x}))}},p=m=>{if(d.has(m))return m;var g=c.xc(m);return g&&d.add(g),g},f=m=>m.map((g=>typeof g=="string"?g:p(g))).filter((g=>!he(g)));return v(h,"appendChild",(m=>function(g){var y=p(g);return y?m.call(this,y):g})),v(h,"insertBefore",(m=>function(g,y){var x=p(g);return x?m.call(this,x,y):g})),v(h,"replaceChild",(m=>function(g,y){var x=p(g);return x?m.call(this,x,y):y})),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(i=l.DocumentFragment)==null?void 0:i.prototype].forEach((m=>{v(m,"append",(g=>function(){for(var y=arguments.length,x=new Array(y),k=0;y>k;k++)x[k]=arguments[k];return g.apply(this,f(x))})),v(m,"prepend",(g=>function(){for(var y=arguments.length,x=new Array(y),k=0;y>k;k++)x[k]=arguments[k];return g.apply(this,f(x))}))})),[(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",(g=>function(){for(var y=arguments.length,x=new Array(y),k=0;y>k;k++)x[k]=arguments[k];return g.apply(this,f(x))})),v(m,"after",(g=>function(){for(var y=arguments.length,x=new Array(y),k=0;y>k;k++)x[k]=arguments[k];return g.apply(this,f(x))})),v(m,"replaceWith",(g=>function(){for(var y=arguments.length,x=new Array(y),k=0;y>k;k++)x[k]=arguments[k];var P=f(x);return x.length&&!P.length?void 0:g.apply(this,P)}))})),v((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(m=>function(g,y){var x=p(y);return x?m.call(this,g,x):null})),this.Tc=()=>{u.forEach((m=>m())),this.Tc=void 0},this.Mc()}Mc(){var s=!1;return()=>{var e;s||(s=!0,this._c--,this._c===0&&((e=this.Tc)==null||e.call(this)))}}Ic(s,e){e===void 0&&(e=!0);var t=this.Cc();try{var i=s(t);return e&&t(),i}catch(r){throw t(),r}}setupSiteApp(s){var e=this.apps[s.id],t=()=>{var a;!e.errored&&this.wc.length&&(Ze.info("Processing "+this.wc.length+" events for site app with id "+s.id),this.wc.forEach((o=>this.Ic((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.Sc)==null||a.call(this))},i=!1,r=a=>{e.errored=!a,e.loaded=!0,Ze.info("Site app with id "+s.id+" "+(a?"loaded":"errored")),i&&t()};try{var n=this.Ic((a=>s.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;n&&(e.processEvent=n),i=!0}catch(a){Ze.error(ka+s.id,a),r(!1)}if(i&&e.loaded)try{t()}catch(a){Ze.error("Error while processing buffered events PostHog app with config id "+s.id,a),e.errored=!0}}Ec(){var s=this.siteAppLoaders||[];for(var e of s)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of s)this.setupSiteApp(t)}Rc(s){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(s),i=function(n){try{e.Ic((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){Ze.error("Error while processing event "+s.event+" for site app "+n.id,a)}};for(var r of Object.values(this.apps))i(r)}}onRemoteConfig(s){var e,t,i,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Ec(),void this._instance.on("eventCaptured",(l=>this.Rc(l)))):void Ze.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.Sc)==null||t.call(this),s.ok){var n=s.config;if((i=n.siteApps)!=null&&i.length)if(this.isEnabled){var a=function(){var l,h=o.id,u=o.url;O["__$$ph_site_app_"+h]=r._instance,(l=O.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,u,(c=>{if(c)return Ze.error(ka+h,c)}))};for(var o of n.siteApps)a()}else Ze.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},dc={tracingHeaders:class{constructor(s){this.Pc=void 0,this.Ac=void 0,this.Fc=void 0,this.Gv=()=>{var e,t,i=this.Oc();i?(b(this.Pc)&&(this.Pc=(e=O.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),b(this.Ac)&&(this.Ac=(t=O.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Xv()},this._instance=s}initialize(){this.startIfEnabledOrStop()}Ys(s){var e,t;(e=O.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?s():(t=O.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return zh.error("failed to load script",i);s()}))}Lc(){var s,e;return(s=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&s!==void 0?s:this._instance.config.__add_tracing_headers}Oc(){var s=this.Lc();return C(s)?(C(this.Fc)?this.Fc.splice(0,this.Fc.length,...s):this.Fc=[...s],s.length>0?this.Fc:void 0):(C(this.Fc)&&this.Fc.splice(0),this.Fc=s||void 0,this.Fc)}Xv(){var s,e;(s=this.Pc)==null||s.call(this),(e=this.Ac)==null||e.call(this),this.Pc=void 0,this.Ac=void 0}startIfEnabledOrStop(){this.Oc()?this.Ys(this.Gv):this.Xv()}}},vc=w({surveys:class extends Jh{constructor(s){var e;super(new ec(s),{get projectToken(){return e.config.token},kv:new Xh(e=s)}),this._instance=s}Bu(s,e){var t=e.query?$s(s,e.query):s;return new Promise((i=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((r=e.target)!==null&&r!==void 0?r:"api",t),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:i})}))}}},Ei),pc={toolbar:class{constructor(s){this.instance=s}Dc(s){O.ph_toolbar_state=s}$c(){var s;return(s=O.ph_toolbar_state)!==null&&s!==void 0?s:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(s,e,t){if(s===void 0&&(s=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),Ar(this.instance.config)||!_||!E)return!1;s=s??_.location,t=t??_.history;try{if(!e){try{_.localStorage.setItem("test","test"),_.localStorage.removeItem("test")}catch{return!1}e=_?.localStorage}var i,r=tc||gi(s.hash,"__posthog")||gi(s.hash,"state"),n=r?Nn((()=>JSON.parse(atob(decodeURIComponent(r)))))||Nn((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((i=n).source="url",i&&Object.keys(i).length>0&&(n.desiredHash?s.hash=n.desiredHash:t?t.replaceState(t.state,"",s.pathname+s.search):s.hash="")):((i=JSON.parse(e.getItem(Sa)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Nc(s){var e=O.ph_load_toolbar||O.ph_load_editor;!L(e)&&Fe(e)?e(s,this.instance):Pa.warn("No toolbar load function found")}loadToolbar(s){var e=!(E==null||!E.getElementById(Lo));if(!_||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=w({token:this.instance.config.token},s,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(_.localStorage.setItem(Sa,JSON.stringify(w({},i,{source:void 0}))),this.$c()===2)this.Nc(i);else if(this.$c()===0){var r;this.Dc(1),(r=O.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Pa.error("[Toolbar] Failed to load",n),void this.Dc(0);this.Dc(2),this.Nc(i)})),K(_,"turbolinks:load",(()=>{this.Dc(0),this.loadToolbar(i)}))}return!0}qc(s){return this.loadToolbar(s)}maybeLoadEditor(s,e,t){return s===void 0&&(s=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(s,e,t)}}},fc=w({experiments:Pe},Ei),gc={conversations:class{constructor(s){this.jc=void 0,this._conversationsManager=null,this.Bc=!1,this.zt=null,this.Hc=!1,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(!this._instance.config.disable_conversations&&(this.zc=s.ok,s.ok)){var e=s.config.conversations;L(e)||(Oe(e)?this.jc=e:(this.jc=e.enabled,this.zt=e),this.loadIfEnabled())}}reset(){var s;(s=this._conversationsManager)==null||s.reset(),this._conversationsManager=null,this.jc=void 0,this.zt=null,this.zc=void 0,this.Hc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Bc||this._instance.config.disable_conversations||Ar(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var s=O?.__PosthogExtensions__;if(s&&!b(this.jc)&&this.jc)if(this.zt&&this.zt.token){this.Bc=!0;try{var e=s.initConversations;if(e)return this.Uc(e),void(this.Bc=!1);var t=s.loadExternalDependency;if(!t)return void this.Wc(an);t(this._instance,"conversations",(i=>{i||!s.initConversations?this.Wc("Could not load conversations script",i):this.Uc(s.initConversations),this.Bc=!1}))}catch(i){this.Wc("Error initializing conversations",i),this.Bc=!1}}else He.error("Conversations enabled but missing token in remote config.")}}Uc(s){if(this.zt)try{this._conversationsManager=s(this.zt,this._instance),this.Hc=!1,He.info("Conversations loaded successfully")}catch(e){this.Wc("Error completing conversations initialization",e)}else He.error("Cannot complete initialization: remote config is null")}Wc(s,e){He.error(s,e),this._conversationsManager=null,this.Bc=!1,this.Hc=!0}show(){this._conversationsManager?this._conversationsManager.show():He.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.jc===!0&&!he(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Ar(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.zc===!1?"remote_config_failed":b(this.jc)?this.zc?"disabled_in_project":"remote_config_pending":this.jc?L(this.zt)||!this.zt.token?"missing_token":O!=null&&O.__PosthogExtensions__?this.Bc?"initializing":this.Hc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var s,e;return(s=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&s!==void 0&&s}sendMessage(s,e,t){var i=this;return X((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(s,e,t):(He.warn(kt),null)}))()}getMessages(s,e){var t=this;return X((function*(){return t._conversationsManager?t._conversationsManager.getMessages(s,e):(He.warn(kt),null)}))()}markAsRead(s){var e=this;return X((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(s):(He.warn(kt),null)}))()}getTickets(s){var e=this;return X((function*(){return e._conversationsManager?e._conversationsManager.getTickets(s):(He.warn(kt),null)}))()}requestRestoreLink(s){var e=this;return X((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(s):(He.warn(kt),null)}))()}restoreFromToken(s){var e=this;return X((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(s):(He.warn(kt),null)}))()}restoreFromUrlToken(){var s=this;return X((function*(){return s._conversationsManager?s._conversationsManager.restoreFromUrlToken():(He.warn(kt),null)}))()}getCurrentTicketId(){var s,e;return(s=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&s!==void 0?s:null}getWidgetSessionId(){var s,e;return(s=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&s!==void 0?s:null}Cu(){var s;(s=this._conversationsManager)==null||s.setIdentity()}Tu(){var s;(s=this._conversationsManager)==null||s.clearIdentity()}}},_c={logs:class{constructor(s){var e,t=this;this.name="logs",this.Vc=!1,this.Gc=!1,this.Zc=!1,this.A=se("[logs]"),this.Qc=w({},this.A,{error(){for(var i=arguments.length,r=new Array(i),n=0;i>n;n++)r[n]=arguments[n];r.some(Da)||t.A.error(...r)}}),this.ba=[],this.Jc=[],this._d=0,this.Os=!1,this.Kc=[],this.Yc=[],this.Xc=!1,this.tf=!1,this.ef=()=>{var i,r;this.Os||(this._d=0,(i=this.if)==null||i.onReconnect(),(r=this.rf)==null||r.onReconnect())},this._instance=s,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Vc=!0),_&&K(_,"online",this.ef)}nf(s,e,t,i){var r,n=Ra((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new Cu(this.sf(s,e),n,this.Qc,(()=>this.af()),(a=>a()),void 0,i),n]}lf(){var s,e=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.if||this.uf!==e){var t;(t=this.if)==null||t.reset(),this.uf=e;var i=this.nf((()=>this.ba),(r=>{this.ba=r}));this.if=i[0],this.hf=i[1]}return this.if}df(){var s,e=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.rf||this.vf!==e){var t;(t=this.rf)==null||t.reset(),this.vf=e;var i=this.nf((()=>this.Jc),(r=>{this.Jc=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ma);this.rf=i[0],this.cf=i[1]}return this.rf}setup(s){var e;if(!this.Os){this.Ns=s,(e=this._instance)!=null&&(e=e.config)!=null&&(e=e.logs)!=null&&e.captureConsoleLogs&&(this.Vc=!0),(this.Vc||this.ff()&&this.pf())&&this.gf();var t=!1,i=s.onRemoteConfig((r=>{var n;t=r.ok&&((n=r.config.logs)==null?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)}));this.Os?i.dispose():(this.qs=i,t||this.loadIfEnabled())}}dispose(){var s,e,t,i;this.Os||(this.Os=!0,this.mf(),(s=this.qs)==null||s.dispose(),this.qs=void 0,this.Ns=void 0,this.Zc=!1,_?.removeEventListener("online",this.ef),(e=this.yf)==null||e.call(this),this.yf=void 0,(t=this.if)==null||t.reset(),(i=this.rf)==null||i.reset())}onRemoteConfig(s){var e,t;if(!this.Os){var i=s.ok?(e=s.config.logs)==null?void 0:e.captureConsoleLogs:void 0;L(i)?this.bf():((t=this._instance)==null||(t=t.persistence)==null||t.register({[wr]:!!i}),i?(this.Vc=!0,this.Gc||this.gf(),this.loadIfEnabled()):this.bf())}}reset(){var s,e,t,i;this.mf(),(s=this.if)==null||s.clearQueue(),this.ba=[],(e=this.if)==null||e.reset(),(t=this.rf)==null||t.clearQueue(),this.Jc=[],(i=this.rf)==null||i.reset(),this._d=0}captureLog(s){this.Os||this.lf().captureLog(s)}captureConsoleLog(s){this.Os||this.df().captureLog(s)}captureBufferedConsoleLog(s,e,t){this.Os||this.df().captureLog(s,{context:e,occurredAtMs:t})}pf(){var s;return!((s=this._instance)==null||(s=s.persistence)==null||(s=s.props)==null||!s[wr])}ff(){var s,e;return(s=this._instance)==null||s.pa==null||!s.pa()||!((e=O._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null||!e.config)}Iu(){var s;this.mf(),(s=this.rf)==null||s.clearQueue(),this.Jc=[]}bf(){this.Vc||this.mf()}gf(){var s,e=this;if(!this.Xc&&O!=null&&O.console){var t=Ra((s=this._instance)==null||(s=s.config)==null?void 0:s.logs).maxBufferSize,i=function(n){var a;try{a=(o=>{for(;(l=o)!=null&&l.__rrweb_original__;){var l;o=o.__rrweb_original__}return o})(O.console[n])}catch{return 0}if(!a)return 0;e.Yc.push(Fl(O.console,n,(o=>{var l=function(){for(var h=arguments.length,u=new Array(h),c=0;h>c;c++)u[c]=arguments[c];try{e._f(n,u,t)}catch{}return o.apply(O.console,u)};return l.__rrweb_original__=a,l})))};for(var r of ac)i(r);this.Xc=!0,this.wf=setTimeout((()=>{this.mf()}),3e4)}}_f(s,e,t){var i;if(this.Xc&&!this.tf&&e.length!==0)if((i=this._instance)!=null&&i.is_capturing()){if(t>this.Kc.length){this.tf=!0;try{this.Kc.push({level:s,args:e,occurredAtMs:Date.now(),context:this.af()})}finally{this.tf=!1}}}else this.mf()}mf(){if(this.Kc=[],this.Xc){for(var s of(this.Xc=!1,this.wf&&(clearTimeout(this.wf),this.wf=void 0),this.Yc))s();this.Yc=[]}}kf(){var s=this.Kc;return this.mf(),s}get logger(){return this.Sf||(this.Sf={trace:(s,e)=>this.captureLog({body:s,level:"trace",attributes:e}),debug:(s,e)=>this.captureLog({body:s,level:"debug",attributes:e}),info:(s,e)=>this.captureLog({body:s,level:"info",attributes:e}),warn:(s,e)=>this.captureLog({body:s,level:"warn",attributes:e}),error:(s,e)=>this.captureLog({body:s,level:"error",attributes:e}),fatal:(s,e)=>this.captureLog({body:s,level:"fatal",attributes:e})}),this.Sf}flushLogs(s){s?this.xf(s):(this.if&&this.if.flush().catch((e=>this.Cf(e))),this.rf&&this.rf.flush().catch((e=>this.Cf(e))))}Cf(s){Da(s)||this.A.error("PostHog logs flush failed:",s)}loadIfEnabled(){if(!this.Os&&this.Vc&&!this.Gc&&!this.Zc){var s=O?.__PosthogExtensions__;if(!s)return this.A.error("PostHog Extensions not found."),void this.mf();var e=s.loadExternalDependency;if(!e)return this.A.error(an),void this.mf();this.Zc=!0;try{e(this._instance,"logs",(t=>{if(this.Zc=!1,!this.Os&&this.Vc){var i=s.logs;if(t||i==null||!i.initializeLogs)this.A.error("Could not load logs script",t),this.mf();else{var r,n,a=this.kf();this.yf=i.initializeLogs((r=this.Ns)!==null&&r!==void 0?r:this._instance),this.Gc=!0,a.length>0&&(i.replayConsoleBuffer==null||i.replayConsoleBuffer((n=this.Ns)!==null&&n!==void 0?n:this._instance,a))}}}))}catch(t){throw this.Zc=!1,t}}}sf(s,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:i=>i===Xe.LogsQueue?s():void 0,setPersistedProperty(i,r){var n;i===Xe.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},hs:i=>this.hs(i),getLibraryId:()=>Z.LIB_NAME,getLibraryVersion:()=>Z.LIB_VERSION}}hs(s){return new Promise((e=>{if(Yo(this._d,3))e({kind:"fatal",error:ir(void 0,"logs endpoint is unreachable, dropping batch")});else{var t=!1,i=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:ir(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Tf(),data:s,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this.Mf(a),a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;a===0?(n.error||this.A.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:ir(n.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}Mf(s){(s!==0||this._instance.__loaded)&&(this._d=Zo(s,this._d,3,(()=>this.A.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."))))}xf(s){this.ba.length>0&&this.If(s,this.ba,this.hf,Z.LIB_NAME,(e=>{this.ba=e})),this.Jc.length>0&&this.If(s,this.Jc,this.cf,Ma,(e=>{this.Jc=e}))}If(s,e,t,i,r){if(e.length!==0){var n=e.map((o=>o.record));r([]);var a=xo(n,wo(t,Z.LIB_NAME,Z.LIB_VERSION),i,Z.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Tf(),data:a,compression:"best-available",batchKey:"logs",transport:s})}}Tf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}af(){var s,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var t=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.windowId,r=t.sessionStartTimestamp,n=t.lastActivityTimestamp;e.sessionId=t.sessionId,e.windowId=i,L(r)||(e.sessionStartTimestamp=r),L(n)||(e.lastActivityTimestamp=n)}if(O!=null&&(s=O.location)!=null&&s.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?_t(O.location.href):O.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},mc={metrics:class{constructor(s){this.A=se("[metrics]"),this._instance=s}initialize(){}lf(){var s,e,t=(s=this._instance)==null||(s=s.config)==null?void 0:s.metrics;return this.if&&this.uf===t||((e=this.if)==null||e.reset(),this.uf=t,this.if=new Au(this.sf(),(function(i){var r,n,a,o,l,h=i?.resourceAttributes;return{serviceName:(r=h?.["service.name"])!==null&&r!==void 0?r:i?.serviceName,serviceVersion:(n=h?.["service.version"])!==null&&n!==void 0?n:i?.serviceVersion,environment:(a=h?.["deployment.environment"])!==null&&a!==void 0?a:i?.environment,resourceAttributes:h,beforeSend:i?.beforeSend,flushIntervalMs:(o=i?.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=i?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.A)),this.if}count(s,e,t){e===void 0&&(e=1),this.lf().count(s,e,t)}gauge(s,e,t){this.lf().gauge(s,e,t)}histogram(s,e,t){this.lf().histogram(s,e,t)}flush(s){if(!this.if)return Promise.resolve();if(s){var e=this.if.drainWindow();return e&&this.Ms(e,s),Promise.resolve()}return this.if.flush().catch((t=>this.A.error("PostHog metrics flush failed:",t)))}reset(){var s;(s=this.if)==null||s.reset()}sf(){var s=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},Ms:t=>e.Ms(t),getLibraryId:()=>Z.LIB_NAME,getLibraryVersion:()=>Z.LIB_VERSION}}Ms(s,e){return new Promise((t=>{var i=!1,r=a=>{i||(i=!0,clearTimeout(n),t(a))},n=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(w({method:"POST",url:this.Ef(),data:s,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!==408&&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)})}}}))}))}Ef(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},yc=w({},Ei,oc,lc,uc,hc,cc,vc,dc,pc,fc,gc,_c,mc);Le.__defaultExtensionClasses=w({},yc);var bc=(function(){Z.SDK_DIST_CHANNEL="npm";var s=xs[Nt]=new Le;return(function(){function e(){e.done||(e.done=!0,Sl=!1,W(xs,(function(t){t._dom_loaded()})))}E!=null&&E.addEventListener?E.readyState==="complete"?e():K(E,"DOMContentLoaded",e,{capture:!1}):_&&S.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),s})();export{De as Compression,Nr as DisplaySurveyType,Le as PostHog,uh as ProductTourEventName,ia as ProductTourEventProperties,ut as SurveyEventName,zi as SurveyEventProperties,os as SurveyEventType,Vi as SurveyType,bc as default,bc as posthog};