posthog-js 1.426.0 → 1.426.2

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 (69) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/conversations.js +1 -1
  14. package/dist/customizations.full.js +1 -1
  15. package/dist/customizations.js +1 -1
  16. package/dist/default-extensions.js +1 -1
  17. package/dist/default-extensions.js.map +1 -1
  18. package/dist/extension-bundles.js +1 -1
  19. package/dist/extension-bundles.js.map +1 -1
  20. package/dist/lazy-recorder.js +1 -1
  21. package/dist/main.js +1 -1
  22. package/dist/main.js.map +1 -1
  23. package/dist/module.d.ts +2 -0
  24. package/dist/module.full.d.ts +2 -0
  25. package/dist/module.full.js +1 -1
  26. package/dist/module.full.js.map +1 -1
  27. package/dist/module.full.no-external.d.ts +2 -0
  28. package/dist/module.full.no-external.js +1 -1
  29. package/dist/module.full.no-external.js.map +1 -1
  30. package/dist/module.js +1 -1
  31. package/dist/module.js.map +1 -1
  32. package/dist/module.mjs +2 -0
  33. package/dist/module.mjs.map +1 -0
  34. package/dist/module.no-external.d.ts +2 -0
  35. package/dist/module.no-external.js +1 -1
  36. package/dist/module.no-external.js.map +1 -1
  37. package/dist/module.slim.js +1 -1
  38. package/dist/module.slim.js.map +1 -1
  39. package/dist/module.slim.no-external.d.ts +2 -0
  40. package/dist/module.slim.no-external.js +1 -1
  41. package/dist/module.slim.no-external.js.map +1 -1
  42. package/dist/posthog-recorder.js +1 -1
  43. package/dist/product-tours.js +1 -1
  44. package/dist/src/entrypoints/web-vitals-with-attribution-soft-navs.d.ts +1 -0
  45. package/dist/src/entrypoints/web-vitals-with-attribution.d.ts +1 -0
  46. package/dist/src/extensions/segment-integration.d.ts +1 -1
  47. package/dist/src/posthog-persistence.d.ts +2 -0
  48. package/dist/web-vitals-with-attribution-soft-navs.js +1 -1
  49. package/dist/web-vitals-with-attribution-soft-navs.js.map +1 -1
  50. package/dist/web-vitals-with-attribution.js +1 -1
  51. package/dist/web-vitals-with-attribution.js.map +1 -1
  52. package/lib/package.json +2 -2
  53. package/lib/src/entrypoints/web-vitals-with-attribution-soft-navs.d.ts +1 -0
  54. package/lib/src/entrypoints/web-vitals-with-attribution-soft-navs.js +4 -2
  55. package/lib/src/entrypoints/web-vitals-with-attribution-soft-navs.js.map +1 -1
  56. package/lib/src/entrypoints/web-vitals-with-attribution.d.ts +1 -0
  57. package/lib/src/entrypoints/web-vitals-with-attribution.js +4 -2
  58. package/lib/src/entrypoints/web-vitals-with-attribution.js.map +1 -1
  59. package/lib/src/extensions/segment-integration.d.ts +1 -1
  60. package/lib/src/extensions/segment-integration.js +22 -10
  61. package/lib/src/extensions/segment-integration.js.map +1 -1
  62. package/lib/src/posthog-core.js +9 -0
  63. package/lib/src/posthog-core.js.map +1 -1
  64. package/lib/src/posthog-featureflags.js +10 -5
  65. package/lib/src/posthog-featureflags.js.map +1 -1
  66. package/lib/src/posthog-persistence.d.ts +2 -0
  67. package/lib/src/posthog-persistence.js +76 -24
  68. package/lib/src/posthog-persistence.js.map +1 -1
  69. package/package.json +5 -5
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";function t(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise((function(s,n){var o=i.apply(e,r);function a(i){t(o,s,n,a,l,"next",i)}function l(i){t(o,s,n,a,l,"throw",i)}a(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}Object.defineProperty(exports,"__esModule",{value:!0});var s={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.426.0",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",h="__alias",u="$fbc",d="$fbc_persistence",v="__timers",c="$autocapture_disabled_server_side",f="$heatmaps_enabled_server_side",p="$exception_capture_enabled_server_side",_="$error_tracking_suppression_rules",g="$error_tracking_capture_extension_exceptions",m="$web_vitals_enabled_server_side",b="$dead_clicks_enabled_server_side",y="$product_tours_enabled_server_side",w="$logs_capture_enabled_server_side",x="$web_vitals_allowed_metrics",S="$session_recording_remote_config",E="$replay_sample_rate",k="$replay_override_sampling",T="$replay_override_linked_flag",P="$replay_override_url_trigger",R="$replay_override_event_trigger",C="$sesid",O="$session_is_sampled",I="$enabled_feature_flags",F="$active_feature_flags",A="$early_access_features",M="$feature_flag_details",D="$feature_flag_payloads",N="$feature_flag_request_id",L="$minimal_flag_called_events",j="$override_feature_flags",U="$override_feature_flag_payloads",B="$stored_person_properties",z="$stored_group_properties",H="$groups",q="$surveys",V="$surveys_loaded_at",W="$surveys_activated",G="$surveys_activated_session",K="$surveys_activated_timestamps",J="ph_product_tours",Y="$flag_call_reported",Q="$flag_call_reported_session_id",X="$feature_flag_errors",Z="$feature_flag_evaluated_at",tt="$user_state",it="$client_session_props",et="$capture_rate_limit",rt="$initial_campaign_params",st="$initial_referrer_info",nt="$initial_person_info",ot="$epp",at="$posthog_cookieless",lt="$cookieless_mode",ht="$sdk_debug_extensions_init_method",ut="$sdk_debug_extensions_init_time_ms",dt="$sdk_debug_recording_script_not_loaded",vt="PostHog loadExternalDependency extension not found.",ct="on_reject",ft="always",pt="anonymous",_t="identified",gt="identified_only",mt="visibilitychange",bt="beforeunload",yt="$pageview",wt="$pageleave",xt="$identify",St="$groupidentify",Et="u">typeof window?window:void 0,kt="u">typeof globalThis?globalThis:Et,Tt=null==kt?void 0:kt.navigator,$t=null==kt?void 0:kt.document,Pt=null==kt?void 0:kt.location,Rt=null==kt?void 0:kt.fetch,Ct=null!=kt&&kt.XMLHttpRequest&&"withCredentials"in new kt.XMLHttpRequest?kt.XMLHttpRequest:void 0,Ot=null==kt?void 0:kt.AbortController,It=null==kt?void 0:kt.CompressionStream,Ft=null==Tt?void 0:Tt.userAgent;function At(){return!(!Et||!1===Et.navigator.onLine)}var Mt="undefined"!=typeof globalThis?globalThis:Et;Mt&&"undefined"==typeof self&&(Mt.self=Mt),Mt&&"undefined"==typeof File&&(Mt.File=function(){});var Dt=null!=Et?Et:{},Nt=["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"],Lt=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return Nt.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function jt(t,i){return-1!==t.indexOf(i)}var Ut=function(t){return t.trim()},Bt=function(t){return t.replace(/^\$/,"")};function zt(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var Ht=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),qt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Vt=["$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"],Wt=["token"],Gt=Object.prototype,Kt=Gt.hasOwnProperty,Jt=Gt.toString,Yt=Array.isArray||function(t){return"[object Array]"===Jt.call(t)},Qt=t=>"function"==typeof t,Xt=t=>t===Object(t)&&!Yt(t),Zt=t=>{if(Xt(t)){for(var i in t)if(Kt.call(t,i))return!1;return!0}return!1},ti=t=>void 0===t,ii=t=>"[object String]"==Jt.call(t),ei=t=>ii(t)&&0===t.trim().length,ri=t=>null===t,si=t=>ti(t)||ri(t),ni=t=>"[object Number]"==Jt.call(t)&&t==t,oi=t=>ni(t)&&t>0,ai=t=>"[object Boolean]"===Jt.call(t),li=t=>t instanceof FormData,hi=t=>jt(Vt,t),ui=t=>jt(Wt,t);function di(t){return null===t||"object"!=typeof t}function vi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function ci(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return pi(t,Error)}}function fi(t){return"u">typeof Event&&pi(t,Event)}function pi(t,i){try{return t instanceof i}catch(t){return!1}}var _i=[!0,"true",1,"1","yes"],gi=t=>jt(_i,t),mi=[!1,"false",0,"0","no"];function bi(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),ni(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),bi(null!=s?s:e,i,e,r))}class yi{constructor(t){this.C={},this.I=t.I,this.R=bi(t.bucketSize,0,100,t.A),this.O=bi(t.refillRate,0,this.R,t.A),this.N=bi(t.refillInterval,0,864e5,t.A)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.N);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.N)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}}var wi="Mobile",xi="iOS",Si="Android",Ei="Tablet",ki=Si+" "+Ei,Ti="iPad",$i="Apple",Pi=$i+" Watch",Ri="Safari",Ci="BlackBerry",Oi="Samsung",Ii=Oi+"Browser",Fi=Oi+" Internet",Ai="Chrome",Mi=Ai+" OS",Di=Ai+" "+xi,Ni="Internet Explorer",Li=Ni+" "+wi,ji="Opera",Ui=ji+" Mini",Bi="Edge",zi="Microsoft "+Bi,Hi="Firefox",qi=Hi+" "+xi,Vi="Nintendo",Wi="PlayStation",Gi="Xbox",Ki=Si+" "+wi,Ji=wi+" "+Ri,Yi="Windows",Qi=Yi+" Phone",Xi="Nokia",Zi="Ouya",te="Generic",ie=te+" "+wi.toLowerCase(),ee=te+" "+Ei.toLowerCase(),re="Konqueror",se="Oculus Browser",ne="Vivaldi",oe="Yandex",ae="Whale",le="DuckDuckGo",he="Pale Moon",ue="Waterfox",de="Brave",ve="Claude",ce="Codex",fe="ChatGPT",pe="Google Search App",_e="(\\d+(\\.\\d+)?)",ge=new RegExp("Version/"+_e),me=new RegExp("("+ve+"|"+ce+"|"+fe+")\\/"+_e),be=new RegExp(Gi,"i"),ye=new RegExp(Wi+" \\w+","i"),we=new RegExp(Vi+" \\w+","i"),xe=new RegExp(Ci+"|PlayBook|BB10","i"),Se={"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"},Ee=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?de:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&jt(t,"GSA/")?pe:jt(t," OPR/")&&jt(t,"Mini")?Ui:jt(t," OPR/")?ji:xe.test(t)?Ci:jt(t,"IE"+wi)||jt(t,"WPDesktop")?Li:jt(t,"OculusBrowser")?se:jt(t,Ii)?Fi:jt(t,Bi)||jt(t,"Edg/")?zi:jt(t,ne+"/")?ne:jt(t,"YaBrowser/")?oe:jt(t,ae+"/")?ae:jt(t,le+"/")||jt(t,"Ddg/")?le:jt(t,ve+"/")?ve:jt(t,ce+"/")?ce:jt(t,fe+"/")?fe:jt(t,"FBIOS")?"Facebook "+wi:jt(t,"UCWEB")||jt(t,"UCBrowser")?"UC Browser":jt(t,"CriOS")?Di:jt(t,"CrMo")||jt(t,Ai)?Ai:jt(t,Si)&&jt(t,Ri)?Ki:jt(t,"FxiOS")?qi:jt(t.toLowerCase(),re.toLowerCase())?re:jt(t,de+"/")?de:((t,i)=>i&&jt(i,$i)||function(t){return jt(t,Ri)&&!jt(t,Ai)&&!jt(t,Si)}(t))(t,i)?jt(t,wi)?Ji:Ri:jt(t,"PaleMoon/")?he:jt(t,ue+"/")?ue:jt(t,Hi)?Hi:jt(t,"MSIE")||jt(t,"Trident/")?Ni:jt(t,"Gecko")?Hi:"")},ke={[Li]:[new RegExp("rv:"+_e)],[zi]:[new RegExp(Bi+"?\\/"+_e)],[Ai]:[new RegExp("("+Ai+"|CrMo)\\/"+_e)],[Di]:[new RegExp("CriOS\\/"+_e)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+_e)],[Ri]:[ge],[Ji]:[ge],[ji]:[new RegExp("(Opera|OPR)\\/"+_e)],[Hi]:[new RegExp(Hi+"\\/"+_e)],[qi]:[new RegExp("FxiOS\\/"+_e)],[re]:[new RegExp("Konqueror[:/]?"+_e,"i")],[Ci]:[new RegExp(Ci+" "+_e),ge],[Ki]:[new RegExp("android\\s"+_e,"i")],[Fi]:[new RegExp(Ii+"\\/"+_e)],[se]:[new RegExp("OculusBrowser\\/"+_e)],[ne]:[new RegExp(ne+"\\/"+_e)],[oe]:[new RegExp("YaBrowser\\/"+_e)],[ae]:[new RegExp(ae+"\\/"+_e)],[de]:[new RegExp(de+"\\/"+_e)],[ve]:[me],[ce]:[me],[fe]:[me],[le]:[new RegExp("(DuckDuckGo|Ddg)\\/"+_e)],[he]:[new RegExp("PaleMoon\\/"+_e)],[ue]:[new RegExp(ue+"\\/"+_e)],[pe]:[new RegExp("GSA\\/"+_e)],[Ni]:[new RegExp("(rv:|MSIE )"+_e)],Mozilla:[new RegExp("rv:"+_e)]},Te=function(t,i,e,r){var s=Ee(t,i,e,r),n=ke[s];if(ti(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},$e=[[new RegExp(Gi+"; "+Gi+" (.*?)[);]","i"),t=>[Gi,t&&t[1]||""]],[new RegExp(Vi,"i"),[Vi,""]],[new RegExp(Wi,"i"),[Wi,""]],[xe,[Ci,""]],[new RegExp(Yi,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Qi,""];if(new RegExp(wi).test(i)&&!/IEMobile\b/.test(i))return[Yi+" "+wi,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Se[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Yi,r]}return[Yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xi,[t[3],t[4],t[5]||"0"].join(".")]:[xi,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=ti(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Si+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Si+")","i"),t=>t&&t[2]?[Si,[t[2],t[3],t[4]||"0"].join(".")]:[Si,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Mi,""]],[/Linux|debian/i,["Linux",""]]],Pe=function(t){for(var i=0;$e.length>i;i++){var e=$e[i],r=e[1],s=e[0].exec(t),n=s&&(Qt(r)?r(s,t):r);if(n)return n}return["",""]},Re=function(t){return we.test(t)?Vi:ye.test(t)?Wi:be.test(t)?Gi:new RegExp(Zi,"i").test(t)?Zi:new RegExp("("+Qi+"|WPDesktop)","i").test(t)?Qi:/iPad/.test(t)?Ti:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Pi:xe.test(t)?Ci:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Xi,"i").test(t)?Xi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(wi).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Si:ki:new RegExp("(pda|"+wi+")","i").test(t)?ie:new RegExp(Ei,"i").test(t)&&!new RegExp(Ei+" pc","i").test(t)?ee:""},Ce=20,Oe=1e3,Ie=1e4,Fe="[Circular]",Ae="[Truncated]",Me="[Unserializable]",De="[Function]";function Ne(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}var Le,je,Ue,Be=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ze(t,i){return"string"==typeof(e=t)&&Be.test(e)?t:i();var e}function He(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function qe(t){return t?t.split("#")[0]:t}function Ve(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function We(t,i,e){return Ge.apply(this,arguments)}function Ge(){return(Ge=i((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ve((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}function Ke(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Ue&&e.length===je||(je=e.length,Ue=e.reduce(((e,r)=>{Le||(Le={});var s=Le[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,Le[r]=[l,h];break}}return e}),{})),Ue}}class Je{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Yt(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var e=this;return i((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,i){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:Ke(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Ye="?";function Qe(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Ye:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return ti(r)||(n.lineno=r),ti(s)||(n.colno=s),n}var Xe=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Ye,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},Ze=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ir=/\((\S*)(?::(\d+))(?::(\d+))\)/,er=(t,i)=>{var e=Ze.exec(t);if(e)return Qe(i,e[1],Ye,+e[2],+e[3]);var r=tr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ir.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Xe(r[1]||Ye,r[2]);return Qe(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},rr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nr=(t,i)=>{var e=rr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=sr.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Ye,o=Xe(n,s);return Qe(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},or=/\(error: (.*)\)/;class ar{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=ii(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return vi(t,"DOMException")}isDOMError(t){return vi(t,"DOMError")}}class lr{match(t){return ci(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class hr{match(t){return!!vi(t,"ErrorEvent")&&(null!=t.error||this.Vi(t))}coerce(t,i){var r;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return e({},s,{stack:null!==(r=this.Zi(t))&&void 0!==r?r:s.stack,synthetic:!0})}Vi(t){return ii(t.message)&&t.message.length>0}Zi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(ii(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var ur=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class dr{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(ur);return r&&(i=r[1],e=r[2]),[i,e]}}var vr=["fatal","error","warning","log","info","debug"];function cr(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class fr{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(fi(t))return t.constructor.name;var i="name"in t?t.name:void 0;return ii(i)&&!ei(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+cr(t)}isSeverityLevel(t){return ii(t)&&!ei(t)&&vr.indexOf(t)>=0}getStack(t){try{return ii(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ii(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(ci(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class pr{match(t){return fi(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+cr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class _r{match(t){return di(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class gr{match(t){return vi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!fi(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return di(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var mr="$message",br="$timestamp",yr=new Set([mr,br]),wr={enabled:!0,max_bytes:32768};function xr(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:wr.enabled,max_bytes:Er(t.max_bytes,wr.max_bytes)}:e({},wr)}class Sr{constructor(t){this.Pn=[],this.Fn=0,this.mn=xr(t)}setConfig(t){this.mn=xr(t),this.$n()}add(t){var i=function(t){var i;try{i=zt(t)}catch(t){return}try{var e=JSON.parse(i);if(!Xt(e))return;var r=e,s=r[mr],n=r[br];if(!ii(s)||0===s.trim().length)return;if(!ii(n)&&!ni(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.mn.max_bytes||(this.Pn.push({step:i.step,bytes:e}),this.Fn+=e,this.$n())}}getAttachable(){return this.Pn.map((t=>t.step))}clear(){this.Pn=[],this.Fn=0}size(){return this.Pn.length}$n(){for(;this.Fn>this.mn.max_bytes&&this.Pn.length>0;){var t=this.Pn.shift();t&&(this.Fn-=t.bytes)}}}function Er(t,i){if(!ni(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var kr=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Tr(t){return"string"==typeof t||t}function $r(t){return"string"==typeof t?t:void 0}var Pr,Rr=["$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"],Cr="NativeGzipValidationError",Or=t=>t.length>=2&&31===t[0]&&139===t[1],Ir=(t,i)=>t===qt.GZipJS||i===qt.GZipJS||"gzip"===i,Fr=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Ar=t=>{throw He(Cr,"Native gzip produced invalid output: "+t)},Mr=function(){var t=i((function*(t,i){18>t.size&&Ar("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Or(e)&&8===e[2]||Ar("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Pr)return Pr;Pr=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Pr[t]=i>>>0}return Pr})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Ar("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Ar("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function Dr(){return Dr=i((function*(t,e,r){void 0===e&&(e=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=i((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Mr(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),Dr.apply(this,arguments)}var Nr=0x8000000000000000,Lr="9223372036854775808",jr={}.propertyIsEnumerable;function Ur(t,i){try{return Hr(t,i,{ancestors:new WeakSet,remainingNodes:Ie},0)}catch(t){return[]}}function Br(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:Ae};if(e.remainingNodes--,ai(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt(Lr);return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Nr||-Nr>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Ne(t)};if("function"==typeof t)return{stringValue:De};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:Fe};if(r>=Ce)return{stringValue:Ae};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Ne(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Br(a.call(t),i,e,r+1)}catch(t){}return Yt(t)?{arrayValue:{values:zr(t,i,e,r+1)}}:{kvlistValue:{values:Hr(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ne(String(t))}}function zr(t,i,e,r){for(var s=[],n=Math.min(t.length,Oe),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(si(a))continue;s.push(Br(a,i,e,r))}catch(t){s.push({stringValue:Me})}return t.length>o&&s.push({stringValue:Ae}),s}function Hr(t,i,e,r){var s=[];for(var n in t)if(jr.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=Oe||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(ri(o)||ti(o))continue;s.push({key:Ne(n),value:Br(o,i,e,r)})}catch(t){s.push({key:Ne(n),value:{stringValue:Me}})}}return s}function qr(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}var Vr={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var Wr={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}},Gr=Wr.info;function Kr(t){try{return Ne(String(t))}catch(t){return Me}}function Jr(t,i,r,s){var n,o=Wr[t.level||"info"]||Gr,a=o.text,l=o.number,h=(void 0===(n=ni(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),si(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),si(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=e({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Me}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:Kr(t.body)},attributes:Ur(d,r)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),ti(t.trace_flags)||(_.flags=t.trace_flags),_}function Yr(t,i,e){return qr(t,i,e)}function Qr(t,i,e,r){return{resourceLogs:[{resource:{attributes:Ur(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Xr=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.mn=i,this.A=e,this.Nn=r,this.qn=s,this.jn=n,this.Bn=o,this.Hn=null,this.zn=0,this.Un=0,this.Wn=0,this.Vn=0,this.Gn=0,this.Zn=!1,this.Qn=i.maxBufferSize,this.Jn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.Kn=i.flushIntervalMs,this.Yn=i.maxBatchRecordsPerPost,this.Xn=i.rateCapWindowMs,this.ts=i.maxLogsPerInterval}clearQueue(){this.Un++,this._instance.setPersistedProperty(Ht.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(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.ns(t);if(null!==r)if(r.body){if(this.ss()){var s={record:Jr(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Nn(),this.A,null==i?void 0:i.occurredAtMs)};this.qn((()=>this.os(s)))}}else this.A.info("Log was rejected in beforeSend function")}}ns(t){var i=this.mn.beforeSend;if(!i)return t;var e=Yt(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}ss(){if(void 0===this.ts)return!0;var t=Date.now(),i=t-this.Vn;return this.Xn>i&&i>=0||(this.Vn=t,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 t=this;return i((function*(){if(!t._instance.isDisabled)return t.Hn||(t.Hn=t.ls().finally((()=>{t.Hn=null}))),t.Hn}))()}ls(){var t=this;return i((function*(){var i;t.es();var e=null!==(i=t._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.Un;t.zn=0;var l=Math.min(e.length,t.Yn),h=e.slice(0,l),u=Qr(h.map((t=>t.record)),t.us(),null!==(n=t.Bn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.hs(u);if(t.Un!==a)return;if("too-large"===d.kind&&h.length>1)t.Yn=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.Yn);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.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."):"ok"===d.kind&&t.mn.maxBatchRecordsPerPost>t.Yn&&(t.Yn=Math.min(t.mn.maxBatchRecordsPerPost,t.Yn+1)),yield t.ds(h.length),e=null!==(o=t._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}ds(t){var e=this;return i((function*(){var i,r=Math.max(0,t-e.zn),s=null!==(i=e._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(Ht.LogsQueue,s.slice(r)),yield e.jn()}))()}us(){return Yr(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}os(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==i?i:[];this.Jn>e.length||(e.shift(),this.zn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(Ht.LogsQueue,e),this.Qn>e.length?this.vs():this.rs()}}vs(t){void 0===t&&(t=this.Kn),this.cs||(this.cs=Ve((()=>{this.cs=void 0,this.rs()}),t))}fs(){var t=Math.min(Math.max(0,this.Wn-1),6);return this.Kn*Math.pow(2,t)}ps(){var t=this._instance.getPersistedProperty(Ht.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i((function*(){e.es();var i=e.flush().catch((()=>{}));void 0!==t?yield We(i,t):yield i}))()}flushWithTimeout(t){var e=this;return i((function*(){var i=e.flush();yield We(i,t,(()=>{i.catch((()=>{}))}))}))()}rs(){this.flush().then((()=>{this.Wn=0}),(t=>{this.Wn++,this.A.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ps()&&this.vs(this.fs())}))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};var Zr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ts(t){return String(t)+"000000"}function is(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let es=class{constructor(t,i,e){this._instance=t,this.mn=i,this.A=e,this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set,this.ws=0}count(t,i,e){void 0===i&&(i=1),this.ks({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.ks({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.ks({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,e=this.Hn,r=function(){var r=i((function*(){e&&(yield e.catch((()=>{}))),yield t.Ss()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.Hn===s&&(this.Hn=null)}));return this.Hn=s,s}drainWindow(){if(0===this.gs.size)return null;var t=this.gs;return this.gs=new Map,this.ys=!1,this.bs=new Map,this._s=new Set,this.xs(t)}reset(){this.ws++,this.es(),this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set}ks(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.ns(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=i.attributes?e({},i.attributes):void 0,s=is(i.type,i.name,i.unit,r)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.gs.get(s);if(!n){if(!this.Cs())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.gs.set(s,n)}var o=this.bs.get(i.name);void 0===o?this.bs.set(i.name,i.type):o===i.type||this._s.has(i.name)||(this._s.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Ts(n,i.value),this.vs()}else this.A.warn("Dropping metric '"+i.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(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Zr.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Zr)]+=1}}ns(t){var i=this.mn.beforeSend;if(!i)return t;var e=Yt(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}vs(){this.cs||(this.cs=Ve((()=>{this.cs=void 0,this.flush().catch((t=>{this.A.error("Metrics flush failed:",t)}))}),this.mn.flushIntervalMs))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}Ss(){var t=this;return i((function*(){if(0!==t.gs.size){var i=t.gs;t.gs=new Map,t.ys=!1,t.bs=new Map,t._s=new Set;var e=t.ws,r=yield t._instance.Ms(t.xs(i));if(e===t.ws)switch(r.kind){case"ok":return;case"retry-later":return t.Is(i),void t.vs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}}))()}xs(t){return i=this.Es(t),e=function(t,i,e){return qr(t,i,e)}(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ur(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Es(t){var i=ts(Date.now()),r=new Map;for(var s of t.values()){var n,o=is(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=e({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=Ur(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=ts(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Zr})}return Array.from(r.values())}Is(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.gs.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.Cs()&&this.gs.set(s,n)}}};var rs=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){if(Et&&(s.DEBUG||Et.POSTHOG_DEBUG||e)&&!ti(Et.console)&&Et.console){for(var r=("__rrweb_original__"in Et.console[i]?Et.console[i].__rrweb_original__:Et.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>rs(t+" "+i,e)};return r},ss=rs("[PostHog.js]"),ns=ss.createLogger;function os(t,i){Yt(t)&&t.forEach(i)}function as(t,i){if(!si(t))if(Yt(t))t.forEach(i);else if(li(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)Kt.call(t,e)&&i(t[e],e)}var ls=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function hs(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var us=function(t){try{return t()}catch(t){return}},ds=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){ss.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ss.critical(t)}}},vs=function(t){var i={};return as(t,(function(t,e){(ii(t)&&t.length>0||ni(t))&&(i[e]=t)})),i};var cs=["herokuapp.com","vercel.app","netlify.app"];function fs(t){var i=null==t?void 0:t.hostname;if(!ii(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of cs)if(e===r)return!1;return!0}function ps(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function _s(t){return"ph_toolbar_internal"===t.name}var gs=t=>{if($t){try{for(var i=t+"=",e=$t.cookie.split(";").filter((t=>t.length)),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ni(t)&&isFinite(t)&&Math.floor(t)===t});class ms{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ms(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ms(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class bs{generate(){var t=this.generateOrAbort();if(!ti(t))return t;this.Kr=0;var i=this.generateOrAbort();if(ti(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ei++,this.ei>4398046511103&&(this.Kr++,this.Xr())}return ms.fromFieldsV7(this.Kr,Math.trunc(this.ei/Math.pow(2,30)),this.ei&Math.pow(2,30)-1,this.ti.nextUint32())}Xr(){this.ei=1024*this.ti.nextUint32()+(1023&this.ti.nextUint32())}constructor(){this.Kr=0,this.ei=0,this.ti=new xs}}var ys,ws=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Et&&!ti(Et.crypto)&&crypto.getRandomValues&&(ws=t=>crypto.getRandomValues(t));class xs{nextUint32(){return this.Pt.length>this.ri||(ws(this.Pt),this.ri=0),this.Pt[this.ri++]}constructor(){this.Pt=new Uint32Array(8),this.ri=1/0}}var Ss=()=>Es().toString(),Es=()=>(ys||(ys=new bs)).generate(),ks="",Ts=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var $s=null,Ps={ii(){if(!ri($s))return $s;if($s=!1,$t)try{var t="__ph_cookie_support_"+Ss();Ps.ni(t,"xyz"),$s='"xyz"'===gs(t),Ps.oi(t)}catch(t){$s=!1}return $s},si(t){ss.error("cookieStore error: "+t)},ai:gs,ui(t){var i;try{i=JSON.parse(Ps.ai(t))||{}}catch(t){}return i},ni(t,i,e,r,s){if(!$t)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=$t),ks)return ks;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ss();!ks&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",ks=n)}return ks}(t);if(!e){var r=(t=>{var i=t.match(Ts);return i?i[0]:""})(t);r!==e&&ss.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}($t.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&ss.warn("cookieStore warning: large cookie, len="+h.length),$t.cookie=h,!0}catch(t){return!1}},oi(t,i){if(null!=$t&&$t.cookie)try{Ps.ni(t,"",-1,i)}catch(t){return}}},Rs=null,Cs={ii(){if(!ri(Rs))return Rs;var t=!0;if(ti(Et))t=!1;else try{var i="__mplssupport__";Cs.ni(i,"xyz"),'"xyz"'!==Cs.ai(i)&&(t=!1),Cs.oi(i)}catch(i){t=!1}return t||ss.error("localStorage unsupported; falling back to cookie store"),Rs=t,t},si(t){ss.error("localStorage error: "+t)},ai(t){try{return null==Et?void 0:Et.localStorage.getItem(t)}catch(t){Cs.si(t)}return null},ui(t){try{return JSON.parse(Cs.ai(t))||{}}catch(t){}return null},ni(t,i){try{return null==Et||Et.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Cs.si(t)}return!1},oi(t){try{null==Et||Et.localStorage.removeItem(t)}catch(t){Cs.si(t)}}},Os=[B,F,I,M,D,N,Z,X,Y],Is=[a,o,C,O,ot,nt,d,tt],Fs=t=>t+"_cpm",As=["__proto__","constructor","prototype"],Ms=t=>{if(!Xt(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===As.indexOf(e)&&(i[e]=t[e])})),i},Ds=function(t,i){void 0===i&&(i=[]);var e={};return[...Is,...i].forEach((i=>{var r=t[i];ti(r)||ri(r)||""===r||(e[i]=r)})),e},Ns=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Ls=(t,i)=>({p:i,f:Ns(JSON.stringify(t))}),js=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ps.ui(Fs(t)),r=(null==e?void 0:e.f)===Ns(i)&&Yt(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Us=(t,i)=>i+"|"+(Ps.ai(Fs(t))||""),Bs={},zs={ii:()=>!0,si(t){ss.error("memoryStorage error: "+t)},ai:t=>t in Bs?Bs[t]:null,ui:t=>t in Bs?Bs[t]:null,ni:(t,i)=>(Bs[t]=i,!0),oi(t){delete Bs[t]}},Hs=null,qs={ii(){if(!ri(Hs))return Hs;if(Hs=!0,ti(Et))Hs=!1;else try{var t="__support__";qs.ni(t,"xyz"),'"xyz"'!==qs.ai(t)&&(Hs=!1),qs.oi(t)}catch(t){Hs=!1}return Hs},si(t){ss.error("sessionStorage error: ",t)},ai(t){try{return null==Et?void 0:Et.sessionStorage.getItem(t)}catch(t){qs.si(t)}return null},ui(t){try{return JSON.parse(qs.ai(t))||null}catch(t){}return null},ni(t,i){try{return null==Et||Et.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){qs.si(t)}return!1},oi(t){try{null==Et||Et.sessionStorage.removeItem(t)}catch(t){qs.si(t)}}};class Vs{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===ft||this.isRejected()||-1===this.consent&&this.mn.cookieless_mode===ct}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?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 t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get Gs(){var t=this.Zs.ai(this.Qs);return gi(t)?1:jt(mi,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,i="localStorage"===t?Cs:Ps,e=i.ii()?i:zs;if(!this.Js||this.Js!==e){this.Js=e;var r="localStorage"===t?Ps:Cs;r.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(gi(r.ai(this.Qs))),r.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[null==Tt?void 0:Tt.doNotTrack,null==Tt?void 0:Tt.msDoNotTrack,Dt.doNotTrack,null==Tt?void 0:Tt.globalPrivacyControl].some((t=>gi(t)))}}function Ws(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!Qt(r))return i;try{var s=r(i);return ii(s)&&s?s:i}catch(t){return ss.error("Error in get_current_url, falling back to window.location.href",t),i}}var Gs="__POSTHOG_TOOLBAR__",Ks=1,Js=3,Ys=11;function Qs(t){return t instanceof Element&&(t.id===Gs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Xs(t){return!!t&&t.nodeType===Ks}function Zs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function tn(t){return!!t&&t.nodeType===Js}function en(t){return!!t&&t.nodeType===Ys&&Xs(t.host)}var rn=1e3;function sn(t){return t?Ut(t).split(/\s+/):[]}function nn(t,i){var e=function(t){var i,e=null==Et||null==(i=Et.location)?void 0:i.href;return ti(e)?void 0:Ws(t,e)}(i);return!!(e&&t&&t.some((t=>e.match(t))))}function on(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return sn(i)}function an(t){return si(t)?null:Ut(t).split(/(\s+)/).filter((t=>On(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ln(t){var i="";return xn(t)&&!Sn(t)&&t.childNodes&&t.childNodes.length&&as(t.childNodes,(function(t){var e;tn(t)&&t.textContent&&(i+=null!==(e=an(t.textContent))&&void 0!==e?e:"")})),Ut(i)}function hn(t){var i;return ti(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var un=["a","button","form","input","select","textarea","label"];function dn(t,i){if(ti(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function vn(t){var i=t.parentNode;return!(!i||!Xs(i))&&i}var cn=[".ph-no-autocapture","[data-ph-no-autocapture]"],fn=["next","previous","prev",">","<"],pn=[...fn,"+","-","−","–"],_n=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,gn=[".ph-no-rageclick",".ph-no-capture"],mn=["","text","search","email","password","url","tel","number"];function bn(t,i){if(!Et||yn(t))return!1;var e,r,s,n,o;if(ai(i)?(e=!!i&&gn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:gn,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!Xs(t))&&(!!Zs(t,"textarea")||(Zs(t,"input")?jt(mn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var a=wn(t,!1).targetElementList;return!function(t,i){if(!1===t||ti(t))return!1;var e;if(!0===t)e=fn;else{if(!Yt(t))return!1;if(t.length>10)return ss.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>_n(i,t)||_n(r,t)))}))}(r,a.map((t=>{var i;return{safeText:ln(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!dn(a,e)}var yn=t=>!t||Zs(t,"html")||!Xs(t),wn=(t,i)=>{if(!Et||yn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!Zs(s,"body");)if(en(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=vn(s);if(!n)break;if(i||un.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=Et.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function xn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Zs(r,"body");r=r.parentNode){if(e++>=rn||i.has(r))return!1;i.add(r);var s=on(r);if(jt(s,"ph-sensitive")||jt(s,"ph-no-capture"))return!1}if(jt(on(t),"ph-include"))return!0;var n=t.type||"";if(ii(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ii(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Sn(t){return!!(Zs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Zs(t,"select")||Zs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var En=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}))$"),kn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Tn=[16,15,14,13],$n=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Pn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Rn=/[0-9A-Za-z_]/;function Cn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function On(t,i){if(void 0===i&&(i=!0),si(t))return!1;if(ii(t)){t=Ut(t);var e=i?En.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(kn.lastIndex=0;i=kn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Tn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(En.test(a)&&Cn(a))return!0}}}return!1}(t);if(e)return!1;var r=i?$n.test(t):function(t){var i;for(Pn.lastIndex=0;i=Pn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Rn.test(e)&&Rn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function In(t){var i=ln(t);return On(i=(i+" "+Fn(t)).trim())?i:""}function Fn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&as(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=ln(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Fn(t)).trim())}catch(t){ss.error("[AutoCapture]",t)}})),i}function An(t){return t.replace(/"|\\"/g,'\\"')}function Mn(t){var i=t.attr__class;if(i)return Yt(i)?i:sn(i)}var Dn=ns("[Dead Clicks]"),Nn=()=>!0,Ln=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(b)),r=t.instance.config.capture_dead_clicks;return ai(r)?r:!!Xt(r)||e};class jn{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[b]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys((()=>{this.Xs()})):this.stop()}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Dn.error("failed to load script",i):t()}))}Xs(){var t;if($t){if(!this.Ks&&null!=(t=Dt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=Xt(this.instance.config.capture_dead_clicks)?e({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Ks=Dt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Ks.start($t),Dn.info("starting...")}}else Dn.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,Dn.info("stopping..."))}}var Un=ns("[SegmentIntegration]");var Bn="posthog-js";function zn(t,i){var r=void 0===i?{}:i,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var r,a,h,d,v;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=i.exception)?void 0:r.values)||[],_=p.map((t=>e({},t,{stacktrace:t.stacktrace?e({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>e({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:_,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),i}}class Hn{constructor(t,i,e,r,s,n){this.name=Bn,this.setupOnce=function(o){o(zn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class qn{constructor(t){this.ta=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(ss.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ea=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ia()}ia(){var t;this.ra=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ta)}destroy(){var t;null==(t=this.ra)||t.call(this),this.ra=void 0}doPageView(t,i){var e,r=this.na(t,i);return this.ea={pathname:null!==(e=null==Et?void 0:Et.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.na(t,null==(i=this.ea)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ea)?void 0:t.pageViewId}}na(t,i){var e=this.ea;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(ti(n)||ti(o)||ti(a)||ti(l)||ti(h)||ti(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?bi(o/n,0,1,ss):1,v=n>1?bi(a/n,0,1,ss):1,c=l>1?bi(h/l,0,1,ss):1,f=l>1?bi(u/l,0,1,ss):1;r=ls(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Vn=["flags","surveys"],Wn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[v]:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[w]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"hidden"},[g]:{exposure:"event"},[m]:{exposure:"event"},[b]:{exposure:"event"},[y]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[C]:{exposure:"hidden"},[O]:{exposure:"event"},[E]:{exposure:"event",shouldSkipFromEventProperties:t=>ri(t)},$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"},[I]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden"},[M]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden",storageGroup:"flags"},[N]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[L]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden"},[U]:{exposure:"hidden"},[B]:{exposure:"hidden"},[z]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"surveys"},[V]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[W]:{exposure:"event"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{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"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[H]:{exposure:"event"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[k]:{exposure:"event"},[T]:{exposure:"event"},[P]:{exposure:"event"},[R]:{exposure:"event"},[ht]:{exposure:"event"},[ut]:{exposure:"event"},[dt]:{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"}},Gn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Kn=t=>{var i=Wn[t];if(i)return i;for(var e of Gn){var r=e[1];if(0===t.indexOf(e[0]))return r}},Jn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return zt(t)}},Yn=t=>{var i=null==$t?void 0:$t.createElement("a");return ti(i)?null:(i.href=t,i)},Qn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!Yt(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){ss.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Xn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");Yt(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},Zn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},to=(t,i)=>t>=i&&At(),io=(t,i,e,r)=>{if(0===t){if(At()){var s=i+1;return s===e&&r(),s}return i}return 0},eo="https?://(.*)",ro=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],so=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ro],no="<masked>",oo=["li_fat_id"];function ao(t,i,e){if(!$t)return{};var r,s=i?[...ro,...e||[]]:[],n=lo(Xn($t.URL,s,no),t),o=(r={},as(oo,(function(t){var i=gs(t);r[t]=i||null})),r);return ls(o,n)}function lo(t,i){var e=so.concat(i||[]),r={};return as(e,(function(i){var e=Qn(t,i);r[i]=e||null})),r}function ho(t){var i=function(t){return t?0===t.search(eo+"google.([^/?]*)")?"google":0===t.search(eo+"bing.com")?"bing":0===t.search(eo+"yahoo.com")?"yahoo":0===t.search(eo+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!ri(i)){r.$search_engine=i;var s=$t?Qn($t.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function uo(){return navigator.language||navigator.userLanguage}var vo="$direct";function co(){return(null==$t?void 0:$t.referrer)||vo}function fo(t,i,e){void 0===e&&(e=!1);var r=t?[...ro,...i||[]]:[],s=e?qe(null==Pt?void 0:Pt.href):null==Pt?void 0:Pt.href,n=null==s?void 0:s.substring(0,1e3);return{r:co().substring(0,1e3),u:n?Xn(n,r,no):void 0}}function po(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?qe(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==vo?vo:null==(e=Yn(r))?void 0:e.host};if(n){o.$current_url=n;var a=Yn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=lo(n);ls(o,l)}if(r){var h=ho(r);ls(o,h)}return o}function _o(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function go(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var mo={flags:Z,surveys:V},bo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],yo=t=>t+"_cookie_identity_change_pending",wo="main",xo=[I,F,M,D,N,Z,L,B],So=t=>-1!==xo.indexOf(t),Eo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},ko=t=>{if(!t)return{};var i=JSON.parse(t);return Xt(i)?i:{}},To=(t,i)=>{as(t,((e,r)=>{var s=Kn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class $o{constructor(t,i,r){if(void 0===r&&(r=!0),this.sa={},this.aa=!1,this.oa=!1,this.la=!1,this.ua=!1,this.ha=new Map,this.da=!1,this.va=!1,this.ca=!1,this.fa=!1,this.pa=new Set,this.mn=t,this.ga=r,this.props={},this.ma=void 0,this.ya=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.Zs=this.ba(t),this.oa=this._a(t),this.load(),this.wa(),t.debug&&ss.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save(),Et){var s=()=>this.flush();ps(Et,"beforeunload",s,{capture:!1}),ps(Et,"pagehide",s,{capture:!1}),this.ka=t=>{if(this.aa&&(!t.storageArea||t.storageArea===(null==Et?void 0:Et.localStorage))&&t.key)if(t.key!==this.ya){if(this.oa){var i=Vn.find((i=>t.key===this.Sa(i)));i&&this.xa(t.key,i)}}else this.xa(t.key,wo)},ps(Et,"storage",this.ka)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var i=t[0],e=t[1],r=this.ha.get(i);if(So(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach((t=>s.add(t))),s.size&&this.Ca(i,s)}else this.Ca(i,!0)}))}onCrossTabFeatureFlagChange(t){return this.pa.add(t),()=>this.pa.delete(t)}destroy(){this.ka&&Et&&(Et.removeEventListener("storage",this.ka),this.ka=void 0),this.pa.clear()}xa(t,i,e){if(void 0===e&&(e=!0),this.Ta)return!1;var r,s;try{if(s=Cs.ai(t),ri(s)){var n=this.Ma(i);return n.storageValue=null,i!==wo&&(n.persisted=!1),!1}r=ko(s)}catch(t){return!1}var o=i===wo?r:Cs.ui(this.ya);if(o&&this.Ia(o))return!1;var a=this.Ea(r,i,e);return i===wo&&this.oa&&!Eo(this.Ra().main,r)||this.Pa(r,i,!0,s),a}Ia(t){var i=this.props[o],e=t[o];return!ti(i)&&!ti(e)&&i!==e}Pa(t,i,e,r){var s=this.Ma(i);s.storageValue=r,i!==wo&&(s.persisted=e);try{s.fingerprint=this.Aa(t,i)}catch(t){s.fingerprint=void 0}}Ea(t,i,e){var r=!1;return xo.forEach((e=>{var s,n=null==(s=Kn(e))?void 0:s.storageGroup;if(!(i===wo&&this.oa&&n||i!==wo&&n!==i)){var o=e in t,a=this.Fa(e,o?t[e]:void 0),l=this.ha.has(e)?e in this.props:o;l===e in this.props&&Eo(a,this.props[e])||(l?this.Oa(e,a,!1):this.La(e,!1),r=!0)}})),r&&e&&this.pa.forEach((t=>t())),r}Da(){if(!this.aa)return!1;try{this.ca=!1;var t,i=Cs.ai(this.ya),e=this.Ma(wo),r=!1,s=!1;if(i!==e.storageValue)if(ri(i))e.storageValue=null;else{if(t=ko(i),this.ca=!this.va&&this.Ia(t),this.ca)return!1;s=this.Ea(t,wo,!1),!this.oa||Eo(this.Ra().main,t)?this.Pa(t,wo,!0,i):e.storageValue=i,r=!0}return this.oa&&Vn.forEach((i=>{var e=Cs.ai(this.Sa(i)),n=this.Ma(i),o=t||{},a=r&&xo.some((t=>{var e;return(null==(e=Kn(t))?void 0:e.storageGroup)===i&&t in o}));if(e!==n.storageValue||a){if(ri(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ea(o,i,!1)||s));var l=ko(e);s=this.Ea(l,i,!1)||s,this.Pa(l,i,!0,e)}})),s}catch(t){return!1}}Ca(t,i){this.ha.set(t,i);var e=Kn(t);null!=e&&e.volatile||(this.Ma((this.oa?null==e?void 0:e.storageGroup:void 0)||wo).fingerprint=void 0,this.$a(t))}Na(){xo.forEach((t=>this.ha.set(t,!0)))}wa(){if(this.aa)try{var t=Cs.ai(this.ya),i=ko(t);this.Ma(wo).storageValue=t,xo.forEach((t=>{var e,r=this.oa?null==(e=Kn(t))?void 0:e.storageGroup:void 0,s=r?Cs.ai(this.Sa(r)):null;if(r){var n=this.Ma(r);n.storageValue=s,n.persisted=!ri(s)}var o=r&&!ri(s)?ko(s):i;t in this.props?this.qa(t,o[t],this.props[t]):t in o&&this.Ca(t,!0)}))}catch(t){}}Fa(t,i){var r=this.ha.get(t);if(!r)return i;if(!0===r)return this.props[t];if(t===F){var s=new Set(Yt(i)?i:[]),n=new Set(Yt(this.props[t])?this.props[t]:[]);return r.forEach((t=>n.has(t)?s.add(t):s.delete(t))),Array.from(s)}var o=Xt(i)?e({},i):{},a=Xt(this.props[t])?this.props[t]:{};return r.forEach((t=>{t in a?o[t]=a[t]:delete o[t]})),o}qa(t,i,e){if(So(t)){var r=this.ha.get(t);if(!0!==r){var s=i;if(this.aa)try{var n,o=this.oa?null==(n=Kn(t))?void 0:n.storageGroup:void 0,a=o?this.Sa(o):this.ya;s=ko(Cs.ai(a))[t]}catch(t){}var l=new Set(r||[]);if(t===F){if(!ti(i)&&!Yt(i)||!ti(s)&&!Yt(s)||!Yt(e))return void this.Ca(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach((t=>{h.has(t)!==d.has(t)&&l.add(t)})),l.forEach((t=>{u.has(t)===d.has(t)&&l.delete(t)}))}else{if(!Xt(e))return void(Eo(s,e)?this.ha.delete(t):this.Ca(t,!0));if(!ti(i)&&!Xt(i)||ti(i)&&Zt(e)&&ti(s))return void this.Ca(t,!0);var v=Xt(i)?i:{},c=Xt(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach((t=>{t in v==t in e&&Eo(v[t],e[t])||l.add(t)})),l.forEach((t=>{t in c==t in e&&Eo(c[t],e[t])&&l.delete(t)}))}l.size?this.Ca(t,l):this.ha.delete(t)}}}ja(){var t,i=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return ni(i)&&i>0?i:0}Ba(t){if(this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase())if(t)try{var i=Ds(t,this.mn.cookie_persisted_properties||[]),e=Ls(i,this.mn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ps.ai(this.ya)||void 0;s&&Us(this.ya,s)===r&&(this.Ha=r,this.za=s)}catch(t){}else try{var n=Ps.ai(this.ya)||void 0;this.Ha=n?Us(this.ya,n):void 0,this.za=n}catch(t){}}syncCookieProperties(){return this.Ua(this.mn)}Ua(t,i){if(void 0===i&&(i=!1),this.Ta&&!i||this.ua||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Ps.ai(this.ya)||void 0}catch(t){}if(!e||e===this.za)return!1;var r,s=Us(this.ya,e);try{r=Ms(JSON.parse(e))}catch(t){return!1}if((Ps.ai(this.ya)||void 0)!==e)return!1;this.Ha=s,this.za=e;var n=js(this.ya,e),a=[...Is,...n.properties],l={};if(Object.keys(r).forEach((t=>{var i=r[t];(ti(i)||ri(i)||""===i||t===tt&&i!==pt&&i!==_t)&&(l[t]=!0,delete r[t])})),Zt(r))return!1;var u=o in r||r[tt]===pt||r[tt]===_t,d=this.props,v=d[o],c=d[tt],f=ls({},d);[...Is,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==tt)){var i=f[t];!n.isValid&&-1!==Is.indexOf(t)&&(!1===i||0===i)||delete f[t]}})),this.props=ls(f,r),xo.forEach((t=>{var i=t in this.props;t in d===i&&Eo(d[t],this.props[t])||(i?this.qa(t,d[t],this.props[t]):this.Ca(t,!0))})),!u||tt in r||tt in this.props||this.Oa(tt,pt);var p=this.props[o],_=this.props[tt];return!u||p===v&&_===c||(this.va=!0,this.la=!0,qs.ni(yo(this.ya),!0),this.La(B),this.La(F),this.La(I),this.La(M),this.La(D),this.La(N),this.La(Z),this.La(X),this.La(Y),_===pt&&(c===_t||r[tt]===pt||!ti(v)&&p!==v)&&(To(this.props,r),this.La(z)),_===_t?this.props.$user_id=p:delete this.props.$user_id,this.La(h)),!0}consumeCookieIdentityChange(){var t=yo(this.ya),i=this.la||!!qs.ai(t);return this.la=!1,i&&qs.oi(t),i}Wa(t){return void 0===t&&(t=!1),!(this.ua||this.Ta&&!t||!this.mn.cookieWinsOnConflict||"localstorage+cookie"!==this.mn.persistence.toLowerCase()||(this.ua=!0,0))}Va(){this.ua&&(ti(this.Ga)||(clearTimeout(this.Ga),this.Ga=void 0),delete this.sa[wo],this.Za(!0))}Qa(t){if(void 0===t&&(t=!0),this.ua)try{t?this.Va():ti(this.Ga)||(clearTimeout(this.Ga),this.Ga=void 0)}finally{this.ua=!1}}isDisabled(){return!!this.Ta}ba(t){-1===bo.indexOf(t.persistence.toLowerCase())&&(ss.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,r=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var r=[...Is,...t];return e({},Cs,{ui(t){try{var e,s={};try{e=Ps.ai(t)||void 0,s=e?Ms(JSON.parse(e)):{}}catch(t){}var n,a=JSON.parse(Cs.ai(t)||"{}");if(i){var l=js(t,e),h=[...Is,...l.properties],u={};Object.keys(s).forEach((t=>{var i=s[t];ri(i)||""===i||t===tt&&i!==pt&&i!==_t||(u[t]=i)}));var d=o in u||u[tt]===pt||u[tt]===_t;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[tt])&&void 0!==v?v:pt;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==tt)){var i=a[t];!l.isValid&&-1!==Is.indexOf(t)&&(!1===i||0===i)||delete a[t]}})),!d||tt in s||tt in a||(a[tt]=pt),!d||(o in u?u[o]:a[o])===c&&(tt in u?u[tt]:a[tt])===f||(Os.forEach((t=>delete a[t])),u[tt]===_t&&o in u?a.$user_id=u[o]:delete a.$user_id,u[tt]!==_t&&(delete a[H],delete a[z]),delete a.__alias)}n=ls(a,u)}else n=ls(s,a);return Cs.ni(t,n),n}catch(t){}return null},ni(e,r,s,n,o,a){var l=Cs.ni(e,r,void 0,void 0,a);try{var h=Ds(r,t);if(Object.keys(h).length){if(i){var u=Fs(e),d=Ls(h,t);if(Ps.ni(u,d,s,n,o,a),Ps.ai(u)!==JSON.stringify(d)){Ps.oi(u,n);var v=Ds(r);return Ps.ni(e,v,s,n,o,a),l}}Ps.ni(e,h,s,n,o,a)}}catch(t){Cs.si(t)}return l},oi(t,i){try{null==Et||Et.localStorage.removeItem(t),Ps.oi(t,i),Ps.oi(Fs(t),i)}catch(t){Cs.si(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Cs.ii()?(i=Cs,s=!0):"localstorage+cookie"===n&&r.ii()?(i=r,s=!0):"sessionstorage"===n&&qs.ii()?i=qs:"memory"===n?i=zs:"cookie"===n&&Ps.ii()?i=Ps:r.ii()?(i=r,s=!0):i=Ps.ii()?Ps:zs,this.aa=s,i}Sa(t){return this.ya+"__"+t}_a(t){return this.aa&&!!t.split_storage}properties(){var t={};return as(this.props,((i,e)=>{var r=Kn(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.Ta||t){var i=this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase(),e=i?Cs.ui(this.ya):null,r={};if(i)try{as(r=Ms(Ps.ui(this.ya)),((t,i)=>{(ti(t)||ri(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.Zs.ui(this.ya);if(s&&(this.props=ls({},s)),this.oa&&this.Ja(),i&&s){var n,a,l=null==e?void 0:e[o],h=null!==(n=null==e?void 0:e[tt])&&void 0!==n?n:pt,u=s[o],d=null!==(a=s[tt])&&void 0!==a?a:pt;if(u!==l||d!==h){this.la=!0,qs.ni(yo(this.ya),!0);var v=ls({},this.props);Os.forEach((t=>delete v[t])),d===pt&&(h===_t||r[tt]===pt||!ti(l)&&u!==l)&&(To(v,r),delete v[z]),this.props=v;var c=new Set;Os.forEach((t=>{var i,e=null==(i=Kn(t))?void 0:i.storageGroup;e&&c.add(e)})),c.forEach((t=>{var i={};as(this.props,((e,r)=>{var s;(null==(s=Kn(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),Zt(i)?(Cs.oi(this.Sa(t)),this.sa[t]={}):Cs.ni(this.Sa(t),i)&&(this.sa[t]={persisted:!0,fingerprint:this.Aa(i,t)})}))}}qs.ai(yo(this.ya))&&(this.la=!0)}}Ja(){for(var t of Vn){var i=Cs.ui(this.Sa(t));if(i&&!Zt(i)){var e=this.Ma(t);e.persisted=!0,this.Ka(t)||(e.fingerprint=this.Aa(i,t)),this.Ya(t,i)||ls(this.props,i)}}}Ka(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Kn(i))?void 0:e.storageGroup)===t}))}Ya(t,i){var e=mo[t];if(!e)return!1;var r=i[e],s=this.props[e];return ni(r)&&ni(s)&&s>r}refreshKey(t){var i;if(!(this.Ta||t===d&&this.fa)){var e=this.oa?null==(i=Kn(t))?void 0:i.storageGroup:void 0,r=e?Cs.ui(this.Sa(e)):this.Zs.ui(this.ya);if(r&&t in r)this.Oa(t,r[t],!1);else{if(e){var s=this.Zs.ui(this.ya);if(s&&t in s)return void this.Oa(t,s[t],!1)}this.La(t,!1)}}}save(){if(!this.Ta){var t=this.ja();t>0?ti(this.Ga)&&(this.Ga=setTimeout((()=>{this.Ga=void 0,this.Za()}),t)):this.Za()}}flush(){ti(this.Ga)||(clearTimeout(this.Ga),this.Ga=void 0,this.Za())}Za(t){if(void 0===t&&(t=!1),!(this.Ta||this.ua&&!t)){t||(this.syncCookieProperties(),this.fa||this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase()||this.refreshKey(d));var i=!t&&!this.da;i||(this.ca=!1);var e=!!i&&this.Da();if(this.ca)this.mn.debug&&ss.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.oa)return this.Xa(),void(e&&this.pa.forEach((t=>t())));var r=this.eo(this.Zs,this.ya,this.props,wo);"written"===r&&this.Ba(this.props),"failed"!==r&&(this.ha.clear(),this.va=!1,this.fa=!1),e&&this.pa.forEach((t=>t()))}}}Xa(){var t=this,i=this.Ra(),e=i.main,r=i.groups,s=this.eo(this.Zs,this.ya,e,wo);"written"===s&&this.Ba(e),"failed"!==s&&(this.va=!1,this.fa=!1,xo.forEach((t=>{var i;null!=(i=Kn(t))&&i.storageGroup||this.ha.delete(t)})));var n=function(i){var e,s=r[i];if(Zt(s)&&(null==(e=t.sa[i])||!e.persisted))return xo.forEach((e=>{var r;(null==(r=Kn(e))?void 0:r.storageGroup)===i&&t.ha.delete(e)})),1;var n=t.eo(Cs,t.Sa(i),s,i);"failed"!==n&&xo.forEach((e=>{var r=Kn(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.ha.delete(e)}))};for(var o of Vn)n(o)}Ra(){var t={},i={flags:{},surveys:{}};return as(this.props,((e,r)=>{var s,n=null==(s=Kn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Aa(t,i){if(i===wo)return JSON.stringify(t)+"|"+this.io+"|"+this.ro+"|"+this.no;var e={};return as(t,((t,i)=>{var r;e[i]=null!=(r=Kn(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}eo(t,i,e,r){var s,n=this.Ma(r);if(r!==wo&&!n.dirty&&!ti(n.fingerprint))return"skipped";try{if((s=this.Aa(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ni(i,e,this.io,this.ro,this.no,this.mn.debug)?(n.dirty=!1,r!==wo&&(n.persisted=!0),ti(s)||(n.fingerprint=s),this.aa&&(n.storageValue=Cs.ai(i)),"written"):(this.mn.debug&&ss.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Na(),ti(this.Ga)||(clearTimeout(this.Ga),this.Ga=void 0),this.Zs.oi(this.ya,!1),this.Zs.oi(this.ya,!0),!e&&this.ga)for(var r of Vn)Cs.oi(this.Sa(r));e?delete this.sa[wo]:this.sa={},this.Ha=void 0,this.za=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(Xt(t)){this.syncCookieProperties(),ti(i)&&(i="None"),this.io=ti(e)?this.so:e;var r=!1;if(as(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Oa(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(Xt(t)){this.syncCookieProperties(),this.io=ti(i)?this.so:i;var e=!1;if(as(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||Xt(i)||Yt(i))&&(this.Oa(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.La(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==$t?void 0:$t.URL;if(t!==this.ma){var i=ao(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),e=!Zt(vs(i));return e&&this.register(i),this.ma=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==$t?void 0:$t.referrer)?ho(t):{})}update_referrer_info(){var t;this.register_once({$referrer:co(),$referring_domain:null!=$t&&$t.referrer&&(null==(t=Yn($t.referrer))?void 0:t.host)||vo},void 0)}set_initial_person_info(){this.props[rt]||this.props[st]||this.register_once({[nt]:fo(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};as([st,rt],(i=>{var e=this.props[i];e&&as(e,(function(i,e){t["$initial_"+Bt(e)]=i}))}));var i=this.props[nt];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=po(t,i),r={};return as(e,(function(t,i){r["$initial_"+Bt(i)]=t})),r}(i,this.mn.disable_capture_url_hashes);ls(t,e)}return t}safe_merge(t){return as(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,r){var s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.Ta&&!l;l||this.Ua(i,h),this.mn=t,!l&&(s||n||a)&&(this.Ha=void 0,this.za=void 0,this.Ua(e({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.ba(t):this.Zs,d=this._a(t),v=o||d!==this.oa,c=!l&&(v||t.cross_subdomain_cookie!==this.ro||t.secure_cookie!==this.no)&&this.Wa(h);this.da=v;try{if(this.so=this.io=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.Zs=u,this.oa=d,this.props=f,this.save()}else a&&(this.Zs=u,l||(delete this.sa[wo],this.Za()))}finally{this.da=!1,c&&this.Qa()}}set_disabled(t){this.Ta=t,this.Ta?this.remove():this.save()}set_cross_subdomain(t){t!==this.ro&&(this.ro=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.no&&(this.no=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[v]||{};e[t]=i,this.Oa(v,e),this.save()}remove_event_timer(t){var i=this.props[v]||{},e=i[t];return ti(e)||(delete i[t],this.Oa(v,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Oa(t,i),this.save()}Oa(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&(t!==o&&t!==tt||s===i||(this.va=!0),t!==d||Eo(s,i)||(this.fa=!0),this.qa(t,s,i),null!=(r=Kn(t))&&r.volatile||this.$a(t))}La(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(So(t)&&this.Ca(t,!0),t===d&&(this.fa=!0),this.$a(t))}$a(t){var i,e=null==(i=Kn(t))?void 0:i.storageGroup;e&&(this.Ma(e).dirty=!0)}Ma(t){return this.sa[t]||(this.sa[t]={})}}var Po={GZipJS:"gzip-js",Base64:"base64"},Ro={Activation:"events",Cancellation:"cancelEvents"},Co={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Oo={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Io={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Fo={Popover:"popover",Inline:"inline"};function Ao(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&Qt(e.then)&&e.then(void 0,(()=>{}))}}}}var Mo={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Do={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},No=ns("[RateLimiter]");class Lo{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{No.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void No.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(et))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(ni(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ao(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(et,a),{isRateLimited:l,remainingTokens:a.tokens}}oo(t){var i=this.instance.config.property_denylist;return!Yt(i)||!i.includes(t)}lo(){var t;if(this.oo("$current_url")&&this.oo("$pathname")&&null!=Pt&&Pt.pathname)return""+(null!==(t=Pt.origin)&&void 0!==t?t:"")+Pt.pathname}ao(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.lo(),o=this.oo("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var jo=ns("[RemoteConfig]");class Uo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}uo(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ho(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return jo.info("Using preloaded remote config",this.remoteConfig),void this.do(this.remoteConfig);if(this._instance.vo())return void jo.warn("Remote config is disabled. Falling back to local config.");this.uo((t=>{if(!t)return jo.info("No config found after loading remote JS config. Falling back to JSON."),void this.ho((t=>{this.do(t.json,t)}));this.do(t)}))}catch(t){jo.error("Error loading remote config",t),this.do()}}do(t,i){!t&&i&&(0===i.statusCode?i.error||jo.warn("Failed to fetch remote config from PostHog."):jo.error("Failed to fetch remote config from PostHog."));try{this._instance.do(t?{ok:!0,config:t}:{ok:!1})}catch(t){jo.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){jo.error("Error loading feature flags",t)}}}var Bo=Uint8Array,zo=Uint16Array,Ho=Uint32Array,qo=new Bo([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]),Vo=new Bo([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]),Wo=new Bo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Go=function(t,i){for(var e=new zo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Ho(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Ko=Go(qo,2),Jo=Ko[1];Ko[0][28]=258,Jo[258]=28;for(var Yo=Go(Vo,0)[1],Qo=new zo(32768),Xo=0;32768>Xo;++Xo){var Zo=(43690&Xo)>>>1|(21845&Xo)<<1;Qo[Xo]=((65280&(Zo=(61680&(Zo=(52428&Zo)>>>2|(13107&Zo)<<2))>>>4|(3855&Zo)<<4))>>>8|(255&Zo)<<8)>>>1}var ta=function(t,i,e){for(var r=t.length,s=0,n=new zo(i);r>s;++s)++n[t[s]-1];var o,a=new zo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new zo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Qo[d]>>>l]=h}else for(o=new zo(r),s=0;r>s;++s)o[s]=Qo[a[t[s]-1]++]>>>15-t[s];return o},ia=new Bo(288);for(Xo=0;144>Xo;++Xo)ia[Xo]=8;for(Xo=144;256>Xo;++Xo)ia[Xo]=9;for(Xo=256;280>Xo;++Xo)ia[Xo]=7;for(Xo=280;288>Xo;++Xo)ia[Xo]=8;var ea=new Bo(32);for(Xo=0;32>Xo;++Xo)ea[Xo]=5;var ra=ta(ia,9,0),sa=ta(ea,5,0),na=function(t){return(t/8>>0)+(7&t&&1)},oa=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof zo?zo:t instanceof Ho?Ho:Bo)(e-i);return r.set(t.subarray(i,e)),r},aa=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},la=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},ha=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Bo(0),0];if(1==s){var o=new Bo(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new zo(v+1),f=ua(e[u-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=g-(1<<f-c[m]),c[m]=i}for(p>>>=_;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Bo(c),f]},ua=function(t,i,e){return-1==t.s?Math.max(ua(t.l,i,e+1),ua(t.r,i,e+1)):i[t.s]=e},da=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new zo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},va=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ca=function(t,i,e){var r=e.length,s=na(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},fa=function(t,i,e,r,s,n,o,a,l,h,u){aa(i,u++,e),++s[256];for(var d=ha(s,15),v=d[0],c=d[1],f=ha(n,15),p=f[0],_=f[1],g=da(v),m=g[0],b=g[1],y=da(p),w=y[0],x=y[1],S=new zo(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=ha(S,7),T=k[0],P=k[1],R=19;R>4&&!T[Wo[R-1]];--R);var C,O,I,F,A=h+5<<3,M=va(s,ia)+va(n,ea)+o,D=va(s,v)+va(n,p)+o+14+3*R+va(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(M>=A&&D>=A)return ca(i,u,t.subarray(l,l+h));if(aa(i,u,1+(M>D)),u+=2,M>D){C=ta(v,c,0),O=v,I=ta(p,_,0),F=p;var N=ta(T,P,0);for(aa(i,u,b-257),aa(i,u+5,x-1),aa(i,u+10,R-4),u+=14,E=0;R>E;++E)aa(i,u+3*E,T[Wo[E]]);u+=3*R;for(var L=[m,w],j=0;2>j;++j){var U=L[j];for(E=0;U.length>E;++E)aa(i,u,N[B=31&U[E]]),u+=T[B],B>15&&(aa(i,u,U[E]>>>5&127),u+=U[E]>>>12)}}else C=ra,O=ia,I=sa,F=ea;for(E=0;a>E;++E)if(r[E]>255){var B;la(i,u,C[257+(B=r[E]>>>18&31)]),u+=O[B+257],B>7&&(aa(i,u,r[E]>>>23&31),u+=qo[B]);var z=31&r[E];la(i,u,I[z]),u+=F[z],z>3&&(la(i,u,r[E]>>>5&8191),u+=Vo[z])}else la(i,u,C[r[E]]),u+=O[r[E]];return la(i,u,C[256]),u+O[256]},pa=new Ho([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),_a=function(){for(var t=new Ho(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ga=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ma(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=_a[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Bo(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ca(l,h,t.subarray(u,d)):(l[u]=!0,h=ca(l,h,t.subarray(u,o)))}else{for(var v=pa[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,_=new zo(32768),g=new zo(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Ho(25e3),x=new zo(288),S=new zo(32),E=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=y(u),O=32767&u,I=g[C];if(_[O]=I,g[C]=O,u>=P){var F=o-u;if((E>7e3||T>24576)&&F>423){h=fa(t,l,0,w,x,S,k,T,R,u-R,h),T=E=k=0,R=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var M=2,D=0,N=f,L=O-I&32767;if(F>2&&C==y(u-L))for(var j=Math.min(c,F)-1,U=Math.min(32767,u),B=Math.min(258,F);U>=L&&--N&&O!=I;){if(t[u+M]==t[u+M-L]){for(var z=0;B>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(A=0;H>A;++A){var V=u-L+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,I=V)}}}L+=(O=I)-(I=_[O])+32768&32767}if(D){w[T++]=268435456|Jo[M]<<18|Yo[D];var G=31&Jo[M],K=31&Yo[D];k+=qo[G]+Vo[K],++x[257+G],++S[K],P=u+M,++E}else w[T++]=t[u],++x[t[u]]}}h=fa(t,l,!0,w,x,S,k,T,R,u-R,h)}return oa(a,0,r+na(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&ga(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),ga(h,u-8,e.d()),ga(h,u-4,r),h}var ba=!!Ct||!!Rt,ya="text/plain",wa=!1,xa=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Sa=function(t,i,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=e({},i),h=null!==(s=null==a?void 0:a.split("&").map((t=>{var i,e=t.split("="),s=e[0],n=r&&null!==(i=l[s])&&void 0!==i?i:e[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return as(t,(function(t,i){ti(t)||ti(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},Ea=t=>{if(t.co)return t.co;var i=t.data,e=t.compression;if(i){if(e===Po.GZipJS){var r=ma(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Bo(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Bo(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return oa(r,0,s)}(Jn(i)),{mtime:0});return{contentType:ya,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Po.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(Jn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Jn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Jn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ka=t=>{var i,r,s=()=>"sendBeacon"===t.transport?{url:Sa(t.url,{compression:Po.Base64}),encodedBody:Ea(e({},t,{compression:Po.Base64,co:void 0}))}:{url:xa(t.url,"compression"),encodedBody:Ea(e({},t,{compression:void 0,co:void 0}))};try{i=Ea(t)}catch(i){if(Ir(t.compression,Qn(t.url,"compression")))return ss.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&Ir(t.compression,Qn(t.url,"compression"))&&!((r=i.body)instanceof ArrayBuffer?Or(new Uint8Array(r)):ArrayBuffer.isView(r)&&Or(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(wa=!0,s()):{url:t.url,encodedBody:i}},Ta=t=>{try{return ka(t)}catch(i){return ss.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},$a=function(){var t=i((function*(t){var i=Jn(t.data),r=yield function(t,i,e){return Dr.apply(this,arguments)}(i,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return e({},t,{co:{contentType:ya,body:n,estimatedSize:n.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),Pa=/Failed to fetch|NetworkError|Load failed/i,Ra=t=>"TypeError"===(null==t?void 0:t.name)&&Pa.test((null==t?void 0:t.message)||""),Ca=t=>{var i=Ta(t);if(i){var r=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;as(t.headers,(function(t,i){h.append(i,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Ot){var v=new Ot;u={signal:v.signal,timeout:setTimeout((()=>{var i;d=!0,v.abort(He("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))}),t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Ra(i)?ss.warn(i):ss.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Rt(r,e({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.fo&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){ss.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},Oa=t=>{try{var i,r=ka(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(Tt.sendBeacon(s,h))return;var u=Yt(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(Yt(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>Yt(t.data)?i:e({},t.data,{batch:i});return Oa(e({},t,{data:v(u.slice(0,d))})),void Oa(e({},t,{data:v(u.slice(d))}))}ss.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ca(e({},t,{fo:!0}))}catch(t){ss.warn("Beacon send failed",t)}},Ia=(t,i,r,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return Sa(r===Po.GZipJS?xa(t,"compression"):t,e({},n?{[n]:Date.now().toString()}:{},r===Po.GZipJS?{}:{compression:r}))},Fa=[];Rt&&Fa.push({transport:"fetch",method:Ca}),Ct&&Fa.push({transport:"XHR",method(t){var i=Ta(t);if(i){var e=new Ct,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;as(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=Tt&&Tt.sendBeacon&&Fa.push({transport:"sendBeacon",method:Oa});var Aa=3e3;class Ma{constructor(t,i){this.po=!0,this.mo=[],this.yo=bi((null==i?void 0:i.flush_interval_ms)||Aa,250,5e3,ss.createLogger("flush interval"),Aa),this.bo=t}enqueue(t){this.mo.push(t),this._o||this.wo()}unload(){this.ko();var t=this.mo.length>0?this.So():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.xo(e({},t,{transport:"sendBeacon"}))}))}enable(){this.po=!1,this.wo()}wo(){var t=this;this.po||(this._o=setTimeout((()=>{if(this.ko(),this.mo.length>0){var i=this.So(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&Yt(e.data)&&as(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.xo(e)};for(var r in i)e()}}),this.yo))}xo(t){try{this.bo(t)}catch(t){ss.error(t)}}ko(){clearTimeout(this._o),this._o=void 0}So(){var t={};return as(this.mo,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;ti(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.mo=[],t}}var Da=["retriesPerformedSoFar"];class Na{constructor(t){this.Co=!1,this.To=3e3,this.mo=[],this._instance=t,this.mo=[],this.Mo=!0,!ti(Et)&&"onLine"in Et.navigator&&(this.Mo=Et.navigator.onLine,this.Io=()=>{this.Mo=!0,this.Eo()},this.Ro=()=>{this.Mo=!1},ps(Et,"online",this.Io),ps(Et,"offline",this.Ro))}get length(){return this.mo.length}retriableRequest(t){var i=t.retriesPerformedSoFar,s=r(t,Da);oi(i)&&(s.url=Sa(s.url,{retry_count:i})),this._instance._send_request(e({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.os(e({retriesPerformedSoFar:i},s));0===t.statusCode&&ss.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=i?i:0)+" retries.")}null==s.callback||s.callback(t)}}))}os(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.mo.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),ss.warn(s),this.Co||(this.Co=!0,this.Po())}Po(){if(this.Ao&&clearTimeout(this.Ao),0===this.mo.length)return this.Co=!1,void(this.Ao=void 0);this.Ao=setTimeout((()=>{this.Mo&&this.mo.length>0&&this.Eo(),this.Po()}),this.To)}Eo(){var t=Date.now(),i=[],e=this.mo.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.mo=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Ao&&(clearTimeout(this.Ao),this.Ao=void 0),this.Co=!1,ti(Et)||(this.Io&&(Et.removeEventListener("online",this.Io),this.Io=void 0),this.Ro&&(Et.removeEventListener("offline",this.Ro),this.Ro=void 0)),this.mo)){var i=t.requestOptions;try{this._instance._send_request(e({},i,{transport:"sendBeacon"}))}catch(t){ss.error(t)}}this.mo=[]}}class La{constructor(t){this.Fo=()=>{var t,i,e,r;this.Oo||(this.Oo={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Oo.lastScrollY=Math.ceil(n),this.Oo.maxScrollY=Math.max(n,null!==(t=this.Oo.maxScrollY)&&void 0!==t?t:0),this.Oo.maxScrollHeight=Math.max(o,null!==(i=this.Oo.maxScrollHeight)&&void 0!==i?i:0),this.Oo.lastContentY=a,this.Oo.maxContentY=Math.max(a,null!==(e=this.Oo.maxContentY)&&void 0!==e?e:0),this.Oo.maxContentHeight=Math.max(l,null!==(r=this.Oo.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Lo(){return this._instance.config.scroll_root_selector}getContext(){return this.Oo}resetContext(){var t=this.Oo;return setTimeout(this.Fo,0),t}startMeasuringScrollPosition(){ps(Et,"scroll",this.Fo,{capture:!0}),ps(Et,"scrollend",this.Fo,{capture:!0}),ps(Et,"resize",this.Fo)}scrollElement(){var t;if(!this.Lo)return null==Et||null==(t=Et.document)?void 0:t.documentElement;var i=Yt(this.Lo)?this.Lo:[this.Lo];for(var e of i){var r,s=null==Et||null==(r=Et.document)?void 0:r.querySelector(e);if(s)return s}}Do(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.Lo){var s=this.scrollElement();return s&&s[r]||0}return Et?"y"===t?Et.scrollY||Et.pageYOffset||(null==(i=Et.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:Et.scrollX||Et.pageXOffset||(null==(e=Et.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Do("y")}scrollX(){return this.Do("x")}}var ja=t=>fo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Ua{constructor(t,i,e,r){this.Tt=t=>{var i=this.$o();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.No(this._instance)};this.qo.register({[it]:e})}},this._instance=t,this.jo=i,this.qo=e,this.No=r||ja,this.jo.onSessionId(this.Tt)}$o(){return this.qo.props[it]}getSetOnceProps(){var t,i=null==(t=this.$o())?void 0:t.props;return i?"r"in i?po(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return as(vs(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+Bt(e)]=i})),t}}class Ba{on(t,i){return this.Bo[t]||(this.Bo[t]=[]),this.Bo[t].push(i),()=>{this.Bo[t]=this.Bo[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Bo[t]||[])e(i);for(var r of this.Bo["*"]||[])r(t,i)}constructor(){this.Bo={}}}var za=ns("[SessionId]"),Ha=864e5;class qa{on(t,i){return this.Ho.on(t,i)}constructor(t,i,e){var r;if(this.zo=null,this.Uo=null,this.Wo=[],this.Vo=void 0,this.Go=!1,this.Ho=new Ba,this.Zo=(t,i)=>!(!oi(t)||!oi(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ft)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.qo=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Qo=void 0,this._sessionActivityTimestamp=null,this.Jo=i||Ss,this.Ko=e||Ss;var s=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*bi(this.mn.session_idle_timeout_seconds||1800,60,36e3,za.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Yo(),this.Xo="ph_"+s+"_window_id",this.tl="ph_"+s+"_primary_window_exists",this.el()){var n=qs.ui(this.Xo),o=qs.ui(this.tl);n&&!o?this.It=n:qs.oi(this.Xo),qs.ni(this.tl,!0)}null!=(r=this.mn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.il()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ti(this.Wo)&&(this.Wo=[]),this.Wo.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.Wo=this.Wo.filter((i=>i!==t))}}el(){return"memory"!==this.mn.persistence&&!this.qo.Ta&&qs.ii()}rl(t){t!==this.It&&(this.It=t,this.el()&&qs.ni(this.Xo,t))}nl(){return this.It?this.It:this.el()?qs.ui(this.Xo):null}sl(t){var i=this.zo;return!ri(i)&&!ri(t)&&5e3>Math.abs(t-i)}al(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Pe||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Pe=t,s&&!r||s&&this.sl(i)||(this.zo=i,this.qo.register({[C]:[i,t,e]}))}ol(){var t,i=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return oi(i)&&i>0}ll(){this.ol()?this.qo.refreshKey(C):(this.qo.flush(),this.qo.load())}ul(){var t;if(!ri(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.zo){this.ll();var i=this.hl();i[1]===this.Pe&&i[2]===this._sessionStartTimestamp&&(this.zo=this._sessionActivityTimestamp,this.qo.register({[C]:[this._sessionActivityTimestamp,null!==(t=this.Pe)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.qo.flush())}}dl(){var t=this.hl()[0],i=oi(t)?t:0,e=oi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}vl(t){return this.ll(),this.Zo(t,this.dl())}hl(){var t=this.qo.props[C];return Yt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.zo=null,this.Qo=void 0,clearTimeout(this.cl),this.cl=void 0,this.al(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void za.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void za.error("Invalid sessionID in bootstrap",t)}}(t);return!ti(e)&&(i?this.Qo={sessionId:t,sessionStartTimestamp:e}:this.al(t,(new Date).getTime(),e),!0)}destroy(){this.Go=!0,this.ul(),clearTimeout(this.cl),this.cl=void 0,this.Vo&&Et&&(Et.removeEventListener(bt,this.Vo,{capture:!1}),this.Vo=void 0),this.Wo=[]}il(){this.Vo=()=>{this.ul(),this.el()&&qs.oi(this.tl)},ps(Et,bt,this.Vo,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.mn.cookieless_mode===ft)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Pe;if(e)this.Uo=r;else if(ri(this.Uo)||this.Uo>r||r-this.Uo>=1e3){var n,o;null==(n=(o=this.qo).syncCookieProperties)||n.call(o),this.Uo=r}var a=this.hl(),l=a[1],h=a[2],u=!ti(s)&&l!==s,d=this.dl(),v=this.nl(),c=this.Qo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ha),p=c?f:oi(h)&&Math.abs(r-h)>Ha,_=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.Zo(r,d);if(y){(y=this.vl(r))||za.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.hl();l=w[1],h=w[2]}if(m||y||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.Jo(),v=this.Ko(),za.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Qo=void 0,_=!0}else v||(v=this.Ko(),_=!0),(g=g||l!==b)&&(za.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var S=oi(d)&&t&&!p?d:r,E=oi(h)?h:(new Date).getTime();this.rl(v),this.al(l,S,E),t||this.Yo();var k={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.Wo.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k:void 0,lastActivityTimestamp:d}}Yo(){this.Go||(clearTimeout(this.cl),this.cl=setTimeout((()=>{if(!this.Go)if(this.vl((new Date).getTime())){var t=this.Pe;this.resetSessionId(),this.Ho.emit("forcedIdleReset",{idleSessionId:t})}else this.Yo()}),1.1*this.sessionTimeoutMs))}}var Va=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&Lt(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Lt(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Wa(){return(Wa=i((function*(){var t=null==Tt?void 0:Tt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return ii(e)&&e.length>0?e:void 0}catch(t){return void ss.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ga(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Ka=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},Ja=t=>t.toLowerCase(),Ya={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Ka(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Ka(i,t))))),icontains:(t,i)=>i.map(Ja).some((i=>t.map(Ja).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Ja).every((i=>t.map(Ja).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))};function Qa(t,i){return!t||Object.entries(t).every((t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Ya[e.operator];return!!s&&s(e.values,[String(r)])}))}function Xa(t,i,e){return Jn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Za="custom",tl="i.posthog.com",il=/^\/static\//,el=["/s/","/e/","/i/"];class rl{constructor(t){this.fl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+tl,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.fl[this.apiHost]||(this.fl[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":Za),this.fl[this.apiHost]}pl(t){if(il.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}gl(t){var i=Yn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}ml(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Yn(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&el.some((t=>0===i.indexOf(t)))){var a=this.gl(r);if(a){var l,h=this.apiHost,u=this.yl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.yl=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.yl,e=this.gl(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.ml(t,i,this.uiHost+i);if("flags"===t)return this.ml(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.pl(i);if(e)return this.ml(t,i,""+e+i)}if(this.region===Za)return this.ml(t,i,this.apiHost+i);var r=tl+i;switch(t){case"assets":return this.ml(t,i,"https://"+this.region+"-assets."+r);case"api":return this.ml(t,i,"https://"+this.region+"."+r)}}}var sl=ns("[Surveys]"),nl="seenSurvey_",ol=t=>{try{var i=(t=>((t,i)=>""+nl+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){sl.error("Failed to persist survey seen state",t)}},al=[Co.Popover,Co.Widget,Co.API],ll={ignoreConditions:!1,ignoreDelay:!1,displayType:Fo.Popover},hl=ns("[PostHog ExternalIntegrations]"),ul={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class dl{constructor(t){this._instance=t}Ys(t,i){var e;null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return hl.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=Dt.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.Ys(ul[n],(()=>{var i;null==(i=Dt.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=Dt.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Dt.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class vl{constructor(t,i){this.A=t,this.Ns=i,this.bl=new Map,this.Os=!1}add(t){var e=this;return i((function*(){if(e.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.bl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.bl.set(t.name,t);try{var i=t.setup(e.Ns);i&&(yield i)}catch(i){var r=e.bl.get(t.name)===t;r&&e.bl.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e._l(t)}}))()}getExtension(t){return this.bl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.bl.values()).reverse();for(var i of(this.bl.clear(),t))this._l(i)}}_l(t){try{var i=null==t.dispose?void 0:t.dispose();i&&Qt(i.then)&&i.then(void 0,(i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class cl{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);ti(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var fl="extensionsRemoteConfig";class pl{constructor(t){this.Os=!1,this.instance=t,this.A=ss,this.wl=t.kl,this.kv=new cl(t),this.onEvent=t=>Ao(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Os)return Ao((()=>{}));var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Sl.on(fl,i);return this.wl&&i(this.wl),Ao(e)},this.xl=new vl(ss.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(a))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(a);return"string"==typeof t?t:void 0}get library(){return{name:s.LIB_NAME,version:s.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.xl.add(t)}getExtension(t){return this.xl.getExtension(t)}capture(t,e,r){var s=this;return i((function*(){r?s.instance.capture(t,e,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Ao(this.instance.Cl(t))}handleRemoteConfig(t){this.Os||(this.wl=t,this.instance.Sl.emit(fl,t))}sendRequest(t,e){var r=this;return i((function*(){var i;void 0===e&&(e={});var s=r.instance.requestRouter.endpointFor(null!==(i=e.target)&&void 0!==i?i:"api",t),n={method:e.method,url:e.query?Sa(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?qt.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.Os||(this.Os=!0,this.xl.dispose())}}var _l={},gl=0,ml=()=>{},bl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',yl="Surveys module not available",wl="sanitize_properties is deprecated. Use before_send instead",xl="Invalid value for property_denylist config: ",Sl=/^[A-Za-z0-9_-]{1,400}$/,El=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,kl=["token","distinct_id",lt],Tl="posthog",$l=!ba&&-1===(null==Ft?void 0:Ft.indexOf("MSIE"))&&-1===(null==Ft?void 0:Ft.indexOf("Mozilla")),Pl=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},Rl=t=>{var i;return e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:fs(null==$t?void 0:$t.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ml,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Pt&&ii(null==Pt?void 0:Pt.search)&&-1!==Pt.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==Et||null==(i=Et.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){ss.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:gt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Aa},error_tracking:{},_onCapture:ml},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:pn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Pl(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||"unset"===t||"2026-08-29">t)}))(t))},Cl=[["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"]],Ol=t=>{var i={};for(var e of Cl){var r=e[0],s=e[1];ti(t[r])||(i[s]=t[r])}var n=ls({},i,t),o=t.__preview_external_dependency_versioned_paths;return ti(o)||(ti(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ii(o)&&ti(t.asset_host)&&(n.asset_host=o)),Yt(t.property_blacklist)&&(ti(t.property_denylist)?n.property_denylist=t.property_blacklist:Yt(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ss.error(xl+t.property_denylist)),n};class Il{constructor(){this.__forceAllowLocalhost=!1}get Tl(){return this.__forceAllowLocalhost}set Tl(t){ss.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Fl{Ml(t){if(t){var i=this.bl.indexOf(t);-1!==i&&this.bl.splice(i,1)}}Il(t,i){return this.Ml(t),this.bl.push(i),null==i.initialize||i.initialize(),i}El(){return this.config.cookieless_mode===ft||this.config.cookieless_mode===ct&&this.consent.isRejected()}Rl(){if(!this.Pl&&!this.config.segment&&!this.El()){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Al||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Pl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+e)))}}Fl(){if(!this.El()&&this.get_distinct_id()===at){var t=this.persistence;if(t){this.Ol()||t.load(!0);var i=this.get_distinct_id();if(!i||i===at){var e=this.config.get_device_id(Ss());this.register({distinct_id:e,$device_id:e}),t.set_property(tt,pt)}this.Ll()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Il,this.Dl=!1,this.version=s.LIB_VERSION,this.$l=new Set,this.Nl="",this.Sl=new Ba,this.bl=[],this.ql=[],this.Al=!1,this.Pl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Rl(),this.SentryIntegration=Hn,this.sentryIntegration=t=>function(t,i){var e=zn(t,i);return{name:Bn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.jl=!1,this.Bl=null,this.Hl=null,this.zl=null,this.scrollManager=new La(this),this.pageViewManager=new qn(this),this.rateLimiter=new Lo(this),this.requestRouter=new rl(this),this.consent=new Vs(this),this.externalIntegrations=new dl(this);var i=null!==(t=Fl.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=ii(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=ii(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>ss.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==Tl){var r,s=null!==(r=_l[e])&&void 0!==r?r:new Fl;return s._init(t,i,e),_l[e]=s,_l[Tl][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var n,o,a;void 0===i&&(i={});var h,u=ii(t)?t.trim():"";if(!u)return ss.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 u!==(null==(h=this.config)?void 0:h.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('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Rl(i.defaults),i.debug=this.Ul(i.debug),this.Wl=i,this.Vl=[],i.person_profiles?this.Hl=i.person_profiles:i.process_person&&(this.Hl=i.process_person);var d=Rl(i.defaults),v=Ol(i),c=ls({},d,v,{name:r,token:u});Xt(d.rageclick)&&Xt(v.rageclick)&&(c.rageclick=ls({},d.rageclick,v.rageclick)),Xt(d.session_recording)&&Xt(v.session_recording)&&(c.session_recording=ls({},d.session_recording,v.session_recording)),this.set_config(c),this.config.on_xhr_error&&ss.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Po.GZipJS;var f=this.Ol();if(this.persistence=new $o(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new $o(e({},this.config,{persistence:"sessionStorage"}),f,!1),this.Nl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&qs.ii()){var p=qs.ui(this.Nl);Yt(p)&&p.forEach((t=>{ii(t)&&this.$l.add(t)}))}else qs.oi(this.Nl);var _=e({},this.persistence.props),g=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Gl=new Ma((t=>this.Zl(t)),this.config.request_queue_config),this.Ql=new Na(this),this.__request_queue=[];var m=this.El();m||(this.sessionManager=new qa(this),this.sessionPropsManager=new Ua(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Jl()}))),this.Kl(),this.config.__preview_deferred_init_extensions?(ss.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Yl(m)}),0)):(ss.info("Initializing extensions synchronously"),this.Yl(m)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&ss.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:_,s:g}),!this.config.identity_distinct_id||null!=(n=i.bootstrap)&&n.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(o=i.bootstrap)?void 0:o.distinctID;if(this.Al=!!b&&!ei(b),void 0!==(null==(a=i.bootstrap)?void 0:a.distinctID)){var y=i.bootstrap.distinctID,w=this.get_distinct_id(),x=this.persistence.get_property(tt);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&x===pt)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&x===_t)ss.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 S=this.config.get_device_id(Ss()),E=i.bootstrap.isIdentifiedID?S:y;this.persistence.set_property(tt,i.bootstrap.isIdentifiedID?_t:pt),this.register({distinct_id:y,$device_id:E})}}if(m)this.register_once({distinct_id:at,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Ss());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(tt,pt)}return ps(Et,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Ss();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(tt,_t)),i()},s=e.user();"then"in s&&Qt(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Un.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Un.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Un.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,yt),identify:t=>i(t,xt),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Xl())):this.Xl(),Qt(this.config._onCapture)&&this.config._onCapture!==ml&&(ss.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&ss.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 Wa.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(ml),this}tu(t){var i=t;return ii(i.name)&&Qt(i.setup)}eu(t,i){this.tu(t)?i.push((()=>{this.iu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((i=>{ss.error('Failed to dispose browser extension "'+t.name+'"',i)}))})):this.bl.push(t)}Kl(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=Fl.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.ru)||r.call(this),this.ru=void 0,this.featureFlags=new o(this)),Qt(this.featureFlags.onReloading)&&Qt(this.featureFlags.setup)?this.ru||(this.ru=this.featureFlags.onReloading((()=>{this.Sl.emit("featureFlagsReloading",!0)})),this.iu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Yl(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},Fl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.bl.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.bl.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.bl.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.bl.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.bl.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.eu(this.autocapture=new u.autocapture(this),d),u.surveys&&this.eu(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.eu(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.bl.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.bl.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.bl.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.bl.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.bl.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.bl.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.bl.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ln)),u.toolbar&&this.bl.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.bl.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.bl.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.nu){var t=this.nu;this.nu=void 0,this.bl.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.su(d,h)}su(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.su(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){ss.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[ht]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ut]:r}),this.config.__preview_deferred_init_extensions&&ss.info("PostHog extensions initialized ("+r+"ms)")}do(t){var i;if(!$t||!$t.body)return ss.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.do(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.nu=t),this.kl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=jt(r.supportedCompression,Po.GZipJS)?Po.GZipJS:jt(r.supportedCompression,Po.Base64)?Po.Base64:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Hl?this.Hl:gt}),null==(i=this.au)||i.handleRemoteConfig(t),this.bl.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Xl(){try{this.config.loaded(this)}catch(t){ss.critical("`loaded` function failed",t)}if(this.ou(),this.config.internal_or_test_user_hostname&&null!=Pt&&Pt.hostname){var t=Pt.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.El())&&this.lu()}),1),this.uu=new Uo(this),this.uu.load()}ou(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Gl)||t.enable())}_dom_loaded(){this.is_capturing()&&os(this.__request_queue,(t=>this.Zl(t))),this.__request_queue=[],this.ou()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.hu()&&this.capture(wt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Gl)||r.unload(),null==(s=this.Ql)||s.unload()):this.hu()&&this.capture(wt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?$l?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=e({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(ti(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,r,s,n=e({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&ti(n.compression)&&n.data&&(n.compression=Po.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(Yt(o=n.data)?o:[o]).map((t=>e({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),Yt(t)?t.map((t=>e({},t,{sent_at:i}))):e({},t,{sent_at:i})}(n.data))),n.url=Ia(n.url,n.method,n.compression,n.timestampMode);var v=Fa.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Ra(t)?ss.warn(t):ss.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Po.GZipJS&&It&&"undefined"!=typeof Promise&&!wa?$a(n).then((t=>{f(t)})).catch((i=>{if(Fr(i))return wa=!0,void f(e({},n,{compression:void 0,url:Ia(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return Fr(t)||i===Cr})(i)&&(wa=!0),f(n)})):c(n)})(e({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Zl(t){this.Ql?this.Ql.retriableRequest(t):this._send_request(t)}_execute_array(t){gl++;try{var i,e=[],r=[],s=[];os(t,(t=>{if(t)if(Yt(i=t[0]))s.push(t);else if(Qt(t))try{t.call(this)}catch(i){ss.error("Error executing queued PostHog call",t,i)}else Yt(t)&&"alias"===i?e.push(t):Yt(t)&&-1!==i.indexOf("capture")&&Qt(this[i])?s.push(t):r.push(t)}));var n=function(t,i){os(t,(function(t){try{if(Yt(t[0])){var e=i;as(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){ss.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{gl--}}push(t){if(gl>0&&Yt(t)&&ii(t[0])){var i=Fl.prototype[t[0]];Qt(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}du(){var t,i=null==(t=this.persistence)?void 0:t.get_property(d);return ii(i)&&El.test(i)?{value:i,delivered:!1}:Xt(i)&&ii(i.value)&&El.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}vu(t,i,e,r){if(this.persistence){this.persistence.refreshKey(d);var s=this.du();if(!r){if(e)return ii(i)&&El.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[d]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(d);if(ii(t)&&Sl.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[d]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(d)}}cu(t){if(this.persistence){this.persistence.refreshKey(d);var i=this.du();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[d]:{value:t,delivered:!0}})}}capture(t,i,r){var s,n,o,a,l,h,d,v,c,f;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gl){if(this.is_capturing())if(!ti(t)&&ii(t)){this.Fl();var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var _=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==_||!_.isRateLimited){var g;null!=i&&i.$current_url&&!ii(null==i?void 0:i.$current_url)&&(ss.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=r&&r.fu||ss.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&&(g=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 m=new Date,b=(null==r?void 0:r.timestamp)||m,y=ze(null==r?void 0:r.uuid,Ss),w={uuid:y,event:t,properties:this.calculateEventProperties(t,i||{},b,y)};t===yt&&this.config.__preview_capture_bot_pageviews&&p&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),_&&(w.properties.$lib_rate_limit_remaining_tokens=_.remainingTokens);var x="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property(L);(null==r?void 0:r.$set)&&!x&&(w.$set=null==r?void 0:r.$set);var S=Xt(null==i?void 0:i.$set)?i.$set:void 0,E=!(null==r||!r.$set)&&u in r.$set,k=E||!!S&&u in S,T=E?null==r||null==(s=r.$set)?void 0:s[u]:null==S?void 0:S[u],P=Yt(null==i?void 0:i.$unset)?i.$unset:[],R=(null==r?void 0:r.$unset)||[],C=-1!==P.indexOf(u)||-1!==R.indexOf(u),O=this.vu(null==(n=g)?void 0:n.fbclid,T,k,C);O&&!0===w.properties.$process_person_profile&&O.pending&&!k&&!x&&(w.$set=e({[u]:O.value},w.$set));var I=null==r?void 0:r.$unset;I&&(w.$unset=I);var F,A,M,D=x?void 0:this.pu(null==r?void 0:r.$set_once,t!==St,t===xt);if(D&&(w.$set_once=D),null!=r&&r._noTruncate||(d=this.config.properties_string_max_length,v=w,c=t=>ii(t)?t.slice(0,d):t,f=new Set,w=function t(i,e){if(i!==Object(i))return c?c(i):i;if(!f.has(i)){var r;if(f.add(i),Yt(i))r=[],os(i,(i=>{r.push(t(i))}));else{var s={};as(i,((i,e)=>{f.has(i)||(s[e]=t(i,e))})),r=s}return r}}(v)),w.timestamp=b,ti(null==r?void 0:r.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),x&&(w.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Rr.forEach(r),i.forEach(r),e}(w.properties,kl)),t===Oo.DISMISSED||t===Oo.SENT){var N=null==i?void 0:i[Io.SURVEY_ID],j=null==i?void 0:i[Io.SURVEY_ITERATION];ol({id:N,current_iteration:j}),w.$set=e({},w.$set,{[(F={id:N,current_iteration:j},A=t===Oo.SENT?"responded":"dismissed",M="$survey_"+A+"/"+F.id,F.current_iteration&&F.current_iteration>0&&(M="$survey_"+A+"/"+F.id+"/"+F.current_iteration),M)]:!0})}else t===Oo.SHOWN&&(w.$set=e({},w.$set,{[Io.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Mo.SHOWN){var U=null==i?void 0:i[Do.TOUR_TYPE];U&&(w.$set=e({},w.$set,{[Do.TOUR_LAST_SEEN_DATE+"/"+U]:(new Date).toISOString()}))}var B=e({},w.properties.$set,w.$set);if(Zt(B)||this.setPersonPropertiesForFlags(B),!si(this.config.before_send)){var z=this.ns(w);if(!z)return;(w=z).uuid=ze(w.uuid,Ss)}var H=null!==(o=null==(a=w.$set)?void 0:a[u])&&void 0!==o?o:Xt(null==(l=w.properties)?void 0:l.$set)?w.properties.$set[u]:void 0,q=null!=O&&O.pending&&H===O.value?O.value:void 0;this.Sl.emit("eventCaptured",w);var V=null!==(h=null==r?void 0:r._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),W=e({method:"POST",url:V,data:w,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(V)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},null!=r&&r.transport?{transport:r.transport}:{},q?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.cu(q)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||q?this.Zl(W):this.Gl.enqueue(W),w}ss.critical("This capture call is ignored due to client rate limiting.")}}else ss.error("No event name provided to posthog.capture")}else ss.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}getExtension(t){var i;return null==(i=this.au)?void 0:i.getExtension(t)}iu(){var t;return null!==(t=this.au)&&void 0!==t?t:this.au=new pl(this)}Cl(t){this.ql.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.ql.indexOf(t);-1!==e&&this.ql.splice(e,1)}}}gu(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.zl=null,this.persistence.get_property(tt)===pt&&(null==(r=this.sessionPersistence)||r.clear(),this.$l.clear(),this.mu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gu();var a=o?void 0:this.persistence.remove_event_timer(t),l=e({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.El()&&(l[lt]=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!ii(l.distinct_id)&&!ni(l.distinct_id)||ei(l.distinct_id))&&ss.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i,e,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ft)return{};var h,u=t?[...ro,...i||[]]:[],d=Pe(Ft),v=d[0],c=d[1],f=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ti(e)||(p.detectGoogleSearchApp=e);var _={},g=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,b=null==Et||null==(a=Et.screen)?void 0:a.width,y=null==Et||null==(l=Et.screen)?void 0:l.height,w=null==Et?void 0:Et.devicePixelRatio;ti(g)||(_.userAgentDataPlatform=g),ti(m)||(_.maxTouchPoints=m),ti(b)||(_.screenWidth=b),ti(y)||(_.screenHeight=y),ti(w)||(_.devicePixelRatio=w);var x,S,E,k,T,P,R,C,O=ls(vs({$os:v,$os_version:c,$browser:Ee(Ft,navigator.vendor,f,p),$device:Re(Ft),$device_type:(S=Ft,E=_,C=Re(S),C===Ti||C===ki||"Kobo"===C||"Kindle Fire"===C||C===ee?Ei:C===Vi||C===Gi||C===Wi||C===Zi?"Console":C===Pi?"Wearable":C?wi:"Android"===(null==E?void 0:E.userAgentDataPlatform)&&(null!==(k=null==E?void 0:E.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==E?void 0:E.screenWidth)&&void 0!==T?T:0,null!==(P=null==E?void 0:E.screenHeight)&&void 0!==P?P:0)/(null!==(R=null==E?void 0:E.devicePixelRatio)&&void 0!==R?R:1)?wi:Ei:"Desktop"),$timezone:_o(),$timezone_offset:go()}),{$current_url:Xn(r?qe(null==Pt?void 0:Pt.href):null==Pt?void 0:Pt.href,u,no),$host:null==Pt?void 0:Pt.host,$pathname:null==Pt?void 0:Pt.pathname,$raw_user_agent:Ft.length>1e3?Ft.substring(0,997)+"...":Ft,$browser_version:Te(Ft,navigator.vendor,f,p),$browser_language:uo(),$browser_language_prefix:(x=uo(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==Et?void 0:Et.screen.height,$screen_width:null==Et?void 0:Et.screen.width,$viewport_height:null==Et?void 0:Et.innerHeight,$viewport_width:null==Et?void 0:Et.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=s.SDK_DIST_CHANNEL),O}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&ls(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ls(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Ql)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Za&&(l.$lib_custom_api_host=this.config.api_host),u=t!==yt||o?t!==wt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=ls(l,u),t===yt&&$t&&(l.title=$t.title),!ti(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ft&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();as(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]}));var m={};if(this.ql.length>0)for(var b of this.ql.slice())try{ls(m,b())}catch(t){ss.error("Failed to produce browser extension event properties",t)}(l=ls({},d,_,g,e({},m,l))).$is_identified=this._isIdentified(),Yt(this.config.property_denylist)?as(this.config.property_denylist,(function(t){delete l[t]})):ss.error(xl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(ss.error(wl),l=y(l,t));var w=this.yu();return l.$process_person_profile=w,w&&!o&&this.bu("_calculate_event_properties"),l}pu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.yu())return t;if(this.Dl&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=ls({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ss.error(wl),o=a(o,"$set_once")),i&&(this.Dl=!0),Zt(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.gu(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.$l.add(t))),this.mu()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.$l.delete(t),this.mu()}_u(t,i){this.register({[t]:i})}Jl(){this.$l.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.$l.clear(),this.mu()}mu(){var t;if(this.Nl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Ta||!qs.ii())qs.oi(this.Nl);else{var i=[];this.$l.forEach((t=>i.push(t))),i.length>0?qs.ni(this.Nl,i):qs.oi(this.Nl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Sl.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:yl}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:yl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:yl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=ll),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:yl}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:yl})}wu(t){return!t||ei(t)?(ss.critical("Unique user id has not been set in posthog.identify"),!1):t===at?(ss.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(ss.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return ss.uninitializedWarning("posthog.identify");if(ni(t)&&(t=t.toString(),ss.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wu(t)&&this.bu("posthog.identify")){this.Fl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gu(!1),o=this.persistence.Wa(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(h)&&(this.unregister(h),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(tt)||pt)===pt,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(tt,_t),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Va(),this.capture(xt,{distinct_id:t,$anon_distinct_id:u},{$set:i||{},$set_once:e||{}}),this.zl=Xa(t,i,e),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(tt,_t);var p=i||{},_=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Va(),this.capture("$set",{$set:p,$set_once:_}),this.zl=Xa(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Y)):f&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Qa(l)}}}setPersonProperties(t,i){if((t||i)&&this.bu("posthog.setPersonProperties")){var e=Xa(this.get_distinct_id(),t,i);this.zl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.zl=e):ss.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(Yt(t)?t:[t]).filter((t=>ii(t)&&t.length>0));0!==e.length&&this.bu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.zl=null)}group(t,i,r){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.gu();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:e({},n,{[t]:i})}),(o||r)&&this.yu()){var a={$group_type:t,$group_key:i};r&&(a.$group_set=r),this.capture(St,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else ss.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.bu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=ai(t)?t:null==t?void 0:t.resetDeviceID,e=ai(t)||null==t?void 0:t.bootstrap;this.ku(i,!1,e)}ku(t,i,r){var s,n,o;if(void 0===i&&(i=!1),ss.info("reset"),!this.__loaded)return ss.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Wl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.vo());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(S),c=this.is_capturing();this.consent.reset(),i||!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 f=null==(o=this.persistence)||null==o.Wa?void 0:o.Wa(),p=!1;try{var _,g,m,b,y,w,x,E,k,T,P,R,C;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.$l.clear(),this.mu(),ti(v)||null==(T=this.persistence)||T.register({[S]:v}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(x=this.metrics)||x.reset(),null==(E=this.persistence)||E.set_property(tt,pt),null==(k=this.sessionManager)||k.resetSessionId(),this.zl=null,this.config.cookieless_mode===ft)this.register_once({distinct_id:at,$device_id:null},"");else{var O=this.config.get_device_id(Ss());this.register_once({distinct_id:O,$device_id:t?O:u},""),t||ti(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.El()||(null==(C=this.persistence)||C.set_property(tt,r.isIdentifiedID?_t:pt),this.register({distinct_id:r.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(ti(h)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(h,!0))){var I=e({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,p=!0}finally{var F;f&&(null==(F=this.persistence)||null==F.Qa||F.Qa(p))}this.reloadFeatureFlags()}shutdown(t){var e=this;return i((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.iu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Gl)||s.unload(),null==(n=e.Ql)||n.unload();try{var l;null==(l=e.featureFlags)||l.destroy()}catch(t){ss.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else ss.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Su()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.xu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(n)?(ss.critical("Attempting to create alias for existing People user - aborting."),-2):this.bu("posthog.alias")?(ti(i)&&(i=this.get_distinct_id()),t!==i?(this._u(h,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(ss.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(Xt(t)){var r,n,o,a,l,h,u,d,v,c,f,p;ls(this.config,Ol(t));var _=this.Ol();null==(r=this.persistence)||r.update_config(this.config,i,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new $o(e({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.Ul(this.config.debug);ai(m)&&(this.config.debug=m),ai(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Cs.ii()&&Cs.ni("ph_debug",!0),ss.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(s.DEBUG=!1,Cs.ii()&&Cs.oi("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.vo()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.Ll(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){s.LIB_NAME=t,s.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(e({},s,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:Fl.Cu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Tl;return i!==Tl&&(i=Tl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(tt))===_t||(null==(i=this.sessionPersistence)?void 0:i.get_property(tt))===_t}yu(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===gt&&!this._isIdentified()&&Zt(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(i=this.persistence)||null==(i=i.props)||!i[ot]))}hu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yu()||this.bu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bu(t){return"never"===this.config.person_profiles?(ss.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Rl(),this._u(ot,!0),!0)}Ol(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ct)}Ll(){var t,i,e,r,s,n=this.Ol();return this.is_capturing()||null==(e=this.logs)||e.Tu(),(null==(t=this.persistence)?void 0:t.Ta)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i.Ta)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.$l.clear(),this.mu()),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==ft){if(this.El()){var e,r,s,n,o,a;null==(e=this.sessionRecording)||e.dispose({discardBufferedEvents:!0}),this.ku(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new qa(this),this.pageViewManager=new qn(this),this.persistence&&(this.sessionPropsManager=new Ua(this,this.sessionManager,this.persistence));var l,h=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Fl.__defaultExtensionClasses)?void 0:a.sessionRecording;h&&(this.sessionRecording=this.Il(this.sessionRecording,new h(this)),this.kl&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this.kl)))}var u,d;this.consent.optInOut(!0),this.Ll(),this.ou(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==ct&&(null==(u=this.surveys)||u.loadIfEnabled()),(ti(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.lu()}else ss.warn(bl)}opt_out_capturing(){if(this.config.cookieless_mode!==ft){var t,i,e=this.config.cookieless_mode===ct?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ct&&this.consent.isOptedIn()&&this.ku(!0,!0),this.consent.optInOut(!1),this.Ll(),this.config.cookieless_mode===ct&&(this.register({distinct_id:at,$device_id:null}),this.Ml(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.lu(),this.ou())}else ss.warn(bl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ft||(this.config.cookieless_mode===ct?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ll()}_is_bot(){return Tt?Va(Tt,this.config.custom_blocked_useragents):void 0}lu(){$t&&("visible"===$t.visibilityState?this.jl||(this.jl=!0,this.capture(yt,{title:$t.title},{send_instantly:!0}),this.Bl&&($t.removeEventListener(mt,this.Bl),this.Bl=null)):this.Bl||(this.Bl=this.lu.bind(this),ps($t,mt,this.Bl)))}debug(t){!1===t?(null==Et||Et.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Et||Et.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}))}vo(){var t=this.Wl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ss.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,e,r,s){var n=i in t&&!si(t[i]),o=e in t&&!si(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,ss)}ns(t){var i;if(si(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(ui),r=Yt(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),si(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return hi(t.event)?ss.warn(o+". This can cause unexpected behavior."):ss.info(o),null}s.properties&&!Zt(s.properties)||ss.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return ss.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&si(s.properties[a]))return ss.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.ea)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Ul(t){var i=ai(t)&&!t,e=Cs.ii()&&"true"===Cs.ai("ph_debug");return!i&&(!!e||t)}}Fl.__defaultExtensionClasses={},Fl.Cu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ds(t.prototype[i[e]])}(Fl,["identify"]);class Al{constructor(t){this.disabled=!1===t;var i=Xt(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Ml="$copy_autocapture",Dl=ns("[AutoCapture]");function Nl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Ll(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Xs(i));return i}function jl(t,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!Xs(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!Zs(c,"body")&&rn>d.length;)if(en(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Xs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,g=[],m={},b=!1,y=!1;if(as(d,(t=>{var i=xn(t);if(Zs(t,"a")){var e=t.getAttribute("href");b=!!(i&&e&&On(e))&&(u?qe(e):e)}jt(on(t),"ph-no-capture")&&(y=!0),g.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};un.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Nl(1024,In(t)):Nl(1024,ln(t)));var a=on(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),as(t.attributes,(function(e){var n;if((!Sn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&On(e.value)&&(!ii(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=sn(a).join(" ")),o["attr__"+e.name]=Nl(1024,"href"===e.name&&s?qe(a):a)}}));for(var l=1,h=1,u=t;u=Ll(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!xn(t))return{};var i={};return as(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&On(r)&&(i[e]=r)}})),i}(t);as(r,((t,i)=>{({}).hasOwnProperty.call(m,i)||(m[i]=t)}))})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=Zs(t,"a")||Zs(t,"button")?In(t):ln(t)),b){var w,x;g[0].attr__href=b;var S=null==(w=Yn(b))?void 0:w.host,E=null==Et||null==(x=Et.location)?void 0:x.host;S&&E&&S!==E&&(p=b)}return{props:ls({$event_type:n.type,$ce_version:1},h?{}:{$elements:g},{$elements_chain:(_=g,Yt(_)?function(t){return t.map((t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return hs(o).sort(((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r})).forEach((t=>{var i=t[1];return a[An(t[0].toString())]=An(i.toString())})),(s+=":")+hs(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Mn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return hs(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)):"")},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}class Ul{constructor(t){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=t,this.Ls.refresh(this.mn),this.rageclicks=new Al(this.mn.rageclick),this.Ds=null}setup(t){this.$s(),this.Ns=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?i.dispose():(this.qs=i,this.startIfEnabled())}dispose(){var t;this.Os||(this.Os=!0,this.Ns=void 0,null==(t=this.qs)||t.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var t,i;return this.Bs(),this.mn.url_allowlist=null==(t=this.mn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.mn.url_ignorelist=null==(i=this.mn.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.mn}Hs(){if(this.isBrowserSupported()){if(Et&&$t){var t=this.zs=t=>{t=t||(null==Et?void 0:Et.event);try{this.Us(t)}catch(t){Dl.error("Failed to capture event",t)}};if(ps($t,"submit",t,{capture:!0}),ps($t,"change",t,{capture:!0}),ps($t,"click",t,{capture:!0}),this.Bs().capture_copied_text){var i=this.Ws=t=>{t=t||(null==Et?void 0:Et.event);try{this.Us(t,Ml)}catch(t){Dl.error("Failed to capture clipboard event",t)}};ps($t,"copy",i,{capture:!0}),ps($t,"cut",i,{capture:!0}),ps($t,"paste",i,{capture:!0})}}}else Dl.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(null==$t||$t.removeEventListener("submit",this.zs,!0),null==$t||$t.removeEventListener("change",this.zs,!0),null==$t||$t.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(null==$t||$t.removeEventListener("copy",this.Ws,!0),null==$t||$t.removeEventListener("cut",this.Ws,!0),null==$t||$t.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(t){if(!this.Os)if(this.As=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Fs=i.elementsChainAsString);var e,r=i.autocapture_opt_out;ai(r)&&(null==(e=this.Ns)||e.kv.set(c,r),this.Ps=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var i,e=[];return null==(i=this.Ds)||i.forEach((i=>{var r=null==$t?void 0:$t.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Os)return!1;var e=null==(t=this.Ns)?void 0:t.kv.get(c),r=this.Ps,s=this.Bs(),n=s.remoteRequestsDisabled&&!this.As;if(ri(r)&&!ai(e)&&!n)return!1;var o=null!==(i=this.Ps)&&void 0!==i?i:!!e;return!!s.enabled&&!o}Us(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=hn(t);tn(r)&&(r=r.parentNode||null);var s,n=this.$s();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&bn(r,n.rageclick)&&this.Us(t,"$rageclick");var o=i===Ml,a=o?e({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,i,e,r,s,n){var o;if(!Et||yn(t))return!1;if(null!=e&&e.url_allowlist&&!nn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&nn(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var a=e.dom_event_allowlist;if(a&&!a.some((t=>i.type===t)))return!1}var l=wn(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(ti(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(u,e))return!1;if(!dn(u,null==e?void 0:e.css_selector_allowlist))return!1;if(dn(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:cn))return!1;try{var d=Et.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(un.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=jl(r,{e:t,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 d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),i===Ml){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==Et||null==(c=Et.getSelection())?void 0:c.toString(),_=an(p);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.Ns)||l.capture(i,u).catch((t=>Dl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return Qt(null==$t?void 0:$t.querySelectorAll)}}class Bl{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=Xt(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.vo(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var zl=ns("[ExceptionAutocapture]"),Hl=()=>{},ql=t=>{var i;if(Qt(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Vl(t,i,e){try{if(!(i in t))return Hl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return Qt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=ql(e);n;){if(n.next===s)return void(n.next=r.next);n=ql(e=n.next)}else t[i]=r.next}}catch(t){return Hl}}var Wl=ns("[TracingHeaders]"),Gl=ns("[Web Vitals]"),Kl=9e5,Jl=["CLS","FCP","INP","LCP"],Yl=["INP","LCP"],Ql=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Xl="disabled",Zl="lazy_loading",th="awaiting_config",ih="missing_config";ns("[SessionRecording]"),ns("[SessionRecording]");var eh="[SessionRecording]",rh=ns(eh),sh=ns("[Heatmaps]");function nh(t){return Xt(t)&&"clientX"in t&&"clientY"in t&&ni(t.clientX)&&ni(t.clientY)}var oh=ns("[Product Tours]"),ah=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(y))},lh=["$set_once","$set"],hh=ns("[SiteApps]"),uh="Error while initializing PostHog app with config id ",dh=(t,i)=>null!=t&&t.then?t.then(i):i(t),vh="SDK is not enabled or survey functionality is not yet loaded",ch="Disabled. Not loading surveys.";class fh{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mu=!1,this.Iu=[],this.Eu=null,this.Ru=null,this.Os=!1,this.Pu=new Set,this.onRemoteConfig=t=>{if(!this.Os&&!this.mn.disableSurveys){if(!t.ok)return sl.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(si(i))return sl.warn("Flags not loaded yet. Not loading surveys.");this.Au=ai(i)?i:i.length>0,sl.info("flags response received, isSurveysEnabled: "+this.Au),this.loadIfEnabled()}},this.Ls=t,this.Fu=i}setup(t){if(!this.Os)return this.Ou=t,dh(t.kv.initialize(),(()=>{if(this.Ou===t&&!this.Os){this.Ou=void 0,this.Ns=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Os?i.dispose():(this.qs=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Os||(this.Os=!0,this.Ou=void 0,this.Ns=void 0,null==(t=this.qs)||t.dispose(),this.qs=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Iu=[],this.Eu=null,this.Pu.forEach((t=>clearTimeout(t))),this.Pu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(nl)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Os&&this.Ns){var t=this.mn;if(!this._surveyManager)if(this.Mu)sl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)sl.info(ch);else if(t.cookielessMode&&this.Ls.isOptedOut())sl.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ls.getExtensions();if(i){if(!ti(this.Au)||t.advancedEnableSurveys){var e=this.Au||t.advancedEnableSurveys;this.Mu=!0;try{var r=i.generateSurveys;if(r)return this.Lu(r,e),void(this.Mu=!1);var s=i.loadExternalDependency;if(!s)return this.Du(vt),void(this.Mu=!1);s((t=>{try{if(this.Os)return;var i=this.Ls.getExtensions();t||null==i||!i.generateSurveys?this.Du("Could not load surveys script",t):this.Lu(i.generateSurveys,e)}finally{this.Mu=!1}}))}catch(t){throw this.Mu=!1,this.Du("Error initializing surveys",t),t}}}else sl.error("PostHog Extensions not found.")}}}Lu(t,i){this.Os||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ls.createEventReceiver(),sl.info("Surveys loaded successfully"),this.$u({isLoaded:!0}))}Du(t,i){sl.error(t,i),this.$u({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Iu.push(t),this._surveyManager&&this.$u({isLoaded:!0}),()=>{this.Iu=this.Iu.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Ns)&&void 0!==e?e:this.Fu;if(r&&!this.Os){if(this.mn.disableSurveys)return sl.info(ch),t([]);var s=r.kv.get(q);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Nu()&&this.getSurveys((()=>{}),!0));if(this.Eu)this.Eu.then((i=>{this.Os||t(i.surveys,i.context)})).catch((t=>sl.error("Error in survey callback",t)));else{var n=this.qu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then((t=>{try{return this.ju(r,t)}catch(t){return sl.error("Error processing surveys response",t),this.ju(r,{statusCode:0,error:t})}}),(t=>this.ju(r,{statusCode:0,error:t})));this.Eu=n;var o=()=>{this.Eu===n&&(this.Eu=null)};n.then((i=>{o(),this.Os||t(i.surveys,i.context)}),o).catch((t=>sl.error("Error in survey callback",t)))}}}qu(t,i){var e=this.Ns;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(vh)})))}ju(t,i){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:vh}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?sl.error(r):i.error||sl.warn(r),this.Ru=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Ru=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ga(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[q]:n,[V]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Nu(){return this.Bu()&&!this.Eu&&!this.Hu()}Bu(){var t,i,e=null==(t=null!==(i=this.Ns)&&void 0!==i?i:this.Fu)?void 0:t.kv.get(V);return ni(e)&&Date.now()-e>3e5}Hu(){return ni(this.Ru)&&3e5>Date.now()-this.Ru}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};ol(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}$u(t){for(var i of this.Iu)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){sl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!si(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);sl.warn("init was not called")}zu(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Uu(t){if(si(this._surveyManager))return{eligible:!1,reason:vh};var i="string"==typeof t?this.zu(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Wu(t){if(si(this._surveyManager))return{eligible:!1,reason:vh};var i="string"==typeof t?this.zu(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(si(this._surveyManager))return sl.warn("init was not called"),{visible:!1,disabledReason:vh};var i=this.Wu(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return si(this._surveyManager)?(sl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vh})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Wu(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(si(this._surveyManager))sl.warn("init was not called");else{var s="string"==typeof t?this.zu(t):t;if(null!=s&&s.id)if(al.includes(s.type)){var n=null==$t?void 0:$t.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){sl.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,i;this.Pu.delete(o),this.Os||(sl.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),sl.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Pu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else sl.warn("Survey element not found")}else sl.warn("Surveys of type "+s.type+" cannot be rendered in the app");else sl.warn("Survey not found")}}displaySurvey(t,i){var r;if(si(this._surveyManager))sl.warn("init was not called");else{var s=this.zu(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Fo.Popover&&i.initialResponses&&sl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.Uu(s);if(!o.eligible)return void sl.warn("Survey is not eligible to be displayed: ",o.reason)}i.displayType!==Fo.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else sl.warn("Survey not found")}}cancelPendingSurvey(t){si(this._surveyManager)?sl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function ph(t,i,e){if(si(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class _h{constructor(t){this.Vu=new Set,this.Gu=new Set,this.Zu=new Ba,this.Qu=(t,i)=>this.Ju(t,i)&&this.Ku(t,i)&&this.Yu(t,i)&&this.Xu(t,i),this.Ju=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;ti(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.th=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.th)||t.call(this),this.th=void 0,this.Zu=new Ba}register(t){var i,e;if(!ti(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Vu.add(t),null==(i=t.steps)||i.forEach((t=>{this.Gu.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Vu.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Vu.clear(),this.Gu.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Gu.has(t)||this.Gu.has(i.event))&&this.Vu.forEach((t=>{this.eh(i,t)&&this.Zu.emit("actionCaptured",t.name)}))}ih(t){this.onAction("actionCaptured",(i=>t(i)))}eh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Qu(t,e))return!0;return!1}onAction(t,i){return this.Zu.on(t,i)}Ku(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!ph(r,i.url,i.url_matching||"contains"))return!1}return!0}Yu(t,i){return!!this.rh(t,i)&&!!this.nh(t,i)&&!!this.sh(t,i)}rh(t,i){var e;if(null==i||!i.href)return!0;var r=this.ah(t);if(r.length>0)return r.some((t=>ph(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&ph((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}nh(t,i){var e;if(null==i||!i.text)return!0;var r=this.ah(t);if(r.length>0)return r.some((t=>ph(t.text,i.text,i.text_matching||"exact")||ph(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!si(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>ph(t,n,o))))}sh(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}ah(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Xu(t,i){return null==i||!i.properties||0===i.properties.length||Qa(i.properties.reduce(((t,i)=>{var e=Yt(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class gh{constructor(t){var i;this.oh=[],this._instance=t,this.lh=new Map,this.uh=new Map,this.hh=new Map,this.dh=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.fh(t)))}ph(t){return!1}gh(){return null}mh(t){}yh(){}bh(t,i){return!!t&&Qa(t.propertyFilters,null==i?void 0:i.properties)}_h(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}wh(t,i,e){var r=(e===Ro.Activation?this.lh:this.uh).get(t),s=[];return this.kh((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.bh(n,i)}))}register(t){this.Sh(t,!1)}replace(t){this.Sh(t,!0)}Sh(t,i){var e;ti(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.xh(t,i),this.Ch(t,i))}Ch(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.hh.clear(),0!==e.length){this.Th||(this.Th=new _h(this._instance),this.Th.init(),this.Th.ih((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.hh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.hh.set(i.name,s)}}))})),i?this.Th.replace(r):this.Th.register(r)}else{var s;i&&(null==(s=this.Th)||s.replace([]))}}Mh(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}xh(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this._h(t,Ro.Activation),a=this._h(t,Ro.Cancellation);i?(this.lh=o,this.uh=a):(this.Mh(this.lh,o),this.Mh(this.uh,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.th)&&void 0!==e||(this.th=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Ih(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Eh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Rh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Ph(n),void this.Ah([n])}if(this.uh.has(t)){var a=this.wh(t,i,Ro.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Rh(a.map((t=>t.id))),a.forEach((t=>this.Fh(t.id))))}if(this.lh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.lh.get(t)});var l=this.wh(t,i,Ro.Activation);this.Oh(l.map((t=>t.id)))}}onAction(t){this.hh.has(t)&&this.Oh(this.hh.get(t)||[])}Oh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.ph(s)?this.Ph(s)&&this.Lh(s):r.push(s);r.length>0&&(this.oh=[...new Set([...this.oh,...r])]),this.Ih().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Ph(t){this.oh=this.oh.filter((i=>i!==t));var i=this.Dh();return!i.includes(t)&&(this.$h([...i,t]),this.Nh(),!0)}Rh(t){var i=new Set(t);this.oh=this.oh.filter((t=>!i.has(t)));var e=this.qh(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.$h(r),0===r.length&&this.jh()),this.Ah(t)}Bh(){var t,i=this.gh();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Lh(t){if(this.gh()){var i=this.Bh();this.mh(e({},i,{[t]:Date.now()}))}}Ah(t){if(this.gh()){var i=this.Bh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(Zt(e)?this.yh():this.mh(e))}}Hh(){this.gh()&&this.yh()}getActivationTimestamp(t){if(this.Dh().includes(t)){var i=this.Bh()[t];return ni(i)?i:void 0}}qh(){var t,i=this.zh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Dh(){var t,i,e=this.qh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Uh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Nh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.Wh(i)}jh(){this.Vh()}fh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Uh()];if(e&&e!==t){var r=this.qh(),s=this.Bh();r.length>0&&(this.$h([]),r.filter((t=>ni(s[t]))).forEach((t=>this.Fh(t)))),this.jh(),this.Hh()}}getActivatedIds(){return[...new Set([...this.Dh(),...this.oh])].filter((t=>!this.Gh(t)))}dispose(){var t,i,e;null==(t=this.dh)||t.call(this),this.dh=void 0,null==(i=this.th)||i.call(this),this.th=void 0,null==(e=this.Th)||e.dispose(),this.Th=void 0}reset(){this.oh=[],this.qh().length>0&&this.$h([]),this.jh(),this.Hh()}getEventToItemsMap(){return this.lh}Zh(){return this.Th}}class mh extends gh{constructor(t){super(t)}zh(){return W}Uh(){return G}gh(){return K}mh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[K]:t})}yh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(K)}ph(t){var i,e;this.kh((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return ni(r)&&r>0}Qh(){return Oo.SHOWN}kh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Fh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Ih(){return sl}$h(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[W]:t})}Wh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[G]:t})}Vh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(G)}Gh(){return!1}Eh(t,i){var e;this.kh((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Ga(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===Oo.SHOWN?"consume":"ignore":t===Oo.SHOWN?"persist":t===Oo.DISMISSED||t===Oo.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class bh{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);ti(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class yh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==Dt?void 0:Dt.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new mh(this._instance)}}var wh=null!=Et&&Et.location?Zn(Et.location.hash,"__posthog")||Zn(location.hash,"state"):null,xh="_postHogToolbarParams",Sh=ns("[Toolbar]"),Eh=ns("[FeatureFlags]");class kh{constructor(t,i){void 0===i&&(i=!1),this.Jh=!1,this.update(t,i)}update(t,i){this.Kh=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:Yt(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Jh||(Eh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jh=!0),ti(t.flag_keys)||Yt(t.flag_keys)||Eh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Kh}}var Th=ns("[FeatureFlags]"),$h=ns("[FeatureFlags]",{debugEnabled:!0}),Ph="\" failed. Feature flags didn't load in time.",Rh="connection_error",Ch=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Oh=t=>{var i={};for(var e of hs(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Ih=ns("[Error tracking]"),Fh="webkit-masked-url:",Ah=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Fh],Mh=["__firefox__","__gCrWeb"],Dh="Refusing to render web experiment since the viewer is a likely bot",Nh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Ka(i,t),not_regex:(t,i)=>!Ka(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Lh{get mn(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Lh.Yh("retrieved web experiments from the server"),i.Xh=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Xh&&(Lh.Yh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Xh)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);ii(r)&&t.variants[r]&&i.td(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Lh.ed(n,i._instance)&&i.td(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Lh.Yh(Dh);else if(!this.mn.disable_web_experiments){if(si(this.Xh))return this.Xh=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Lh.Yh("applying feature flags",t),t.forEach((t=>{var i;if(this.Xh&&null!=(i=this.Xh)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Xh)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.td(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Lh.getWindowLocation();if(null!=t&&t.search){var i=Qn(null==t?void 0:t.search,"__experiment_id"),e=Qn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Lh.Yh("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.rd(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.mn.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.mn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}rd(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Lh.Yh("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.td(r[0].name,i,r[0].variants[i].transforms))}static ed(t,i){return!si(t.conditions)&&Lh.nd(t,i)&&Lh.sd(t)}static nd(t,i){var e;if(si(t.conditions)||si(null==(e=t.conditions)?void 0:e.url))return!0;var r=Lh.getWindowLocation();if(r){var s,n,o,a=Ws(i,r.href);return null==(s=t.conditions)||!s.url||Nh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==Et?void 0:Et.location}static sd(t){var i;if(si(t.conditions)||si(null==(i=t.conditions)?void 0:i.utm))return!0;var e=ao();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Yh(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];ss.info("[WebExperiments] "+t,e)}td(t,i,e){this._is_bot()?Lh.Yh(Dh):"control"!==i?e.forEach((e=>{if(e.selector){var r;Lh.Yh("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Lh.Yh("Control variants leave the page unmodified.")}_is_bot(){return Tt&&this._instance?Va(Tt,this.mn.custom_blocked_useragents):void 0}}var jh=ns("[Conversations]"),Uh="Conversations not available yet.";function Bh(t,i){var r,s,n,o,a,l,h,u=null!==(r=null==t?void 0:t.flushIntervalMs)&&void 0!==r?r:3e3,d=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=ti(v)?Math.max(d,2048):Math.max(d,v),f=e({},function(){var t="",i="";try{var r=null==Tt?void 0:Tt.userAgent;if(r){var s=Pe(r);t=s[0],i=s[1]}}catch(t){}return function(t,i){var r=function(t){if(t)return{}.hasOwnProperty.call(Vr,t)?Vr[t]:t}(t);return e({},r?{"os.name":r}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(h=null==f?void 0:f["deployment.environment"])&&void 0!==h?h:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var zh=["debug","log","warn","error","info"],Hh="console",qh="__posthogHandledLogsRequestError",Vh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[qh]=!0,e},Wh=t=>!!t&&"object"==typeof t&&!0===t[qh],Gh={featureFlags:class{constructor(t){this.name="featureFlags",this.ad=!1,this.featureFlagEventHandlers=[],this.A=Th,this.od={},this.ld={},this.ud=[],this.hd=!1,this.dd=!1,this.vd=0,this.fd=!1,this.pd=!1,this.gd=!1,this.md=!1,this.yd=0,this.Wt=()=>{var t=this.bd();this.yd=0,t&&this.reloadFeatureFlags()},this._d=()=>{var t,i=this.wd;ti(i)||this.mn.remoteRequestsDisabled||!$t||"hidden"===$t.visibilityState||Date.now()-(null!==(t=this.kd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Sd())},this.Vt=()=>{"visible"===(null==$t?void 0:$t.visibilityState)&&this._d()},"get"in t?this.Ls=t:(this._instance=t,this.xd=new kh(t.config,t.vo()),this.Ls=this.xd)}updateConfig(t,i){var e;null==(e=this.xd)||e.update(t,i),this.Ns&&this.Cd()}setup(t){return this.Ou=t,this.A=t.logger.createLogger("[FeatureFlags]"),dh(t.kv.initialize(),(()=>{this.Ou===t&&(this.Ou=void 0,this.Ns=t,this.Td(t))}))}Td(t){var i;if(this.Ns===t)return Et&&ps(Et,"online",this.Wt),this.Cd(),this.Md=t.registerDynamicEventProperties((()=>this.Id()?this.od:this.ld)),this.Ed=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange((()=>{this.Rd(),this.Pd()})),this.Rd(),this.initialize()}Cd(){var t=this.mn.refreshIntervalMs,i=!this.mn.remoteRequestsDisabled&&$t&&!ti(t)&&t>0?t:void 0;i!==this.wd&&(this.Ad(),ti(i)||(this.wd=i,this.Sd(),null!=$t&&$t.addEventListener&&ps($t,mt,this.Vt)))}Sd(){ti(this.wd)||(ti(this.Fd)||clearInterval(this.Fd),this.kd=Date.now(),this.Fd=setInterval(this._d,this.wd))}Ad(){ti(this.Fd)||(clearInterval(this.Fd),this.Fd=void 0,null==$t||null==$t.removeEventListener||$t.removeEventListener(mt,this.Vt)),this.wd=void 0,this.kd=void 0}destroy(){this.Od()}dispose(){this.Od()}Od(){var t,i;this.Ad(),this.vd++,this.pd=!1,this.Ou=void 0,this.Ns&&(this.Ld(),null==(t=this.Md)||t.dispose(),this.Md=void 0,null==(i=this.Ed)||i.call(this),this.Ed=void 0,this.ud=[],null==Et||Et.removeEventListener("online",this.Wt),this.Ns=void 0)}get mn(){return this.Ls.get()}Dd(t){var i;return null==(i=this.Ns)?void 0:i.kv.get(t)}ni(t){this.$d((()=>{var i;return null==(i=this.Ns)?void 0:i.kv.set(t)}))}Nd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t[I]){var s=this.Dd(I)||{},n=t[I]||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter((t=>{var i=t[1];return!(null!=i&&i.failed)})).map((t=>t[0])):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!Yt(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Dd(D)||{},d=t[D]||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p={[F]:f,[I]:f,[D]:!!c||v};for(var _ of(t[M]&&(p[M]=f),[N,Z,L]))ti(t[_])||(p[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(p)}}oi(t){this.$d((()=>{var i;return null==(i=this.Ns)?void 0:i.kv.remove(t)}))}$d(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Rd(){var t={};for(var i of[F,D,N,j]){var r=this.Dd(i);ti(r)||(t[i]=r)}this.od=t;var s=e({},t),n=this.Dd(I);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.ld=s}Id(){var t=this.mn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Dd(Z);return"number"!=typeof i||Date.now()-i>t}qd(){return!!this.Id()&&(this.md||this.dd||(this.md=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){var t=this.mn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Bd(){var t=this.mn.flagKeys;if(!ti(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.mn,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.Hd({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Dd(I))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Dd(D))&&void 0!==n?n:{},l=e({},o,t),h=e({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Tr(c),variant:$r(c),reason:void 0,metadata:ti(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Hd({flags:u})}get hasLoadedFlags(){return this.hd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Dd(M),i=this.Dd(j),r=this.Dd(U);if(!r&&!i)return t||{};var s=ls({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var o of n){var a,l,h=s[o],u=null==i?void 0:i[o],d=ti(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ti(u)?null==h?void 0:h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=e({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=e({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.ad||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ad=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:Tr(r),variant:$r(r),payload:kr(i[e])}}))}getFlagVariants(){var t=this.Dd(I),i=this.Dd(j);if(!i)return t||{};for(var e=ls({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ad||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ad=!0),e}getFlagPayloads(){var t=this.Dd(D),i=this.Dd(U);if(!i)return t||{};for(var e=ls({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ad||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ad=!0),e}reloadFeatureFlags(){this.fd||this.mn.featureFlagsDisabled||this.bd()||this.zd||(this.ud.slice().forEach((t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.zd=setTimeout((()=>{this.Ud()}),5))}Ld(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ud.push(t),()=>{this.ud=this.ud.filter((i=>i!==t))}}ensureFlagsLoaded(){this.hd||this.dd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.fd=t}resetFlagCallReported(){this.oi(Y)}Ud(t){this.Ld();var i=this.Ns;if(i&&!this.mn.remoteRequestsDisabled&&!this.bd())if(this.dd)this.pd=!0;else{var r={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},i.initialPersonProperties,this.Dd(B)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Dd(z),timezone:_o()};ti(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.mn.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.jd();s.length&&(r.evaluation_contexts=s);var n=this.Bd();ti(n)||(r.flag_keys=n);var o=this.mn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.vd;this.dd=!0;var h=()=>{this.pd&&(this.pd=!1,this.Ud())},u=t=>{this.dd=!1,l===this.vd?(this.ni({[X]:[Rh]}),this.A.error("Feature flag request failed",t),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then((t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.dd=!1,l===this.vd){if(this.Wd(t.statusCode),n||this.pd||(this.$anon_distinct_id=void 0),!r.disable_flags||this.pd){this.gd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Rh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(e=s.quotaLimited)||!e.includes("feature_flags"));u&&a.push("quota_limited"),this.ni({[X]:a}),u?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."):r.disable_flags||this.Hd(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}bd(){return to(this.yd,3)}Wd(t){this.yd=io(t,this.yd,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(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.gd)if(this.hd||this.getFlags()&&this.getFlags().length>0){if(!this.qd()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+Ph)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.gd)if(this.hd||this.getFlags()&&this.getFlags().length>0){if(!this.qd()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Dd(N)||void 0,u=this.Dd(Z)||void 0,d=this.Dd(Y)||{};if(this.mn.deduplicateCallsPerSession){var v,c=null==(v=this.Ns)?void 0:v.session.sessionId,f=this.Dd(Q);c&&c!==f&&(d={},r=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))r&&this.ni({[Y]:d,[Q]:r});else{var p,_,g,m,b,y,w,x,S,E,k,T;Yt(d[t])?d[t].push(l):d[t]=[l],this.ni(e({[Y]:d},r?{[Q]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.Dd(X))&&void 0!==p?p:[]];ti(o)&&R.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.mn.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this.mn.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.gd};ti(null==P||null==(y=P.metadata)?void 0:y.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ti(null==P||null==(w=P.metadata)?void 0:w.version)||(C.$feature_flag_version=P.metadata.version);var O,I=null!==(x=null==P||null==(S=P.reason)?void 0:S.description)&&void 0!==x?x:null==P||null==(E=P.reason)?void 0:E.code;I&&(C.$feature_flag_reason=I),null!=P&&null!=(k=P.metadata)&&k.id&&(C.$feature_flag_id=P.metadata.id),ti(null==P?void 0:P.original_variant)&&ti(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ti(P.original_variant)?P.original_enabled:P.original_variant),null!=P&&null!=(T=P.metadata)&&T.original_payload&&(C.$feature_flag_original_payload=null==P||null==(O=P.metadata)?void 0:O.original_payload),R.length&&(C.$feature_flag_error=R.join(",")),this.Vd(C)}else r&&this.ni({[Y]:d,[Q]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:kr(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Ph)}Vd(t){try{var i;null==(i=this.Ns)||i.capture("$feature_flag_called",t).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(t,i){this.Gd(t,i)}Gd(t,e){var r=this;return i((function*(){var i=r.Ns;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.jd();n.length&&(s.evaluation_contexts=n);var o,a=r.Bd();ti(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.mn.compression,sentAt:"body",timeoutMs:r.mn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.A.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){r.A.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.gd)return i.defaultValue;if(!(this.hd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Ph),i.defaultValue;var e=this.getFeatureFlag(t,i);return ti(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.Hd(t,i,e)}Hd(t,i,r){if(this.Ns){this.hd=!0;var s=function(t,i,r,s,n,o){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=Th);var a=((t,i)=>{var r=t.flags;return r?e({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var i;return[t,null!==(i=r[t].variant)&&void 0!==i?i:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var i;return!ti(null==(i=r[t].metadata)?void 0:i.payload)})).map((t=>{var i;return[t,null==(i=r[t].metadata)?void 0:i.payload]})))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(Yt(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[F]:h,[I]:c,[L]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=_||{};p=e({},i,p),_=e({},r,b),m.forEach((t=>{var i;t in b||null==(i=_)||delete i[t]})),g=e({},s,g)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter((t=>{var i;return!(null!=(i=l[t])&&i.failed)})));p=e({},i,Object.fromEntries(Object.entries(p).filter((t=>y.has(t[0])))));var w=Object.fromEntries(Object.entries(_||{}).filter((t=>y.has(t[0]))));_=e({},r,w),y.forEach((t=>{var i;t in w||null==(i=_)||delete i[t]})),g=e({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>y.has(t[0])))))}else p=e({},i,p),_=e({},r,_),g=e({},s,g);return e({[F]:Object.keys(Oh(p)),[I]:p||{},[D]:_||{},[M]:g||{},[L]:!0===t.minimalFlagCalledEvents},d?{[N]:d}:{},v?{[Z]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.A);s&&(this.Nd(s,t,!(null==r||!r.partialResponse)),this.ni(s)),i||(this.md=!1),this.Pd(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.Ns){if(!1===t)return this.oi([j,U]),this.Pd(),void $h.info("All overrides cleared");if(Yt(t))return this.ni({[j]:Ch(t)}),this.Pd(),void $h.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ad=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[j]=Yt(s)?Ch(s):s),n&&(r[U]=n),Object.keys(r).length&&this.ni(r),!1===s&&!1===n?this.oi([j,U]):!1===s?this.oi(j):!1===n&&this.oi(U),this.Pd(),!1===s?$h.info("Flag overrides cleared"):s&&$h.info("Flag overrides set",{flags:s}),void(!1===n?$h.info("Payload overrides cleared"):n&&$h.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ni({[j]:t}),this.Pd(),void $h.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.hd){var i=this.Qd(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.Dd(A)||[]).find((i=>i.flagKey===t)),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[F]:[t],[I]:[t],[B]:Object.keys(o)}),this.ni({[F]:Object.keys(Oh(l)),[I]:l,[B]:e({},this.Dd(B)||{},o)}),this.Pd();try{var h;null==(h=this.Ns)||h.capture("$feature_enrollment_update",a).catch((t=>{this.A.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Dd(A);!r||i?this.Jd(t,e):t(r)}Jd(t,e){var r=this;return i((function*(){var i=r.Ns;if(i){var s,n=e?"&"+e.map((t=>"stage="+t)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.ni({[A]:s=o.json.earlyAccessFeatures})}catch(t){return void r.A.error("Early access feature request failed",t)}try{t(s)}catch(t){r.A.error("Early access feature callback failed",t)}}}))()}Qd(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Pd(t){this.Rd();var i=this.Qd(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Kd(t,i)}Kd(t,i){void 0===i&&(i=!0);var r=this.Dd(B)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this.ni({[B]:e({},r,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.Dd(B)||{});t.forEach((t=>{delete r[t]})),this.ni({[B]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.oi(B),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Dd(z)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.ni({[z]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Dd(z)||{};this.ni({[z]:e({},i,{[t]:{}})})}else this.oi(z)}reset(){this.vd++,this.pd=!1,this.od={},this.ld={},this.hd=!1,this.fd=!1,this.gd=!1,this.$anon_distinct_id=void 0,this.Ld(),this.ad=!1,this.yd=0}}},Kh={sessionRecording:class{get mn(){return this._instance.config}get qo(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Yd)||!t.isStarted)}get status(){var t,i;return this.Xd===th||this.Xd===ih?this.Xd:null!==(t=null==(i=this.Yd)?void 0:i.status)&&void 0!==t?t:this.Xd}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Xd=Xl,this.tv=void 0,this.ev=!1,this.jt=(()=>{var t;if(null==$t||!$t.visibilityState||"visible"===$t.visibilityState)return!0;var i=null==Et||null==(t=Et.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.Vt=()=>{var t;"visible"===(null==$t?void 0:$t.visibilityState)&&(this.jt=!0,null==(t=this.Yd)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw rh.error("started without valid sessionManager"),new Error(eh+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===ft)throw new Error(eh+' cannot be used with cookieless_mode="always"');null!=$t&&$t.addEventListener&&ps($t,"visibilitychange",this.Vt)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.ev=!0,null==$t||null==$t.removeEventListener||$t.removeEventListener("visibilitychange",this.Vt),e?this.iv(!0):this.stopRecording()}get rv(){var t,i=!(null==(t=this._instance.get_property(S))||!t.enabled),e=!this.mn.disable_session_recording,r=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return Et&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.ev||this.rv&&null!=(i=this.Yd)&&i.isStarted)){var e=!ti(Object.assign)&&!ti(Array.from);this.rv&&e?(this.nv(t),rh.info("starting")):(this.Xd=Xl,this.stopRecording())}}nv(t){var i,e;if(this.rv)if(this.Xd!==th&&this.Xd!==ih&&(this.Xd=Zl),null!=Dt&&null!=(i=Dt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=Dt.__PosthogExtensions__)&&e.initSessionRecording)this.sv(t);else{var r,s=this._instance.sessionManager;null==(r=Dt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.av,(i=>{if(!this.ev&&this.rv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[dt]:!0}),rh.error("could not load recorder",i)):void this.sv(t);this.Xd=Xl}))}}stopRecording(){var t,i;null==(t=this.tv)||t.call(this),this.tv=void 0,null==(i=this.Yd)||i.stop()}iv(t){var i,e;void 0===t&&(t=!1),null==(i=this.tv)||i.call(this),this.tv=void 0,null==(e=this.Yd)||e.discard({discardProducerEvents:t})}ov(){var t,i;null==(t=this.qo)||t.unregister(O),null==(i=this.qo)||i.unregister(E)}lv(t,i){if(si(t))return null;var e,r=ni(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(rh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}uv(t){if(this.qo){var i,r,s=this.qo,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.lv(null==(i=this.mn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.lv(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;si(a)&&this.ov();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[S]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ti(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(i=this.tv)||i.call(this),this.tv=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.uv(i),void this.iv()):(this.uv(i),void this.startIfEnabledOrStop()):(this.Xd===th&&(this.Xd=ih,rh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.Yd)&&e.log?this.Yd.log(t,i):rh.warn("log called before recorder was ready")}get av(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(S);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}hv(){var t,i=this._instance.get_property(S);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return rh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!si(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}sv(t){var i,e,r;if(!this.ev&&this.rv&&this._instance.sessionManager){if(null==(i=Dt.__PosthogExtensions__)||!i.initSessionRecording)return rh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[dt]:!0});var s;if(this.Yd||(this.Yd=null==(s=Dt.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.jt),this.Yd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv()){if(this.Xd===ih||this.Xd===th)return;return this.Xd=th,rh.info("persisted remote config is stale, requesting fresh config before starting"),void new Uo(this._instance).load()}this.Xd=Zl,null==(e=(r=this.Yd).setDocumentWasEverVisible)||e.call(r,this.jt),this.Yd.start(t)}else this.Xd=Xl}onRRwebEmit(t){var i;null==(i=this.Yd)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.Yd||null==(i=this.qo)||i.register({[T]:!0}),null==(t=this.Yd)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Yd||null==(i=this.qo)||i.register({[k]:!0}),null==(t=this.Yd)||t.overrideSampling()}overrideTrigger(t){var i,e;this.Yd||null==(e=this.qo)||e.register({["url"===t?P:R]:!0}),null==(i=this.Yd)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Yd)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.Yd)||!e.tryAddCustomEvent(t,i))}}},Jh={autocapture:class extends Ul{constructor(t){super(new Bl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.fv();return!!(t.path||t.search||this.pv(t))}startIfEnabled(){this.isEnabled&&(ss.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,ss.info("History API monitoring stopped")}monitorHistoryChanges(){Et&&Et.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(t){var i;if(Et&&(null==(i=Et.history[t])||!i.__posthog_wrapped__)){var e=this;Vl(Et.history,t,(i=>function(r,s,n){i.call(this,r,s,n),e.wv(t)}))}}vv(){var t=null==Et?void 0:Et.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}fv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Xt(t)?t:{}}pv(t){return void 0===t&&(t=this.fv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Sv(t){var i=this.fv(),e=this.dv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.pv(i)&&t.hash!==e.hash))}wv(t){try{var i=this.vv();if(!i)return;this.Sv(i)&&this._instance.capture(yt,{navigation_type:t}),this.dv=i}catch(i){ss.error("Error capturing "+t+" pageview",i)}}bv(){if(!this.gv){var t=()=>{this.wv("popstate")};ps(Et,"popstate",t),this.gv=()=>{Et&&Et.removeEventListener("popstate",t)}}}_v(){if(!this.mv){var t=()=>{this.wv("hashchange")};ps(Et,"hashchange",t),this.mv=()=>{Et&&Et.removeEventListener("hashchange",t)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(t){var i;this.xv=!1,this.Rs=!1,this.Cv=null,this.instance=t,this.xv=!(null==(i=this.instance.persistence)||!i.props[f]),this.rageclicks=new Al(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Xt(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(t=this.mn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return si(this.mn.capture_heatmaps)?si(this.mn.enable_heatmaps)?this.xv:this.mn.enable_heatmaps:!1!==this.mn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;sh.info("starting..."),this.Tv(),this.Vt()}else{var t;clearInterval(null!==(t=this.Cv)&&void 0!==t?t:void 0),this.Mv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[f]:e}),this.xv=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pt;return this.Pt=void 0,t}Iv(t){nh(t.originalEvent)&&this.Xi(t.originalEvent,"deadclick")}Vt(){this.Cv&&clearInterval(this.Cv),this.Cv="visible"===(null==$t?void 0:$t.visibilityState)?setInterval(this.Eo.bind(this),this.flushIntervalMilliseconds):null}Tv(){Et&&$t&&(this.Ev=this.Eo.bind(this),ps(Et,bt,this.Ev),this.Rv=t=>this.Xi(t||(null==Et?void 0:Et.event)),ps($t,"click",this.Rv,{capture:!0}),this.Pv=t=>this.Av(t||(null==Et?void 0:Et.event)),ps($t,"mousemove",this.Pv,{capture:!0}),this.Fv=new jn(this.instance,Nn,this.Iv.bind(this)),this.Fv.startIfEnabledOrStop(),this.Ov=this.Vt.bind(this),ps($t,mt,this.Ov),this.Rs=!0)}Mv(){var t;Et&&$t&&(this.Ev&&Et.removeEventListener(bt,this.Ev),this.Rv&&$t.removeEventListener("click",this.Rv,{capture:!0}),this.Pv&&$t.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Ov&&$t.removeEventListener(mt,this.Ov),clearTimeout(this.Lv),null==(t=this.Fv)||t.stop(),this.Rs=!1)}Dv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&Xs(r)&&!Zs(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:Et)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(jt(i,s))return!0;r=vn(r)}return!1}(hn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}Xi(t,i){var r;if(void 0===i&&(i="click"),!Qs(t.target)&&nh(t)){var s=this.Dv(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&bn(hn(t),this.instance.config.rageclick)&&this.ks(e({},s,{type:"rageclick"})),this.ks(s)}}Av(t){!Qs(t.target)&&nh(t)&&(clearTimeout(this.Lv),this.Lv=setTimeout((()=>{this.ks(this.Dv(t,"mousemove"))}),500))}ks(t){if(Et){var i=this.mn.disable_capture_url_hashes?qe(Et.location.href):Et.location.href,e=this.mn.custom_personal_data_properties,r=this.mn.mask_personal_data_properties?[...ro,...e||[]]:[],s=Xn(i,r,no);this.Pt=this.Pt||{},this.Pt[s]||(this.Pt[s]=[]),this.Pt[s].push(t)}}Eo(){this.Pt&&!Zt(this.Pt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:jn,webVitalsAutocapture:class{constructor(t){var i;this.xv=!1,this.Rs=!1,this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$v=()=>{clearTimeout(this.Nv),this.Nv=void 0,0!==this.Pt.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.Pt.url},this.Pt.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=t=>{var i;if(this.Pt=this.Pt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},si(null==t?void 0:t.name)||si(null==t?void 0:t.value))Gl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.jv(r);if(!ti(s)){var n=ni(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Bv||this.Bv>t.value){this.Pt.navigationKey!==n&&(this.$v(),this.Nv=setTimeout(this.$v,this.flushToCaptureTimeoutMs)),ti(this.Pt.navigationKey)&&(this.Pt.navigationKey=n,this.Pt.url=s),this.Pt.firstMetricTimestamp=ti(this.Pt.firstMetricTimestamp)?Date.now():this.Pt.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=e({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,Xt(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Ql){var u="url"===h&&"string"==typeof t.attribution[h]?this.jv(t.attribution[h]):t.attribution[h];ti(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ti(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Pt.metrics.push(a),this.Pt.metrics.length===this.allowedMetrics.length&&this.$v()}else Gl.error("Ignoring metric with value >= "+this.Bv,t)}}},this.Hv=()=>{if(!this.Rs){var t,i,r,s,n=!1,o=Dt.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.zv])||("web-vitals"===this.zv&&ti(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ti(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ti(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,r=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?e({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.qv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.qv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.qv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.qv.bind(this),v),this.Rs=!0}else Gl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.xv=!(null==(i=this._instance.persistence)||!i.props[m]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=Xt(this.Uv)?null==(t=this.Uv)?void 0:t.web_vitals_allowed_metrics:void 0;return si(e)?(null==(i=this._instance.persistence)?void 0:i.props[x])||Jl:e}get flushToCaptureTimeoutMs(){return(Xt(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=Xt(this.Uv)?this.Uv.web_vitals_attribution:void 0;return ai(t)?t?Jl:[]:Yt(t)?t:Yl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=Xt(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Bv(){var t=Xt(this.Uv)&&ni(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:Kl;return t>0&&6e4>=t?Kl:t}get isEnabled(){var t=null==Pt?void 0:Pt.protocol;if("http:"!==t&&"https:"!==t)return Gl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=Xt(this.Uv)?this.Uv.web_vitals:ai(this.Uv)?this.Uv:void 0;return ai(i)?i:this.xv}startIfEnabled(){this.isEnabled&&!this.Rs&&(Gl.info("enabled, starting..."),this.Ys(this.Hv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=Xt(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=Xt(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[m]:e}),this._instance.persistence.register({[x]:r})),this.xv=e,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(t){var i=Dt.__PosthogExtensions__,e=this.zv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&ti(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Gl.error("failed to load script",i):t()}))}jv(t){var i=t||(null==Et?void 0:Et.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?qe(i):i,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...ro,...r||[]]:[];return Xn(e,s,no)}Gl.error("Could not determine current URL")}}},Yh={exceptionObserver:class{constructor(t){var i;this.Hv=()=>{var t;if(Et&&this.isEnabled&&null!=(t=Dt.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=Dt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=Dt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Dt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.mn.capture_unhandled_errors&&(this.Wv=i(this.captureException.bind(this))),!this.Vv&&this.mn.capture_unhandled_rejections&&(this.Vv=e(this.captureException.bind(this))),!this.Gv&&this.mn.capture_console_errors&&(this.Gv=r(this.captureException.bind(this)))}catch(t){zl.error("failed to start",t),this.Zv()}}},this._instance=t,this.Qv=!(null==(i=this._instance.persistence)||!i.props[p]),this.pe=new yi(e({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:zl})),this.mn=this.Jv(),this.startIfEnabledOrStop()}Jv(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Xt(t)?i=e({},i,t):(ti(t)?this.Qv:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(zl.info("enabled"),this.Zv(),this.Ys(this.Hv)):this.Zv()}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return zl.error("failed to load script",i);t()}))}Zv(){var t,i,e;null==(t=this.Wv)||t.call(this),this.Wv=void 0,null==(i=this.Vv)||i.call(this),this.Vv=void 0,null==(e=this.Gv)||e.call(this),this.Gv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Qv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[p]:this.Qv}),this.mn=this.Jv(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.Jv()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.pe.consumeRateLimit(s)?zl.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,r;this.Kv=[],this.Yv=new Je([new ar,new gr,new hr,new lr,new pr,new fr,new dr,new _r],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=or.test(l)?l.replace(or,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Ye});var r}))}(n)}}("web:javascript",er,nr)),this._instance=t,this.Kv=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(_))&&void 0!==i?i:[],this.Xv=xr(this.tc()),this.ec=new Sr(this.Xv)}onConfigChange(){this.Xv=xr(this.tc()),this.ec.setConfig(this.Xv)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Kv=n,this._instance.persistence&&this._instance.persistence.register({[_]:this.Kv,[g]:o})}}}get ic(){var t,i=!!this._instance.get_property(g),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Yv.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Xv.enabled)try{if(!ii(t)||0===t.trim().length)return void Ih.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>yr.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.rc(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Ih.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ec.add(e({[mr]:t,[br]:(new Date).toISOString()},s))}catch(t){Ih.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.nc(i)){if(this.sc(i))return this.ac("Exception dropped: matched a suppression rule"),void Ih.info("Skipping exception capture because a suppression rule matched");if(!this.ic&&this.oc(i))return this.ac("Exception dropped: thrown by a browser extension"),void Ih.info("Skipping exception capture because it was thrown by an extension");if(!this.ic&&this.lc(i))return this.ac("Exception dropped: thrown by an injected browser script"),void Ih.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uc(i))return this.ac("Exception dropped: thrown by the PostHog SDK"),void Ih.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.Xv.enabled&&si(t.$exception_steps)?this.hc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",fu:!0});return s&&this.ec.clear(),s}catch(t){return Ih.error("Failed to capture exception event. Dropping this exception.",t),void this.ec.clear()}}catch(t){return void Ih.error("Failed to process exception event. Ignoring this exception.",t)}var n}hc(t){try{var i=this.ec.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return Ih.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}ac(t){this.Xv.enabled&&this.ec.add({[mr]:t,[br]:(new Date).toISOString()})}rc(t){return Xt(t)?e({},t):{}}tc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}sc(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return ii(e)&&e.length>0&&t.$exception_types.push(e),ii(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Kv.some((t=>{var e=t.values.map((t=>{var e=Ya[t.operator],r=i[t.key];if(!e||!r)return!1;var s=Yt(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return Ih.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}oc(t){var i=t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})),e=i.filter((t=>{var i=t.filename;return!!i&&Ah.some((t=>i.startsWith(t)))}));return 0!==e.length&&(!e.every((t=>{var i=t.filename;return!!i&&i.startsWith(Fh)}))||t.some((t=>{var i=t.value;return ii(i)&&i.includes("isolatedAPI.contexts.topHostname")}))&&!i.some((t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Fh))})))}lc(t){return t.some((t=>{var i=t.value;return ii(i)&&Mh.some((t=>i.includes(t)))}))}uc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}nc(t){return!si(t)&&Yt(t)}}},Qh=e({productTours:class{get qo(){return this._instance.persistence}constructor(t){this.dc=null,this.vc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.qo&&this.qo.register({[y]:!!i.productTours}),!ah(this._instance))return!this.dc&&si(null==(e=this.qo)?void 0:e.props[J])||oh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.dc)||r.stop(),this.dc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.dc&&ah(this._instance)&&this.Ys((()=>this.cc()))}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?oh.error("Could not load product tours script",i):t()}))}cc(){var t;!this.dc&&null!=(t=Dt.__PosthogExtensions__)&&t.generateProductTours&&(this.dc=Dt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!Yt(this.vc)||i){var e=this.qo;if(e){var r=e.props[J];if(Yt(r)&&!i)return this.vc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(ah(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||oh.warn(s):oh.error(s),void t([],{isLoaded:!1,error:s})}var n=Yt(i.json.product_tours)?i.json.product_tours:[];this.vc=n,e&&e.register({[J]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.vc,{isLoaded:!0})}getActiveProductTours(t){si(this.dc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.dc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.dc)||i.showTourById(t)}previewTour(t){this.dc?this.dc.previewTour(t):this.Ys((()=>{var i;this.cc(),null==(i=this.dc)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.dc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.dc)||t.nextStep()}previousStep(){var t;null==(t=this.dc)||t.previousStep()}clearCache(){var t;this.vc=null,null==(t=this.qo)||t.unregister(J)}resetTour(t){var i;null==(i=this.dc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.dc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.dc)||i.cancelPendingTour(t)}}},Gh),Xh={siteApps:class{constructor(t){this.fc=0,this._instance=t,this.gc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mc(t,i){if(i){var e=this.globalsForEvent(i);this.gc.push(e),this.gc.length>1e3&&(this.gc=this.gc.slice(10))}}get siteAppLoaders(){var t;return null==(t=Dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.mc.bind(this));this.yc=()=>{t(),this.gc=[],this.yc=void 0}}}globalsForEvent(t){var i,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(v)){var f=c[0];u[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:e({},r(t,lh),{properties:e({},t.properties,_?{$set:e({},null!==(i=null==(s=t.properties)?void 0:s.$set)&&void 0!==i?i:{},_)}:{},p?{$set_once:e({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}bc(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(hh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(hh.error("prepare_external_dependency_script returned null"),null):t}_c(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==$t?void 0:$t.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.fc++,this.wc)return this.kc();var u=[],d=this,v=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),u.push((()=>{t[i]=r}))}},f=t=>{if(v.has(t))return t;var i=d.bc(t);return i&&v.add(i),i},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ri(t)));return c(h,"appendChild",(t=>function(i){var e=f(i);return e?t.call(this,e):i})),c(h,"insertBefore",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i})),c(h,"replaceChild",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):e})),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null})),this.wc=()=>{u.forEach((t=>t())),this.wc=void 0},this.kc()}kc(){var t=!1;return()=>{var i;t||(t=!0,this.fc--,0===this.fc&&(null==(i=this.wc)||i.call(this)))}}Sc(t,i){void 0===i&&(i=!0);var e=this._c();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.gc.length&&(hh.info("Processing "+this.gc.length+" events for site app with id "+t.id),this.gc.forEach((t=>this.Sc((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.yc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,hh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.Sc((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){hh.error(uh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){hh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}xc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Cc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.Sc((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){hh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.xc(),void this._instance.on("eventCaptured",(t=>this.Cc(t)))):void hh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.yc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;Dt["__$$ph_site_app_"+i]=s._instance,null==(t=Dt.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return hh.error(uh+i,t)}))};for(var a of n.siteApps)o()}else hh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Zh={tracingHeaders:class{constructor(t){this.Tc=void 0,this.Mc=void 0,this.Ic=void 0,this.Hv=()=>{var t,i,e=this.Ec();e?(ti(this.Tc)&&(this.Tc=null==(t=Dt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ti(this.Mc)&&(this.Mc=null==(i=Dt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Zv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Wl.error("failed to load script",i);t()}))}Rc(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Ec(){var t=this.Rc();return Yt(t)?(Yt(this.Ic)?this.Ic.splice(0,this.Ic.length,...t):this.Ic=[...t],t.length>0?this.Ic:void 0):(Yt(this.Ic)&&this.Ic.splice(0),this.Ic=t||void 0,this.Ic)}Zv(){var t,i;null==(t=this.Tc)||t.call(this),null==(i=this.Mc)||i.call(this),this.Tc=void 0,this.Mc=void 0}startIfEnabledOrStop(){this.Ec()?this.Ys(this.Hv):this.Zv()}}},tu=e({surveys:class extends fh{constructor(t){var i;super(new yh(t),{get projectToken(){return i.config.token},kv:new bh(i=t)}),this._instance=t}qu(t,i){var e=i.query?Sa(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Gh),iu={toolbar:class{constructor(t){this.instance=t}Pc(t){Dt.ph_toolbar_state=t}Ac(){var t;return null!==(t=Dt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),_s(this.instance.config))return!1;if(!Et||!$t)return!1;t=null!=t?t:Et.location,e=null!=e?e:Et.history;try{if(!i){try{Et.localStorage.setItem("test","test"),Et.localStorage.removeItem("test")}catch(t){return!1}i=null==Et?void 0:Et.localStorage}var r,s=wh||Zn(t.hash,"__posthog")||Zn(t.hash,"state"),n=s?us((()=>JSON.parse(atob(decodeURIComponent(s)))))||us((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(xh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Fc(t){var i=Dt.ph_load_toolbar||Dt.ph_load_editor;!si(i)&&Qt(i)?i(t,this.instance):Sh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==$t||!$t.getElementById(Gs));if(!Et||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Et.localStorage.setItem(xh,JSON.stringify(e({},s,{source:void 0}))),2===this.Ac())this.Fc(s);else if(0===this.Ac()){var n;this.Pc(1),null==(n=Dt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Sh.error("[Toolbar] Failed to load",t),void this.Pc(0);this.Pc(2),this.Fc(s)})),ps(Et,"turbolinks:load",(()=>{this.Pc(0),this.loadToolbar(s)}))}return!0}Oc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},eu=e({experiments:Lh},Gh),ru={conversations:class{constructor(t){this.Lc=void 0,this._conversationsManager=null,this.Dc=!1,this.je=null,this.$c=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Nc=t.ok,t.ok)){var i=t.config.conversations;si(i)||(ai(i)?this.Lc=i:(this.Lc=i.enabled,this.je=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Lc=void 0,this.je=null,this.Nc=void 0,this.$c=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Dc||this._instance.config.disable_conversations||_s(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Dt?void 0:Dt.__PosthogExtensions__;if(t&&!ti(this.Lc)&&this.Lc)if(this.je&&this.je.token){this.Dc=!0;try{var i=t.initConversations;if(i)return this.qc(i),void(this.Dc=!1);var e=t.loadExternalDependency;if(!e)return void this.jc(vt);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.jc("Could not load conversations script",i):this.qc(t.initConversations),this.Dc=!1}))}catch(t){this.jc("Error initializing conversations",t),this.Dc=!1}}else jh.error("Conversations enabled but missing token in remote config.")}}qc(t){if(this.je)try{this._conversationsManager=t(this.je,this._instance),this.$c=!1,jh.info("Conversations loaded successfully")}catch(t){this.jc("Error completing conversations initialization",t)}else jh.error("Cannot complete initialization: remote config is null")}jc(t,i){jh.error(t,i),this._conversationsManager=null,this.Dc=!1,this.$c=!0}show(){this._conversationsManager?this._conversationsManager.show():jh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Lc&&!ri(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":_s(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Nc?"remote_config_failed":ti(this.Lc)?this.Nc?"disabled_in_project":"remote_config_pending":this.Lc?si(this.je)||!this.je.token?"missing_token":null!=Dt&&Dt.__PosthogExtensions__?this.Dc?"initializing":this.$c?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(jh.warn(Uh),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(jh.warn(Uh),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(jh.warn(Uh),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(jh.warn(Uh),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(jh.warn(Uh),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(jh.warn(Uh),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(jh.warn(Uh),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Su(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},su={logs:class{constructor(t){var i,r=this;this.name="logs",this.Bc=!1,this.Hc=!1,this.zc=!1,this.A=ns("[logs]"),this.Uc=e({},this.A,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(Wh)||r.A.error(...i)}}),this.mo=[],this.Wc=[],this.yd=0,this.Os=!1,this.Vc=[],this.Gc=[],this.Zc=!1,this.Qc=!1,this.Jc=()=>{var t,i;this.Os||(this.yd=0,null==(t=this.Kc)||t.onReconnect(),null==(i=this.Yc)||i.onReconnect())},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Bc=!0),Et&&ps(Et,"online",this.Jc)}Xc(t,i,e,r){var s,n=Bh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Xr(this.tf(t,i),n,this.Uc,(()=>this.ef()),(t=>t()),void 0,r),n]}if(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Kc||this.rf!==i){var e;null==(e=this.Kc)||e.reset(),this.rf=i;var r=this.Xc((()=>this.mo),(t=>{this.mo=t}));this.Kc=r[0],this.nf=r[1]}return this.Kc}sf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Yc||this.af!==i){var e;null==(e=this.Yc)||e.reset(),this.af=i;var r=this.Xc((()=>this.Wc),(t=>{this.Wc=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Hh);this.Yc=r[0],this.lf=r[1]}return this.Yc}setup(t){var i;if(!this.Os){this.Ns=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.Bc=!0),(this.Bc||this.uf()&&this.hf())&&this.df();var e=!1,r=t.onRemoteConfig((t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)}));this.Os?r.dispose():(this.qs=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Os||(this.Os=!0,this.vf(),null==(t=this.qs)||t.dispose(),this.qs=void 0,this.Ns=void 0,this.zc=!1,null==Et||Et.removeEventListener("online",this.Jc),null==(i=this.cf)||i.call(this),this.cf=void 0,null==(e=this.Kc)||e.reset(),null==(r=this.Yc)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Os){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;si(r)?this.ff():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[w]:!!r}),r?(this.Bc=!0,this.Hc||this.df(),this.loadIfEnabled()):this.ff())}}reset(){var t,i,e,r;this.vf(),null==(t=this.Kc)||t.clearQueue(),this.mo=[],null==(i=this.Kc)||i.reset(),null==(e=this.Yc)||e.clearQueue(),this.Wc=[],null==(r=this.Yc)||r.reset(),this.yd=0}captureLog(t){this.Os||this.if().captureLog(t)}captureConsoleLog(t){this.Os||this.sf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Os||this.sf().captureLog(t,{context:i,occurredAtMs:e})}hf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[w])}uf(){var t,i;return null==(t=this._instance)||null==t.vo||!t.vo()||!(null==(i=Dt._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Tu(){var t;this.vf(),null==(t=this.Yc)||t.clearQueue(),this.Wc=[]}ff(){this.Bc||this.vf()}df(){var t,i=this;if(!this.Zc&&null!=Dt&&Dt.console){var e=Bh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(Dt.console[t])}catch(t){return 0}if(!r)return 0;i.Gc.push(Vl(Dt.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.pf(t,n,e)}catch(t){}return s.apply(Dt.console,n)};return n.__rrweb_original__=r,n})))};for(var s of zh)r(s);this.Zc=!0,this.gf=setTimeout((()=>{this.vf()}),3e4)}}pf(t,i,e){var r;if(this.Zc&&!this.Qc&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.Vc.length){this.Qc=!0;try{this.Vc.push({level:t,args:i,occurredAtMs:Date.now(),context:this.ef()})}finally{this.Qc=!1}}}else this.vf()}vf(){if(this.Vc=[],this.Zc){for(var t of(this.Zc=!1,this.gf&&(clearTimeout(this.gf),this.gf=void 0),this.Gc))t();this.Gc=[]}}mf(){var t=this.Vc;return this.vf(),t}get logger(){return this.yf||(this.yf={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.yf}flushLogs(t){t?this.bf(t):(this.Kc&&this.Kc.flush().catch((t=>this._f(t))),this.Yc&&this.Yc.flush().catch((t=>this._f(t))))}_f(t){Wh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Os&&this.Bc&&!this.Hc&&!this.zc){var t=null==Dt?void 0:Dt.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.vf();var i=t.loadExternalDependency;if(!i)return this.A.error(vt),void this.vf();this.zc=!0;try{i(this._instance,"logs",(i=>{if(this.zc=!1,!this.Os&&this.Bc){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.vf();else{var r,s,n=this.mf();this.cf=e.initializeLogs(null!==(r=this.Ns)&&void 0!==r?r:this._instance),this.Hc=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Ns)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.zc=!1,t}}}tf(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===Ht.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===Ht.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},hs:t=>this.hs(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}hs(t){return new Promise((i=>{if(to(this.yd,3))i({kind:"fatal",error:Vh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Vh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.wf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.kf(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Vh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}kf(t){(0!==t||this._instance.__loaded)&&(this.yd=io(t,this.yd,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."))))}bf(t){this.mo.length>0&&this.Sf(t,this.mo,this.nf,s.LIB_NAME,(t=>{this.mo=t})),this.Wc.length>0&&this.Sf(t,this.Wc,this.lf,Hh,(t=>{this.Wc=t}))}Sf(t,i,e,r,n){if(0!==i.length){var o=i.map((t=>t.record));n([]);var a=Qr(o,Yr(e,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.wf(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}wf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}ef(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,si(s)||(i.sessionStartTimestamp=s),si(n)||(i.lastActivityTimestamp=n)}if(null!=Dt&&null!=(t=Dt.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?qe(Dt.location.href):Dt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},nu={metrics:class{constructor(t){this.A=ns("[metrics]"),this._instance=t}initialize(){}if(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Kc&&this.rf===e||(null==(i=this.Kc)||i.reset(),this.rf=e,this.Kc=new es(this.tf(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.Kc}count(t,i,e){void 0===i&&(i=1),this.if().count(t,i,e)}gauge(t,i,e){this.if().gauge(t,i,e)}histogram(t,i,e){this.if().histogram(t,i,e)}flush(t){if(!this.Kc)return Promise.resolve();if(t){var i=this.Kc.drainWindow();return i&&this.Ms(i,t),Promise.resolve()}return this.Kc.flush().catch((t=>this.A.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Kc)||t.reset()}tf(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ms:t=>i.Ms(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Ms(t,i){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(e({method:"POST",url:this.xf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}xf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},ou=e({},Gh,Kh,Jh,Yh,Qh,Xh,tu,Zh,iu,eu,ru,su,nu);Fl.__defaultExtensionClasses=e({},ou);var au=ns("[ExternalScriptsLoader]"),lu=t=>{var i=null==$t?void 0:$t.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},hu=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return au.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=lu(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",(t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)})),void r.addEventListener("error",(t=>{r.__posthog_loading_error=t,e(t)})))}var n=()=>{if(!$t)return e("document not found");if(lu(i))return hu(t,i,e);var r=$t.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)$t.head.appendChild(r);else{var s,n=$t.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):$t.body.appendChild(r)}};null!=$t&&$t.body?n():null==$t||$t.addEventListener("DOMContentLoaded",n)},uu={},du=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};Dt.__PosthogExtensions__=Dt.__PosthogExtensions__||{},Dt.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=uu[s];if("fallback"===r&&n){if(lu(n))return void hu(t,n,e);delete uu[s]}hu(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=du(t,i);uu[s]=a;var l=lu(s);null==l||null==(o=l.parentNode)||o.removeChild(l),hu(t,a,e)}else e(void 0,n)}:e)}else hu(t,du(t,i),e)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");hu(t,o,e)}},Dt.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);hu(t,r,e)};var vu=function(){s.SDK_DIST_CHANNEL="npm";var t=_l[Tl]=new Fl;return function(){function t(){t.done||(t.done=!0,$l=!1,as(_l,(function(t){t._dom_loaded()})))}null!=$t&&$t.addEventListener?"complete"===$t.readyState?t():ps($t,"DOMContentLoaded",t,{capture:!1}):Et&&ss.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Po,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Fo,exports.PostHog=Fl,exports.ProductTourEventName=Mo,exports.ProductTourEventProperties=Do,exports.SurveyEventName=Oo,exports.SurveyEventProperties=Io,exports.SurveyEventType=Ro,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Co,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=vu,exports.posthog=vu,exports.severityLevels=["fatal","error","warning","log","info","debug"];
1
+ "use strict";function t(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise((function(s,n){var o=i.apply(e,r);function a(i){t(o,s,n,a,l,"next",i)}function l(i){t(o,s,n,a,l,"throw",i)}a(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}Object.defineProperty(exports,"__esModule",{value:!0});var s={DEBUG:!1,LIB_VERSION:"0.7.2",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.426.2",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",h="__alias",u="$fbc",d="$fbc_persistence",v="__timers",c="$autocapture_disabled_server_side",f="$heatmaps_enabled_server_side",p="$exception_capture_enabled_server_side",_="$error_tracking_suppression_rules",g="$error_tracking_capture_extension_exceptions",m="$web_vitals_enabled_server_side",b="$dead_clicks_enabled_server_side",y="$product_tours_enabled_server_side",w="$logs_capture_enabled_server_side",x="$web_vitals_allowed_metrics",S="$session_recording_remote_config",E="$replay_sample_rate",k="$replay_override_sampling",T="$replay_override_linked_flag",P="$replay_override_url_trigger",R="$replay_override_event_trigger",C="$sesid",O="$session_is_sampled",I="$enabled_feature_flags",F="$active_feature_flags",A="$early_access_features",M="$feature_flag_details",D="$feature_flag_payloads",N="$feature_flag_request_id",L="$minimal_flag_called_events",j="$override_feature_flags",U="$override_feature_flag_payloads",B="$stored_person_properties",z="$stored_group_properties",H="$groups",q="$surveys",V="$surveys_loaded_at",W="$surveys_activated",G="$surveys_activated_session",J="$surveys_activated_timestamps",K="ph_product_tours",Y="$flag_call_reported",Q="$flag_call_reported_session_id",X="$feature_flag_errors",Z="$feature_flag_evaluated_at",tt="$user_state",it="$client_session_props",et="$capture_rate_limit",rt="$initial_campaign_params",st="$initial_referrer_info",nt="$initial_person_info",ot="$epp",at="$posthog_cookieless",lt="$cookieless_mode",ht="$sdk_debug_extensions_init_method",ut="$sdk_debug_extensions_init_time_ms",dt="$sdk_debug_recording_script_not_loaded",vt="PostHog loadExternalDependency extension not found.",ct="on_reject",ft="always",pt="anonymous",_t="identified",gt="identified_only",mt="visibilitychange",bt="beforeunload",yt="$pageview",wt="$pageleave",xt="$identify",St="$groupidentify",Et="u">typeof window?window:void 0,kt="u">typeof globalThis?globalThis:Et,Tt=null==kt?void 0:kt.navigator,$t=null==kt?void 0:kt.document,Pt=null==kt?void 0:kt.location,Rt=null==kt?void 0:kt.fetch,Ct=null!=kt&&kt.XMLHttpRequest&&"withCredentials"in new kt.XMLHttpRequest?kt.XMLHttpRequest:void 0,Ot=null==kt?void 0:kt.AbortController,It=null==kt?void 0:kt.CompressionStream,Ft=null==Tt?void 0:Tt.userAgent;function At(){return!(!Et||!1===Et.navigator.onLine)}var Mt="undefined"!=typeof globalThis?globalThis:Et;Mt&&"undefined"==typeof self&&(Mt.self=Mt),Mt&&"undefined"==typeof File&&(Mt.File=function(){});var Dt=null!=Et?Et:{},Nt=["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"],Lt=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return Nt.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function jt(t,i){return-1!==t.indexOf(i)}var Ut=function(t){return t.trim()},Bt=function(t){return t.replace(/^\$/,"")};function zt(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var Ht=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),qt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Vt=["$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"],Wt=["token"],Gt=Object.prototype,Jt=Gt.hasOwnProperty,Kt=Gt.toString,Yt=Array.isArray||function(t){return"[object Array]"===Kt.call(t)},Qt=t=>"function"==typeof t,Xt=t=>t===Object(t)&&!Yt(t),Zt=t=>{if(Xt(t)){for(var i in t)if(Jt.call(t,i))return!1;return!0}return!1},ti=t=>void 0===t,ii=t=>"[object String]"==Kt.call(t),ei=t=>ii(t)&&0===t.trim().length,ri=t=>null===t,si=t=>ti(t)||ri(t),ni=t=>"[object Number]"==Kt.call(t)&&t==t,oi=t=>ni(t)&&t>0,ai=t=>"[object Boolean]"===Kt.call(t),li=t=>t instanceof FormData,hi=t=>jt(Vt,t),ui=t=>jt(Wt,t);function di(t){return null===t||"object"!=typeof t}function vi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function ci(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return pi(t,Error)}}function fi(t){return"u">typeof Event&&pi(t,Event)}function pi(t,i){try{return t instanceof i}catch(t){return!1}}var _i=[!0,"true",1,"1","yes"],gi=t=>jt(_i,t),mi=[!1,"false",0,"0","no"];function bi(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),ni(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),bi(null!=s?s:e,i,e,r))}class yi{constructor(t){this.C={},this.I=t.I,this.R=bi(t.bucketSize,0,100,t.A),this.O=bi(t.refillRate,0,this.R,t.A),this.N=bi(t.refillInterval,0,864e5,t.A)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.N);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.N)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}}var wi="Mobile",xi="iOS",Si="Android",Ei="Tablet",ki=Si+" "+Ei,Ti="iPad",$i="Apple",Pi=$i+" Watch",Ri="Safari",Ci="BlackBerry",Oi="Samsung",Ii=Oi+"Browser",Fi=Oi+" Internet",Ai="Chrome",Mi=Ai+" OS",Di=Ai+" "+xi,Ni="Internet Explorer",Li=Ni+" "+wi,ji="Opera",Ui=ji+" Mini",Bi="Edge",zi="Microsoft "+Bi,Hi="Firefox",qi=Hi+" "+xi,Vi="Nintendo",Wi="PlayStation",Gi="Xbox",Ji=Si+" "+wi,Ki=wi+" "+Ri,Yi="Windows",Qi=Yi+" Phone",Xi="Nokia",Zi="Ouya",te="Generic",ie=te+" "+wi.toLowerCase(),ee=te+" "+Ei.toLowerCase(),re="Konqueror",se="Oculus Browser",ne="Vivaldi",oe="Yandex",ae="Whale",le="DuckDuckGo",he="Pale Moon",ue="Waterfox",de="Brave",ve="Claude",ce="Codex",fe="ChatGPT",pe="Google Search App",_e="(\\d+(\\.\\d+)?)",ge=new RegExp("Version/"+_e),me=new RegExp("("+ve+"|"+ce+"|"+fe+")\\/"+_e),be=new RegExp(Gi,"i"),ye=new RegExp(Wi+" \\w+","i"),we=new RegExp(Vi+" \\w+","i"),xe=new RegExp(Ci+"|PlayBook|BB10","i"),Se={"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"},Ee=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?de:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&jt(t,"GSA/")?pe:jt(t," OPR/")&&jt(t,"Mini")?Ui:jt(t," OPR/")?ji:xe.test(t)?Ci:jt(t,"IE"+wi)||jt(t,"WPDesktop")?Li:jt(t,"OculusBrowser")?se:jt(t,Ii)?Fi:jt(t,Bi)||jt(t,"Edg/")?zi:jt(t,ne+"/")?ne:jt(t,"YaBrowser/")?oe:jt(t,ae+"/")?ae:jt(t,le+"/")||jt(t,"Ddg/")?le:jt(t,ve+"/")?ve:jt(t,ce+"/")?ce:jt(t,fe+"/")?fe:jt(t,"FBIOS")?"Facebook "+wi:jt(t,"UCWEB")||jt(t,"UCBrowser")?"UC Browser":jt(t,"CriOS")?Di:jt(t,"CrMo")||jt(t,Ai)?Ai:jt(t,Si)&&jt(t,Ri)?Ji:jt(t,"FxiOS")?qi:jt(t.toLowerCase(),re.toLowerCase())?re:jt(t,de+"/")?de:((t,i)=>i&&jt(i,$i)||function(t){return jt(t,Ri)&&!jt(t,Ai)&&!jt(t,Si)}(t))(t,i)?jt(t,wi)?Ki:Ri:jt(t,"PaleMoon/")?he:jt(t,ue+"/")?ue:jt(t,Hi)?Hi:jt(t,"MSIE")||jt(t,"Trident/")?Ni:jt(t,"Gecko")?Hi:"")},ke={[Li]:[new RegExp("rv:"+_e)],[zi]:[new RegExp(Bi+"?\\/"+_e)],[Ai]:[new RegExp("("+Ai+"|CrMo)\\/"+_e)],[Di]:[new RegExp("CriOS\\/"+_e)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+_e)],[Ri]:[ge],[Ki]:[ge],[ji]:[new RegExp("(Opera|OPR)\\/"+_e)],[Hi]:[new RegExp(Hi+"\\/"+_e)],[qi]:[new RegExp("FxiOS\\/"+_e)],[re]:[new RegExp("Konqueror[:/]?"+_e,"i")],[Ci]:[new RegExp(Ci+" "+_e),ge],[Ji]:[new RegExp("android\\s"+_e,"i")],[Fi]:[new RegExp(Ii+"\\/"+_e)],[se]:[new RegExp("OculusBrowser\\/"+_e)],[ne]:[new RegExp(ne+"\\/"+_e)],[oe]:[new RegExp("YaBrowser\\/"+_e)],[ae]:[new RegExp(ae+"\\/"+_e)],[de]:[new RegExp(de+"\\/"+_e)],[ve]:[me],[ce]:[me],[fe]:[me],[le]:[new RegExp("(DuckDuckGo|Ddg)\\/"+_e)],[he]:[new RegExp("PaleMoon\\/"+_e)],[ue]:[new RegExp(ue+"\\/"+_e)],[pe]:[new RegExp("GSA\\/"+_e)],[Ni]:[new RegExp("(rv:|MSIE )"+_e)],Mozilla:[new RegExp("rv:"+_e)]},Te=function(t,i,e,r){var s=Ee(t,i,e,r),n=ke[s];if(ti(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},$e=[[new RegExp(Gi+"; "+Gi+" (.*?)[);]","i"),t=>[Gi,t&&t[1]||""]],[new RegExp(Vi,"i"),[Vi,""]],[new RegExp(Wi,"i"),[Wi,""]],[xe,[Ci,""]],[new RegExp(Yi,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Qi,""];if(new RegExp(wi).test(i)&&!/IEMobile\b/.test(i))return[Yi+" "+wi,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Se[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Yi,r]}return[Yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[xi,[t[3],t[4],t[5]||"0"].join(".")]:[xi,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=ti(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Si+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Si+")","i"),t=>t&&t[2]?[Si,[t[2],t[3],t[4]||"0"].join(".")]:[Si,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Mi,""]],[/Linux|debian/i,["Linux",""]]],Pe=function(t){for(var i=0;$e.length>i;i++){var e=$e[i],r=e[1],s=e[0].exec(t),n=s&&(Qt(r)?r(s,t):r);if(n)return n}return["",""]},Re=function(t){return we.test(t)?Vi:ye.test(t)?Wi:be.test(t)?Gi:new RegExp(Zi,"i").test(t)?Zi:new RegExp("("+Qi+"|WPDesktop)","i").test(t)?Qi:/iPad/.test(t)?Ti:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Pi:xe.test(t)?Ci:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Xi,"i").test(t)?Xi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(wi).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Si:ki:new RegExp("(pda|"+wi+")","i").test(t)?ie:new RegExp(Ei,"i").test(t)&&!new RegExp(Ei+" pc","i").test(t)?ee:""},Ce=20,Oe=1e3,Ie=1e4,Fe="[Circular]",Ae="[Truncated]",Me="[Unserializable]",De="[Function]";function Ne(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}var Le,je,Ue,Be=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ze(t,i){return"string"==typeof(e=t)&&Be.test(e)?t:i();var e}function He(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function qe(t){return t?t.split("#")[0]:t}function Ve(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function We(t,i,e){return Ge.apply(this,arguments)}function Ge(){return(Ge=i((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ve((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}function Je(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Ue&&e.length===je||(je=e.length,Ue=e.reduce(((e,r)=>{Le||(Le={});var s=Le[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,Le[r]=[l,h];break}}return e}),{})),Ue}}class Ke{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Yt(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var e=this;return i((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,i){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:Je(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Ye="?";function Qe(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Ye:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return ti(r)||(n.lineno=r),ti(s)||(n.colno=s),n}var Xe=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Ye,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},Ze=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ir=/\((\S*)(?::(\d+))(?::(\d+))\)/,er=(t,i)=>{var e=Ze.exec(t);if(e)return Qe(i,e[1],Ye,+e[2],+e[3]);var r=tr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ir.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Xe(r[1]||Ye,r[2]);return Qe(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},rr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,sr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nr=(t,i)=>{var e=rr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=sr.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Ye,o=Xe(n,s);return Qe(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},or=/\(error: (.*)\)/;class ar{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=ii(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return vi(t,"DOMException")}isDOMError(t){return vi(t,"DOMError")}}class lr{match(t){return ci(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class hr{match(t){return!!vi(t,"ErrorEvent")&&(null!=t.error||this.Vi(t))}coerce(t,i){var r;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return e({},s,{stack:null!==(r=this.Zi(t))&&void 0!==r?r:s.stack,synthetic:!0})}Vi(t){return ii(t.message)&&t.message.length>0}Zi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(ii(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var ur=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class dr{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(ur);return r&&(i=r[1],e=r[2]),[i,e]}}var vr=["fatal","error","warning","log","info","debug"];function cr(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class fr{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(fi(t))return t.constructor.name;var i="name"in t?t.name:void 0;return ii(i)&&!ei(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+cr(t)}isSeverityLevel(t){return ii(t)&&!ei(t)&&vr.indexOf(t)>=0}getStack(t){try{return ii(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ii(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(ci(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class pr{match(t){return fi(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+cr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class _r{match(t){return di(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class gr{match(t){return vi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!fi(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return di(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var mr="$message",br="$timestamp",yr=new Set([mr,br]),wr={enabled:!0,max_bytes:32768};function xr(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:wr.enabled,max_bytes:Er(t.max_bytes,wr.max_bytes)}:e({},wr)}class Sr{constructor(t){this.Pn=[],this.Fn=0,this.mn=xr(t)}setConfig(t){this.mn=xr(t),this.$n()}add(t){var i=function(t){var i;try{i=zt(t)}catch(t){return}try{var e=JSON.parse(i);if(!Xt(e))return;var r=e,s=r[mr],n=r[br];if(!ii(s)||0===s.trim().length)return;if(!ii(n)&&!ni(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.mn.max_bytes||(this.Pn.push({step:i.step,bytes:e}),this.Fn+=e,this.$n())}}getAttachable(){return this.Pn.map((t=>t.step))}clear(){this.Pn=[],this.Fn=0}size(){return this.Pn.length}$n(){for(;this.Fn>this.mn.max_bytes&&this.Pn.length>0;){var t=this.Pn.shift();t&&(this.Fn-=t.bytes)}}}function Er(t,i){if(!ni(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var kr=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Tr(t){return"string"==typeof t||t}function $r(t){return"string"==typeof t?t:void 0}var Pr,Rr=["$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"],Cr="NativeGzipValidationError",Or=t=>t.length>=2&&31===t[0]&&139===t[1],Ir=(t,i)=>t===qt.GZipJS||i===qt.GZipJS||"gzip"===i,Fr=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Ar=t=>{throw He(Cr,"Native gzip produced invalid output: "+t)},Mr=function(){var t=i((function*(t,i){18>t.size&&Ar("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Or(e)&&8===e[2]||Ar("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Pr)return Pr;Pr=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Pr[t]=i>>>0}return Pr})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Ar("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Ar("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function Dr(){return Dr=i((function*(t,e,r){void 0===e&&(e=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=i((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Mr(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),Dr.apply(this,arguments)}var Nr=0x8000000000000000,Lr="9223372036854775808",jr={}.propertyIsEnumerable;function Ur(t,i){try{return Hr(t,i,{ancestors:new WeakSet,remainingNodes:Ie},0)}catch(t){return[]}}function Br(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:Ae};if(e.remainingNodes--,ai(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt(Lr);return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Nr||-Nr>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Ne(t)};if("function"==typeof t)return{stringValue:De};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:Fe};if(r>=Ce)return{stringValue:Ae};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Ne(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Br(a.call(t),i,e,r+1)}catch(t){}return Yt(t)?{arrayValue:{values:zr(t,i,e,r+1)}}:{kvlistValue:{values:Hr(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ne(String(t))}}function zr(t,i,e,r){for(var s=[],n=Math.min(t.length,Oe),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(si(a))continue;s.push(Br(a,i,e,r))}catch(t){s.push({stringValue:Me})}return t.length>o&&s.push({stringValue:Ae}),s}function Hr(t,i,e,r){var s=[];for(var n in t)if(jr.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=Oe||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(ri(o)||ti(o))continue;s.push({key:Ne(n),value:Br(o,i,e,r)})}catch(t){s.push({key:Ne(n),value:{stringValue:Me}})}}return s}function qr(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}var Vr={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var Wr={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}},Gr=Wr.info;function Jr(t){try{return Ne(String(t))}catch(t){return Me}}function Kr(t,i,r,s){var n,o=Wr[t.level||"info"]||Gr,a=o.text,l=o.number,h=(void 0===(n=ni(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),si(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),si(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=e({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Me}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:Jr(t.body)},attributes:Ur(d,r)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),ti(t.trace_flags)||(_.flags=t.trace_flags),_}function Yr(t,i,e){return qr(t,i,e)}function Qr(t,i,e,r){return{resourceLogs:[{resource:{attributes:Ur(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Xr=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.mn=i,this.A=e,this.Nn=r,this.qn=s,this.jn=n,this.Bn=o,this.Hn=null,this.zn=0,this.Un=0,this.Wn=0,this.Vn=0,this.Gn=0,this.Zn=!1,this.Qn=i.maxBufferSize,this.Jn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.Kn=i.flushIntervalMs,this.Yn=i.maxBatchRecordsPerPost,this.Xn=i.rateCapWindowMs,this.ts=i.maxLogsPerInterval}clearQueue(){this.Un++,this._instance.setPersistedProperty(Ht.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(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.ns(t);if(null!==r)if(r.body){if(this.ss()){var s={record:Kr(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Nn(),this.A,null==i?void 0:i.occurredAtMs)};this.qn((()=>this.os(s)))}}else this.A.info("Log was rejected in beforeSend function")}}ns(t){var i=this.mn.beforeSend;if(!i)return t;var e=Yt(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}ss(){if(void 0===this.ts)return!0;var t=Date.now(),i=t-this.Vn;return this.Xn>i&&i>=0||(this.Vn=t,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 t=this;return i((function*(){if(!t._instance.isDisabled)return t.Hn||(t.Hn=t.ls().finally((()=>{t.Hn=null}))),t.Hn}))()}ls(){var t=this;return i((function*(){var i;t.es();var e=null!==(i=t._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.Un;t.zn=0;var l=Math.min(e.length,t.Yn),h=e.slice(0,l),u=Qr(h.map((t=>t.record)),t.us(),null!==(n=t.Bn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.hs(u);if(t.Un!==a)return;if("too-large"===d.kind&&h.length>1)t.Yn=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.Yn);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.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."):"ok"===d.kind&&t.mn.maxBatchRecordsPerPost>t.Yn&&(t.Yn=Math.min(t.mn.maxBatchRecordsPerPost,t.Yn+1)),yield t.ds(h.length),e=null!==(o=t._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}ds(t){var e=this;return i((function*(){var i,r=Math.max(0,t-e.zn),s=null!==(i=e._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(Ht.LogsQueue,s.slice(r)),yield e.jn()}))()}us(){return Yr(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}os(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(Ht.LogsQueue))&&void 0!==i?i:[];this.Jn>e.length||(e.shift(),this.zn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(Ht.LogsQueue,e),this.Qn>e.length?this.vs():this.rs()}}vs(t){void 0===t&&(t=this.Kn),this.cs||(this.cs=Ve((()=>{this.cs=void 0,this.rs()}),t))}fs(){var t=Math.min(Math.max(0,this.Wn-1),6);return this.Kn*Math.pow(2,t)}ps(){var t=this._instance.getPersistedProperty(Ht.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i((function*(){e.es();var i=e.flush().catch((()=>{}));void 0!==t?yield We(i,t):yield i}))()}flushWithTimeout(t){var e=this;return i((function*(){var i=e.flush();yield We(i,t,(()=>{i.catch((()=>{}))}))}))()}rs(){this.flush().then((()=>{this.Wn=0}),(t=>{this.Wn++,this.A.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ps()&&this.vs(this.fs())}))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};var Zr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ts(t){return String(t)+"000000"}function is(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let es=class{constructor(t,i,e){this._instance=t,this.mn=i,this.A=e,this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set,this.ws=0}count(t,i,e){void 0===i&&(i=1),this.ks({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.ks({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.ks({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,e=this.Hn,r=function(){var r=i((function*(){e&&(yield e.catch((()=>{}))),yield t.Ss()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.Hn===s&&(this.Hn=null)}));return this.Hn=s,s}drainWindow(){if(0===this.gs.size)return null;var t=this.gs;return this.gs=new Map,this.ys=!1,this.bs=new Map,this._s=new Set,this.xs(t)}reset(){this.ws++,this.es(),this.gs=new Map,this.Hn=null,this.ys=!1,this.bs=new Map,this._s=new Set}ks(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.ns(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=i.attributes?e({},i.attributes):void 0,s=is(i.type,i.name,i.unit,r)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.gs.get(s);if(!n){if(!this.Cs())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.gs.set(s,n)}var o=this.bs.get(i.name);void 0===o?this.bs.set(i.name,i.type):o===i.type||this._s.has(i.name)||(this._s.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Ts(n,i.value),this.vs()}else this.A.warn("Dropping metric '"+i.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(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Zr.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Zr)]+=1}}ns(t){var i=this.mn.beforeSend;if(!i)return t;var e=Yt(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}vs(){this.cs||(this.cs=Ve((()=>{this.cs=void 0,this.flush().catch((t=>{this.A.error("Metrics flush failed:",t)}))}),this.mn.flushIntervalMs))}es(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}Ss(){var t=this;return i((function*(){if(0!==t.gs.size){var i=t.gs;t.gs=new Map,t.ys=!1,t.bs=new Map,t._s=new Set;var e=t.ws,r=yield t._instance.Ms(t.xs(i));if(e===t.ws)switch(r.kind){case"ok":return;case"retry-later":return t.Is(i),void t.vs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}}))()}xs(t){return i=this.Es(t),e=function(t,i,e){return qr(t,i,e)}(this.mn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ur(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Es(t){var i=ts(Date.now()),r=new Map;for(var s of t.values()){var n,o=is(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=e({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=Ur(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=ts(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:Zr})}return Array.from(r.values())}Is(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.gs.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.Cs()&&this.gs.set(s,n)}}};var rs=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){if(Et&&(s.DEBUG||Et.POSTHOG_DEBUG||e)&&!ti(Et.console)&&Et.console){for(var r=("__rrweb_original__"in Et.console[i]?Et.console[i].__rrweb_original__:Et.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>rs(t+" "+i,e)};return r},ss=rs("[PostHog.js]"),ns=ss.createLogger;function os(t,i){Yt(t)&&t.forEach(i)}function as(t,i){if(!si(t))if(Yt(t))t.forEach(i);else if(li(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)Jt.call(t,e)&&i(t[e],e)}var ls=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function hs(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var us=function(t){try{return t()}catch(t){return}},ds=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){ss.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ss.critical(t)}}},vs=function(t){var i={};return as(t,(function(t,e){(ii(t)&&t.length>0||ni(t))&&(i[e]=t)})),i};var cs=["herokuapp.com","vercel.app","netlify.app"];function fs(t){var i=null==t?void 0:t.hostname;if(!ii(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of cs)if(e===r)return!1;return!0}function ps(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function _s(t){return"ph_toolbar_internal"===t.name}var gs=t=>{if($t){try{for(var i=t+"=",e=$t.cookie.split(";").filter((t=>t.length)),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ni(t)&&isFinite(t)&&Math.floor(t)===t});class ms{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ms(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ms(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class bs{generate(){var t=this.generateOrAbort();if(!ti(t))return t;this.Kr=0;var i=this.generateOrAbort();if(ti(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Kr)this.Kr=t,this.Xr();else{if(this.Kr>=t+1e4)return;this.ei++,this.ei>4398046511103&&(this.Kr++,this.Xr())}return ms.fromFieldsV7(this.Kr,Math.trunc(this.ei/Math.pow(2,30)),this.ei&Math.pow(2,30)-1,this.ti.nextUint32())}Xr(){this.ei=1024*this.ti.nextUint32()+(1023&this.ti.nextUint32())}constructor(){this.Kr=0,this.ei=0,this.ti=new xs}}var ys,ws=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Et&&!ti(Et.crypto)&&crypto.getRandomValues&&(ws=t=>crypto.getRandomValues(t));class xs{nextUint32(){return this.Pt.length>this.ri||(ws(this.Pt),this.ri=0),this.Pt[this.ri++]}constructor(){this.Pt=new Uint32Array(8),this.ri=1/0}}var Ss=()=>Es().toString(),Es=()=>(ys||(ys=new bs)).generate(),ks="",Ts=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var $s=null,Ps={ii(){if(!ri($s))return $s;if($s=!1,$t)try{var t="__ph_cookie_support_"+Ss();Ps.ni(t,"xyz"),$s='"xyz"'===gs(t),Ps.oi(t)}catch(t){$s=!1}return $s},si(t){ss.error("cookieStore error: "+t)},ai:gs,ui(t){var i;try{i=JSON.parse(Ps.ai(t))||{}}catch(t){}return i},ni(t,i,e,r,s){if(!$t)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=$t),ks)return ks;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ss();!ks&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",ks=n)}return ks}(t);if(!e){var r=(t=>{var i=t.match(Ts);return i?i[0]:""})(t);r!==e&&ss.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}($t.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&ss.warn("cookieStore warning: large cookie, len="+h.length),$t.cookie=h,!0}catch(t){return!1}},oi(t,i){if(null!=$t&&$t.cookie)try{Ps.ni(t,"",-1,i)}catch(t){return}}},Rs=null,Cs={ii(){if(!ri(Rs))return Rs;var t=!0;if(ti(Et))t=!1;else try{var i="__mplssupport__";Cs.ni(i,"xyz"),'"xyz"'!==Cs.ai(i)&&(t=!1),Cs.oi(i)}catch(i){t=!1}return t||ss.error("localStorage unsupported; falling back to cookie store"),Rs=t,t},si(t){ss.error("localStorage error: "+t)},ai(t){try{return null==Et?void 0:Et.localStorage.getItem(t)}catch(t){Cs.si(t)}return null},ui(t){try{return JSON.parse(Cs.ai(t))||{}}catch(t){}return null},ni(t,i){try{return null==Et||Et.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Cs.si(t)}return!1},oi(t){try{null==Et||Et.localStorage.removeItem(t)}catch(t){Cs.si(t)}}},Os=[B,F,I,M,D,N,Z,X,Y],Is=[a,o,C,O,ot,nt,d,tt],Fs=t=>t+"_cpm",As=["__proto__","constructor","prototype"],Ms=t=>{if(!Xt(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===As.indexOf(e)&&(i[e]=t[e])})),i},Ds=function(t,i){void 0===i&&(i=[]);var e={};return[...Is,...i].forEach((i=>{var r=t[i];ti(r)||ri(r)||""===r||(e[i]=r)})),e},Ns=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Ls=(t,i)=>({p:i,f:Ns(JSON.stringify(t))}),js=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ps.ui(Fs(t)),r=(null==e?void 0:e.f)===Ns(i)&&Yt(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Us=(t,i)=>i+"|"+(Ps.ai(Fs(t))||""),Bs={},zs={ii:()=>!0,si(t){ss.error("memoryStorage error: "+t)},ai:t=>t in Bs?Bs[t]:null,ui:t=>t in Bs?Bs[t]:null,ni:(t,i)=>(Bs[t]=i,!0),oi(t){delete Bs[t]}},Hs=null,qs={ii(){if(!ri(Hs))return Hs;if(Hs=!0,ti(Et))Hs=!1;else try{var t="__support__";qs.ni(t,"xyz"),'"xyz"'!==qs.ai(t)&&(Hs=!1),qs.oi(t)}catch(t){Hs=!1}return Hs},si(t){ss.error("sessionStorage error: ",t)},ai(t){try{return null==Et?void 0:Et.sessionStorage.getItem(t)}catch(t){qs.si(t)}return null},ui(t){try{return JSON.parse(qs.ai(t))||null}catch(t){}return null},ni(t,i){try{return null==Et||Et.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){qs.si(t)}return!1},oi(t){try{null==Et||Et.sessionStorage.removeItem(t)}catch(t){qs.si(t)}}};class Vs{constructor(t){this._instance=t}get mn(){return this._instance.config}get consent(){return this.Vs()?0:this.Gs}isOptedOut(){return this.mn.cookieless_mode===ft||this.isRejected()||-1===this.consent&&this.mn.cookieless_mode===ct}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.mn.opt_out_capturing_by_default}optInOut(t){this.Zs.ni(this.Qs,t?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 t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get Gs(){var t=this.Zs.ai(this.Qs);return gi(t)?1:jt(mi,t)?0:-1}get Zs(){var t=this.mn.opt_out_capturing_persistence_type,i="localStorage"===t?Cs:Ps,e=i.ii()?i:zs;if(!this.Js||this.Js!==e){this.Js=e;var r="localStorage"===t?Ps:Cs;r.ai(this.Qs)&&(this.Js.ai(this.Qs)||this.optInOut(gi(r.ai(this.Qs))),r.oi(this.Qs,this.mn.cross_subdomain_cookie))}return this.Js}Vs(){return!!this.mn.respect_dnt&&[null==Tt?void 0:Tt.doNotTrack,null==Tt?void 0:Tt.msDoNotTrack,Dt.doNotTrack,null==Tt?void 0:Tt.globalPrivacyControl].some((t=>gi(t)))}}function Ws(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!Qt(r))return i;try{var s=r(i);return ii(s)&&s?s:i}catch(t){return ss.error("Error in get_current_url, falling back to window.location.href",t),i}}var Gs="__POSTHOG_TOOLBAR__",Js=1,Ks=3,Ys=11;function Qs(t){return t instanceof Element&&(t.id===Gs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Xs(t){return!!t&&t.nodeType===Js}function Zs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function tn(t){return!!t&&t.nodeType===Ks}function en(t){return!!t&&t.nodeType===Ys&&Xs(t.host)}var rn=1e3;function sn(t){return t?Ut(t).split(/\s+/):[]}function nn(t,i){var e=function(t){var i,e=null==Et||null==(i=Et.location)?void 0:i.href;return ti(e)?void 0:Ws(t,e)}(i);return!!(e&&t&&t.some((t=>e.match(t))))}function on(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return sn(i)}function an(t){return si(t)?null:Ut(t).split(/(\s+)/).filter((t=>On(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ln(t){var i="";return xn(t)&&!Sn(t)&&t.childNodes&&t.childNodes.length&&as(t.childNodes,(function(t){var e;tn(t)&&t.textContent&&(i+=null!==(e=an(t.textContent))&&void 0!==e?e:"")})),Ut(i)}function hn(t){var i;return ti(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var un=["a","button","form","input","select","textarea","label"];function dn(t,i){if(ti(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function vn(t){var i=t.parentNode;return!(!i||!Xs(i))&&i}var cn=[".ph-no-autocapture","[data-ph-no-autocapture]"],fn=["next","previous","prev",">","<"],pn=[...fn,"+","-","−","–"],_n=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,gn=[".ph-no-rageclick",".ph-no-capture"],mn=["","text","search","email","password","url","tel","number"];function bn(t,i){if(!Et||yn(t))return!1;var e,r,s,n,o;if(ai(i)?(e=!!i&&gn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:gn,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!Xs(t))&&(!!Zs(t,"textarea")||(Zs(t,"input")?jt(mn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var a=wn(t,!1).targetElementList;return!function(t,i){if(!1===t||ti(t))return!1;var e;if(!0===t)e=fn;else{if(!Yt(t))return!1;if(t.length>10)return ss.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>_n(i,t)||_n(r,t)))}))}(r,a.map((t=>{var i;return{safeText:ln(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!dn(a,e)}var yn=t=>!t||Zs(t,"html")||!Xs(t),wn=(t,i)=>{if(!Et||yn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!Zs(s,"body");)if(en(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=vn(s);if(!n)break;if(i||un.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=Et.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function xn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Zs(r,"body");r=r.parentNode){if(e++>=rn||i.has(r))return!1;i.add(r);var s=on(r);if(jt(s,"ph-sensitive")||jt(s,"ph-no-capture"))return!1}if(jt(on(t),"ph-include"))return!0;var n=t.type||"";if(ii(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ii(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Sn(t){return!!(Zs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Zs(t,"select")||Zs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var En=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}))$"),kn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Tn=[16,15,14,13],$n=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Pn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Rn=/[0-9A-Za-z_]/;function Cn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function On(t,i){if(void 0===i&&(i=!0),si(t))return!1;if(ii(t)){t=Ut(t);var e=i?En.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(kn.lastIndex=0;i=kn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Tn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(En.test(a)&&Cn(a))return!0}}}return!1}(t);if(e)return!1;var r=i?$n.test(t):function(t){var i;for(Pn.lastIndex=0;i=Pn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Rn.test(e)&&Rn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function In(t){var i=ln(t);return On(i=(i+" "+Fn(t)).trim())?i:""}function Fn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&as(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=ln(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Fn(t)).trim())}catch(t){ss.error("[AutoCapture]",t)}})),i}function An(t){return t.replace(/"|\\"/g,'\\"')}function Mn(t){var i=t.attr__class;if(i)return Yt(i)?i:sn(i)}var Dn=ns("[Dead Clicks]"),Nn=()=>!0,Ln=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(b)),r=t.instance.config.capture_dead_clicks;return ai(r)?r:!!Xt(r)||e};class jn{get lazyLoadedDeadClicksAutocapture(){return this.Ks}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[b]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ys((()=>{this.Xs()})):this.stop()}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Dn.error("failed to load script",i):t()}))}Xs(){var t;if($t){if(!this.Ks&&null!=(t=Dt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=Xt(this.instance.config.capture_dead_clicks)?e({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Ks=Dt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Ks.start($t),Dn.info("starting...")}}else Dn.error("`document` not found. Cannot start.")}stop(){this.Ks&&(this.Ks.stop(),this.Ks=void 0,Dn.info("stopping..."))}}var Un=ns("[SegmentIntegration]");function Bn(t,i,e){void 0===e&&(e=!0);var r=t.config.segment;if(!r)return i();!function(t,i,e){var r=t.config.segment;if(!r)return i();var s=r=>{var s=()=>r.anonymousId()||Ss();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(tt,_t)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&Qt(n.then)?n.then(s):s(n)}(t,(e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||Un.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,r)=>{if(!r)return e;var s=!!i&&e.event.anonymousId===i&&!e.event.userId;s||e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Un.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Un.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var n=t.calculateEventProperties(r,e.event.properties);return e.event.properties=Object.assign({},n,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return e(t,t.event.event)},page(t){return e(t,yt)},identify(t){return e(t,xt)},screen(t){return e(t,"$screen")}}})(t,e)).then((()=>{i()}),(t=>{Un.error("Failed to register the Segment integration",t),i()}))}),e)}var zn="posthog-js";function Hn(t,i){var r=void 0===i?{}:i,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var r,a,h,d,v;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=i.exception)?void 0:r.values)||[],_=p.map((t=>e({},t,{stacktrace:t.stacktrace?e({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>e({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:_,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),i}}class qn{constructor(t,i,e,r,s,n){this.name=zn,this.setupOnce=function(o){o(Hn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Vn{constructor(t){this.ta=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(ss.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ea=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ia()}ia(){var t;this.ra=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ta)}destroy(){var t;null==(t=this.ra)||t.call(this),this.ra=void 0}doPageView(t,i){var e,r=this.na(t,i);return this.ea={pathname:null!==(e=null==Et?void 0:Et.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.na(t,null==(i=this.ea)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ea)?void 0:t.pageViewId}}na(t,i){var e=this.ea;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(ti(n)||ti(o)||ti(a)||ti(l)||ti(h)||ti(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?bi(o/n,0,1,ss):1,v=n>1?bi(a/n,0,1,ss):1,c=l>1?bi(h/l,0,1,ss):1,f=l>1?bi(u/l,0,1,ss):1;r=ls(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Wn=["flags","surveys"],Gn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[v]:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[w]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"hidden"},[g]:{exposure:"event"},[m]:{exposure:"event"},[b]:{exposure:"event"},[y]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[C]:{exposure:"hidden"},[O]:{exposure:"event"},[E]:{exposure:"event",shouldSkipFromEventProperties:t=>ri(t)},$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"},[I]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden"},[M]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden",storageGroup:"flags"},[N]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[L]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden"},[U]:{exposure:"hidden"},[B]:{exposure:"hidden"},[z]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"surveys"},[V]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[W]:{exposure:"event"},[G]:{exposure:"hidden"},[J]:{exposure:"hidden"},[K]:{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"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[H]:{exposure:"event"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[k]:{exposure:"event"},[T]:{exposure:"event"},[P]:{exposure:"event"},[R]:{exposure:"event"},[ht]:{exposure:"event"},[ut]:{exposure:"event"},[dt]:{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"}},Jn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Kn=t=>{var i=Gn[t];if(i)return i;for(var e of Jn){var r=e[1];if(0===t.indexOf(e[0]))return r}},Yn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return zt(t)}},Qn=t=>{var i=null==$t?void 0:$t.createElement("a");return ti(i)?null:(i.href=t,i)},Xn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!Yt(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){ss.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");Yt(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},to=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},io=(t,i)=>t>=i&&At(),eo=(t,i,e,r)=>{if(0===t){if(At()){var s=i+1;return s===e&&r(),s}return i}return 0},ro="https?://(.*)",so=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],no=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...so],oo="<masked>",ao=["li_fat_id"];function lo(t,i,e){if(!$t)return{};var r,s=i?[...so,...e||[]]:[],n=ho(Zn($t.URL,s,oo),t),o=(r={},as(ao,(function(t){var i=gs(t);r[t]=i||null})),r);return ls(o,n)}function ho(t,i){var e=no.concat(i||[]),r={};return as(e,(function(i){var e=Xn(t,i);r[i]=e||null})),r}function uo(t){var i=function(t){return t?0===t.search(ro+"google.([^/?]*)")?"google":0===t.search(ro+"bing.com")?"bing":0===t.search(ro+"yahoo.com")?"yahoo":0===t.search(ro+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!ri(i)){r.$search_engine=i;var s=$t?Xn($t.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function vo(){return navigator.language||navigator.userLanguage}var co="$direct";function fo(){return(null==$t?void 0:$t.referrer)||co}function po(t,i,e){void 0===e&&(e=!1);var r=t?[...so,...i||[]]:[],s=e?qe(null==Pt?void 0:Pt.href):null==Pt?void 0:Pt.href,n=null==s?void 0:s.substring(0,1e3);return{r:fo().substring(0,1e3),u:n?Zn(n,r,oo):void 0}}function _o(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?qe(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==co?co:null==(e=Qn(r))?void 0:e.host};if(n){o.$current_url=n;var a=Qn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=ho(n);ls(o,l)}if(r){var h=uo(r);ls(o,h)}return o}function go(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function mo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var bo={flags:Z,surveys:V},yo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],wo=t=>t+"_cookie_identity_change_pending",xo=t=>{var i="",e=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(e+s>1e3)break;i+=r,e+=s}return i},So="main",Eo=[I,F,M,D,N,Z,L,B],ko=t=>-1!==Eo.indexOf(t),To=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},$o=t=>{if(!t)return{};var i=JSON.parse(t);return Xt(i)?i:{}},Po=(t,i)=>{as(t,((e,r)=>{var s=Kn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class Ro{constructor(t,i,r){if(void 0===r&&(r=!0),this.sa={},this.aa=!1,this.oa=!1,this.la=!1,this.ua=!1,this.ha=!1,this.da=new Map,this.va=!1,this.ca=!1,this.fa=!1,this.pa=!1,this.ga=new Set,this.mn=t,this.ma=r,this.props={},this.ya=void 0,this.ba=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.Zs=this._a(t),this.la=this.wa(t),this.load(),this.ka(),t.debug&&ss.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save(),Et){var s=()=>this.flush();ps(Et,"beforeunload",s,{capture:!1}),ps(Et,"pagehide",s,{capture:!1}),this.Sa=t=>{if(this.aa&&(!t.storageArea||t.storageArea===(null==Et?void 0:Et.localStorage))&&t.key)if(t.key!==this.ba){if(this.la){var i=Wn.find((i=>t.key===this.xa(i)));i&&this.Ca(t.key,i)}}else this.Ca(t.key,So)},ps(Et,"storage",this.Sa)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var i=t[0],e=t[1],r=this.da.get(i);if(ko(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach((t=>s.add(t))),s.size&&this.Ta(i,s)}else this.Ta(i,!0)}))}onCrossTabFeatureFlagChange(t){return this.ga.add(t),()=>this.ga.delete(t)}destroy(){this.Sa&&Et&&(Et.removeEventListener("storage",this.Sa),this.Sa=void 0),this.ga.clear()}Ca(t,i,e){if(void 0===e&&(e=!0),this.Ma)return!1;var r,s;try{if(s=Cs.ai(t),ri(s)){var n=this.Ia(i);return n.storageValue=null,i!==So&&(n.persisted=!1),!1}r=$o(s)}catch(t){return!1}var o=i===So?r:Cs.ui(this.ba);if(o&&this.Ea(o))return!1;var a=this.Ra(r,i,e);return i===So&&this.la&&!To(this.Pa().main,r)||this.Aa(r,i,!0,s),a}Ea(t){var i=this.props[o],e=t[o];return!ti(i)&&!ti(e)&&i!==e}Aa(t,i,e,r){var s=this.Ia(i);s.storageValue=r,i!==So&&(s.persisted=e);try{s.fingerprint=this.Fa(t,i)}catch(t){s.fingerprint=void 0}}Ra(t,i,e){var r=!1;return Eo.forEach((e=>{var s,n=null==(s=Kn(e))?void 0:s.storageGroup;if(!(i===So&&this.la&&n||i!==So&&n!==i)){var o=e in t,a=this.Oa(e,o?t[e]:void 0),l=this.da.has(e)?e in this.props:o;l===e in this.props&&To(a,this.props[e])||(l?this.La(e,a,!1):this.Da(e,!1),r=!0)}})),r&&e&&this.ga.forEach((t=>t())),r}$a(){if(!this.aa)return!1;try{this.fa=!1;var t,i=Cs.ai(this.ba),e=this.Ia(So),r=!1,s=!1;if(i!==e.storageValue)if(ri(i))e.storageValue=null;else{if(t=$o(i),this.fa=!this.ca&&this.Ea(t),this.fa)return!1;s=this.Ra(t,So,!1),!this.la||To(this.Pa().main,t)?this.Aa(t,So,!0,i):e.storageValue=i,r=!0}return this.la&&Wn.forEach((i=>{var e=Cs.ai(this.xa(i)),n=this.Ia(i),o=t||{},a=r&&Eo.some((t=>{var e;return(null==(e=Kn(t))?void 0:e.storageGroup)===i&&t in o}));if(e!==n.storageValue||a){if(ri(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ra(o,i,!1)||s));var l=$o(e);s=this.Ra(l,i,!1)||s,this.Aa(l,i,!0,e)}})),s}catch(t){return!1}}Ta(t,i){this.da.set(t,i);var e=Kn(t);null!=e&&e.volatile||(this.Ia((this.la?null==e?void 0:e.storageGroup:void 0)||So).fingerprint=void 0,this.Na(t))}qa(){Eo.forEach((t=>this.da.set(t,!0)))}ka(){if(this.aa)try{var t=Cs.ai(this.ba),i=$o(t);this.Ia(So).storageValue=t,Eo.forEach((t=>{var e,r=this.la?null==(e=Kn(t))?void 0:e.storageGroup:void 0,s=r?Cs.ai(this.xa(r)):null;if(r){var n=this.Ia(r);n.storageValue=s,n.persisted=!ri(s)}var o=r&&!ri(s)?$o(s):i;t in this.props?this.ja(t,o[t],this.props[t]):t in o&&this.Ta(t,!0)}))}catch(t){}}Oa(t,i){var r=this.da.get(t);if(!r)return i;if(!0===r)return this.props[t];if(t===F){var s=new Set(Yt(i)?i:[]),n=new Set(Yt(this.props[t])?this.props[t]:[]);return r.forEach((t=>n.has(t)?s.add(t):s.delete(t))),Array.from(s)}var o=Xt(i)?e({},i):{},a=Xt(this.props[t])?this.props[t]:{};return r.forEach((t=>{t in a?o[t]=a[t]:delete o[t]})),o}ja(t,i,e){if(ko(t)){var r=this.da.get(t);if(!0!==r){var s=i;if(this.aa)try{var n,o=this.la?null==(n=Kn(t))?void 0:n.storageGroup:void 0,a=o?this.xa(o):this.ba;s=$o(Cs.ai(a))[t]}catch(t){}var l=new Set(r||[]);if(t===F){if(!ti(i)&&!Yt(i)||!ti(s)&&!Yt(s)||!Yt(e))return void this.Ta(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach((t=>{h.has(t)!==d.has(t)&&l.add(t)})),l.forEach((t=>{u.has(t)===d.has(t)&&l.delete(t)}))}else{if(!Xt(e))return void(To(s,e)?this.da.delete(t):this.Ta(t,!0));if(!ti(i)&&!Xt(i)||ti(i)&&Zt(e)&&ti(s))return void this.Ta(t,!0);var v=Xt(i)?i:{},c=Xt(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach((t=>{t in v==t in e&&To(v[t],e[t])||l.add(t)})),l.forEach((t=>{t in c==t in e&&To(c[t],e[t])&&l.delete(t)}))}l.size?this.Ta(t,l):this.da.delete(t)}}}Ba(){var t,i=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return ni(i)&&i>0?i:0}Ha(t){if(this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase())if(t)try{var i=Ds(t,this.mn.cookie_persisted_properties||[]),e=Ls(i,this.mn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ps.ai(this.ba)||void 0;s&&Us(this.ba,s)===r&&(this.za=r,this.Ua=s)}catch(t){}else try{var n=Ps.ai(this.ba)||void 0;this.za=n?Us(this.ba,n):void 0,this.Ua=n}catch(t){}}syncCookieProperties(){return this.Wa(this.mn)}Wa(t,i){if(void 0===i&&(i=!1),this.Ma&&!i||this.ha||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Ps.ai(this.ba)||void 0}catch(t){}if(!e||e===this.Ua)return!1;var r,s=Us(this.ba,e);try{r=Ms(JSON.parse(e))}catch(t){return!1}if((Ps.ai(this.ba)||void 0)!==e)return!1;this.za=s,this.Ua=e;var n=js(this.ba,e),a=[...Is,...n.properties],l={};if(Object.keys(r).forEach((t=>{var i=r[t];(ti(i)||ri(i)||""===i||t===tt&&i!==pt&&i!==_t)&&(l[t]=!0,delete r[t])})),Zt(r))return!1;var u=o in r||r[tt]===pt||r[tt]===_t,d=this.props,v=d[o],c=d[tt],f=ls({},d);[...Is,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==tt)){var i=f[t];!n.isValid&&-1!==Is.indexOf(t)&&(!1===i||0===i)||delete f[t]}})),this.props=ls(f,r),Eo.forEach((t=>{var i=t in this.props;t in d===i&&To(d[t],this.props[t])||(i?this.ja(t,d[t],this.props[t]):this.Ta(t,!0))})),!u||tt in r||tt in this.props||this.La(tt,pt);var p=this.props[o],_=this.props[tt];return!u||p===v&&_===c||(this.ca=!0,this.ua=!0,qs.ni(wo(this.ba),!0),this.Da(B),this.Da(F),this.Da(I),this.Da(M),this.Da(D),this.Da(N),this.Da(Z),this.Da(X),this.Da(Y),_===pt&&(c===_t||r[tt]===pt||!ti(v)&&p!==v)&&(Po(this.props,r),this.Da(z)),_===_t?this.props.$user_id=p:delete this.props.$user_id,this.Da(h)),!0}consumeCookieIdentityChange(){var t=wo(this.ba),i=this.ua||!!qs.ai(t);return this.ua=!1,i&&qs.oi(t),i}Va(t){return void 0===t&&(t=!1),!(this.ha||this.Ma&&!t||!this.mn.cookieWinsOnConflict||"localstorage+cookie"!==this.mn.persistence.toLowerCase()||(this.ha=!0,0))}Ga(){this.ha&&(ti(this.Za)||(clearTimeout(this.Za),this.Za=void 0),delete this.sa[So],this.Qa(!0))}Ja(t){if(void 0===t&&(t=!0),this.ha)try{t?this.Ga():ti(this.Za)||(clearTimeout(this.Za),this.Za=void 0)}finally{this.ha=!1}}isDisabled(){return!!this.Ma}_a(t){-1===yo.indexOf(t.persistence.toLowerCase())&&(ss.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,r=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var r=[...Is,...t];return e({},Cs,{ui(t){try{var e,s={};try{e=Ps.ai(t)||void 0,s=e?Ms(JSON.parse(e)):{}}catch(t){}var n,a=JSON.parse(Cs.ai(t)||"{}");if(i){var l=js(t,e),h=[...Is,...l.properties],u={};Object.keys(s).forEach((t=>{var i=s[t];ri(i)||""===i||t===tt&&i!==pt&&i!==_t||(u[t]=i)}));var d=o in u||u[tt]===pt||u[tt]===_t;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[tt])&&void 0!==v?v:pt;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==tt)){var i=a[t];!l.isValid&&-1!==Is.indexOf(t)&&(!1===i||0===i)||delete a[t]}})),!d||tt in s||tt in a||(a[tt]=pt),!d||(o in u?u[o]:a[o])===c&&(tt in u?u[tt]:a[tt])===f||(Os.forEach((t=>delete a[t])),u[tt]===_t&&o in u?a.$user_id=u[o]:delete a.$user_id,u[tt]!==_t&&(delete a[H],delete a[z]),delete a.__alias)}n=ls(a,u)}else n=ls(s,a);return Cs.ni(t,n),n}catch(t){}return null},ni(e,r,s,n,o,a){var l=Cs.ni(e,r,void 0,void 0,a);try{var h=Ds(r,t);if(Object.keys(h).length){if(i){var u=Fs(e),d=Ls(h,t);if(Ps.ni(u,d,s,n,o,a),Ps.ai(u)!==JSON.stringify(d)){Ps.oi(u,n);var v=Ds(r);return Ps.ni(e,v,s,n,o,a),l}}Ps.ni(e,h,s,n,o,a)}}catch(t){Cs.si(t)}return l},oi(t,i){try{null==Et||Et.localStorage.removeItem(t),Ps.oi(t,i),Ps.oi(Fs(t),i)}catch(t){Cs.si(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&Cs.ii()?(i=Cs,n=!0):"localstorage+cookie"===a&&r.ii()?(i=r,n=!0,s=!0):"sessionstorage"===a&&qs.ii()?i=qs:"memory"===a?i=zs:"cookie"===a&&Ps.ii()?(i=Ps,s=!0):r.ii()?(i=r,n=!0,s=!0):Ps.ii()?(i=Ps,s=!0):i=zs,this.aa=n,this.oa=s,i}xa(t){return this.ba+"__"+t}wa(t){return this.aa&&!!t.split_storage}properties(){var t={};return as(this.props,((i,e)=>{var r=Kn(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.Ma||t){var i=this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase(),e=i?Cs.ui(this.ba):null,r={};if(i)try{as(r=Ms(Ps.ui(this.ba)),((t,i)=>{(ti(t)||ri(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.Zs.ui(this.ba);if(s&&(this.props=ls({},s)),this.la&&this.Ka(),i&&s){var n,a,l=null==e?void 0:e[o],h=null!==(n=null==e?void 0:e[tt])&&void 0!==n?n:pt,u=s[o],d=null!==(a=s[tt])&&void 0!==a?a:pt;if(u!==l||d!==h){this.ua=!0,qs.ni(wo(this.ba),!0);var v=ls({},this.props);Os.forEach((t=>delete v[t])),d===pt&&(h===_t||r[tt]===pt||!ti(l)&&u!==l)&&(Po(v,r),delete v[z]),this.props=v;var c=new Set;Os.forEach((t=>{var i,e=null==(i=Kn(t))?void 0:i.storageGroup;e&&c.add(e)})),c.forEach((t=>{var i={};as(this.props,((e,r)=>{var s;(null==(s=Kn(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),Zt(i)?(Cs.oi(this.xa(t)),this.sa[t]={}):Cs.ni(this.xa(t),i)&&(this.sa[t]={persisted:!0,fingerprint:this.Fa(i,t)})}))}}qs.ai(wo(this.ba))&&(this.ua=!0)}}Ka(){for(var t of Wn){var i=Cs.ui(this.xa(t));if(i&&!Zt(i)){var e=this.Ia(t);e.persisted=!0,this.Ya(t)||(e.fingerprint=this.Fa(i,t)),this.Xa(t,i)||ls(this.props,i)}}}Ya(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Kn(i))?void 0:e.storageGroup)===t}))}Xa(t,i){var e=bo[t];if(!e)return!1;var r=i[e],s=this.props[e];return ni(r)&&ni(s)&&s>r}refreshKey(t){var i;if(!(this.Ma||t===d&&this.pa)){var e=this.la?null==(i=Kn(t))?void 0:i.storageGroup:void 0,r=e?Cs.ui(this.xa(e)):this.Zs.ui(this.ba);if(r&&t in r)this.La(t,r[t],!1);else{if(e){var s=this.Zs.ui(this.ba);if(s&&t in s)return void this.La(t,s[t],!1)}this.Da(t,!1)}}}save(){if(!this.Ma){var t=this.Ba();t>0?ti(this.Za)&&(this.Za=setTimeout((()=>{this.Za=void 0,this.Qa()}),t)):this.Qa()}}flush(){ti(this.Za)||(clearTimeout(this.Za),this.Za=void 0,this.Qa())}Qa(t){if(void 0===t&&(t=!1),!(this.Ma||this.ha&&!t)){t||(this.syncCookieProperties(),this.pa||this.mn.cookieWinsOnConflict&&"localstorage+cookie"===this.mn.persistence.toLowerCase()||this.refreshKey(d));var i=!t&&!this.va;i||(this.fa=!1);var e=!!i&&this.$a();if(this.fa)this.mn.debug&&ss.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.la)return this.eo(),void(e&&this.ga.forEach((t=>t())));var r=this.io(this.Zs,this.ba,this.props,So);"written"===r&&this.Ha(this.props),"failed"!==r&&(this.da.clear(),this.ca=!1,this.pa=!1),e&&this.ga.forEach((t=>t()))}}}eo(){var t=this,i=this.Pa(),e=i.main,r=i.groups,s=this.io(this.Zs,this.ba,e,So);"written"===s&&this.Ha(e),"failed"!==s&&(this.ca=!1,this.pa=!1,Eo.forEach((t=>{var i;null!=(i=Kn(t))&&i.storageGroup||this.da.delete(t)})));var n=function(i){var e,s=r[i];if(Zt(s)&&(null==(e=t.sa[i])||!e.persisted))return Eo.forEach((e=>{var r;(null==(r=Kn(e))?void 0:r.storageGroup)===i&&t.da.delete(e)})),1;var n=t.io(Cs,t.xa(i),s,i);"failed"!==n&&Eo.forEach((e=>{var r=Kn(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.da.delete(e)}))};for(var o of Wn)n(o)}Pa(){var t={},i={flags:{},surveys:{}};return as(this.props,((e,r)=>{var s,n=null==(s=Kn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Fa(t,i){if(i===So)return JSON.stringify(t)+"|"+this.ro+"|"+this.no+"|"+this.so;var e={};return as(t,((t,i)=>{var r;e[i]=null!=(r=Kn(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}io(t,i,e,r){var s,n=this.Ia(r);if(r!==So&&!n.dirty&&!ti(n.fingerprint))return"skipped";try{if((s=this.Fa(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ni(i,e,this.ro,this.no,this.so,this.mn.debug)?(n.dirty=!1,r!==So&&(n.persisted=!0),ti(s)||(n.fingerprint=s),this.aa&&(n.storageValue=Cs.ai(i)),"written"):(this.mn.debug&&ss.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.qa(),ti(this.Za)||(clearTimeout(this.Za),this.Za=void 0),this.Zs.oi(this.ba,!1),this.Zs.oi(this.ba,!0),!e&&this.ma)for(var r of Wn)Cs.oi(this.xa(r));e?delete this.sa[So]:this.sa={},this.za=void 0,this.Ua=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(Xt(t)){this.syncCookieProperties(),ti(i)&&(i="None"),this.ro=ti(e)?this.ao:e;var r=!1;if(as(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.La(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(Xt(t)){this.syncCookieProperties(),this.ro=ti(i)?this.ao:i;var e=!1;if(as(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||Xt(i)||Yt(i))&&(this.La(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Da(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==$t?void 0:$t.URL;if(t!==this.ya){var i=lo(this.mn.custom_campaign_params,this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties),e=!Zt(vs(i));return e&&this.register(i),this.ya=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==$t?void 0:$t.referrer)?uo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:fo(),$referring_domain:null!=$t&&$t.referrer&&(null==(t=Qn($t.referrer))?void 0:t.host)||co},void 0)}set_initial_person_info(){if(!this.props[rt]&&!this.props[st]){var t=po(this.mn.mask_personal_data_properties,this.mn.custom_personal_data_properties,this.mn.disable_capture_url_hashes);this.register_once({[nt]:this.oa?{r:xo(t.r),u:t.u?xo(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};as([st,rt],(i=>{var e=this.props[i];e&&as(e,(function(i,e){t["$initial_"+Bt(e)]=i}))}));var i=this.props[nt];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=_o(t,i),r={};return as(e,(function(t,i){r["$initial_"+Bt(i)]=t})),r}(i,this.mn.disable_capture_url_hashes);ls(t,e)}return t}safe_merge(t){return as(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,r){var s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.Ma&&!l;l||this.Wa(i,h),this.mn=t,!l&&(s||n||a)&&(this.za=void 0,this.Ua=void 0,this.Wa(e({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this._a(t):this.Zs;this.oo();var d=this.wa(t),v=o||d!==this.la,c=!l&&(v||t.cross_subdomain_cookie!==this.no||t.secure_cookie!==this.so)&&this.Va(h);this.va=v;try{if(this.ao=this.ro=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.Zs=u,this.la=d,this.props=f,this.save()}else a&&(this.Zs=u,l||(delete this.sa[So],this.Qa()))}finally{this.va=!1,c&&this.Ja()}}oo(){var t=this.props[nt];if(this.oa&&Xt(t)&&"string"==typeof t.r){var i=xo(t.r),r="string"==typeof t.u?xo(t.u):t.u;i===t.r&&r===t.u||this.La(nt,e({},t,{r:i,u:r}))}}set_disabled(t){this.Ma=t,this.Ma?this.remove():this.save()}set_cross_subdomain(t){t!==this.no&&(this.no=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.so&&(this.so=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[v]||{};e[t]=i,this.La(v,e),this.save()}remove_event_timer(t){var i=this.props[v]||{},e=i[t];return ti(e)||(delete i[t],this.La(v,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.La(t,i),this.save()}La(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&(t!==o&&t!==tt||s===i||(this.ca=!0),t!==d||To(s,i)||(this.pa=!0),this.ja(t,s,i),null!=(r=Kn(t))&&r.volatile||this.Na(t))}Da(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(ko(t)&&this.Ta(t,!0),t===d&&(this.pa=!0),this.Na(t))}Na(t){var i,e=null==(i=Kn(t))?void 0:i.storageGroup;e&&(this.Ia(e).dirty=!0)}Ia(t){return this.sa[t]||(this.sa[t]={})}}var Co={GZipJS:"gzip-js",Base64:"base64"},Oo={Activation:"events",Cancellation:"cancelEvents"},Io={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Fo={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ao={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Mo={Popover:"popover",Inline:"inline"};function Do(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&Qt(e.then)&&e.then(void 0,(()=>{}))}}}}var No={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Lo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},jo=ns("[RateLimiter]");class Uo{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{jo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void jo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(et))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(ni(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.lo(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(et,a),{isRateLimited:l,remainingTokens:a.tokens}}uo(t){var i=this.instance.config.property_denylist;return!Yt(i)||!i.includes(t)}ho(){var t;if(this.uo("$current_url")&&this.uo("$pathname")&&null!=Pt&&Pt.pathname)return""+(null!==(t=Pt.origin)&&void 0!==t?t:"")+Pt.pathname}lo(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ho(),o=this.uo("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Bo=ns("[RemoteConfig]");class zo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}do(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vo(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Bo.info("Using preloaded remote config",this.remoteConfig),void this.co(this.remoteConfig);if(this._instance.fo())return void Bo.warn("Remote config is disabled. Falling back to local config.");this.do((t=>{if(!t)return Bo.info("No config found after loading remote JS config. Falling back to JSON."),void this.vo((t=>{this.co(t.json,t)}));this.co(t)}))}catch(t){Bo.error("Error loading remote config",t),this.co()}}co(t,i){!t&&i&&(0===i.statusCode?i.error||Bo.warn("Failed to fetch remote config from PostHog."):Bo.error("Failed to fetch remote config from PostHog."));try{this._instance.co(t?{ok:!0,config:t}:{ok:!1})}catch(t){Bo.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Bo.error("Error loading feature flags",t)}}}var Ho=Uint8Array,qo=Uint16Array,Vo=Uint32Array,Wo=new Ho([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]),Go=new Ho([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]),Jo=new Ho([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ko=function(t,i){for(var e=new qo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Vo(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Yo=Ko(Wo,2),Qo=Yo[1];Yo[0][28]=258,Qo[258]=28;for(var Xo=Ko(Go,0)[1],Zo=new qo(32768),ta=0;32768>ta;++ta){var ia=(43690&ta)>>>1|(21845&ta)<<1;Zo[ta]=((65280&(ia=(61680&(ia=(52428&ia)>>>2|(13107&ia)<<2))>>>4|(3855&ia)<<4))>>>8|(255&ia)<<8)>>>1}var ea=function(t,i,e){for(var r=t.length,s=0,n=new qo(i);r>s;++s)++n[t[s]-1];var o,a=new qo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new qo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Zo[d]>>>l]=h}else for(o=new qo(r),s=0;r>s;++s)o[s]=Zo[a[t[s]-1]++]>>>15-t[s];return o},ra=new Ho(288);for(ta=0;144>ta;++ta)ra[ta]=8;for(ta=144;256>ta;++ta)ra[ta]=9;for(ta=256;280>ta;++ta)ra[ta]=7;for(ta=280;288>ta;++ta)ra[ta]=8;var sa=new Ho(32);for(ta=0;32>ta;++ta)sa[ta]=5;var na=ea(ra,9,0),oa=ea(sa,5,0),aa=function(t){return(t/8>>0)+(7&t&&1)},la=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof qo?qo:t instanceof Vo?Vo:Ho)(e-i);return r.set(t.subarray(i,e)),r},ha=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},ua=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},da=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Ho(0),0];if(1==s){var o=new Ho(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new qo(v+1),f=va(e[u-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=g-(1<<f-c[m]),c[m]=i}for(p>>>=_;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Ho(c),f]},va=function(t,i,e){return-1==t.s?Math.max(va(t.l,i,e+1),va(t.r,i,e+1)):i[t.s]=e},ca=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new qo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},fa=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},pa=function(t,i,e){var r=e.length,s=aa(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},_a=function(t,i,e,r,s,n,o,a,l,h,u){ha(i,u++,e),++s[256];for(var d=da(s,15),v=d[0],c=d[1],f=da(n,15),p=f[0],_=f[1],g=ca(v),m=g[0],b=g[1],y=ca(p),w=y[0],x=y[1],S=new qo(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=da(S,7),T=k[0],P=k[1],R=19;R>4&&!T[Jo[R-1]];--R);var C,O,I,F,A=h+5<<3,M=fa(s,ra)+fa(n,sa)+o,D=fa(s,v)+fa(n,p)+o+14+3*R+fa(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(M>=A&&D>=A)return pa(i,u,t.subarray(l,l+h));if(ha(i,u,1+(M>D)),u+=2,M>D){C=ea(v,c,0),O=v,I=ea(p,_,0),F=p;var N=ea(T,P,0);for(ha(i,u,b-257),ha(i,u+5,x-1),ha(i,u+10,R-4),u+=14,E=0;R>E;++E)ha(i,u+3*E,T[Jo[E]]);u+=3*R;for(var L=[m,w],j=0;2>j;++j){var U=L[j];for(E=0;U.length>E;++E)ha(i,u,N[B=31&U[E]]),u+=T[B],B>15&&(ha(i,u,U[E]>>>5&127),u+=U[E]>>>12)}}else C=na,O=ra,I=oa,F=sa;for(E=0;a>E;++E)if(r[E]>255){var B;ua(i,u,C[257+(B=r[E]>>>18&31)]),u+=O[B+257],B>7&&(ha(i,u,r[E]>>>23&31),u+=Wo[B]);var z=31&r[E];ua(i,u,I[z]),u+=F[z],z>3&&(ua(i,u,r[E]>>>5&8191),u+=Go[z])}else ua(i,u,C[r[E]]),u+=O[r[E]];return ua(i,u,C[256]),u+O[256]},ga=new Vo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ma=function(){for(var t=new Vo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ba=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ya(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=ma[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Ho(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=pa(l,h,t.subarray(u,d)):(l[u]=!0,h=pa(l,h,t.subarray(u,o)))}else{for(var v=ga[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,_=new qo(32768),g=new qo(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Vo(25e3),x=new qo(288),S=new qo(32),E=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=y(u),O=32767&u,I=g[C];if(_[O]=I,g[C]=O,u>=P){var F=o-u;if((E>7e3||T>24576)&&F>423){h=_a(t,l,0,w,x,S,k,T,R,u-R,h),T=E=k=0,R=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var M=2,D=0,N=f,L=O-I&32767;if(F>2&&C==y(u-L))for(var j=Math.min(c,F)-1,U=Math.min(32767,u),B=Math.min(258,F);U>=L&&--N&&O!=I;){if(t[u+M]==t[u+M-L]){for(var z=0;B>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(A=0;H>A;++A){var V=u-L+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,I=V)}}}L+=(O=I)-(I=_[O])+32768&32767}if(D){w[T++]=268435456|Qo[M]<<18|Xo[D];var G=31&Qo[M],J=31&Xo[D];k+=Wo[G]+Go[J],++x[257+G],++S[J],P=u+M,++E}else w[T++]=t[u],++x[t[u]]}}h=_a(t,l,!0,w,x,S,k,T,R,u-R,h)}return la(a,0,r+aa(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&ba(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),ba(h,u-8,e.d()),ba(h,u-4,r),h}var wa=!!Ct||!!Rt,xa="text/plain",Sa=!1,Ea=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},ka=function(t,i,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=e({},i),h=null!==(s=null==a?void 0:a.split("&").map((t=>{var i,e=t.split("="),s=e[0],n=r&&null!==(i=l[s])&&void 0!==i?i:e[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return as(t,(function(t,i){ti(t)||ti(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},Ta=t=>{if(t.po)return t.po;var i=t.data,e=t.compression;if(i){if(e===Co.GZipJS){var r=ya(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Ho(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Ho(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return la(r,0,s)}(Yn(i)),{mtime:0});return{contentType:xa,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Co.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(Yn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Yn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Yn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},$a=t=>{var i,r,s=()=>"sendBeacon"===t.transport?{url:ka(t.url,{compression:Co.Base64}),encodedBody:Ta(e({},t,{compression:Co.Base64,po:void 0}))}:{url:Ea(t.url,"compression"),encodedBody:Ta(e({},t,{compression:void 0,po:void 0}))};try{i=Ta(t)}catch(i){if(Ir(t.compression,Xn(t.url,"compression")))return ss.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&Ir(t.compression,Xn(t.url,"compression"))&&!((r=i.body)instanceof ArrayBuffer?Or(new Uint8Array(r)):ArrayBuffer.isView(r)&&Or(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Sa=!0,s()):{url:t.url,encodedBody:i}},Pa=t=>{try{return $a(t)}catch(i){return ss.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Ra=function(){var t=i((function*(t){var i=Yn(t.data),r=yield function(t,i,e){return Dr.apply(this,arguments)}(i,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return e({},t,{po:{contentType:xa,body:n,estimatedSize:n.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),Ca=/Failed to fetch|NetworkError|Load failed/i,Oa=t=>"TypeError"===(null==t?void 0:t.name)&&Ca.test((null==t?void 0:t.message)||""),Ia=t=>{var i=Pa(t);if(i){var r=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;as(t.headers,(function(t,i){h.append(i,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Ot){var v=new Ot;u={signal:v.signal,timeout:setTimeout((()=>{var i;d=!0,v.abort(He("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))}),t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Oa(i)?ss.warn(i):ss.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Rt(r,e({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.mo&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){ss.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},Fa=t=>{try{var i,r=$a(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(Tt.sendBeacon(s,h))return;var u=Yt(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(Yt(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>Yt(t.data)?i:e({},t.data,{batch:i});return Fa(e({},t,{data:v(u.slice(0,d))})),void Fa(e({},t,{data:v(u.slice(d))}))}ss.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ia(e({},t,{mo:!0}))}catch(t){ss.warn("Beacon send failed",t)}},Aa=(t,i,r,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return ka(r===Co.GZipJS?Ea(t,"compression"):t,e({},n?{[n]:Date.now().toString()}:{},r===Co.GZipJS?{}:{compression:r}))},Ma=[];Rt&&Ma.push({transport:"fetch",method:Ia}),Ct&&Ma.push({transport:"XHR",method(t){var i=Pa(t);if(i){var e=new Ct,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;as(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=Tt&&Tt.sendBeacon&&Ma.push({transport:"sendBeacon",method:Fa});var Da=3e3;class Na{constructor(t,i){this.yo=!0,this.bo=[],this._o=bi((null==i?void 0:i.flush_interval_ms)||Da,250,5e3,ss.createLogger("flush interval"),Da),this.wo=t}enqueue(t){this.bo.push(t),this.ko||this.So()}unload(){this.xo();var t=this.bo.length>0?this.Co():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.To(e({},t,{transport:"sendBeacon"}))}))}enable(){this.yo=!1,this.So()}So(){var t=this;this.yo||(this.ko=setTimeout((()=>{if(this.xo(),this.bo.length>0){var i=this.Co(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&Yt(e.data)&&as(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.To(e)};for(var r in i)e()}}),this._o))}To(t){try{this.wo(t)}catch(t){ss.error(t)}}xo(){clearTimeout(this.ko),this.ko=void 0}Co(){var t={};return as(this.bo,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;ti(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.bo=[],t}}var La=["retriesPerformedSoFar"];class ja{constructor(t){this.Mo=!1,this.Io=3e3,this.bo=[],this._instance=t,this.bo=[],this.Eo=!0,!ti(Et)&&"onLine"in Et.navigator&&(this.Eo=Et.navigator.onLine,this.Ro=()=>{this.Eo=!0,this.Po()},this.Ao=()=>{this.Eo=!1},ps(Et,"online",this.Ro),ps(Et,"offline",this.Ao))}get length(){return this.bo.length}retriableRequest(t){var i=t.retriesPerformedSoFar,s=r(t,La);oi(i)&&(s.url=ka(s.url,{retry_count:i})),this._instance._send_request(e({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.os(e({retriesPerformedSoFar:i},s));0===t.statusCode&&ss.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=i?i:0)+" retries.")}null==s.callback||s.callback(t)}}))}os(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.bo.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),ss.warn(s),this.Mo||(this.Mo=!0,this.Fo())}Fo(){if(this.Oo&&clearTimeout(this.Oo),0===this.bo.length)return this.Mo=!1,void(this.Oo=void 0);this.Oo=setTimeout((()=>{this.Eo&&this.bo.length>0&&this.Po(),this.Fo()}),this.Io)}Po(){var t=Date.now(),i=[],e=this.bo.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.bo=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Oo&&(clearTimeout(this.Oo),this.Oo=void 0),this.Mo=!1,ti(Et)||(this.Ro&&(Et.removeEventListener("online",this.Ro),this.Ro=void 0),this.Ao&&(Et.removeEventListener("offline",this.Ao),this.Ao=void 0)),this.bo)){var i=t.requestOptions;try{this._instance._send_request(e({},i,{transport:"sendBeacon"}))}catch(t){ss.error(t)}}this.bo=[]}}class Ua{constructor(t){this.Lo=()=>{var t,i,e,r;this.Do||(this.Do={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Do.lastScrollY=Math.ceil(n),this.Do.maxScrollY=Math.max(n,null!==(t=this.Do.maxScrollY)&&void 0!==t?t:0),this.Do.maxScrollHeight=Math.max(o,null!==(i=this.Do.maxScrollHeight)&&void 0!==i?i:0),this.Do.lastContentY=a,this.Do.maxContentY=Math.max(a,null!==(e=this.Do.maxContentY)&&void 0!==e?e:0),this.Do.maxContentHeight=Math.max(l,null!==(r=this.Do.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get $o(){return this._instance.config.scroll_root_selector}getContext(){return this.Do}resetContext(){var t=this.Do;return setTimeout(this.Lo,0),t}startMeasuringScrollPosition(){ps(Et,"scroll",this.Lo,{capture:!0}),ps(Et,"scrollend",this.Lo,{capture:!0}),ps(Et,"resize",this.Lo)}scrollElement(){var t;if(!this.$o)return null==Et||null==(t=Et.document)?void 0:t.documentElement;var i=Yt(this.$o)?this.$o:[this.$o];for(var e of i){var r,s=null==Et||null==(r=Et.document)?void 0:r.querySelector(e);if(s)return s}}No(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.$o){var s=this.scrollElement();return s&&s[r]||0}return Et?"y"===t?Et.scrollY||Et.pageYOffset||(null==(i=Et.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:Et.scrollX||Et.pageXOffset||(null==(e=Et.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.No("y")}scrollX(){return this.No("x")}}var Ba=t=>po(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class za{constructor(t,i,e,r){this.Tt=t=>{var i=this.qo();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.jo(this._instance)};this.Bo.register({[it]:e})}},this._instance=t,this.Ho=i,this.Bo=e,this.jo=r||Ba,this.Ho.onSessionId(this.Tt)}qo(){return this.Bo.props[it]}getSetOnceProps(){var t,i=null==(t=this.qo())?void 0:t.props;return i?"r"in i?_o(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return as(vs(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+Bt(e)]=i})),t}}class Ha{on(t,i){return this.zo[t]||(this.zo[t]=[]),this.zo[t].push(i),()=>{this.zo[t]=this.zo[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.zo[t]||[])e(i);for(var r of this.zo["*"]||[])r(t,i)}constructor(){this.zo={}}}var qa=ns("[SessionId]"),Va=864e5;class Wa{on(t,i){return this.Uo.on(t,i)}constructor(t,i,e){var r;if(this.Wo=null,this.Vo=null,this.Go=[],this.Zo=void 0,this.Qo=!1,this.Uo=new Ha,this.Jo=(t,i)=>!(!oi(t)||!oi(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ft)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.mn=t.config,this.Bo=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Ko=void 0,this._sessionActivityTimestamp=null,this.Yo=i||Ss,this.Xo=e||Ss;var s=this.mn.persistence_name||this.mn.token;if(this._sessionTimeoutMs=1e3*bi(this.mn.session_idle_timeout_seconds||1800,60,36e3,qa.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.tl(),this.el="ph_"+s+"_window_id",this.il="ph_"+s+"_primary_window_exists",this.rl()){var n=qs.ui(this.el),o=qs.ui(this.il);n&&!o?this.It=n:qs.oi(this.el),qs.ni(this.il,!0)}null!=(r=this.mn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.mn.bootstrap.sessionID),this.nl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ti(this.Go)&&(this.Go=[]),this.Go.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.Go=this.Go.filter((i=>i!==t))}}rl(){return"memory"!==this.mn.persistence&&!this.Bo.Ma&&qs.ii()}sl(t){t!==this.It&&(this.It=t,this.rl()&&qs.ni(this.el,t))}al(){return this.It?this.It:this.rl()?qs.ui(this.el):null}ol(t){var i=this.Wo;return!ri(i)&&!ri(t)&&5e3>Math.abs(t-i)}ll(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Pe||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Pe=t,s&&!r||s&&this.ol(i)||(this.Wo=i,this.Bo.register({[C]:[i,t,e]}))}ul(){var t,i=null==(t=this.mn)?void 0:t.persistence_save_debounce_ms;return oi(i)&&i>0}hl(){this.ul()?this.Bo.refreshKey(C):(this.Bo.flush(),this.Bo.load())}dl(){var t;if(!ri(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Wo){this.hl();var i=this.vl();i[1]===this.Pe&&i[2]===this._sessionStartTimestamp&&(this.Wo=this._sessionActivityTimestamp,this.Bo.register({[C]:[this._sessionActivityTimestamp,null!==(t=this.Pe)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Bo.flush())}}cl(){var t=this.vl()[0],i=oi(t)?t:0,e=oi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}fl(t){return this.hl(),this.Jo(t,this.cl())}vl(){var t=this.Bo.props[C];return Yt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Wo=null,this.Ko=void 0,clearTimeout(this.pl),this.pl=void 0,this.ll(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void qa.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void qa.error("Invalid sessionID in bootstrap",t)}}(t);return!ti(e)&&(i?this.Ko={sessionId:t,sessionStartTimestamp:e}:this.ll(t,(new Date).getTime(),e),!0)}destroy(){this.Qo=!0,this.dl(),clearTimeout(this.pl),this.pl=void 0,this.Zo&&Et&&(Et.removeEventListener(bt,this.Zo,{capture:!1}),this.Zo=void 0),this.Go=[]}nl(){this.Zo=()=>{this.dl(),this.rl()&&qs.oi(this.il)},ps(Et,bt,this.Zo,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.mn.cookieless_mode===ft)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Pe;if(e)this.Vo=r;else if(ri(this.Vo)||this.Vo>r||r-this.Vo>=1e3){var n,o;null==(n=(o=this.Bo).syncCookieProperties)||n.call(o),this.Vo=r}var a=this.vl(),l=a[1],h=a[2],u=!ti(s)&&l!==s,d=this.cl(),v=this.al(),c=this.Ko,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Va),p=c?f:oi(h)&&Math.abs(r-h)>Va,_=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.Jo(r,d);if(y){(y=this.fl(r))||qa.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.vl();l=w[1],h=w[2]}if(m||y||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.Yo(),v=this.Xo(),qa.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Ko=void 0,_=!0}else v||(v=this.Xo(),_=!0),(g=g||l!==b)&&(qa.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var S=oi(d)&&t&&!p?d:r,E=oi(h)?h:(new Date).getTime();this.sl(v),this.ll(l,S,E),t||this.tl();var k={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.Go.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k:void 0,lastActivityTimestamp:d}}tl(){this.Qo||(clearTimeout(this.pl),this.pl=setTimeout((()=>{if(!this.Qo)if(this.fl((new Date).getTime())){var t=this.Pe;this.resetSessionId(),this.Uo.emit("forcedIdleReset",{idleSessionId:t})}else this.tl()}),1.1*this.sessionTimeoutMs))}}var Ga=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&Lt(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Lt(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Ja(){return(Ja=i((function*(){var t=null==Tt?void 0:Tt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return ii(e)&&e.length>0?e:void 0}catch(t){return void ss.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ka(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Ya=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},Qa=t=>t.toLowerCase(),Xa={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Ya(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Ya(i,t))))),icontains:(t,i)=>i.map(Qa).some((i=>t.map(Qa).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Qa).every((i=>t.map(Qa).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))};function Za(t,i){return!t||Object.entries(t).every((t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Xa[e.operator];return!!s&&s(e.values,[String(r)])}))}function tl(t,i,e){return Yn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var il="custom",el="i.posthog.com",rl=/^\/static\//,sl=["/s/","/e/","/i/"];class nl{constructor(t){this.gl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+el,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}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":il),this.gl[this.apiHost]}ml(t){if(rl.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}yl(t){var i=Qn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}bl(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Qn(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&sl.some((t=>0===i.indexOf(t)))){var a=this.yl(r);if(a){var l,h=this.apiHost,u=this._l;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this._l=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this._l,e=this.yl(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.bl(t,i,this.uiHost+i);if("flags"===t)return this.bl(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.ml(i);if(e)return this.bl(t,i,""+e+i)}if(this.region===il)return this.bl(t,i,this.apiHost+i);var r=el+i;switch(t){case"assets":return this.bl(t,i,"https://"+this.region+"-assets."+r);case"api":return this.bl(t,i,"https://"+this.region+"."+r)}}}var ol=ns("[Surveys]"),al="seenSurvey_",ll=t=>{try{var i=(t=>((t,i)=>""+al+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){ol.error("Failed to persist survey seen state",t)}},hl=[Io.Popover,Io.Widget,Io.API],ul={ignoreConditions:!1,ignoreDelay:!1,displayType:Mo.Popover},dl=ns("[PostHog ExternalIntegrations]"),vl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class cl{constructor(t){this._instance=t}Ys(t,i){var e;null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return dl.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=Dt.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.Ys(vl[n],(()=>{var i;null==(i=Dt.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=Dt.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Dt.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class fl{constructor(t,i){this.A=t,this.Ns=i,this.wl=new Map,this.Os=!1}add(t){var e=this;return i((function*(){if(e.Os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.wl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.wl.set(t.name,t);try{var i=t.setup(e.Ns);i&&(yield i)}catch(i){var r=e.wl.get(t.name)===t;r&&e.wl.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.kl(t)}}))()}getExtension(t){return this.wl.get(t)}dispose(){if(!this.Os){this.Os=!0;var t=Array.from(this.wl.values()).reverse();for(var i of(this.wl.clear(),t))this.kl(i)}}kl(t){try{var i=null==t.dispose?void 0:t.dispose();i&&Qt(i.then)&&i.then(void 0,(i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class pl{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);ti(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var _l="extensionsRemoteConfig";class gl{constructor(t){this.Os=!1,this.instance=t,this.A=ss,this.Sl=t.xl,this.kv=new pl(t),this.onEvent=t=>Do(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Os)return Do((()=>{}));var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Cl.on(_l,i);return this.Sl&&i(this.Sl),Do(e)},this.Tl=new fl(ss.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(a))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(a);return"string"==typeof t?t:void 0}get library(){return{name:s.LIB_NAME,version:s.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Tl.add(t)}getExtension(t){return this.Tl.getExtension(t)}capture(t,e,r){var s=this;return i((function*(){r?s.instance.capture(t,e,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Do(this.instance.Ml(t))}handleRemoteConfig(t){this.Os||(this.Sl=t,this.instance.Cl.emit(_l,t))}sendRequest(t,e){var r=this;return i((function*(){var i;void 0===e&&(e={});var s=r.instance.requestRouter.endpointFor(null!==(i=e.target)&&void 0!==i?i:"api",t),n={method:e.method,url:e.query?ka(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?qt.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.Os||(this.Os=!0,this.Tl.dispose())}}var ml={},bl=0,yl=()=>{},wl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',xl="Surveys module not available",Sl="sanitize_properties is deprecated. Use before_send instead",El="Invalid value for property_denylist config: ",kl=/^[A-Za-z0-9_-]{1,400}$/,Tl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,$l=["token","distinct_id",lt],Pl="posthog",Rl=!wa&&-1===(null==Ft?void 0:Ft.indexOf("MSIE"))&&-1===(null==Ft?void 0:Ft.indexOf("Mozilla")),Cl=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},Ol=t=>{var i;return e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:fs(null==$t?void 0:$t.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:yl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Pt&&ii(null==Pt?void 0:Pt.search)&&-1!==Pt.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==Et||null==(i=Et.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){ss.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:gt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Da},error_tracking:{},_onCapture:yl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:pn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Cl(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||"unset"===t||"2026-08-29">t)}))(t))},Il=[["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"]],Fl=t=>{var i={};for(var e of Il){var r=e[0],s=e[1];ti(t[r])||(i[s]=t[r])}var n=ls({},i,t),o=t.__preview_external_dependency_versioned_paths;return ti(o)||(ti(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ii(o)&&ti(t.asset_host)&&(n.asset_host=o)),Yt(t.property_blacklist)&&(ti(t.property_denylist)?n.property_denylist=t.property_blacklist:Yt(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ss.error(El+t.property_denylist)),n};class Al{constructor(){this.__forceAllowLocalhost=!1}get Il(){return this.__forceAllowLocalhost}set Il(t){ss.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Ml{El(t){if(t){var i=this.wl.indexOf(t);-1!==i&&this.wl.splice(i,1)}}Rl(t,i){return this.El(t),this.wl.push(i),null==i.initialize||i.initialize(),i}Pl(){return this.config.cookieless_mode===ft||this.config.cookieless_mode===ct&&this.consent.isRejected()}Al(){if(!this.Fl&&!this.config.segment&&!this.Pl()){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Ol||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Fl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+e)))}}Ll(){if(!this.Pl()&&this.get_distinct_id()===at){var t=this.persistence;if(t){this.Dl()||t.load(!0);var i=this.get_distinct_id();if(!i||i===at){var e=this.config.get_device_id(Ss());this.register({distinct_id:e,$device_id:e}),t.set_property(tt,pt)}this.$l()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Al,this.Nl=!1,this.version=s.LIB_VERSION,this.ql=new Set,this.jl="",this.Cl=new Ha,this.wl=[],this.Bl=[],this.Ol=!1,this.Fl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ol(),this.SentryIntegration=qn,this.sentryIntegration=t=>function(t,i){var e=Hn(t,i);return{name:zn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Hl=!1,this.zl=null,this.Ul=null,this.Wl=null,this.scrollManager=new Ua(this),this.pageViewManager=new Vn(this),this.rateLimiter=new Uo(this),this.requestRouter=new nl(this),this.consent=new Vs(this),this.externalIntegrations=new cl(this);var i=null!==(t=Ml.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=ii(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=ii(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>ss.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==Pl){var r,s=null!==(r=ml[e])&&void 0!==r?r:new Ml;return s._init(t,i,e),ml[e]=s,ml[Pl][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var n,o,a;void 0===i&&(i={});var h,u=ii(t)?t.trim():"";if(!u)return ss.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 u!==(null==(h=this.config)?void 0:h.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('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ol(i.defaults),i.debug=this.Vl(i.debug),this.Gl=i,this.Zl=[],i.person_profiles?this.Ul=i.person_profiles:i.process_person&&(this.Ul=i.process_person);var d=Ol(i.defaults),v=Fl(i),c=ls({},d,v,{name:r,token:u});Xt(d.rageclick)&&Xt(v.rageclick)&&(c.rageclick=ls({},d.rageclick,v.rageclick)),Xt(d.session_recording)&&Xt(v.session_recording)&&(c.session_recording=ls({},d.session_recording,v.session_recording)),this.set_config(c),this.config.on_xhr_error&&ss.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Co.GZipJS;var f=this.Dl();if(this.persistence=new Ro(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ro(e({},this.config,{persistence:"sessionStorage"}),f,!1),this.jl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&qs.ii()){var p=qs.ui(this.jl);Yt(p)&&p.forEach((t=>{ii(t)&&this.ql.add(t)}))}else qs.oi(this.jl);var _=e({},this.persistence.props),g=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ql=new Na((t=>this.Jl(t)),this.config.request_queue_config),this.Kl=new ja(this),this.__request_queue=[];var m=this.Pl();m||(this.sessionManager=new Wa(this),this.sessionPropsManager=new za(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Yl()}))),this.Xl(),this.config.__preview_deferred_init_extensions?(ss.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.tu(m)}),0)):(ss.info("Initializing extensions synchronously"),this.tu(m)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&ss.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:_,s:g}),!this.config.identity_distinct_id||null!=(n=i.bootstrap)&&n.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(o=i.bootstrap)?void 0:o.distinctID;if(this.Ol=!!b&&!ei(b),void 0!==(null==(a=i.bootstrap)?void 0:a.distinctID)){var y=i.bootstrap.distinctID,w=this.get_distinct_id(),x=this.persistence.get_property(tt);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&x===pt)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&x===_t)ss.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 S=this.config.get_device_id(Ss()),E=i.bootstrap.isIdentifiedID?S:y;this.persistence.set_property(tt,i.bootstrap.isIdentifiedID?_t:pt),this.register({distinct_id:y,$device_id:E})}}if(m)this.register_once({distinct_id:at,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Ss());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(tt,pt)}return ps(Et,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Bn(this,(()=>this.eu())):this.eu(),Qt(this.config._onCapture)&&this.config._onCapture!==yl&&(ss.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&ss.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 Ja.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(yl),this}iu(t){var i=t;return ii(i.name)&&Qt(i.setup)}ru(t,i){this.iu(t)?i.push((()=>{this.nu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((i=>{ss.error('Failed to dispose browser extension "'+t.name+'"',i)}))})):this.wl.push(t)}Xl(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=Ml.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.su)||r.call(this),this.su=void 0,this.featureFlags=new o(this)),Qt(this.featureFlags.onReloading)&&Qt(this.featureFlags.setup)?this.su||(this.su=this.featureFlags.onReloading((()=>{this.Cl.emit("featureFlagsReloading",!0)})),this.nu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}tu(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},Ml.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.wl.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i: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&&!t&&this.wl.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ru(this.autocapture=new u.autocapture(this),d),u.surveys&&this.ru(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.ru(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.wl.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.wl.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o: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,Ln)),u.toolbar&&this.wl.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.wl.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.wl.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.au){var t=this.au;this.au=void 0,this.wl.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ou(d,h)}ou(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ou(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){ss.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[ht]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ut]:r}),this.config.__preview_deferred_init_extensions&&ss.info("PostHog extensions initialized ("+r+"ms)")}co(t){var i;if(!$t||!$t.body)return ss.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.co(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.au=t),this.xl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=jt(r.supportedCompression,Co.GZipJS)?Co.GZipJS:jt(r.supportedCompression,Co.Base64)?Co.Base64:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Ul?this.Ul:gt}),null==(i=this.lu)||i.handleRemoteConfig(t),this.wl.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}eu(){try{this.config.loaded(this)}catch(t){ss.critical("`loaded` function failed",t)}if(this.uu(),this.config.internal_or_test_user_hostname&&null!=Pt&&Pt.hostname){var t=Pt.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Pl())&&this.hu()}),1),this.du=new zo(this),this.du.load()}uu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Ql)||t.enable())}_dom_loaded(){this.is_capturing()&&os(this.__request_queue,(t=>this.Jl(t))),this.__request_queue=[],this.uu()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.vu()&&this.capture(wt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Ql)||r.unload(),null==(s=this.Kl)||s.unload()):this.vu()&&this.capture(wt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Rl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=e({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(ti(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,r,s,n=e({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&ti(n.compression)&&n.data&&(n.compression=Co.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(Yt(o=n.data)?o:[o]).map((t=>e({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),Yt(t)?t.map((t=>e({},t,{sent_at:i}))):e({},t,{sent_at:i})}(n.data))),n.url=Aa(n.url,n.method,n.compression,n.timestampMode);var v=Ma.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Oa(t)?ss.warn(t):ss.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Co.GZipJS&&It&&"undefined"!=typeof Promise&&!Sa?Ra(n).then((t=>{f(t)})).catch((i=>{if(Fr(i))return Sa=!0,void f(e({},n,{compression:void 0,url:Aa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return Fr(t)||i===Cr})(i)&&(Sa=!0),f(n)})):c(n)})(e({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Jl(t){this.Kl?this.Kl.retriableRequest(t):this._send_request(t)}_execute_array(t){bl++;try{var i,e=[],r=[],s=[];os(t,(t=>{if(t)if(Yt(i=t[0]))s.push(t);else if(Qt(t))try{t.call(this)}catch(i){ss.error("Error executing queued PostHog call",t,i)}else Yt(t)&&"alias"===i?e.push(t):Yt(t)&&-1!==i.indexOf("capture")&&Qt(this[i])?s.push(t):r.push(t)}));var n=function(t,i){os(t,(function(t){try{if(Yt(t[0])){var e=i;as(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){ss.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{bl--}}push(t){if(bl>0&&Yt(t)&&ii(t[0])){var i=Ml.prototype[t[0]];Qt(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}cu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(d);return ii(i)&&Tl.test(i)?{value:i,delivered:!1}:Xt(i)&&ii(i.value)&&Tl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}fu(t,i,e,r){if(this.persistence){this.persistence.refreshKey(d);var s=this.cu();if(!r){if(e)return ii(i)&&Tl.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[d]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(d);if(ii(t)&&kl.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[d]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(d)}}pu(t){if(this.persistence){this.persistence.refreshKey(d);var i=this.cu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[d]:{value:t,delivered:!0}})}}capture(t,i,r){var s,n,o,a,l,h,d,v,c,f;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ql){if(this.is_capturing())if(!ti(t)&&ii(t)){this.Ll();var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var _=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==_||!_.isRateLimited){var g;null!=i&&i.$current_url&&!ii(null==i?void 0:i.$current_url)&&(ss.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=r&&r.gu||ss.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&&(g=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 m=new Date,b=(null==r?void 0:r.timestamp)||m,y=ze(null==r?void 0:r.uuid,Ss),w={uuid:y,event:t,properties:this.calculateEventProperties(t,i||{},b,y)};t===yt&&this.config.__preview_capture_bot_pageviews&&p&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),_&&(w.properties.$lib_rate_limit_remaining_tokens=_.remainingTokens);var x="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property(L);(null==r?void 0:r.$set)&&!x&&(w.$set=null==r?void 0:r.$set);var S=Xt(null==i?void 0:i.$set)?i.$set:void 0,E=!(null==r||!r.$set)&&u in r.$set,k=E||!!S&&u in S,T=E?null==r||null==(s=r.$set)?void 0:s[u]:null==S?void 0:S[u],P=Yt(null==i?void 0:i.$unset)?i.$unset:[],R=(null==r?void 0:r.$unset)||[],C=-1!==P.indexOf(u)||-1!==R.indexOf(u),O=this.fu(null==(n=g)?void 0:n.fbclid,T,k,C);O&&!0===w.properties.$process_person_profile&&O.pending&&!k&&!x&&(w.$set=e({[u]:O.value},w.$set));var I=null==r?void 0:r.$unset;I&&(w.$unset=I);var F,A,M,D=x?void 0:this.mu(null==r?void 0:r.$set_once,t!==St,t===xt);if(D&&(w.$set_once=D),null!=r&&r._noTruncate||(d=this.config.properties_string_max_length,v=w,c=t=>ii(t)?t.slice(0,d):t,f=new Set,w=function t(i,e){if(i!==Object(i))return c?c(i):i;if(!f.has(i)){var r;if(f.add(i),Yt(i))r=[],os(i,(i=>{r.push(t(i))}));else{var s={};as(i,((i,e)=>{f.has(i)||(s[e]=t(i,e))})),r=s}return r}}(v)),w.timestamp=b,ti(null==r?void 0:r.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),x&&(w.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Rr.forEach(r),i.forEach(r),e}(w.properties,$l)),t===Fo.DISMISSED||t===Fo.SENT){var N=null==i?void 0:i[Ao.SURVEY_ID],j=null==i?void 0:i[Ao.SURVEY_ITERATION];ll({id:N,current_iteration:j}),w.$set=e({},w.$set,{[(F={id:N,current_iteration:j},A=t===Fo.SENT?"responded":"dismissed",M="$survey_"+A+"/"+F.id,F.current_iteration&&F.current_iteration>0&&(M="$survey_"+A+"/"+F.id+"/"+F.current_iteration),M)]:!0})}else t===Fo.SHOWN&&(w.$set=e({},w.$set,{[Ao.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===No.SHOWN){var U=null==i?void 0:i[Lo.TOUR_TYPE];U&&(w.$set=e({},w.$set,{[Lo.TOUR_LAST_SEEN_DATE+"/"+U]:(new Date).toISOString()}))}var B=e({},w.properties.$set,w.$set);if(Zt(B)||this.setPersonPropertiesForFlags(B),!si(this.config.before_send)){var z=this.ns(w);if(!z)return;(w=z).uuid=ze(w.uuid,Ss)}var H=null!==(o=null==(a=w.$set)?void 0:a[u])&&void 0!==o?o:Xt(null==(l=w.properties)?void 0:l.$set)?w.properties.$set[u]:void 0,q=null!=O&&O.pending&&H===O.value?O.value:void 0;this.Cl.emit("eventCaptured",w);var V=null!==(h=null==r?void 0:r._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),W=e({method:"POST",url:V,data:w,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(V)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},null!=r&&r.transport?{transport:r.transport}:{},q?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.pu(q)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||q?this.Jl(W):this.Ql.enqueue(W),w}ss.critical("This capture call is ignored due to client rate limiting.")}}else ss.error("No event name provided to posthog.capture")}else ss.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}getExtension(t){var i;return null==(i=this.lu)?void 0:i.getExtension(t)}nu(){var t;return null!==(t=this.lu)&&void 0!==t?t:this.lu=new gl(this)}Ml(t){this.Bl.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Bl.indexOf(t);-1!==e&&this.Bl.splice(e,1)}}}yu(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Wl=null,this.persistence.get_property(tt)===pt&&(null==(r=this.sessionPersistence)||r.clear(),this.ql.clear(),this.bu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.yu();var a=o?void 0:this.persistence.remove_event_timer(t),l=e({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Pl()&&(l[lt]=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!ii(l.distinct_id)&&!ni(l.distinct_id)||ei(l.distinct_id))&&ss.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i,e,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ft)return{};var h,u=t?[...so,...i||[]]:[],d=Pe(Ft),v=d[0],c=d[1],f=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ti(e)||(p.detectGoogleSearchApp=e);var _={},g=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,b=null==Et||null==(a=Et.screen)?void 0:a.width,y=null==Et||null==(l=Et.screen)?void 0:l.height,w=null==Et?void 0:Et.devicePixelRatio;ti(g)||(_.userAgentDataPlatform=g),ti(m)||(_.maxTouchPoints=m),ti(b)||(_.screenWidth=b),ti(y)||(_.screenHeight=y),ti(w)||(_.devicePixelRatio=w);var x,S,E,k,T,P,R,C,O=ls(vs({$os:v,$os_version:c,$browser:Ee(Ft,navigator.vendor,f,p),$device:Re(Ft),$device_type:(S=Ft,E=_,C=Re(S),C===Ti||C===ki||"Kobo"===C||"Kindle Fire"===C||C===ee?Ei:C===Vi||C===Gi||C===Wi||C===Zi?"Console":C===Pi?"Wearable":C?wi:"Android"===(null==E?void 0:E.userAgentDataPlatform)&&(null!==(k=null==E?void 0:E.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==E?void 0:E.screenWidth)&&void 0!==T?T:0,null!==(P=null==E?void 0:E.screenHeight)&&void 0!==P?P:0)/(null!==(R=null==E?void 0:E.devicePixelRatio)&&void 0!==R?R:1)?wi:Ei:"Desktop"),$timezone:go(),$timezone_offset:mo()}),{$current_url:Zn(r?qe(null==Pt?void 0:Pt.href):null==Pt?void 0:Pt.href,u,oo),$host:null==Pt?void 0:Pt.host,$pathname:null==Pt?void 0:Pt.pathname,$raw_user_agent:Ft.length>1e3?Ft.substring(0,997)+"...":Ft,$browser_version:Te(Ft,navigator.vendor,f,p),$browser_language:vo(),$browser_language_prefix:(x=vo(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==Et?void 0:Et.screen.height,$screen_width:null==Et?void 0:Et.screen.width,$viewport_height:null==Et?void 0:Et.innerHeight,$viewport_width:null==Et?void 0:Et.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=s.SDK_DIST_CHANNEL),O}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&ls(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ls(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Kl)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===il&&(l.$lib_custom_api_host=this.config.api_host),u=t!==yt||o?t!==wt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=ls(l,u),t===yt&&$t&&(l.title=$t.title),!ti(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ft&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties(),m=l.$groups,b=_.$groups;Xt(m)&&!Zt(m)&&(l.$groups=e({},Xt(b)?b:{},m)),as(["$referrer","$referring_domain"],(t=>{t in _&&delete g[t]}));var y={};if(this.Bl.length>0)for(var w of this.Bl.slice())try{ls(y,w())}catch(t){ss.error("Failed to produce browser extension event properties",t)}(l=ls({},d,_,g,e({},y,l))).$is_identified=this._isIdentified(),Yt(this.config.property_denylist)?as(this.config.property_denylist,(function(t){delete l[t]})):ss.error(El+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(ss.error(Sl),l=x(l,t));var S=this._u();return l.$process_person_profile=S,S&&!o&&this.wu("_calculate_event_properties"),l}mu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this._u())return t;if(this.Nl&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=ls({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ss.error(Sl),o=a(o,"$set_once")),i&&(this.Nl=!0),Zt(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.yu(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.ql.add(t))),this.bu()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.ql.delete(t),this.bu()}ku(t,i){this.register({[t]:i})}Yl(){this.ql.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.ql.clear(),this.bu()}bu(){var t;if(this.jl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Ma||!qs.ii())qs.oi(this.jl);else{var i=[];this.ql.forEach((t=>i.push(t))),i.length>0?qs.ni(this.jl,i):qs.oi(this.jl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Cl.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:xl}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:xl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:xl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=ul),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:xl}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:xl})}Su(t){return!t||ei(t)?(ss.critical("Unique user id has not been set in posthog.identify"),!1):t===at?(ss.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(ss.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return ss.uninitializedWarning("posthog.identify");if(ni(t)&&(t=t.toString(),ss.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(t)&&this.wu("posthog.identify")){this.Ll();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.yu(!1),o=this.persistence.Va(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(h)&&(this.unregister(h),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(tt)||pt)===pt,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(tt,_t),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ga(),this.capture(xt,{distinct_id:t,$anon_distinct_id:u},{$set:i||{},$set_once:e||{}}),this.Wl=tl(t,i,e),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(tt,_t);var p=i||{},_=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Ga(),this.capture("$set",{$set:p,$set_once:_}),this.Wl=tl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Y)):f&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ja(l)}}}setPersonProperties(t,i){if((t||i)&&this.wu("posthog.setPersonProperties")){var e=tl(this.get_distinct_id(),t,i);this.Wl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Wl=e):ss.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(Yt(t)?t:[t]).filter((t=>ii(t)&&t.length>0));0!==e.length&&this.wu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Wl=null)}group(t,i,r){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.yu();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:e({},n,{[t]:i})}),(o||r)&&this._u()){var a={$group_type:t,$group_key:i};r&&(a.$group_set=r),this.capture(St,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else ss.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.wu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=ai(t)?t:null==t?void 0:t.resetDeviceID,e=ai(t)||null==t?void 0:t.bootstrap;this.xu(i,!1,e)}xu(t,i,r){var s,n,o;if(void 0===i&&(i=!1),ss.info("reset"),!this.__loaded)return ss.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Gl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.fo());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(S),c=this.is_capturing();this.consent.reset(),i||!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 f=null==(o=this.persistence)||null==o.Va?void 0:o.Va(),p=!1;try{var _,g,m,b,y,w,x,E,k,T,P,R,C;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.ql.clear(),this.bu(),ti(v)||null==(T=this.persistence)||T.register({[S]:v}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(x=this.metrics)||x.reset(),null==(E=this.persistence)||E.set_property(tt,pt),null==(k=this.sessionManager)||k.resetSessionId(),this.Wl=null,this.config.cookieless_mode===ft)this.register_once({distinct_id:at,$device_id:null},"");else{var O=this.config.get_device_id(Ss());this.register_once({distinct_id:O,$device_id:t?O:u},""),t||ti(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Pl()||(null==(C=this.persistence)||C.set_property(tt,r.isIdentifiedID?_t:pt),this.register({distinct_id:r.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(ti(h)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(h,!0))){var I=e({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,p=!0}finally{var F;f&&(null==(F=this.persistence)||null==F.Ja||F.Ja(p))}this.reloadFeatureFlags()}shutdown(t){var e=this;return i((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.nu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Ql)||s.unload(),null==(n=e.Kl)||n.unload();try{var l;null==(l=e.featureFlags)||l.destroy()}catch(t){ss.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else ss.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Cu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Tu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(n)?(ss.critical("Attempting to create alias for existing People user - aborting."),-2):this.wu("posthog.alias")?(ti(i)&&(i=this.get_distinct_id()),t!==i?(this.ku(h,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(ss.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(Xt(t)){var r,n,o,a,l,h,u,d,v,c,f,p;ls(this.config,Fl(t));var _=this.Dl();null==(r=this.persistence)||r.update_config(this.config,i,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ro(e({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.Vl(this.config.debug);ai(m)&&(this.config.debug=m),ai(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Cs.ii()&&Cs.ni("ph_debug",!0),ss.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(s.DEBUG=!1,Cs.ii()&&Cs.oi("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.fo()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.$l(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Bn(this,yl,!1)}}_overrideSDKInfo(t,i){s.LIB_NAME=t,s.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(e({},s,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:Ml.Mu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Pl;return i!==Pl&&(i=Pl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(tt))===_t||(null==(i=this.sessionPersistence)?void 0:i.get_property(tt))===_t}_u(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===gt&&!this._isIdentified()&&Zt(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(i=this.persistence)||null==(i=i.props)||!i[ot]))}vu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!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(t){return"never"===this.config.person_profiles?(ss.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Al(),this.ku(ot,!0),!0)}Dl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ct)}$l(){var t,i,e,r,s,n=this.Dl();return this.is_capturing()||null==(e=this.logs)||e.Iu(),(null==(t=this.persistence)?void 0:t.Ma)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i.Ma)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.ql.clear(),this.bu()),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==ft){if(this.Pl()){var e,r,s,n,o,a;null==(e=this.sessionRecording)||e.dispose({discardBufferedEvents:!0}),this.xu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Wa(this),this.pageViewManager=new Vn(this),this.persistence&&(this.sessionPropsManager=new za(this,this.sessionManager,this.persistence));var l,h=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Ml.__defaultExtensionClasses)?void 0:a.sessionRecording;h&&(this.sessionRecording=this.Rl(this.sessionRecording,new h(this)),this.xl&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this.xl)))}var u,d;this.consent.optInOut(!0),this.$l(),this.uu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==ct&&(null==(u=this.surveys)||u.loadIfEnabled()),(ti(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hu()}else ss.warn(wl)}opt_out_capturing(){if(this.config.cookieless_mode!==ft){var t,i,e=this.config.cookieless_mode===ct?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===ct&&this.consent.isOptedIn()&&this.xu(!0,!0),this.consent.optInOut(!1),this.$l(),this.config.cookieless_mode===ct&&(this.register({distinct_id:at,$device_id:null}),this.El(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.hu(),this.uu())}else ss.warn(wl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ft||(this.config.cookieless_mode===ct?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$l()}_is_bot(){return Tt?Ga(Tt,this.config.custom_blocked_useragents):void 0}hu(){$t&&("visible"===$t.visibilityState?this.Hl||(this.Hl=!0,this.capture(yt,{title:$t.title},{send_instantly:!0}),this.zl&&($t.removeEventListener(mt,this.zl),this.zl=null)):this.zl||(this.zl=this.hu.bind(this),ps($t,mt,this.zl)))}debug(t){!1===t?(null==Et||Et.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Et||Et.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}))}fo(){var t=this.Gl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ss.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,e,r,s){var n=i in t&&!si(t[i]),o=e in t&&!si(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,ss)}ns(t){var i;if(si(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(ui),r=Yt(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),si(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return hi(t.event)?ss.warn(o+". This can cause unexpected behavior."):ss.info(o),null}s.properties&&!Zt(s.properties)||ss.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return ss.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&si(s.properties[a]))return ss.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.ea)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Vl(t){var i=ai(t)&&!t,e=Cs.ii()&&"true"===Cs.ai("ph_debug");return!i&&(!!e||t)}}Ml.__defaultExtensionClasses={},Ml.Mu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ds(t.prototype[i[e]])}(Ml,["identify"]);class Dl{constructor(t){this.disabled=!1===t;var i=Xt(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Nl="$copy_autocapture",Ll=ns("[AutoCapture]");function jl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Ul(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Xs(i));return i}function Bl(t,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!Xs(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!Zs(c,"body")&&rn>d.length;)if(en(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Xs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,g=[],m={},b=!1,y=!1;if(as(d,(t=>{var i=xn(t);if(Zs(t,"a")){var e=t.getAttribute("href");b=!!(i&&e&&On(e))&&(u?qe(e):e)}jt(on(t),"ph-no-capture")&&(y=!0),g.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};un.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?jl(1024,In(t)):jl(1024,ln(t)));var a=on(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),as(t.attributes,(function(e){var n;if((!Sn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&On(e.value)&&(!ii(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=sn(a).join(" ")),o["attr__"+e.name]=jl(1024,"href"===e.name&&s?qe(a):a)}}));for(var l=1,h=1,u=t;u=Ul(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!xn(t))return{};var i={};return as(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&On(r)&&(i[e]=r)}})),i}(t);as(r,((t,i)=>{({}).hasOwnProperty.call(m,i)||(m[i]=t)}))})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=Zs(t,"a")||Zs(t,"button")?In(t):ln(t)),b){var w,x;g[0].attr__href=b;var S=null==(w=Qn(b))?void 0:w.host,E=null==Et||null==(x=Et.location)?void 0:x.host;S&&E&&S!==E&&(p=b)}return{props:ls({$event_type:n.type,$ce_version:1},h?{}:{$elements:g},{$elements_chain:(_=g,Yt(_)?function(t){return t.map((t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return hs(o).sort(((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r})).forEach((t=>{var i=t[1];return a[An(t[0].toString())]=An(i.toString())})),(s+=":")+hs(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Mn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return hs(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)):"")},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}class zl{constructor(t){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=t,this.Ls.refresh(this.mn),this.rageclicks=new Dl(this.mn.rageclick),this.Ds=null}setup(t){this.$s(),this.Ns=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Os?i.dispose():(this.qs=i,this.startIfEnabled())}dispose(){var t;this.Os||(this.Os=!0,this.Ns=void 0,null==(t=this.qs)||t.dispose(),this.qs=void 0,this.js())}Bs(){return this.Ls.refresh(this.mn),this.mn}$s(){var t,i;return this.Bs(),this.mn.url_allowlist=null==(t=this.mn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.mn.url_ignorelist=null==(i=this.mn.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.mn}Hs(){if(this.isBrowserSupported()){if(Et&&$t){var t=this.zs=t=>{t=t||(null==Et?void 0:Et.event);try{this.Us(t)}catch(t){Ll.error("Failed to capture event",t)}};if(ps($t,"submit",t,{capture:!0}),ps($t,"change",t,{capture:!0}),ps($t,"click",t,{capture:!0}),this.Bs().capture_copied_text){var i=this.Ws=t=>{t=t||(null==Et?void 0:Et.event);try{this.Us(t,Nl)}catch(t){Ll.error("Failed to capture clipboard event",t)}};ps($t,"copy",i,{capture:!0}),ps($t,"cut",i,{capture:!0}),ps($t,"paste",i,{capture:!0})}}}else Ll.info("Disabling Automatic Event Collection because this browser is not supported")}js(){this.zs&&(null==$t||$t.removeEventListener("submit",this.zs,!0),null==$t||$t.removeEventListener("change",this.zs,!0),null==$t||$t.removeEventListener("click",this.zs,!0),this.zs=void 0),this.Ws&&(null==$t||$t.removeEventListener("copy",this.Ws,!0),null==$t||$t.removeEventListener("cut",this.Ws,!0),null==$t||$t.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(t){if(!this.Os)if(this.As=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Fs=i.elementsChainAsString);var e,r=i.autocapture_opt_out;ai(r)&&(null==(e=this.Ns)||e.kv.set(c,r),this.Ps=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ds=t}getElementSelectors(t){var i,e=[];return null==(i=this.Ds)||i.forEach((i=>{var r=null==$t?void 0:$t.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Os)return!1;var e=null==(t=this.Ns)?void 0:t.kv.get(c),r=this.Ps,s=this.Bs(),n=s.remoteRequestsDisabled&&!this.As;if(ri(r)&&!ai(e)&&!n)return!1;var o=null!==(i=this.Ps)&&void 0!==i?i:!!e;return!!s.enabled&&!o}Us(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=hn(t);tn(r)&&(r=r.parentNode||null);var s,n=this.$s();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&bn(r,n.rageclick)&&this.Us(t,"$rageclick");var o=i===Nl,a=o?e({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,i,e,r,s,n){var o;if(!Et||yn(t))return!1;if(null!=e&&e.url_allowlist&&!nn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&nn(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var a=e.dom_event_allowlist;if(a&&!a.some((t=>i.type===t)))return!1}var l=wn(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(ti(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(u,e))return!1;if(!dn(u,null==e?void 0:e.css_selector_allowlist))return!1;if(dn(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:cn))return!1;try{var d=Et.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(un.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=Bl(r,{e:t,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 d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),i===Nl){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==Et||null==(c=Et.getSelection())?void 0:c.toString(),_=an(p);if(!_)return!1;u.$selected_content=_,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.Ns)||l.capture(i,u).catch((t=>Ll.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return Qt(null==$t?void 0:$t.querySelectorAll)}}class Hl{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=Xt(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.fo(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var ql=ns("[ExceptionAutocapture]"),Vl=()=>{},Wl=t=>{var i;if(Qt(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Gl(t,i,e){try{if(!(i in t))return Vl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return Qt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=Wl(e);n;){if(n.next===s)return void(n.next=r.next);n=Wl(e=n.next)}else t[i]=r.next}}catch(t){return Vl}}var Jl=ns("[TracingHeaders]"),Kl=ns("[Web Vitals]"),Yl=9e5,Ql=["CLS","FCP","INP","LCP"],Xl=["INP","LCP"],Zl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],th="disabled",ih="lazy_loading",eh="awaiting_config",rh="missing_config";ns("[SessionRecording]"),ns("[SessionRecording]");var sh="[SessionRecording]",nh=ns(sh),oh=ns("[Heatmaps]");function ah(t){return Xt(t)&&"clientX"in t&&"clientY"in t&&ni(t.clientX)&&ni(t.clientY)}var lh=ns("[Product Tours]"),hh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(y))},uh=["$set_once","$set"],dh=ns("[SiteApps]"),vh="Error while initializing PostHog app with config id ",ch=(t,i)=>null!=t&&t.then?t.then(i):i(t),fh="SDK is not enabled or survey functionality is not yet loaded",ph="Disabled. Not loading surveys.";class _h{constructor(t,i){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=t=>{if(!this.Os&&!this.mn.disableSurveys){if(!t.ok)return ol.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(si(i))return ol.warn("Flags not loaded yet. Not loading surveys.");this.Ou=ai(i)?i:i.length>0,ol.info("flags response received, isSurveysEnabled: "+this.Ou),this.loadIfEnabled()}},this.Ls=t,this.Lu=i}setup(t){if(!this.Os)return this.Du=t,ch(t.kv.initialize(),(()=>{if(this.Du===t&&!this.Os){this.Du=void 0,this.Ns=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Os?i.dispose():(this.qs=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Os||(this.Os=!0,this.Du=void 0,this.Ns=void 0,null==(t=this.qs)||t.dispose(),this.qs=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ru=[],this.Pu=null,this.Fu.forEach((t=>clearTimeout(t))),this.Fu.clear())}get mn(){return this.Ls.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(al)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Os&&this.Ns){var t=this.mn;if(!this._surveyManager)if(this.Eu)ol.info("Already initializing surveys, skipping...");else if(t.disableSurveys)ol.info(ph);else if(t.cookielessMode&&this.Ls.isOptedOut())ol.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ls.getExtensions();if(i){if(!ti(this.Ou)||t.advancedEnableSurveys){var e=this.Ou||t.advancedEnableSurveys;this.Eu=!0;try{var r=i.generateSurveys;if(r)return this.$u(r,e),void(this.Eu=!1);var s=i.loadExternalDependency;if(!s)return this.Nu(vt),void(this.Eu=!1);s((t=>{try{if(this.Os)return;var i=this.Ls.getExtensions();t||null==i||!i.generateSurveys?this.Nu("Could not load surveys script",t):this.$u(i.generateSurveys,e)}finally{this.Eu=!1}}))}catch(t){throw this.Eu=!1,this.Nu("Error initializing surveys",t),t}}}else ol.error("PostHog Extensions not found.")}}}$u(t,i){this.Os||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ls.createEventReceiver(),ol.info("Surveys loaded successfully"),this.qu({isLoaded:!0}))}Nu(t,i){ol.error(t,i),this.qu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ru.push(t),this._surveyManager&&this.qu({isLoaded:!0}),()=>{this.Ru=this.Ru.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Ns)&&void 0!==e?e:this.Lu;if(r&&!this.Os){if(this.mn.disableSurveys)return ol.info(ph),t([]);var s=r.kv.get(q);if(s&&!i)return t(s,{isLoaded:!0}),void(this.ju()&&this.getSurveys((()=>{}),!0));if(this.Pu)this.Pu.then((i=>{this.Os||t(i.surveys,i.context)})).catch((t=>ol.error("Error in survey callback",t)));else{var n=this.Bu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.mn.requestTimeoutMs}).then((t=>{try{return this.Hu(r,t)}catch(t){return ol.error("Error processing surveys response",t),this.Hu(r,{statusCode:0,error:t})}}),(t=>this.Hu(r,{statusCode:0,error:t})));this.Pu=n;var o=()=>{this.Pu===n&&(this.Pu=null)};n.then((i=>{o(),this.Os||t(i.surveys,i.context)}),o).catch((t=>ol.error("Error in survey callback",t)))}}}Bu(t,i){var e=this.Ns;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(fh)})))}Hu(t,i){if(this.Os)return{surveys:[],context:{isLoaded:!1,error:fh}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?ol.error(r):i.error||ol.warn(r),this.Au=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Au=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ka(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[q]:n,[V]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}ju(){return this.zu()&&!this.Pu&&!this.Uu()}zu(){var t,i,e=null==(t=null!==(i=this.Ns)&&void 0!==i?i:this.Lu)?void 0:t.kv.get(V);return ni(e)&&Date.now()-e>3e5}Uu(){return ni(this.Au)&&3e5>Date.now()-this.Au}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};ll(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}qu(t){for(var i of this.Ru)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){ol.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!si(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ol.warn("init was not called")}Wu(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Vu(t){if(si(this._surveyManager))return{eligible:!1,reason:fh};var i="string"==typeof t?this.Wu(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Gu(t){if(si(this._surveyManager))return{eligible:!1,reason:fh};var i="string"==typeof t?this.Wu(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(si(this._surveyManager))return ol.warn("init was not called"),{visible:!1,disabledReason:fh};var i=this.Gu(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return si(this._surveyManager)?(ol.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fh})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Gu(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(si(this._surveyManager))ol.warn("init was not called");else{var s="string"==typeof t?this.Wu(t):t;if(null!=s&&s.id)if(hl.includes(s.type)){var n=null==$t?void 0:$t.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){ol.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,i;this.Fu.delete(o),this.Os||(ol.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),ol.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Fu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else ol.warn("Survey element not found")}else ol.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ol.warn("Survey not found")}}displaySurvey(t,i){var r;if(si(this._surveyManager))ol.warn("init was not called");else{var s=this.Wu(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Mo.Popover&&i.initialResponses&&ol.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.Vu(s);if(!o.eligible)return void ol.warn("Survey is not eligible to be displayed: ",o.reason)}i.displayType!==Mo.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else ol.warn("Survey not found")}}cancelPendingSurvey(t){si(this._surveyManager)?ol.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function gh(t,i,e){if(si(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class mh{constructor(t){this.Zu=new Set,this.Qu=new Set,this.Ju=new Ha,this.Ku=(t,i)=>this.Yu(t,i)&&this.Xu(t,i)&&this.th(t,i)&&this.eh(t,i),this.Yu=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;ti(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.ih=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.ih)||t.call(this),this.ih=void 0,this.Ju=new Ha}register(t){var i,e;if(!ti(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Zu.add(t),null==(i=t.steps)||i.forEach((t=>{this.Qu.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Zu.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Zu.clear(),this.Qu.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Qu.has(t)||this.Qu.has(i.event))&&this.Zu.forEach((t=>{this.rh(i,t)&&this.Ju.emit("actionCaptured",t.name)}))}nh(t){this.onAction("actionCaptured",(i=>t(i)))}rh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ku(t,e))return!0;return!1}onAction(t,i){return this.Ju.on(t,i)}Xu(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!gh(r,i.url,i.url_matching||"contains"))return!1}return!0}th(t,i){return!!this.sh(t,i)&&!!this.ah(t,i)&&!!this.oh(t,i)}sh(t,i){var e;if(null==i||!i.href)return!0;var r=this.lh(t);if(r.length>0)return r.some((t=>gh(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&gh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ah(t,i){var e;if(null==i||!i.text)return!0;var r=this.lh(t);if(r.length>0)return r.some((t=>gh(t.text,i.text,i.text_matching||"exact")||gh(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!si(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>gh(t,n,o))))}oh(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}lh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}eh(t,i){return null==i||!i.properties||0===i.properties.length||Za(i.properties.reduce(((t,i)=>{var e=Yt(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class bh{constructor(t){var i;this.uh=[],this._instance=t,this.hh=new Map,this.dh=new Map,this.fh=new Map,this.ph=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.gh(t)))}mh(t){return!1}yh(){return null}bh(t){}_h(){}wh(t,i){return!!t&&Za(t.propertyFilters,null==i?void 0:i.properties)}kh(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}Sh(t,i,e){var r=(e===Oo.Activation?this.hh:this.dh).get(t),s=[];return this.xh((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.wh(n,i)}))}register(t){this.Ch(t,!1)}replace(t){this.Ch(t,!0)}Ch(t,i){var e;ti(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Th(t,i),this.Mh(t,i))}Mh(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.fh.clear(),0!==e.length){this.Ih||(this.Ih=new mh(this._instance),this.Ih.init(),this.Ih.nh((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.fh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.fh.set(i.name,s)}}))})),i?this.Ih.replace(r):this.Ih.register(r)}else{var s;i&&(null==(s=this.Ih)||s.replace([]))}}Eh(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}Th(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this.kh(t,Oo.Activation),a=this.kh(t,Oo.Cancellation);i?(this.hh=o,this.dh=a):(this.Eh(this.hh,o),this.Eh(this.dh,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.ih)&&void 0!==e||(this.ih=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Rh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Ph(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Ah([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Fh(n),void this.Oh([n])}if(this.dh.has(t)){var a=this.Sh(t,i,Oo.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Ah(a.map((t=>t.id))),a.forEach((t=>this.Lh(t.id))))}if(this.hh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.hh.get(t)});var l=this.Sh(t,i,Oo.Activation);this.Dh(l.map((t=>t.id)))}}onAction(t){this.fh.has(t)&&this.Dh(this.fh.get(t)||[])}Dh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.mh(s)?this.Fh(s)&&this.$h(s):r.push(s);r.length>0&&(this.uh=[...new Set([...this.uh,...r])]),this.Rh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Fh(t){this.uh=this.uh.filter((i=>i!==t));var i=this.Nh();return!i.includes(t)&&(this.qh([...i,t]),this.jh(),!0)}Ah(t){var i=new Set(t);this.uh=this.uh.filter((t=>!i.has(t)));var e=this.Bh(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.qh(r),0===r.length&&this.Hh()),this.Oh(t)}zh(){var t,i=this.yh();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}$h(t){if(this.yh()){var i=this.zh();this.bh(e({},i,{[t]:Date.now()}))}}Oh(t){if(this.yh()){var i=this.zh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(Zt(e)?this._h():this.bh(e))}}Uh(){this.yh()&&this._h()}getActivationTimestamp(t){if(this.Nh().includes(t)){var i=this.zh()[t];return ni(i)?i:void 0}}Bh(){var t,i=this.Wh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Nh(){var t,i,e=this.Bh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Vh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}jh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.Gh(i)}Hh(){this.Zh()}gh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Vh()];if(e&&e!==t){var r=this.Bh(),s=this.zh();r.length>0&&(this.qh([]),r.filter((t=>ni(s[t]))).forEach((t=>this.Lh(t)))),this.Hh(),this.Uh()}}getActivatedIds(){return[...new Set([...this.Nh(),...this.uh])].filter((t=>!this.Qh(t)))}dispose(){var t,i,e;null==(t=this.ph)||t.call(this),this.ph=void 0,null==(i=this.ih)||i.call(this),this.ih=void 0,null==(e=this.Ih)||e.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 yh extends bh{constructor(t){super(t)}Wh(){return W}Vh(){return G}yh(){return J}bh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[J]:t})}_h(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(J)}mh(t){var i,e;this.xh((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return ni(r)&&r>0}Kh(){return Fo.SHOWN}xh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Lh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Rh(){return ol}qh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[W]:t})}Gh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[G]:t})}Zh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(G)}Qh(){return!1}Ph(t,i){var e;this.xh((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Ka(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===Fo.SHOWN?"consume":"ignore":t===Fo.SHOWN?"persist":t===Fo.DISMISSED||t===Fo.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class wh{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);ti(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class xh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==Dt?void 0:Dt.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new yh(this._instance)}}var Sh=null!=Et&&Et.location?to(Et.location.hash,"__posthog")||to(location.hash,"state"):null,Eh="_postHogToolbarParams",kh=ns("[Toolbar]"),Th=ns("[FeatureFlags]");class $h{constructor(t,i){void 0===i&&(i=!1),this.Yh=!1,this.update(t,i)}update(t,i){this.Xh=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:Yt(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Yh||(Th.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yh=!0),ti(t.flag_keys)||Yt(t.flag_keys)||Th.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Xh}}var Ph=ns("[FeatureFlags]"),Rh=ns("[FeatureFlags]",{debugEnabled:!0}),Ch="\" failed. Feature flags didn't load in time.",Oh="connection_error",Ih=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Fh=t=>{var i={};for(var e of hs(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Ah=ns("[Error tracking]"),Mh="webkit-masked-url:",Dh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Mh],Nh=["__firefox__","__gCrWeb"],Lh="Refusing to render web experiment since the viewer is a likely bot",jh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Ya(i,t),not_regex:(t,i)=>!Ya(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Uh{get mn(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Uh.td("retrieved web experiments from the server"),i.ed=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.ed&&(Uh.td("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.ed)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);ii(r)&&t.variants[r]&&i.rd(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Uh.nd(n,i._instance)&&i.rd(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Uh.td(Lh);else if(!this.mn.disable_web_experiments){if(si(this.ed))return this.ed=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Uh.td("applying feature flags",t),t.forEach((t=>{var i;if(this.ed&&null!=(i=this.ed)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.ed)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.rd(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Uh.getWindowLocation();if(null!=t&&t.search){var i=Xn(null==t?void 0:t.search,"__experiment_id"),e=Xn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Uh.td("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.sd(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.mn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.mn.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.mn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}sd(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Uh.td("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.rd(r[0].name,i,r[0].variants[i].transforms))}static nd(t,i){return!si(t.conditions)&&Uh.ad(t,i)&&Uh.od(t)}static ad(t,i){var e;if(si(t.conditions)||si(null==(e=t.conditions)?void 0:e.url))return!0;var r=Uh.getWindowLocation();if(r){var s,n,o,a=Ws(i,r.href);return null==(s=t.conditions)||!s.url||jh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==Et?void 0:Et.location}static od(t){var i;if(si(t.conditions)||si(null==(i=t.conditions)?void 0:i.utm))return!0;var e=lo();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static td(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];ss.info("[WebExperiments] "+t,e)}rd(t,i,e){this._is_bot()?Uh.td(Lh):"control"!==i?e.forEach((e=>{if(e.selector){var r;Uh.td("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Uh.td("Control variants leave the page unmodified.")}_is_bot(){return Tt&&this._instance?Ga(Tt,this.mn.custom_blocked_useragents):void 0}}var Bh=ns("[Conversations]"),zh="Conversations not available yet.";function Hh(t,i){var r,s,n,o,a,l,h,u=null!==(r=null==t?void 0:t.flushIntervalMs)&&void 0!==r?r:3e3,d=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=ti(v)?Math.max(d,2048):Math.max(d,v),f=e({},function(){var t="",i="";try{var r=null==Tt?void 0:Tt.userAgent;if(r){var s=Pe(r);t=s[0],i=s[1]}}catch(t){}return function(t,i){var r=function(t){if(t)return{}.hasOwnProperty.call(Vr,t)?Vr[t]:t}(t);return e({},r?{"os.name":r}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(h=null==f?void 0:f["deployment.environment"])&&void 0!==h?h:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var qh=["debug","log","warn","error","info"],Vh="console",Wh="__posthogHandledLogsRequestError",Gh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Wh]=!0,e},Jh=t=>!!t&&"object"==typeof t&&!0===t[Wh],Kh={featureFlags:class{constructor(t){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=Ph,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.Wt=()=>{var t=this.wd();this._d=0,t&&this.reloadFeatureFlags()},this.kd=()=>{var t,i=this.Sd;ti(i)||this.mn.remoteRequestsDisabled||!$t||"hidden"===$t.visibilityState||Date.now()-(null!==(t=this.xd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Cd())},this.Vt=()=>{"visible"===(null==$t?void 0:$t.visibilityState)&&this.kd()},"get"in t?this.Ls=t:(this._instance=t,this.Td=new $h(t.config,t.fo()),this.Ls=this.Td)}updateConfig(t,i){var e;null==(e=this.Td)||e.update(t,i),this.Ns&&this.Md()}setup(t){return this.Du=t,this.A=t.logger.createLogger("[FeatureFlags]"),ch(t.kv.initialize(),(()=>{this.Du===t&&(this.Du=void 0,this.Ns=t,this.Id(t))}))}Id(t){var i;if(this.Ns===t)return Et&&ps(Et,"online",this.Wt),this.Md(),this.Ed=t.registerDynamicEventProperties((()=>this.Rd()?this.ud:this.hd)),this.Pd=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange((()=>{this.Ad(),this.Fd()})),this.Ad(),this.initialize()}Md(){var t=this.mn.refreshIntervalMs,i=!this.mn.remoteRequestsDisabled&&$t&&!ti(t)&&t>0?t:void 0;i!==this.Sd&&(this.Od(),ti(i)||(this.Sd=i,this.Cd(),null!=$t&&$t.addEventListener&&ps($t,mt,this.Vt)))}Cd(){ti(this.Sd)||(ti(this.Ld)||clearInterval(this.Ld),this.xd=Date.now(),this.Ld=setInterval(this.kd,this.Sd))}Od(){ti(this.Ld)||(clearInterval(this.Ld),this.Ld=void 0,null==$t||null==$t.removeEventListener||$t.removeEventListener(mt,this.Vt)),this.Sd=void 0,this.xd=void 0}destroy(){this.Dd()}dispose(){this.Dd()}Dd(){var t,i;this.Od(),this.pd++,this.md=!1,this.Du=void 0,this.Ns&&(this.$d(),null==(t=this.Ed)||t.dispose(),this.Ed=void 0,null==(i=this.Pd)||i.call(this),this.Pd=void 0,this.dd=[],null==Et||Et.removeEventListener("online",this.Wt),this.Ns=void 0)}get mn(){return this.Ls.get()}Nd(t){var i;return null==(i=this.Ns)?void 0:i.kv.get(t)}ni(t){this.qd((()=>{var i;return null==(i=this.Ns)?void 0:i.kv.set(t)}))}jd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t[I]){var s=this.Nd(I)||{},n=t[I]||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter((t=>{var i=t[1];return!(null!=i&&i.failed)})).map((t=>t[0])):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!Yt(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Nd(D)||{},d=t[D]||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p={[F]:f,[I]:f,[D]:!!c||v};for(var _ of(t[M]&&(p[M]=f),[N,Z,L]))ti(t[_])||(p[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(p)}}oi(t){this.qd((()=>{var i;return null==(i=this.Ns)?void 0:i.kv.remove(t)}))}qd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Ad(){var t={};for(var i of[F,D,N,j]){var r=this.Nd(i);ti(r)||(t[i]=r)}this.ud=t;var s=e({},t),n=this.Nd(I);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.hd=s}Rd(){var t=this.mn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Nd(Z);return"number"!=typeof i||Date.now()-i>t}Bd(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Hd(){var t=this.mn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}zd(){var t=this.mn.flagKeys;if(!ti(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.mn,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!ti(r[t]))).reduce(((t,i)=>(t[i]=r[i],t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.Ud({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Nd(I))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Nd(D))&&void 0!==n?n:{},l=e({},o,t),h=e({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Tr(c),variant:$r(c),reason:void 0,metadata:ti(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Ud({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Nd(M),i=this.Nd(j),r=this.Nd(U);if(!r&&!i)return t||{};var s=ls({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var o of n){var a,l,h=s[o],u=null==i?void 0:i[o],d=ti(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ti(u)?null==h?void 0:h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=e({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=e({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:Tr(r),variant:$r(r),payload:kr(i[e])}}))}getFlagVariants(){var t=this.Nd(I),i=this.Nd(j);if(!i)return t||{};for(var e=ls({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ld=!0),e}getFlagPayloads(){var t=this.Nd(D),i=this.Nd(U);if(!i)return t||{};for(var e=ls({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ld=!0),e}reloadFeatureFlags(){this.gd||this.mn.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Wd||(this.dd.slice().forEach((t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Wd=setTimeout((()=>{this.Vd()}),5)))}$d(){clearTimeout(this.Wd),this.Wd=void 0}onReloading(t){return this.dd.push(t),()=>{this.dd=this.dd.filter((i=>i!==t))}}ensureFlagsLoaded(){this.vd||this.fd||this.Wd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.oi(Y)}Vd(t){this.$d();var i=this.Ns;if(i&&!this.mn.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var r={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},i.initialPersonProperties,this.Nd(B)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Nd(z),timezone:go()};ti(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.mn.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Hd();s.length&&(r.evaluation_contexts=s);var n=this.zd();ti(n)||(r.flag_keys=n);var o=this.mn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.pd;this.fd=!0;var h=()=>{this.md&&(this.md=!1,this.Vd())},u=t=>{this.fd=!1,l===this.pd?(this.ni({[X]:[Oh]}),this.A.error("Feature flag request failed",t),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.mn.compression,sentAt:"body",timeoutMs:this.mn.requestTimeoutMs}).then((t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.fd=!1,l===this.pd){if(this.Gd(t.statusCode),n||this.md||(this.$anon_distinct_id=void 0),!r.disable_flags||this.md){this.yd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Oh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(e=s.quotaLimited)||!e.includes("feature_flags"));u&&a.push("quota_limited"),this.ni({[X]:a}),u?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."):r.disable_flags||this.Ud(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}wd(){return io(this._d,3)}Gd(t){this._d=eo(t,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(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Bd()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+Ch)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Bd()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Nd(N)||void 0,u=this.Nd(Z)||void 0,d=this.Nd(Y)||{};if(this.mn.deduplicateCallsPerSession){var v,c=null==(v=this.Ns)?void 0:v.session.sessionId,f=this.Nd(Q);c&&c!==f&&(d={},r=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))r&&this.ni({[Y]:d,[Q]:r});else{var p,_,g,m,b,y,w,x,S,E,k,T;Yt(d[t])?d[t].push(l):d[t]=[l],this.ni(e({[Y]:d},r?{[Q]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.Nd(X))&&void 0!==p?p:[]];ti(o)&&R.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.mn.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this.mn.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.yd};ti(null==P||null==(y=P.metadata)?void 0:y.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ti(null==P||null==(w=P.metadata)?void 0:w.version)||(C.$feature_flag_version=P.metadata.version);var O,I=null!==(x=null==P||null==(S=P.reason)?void 0:S.description)&&void 0!==x?x:null==P||null==(E=P.reason)?void 0:E.code;I&&(C.$feature_flag_reason=I),null!=P&&null!=(k=P.metadata)&&k.id&&(C.$feature_flag_id=P.metadata.id),ti(null==P?void 0:P.original_variant)&&ti(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ti(P.original_variant)?P.original_enabled:P.original_variant),null!=P&&null!=(T=P.metadata)&&T.original_payload&&(C.$feature_flag_original_payload=null==P||null==(O=P.metadata)?void 0:O.original_payload),R.length&&(C.$feature_flag_error=R.join(",")),this.Zd(C)}else r&&this.ni({[Y]:d,[Q]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:kr(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Ch)}Zd(t){try{var i;null==(i=this.Ns)||i.capture("$feature_flag_called",t).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(t,i){this.Qd(t,i)}Qd(t,e){var r=this;return i((function*(){var i=r.Ns;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.Hd();n.length&&(s.evaluation_contexts=n);var o,a=r.zd();ti(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.mn.compression,sentAt:"body",timeoutMs:r.mn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.A.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){r.A.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.yd)return i.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Ch),i.defaultValue;var e=this.getFeatureFlag(t,i);return ti(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.Ud(t,i,e)}Ud(t,i,r){if(this.Ns){this.vd=!0;var s=function(t,i,r,s,n,o){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=Ph);var a=((t,i)=>{var r=t.flags;return r?e({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var i;return[t,null!==(i=r[t].variant)&&void 0!==i?i:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var i;return!ti(null==(i=r[t].metadata)?void 0:i.payload)})).map((t=>{var i;return[t,null==(i=r[t].metadata)?void 0:i.payload]})))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(Yt(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[F]:h,[I]:c,[L]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=_||{};p=e({},i,p),_=e({},r,b),m.forEach((t=>{var i;t in b||null==(i=_)||delete i[t]})),g=e({},s,g)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter((t=>{var i;return!(null!=(i=l[t])&&i.failed)})));p=e({},i,Object.fromEntries(Object.entries(p).filter((t=>y.has(t[0])))));var w=Object.fromEntries(Object.entries(_||{}).filter((t=>y.has(t[0]))));_=e({},r,w),y.forEach((t=>{var i;t in w||null==(i=_)||delete i[t]})),g=e({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>y.has(t[0])))))}else p=e({},i,p),_=e({},r,_),g=e({},s,g);return e({[F]:Object.keys(Fh(p)),[I]:p||{},[D]:_||{},[M]:g||{},[L]:!0===t.minimalFlagCalledEvents},d?{[N]:d}:{},v?{[Z]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.A);s&&(this.jd(s,t,!(null==r||!r.partialResponse)),this.ni(s)),i||(this.bd=!1),this.Fd(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Jd(t)}Jd(t){if(this.Ns){if(!1===t)return this.oi([j,U]),this.Fd(),void Rh.info("All overrides cleared");if(Yt(t))return this.ni({[j]:Ih(t)}),this.Fd(),void Rh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ld=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[j]=Yt(s)?Ih(s):s),n&&(r[U]=n),Object.keys(r).length&&this.ni(r),!1===s&&!1===n?this.oi([j,U]):!1===s?this.oi(j):!1===n&&this.oi(U),this.Fd(),!1===s?Rh.info("Flag overrides cleared"):s&&Rh.info("Flag overrides set",{flags:s}),void(!1===n?Rh.info("Payload overrides cleared"):n&&Rh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ni({[j]:t}),this.Fd(),void Rh.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){var i=this.Kd(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.Nd(A)||[]).find((i=>i.flagKey===t)),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[F]:[t],[I]:[t],[B]:Object.keys(o)}),this.ni({[F]:Object.keys(Fh(l)),[I]:l,[B]:e({},this.Nd(B)||{},o)}),this.Fd();try{var h;null==(h=this.Ns)||h.capture("$feature_enrollment_update",a).catch((t=>{this.A.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Nd(A);!r||i?this.Yd(t,e):t(r)}Yd(t,e){var r=this;return i((function*(){var i=r.Ns;if(i){var s,n=e?"&"+e.map((t=>"stage="+t)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.ni({[A]:s=o.json.earlyAccessFeatures})}catch(t){return void r.A.error("Early access feature request failed",t)}try{t(s)}catch(t){r.A.error("Early access feature callback failed",t)}}}))()}Kd(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Fd(t){this.Ad();var i=this.Kd(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Xd(t,i)}Xd(t,i){void 0===i&&(i=!0);var r=this.Nd(B)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this.ni({[B]:e({},r,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.Nd(B)||{});t.forEach((t=>{delete r[t]})),this.ni({[B]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.oi(B),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Nd(z)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.ni({[z]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Nd(z)||{};this.ni({[z]:e({},i,{[t]:{}})})}else this.oi(z)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.$d(),this.ld=!1,this._d=0}}},Yh={sessionRecording:class{get mn(){return this._instance.config}get Bo(){return this._instance.persistence}get started(){var t;return!(null==(t=this.tv)||!t.isStarted)}get status(){var t,i;return this.ev===eh||this.ev===rh?this.ev:null!==(t=null==(i=this.tv)?void 0:i.status)&&void 0!==t?t:this.ev}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ev=th,this.iv=void 0,this.rv=!1,this.jt=(()=>{var t;if(null==$t||!$t.visibilityState||"visible"===$t.visibilityState)return!0;var i=null==Et||null==(t=Et.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.Vt=()=>{var t;"visible"===(null==$t?void 0:$t.visibilityState)&&(this.jt=!0,null==(t=this.tv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw nh.error("started without valid sessionManager"),new Error(sh+" started without valid sessionManager. This is a bug.");if(this.mn.cookieless_mode===ft)throw new Error(sh+' cannot be used with cookieless_mode="always"');null!=$t&&$t.addEventListener&&ps($t,"visibilitychange",this.Vt)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.rv=!0,null==$t||null==$t.removeEventListener||$t.removeEventListener("visibilitychange",this.Vt),e?this.nv(!0):this.stopRecording()}get sv(){var t,i=!(null==(t=this._instance.get_property(S))||!t.enabled),e=!this.mn.disable_session_recording,r=this.mn.disable_session_recording||this._instance.consent.isOptedOut();return Et&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.rv||this.sv&&null!=(i=this.tv)&&i.isStarted)){var e=!ti(Object.assign)&&!ti(Array.from);this.sv&&e?(this.av(t),nh.info("starting")):(this.ev=th,this.stopRecording())}}av(t){var i,e;if(this.sv)if(this.ev!==eh&&this.ev!==rh&&(this.ev=ih),null!=Dt&&null!=(i=Dt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=Dt.__PosthogExtensions__)&&e.initSessionRecording)this.ov(t);else{var r,s=this._instance.sessionManager;null==(r=Dt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.lv,(i=>{if(!this.rv&&this.sv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[dt]:!0}),nh.error("could not load recorder",i)):void this.ov(t);this.ev=th}))}}stopRecording(){var t,i;null==(t=this.iv)||t.call(this),this.iv=void 0,null==(i=this.tv)||i.stop()}nv(t){var i,e;void 0===t&&(t=!1),null==(i=this.iv)||i.call(this),this.iv=void 0,null==(e=this.tv)||e.discard({discardProducerEvents:t})}uv(){var t,i;null==(t=this.Bo)||t.unregister(O),null==(i=this.Bo)||i.unregister(E)}hv(t,i){if(si(t))return null;var e,r=ni(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(nh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}dv(t){if(this.Bo){var i,r,s=this.Bo,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.hv(null==(i=this.mn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.hv(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;si(a)&&this.uv();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[S]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ti(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(i=this.iv)||i.call(this),this.iv=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.dv(i),void this.nv()):(this.dv(i),void this.startIfEnabledOrStop()):(this.ev===eh&&(this.ev=rh,nh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.tv)&&e.log?this.tv.log(t,i):nh.warn("log called before recorder was ready")}get lv(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(S);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}vv(){var t,i=this._instance.get_property(S);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return nh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!si(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}ov(t){var i,e,r;if(!this.rv&&this.sv&&this._instance.sessionManager){if(null==(i=Dt.__PosthogExtensions__)||!i.initSessionRecording)return nh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[dt]:!0});var s;if(this.tv||(this.tv=null==(s=Dt.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.jt),this.tv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.vv()){if(this.ev===rh||this.ev===eh)return;return this.ev=eh,nh.info("persisted remote config is stale, requesting fresh config before starting"),void new zo(this._instance).load()}this.ev=ih,null==(e=(r=this.tv).setDocumentWasEverVisible)||e.call(r,this.jt),this.tv.start(t)}else this.ev=th}onRRwebEmit(t){var i;null==(i=this.tv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.tv||null==(i=this.Bo)||i.register({[T]:!0}),null==(t=this.tv)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.tv||null==(i=this.Bo)||i.register({[k]:!0}),null==(t=this.tv)||t.overrideSampling()}overrideTrigger(t){var i,e;this.tv||null==(e=this.Bo)||e.register({["url"===t?P:R]:!0}),null==(i=this.tv)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.tv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.tv)||!e.tryAddCustomEvent(t,i))}}},Qh={autocapture:class extends zl{constructor(t){super(new Hl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.fv=this.pv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.gv();return!!(t.path||t.search||this.mv(t))}startIfEnabled(){this.isEnabled&&(ss.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.fv=this.pv(),this.startIfEnabled()}stop(){this.yv&&this.yv(),this.yv=void 0,this.bv&&this.bv(),this.bv=void 0,ss.info("History API monitoring stopped")}monitorHistoryChanges(){Et&&Et.history&&(this._v("pushState"),this._v("replaceState"),this.wv(),this.mv()&&this.Sv())}_v(t){var i;if(Et&&(null==(i=Et.history[t])||!i.__posthog_wrapped__)){var e=this;Gl(Et.history,t,(i=>function(r,s,n){i.call(this,r,s,n),e.xv(t)}))}}pv(){var t=null==Et?void 0:Et.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}gv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Xt(t)?t:{}}mv(t){return void 0===t&&(t=this.gv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Cv(t){var i=this.gv(),e=this.fv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.mv(i)&&t.hash!==e.hash))}xv(t){try{var i=this.pv();if(!i)return;this.Cv(i)&&this._instance.capture(yt,{navigation_type:t}),this.fv=i}catch(i){ss.error("Error capturing "+t+" pageview",i)}}wv(){if(!this.yv){var t=()=>{this.xv("popstate")};ps(Et,"popstate",t),this.yv=()=>{Et&&Et.removeEventListener("popstate",t)}}}Sv(){if(!this.bv){var t=()=>{this.xv("hashchange")};ps(Et,"hashchange",t),this.bv=()=>{Et&&Et.removeEventListener("hashchange",t)}}}},heatmaps:class{get mn(){return this.instance.config}constructor(t){var i;this.Tv=!1,this.Rs=!1,this.Mv=null,this.instance=t,this.Tv=!(null==(i=this.instance.persistence)||!i.props[f]),this.rageclicks=new Dl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Xt(this.mn.capture_heatmaps)&&this.mn.capture_heatmaps.flush_interval_milliseconds&&(t=this.mn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return si(this.mn.capture_heatmaps)?si(this.mn.enable_heatmaps)?this.Tv:this.mn.enable_heatmaps:!1!==this.mn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;oh.info("starting..."),this.Iv(),this.Vt()}else{var t;clearInterval(null!==(t=this.Mv)&&void 0!==t?t:void 0),this.Ev(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[f]:e}),this.Tv=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pt;return this.Pt=void 0,t}Rv(t){ah(t.originalEvent)&&this.Xi(t.originalEvent,"deadclick")}Vt(){this.Mv&&clearInterval(this.Mv),this.Mv="visible"===(null==$t?void 0:$t.visibilityState)?setInterval(this.Po.bind(this),this.flushIntervalMilliseconds):null}Iv(){Et&&$t&&(this.Pv=this.Po.bind(this),ps(Et,bt,this.Pv),this.Av=t=>this.Xi(t||(null==Et?void 0:Et.event)),ps($t,"click",this.Av,{capture:!0}),this.Fv=t=>this.Ov(t||(null==Et?void 0:Et.event)),ps($t,"mousemove",this.Fv,{capture:!0}),this.Lv=new jn(this.instance,Nn,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Dv=this.Vt.bind(this),ps($t,mt,this.Dv),this.Rs=!0)}Ev(){var t;Et&&$t&&(this.Pv&&Et.removeEventListener(bt,this.Pv),this.Av&&$t.removeEventListener("click",this.Av,{capture:!0}),this.Fv&&$t.removeEventListener("mousemove",this.Fv,{capture:!0}),this.Dv&&$t.removeEventListener(mt,this.Dv),clearTimeout(this.$v),null==(t=this.Lv)||t.stop(),this.Rs=!1)}Nv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&Xs(r)&&!Zs(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:Et)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(jt(i,s))return!0;r=vn(r)}return!1}(hn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}Xi(t,i){var r;if(void 0===i&&(i="click"),!Qs(t.target)&&ah(t)){var s=this.Nv(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&bn(hn(t),this.instance.config.rageclick)&&this.ks(e({},s,{type:"rageclick"})),this.ks(s)}}Ov(t){!Qs(t.target)&&ah(t)&&(clearTimeout(this.$v),this.$v=setTimeout((()=>{this.ks(this.Nv(t,"mousemove"))}),500))}ks(t){if(Et){var i=this.mn.disable_capture_url_hashes?qe(Et.location.href):Et.location.href,e=this.mn.custom_personal_data_properties,r=this.mn.mask_personal_data_properties?[...so,...e||[]]:[],s=Zn(i,r,oo);this.Pt=this.Pt||{},this.Pt[s]||(this.Pt[s]=[]),this.Pt[s].push(t)}}Po(){this.Pt&&!Zt(this.Pt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:jn,webVitalsAutocapture:class{constructor(t){var i;this.Tv=!1,this.Rs=!1,this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.qv=()=>{clearTimeout(this.jv),this.jv=void 0,0!==this.Pt.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.Pt.url},this.Pt.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.Pt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Bv=t=>{var i;if(this.Pt=this.Pt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},si(null==t?void 0:t.name)||si(null==t?void 0:t.value))Kl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Hv(r);if(!ti(s)){var n=ni(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.zv||this.zv>t.value){this.Pt.navigationKey!==n&&(this.qv(),this.jv=setTimeout(this.qv,this.flushToCaptureTimeoutMs)),ti(this.Pt.navigationKey)&&(this.Pt.navigationKey=n,this.Pt.url=s),this.Pt.firstMetricTimestamp=ti(this.Pt.firstMetricTimestamp)?Date.now():this.Pt.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=e({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,Xt(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Zl){var u="url"===h&&"string"==typeof t.attribution[h]?this.Hv(t.attribution[h]):t.attribution[h];ti(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ti(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Pt.metrics.push(a),this.Pt.metrics.length===this.allowedMetrics.length&&this.qv()}else Kl.error("Ignoring metric with value >= "+this.zv,t)}}},this.Uv=()=>{if(!this.Rs){var t,i,r,s,n=!1,o=Dt.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Wv])||("web-vitals"===this.Wv&&ti(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ti(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ti(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,r=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?e({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Bv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Bv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Bv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Bv.bind(this),v),this.Rs=!0}else Kl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Tv=!(null==(i=this._instance.persistence)||!i.props[m]),this.startIfEnabled()}get Vv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=Xt(this.Vv)?null==(t=this.Vv)?void 0:t.web_vitals_allowed_metrics:void 0;return si(e)?(null==(i=this._instance.persistence)?void 0:i.props[x])||Ql:e}get flushToCaptureTimeoutMs(){return(Xt(this.Vv)?this.Vv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=Xt(this.Vv)?this.Vv.web_vitals_attribution:void 0;return ai(t)?t?Ql:[]:Yt(t)?t:Xl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=Xt(this.Vv)?this.Vv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get zv(){var t=Xt(this.Vv)&&ni(this.Vv.__web_vitals_max_value)?this.Vv.__web_vitals_max_value:Yl;return t>0&&6e4>=t?Yl:t}get isEnabled(){var t=null==Pt?void 0:Pt.protocol;if("http:"!==t&&"https:"!==t)return Kl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=Xt(this.Vv)?this.Vv.web_vitals:ai(this.Vv)?this.Vv:void 0;return ai(i)?i:this.Tv}startIfEnabled(){this.isEnabled&&!this.Rs&&(Kl.info("enabled, starting..."),this.Ys(this.Uv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=Xt(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=Xt(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[m]:e}),this._instance.persistence.register({[x]:r})),this.Tv=e,this.startIfEnabled()}}}get Wv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ys(t){var i=Dt.__PosthogExtensions__,e=this.Wv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&ti(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Kl.error("failed to load script",i):t()}))}Hv(t){var i=t||(null==Et?void 0:Et.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?qe(i):i,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...so,...r||[]]:[];return Zn(e,s,oo)}Kl.error("Could not determine current URL")}}},Xh={exceptionObserver:class{constructor(t){var i;this.Uv=()=>{var t;if(Et&&this.isEnabled&&null!=(t=Dt.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=Dt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=Dt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Dt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gv&&this.mn.capture_unhandled_errors&&(this.Gv=i(this.captureException.bind(this))),!this.Zv&&this.mn.capture_unhandled_rejections&&(this.Zv=e(this.captureException.bind(this))),!this.Qv&&this.mn.capture_console_errors&&(this.Qv=r(this.captureException.bind(this)))}catch(t){ql.error("failed to start",t),this.Jv()}}},this._instance=t,this.Kv=!(null==(i=this._instance.persistence)||!i.props[p]),this.pe=new yi(e({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:ql})),this.mn=this.Yv(),this.startIfEnabledOrStop()}Yv(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Xt(t)?i=e({},i,t):(ti(t)?this.Kv:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.mn.capture_console_errors||this.mn.capture_unhandled_errors||this.mn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ql.info("enabled"),this.Jv(),this.Ys(this.Uv)):this.Jv()}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return ql.error("failed to load script",i);t()}))}Jv(){var t,i,e;null==(t=this.Gv)||t.call(this),this.Gv=void 0,null==(i=this.Zv)||i.call(this),this.Zv=void 0,null==(e=this.Qv)||e.call(this),this.Qv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Kv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[p]:this.Kv}),this.mn=this.Yv(),this.startIfEnabledOrStop())}}onConfigChange(){this.mn=this.Yv()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.pe.consumeRateLimit(s)?ql.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,r;this.Xv=[],this.tc=new Ke([new ar,new gr,new hr,new lr,new pr,new fr,new dr,new _r],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=or.test(l)?l.replace(or,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Ye});var r}))}(n)}}("web:javascript",er,nr)),this._instance=t,this.Xv=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(_))&&void 0!==i?i:[],this.ec=xr(this.ic()),this.rc=new Sr(this.ec)}onConfigChange(){this.ec=xr(this.ic()),this.rc.setConfig(this.ec)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Xv=n,this._instance.persistence&&this._instance.persistence.register({[_]:this.Xv,[g]:o})}}}get nc(){var t,i=!!this._instance.get_property(g),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.tc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.ec.enabled)try{if(!ii(t)||0===t.trim().length)return void Ah.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>yr.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.sc(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Ah.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.rc.add(e({[mr]:t,[br]:(new Date).toISOString()},s))}catch(t){Ah.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.ac(i)){if(this.oc(i))return this.lc("Exception dropped: matched a suppression rule"),void Ah.info("Skipping exception capture because a suppression rule matched");if(!this.nc&&this.uc(i))return this.lc("Exception dropped: thrown by a browser extension"),void Ah.info("Skipping exception capture because it was thrown by an extension");if(!this.nc&&this.hc(i))return this.lc("Exception dropped: thrown by an injected browser script"),void Ah.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.dc(i))return this.lc("Exception dropped: thrown by the PostHog SDK"),void Ah.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.ec.enabled&&si(t.$exception_steps)?this.vc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",gu:!0});return s&&this.rc.clear(),s}catch(t){return Ah.error("Failed to capture exception event. Dropping this exception.",t),void this.rc.clear()}}catch(t){return void Ah.error("Failed to process exception event. Ignoring this exception.",t)}var n}vc(t){try{var i=this.rc.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return Ah.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}lc(t){this.ec.enabled&&this.rc.add({[mr]:t,[br]:(new Date).toISOString()})}sc(t){return Xt(t)?e({},t):{}}ic(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}oc(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return ii(e)&&e.length>0&&t.$exception_types.push(e),ii(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Xv.some((t=>{var e=t.values.map((t=>{var e=Xa[t.operator],r=i[t.key];if(!e||!r)return!1;var s=Yt(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return Ah.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}uc(t){var i=t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})),e=i.filter((t=>{var i=t.filename;return!!i&&Dh.some((t=>i.startsWith(t)))}));return 0!==e.length&&(!e.every((t=>{var i=t.filename;return!!i&&i.startsWith(Mh)}))||t.some((t=>{var i=t.value;return ii(i)&&i.includes("isolatedAPI.contexts.topHostname")}))&&!i.some((t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Mh))})))}hc(t){return t.some((t=>{var i=t.value;return ii(i)&&Nh.some((t=>i.includes(t)))}))}dc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}ac(t){return!si(t)&&Yt(t)}}},Zh=e({productTours:class{get Bo(){return this._instance.persistence}constructor(t){this.cc=null,this.fc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Bo&&this.Bo.register({[y]:!!i.productTours}),!hh(this._instance))return!this.cc&&si(null==(e=this.Bo)?void 0:e.props[K])||lh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.cc)||r.stop(),this.cc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.cc&&hh(this._instance)&&this.Ys((()=>this.gc()))}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?lh.error("Could not load product tours script",i):t()}))}gc(){var t;!this.cc&&null!=(t=Dt.__PosthogExtensions__)&&t.generateProductTours&&(this.cc=Dt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!Yt(this.fc)||i){var e=this.Bo;if(e){var r=e.props[K];if(Yt(r)&&!i)return this.fc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(hh(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||lh.warn(s):lh.error(s),void t([],{isLoaded:!1,error:s})}var n=Yt(i.json.product_tours)?i.json.product_tours:[];this.fc=n,e&&e.register({[K]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.fc,{isLoaded:!0})}getActiveProductTours(t){si(this.cc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.cc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.cc)||i.showTourById(t)}previewTour(t){this.cc?this.cc.previewTour(t):this.Ys((()=>{var i;this.gc(),null==(i=this.cc)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.cc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.cc)||t.nextStep()}previousStep(){var t;null==(t=this.cc)||t.previousStep()}clearCache(){var t;this.fc=null,null==(t=this.Bo)||t.unregister(K)}resetTour(t){var i;null==(i=this.cc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.cc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.cc)||i.cancelPendingTour(t)}}},Kh),tu={siteApps:class{constructor(t){this.mc=0,this._instance=t,this.yc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}bc(t,i){if(i){var e=this.globalsForEvent(i);this.yc.push(e),this.yc.length>1e3&&(this.yc=this.yc.slice(10))}}get siteAppLoaders(){var t;return null==(t=Dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.bc.bind(this));this._c=()=>{t(),this.yc=[],this._c=void 0}}}globalsForEvent(t){var i,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(v)){var f=c[0];u[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:e({},r(t,uh),{properties:e({},t.properties,_?{$set:e({},null!==(i=null==(s=t.properties)?void 0:s.$set)&&void 0!==i?i:{},_)}:{},p?{$set_once:e({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}wc(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(dh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(dh.error("prepare_external_dependency_script returned null"),null):t}kc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==$t?void 0:$t.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.mc++,this.Sc)return this.xc();var u=[],d=this,v=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),u.push((()=>{t[i]=r}))}},f=t=>{if(v.has(t))return t;var i=d.wc(t);return i&&v.add(i),i},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ri(t)));return c(h,"appendChild",(t=>function(i){var e=f(i);return e?t.call(this,e):i})),c(h,"insertBefore",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i})),c(h,"replaceChild",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):e})),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null})),this.Sc=()=>{u.forEach((t=>t())),this.Sc=void 0},this.xc()}xc(){var t=!1;return()=>{var i;t||(t=!0,this.mc--,0===this.mc&&(null==(i=this.Sc)||i.call(this)))}}Cc(t,i){void 0===i&&(i=!0);var e=this.kc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.yc.length&&(dh.info("Processing "+this.yc.length+" events for site app with id "+t.id),this.yc.forEach((t=>this.Cc((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this._c)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,dh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.Cc((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){dh.error(vh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){dh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Tc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Mc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.Cc((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){dh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.Tc(),void this._instance.on("eventCaptured",(t=>this.Mc(t)))):void dh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this._c)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;Dt["__$$ph_site_app_"+i]=s._instance,null==(t=Dt.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return dh.error(vh+i,t)}))};for(var a of n.siteApps)o()}else dh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},iu={tracingHeaders:class{constructor(t){this.Ic=void 0,this.Ec=void 0,this.Rc=void 0,this.Uv=()=>{var t,i,e=this.Pc();e?(ti(this.Ic)&&(this.Ic=null==(t=Dt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ti(this.Ec)&&(this.Ec=null==(i=Dt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Jv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Ys(t){var i,e;null!=(i=Dt.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=Dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Jl.error("failed to load script",i);t()}))}Ac(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Pc(){var t=this.Ac();return Yt(t)?(Yt(this.Rc)?this.Rc.splice(0,this.Rc.length,...t):this.Rc=[...t],t.length>0?this.Rc:void 0):(Yt(this.Rc)&&this.Rc.splice(0),this.Rc=t||void 0,this.Rc)}Jv(){var t,i;null==(t=this.Ic)||t.call(this),null==(i=this.Ec)||i.call(this),this.Ic=void 0,this.Ec=void 0}startIfEnabledOrStop(){this.Pc()?this.Ys(this.Uv):this.Jv()}}},eu=e({surveys:class extends _h{constructor(t){var i;super(new xh(t),{get projectToken(){return i.config.token},kv:new wh(i=t)}),this._instance=t}Bu(t,i){var e=i.query?ka(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Kh),ru={toolbar:class{constructor(t){this.instance=t}Fc(t){Dt.ph_toolbar_state=t}Oc(){var t;return null!==(t=Dt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),_s(this.instance.config))return!1;if(!Et||!$t)return!1;t=null!=t?t:Et.location,e=null!=e?e:Et.history;try{if(!i){try{Et.localStorage.setItem("test","test"),Et.localStorage.removeItem("test")}catch(t){return!1}i=null==Et?void 0:Et.localStorage}var r,s=Sh||to(t.hash,"__posthog")||to(t.hash,"state"),n=s?us((()=>JSON.parse(atob(decodeURIComponent(s)))))||us((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(Eh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Lc(t){var i=Dt.ph_load_toolbar||Dt.ph_load_editor;!si(i)&&Qt(i)?i(t,this.instance):kh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==$t||!$t.getElementById(Gs));if(!Et||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Et.localStorage.setItem(Eh,JSON.stringify(e({},s,{source:void 0}))),2===this.Oc())this.Lc(s);else if(0===this.Oc()){var n;this.Fc(1),null==(n=Dt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return kh.error("[Toolbar] Failed to load",t),void this.Fc(0);this.Fc(2),this.Lc(s)})),ps(Et,"turbolinks:load",(()=>{this.Fc(0),this.loadToolbar(s)}))}return!0}Dc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},su=e({experiments:Uh},Kh),nu={conversations:class{constructor(t){this.$c=void 0,this._conversationsManager=null,this.Nc=!1,this.je=null,this.qc=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.jc=t.ok,t.ok)){var i=t.config.conversations;si(i)||(ai(i)?this.$c=i:(this.$c=i.enabled,this.je=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.$c=void 0,this.je=null,this.jc=void 0,this.qc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Nc||this._instance.config.disable_conversations||_s(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Dt?void 0:Dt.__PosthogExtensions__;if(t&&!ti(this.$c)&&this.$c)if(this.je&&this.je.token){this.Nc=!0;try{var i=t.initConversations;if(i)return this.Bc(i),void(this.Nc=!1);var e=t.loadExternalDependency;if(!e)return void this.Hc(vt);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Hc("Could not load conversations script",i):this.Bc(t.initConversations),this.Nc=!1}))}catch(t){this.Hc("Error initializing conversations",t),this.Nc=!1}}else Bh.error("Conversations enabled but missing token in remote config.")}}Bc(t){if(this.je)try{this._conversationsManager=t(this.je,this._instance),this.qc=!1,Bh.info("Conversations loaded successfully")}catch(t){this.Hc("Error completing conversations initialization",t)}else Bh.error("Cannot complete initialization: remote config is null")}Hc(t,i){Bh.error(t,i),this._conversationsManager=null,this.Nc=!1,this.qc=!0}show(){this._conversationsManager?this._conversationsManager.show():Bh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.$c&&!ri(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":_s(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.jc?"remote_config_failed":ti(this.$c)?this.jc?"disabled_in_project":"remote_config_pending":this.$c?si(this.je)||!this.je.token?"missing_token":null!=Dt&&Dt.__PosthogExtensions__?this.Nc?"initializing":this.qc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Bh.warn(zh),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Bh.warn(zh),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Bh.warn(zh),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Bh.warn(zh),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Bh.warn(zh),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Bh.warn(zh),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Bh.warn(zh),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Cu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Tu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},ou={logs:class{constructor(t){var i,r=this;this.name="logs",this.zc=!1,this.Uc=!1,this.Wc=!1,this.A=ns("[logs]"),this.Vc=e({},this.A,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(Jh)||r.A.error(...i)}}),this.bo=[],this.Gc=[],this._d=0,this.Os=!1,this.Zc=[],this.Qc=[],this.Jc=!1,this.Kc=!1,this.Yc=()=>{var t,i;this.Os||(this._d=0,null==(t=this.Xc)||t.onReconnect(),null==(i=this.tf)||i.onReconnect())},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.zc=!0),Et&&ps(Et,"online",this.Yc)}ef(t,i,e,r){var s,n=Hh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Xr(this.if(t,i),n,this.Vc,(()=>this.rf()),(t=>t()),void 0,r),n]}nf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Xc||this.sf!==i){var e;null==(e=this.Xc)||e.reset(),this.sf=i;var r=this.ef((()=>this.bo),(t=>{this.bo=t}));this.Xc=r[0],this.af=r[1]}return this.Xc}lf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.tf||this.uf!==i){var e;null==(e=this.tf)||e.reset(),this.uf=i;var r=this.ef((()=>this.Gc),(t=>{this.Gc=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Vh);this.tf=r[0],this.hf=r[1]}return this.tf}setup(t){var i;if(!this.Os){this.Ns=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.zc=!0),(this.zc||this.df()&&this.vf())&&this.cf();var e=!1,r=t.onRemoteConfig((t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)}));this.Os?r.dispose():(this.qs=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Os||(this.Os=!0,this.ff(),null==(t=this.qs)||t.dispose(),this.qs=void 0,this.Ns=void 0,this.Wc=!1,null==Et||Et.removeEventListener("online",this.Yc),null==(i=this.pf)||i.call(this),this.pf=void 0,null==(e=this.Xc)||e.reset(),null==(r=this.tf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Os){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;si(r)?this.gf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[w]:!!r}),r?(this.zc=!0,this.Uc||this.cf(),this.loadIfEnabled()):this.gf())}}reset(){var t,i,e,r;this.ff(),null==(t=this.Xc)||t.clearQueue(),this.bo=[],null==(i=this.Xc)||i.reset(),null==(e=this.tf)||e.clearQueue(),this.Gc=[],null==(r=this.tf)||r.reset(),this._d=0}captureLog(t){this.Os||this.nf().captureLog(t)}captureConsoleLog(t){this.Os||this.lf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Os||this.lf().captureLog(t,{context:i,occurredAtMs:e})}vf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[w])}df(){var t,i;return null==(t=this._instance)||null==t.fo||!t.fo()||!(null==(i=Dt._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Iu(){var t;this.ff(),null==(t=this.tf)||t.clearQueue(),this.Gc=[]}gf(){this.zc||this.ff()}cf(){var t,i=this;if(!this.Jc&&null!=Dt&&Dt.console){var e=Hh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(Dt.console[t])}catch(t){return 0}if(!r)return 0;i.Qc.push(Gl(Dt.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.mf(t,n,e)}catch(t){}return s.apply(Dt.console,n)};return n.__rrweb_original__=r,n})))};for(var s of qh)r(s);this.Jc=!0,this.yf=setTimeout((()=>{this.ff()}),3e4)}}mf(t,i,e){var r;if(this.Jc&&!this.Kc&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.Zc.length){this.Kc=!0;try{this.Zc.push({level:t,args:i,occurredAtMs:Date.now(),context:this.rf()})}finally{this.Kc=!1}}}else this.ff()}ff(){if(this.Zc=[],this.Jc){for(var t of(this.Jc=!1,this.yf&&(clearTimeout(this.yf),this.yf=void 0),this.Qc))t();this.Qc=[]}}bf(){var t=this.Zc;return this.ff(),t}get logger(){return this._f||(this._f={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this._f}flushLogs(t){t?this.wf(t):(this.Xc&&this.Xc.flush().catch((t=>this.kf(t))),this.tf&&this.tf.flush().catch((t=>this.kf(t))))}kf(t){Jh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Os&&this.zc&&!this.Uc&&!this.Wc){var t=null==Dt?void 0:Dt.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.ff();var i=t.loadExternalDependency;if(!i)return this.A.error(vt),void this.ff();this.Wc=!0;try{i(this._instance,"logs",(i=>{if(this.Wc=!1,!this.Os&&this.zc){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.ff();else{var r,s,n=this.bf();this.pf=e.initializeLogs(null!==(r=this.Ns)&&void 0!==r?r:this._instance),this.Uc=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Ns)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.Wc=!1,t}}}if(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===Ht.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===Ht.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},hs:t=>this.hs(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}hs(t){return new Promise((i=>{if(io(this._d,3))i({kind:"fatal",error:Gh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Gh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Sf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.xf(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Gh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}xf(t){(0!==t||this._instance.__loaded)&&(this._d=eo(t,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."))))}wf(t){this.bo.length>0&&this.Cf(t,this.bo,this.af,s.LIB_NAME,(t=>{this.bo=t})),this.Gc.length>0&&this.Cf(t,this.Gc,this.hf,Vh,(t=>{this.Gc=t}))}Cf(t,i,e,r,n){if(0!==i.length){var o=i.map((t=>t.record));n([]);var a=Qr(o,Yr(e,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Sf(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Sf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}rf(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,si(s)||(i.sessionStartTimestamp=s),si(n)||(i.lastActivityTimestamp=n)}if(null!=Dt&&null!=(t=Dt.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?qe(Dt.location.href):Dt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},au={metrics:class{constructor(t){this.A=ns("[metrics]"),this._instance=t}initialize(){}nf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Xc&&this.sf===e||(null==(i=this.Xc)||i.reset(),this.sf=e,this.Xc=new es(this.if(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.Xc}count(t,i,e){void 0===i&&(i=1),this.nf().count(t,i,e)}gauge(t,i,e){this.nf().gauge(t,i,e)}histogram(t,i,e){this.nf().histogram(t,i,e)}flush(t){if(!this.Xc)return Promise.resolve();if(t){var i=this.Xc.drainWindow();return i&&this.Ms(i,t),Promise.resolve()}return this.Xc.flush().catch((t=>this.A.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Xc)||t.reset()}if(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ms:t=>i.Ms(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Ms(t,i){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(e({method:"POST",url:this.Tf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}Tf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},lu=e({},Kh,Yh,Qh,Xh,Zh,tu,eu,iu,ru,su,nu,ou,au);Ml.__defaultExtensionClasses=e({},lu);var hu=ns("[ExternalScriptsLoader]"),uu=t=>{var i=null==$t?void 0:$t.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},du=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return hu.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=uu(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",(t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)})),void r.addEventListener("error",(t=>{r.__posthog_loading_error=t,e(t)})))}var n=()=>{if(!$t)return e("document not found");if(uu(i))return du(t,i,e);var r=$t.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)$t.head.appendChild(r);else{var s,n=$t.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):$t.body.appendChild(r)}};null!=$t&&$t.body?n():null==$t||$t.addEventListener("DOMContentLoaded",n)},vu={},cu=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};Dt.__PosthogExtensions__=Dt.__PosthogExtensions__||{},Dt.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=vu[s];if("fallback"===r&&n){if(uu(n))return void du(t,n,e);delete vu[s]}du(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=cu(t,i);vu[s]=a;var l=uu(s);null==l||null==(o=l.parentNode)||o.removeChild(l),du(t,a,e)}else e(void 0,n)}:e)}else du(t,cu(t,i),e)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");du(t,o,e)}},Dt.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);du(t,r,e)};var fu=function(){s.SDK_DIST_CHANNEL="npm";var t=ml[Pl]=new Ml;return function(){function t(){t.done||(t.done=!0,Rl=!1,as(ml,(function(t){t._dom_loaded()})))}null!=$t&&$t.addEventListener?"complete"===$t.readyState?t():ps($t,"DOMContentLoaded",t,{capture:!1}):Et&&ss.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Co,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Mo,exports.PostHog=Ml,exports.ProductTourEventName=No,exports.ProductTourEventProperties=Lo,exports.SurveyEventName=Fo,exports.SurveyEventProperties=Ao,exports.SurveyEventType=Oo,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Io,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=fu,exports.posthog=fu,exports.severityLevels=["fatal","error","warning","log","info","debug"];
2
2
  //# sourceMappingURL=main.js.map