posthog-js 1.455.0 → 1.455.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/exception-autocapture.d.ts +4 -3
- package/dist/exception-autocapture.js +1 -1
- package/dist/exception-autocapture.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/external-scripts-loader.js +1 -1
- package/dist/integrity.json +28 -28
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/src/entrypoints/exception-autocapture.d.ts +4 -3
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/entrypoints/exception-autocapture.d.ts +4 -3
- package/lib/src/entrypoints/exception-autocapture.js +92 -42
- package/lib/src/entrypoints/exception-autocapture.js.map +1 -1
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="0.14.1",i={DEBUG:(!1,!1),LIB_VERSION:(t,"1.455.0"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:t};var e=i;const s="u">typeof window?window:void 0,n="u">typeof globalThis?globalThis:s,r=null==n?void 0:n.navigator,o=null==n?void 0:n.document,l=null==n?void 0:n.location,a=null==n?void 0:n.fetch,u=(null==n?void 0:n.XMLHttpRequest)&&"withCredentials"in new n.XMLHttpRequest?n.XMLHttpRequest:void 0,h=null==n?void 0:n.AbortController,c=null==n?void 0:n.CompressionStream,d=null==r?void 0:r.userAgent,v="undefined"!=typeof globalThis?globalThis:s;v&&"undefined"==typeof self&&(v.self=v),v&&"undefined"==typeof File&&(v.File=function(){});const f=null!=s?s:{};let p;const g=t=>{var i;return(null==t?void 0:t.config.require_subresource_integrity)?t.__loadExternalDependency:null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency},_="$early_access_features",m="$active_feature_flags",y="$feature_flag_details",b="$feature_flag_errors",w="$feature_flag_evaluated_at",x="$feature_flag_request_id",S="$minimal_flag_called_events",k="$enabled_feature_flags",E="$stored_group_properties",T="$stored_person_properties",P="$flag_call_reported",O="$flag_call_reported_session_id",C="$feature_flag_payloads",R="$override_feature_flags",A="$override_feature_flag_payloads",I="visibilitychange",M="$autocapture_disabled_server_side",F="$surveys",D="$surveys_loaded_at",j="PostHog loadExternalDependency extension not found.",L="$surveys_activated",N="$surveys_activated_session",B="$surveys_activated_timestamps",U="$people_distinct_id",z="distinct_id",H="$device_id",q="$device_model",W="__alias",V="__cmpns",G="$fbc",K="$fbc_persistence",J="$fbp",Y="$fbp_persistence",Z="__timers",X="$heatmaps_enabled_server_side",Q="$exception_capture_enabled_server_side",tt="$error_tracking_suppression_rules",it="$error_tracking_capture_extension_exceptions",et="$web_vitals_enabled_server_side",st="$dead_clicks_enabled_server_side",nt="$product_tours_enabled_server_side",rt="$logs_capture_enabled_server_side",ot="$web_vitals_allowed_metrics",lt="$session_recording_remote_config",at="$session_recording_enabled_server_side",ut="$replay_sample_rate",ht="$replay_override_sampling",ct="$replay_override_linked_flag",dt="$replay_override_url_trigger",vt="$replay_override_event_trigger",ft="$sesid",pt="$session_is_sampled",gt="$session_past_minimum_duration",_t="$session_recording_url_trigger_activated_session",mt="$session_recording_event_trigger_activated_session",yt="$debug_first_full_snapshot_timestamp",bt="$sess_rec_flush_size",wt="$groups",$t="ph_product_tours",xt="$product_tours_activated",St="$product_tours_activated_session",kt="$conversations_widget_session_id",Et="$conversations_ticket_id",Tt="$conversations_widget_state",Pt="$conversations_user_traits",Ot="$user_state",Ct="$client_session_props",Rt="$capture_rate_limit",At="$initial_campaign_params",It="$initial_referrer_info",Mt="$initial_person_info",Ft="$epp",Dt="$posthog_cookieless",jt="$cookieless_mode",Lt="$sdk_debug_extensions_init_method",Nt="$sdk_debug_extensions_init_time_ms",Bt="$sdk_debug_recording_script_not_loaded",Ut="$sdk_debug_replay_stale_config",zt="$sdk_debug_replay_event_trigger_status",Ht="$sdk_debug_replay_linked_flag_trigger_status",qt="$sdk_debug_replay_matched_recording_trigger_groups",Wt="$sdk_debug_replay_pending_trigger_conditions",Vt="$sdk_debug_replay_remote_trigger_matching_config",Gt="$sdk_debug_replay_trigger_groups_count",Kt="$sdk_debug_replay_url_trigger_status",Jt="$session_recording_start_reason",Yt="anonymous",Zt="identified",Xt="identified_only",Qt="beforeunload",ti="$pageview",ii="$pageleave",ei="$identify",si="$groupidentify";var ni=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.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ri=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const oi=["$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"],li=["token"];function ai(t,i){return-1!==t.indexOf(i)}const ui=function(t){return t.trim()},hi=function(t){return t.replace(/^\$/,"")};function ci(t){var i;const 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"}const di=Object.prototype,vi=di.hasOwnProperty,fi=di.toString,pi=Array.isArray||function(t){return"[object Array]"===fi.call(t)},gi=t=>"function"==typeof t,_i=t=>t===Object(t)&&!pi(t),mi=t=>{if(_i(t)){for(const i in t)if(vi.call(t,i))return!1;return!0}return!1},yi=t=>void 0===t,bi=t=>"[object String]"==fi.call(t),wi=t=>bi(t)&&0===t.trim().length,$i=t=>null===t,xi=t=>yi(t)||$i(t),Si=t=>"[object Number]"==fi.call(t)&&t==t,ki=t=>Si(t)&&t>0,Ei=t=>"[object Boolean]"===fi.call(t),Ti=t=>ai(oi,t),Pi=t=>ai(li,t);function Oi(t){return null===t||"object"!=typeof t}function Ci(t,i){return{}.toString.call(t)===`[object ${i}]`}function Ri(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 Ii(t,Error)}}function Ai(t){return"u">typeof Event&&Ii(t,Event)}function Ii(t,i){try{return t instanceof i}catch(t){return!1}}const Mi=[!0,"true",1,"1","yes"],Fi=t=>ai(Mi,t),Di=[!1,"false",0,"0","no"];function ji(t,i,e,s,n,r,o){try{var l=t[r](o),a=l.value}catch(t){return void e(t)}l.done?i(a):Promise.resolve(a).then(s,n)}function Li(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){ji(r,s,n,o,l,"next",t)}function l(t){ji(r,s,n,o,l,"throw",t)}o(void 0)})}}const Ni=["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","lightpanda","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"],Bi=new Map,Ui=function(t,i=[]){if(!t)return!1;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Bi.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Ni.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Bi.size||Bi.clear(),Bi.set(e,r),r};function zi(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),Si(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),zi(null!=n?n:e,i,e,s))}var Hi=class{constructor(t){this.C={},this.I=t.I,this.A=zi(t.bucketSize,0,100,t.R),this.O=zi(t.refillRate,0,this.A,t.R),this.$=zi(t.refillInterval,0,864e5,t.R)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.$);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.A),t.lastAccess=t.lastAccess+e*this.$)}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.A,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={}}};const qi="Mobile",Wi="Android",Vi="Tablet",Gi="Android Tablet",Ki="iPad",Ji="Apple Watch",Yi="Safari",Zi="BlackBerry",Xi="Samsung Internet",Qi="Chrome",te="Chrome iOS",ie="Internet Explorer",ee="Internet Explorer Mobile",se="Opera",ne="Microsoft Edge",re="Firefox",oe="Firefox iOS",le="Nintendo",ae="PlayStation",ue="Xbox",he="Android Mobile",ce="Mobile Safari",de="Windows",ve="Windows Phone",fe="Nokia",pe="Ouya",ge="Generic tablet",_e="Konqueror",me="Oculus Browser",ye="Vivaldi",be="Yandex",we="Whale",$e="DuckDuckGo",xe="Pale Moon",Se="Waterfox",ke="Brave",Ee="Claude",Te="Codex",Pe="ChatGPT",Oe="Google Search App",Ce=new RegExp("Version/(\\d+(\\.\\d+)?)"),Re=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ae=new RegExp(ue,"i"),Ie=new RegExp("PlayStation \\w+","i"),Me=new RegExp("Nintendo \\w+","i"),Fe=new RegExp("BlackBerry|PlayBook|BB10","i"),De={"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"},je=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?ke:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&ai(t,"GSA/")?Oe:ai(t," OPR/")&&ai(t,"Mini")?"Opera Mini":ai(t," OPR/")?se:Fe.test(t)?Zi:ai(t,"IEMobile")||ai(t,"WPDesktop")?ee:ai(t,"OculusBrowser")?me:ai(t,"SamsungBrowser")?Xi:ai(t,"Edge")||ai(t,"Edg/")?ne:ai(t,"Vivaldi/")?ye:ai(t,"YaBrowser/")?be:ai(t,"Whale/")?we:ai(t,"DuckDuckGo/")||ai(t,"Ddg/")?$e:ai(t,"Claude/")?Ee:ai(t,"Codex/")?Te:ai(t,"ChatGPT/")?Pe:ai(t,"FBIOS")?"Facebook Mobile":ai(t,"UCWEB")||ai(t,"UCBrowser")?"UC Browser":ai(t,"CriOS")?te:ai(t,"CrMo")||ai(t,Qi)?Qi:ai(t,Wi)&&ai(t,Yi)?he:ai(t,"FxiOS")?oe:ai(t.toLowerCase(),_e.toLowerCase())?_e:ai(t,"Brave/")?ke:((t,i)=>i&&ai(i,"Apple")||function(t){return ai(t,Yi)&&!ai(t,Qi)&&!ai(t,Wi)}(t))(t,i)?ai(t,qi)?ce:Yi:ai(t,"PaleMoon/")?xe:ai(t,"Waterfox/")?Se:ai(t,re)?re:ai(t,"MSIE")||ai(t,"Trident/")?ie:ai(t,"Gecko")?re:"")},Le={[ee]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Qi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Yi]:[Ce],[ce]:[Ce],[se]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[re]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[oe]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Zi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ce],[he]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Xi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[ke]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ee]:[Re],[Te]:[Re],[Pe]:[Re],[$e]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[xe]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Oe]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ie]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ne=function(t,i,e,s){const n=je(t,i,e,s),r=Le[n];if(yi(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},Be=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[ue,t&&t[1]||""]],[new RegExp(le,"i"),[le,""]],[new RegExp(ae,"i"),[ae,""]],[Fe,[Zi,""]],[new RegExp(de,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ve,""];if(new RegExp(qi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=De[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[de,t]}return[de,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let i="";return t&&t.length>=3&&(i=yi(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Wi,[t[2],t[3],t[4]||"0"].join(".")]:[Wi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const 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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ue=function(t){for(let i=0;Be.length>i;i++){const[e,s]=Be[i],n=e.exec(t),r=n&&(gi(s)?s(n,t):s);if(r)return r}return["",""]},ze=function(t){return Me.test(t)?le:Ie.test(t)?ae:Ae.test(t)?ue:new RegExp(pe,"i").test(t)?pe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ve:/iPad/.test(t)?Ki:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ji:Fe.test(t)?Zi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(fe,"i").test(t)?fe:/(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(qi).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)?Wi:Gi:new RegExp("(pda|Mobile)","i").test(t)?"Generic mobile":new RegExp(Vi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ge:""},He=function(t,i){var e;const s=ze(t);return s===Ki||s===Gi||"Kobo"===s||"Kindle Fire"===s||s===ge?Vi:s===le||s===ue||s===ae||s===pe?"Console":s===Ji?"Wearable":s?qi:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?qi:Vi:"Desktop";var n,r,o},qe=/\bFBAV\/(\d+(?:\.\d+)*)/i,We=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",qe],[/\bFBAN\/EMA\b/i,"Facebook Lite",qe],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",qe],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Ve="[Truncated]",Ge="[Unserializable]";function Ke(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else{const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function Je(t,i){if(!i)return t;let e=[];try{e=Object.keys(i)}catch(t){e=[]}for(const s of e){let e;try{e=i[s]}catch(t){e=Ge}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const Ye=3e5;var Ze=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,Ye);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+Ye))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(Ye,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qe(t,i){return"string"==typeof(e=t)&&Xe.test(e)?t:i();var e}function ts(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function is(t){return t?t.split("#")[0]:t}function es(t){try{return t()}catch(t){return}}function ss(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function ns(t,i,e){return rs.apply(this,arguments)}function rs(){return(rs=Li(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=ss(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function os(t){return os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},os(t)}function ls(t,i,e){return(i=function(t){var i=function(t){if("object"!=os(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=os(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==os(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function as(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function us(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?as(Object(e),!0).forEach(function(i){ls(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):as(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}let hs,cs,ds,vs;function fs(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(vs&&ps(e,n,cs)&&ps(s,r,ds))return vs;cs=e?us({},e):void 0,ds=s?us({},s):void 0,vs={},null!==(i=hs)&&void 0!==i||(hs={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==hs?void 0:hs[n];if(r){vs[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){vs[e]=i,hs[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),vs}function ps(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var gs=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return Li(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&pi(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)}catch(t){}return us(us({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return Li(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,a=void 0===n?us(us({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),e.push(u),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member")};return s(t),e}buildParsingContext(t){var i;return{chunkIdMap:fs(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(Ri(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return pi(i)?i:void 0}e=Object.getPrototypeOf(e)}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=!1;const o=new Set,l=[],a={},u=(t,i,e=0)=>{const u=h(i,e),c=u.apply;if(u.apply=i=>{l.push(t);try{return c(i)}finally{l.pop()}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||d&&o.has(t))return;d&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||s>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=u.next(v[t])}catch(t){s++,e=this.coerceFallback(h(i+1))}e&&g.push(e)}return us(us({},f),{},{errors:g})},h=(e,s=0)=>us(us({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=u(t,e,s+1);if(!i)throw a;return i},next:t=>u(t,e+1)}),c=h(e);return us(us({},c),{},{apply:t=>{var i;return null!==(i=u(t,e))&&void 0!==i?i:this.coerceFallback(c)}})}};const _s=/^([a-z][a-z0-9.+-]+):/i,ms=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ys(t){if(!t||"<anonymous>"===t)return!1;const i=_s.exec(t);return!i||ms.includes(i[1].toLowerCase())}function bs(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ys(i)};return yi(s)||(r.lineno=s),yi(n)||(r.colno=n),r}const ws=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},$s=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xs=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ss=/\((\S*)(?::(\d+))(?::(\d+))\)/,ks=(t,i)=>{const e=$s.exec(t);if(e){const[,t,s,n]=e;return bs(i,t,"?",+s,+n)}const s=xs.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=Ss.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=ws(s[1]||"?",s[2]);return bs(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Es=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ts=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ps=(t,i)=>{const e=Es.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Ts.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],s=e[1]||"?";return[s,t]=ws(s,t),bs(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Os=/\(error: (.*)\)/;function Cs(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Rs(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=!0;for(let n=0;i>n;n++)if(!Cs(t[e+n],t[e+i+n])){s=!1;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function As(t,i){const e=i.start+i.length,s=Ms(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function Is(t,i){let e=i.start;for(;e>0&&Cs(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Ms(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&Cs(t[s],t[s-i.length]);)s++;return s-e}function Fs(t,i){const e=i[0];let s=t.length-(e?Is(t,e):0);for(const e of i)s-=Ms(t,e);return s}function Ds(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return!1}var js=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=bi(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){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return Ci(t,"DOMException")}isDOMError(t){return Ci(t,"DOMError")}},Ls=class{match(t){return Ri(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Ns=class{match(t){return!!Ci(t,"ErrorEvent")&&(null!=t.error||this.$r(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return us(us({},s),{},{stack:null!==(e=this.Lr(t))&&void 0!==e?e:s.stack,synthetic:!0})}$r(t){return bi(t.message)&&t.message.length>0}Lr(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(bi(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Bs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Us=class{match(t){return"string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}getInfos(t){let i="Error",e=t;const s=t.match(Bs);return s&&(i=s[1],e=s[2]),[i,e]}};const zs=["fatal","error","warning","log","info","debug"];function Hs(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";let s="";for(const t of e){const e=s?`${s}, ${t}`:t;if(e.length>i)break;s=e}return s}var qs=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Ai(t))return t.constructor.name;const i="name"in t?t.name:void 0;return bi(i)&&!wi(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let 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;const i=this.getObjectClassName(t);return`${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${Hs(t)}`}isSeverityLevel(t){return bi(t)&&!wi(t)&&zs.indexOf(t)>=0}getStack(t){try{return bi(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:bi(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(Ri(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ws=class{match(t){return Ai(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Hs(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},Vs=class{match(t){return Oi(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?void 0:e.stack,synthetic:!0}}},Gs=class{match(t){return Ci(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ai(t))return!1;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return Oi(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}:i.apply(s)}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}};const Ks="$message",Js="$timestamp",Ys=new Set([Ks,Js]),Zs={enabled:!0,max_bytes:32768};function Xs(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Zs.enabled,max_bytes:tn(t.max_bytes,Zs.max_bytes)}:us({},Zs)}var Qs=class{constructor(t){this.ns=[],this.ss=0,this.Yr=Xs(t)}setConfig(t){this.Yr=Xs(t),this.rs()}add(t){const i=function(t){let i;try{i=ci(t)}catch(t){return}try{const t=JSON.parse(i);if(!_i(t))return;const e=t,s=e[Ks],n=e[Js];if(!bi(s)||0===s.trim().length)return;if(!bi(n)&&!Si(n))return;return{step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Yr.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Yr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function tn(t,i){if(!Si(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const en=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function sn(t){return"string"==typeof t||t}function nn(t){return"string"==typeof t?t:void 0}const rn=["$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","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],on="NativeGzipValidationError",ln=t=>t.length>=2&&31===t[0]&&139===t[1],an=(t,i)=>t===ri.GZipJS||i===ri.GZipJS||"gzip"===i,un=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let hn;const cn=t=>{throw ts(on,`Native gzip produced invalid output: ${t}`)};let dn=0,vn=!1;const fn=function(){var t=Li(function*(t,i){18>t.size&&cn("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());ln(e)&&8===e[2]||cn("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer()),n=i.length>>>0;s.getUint32(4,!0)!==n&&cn("invalid-size"),(vn||3>dn)&&(s.getUint32(0,!0)!==(t=>{const i=(()=>{if(hn)return hn;hn=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;hn[t]=i>>>0}return hn})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&(vn=!0,cn("invalid-crc")),dn++)});return function(i,e){return t.apply(this,arguments)}}();function pn(){return pn=Li(function*(t,i=!0,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=Li(function*(t){try{yield n.abort(t)}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield fn(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s}),pn.apply(this,arguments)}function gn(t,i){if(null==t)return{};var e,s,n=function(t,i){if(null==t)return{};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s]}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}const _n="[redacted]",mn=/^[A-Za-z0-9+/\n\r]+=*$/,yn=/^[A-Za-z0-9_-]+={0,2}$/,bn=/[-_]/,wn=/^data:[^,\s]*;base64,/i,$n=/^[A-Za-z0-9+/_-]+={0,2}$/,xn=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Sn=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,kn=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,En=/[\s<>"]/,Tn=(()=>new RegExp(kn.source,"i"))(),Pn=/[a-z][a-z0-9+.-]{0,63}:\/\//i,On=(()=>new RegExp(`^${Pn.source}`,"i"))(),Cn=(()=>new RegExp(Pn.source,"gi"))(),Rn=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,An=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,In=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Mn=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Fn=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Dn=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,jn=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Ln=/\d+/g,Nn=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Bn=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Un(t){return function(t){return Sn.test(t)}(t)||Rn.test(t)||An.test(t)}function zn(t){return t.split("&",129).length>128}function Hn(t,i,e){return Un(t)||i.includes(";")&&function(t){return t.split(";").some(t=>Un(t.split("=",1)[0]))}(i)?_n:Tn.test(i)?e?Jn(i,{allowNestedUrls:!1,stripPunctuation:!0}):_n:i}function qn(t,i){const e=new URLSearchParams;let s=!1,n=!1;for(const[r,o]of new URLSearchParams(t)){const t=Yn(r),l=Yn(o);s||(s=t!==r||l!==o);const a=Hn(t,l,i);s||(s=a!==l),n=Un(t)||a!==l,e.append(t,a)}return{changed:s,lastFieldSensitive:n,serialized:e.toString()}}function Wn(t,i){if(!t.includes("="))return{value:Vn(t,i),lastFieldSensitive:!1};const e=qn(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function Vn(t,i){return i?Jn(t,{allowNestedUrls:!1,stripPunctuation:!0}):Tn.test(t)?_n:t}function Gn(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function Kn(t,i){var e;if(t.length>8192&&On.test(t))return _n;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s)}catch(t){return _n+n}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(zn(o)||zn(a.head)||zn(null!==(e=a.tail)&&void 0!==e?e:""))return _n+n;let u=!1;(r.username||r.password)&&(r.username=_n,r.password="",u=!0);const h=qn(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,u=!0);const c=Wn(a.head,i.allowNestedUrls),d=null===a.tail?null:(v=a.tail,c.lastFieldSensitive?{value:""===v?"":_n,lastFieldSensitive:!0}:Wn(v,i.allowNestedUrls));var v;const f=null===d?c.value:`${c.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:c:h;return(u?Yn(r.toString()):s)+(p.lastFieldSensitive?"":n)}function Jn(t,i){return t.replace(kn,e=>function(t,i){const e=function(t){if(!t.includes("://"))return[];const i=[...t.matchAll(Cn)].map(t=>t.index),e=[],s={query:!1,fragment:!1,fragmentQuery:!1};let n=0,r=!1,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const a=t[l];Gn(a,s,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return e}(t);if(0===e.length)return Kn(t,i);let s="",n=0;for(const r of e)s+=Kn(t.slice(n,r),us(us({},i),{},{stripPunctuation:!1})),n=r;return s+Kn(t.slice(n),i)}(e,us(us({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function Yn(t){return t.replace(xn,_n)}function Zn(t,i){return function(t){return t.length>=10240&&(mn.test(t)||function(t){const i=wn.exec(t);if(!i)return!1;let e;try{e=decodeURIComponent(t.slice(i[0].length))}catch(t){return!1}return $n.test(e.replace(/[\r\n]/g,""))}(t)||bn.test(t)&&yn.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!En.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return Jn(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let i=t.replace(In," ");return i=i.replace(Mn,_n),i=i.replace(Fn,_n),i=i.replace(Dn,`$1${_n}`),i=function(t){let i="",e=0;for(let s=er(t,0);null!==s;s=er(t,s[1]))i+=t.slice(e,s[0])+sr(t.slice(s[0],s[1])),e=s[1];return i+t.slice(e)}(i),i=i.replace(jn,_n),i=i.replace(Nn,`$1${_n}`),i=i.replace(Bn,`$1${_n}`),i}(Yn(t))),i)}function Xn(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return!1;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function Qn(t,i){const e=t.charCodeAt(i);return e>=48&&57>=e}function tr(t,i){const e=t.charCodeAt(i);return Qn(t,i)||95===e||e>=65&&90>=e||e>=97&&122>=e}function ir(t,i){let e=i;for(;Qn(t,e);)e++;return e}function er(t,i){for(let e=i;t.length>e;e++){if(!Qn(t,e)||tr(t,e-1))continue;let i=0,s=-1,n=e;for(;;){const e=ir(t,n);if(i+=e-n,13>i||tr(t,e)||(s=e),n=e+1,!" ./-".includes(t.charAt(e))||!Qn(t,n))break}if(s>=0)return[e,s];e=n-1}return null}function sr(t){const i=[];for(let e=Ln.exec(t);null!==e;e=Ln.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&Xn(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+_n,s=i[o].end,n=o+1)}return e+t.slice(s)}const nr={}.propertyIsEnumerable;function rr(t,i){try{return ar(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function or(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:Ve};if(e.remainingNodes--,Ei(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>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)};const e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Ke(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Ve};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?Ke(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return or(n.call(t),i,e,s+1)}catch(t){}return pi(t)?{arrayValue:{values:lr(t,i,e,s+1)}}:{kvlistValue:{values:ar(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ke(String(t))}}function lr(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(xi(r))continue;n.push(or(r,i,e,s))}catch(t){n.push({stringValue:Ge})}return t.length>o&&n.push({stringValue:Ve}),n}function ar(t,i,e,s){const n=[];for(const r in t)if(nr.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if($i(o)||yi(o))continue;n.push({key:Ke(r),value:or(o,i,e,s)})}catch(t){n.push({key:Ke(r),value:{stringValue:Ge}})}}return n}function ur(t,i,e){return us(us(us(us({},Je({},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":e})}const hr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function cr(t,i){const e=Je({},t),s={};for(const t of hr)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...rr(e,i),...rr(s,i)]}const dr={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const vr={text:"INFO",number:9},fr={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:vr,warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}};function pr(t){try{return Ke(String(t))}catch(t){return Ge}}function gr(t,i,e,s){const n=t.level||"info",{text:r,number:o}=fr[n]||vr,l=function(t=Date.now()){return String(t)+"000000"}(Si(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),xi(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),xi(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);const u=us({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(i){t=[]}for(const i of t){let t;try{t=h[i]}catch(i){t=Ge}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:pr(t.body)},attributes:rr(u,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),yi(t.trace_flags)||(c.flags=t.trace_flags),c}function _r(t,i,e){return ur(t,i,e)}function mr(t,i,e,s){return{resourceLogs:[{resource:{attributes:cr(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var yr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=ss(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function br(){return.75+.5*Math.random()}function wr(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,t)))*e)}var $r=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o,l=()=>!1){var a;this._instance=t,this.Yr=i,this.R=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=l,this.gs=new yr(()=>this.ys()),this.bs=null,this._s=0,this.ws=0,this.ks=null,this.Ss=new Ze,this.xs=0,this.$s=1,this.Cs=0,this.Ts=0,this.Ms=!1,this.Is=i.maxBufferSize,this.Es=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.As=i.flushIntervalMs,this.Rs=i.maxBatchRecordsPerPost,this.Ps=i.rateCapWindowMs,this.Os=i.maxLogsPerInterval}clearQueue(){this.ws++,this._instance.setPersistedProperty(ni.LogsQueue,[])}get throttled(){return this.Ss.isOpen()}reset(){this.gs.clear(),this.Cs=0,this.Ts=0,this.Ms=!1,this.xs=0,this.$s=1,this.Ss.reset(),this.Rs=this.Yr.maxBatchRecordsPerPost}onReconnect(){this.xs=0,this.$s=1,this.Ss.isOpen()?this.Fs()&&this.Ls():this.ys()}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Ds(t);if(null===s)return;if(!s.body)return void this.R.info("Log was rejected in beforeSend function");if(!this.Ns())return;const n={record:gr(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.R,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.js(n))}Ds(t){const i=this.Yr.beforeSend;if(!i)return t;const e=pi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for log:",t),null}return s}Ns(){if(void 0===this.Os)return!0;const t=Date.now(),i=t-this.Cs;return this.Ps>i&&i>=0||(this.Cs=t,this.Ts=0,this.Ms=!1),this.Os>this.Ts?(this.Ts++,!0):(this.Ms||(this.R.warn(`captureLog dropping logs: exceeded ${this.Os} logs per ${this.Ps}ms`),this.Ms=!0),!1)}flush(){var t=this;return Li(function*(){if(!t._instance.isDisabled)return t.bs||(t.bs=t.qs().finally(()=>{t.bs=null})),t.bs})()}qs(){var t=this;return Li(function*(){var i;if(t.gs.clear(),t.Bs())return;let e=null!==(i=t._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;if(t.Bs())return;const i=t.ws;t._s=0;const s=Math.min(e.length,t.Rs),l=e.slice(0,s),a=mr(l.map(t=>t.record),t.zs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Hs(a);if(t.ws!==i)return;if("too-large"===u.kind&&l.length>1)t.Rs=Math.max(1,Math.floor(l.length/2)),t.R.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Rs}`);else{if(t.Ss.record(u),t.gs.pending&&t.gs.arm(Math.max(t.As,t.Ss.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.R.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Yr.maxBatchRecordsPerPost>t.Rs&&(t.Rs=Math.min(t.Yr.maxBatchRecordsPerPost,t.Rs+1)),yield t.Us(l.length),e=null!==(o=t._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(){return!!this.ps()&&(this.Fs()&&this.clearQueue(),!0)}Us(t){var i=this;return Li(function*(){var e;const s=Math.max(0,t-i._s),n=null!==(e=i._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ni.LogsQueue,n.slice(s)),yield i.vs()})()}zs(){return _r(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}js(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==i?i:[];this.Es>e.length||(e.shift(),this._s++,this.R.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ni.LogsQueue,e),this.Is>e.length||this.Ss.isOpen()?this.Ls():this.ys()}Ls(){this.gs.pending||this.gs.arm(Math.max(this.As,this.Ss.remainingMs()))}Ws(){return Math.max(wr(this.As,this.xs,this.$s,3e4),this.Ss.remainingMs())}Fs(){const t=this._instance.getPersistedProperty(ni.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return Li(function*(){i.gs.clear();const e=i.flush().catch(()=>{});void 0!==t?yield ns(e,t):yield e})()}flushWithTimeout(t){var i=this;return Li(function*(){const e=i.flush();yield ns(e,t,()=>{e.catch(()=>{})})})()}flushInBackground(){if(this.ks)return this.ks;const t=this.flush().then(()=>{this.xs=0,this.$s=1},t=>{this.xs++,this.$s=br(),this.R.error("PostHog logs flush failed:",t)}).finally(()=>{this.ks===t&&(this.ks=null),!this._instance.isDisabled&&this.Fs()&&this.gs.armNoEarlierThan(this.Ws())});return this.ks=t,t}ys(){this.flushInBackground()}};const xr=/^[0-9a-f]+$/;function Sr(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&xr.test(t)}const kr=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Er="00",Tr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Pr(t){return String(t)+"000000"}function Or(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Cr=class{constructor(t,i,e){this._instance=t,this.Yr=i,this.R=e,this.Vs=new Map,this.gs=new yr(()=>this.flush().catch(t=>{this.R.error("Metrics flush failed:",t)})),this.bs=null,this.Gs=null,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ks=new Map,this.Ys=new Set,this.Xs=!1,this.Ss=new Ze,this.xs=0,this.$s=1,this.Po=0}count(t,i=1,e){this.Fo({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.Fo({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.Fo({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes,bounds:pi(null==e?void 0:e.bounds)?e.bounds.slice():null==e?void 0:e.bounds})}flush(){var t=this;const i=this.bs,e=function(){var e=Li(function*(){i&&(yield i.catch(()=>{})),yield t.No()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.bs===e&&(this.bs=null)});return this.bs=e,e}flushCoalesced(){var t,i;return this.jo()?null!==(t=this.bs)&&void 0!==t?t:Promise.resolve():(this.Gs||(this.Gs=(null!==(i=this.bs)&&void 0!==i?i:Promise.resolve()).catch(()=>{}).then(()=>(this.Gs=null,this.jo()?void 0:this.flush()))),this.Gs)}jo(){return this.xs>0||this.Ss.remainingMs()>0}drainWindow(){if(0===this.Vs.size)return null;const t=this.Vs;return this.qo(),this.Bo(t)}reset(){this.Po++,this.Ss.reset(),this.xs=0,this.$s=1,this.gs.clear(),this.bs=null,this.Gs=null,this.qo(),this.Ks=new Map,this.Xs=!1}qo(){this.Vs=new Map,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ys=new Set}Fo(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Ds(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.R.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.R.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"!==i.type&&"gauge"!==i.type&&"histogram"!==i.type)return void this.R.warn(`Dropping metric '${i.name}': unknown type '${String(i.type)}'`);if("count"===i.type&&0>i.value)return void this.R.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?us({},i.attributes):void 0,s=Or(i.type,i.name,i.unit,e)}catch(t){return void this.R.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n,r=this.Vs.get(s);if(!r&&!this.zo())return;if("histogram"===i.type&&(n=this.Ho(i.name,i.unit,i.bounds),!n))return;r||(r={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now(),hist:n&&Ar(n)},this.Vs.set(s,r));const o=this.Qs.get(i.name);void 0===o?this.Qs.set(i.name,i.type):o===i.type||this.Zs.has(i.name)||(this.Zs.add(i.name),this.R.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.Uo(r,i.value);const l=this.Wo();l&&(r.exemplar=us(us({},l),{},{value:i.value,timeMs:Date.now()})),this.Ls()}Wo(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=kr.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return"ff"===e||"00"===e&&o||!function(t){return Sr(t,32,"00000000000000000000000000000000")}(s)||!function(t){return Sr(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":Er)};var e}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}}zo(){return this.Yr.maxSeriesPerFlush>this.Vs.size||(this.Js||(this.Js=!0,this.R.warn(`Metric series cap reached (${this.Yr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ho(t,i,e){if(void 0!==e&&!function(t){if(!pi(t)||0===t.length)return!1;for(let i=0;t.length>i;i++)if(!Number.isFinite(t[i])||i>0&&t[i-1]>=t[i])return!1;return!0}(e))return void this.R.warn(`Dropping histogram '${t}': bounds must be a non-empty array of finite, strictly increasing numbers`);const s=Or("histogram",t,i,void 0),n=this.Ks.get(s);if(n)return this.Vo(t,s,n,e),n;if(this.Ks.size>=this.Yr.maxSeriesPerFlush){if(this.Xs||(this.Xs=!0,this.R.warn(`Histogram bounds limit reached (${this.Yr.maxSeriesPerFlush} distinct histograms); new histograms that pass custom bounds are dropped. Reduce histogram name cardinality.`)),e&&!Rr(e,Tr))return;return Tr}const r=e?e.slice():Tr;return this.Ks.set(s,r),r}Vo(t,i,e,s){Rr(e,null!=s?s:Tr)||this.Ys.has(i)||(this.Ys.add(i),this.R.warn(`Histogram '${t}' already uses the bounds [${e.join(", ")}]; samples that pass different bounds are recorded in those buckets.`))}Uo(t,i){switch(t.type){case"count":var e;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":{const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,e.bounds)]+=1;break}}}Ds(t){const i=this.Yr.beforeSend;if(!i)return t;const e=pi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for metric:",t),null}return s}Ls(){this.gs.pending||this.gs.arm(this.Ws())}Ws(){return Math.max(wr(this.Yr.flushIntervalMs,this.xs,this.$s,3e4),this.Ss.remainingMs())}No(){var t=this;return Li(function*(){if(t.gs.clear(),0===t.Vs.size)return;const i=t.Vs;t.qo();const e=t.Po,s=yield t._instance.Go(t.Bo(i));if(e===t.Po)switch(t.Ss.record(s),"retry-later"===s.kind?(t.xs++,t.$s=br()):(t.xs=0,t.$s=1),t.gs.pending&&t.gs.arm(t.Ws()),s.kind){case"ok":return;case"retry-later":return t.Jo(i),void t.gs.armNoEarlierThan(t.Ws());case"too-large":return void t.R.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.R.error("Failed to send metrics batch:",s.error)}})()}Bo(t){return i=this.Qo(t),e=function(t,i,e){return ur(t,i,e)}(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:cr(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}Qo(t){const i=Pr(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Or(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=us({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const a=rr(null!==(s=o.attributes)&&void 0!==s?s:{},this.R),u=Pr(o.windowStartMs),h=Ir(o.exemplar);if("count"===o.type){var n;const t=us({attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=us({attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t)}else{const t=o.hist,e=us({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:t.count,sum:t.sum,min:t.min,max:t.max,bucketCounts:t.bucketCounts,explicitBounds:t.bounds},h);l.histogram.dataPoints.push(e)}}return Array.from(e.values())}Jo(t){for(const[n,r]of t){var i;const t=this.Vs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case"count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case"gauge":break;case"histogram":{const i=t.hist,e=r.hist;i.count+=e.count,i.sum+=e.sum,i.min=Math.min(i.min,e.min),i.max=Math.max(i.max,e.max);for(let t=0;i.bucketCounts.length>t;t++)i.bucketCounts[t]+=e.bucketCounts[t];break}}else this.zo()&&this.Vs.set(n,r)}}};function Rr(t,i){if(t===i)return!0;if(t.length!==i.length)return!1;for(let e=0;t.length>e;e++)if(t[e]!==i[e])return!1;return!0}function Ar(t){return{bounds:t,count:0,sum:0,min:1/0,max:-1/0,bucketCounts:new Array(t.length+1).fill(0)}}function Ir(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Pr(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const Mr=(t,{debugEnabled:e}={})=>{const s={N(s,...n){let r;try{r=typeof window>"u"?void 0:window}catch(t){return}r&&(i.DEBUG||r.POSTHOG_DEBUG||e)&&!yi(r.console)&&r.console&&("__rrweb_original__"in r.console[s]?r.console[s].__rrweb_original__:r.console[s])(t,...n)},debug(...t){s.N("debug",...t)},info(...t){s.N("log",...t)},warn(...t){s.N("warn",...t)},error(...t){s.N("error",...t)},critical(...i){console.error(t,...i)},uninitializedWarning(t){s.error(`You must initialize PostHog before calling ${t}`)},createLogger:(i,e)=>Mr(`${t} ${i}`,e)};return s},Fr=Mr("[PostHog.js]"),Dr=(t,i)=>Fr.createLogger(t,i);function jr(t,i){pi(t)&&t.forEach(i)}function Lr(t,i){if(!xi(t))if(pi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)vi.call(t,e)&&i(t[e],e)}const Nr=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Br(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const Ur=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Fr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Fr.critical(t)}}},zr=function(t){const i={};return Lr(t,function(t,e){(bi(t)&&t.length>0||Si(t))&&(i[e]=t)}),i};function Hr(t){const i=us({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const qr=["herokuapp.com","vercel.app","netlify.app"];function Wr(t){const i=null==t?void 0:t.hostname;if(!bi(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of qr)if(e===t)return!1;return!0}function Vr(t,i,e,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r})}function Gr(t){return"ph_toolbar_internal"===t.name}const Kr=t=>{if(o){try{const i=t+"=",e=o.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==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}};var Jr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let 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 t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Yr=class{generate(){const t=this.generateOrAbort();if(!yi(t))return t;{this.Mt=0;const t=this.generateOrAbort();if(yi(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Si(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Mt)this.Mt=t,this.Tt();else{if(this.Mt>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Mt++,this.Tt())}return Jr.fromFieldsV7(this.Mt,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.At.nextUint32())}Tt(){this.It=1024*this.At.nextUint32()+(1023&this.At.nextUint32())}constructor(){this.Mt=0,this.It=0,this.At=new Qr}};const Zr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let Xr;var Qr=class{nextUint32(){var t;return this.Rt.length>this.Et||((null!==(t=Xr)&&void 0!==t?t:Xr="u">typeof window&&!yi(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Zr(t)}}:Zr)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let to;const io=()=>eo().toString(),eo=()=>(to||(to=new Yr)).generate();let so="";const no=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let ro=null;const oo={Ot(){if(!$i(ro))return ro;if(ro=!1,o)try{const t=`__ph_cookie_support_${io()}`;oo.$t(t,"xyz"),ro='"xyz"'===Kr(t),oo.Dt(t)}catch(t){ro=!1}return ro},Ft(t){Fr.error("cookieStore error: "+t)},Lt:Kr,Pt(t){let i;try{i=JSON.parse(oo.Lt(t))||{}}catch(t){}return i},$t(t,i,e,s,n){if(!o)return!1;try{let r="",l="";const a=function(t,i){if(i){let i=function(t,i=o){if(so)return so;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";const e=t.split(".");let s=Math.min(e.length,8);const n="dmn_chk_"+io();for(;!so&&s--;){const t=e.slice(s).join("."),r=n+"=1;domain=."+t+";path=/";i.cookie=r+";max-age=3",i.cookie.includes(n)&&(i.cookie=r+";max-age=0",so=t)}return so}(t);if(!i){const e=(t=>{const i=t.match(no);return i?i[0]:""})(t);e!==i&&Fr.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(o.location.hostname,s);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),r="; expires="+t.toUTCString()}n&&(l="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(i))+r+"; SameSite=Lax; path=/"+a+l;return u.length>3686.4&&Fr.warn("cookieStore warning: large cookie, len="+u.length),o.cookie=u,!0}catch(t){return!1}},Dt(t,i){if((null==o?void 0:o.cookie)&&(!i||!$i(Kr(t))))try{oo.$t(t,"",-1,i)}catch(t){return}}};let lo=null;const ao={Ot(){if(!$i(lo))return lo;let t=!0;if(yi(s))t=!1;else try{const i="__mplssupport__";ao.$t(i,"xyz"),'"xyz"'!==ao.Lt(i)&&(t=!1),ao.Dt(i)}catch(i){t=!1}return t||Fr.error("localStorage unsupported; falling back to cookie store"),lo=t,t},Ft(t){Fr.error("localStorage error: "+t)},Lt(t){try{return null==s?void 0:s.localStorage.getItem(t)}catch(t){ao.Ft(t)}return null},Pt(t){try{return JSON.parse(ao.Lt(t))||{}}catch(t){}return null},$t(t,i){try{return null==s||s.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){ao.Ft(t)}return!1},Dt(t){try{null==s||s.localStorage.removeItem(t)}catch(t){ao.Ft(t)}}},uo=[T,m,k,y,C,x,w,b,P],ho=[H,z,ft,pt,Ft,Mt,K,Ot],co=t=>t+"_cpm",vo=["__proto__","constructor","prototype"],fo=t=>{if(!_i(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===vo.indexOf(e)&&(i[e]=t[e])}),i},po=(t,i=[])=>{const e={};return[...ho,...i].forEach(i=>{const s=t[i];yi(s)||$i(s)||""===s||(e[i]=s)}),e},go=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},_o=(t,i)=>({p:i,f:go(JSON.stringify(t))}),mo=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=oo.Pt(co(t)),s=(null==e?void 0:e.f)===go(i)&&pi(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},yo=(t,i)=>i+"|"+(oo.Lt(co(t))||""),bo={},wo={Ot:()=>!0,Ft(t){Fr.error("memoryStorage error: "+t)},Lt:t=>t in bo?bo[t]:null,Pt:t=>t in bo?bo[t]:null,$t:(t,i)=>(bo[t]=i,!0),Dt(t){delete bo[t]}};let $o=null;const xo={Ot(){if(!$i($o))return $o;if($o=!0,yi(s))$o=!1;else try{const t="__support__";xo.$t(t,"xyz"),'"xyz"'!==xo.Lt(t)&&($o=!1),xo.Dt(t)}catch(t){$o=!1}return $o},Ft(t){Fr.error("sessionStorage error: ",t)},Lt(t){try{return null==s?void 0:s.sessionStorage.getItem(t)}catch(t){xo.Ft(t)}return null},Pt(t){try{return JSON.parse(xo.Lt(t))||null}catch(t){}return null},$t(t,i){try{return null==s||s.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){xo.Ft(t)}return!1},Dt(t){try{null==s||s.sessionStorage.removeItem(t)}catch(t){xo.Ft(t)}}};var So=class{constructor(t){this._instance=t}get Yr(){return this._instance.config}get consent(){return this.eu()?0:this.iu}isOptedOut(){return"always"===this.Yr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Yr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Yr.opt_out_capturing_by_default}optInOut(t){this.nu.$t(this.su,t?1:0,this.Yr.cookie_expiration,this.Yr.cross_subdomain_cookie,this.Yr.secure_cookie)}reset(){this.nu.Dt(this.su,this.Yr.cross_subdomain_cookie)}get su(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get iu(){const t=this.nu.Lt(this.su);return Fi(t)?1:ai(Di,t)?0:-1}get nu(){const t=this.Yr.opt_out_capturing_persistence_type,i="localStorage"===t?ao:oo,e=i.Ot()?i:wo;if(!this.ru||this.ru!==e){this.ru=e;const i="localStorage"===t?oo:ao;i.Lt(this.su)&&(this.ru.Lt(this.su)||this.optInOut(Fi(i.Lt(this.su))),i.Dt(this.su,this.Yr.cross_subdomain_cookie))}return this.ru}eu(){return!!this.Yr.respect_dnt&&[null==r?void 0:r.doNotTrack,null==r?void 0:r.msDoNotTrack,f.doNotTrack,null==r?void 0:r.globalPrivacyControl].some(t=>Fi(t))}};function ko(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!gi(s))return i;try{const t=s(i);return bi(t)&&t?t:i}catch(t){return Fr.error("Error in get_current_url, falling back to window.location.href",t),i}}function Eo(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function To(t){return!!t&&1===t.nodeType}function Po(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Oo(t){return!!t&&3===t.nodeType}function Co(t){return!!t&&11===t.nodeType&&To(t.host)}function Ro(t){return t?ui(t).split(/\s+/):[]}function Ao(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return yi(s)?void 0:ko(t,s)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Io(t){let 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 Ro(i)}function Mo(t){return xi(t)?null:ui(t).split(/(\s+)/).filter(t=>cl(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fo(t){let i="";return el(t)&&!sl(t)&&t.childNodes&&t.childNodes.length&&Lr(t.childNodes,function(t){var e;Oo(t)&&t.textContent&&(i+=null!==(e=Mo(t.textContent))&&void 0!==e?e:"")}),ui(i)}function Do(t){var i;return yi(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const jo=["a","button","form","input","select","textarea","label"];function Lo(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function No(t,i){if(yi(i))return!0;for(const e of t)if(i.some(t=>Lo(e,t)))return!0;return!1}function Bo(t){const i=t.parentNode;return!(!i||!To(i))&&i}const Uo=[".ph-no-autocapture","[data-ph-no-autocapture]"],zo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Ho=(()=>[...zo,"+","-","−","–"])(),qo=(()=>Ho.length+10)(),Wo=["button","a","input","select","textarea","label"],Vo=["button","link","tab","menuitem","option"],Go=(t,i)=>/[a-z0-9]/i.test(i)?ai(Ho,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,Ko=t=>ai(Wo,t.tagName.toLowerCase())||ai(Vo,(t.getAttribute("role")||"").toLowerCase());function Jo(t){let i="",e="";const s=t=>{To(t)&&el(t)&&!sl(t)&&(i+=` ${Fo(t)}`,e=e||t.getAttribute("aria-label")||"",Lr(t.childNodes,s))};s(t),i=ui(i.replace(/\s+/g," "));const n=(cl(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return{safeText:n,ariaLabel:ui(r).toLowerCase()}}const Yo=[".ph-no-rageclick",".ph-no-capture"],Zo=["","text","search","email","password","url","tel","number"];function Xo(t,i){if(!(typeof window>"u"?void 0:window)||Qo(t))return!1;let e,s,n;var r,o;if(Ei(i)?(e=!!i&&Yo,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:Yo,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!To(t))&&(!!Po(t,"textarea")||(Po(t,"input")?ai(Zo,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return!0;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return"true"===e||""===e}(t)))}(t))return!1;const{targetElementList:l,isComplete:a}=tl(t,!1);return!(!a||s&&function(t,{safeText:i,ariaLabel:e}){let s;if(!0===t)s=zo;else{if(!pi(t))return!1;if(t.length>qo)return Fr.error(`[PostHog] content_ignorelist array cannot exceed ${qo} items. Use css_selector_ignorelist for more complex matching.`),!1;s=t.map(t=>t.toLowerCase())}return s.some(t=>Go(i,t)||Go(e,t))}(s,function(t,i){for(const t of i)if(Ko(t))return Jo(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Jo(t);if(i.safeText||i.ariaLabel)return i}return Jo(t)}(t,l))||No(l,e))}const Qo=t=>!t||Po(t,"html")||!To(t),tl=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Qo(t))return{parentIsUsefulElement:!1,targetElementList:[],isComplete:!1};let s=!1;const n=[t];let r=t;const o=new Set([t]);for(;!Po(r,"body");){const t=r.assignedSlot||r.parentNode,l=Co(t)?t.host:t&&To(t)?t:null;if(!l)break;if(o.has(l)||o.size>=1e3)return{parentIsUsefulElement:s,targetElementList:n,isComplete:!1};if(o.add(l),Co(t))n.push(l),r=l;else{if(i||jo.indexOf(l.tagName.toLowerCase())>-1)s=!0;else try{const t=e.getComputedStyle(l);t&&"pointer"===t.getPropertyValue("cursor")&&(s=!0)}catch(t){}n.push(l),r=l}}return{parentIsUsefulElement:s,targetElementList:n,isComplete:!0}};function il(t){const i=new Set;let e=0,s=t;for(;s;){if(e++>=1e3||i.has(s))return!0;i.add(s);const t=Io(s);if(ai(t,"ph-sensitive")||ai(t,"ph-no-capture"))return!0;const n=s.assignedSlot||s.parentNode;s=Co(n)?n.host:n&&To(n)?n:null}return!1}function el(t){if(il(t))return!1;if(ai(Io(t),"ph-include"))return!0;const i=t.type||"";if(bi(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const e=t.name||t.id||"";return!bi(e)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(e.replace(/[^a-zA-Z0-9]/g,""))}function sl(t){return!!(Po(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Po(t,"select")||Po(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const nl=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}))$"),rl=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,ol=[16,15,14,13],ll=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),al=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ul=/[0-9A-Za-z_]/;function hl(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function cl(t,i=!0){if(xi(t))return!1;if(bi(t)){if(t=ui(t),i?nl.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(rl.lastIndex=0;i=rl.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of ol){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(nl.test(i)&&hl(i))return!0}}}return!1}(t))return!1;if(i?ll.test(t):function(t){let i;for(al.lastIndex=0;i=al.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&ul.test(t)&&ul.test(e)))return!0}return!1}(t))return!1}return!0}function dl(t){let i=Fo(t);return i=`${i} ${vl(t)}`.trim(),cl(i)?i:""}function vl(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Lr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Fo(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${vl(t)}`.trim())}catch(t){Fr.error("[AutoCapture]",t)}}),i}function fl(t){return t.replace(/"|\\"/g,'\\"')}function pl(t){const i=t.attr__class;if(i)return pi(i)?i:Ro(i)}const gl=Dr("[Dead Clicks]"),_l=()=>!0,ml=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(st)),s=t.instance.config.capture_dead_clicks;return Ei(s)?s:!!_i(s)||e};var yl=class{get lazyLoadedDeadClicksAutocapture(){return this.ou}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[st]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lu(()=>{this.au()}):this.stop()}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=g(this.instance))||void 0===e||e(this.instance,"dead-clicks-autocapture",i=>{i?gl.error("failed to load script",i):t()})}au(){var t;if(o){if(!this.ou&&(null===(t=f.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=_i(this.instance.config.capture_dead_clicks)?us({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.ou=f.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ou.start(o),gl.info("starting...")}}else gl.error("`document` not found. Cannot start.")}stop(){this.ou&&(this.ou.stop(),this.ou=void 0,gl.info("stopping..."))}};const bl=Dr("[SegmentIntegration]");function wl(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>gi(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||io();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(Ot,Zt)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&gi(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||bl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(bl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(bl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!xi(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))vi.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=pi(t)?t:[t];let s=us({},i);for(const t of e)try{if(s=t(s),xi(s))return null}catch(t){return bl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(xi(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,ti)},identify(t){return s(t,ei)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{bl.error("Failed to register the Segment integration",t),i()})},e)}const $l="posthog-js";function xl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>us(us({},t),{},{stacktrace:t.stacktrace?us(us({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>us(us({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var Sl=class{constructor(t,i,e,s,n,r){this.name=$l,this.setupOnce=function(o){o(xl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},kl=class{constructor(t){this.uu=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Fr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.cu=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hu()}hu(){var t;this.du=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.uu)}destroy(){var t;null===(t=this.du)||void 0===t||t.call(this),this.du=void 0}doPageView(t,i){var e;const n=this.vu(t,i);return this.cu={pathname:null!==(e=null==s?void 0:s.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(t){var i;return this.vu(t,null===(i=this.cu)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.cu)||void 0===t?void 0:t.pageViewId}}vu(t,i){const e=this.cu;if(!e)return{$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(yi(t)||yi(i)||yi(e)||yi(r)||yi(o)||yi(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?zi(i/t,0,1,Fr):1,a=t>1?zi(e/t,0,1,Fr):1,u=r>1?zi(o/r,0,1,Fr):1,h=r>1?zi(l/r,0,1,Fr):1;s=Nr(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const El=["flags","surveys"],Tl={[U]:{exposure:"hidden"},[W]:{exposure:"hidden"},[V]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[M]:{exposure:"event"},[X]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[Q]:{exposure:"event"},[tt]:{exposure:"hidden"},[it]:{exposure:"event"},[et]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{exposure:"hidden"},[ot]:{exposure:"event"},[lt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"event"},[ut]:{exposure:"event",shouldSkipFromEventProperties:t=>$i(t)},[gt]:{exposure:"event"},[_t]:{exposure:"event"},[mt]:{exposure:"event"},[yt]:{exposure:"event"},[bt]:{exposure:"hidden"},[k]:{exposure:"hidden",storageGroup:"flags"},[m]:{exposure:"hidden",storageGroup:"flags"},[_]:{exposure:"hidden"},[y]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[S]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"hidden"},[A]:{exposure:"hidden"},[T]:{exposure:"hidden"},[E]:{exposure:"hidden"},[F]:{exposure:"hidden",storageGroup:"surveys"},[D]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[L]:{exposure:"event"},[N]:{exposure:"hidden"},[B]:{exposure:"hidden"},[$t]:{exposure:"hidden"},[xt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[kt]:{exposure:"event"},[Et]:{exposure:"event"},[Tt]:{exposure:"event"},[Pt]:{exposure:"event"},[P]:{exposure:"hidden"},[O]:{exposure:"hidden"},[wt]:{exposure:"event"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ot]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[At]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Ft]:{exposure:"hidden"},[ht]:{exposure:"event"},[ct]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[Bt]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[qt]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Vt]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[Kt]:{exposure:"hidden"},[Jt]:{exposure:"event"}},Pl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ol=t=>{const i=Tl[t];if(i)return i;for(const[i,e]of Pl)if(0===t.indexOf(i))return e};function Cl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const Rl=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return yi(e)?null:(e.href=t,e)},Al=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Il=(t,i)=>t>=i&&Al(),Ml=(t,i,e,s)=>{if(0===t){if(Al()){const t=i+1;return t===e&&s(),t}return i}return 0},Fl=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return Ri(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Hr(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return ci(t)}},Dl=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!pi(s)||2>s.length)return"";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(i){Fr.error("Skipping decoding for malformed query param: "+t)}return t}},jl=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const s=a[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;u.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):a[t])}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Ll=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Nl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Bl=["ScCid","SsCid"],Ul={sccid:Bl},zl=(()=>[...Nl,...Bl,"sscid"])(),Hl=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Nl])(),ql="<masked>",Wl=["li_fat_id"];function Vl(t,i,e){if(!o)return{};const s=i?[...zl,...e||[]]:[],n=Gl(jl(o.URL,s,ql),t),r=function(){const t={};return Lr(Wl,function(i){const e=Kr(i);t[i]=e||null}),t}();return Nr(r,n)}function Gl(t,i){const e=Hl.concat(i||[]),s={};return Lr(e,function(i){let e=Dl(t,i);!e&&vi.call(Ul,i)&&jr(Ul[i],function(i){e=e||Dl(t,i)}),s[i]=e||null}),s}function Kl(t){const i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!$i(i)){s.$search_engine=i;const t=o?Dl(o.referrer,e):"";t.length&&(s.ph_keyword=t)}return s}function Jl(){return navigator.language||navigator.userLanguage}function Yl(){const t=Jl();return"string"==typeof t?t.split("-")[0]:void 0}const Zl="$direct";function Xl(){return(null==o?void 0:o.referrer)||Zl}function Ql(t,i,e=!1){const s=t?[...zl,...i||[]]:[],n=e?is(null==l?void 0:l.href):null==l?void 0:l.href,r=null==n?void 0:n.substring(0,1e3);return{r:Xl().substring(0,1e3),u:r?jl(r,s,ql):void 0}}function ta(t,i=!1,e,s){var n;const{r:r,u:o}=t,l=i?is(o):o,a=l&&e?jl(l,[...zl,...s||[]],ql):l,u={$referrer:r,$referring_domain:null==r?void 0:r==Zl?Zl:null===(n=Rl(r))||void 0===n?void 0:n.host};if(a){u.$current_url=a;const t=Rl(a);u.$host=null==t?void 0:t.host,u.$pathname=null==t?void 0:t.pathname,Nr(u,Gl(a))}if(r){const t=Kl(r);Nr(u,t)}return u}function ia(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const ea={flags:w,surveys:D},sa=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],na=t=>`${t}_cookie_identity_change_pending`,ra=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t}return i},oa="main",la=[k,m,y,C,x,w,S,T],aa=t=>-1!==la.indexOf(t),ua=[K,Y],ha=t=>-1!==ua.indexOf(t),ca=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},da=t=>{if(!t)return{};const i=JSON.parse(t);return _i(i)?i:{}},va=t=>{const i=t[y];return _i(i)?us(us({},t),{},{[y]:Object.fromEntries(Object.entries(i).map(([t,i])=>{var e;if(!_i(i)||!("value"in i)||1!==(null===(e=i.metadata)||void 0===e?void 0:e.config_version))return[t,i];const s=us(us({},i),{},{metadata:us({},i.metadata)});delete s.value;for(const t of["config_version","rule_type","rule_id","variant_key","forced_variant"])delete s.metadata[t];return[t,s]}))}):t},fa=(t,i)=>{Lr(t,(e,s)=>{const n=Ol(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var pa=class{constructor(t,i,e=!0,n=!t.cookieless_mode){if(this.fu={},this.pu=!1,this.gu=!1,this.mu=!1,this.yu=!1,this.bu=!1,this._u=new Map,this.wu=!1,this.ku=!1,this.Su=!1,this.xu=new Set,this.$u=new Set,this.Yr=t,this.Cu=e,this.props={},this.Tu=void 0,this.Mu=(t=>{let 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.Ai=t.disable_persistence||!!i,this.nu=this.Iu(t),this.mu=this.Eu(t),this.load(n),this.Au(),t.debug&&Fr.info("Persistence loaded",t.persistence,us({},this.props)),this.update_config(t,t,i),this.save(),s){const t=()=>this.flush();Vr(s,"beforeunload",t,{capture:!1}),Vr(s,"pagehide",t,{capture:!1}),this.Ru=t=>{if(this.pu&&(!t.storageArea||t.storageArea===(null==s?void 0:s.localStorage))&&t.key)if(t.key!==this.Mu){if(this.mu){const i=El.find(i=>t.key===this.Pu(i));i&&this.Ou(t.key,i)}}else this.Ou(t.key,oa)},Vr(s,"storage",this.Ru)}}reconcileFeatureFlagsBeforeMerge(){return!(this.Ai||this.bu||this.wu)&&this.Fu()}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this._u.get(t);if(!aa(t)||!0===e)return;if(!0===i)return void this.Lu(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.Lu(t,s)})}onCrossTabFeatureFlagChange(t){return this.$u.add(t),()=>this.$u.delete(t)}destroy(){this.Ru&&s&&(s.removeEventListener("storage",this.Ru),this.Ru=void 0),this.$u.clear()}Ou(t,i,e=!0){if(this.Ai)return!1;let s,n;try{if(n=ao.Lt(t),$i(n)){const t=this.Du(i);return t.storageValue=null,i!==oa?t.persisted=!1:this.Nu({}),!1}s=da(n)}catch(t){return!1}i===oa&&this.Nu(s);const r=i===oa?s:ao.Pt(this.Mu);if(r&&this.ju(r))return!1;const o=this.qu(s,i,e);return i===oa&&this.mu&&!ca(this.Bu().main,s)||this.zu(s,i,!0,n),o}ju(t){const i=this.props[z],e=t[z];return!yi(i)&&!yi(e)&&i!==e}zu(t,i,e,s){const n=this.Du(i);n.storageValue=s,i!==oa&&(n.persisted=e);try{n.fingerprint=this.Hu(t,i)}catch(t){n.fingerprint=void 0}}qu(t,i,e){let s=!1;return la.forEach(e=>{var n;const r=null===(n=Ol(e))||void 0===n?void 0:n.storageGroup;if(i===oa&&this.mu&&r||i!==oa&&r!==i)return;const o=e in t,l=this.Uu(e,o?t[e]:void 0),a=this._u.has(e)?e in this.props:o;a===e in this.props&&ca(l,this.props[e])||(a?this.Wu(e,l,!1):this.Vu(e,!1),s=!0)}),s&&e&&this.$u.forEach(t=>t()),s}Nu(t){const i=this.gu&&this.Yr.cookieWinsOnConflict?[...ho,...this.Yr.cookie_persisted_properties||[]]:[];ua.forEach(e=>{this.xu.has(e)||-1!==i.indexOf(e)||(e in t?ca(t[e],this.props[e])||this.Wu(e,t[e],!1):e in this.props&&this.Vu(e,!1))})}Gu(){return this.gu&&this.pu&&!this.Yr.cookieWinsOnConflict}Ju(){if(!this.Gu())return;let t,i;try{t=oo.Lt(this.Mu)||void 0}catch(t){return}if(t&&t!==this.Qu){this.Qu=t;try{i=fo(JSON.parse(t))}catch(t){return}ua.forEach(t=>{!(t in i)||t in this.props||this.xu.has(t)||this.Wu(t,i[t],!1)})}}Zu(t){if(this.Gu())try{const i=JSON.stringify(po(t,this.Yr.cookie_persisted_properties||[])),e=oo.Lt(this.Mu)||void 0;e===i&&(this.Qu=e)}catch(t){}}Fu(){if(!this.pu)return!1;try{this.Su=!1;const t=ao.Lt(this.Mu),i=this.Du(oa);let e,s=!1,n=!1;if(t!==i.storageValue)if($i(t))bi(i.storageValue)&&this.Nu({}),i.storageValue=null;else{if(e=da(t),this.Nu(e),this.Su=!this.ku&&this.ju(e),this.Su)return!1;n=this.qu(e,oa,!1),!this.mu||ca(this.Bu().main,e)?this.zu(e,oa,!0,t):i.storageValue=t,s=!0}return this.mu&&El.forEach(t=>{const i=ao.Lt(this.Pu(t)),r=this.Du(t),o=e||{},l=s&&la.some(i=>{var e;return(null===(e=Ol(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if($i(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.qu(o,t,!1)||n));const a=da(i);n=this.qu(a,t,!1)||n,this.zu(a,t,!0,i)}),n}catch(t){return!1}}Lu(t,i){this._u.set(t,i);const e=Ol(t);(null==e?void 0:e.volatile)||(this.Du((this.mu?null==e?void 0:e.storageGroup:void 0)||oa).fingerprint=void 0,this.Ku(t))}Yu(){la.forEach(t=>this._u.set(t,!0))}Au(){if(this.pu)try{const t=ao.Lt(this.Mu),i=da(t);this.Du(oa).storageValue=t,la.forEach(t=>{var e;const s=this.mu?null===(e=Ol(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?ao.Lt(this.Pu(s)):null;if(s){const t=this.Du(s);t.storageValue=n,t.persisted=!$i(n)}const r=s&&!$i(n)?da(n):i;t in this.props?this.Xu(t,r[t],this.props[t]):t in r&&this.Lu(t,!0)})}catch(t){}}Uu(t,i){const e=this._u.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(pi(i)?i:[]),n=new Set(pi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=_i(i)?us({},i):{},n=_i(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}Xu(t,i,e){if(!aa(t))return;const s=this._u.get(t);if(!0===s)return;let n=i;if(this.pu)try{var r;const i=this.mu?null===(r=Ol(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.Pu(i):this.Mu;n=da(ao.Lt(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!yi(i)&&!pi(i)||!yi(n)&&!pi(n)||!pi(e))return void this.Lu(t,!0);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!_i(e))return void(ca(n,e)?this._u.delete(t):this.Lu(t,!0));{if(!yi(i)&&!_i(i)||yi(i)&&mi(e)&&yi(n))return void this.Lu(t,!0);const s=_i(i)?i:{},r=_i(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&ca(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&ca(r[t],e[t])&&o.delete(t)})}}o.size?this.Lu(t,o):this._u.delete(t)}tc(){var t;const i=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Si(i)&&i>0?i:0}ec(t){if(this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase())if(t)try{const i=po(t,this.Yr.cookie_persisted_properties||[]),e=_o(i,this.Yr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=oo.Lt(this.Mu)||void 0;n&&yo(this.Mu,n)===s&&(this.nc=s,this.sc=n)}catch(t){}else try{const t=oo.Lt(this.Mu)||void 0;this.nc=t?yo(this.Mu,t):void 0,this.sc=t}catch(t){}}syncCookieProperties(){return this.rc(this.Yr)}rc(t,i=!1){if(this.Ai&&!i||this.bu||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=oo.Lt(this.Mu)||void 0}catch(t){}if(!e||e===this.sc)return!1;const s=yo(this.Mu,e);let n;try{n=fo(JSON.parse(e))}catch(t){return!1}if((oo.Lt(this.Mu)||void 0)!==e)return!1;this.nc=s,this.sc=e;const r=mo(this.Mu,e),o=[...ho,...r.properties],l={};if(Object.keys(n).forEach(t=>{const i=n[t];(yi(i)||$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(l[t]=!0,delete n[t])}),mi(n))return!1;const a="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,u=this.props,h=u[z],c=u[Ot],d=Nr({},u);[...ho,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in n)&&!l[t]&&(a||"distinct_id"!==t&&"$user_state"!==t)){const i=d[t];(r.isValid||-1===ho.indexOf(t)||!1!==i&&0!==i)&&delete d[t]}}),this.props=Nr(d,n),la.forEach(t=>{const i=t in this.props;t in u===i&&ca(u[t],this.props[t])||(i?this.Xu(t,u[t],this.props[t]):this.Lu(t,!0))}),!a||"$user_state"in n||"$user_state"in this.props||this.Wu(Ot,Yt);const v=this.props[z],f=this.props[Ot];return!a||v===h&&f===c||(this.ku=!0,this.yu=!0,xo.$t(na(this.Mu),!0),this.Vu(T),this.Vu(m),this.Vu(k),this.Vu(y),this.Vu(C),this.Vu(x),this.Vu(w),this.Vu(b),this.Vu(P),"anonymous"!==f||"identified"!==c&&"anonymous"!==n.$user_state&&(yi(h)||v===h)||(fa(this.props,n),this.Vu(E)),"identified"===f?this.props.$user_id=v:delete this.props.$user_id,this.Vu(W)),!0}consumeCookieIdentityChange(){const t=na(this.Mu),i=this.yu||!!xo.Lt(t);return this.yu=!1,i&&xo.Dt(t),i}oc(t=!1){return!(this.bu||this.Ai&&!t||!this.Yr.cookieWinsOnConflict||"localstorage+cookie"!==this.Yr.persistence.toLowerCase()||(this.bu=!0,0))}lc(){this.bu&&(yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0),delete this.fu[oa],this.uc(!0))}cc(t=!0){if(this.bu)try{t?this.lc():yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0)}finally{this.bu=!1}}isDisabled(){return!!this.Ai}Iu(t){-1===sa.indexOf(t.persistence.toLowerCase())&&(Fr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1,e=()=>!1)=>{const n=[...ho,...t];return us(us({},ao),{},{Pt(t){try{let r,o={};try{r=oo.Lt(t)||void 0,o=r?fo(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(ao.Lt(t)||"{}");let a;if(i){const i=mo(t,r),e=[...ho,...i.properties],u={};Object.keys(o).forEach(t=>{const i=o[t];$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(u[t]=i)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var s;const t=l[z],r=null!==(s=l.$user_state)&&void 0!==s?s:Yt;n.forEach(t=>{if(-1!==e.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===ho.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!h||"$user_state"in o||"$user_state"in l||(l[Ot]=Yt),!h||("distinct_id"in u?u[z]:l[z])===t&&("$user_state"in u?u[Ot]:l[Ot])===r||(uo.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[z]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[wt],delete l[E]),delete l.__alias)}a=Nr(l,u)}else a=Nr(o,l);return e()||ao.$t(t,a),a}catch(t){}return null},$t(e,s,n,r,o,l){const a=ao.$t(e,s,void 0,void 0,l);try{const u=po(s,t);if(Object.keys(u).length){if(i){const i=co(e),h=_o(u,t);if(oo.$t(i,h,n,r,o,l),oo.Lt(i)!==JSON.stringify(h)){oo.Dt(i,r);const t=po(s);return oo.$t(e,t,n,r,o,l),a}}oo.$t(e,u,n,r,o,l)}}catch(t){ao.Ft(t)}return a},Dt(t,i){try{null==s||s.localStorage.removeItem(t),oo.Dt(t,i),oo.Dt(co(t),i)}catch(t){ao.Ft(t)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this.Ai);let e,n=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&ao.Ot()?(e=ao,r=!0):"localstorage+cookie"===o&&i.Ot()?(e=i,r=!0,n=!0):"sessionstorage"===o&&xo.Ot()?e=xo:"memory"===o?e=wo:"cookie"===o&&oo.Ot()?(e=oo,n=!0):i.Ot()?(e=i,r=!0,n=!0):oo.Ot()?(e=oo,n=!0):e=wo,this.pu=r,this.gu=n,e}Pu(t){return`${this.Mu}__${t}`}Eu(t){return this.pu&&!!t.split_storage}properties(){const t={};return Lr(this.props,(i,e)=>{const s=Ol(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i}}),t}load(t=!1){if(this.Ai&&!t)return;const i=this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase(),e=i?ao.Pt(this.Mu):null;let s={};if(i)try{s=fo(oo.Pt(this.Mu)),Lr(s,(t,i)=>{(yi(t)||$i(t)||""===t)&&delete s[i]})}catch(t){}const n=this.nu.Pt(this.Mu);if(n&&(this.props=Nr({},n)),this.mu&&this.hc(),i&&n){var r,o;const t=null==e?void 0:e[z],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:Yt,l=n[z],a=null!==(o=n.$user_state)&&void 0!==o?o:Yt,u=xo.Pt(this.Mu),h=!yi(t)||!yi(null==e?void 0:e.$user_state)||!!u&&!mi(u);if(l!==t||a!==i){h&&(this.yu=!0,this.Ai||xo.$t(na(this.Mu),!0));const e=Nr({},this.props);uo.forEach(t=>delete e[t]),h&&"anonymous"===a&&("identified"===i||"anonymous"===s.$user_state||!yi(t)&&l!==t)&&(fa(e,s),delete e[E]),this.props=e;const n=new Set;uo.forEach(t=>{var i;const e=null===(i=Ol(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{if(this.Ai)return;const i={};Lr(this.props,(e,s)=>{var n;(null===(n=Ol(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)});const e=va(i);mi(i)?(ao.Dt(this.Pu(t)),this.fu[t]={}):ao.$t(this.Pu(t),e)&&(this.fu[t]={persisted:!0,fingerprint:this.Hu(e,t)})})}}xo.Lt(na(this.Mu))&&(this.yu=!0)}hc(){for(const t of El){const i=ao.Pt(this.Pu(t));if(i&&!mi(i)){const e=this.Du(t);e.persisted=!0,this.dc(t)||(e.fingerprint=this.Hu(i,t)),this.vc(t,i)||Nr(this.props,i)}}}dc(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=Ol(i))||void 0===e?void 0:e.storageGroup)===t})}vc(t,i){const e=ea[t];if(!e)return!1;const s=i[e],n=this.props[e];return Si(s)&&Si(n)&&n>s}refreshKey(t){this.fc([t])}fc(t){if(this.Ai)return;let i,e=!1;const s=()=>(e||(i=this.nu.Pt(this.Mu),e=!0),i);t.forEach(t=>{var i;if(this.xu.has(t))return;const e=this.mu?null===(i=Ol(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?ao.Pt(this.Pu(e)):s();if(n&&t in n)this.Wu(t,n[t],!1);else{if(e){const i=s();if(i&&t in i)return void this.Wu(t,i[t],!1)}this.Vu(t,!1)}})}refreshMetaIdentifiers(){this.Ai||(this.gc()?this.mc():this.fc(ua))}mc(){const t=this.yc();(yi(t)||t!==this.bc)&&(this.fc(ua),this._c(t))}_c(t=this.yc()){this.bc=0===this.xu.size?t:void 0}refreshMetaIdentifiersBeforeCapture(){this.Ai||this.bu||(this.gc()||this.Ju(),this.mc())}gc(){return this.nu===oo||this.nu===xo||this.nu===wo}yc(){const t=this.nu.Lt(this.Mu);return bi(t)?t:void 0}save(){if(this.Ai)return;const t=this.tc();t>0?yi(this.ac)&&(this.ac=setTimeout(()=>{this.ac=void 0,this.uc()},t)):this.uc()}flush(){yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0,this.uc())}uc(t=!1){if(this.Ai||this.bu&&!t)return;t||(this.syncCookieProperties(),this.gc()&&this.refreshMetaIdentifiers());const i=!t&&!this.wu;i||(this.Su=!1);const e=!!i&&this.Fu();if(this.Su)return void(this.Yr.debug&&Fr.warn("skipping persistence write because storage belongs to a different distinct ID"));if(t||this.Ju(),this.mu)return this.wc(),void(e&&this.$u.forEach(t=>t()));const s=this.kc(this.nu,this.Mu,this.props,oa);"written"===s&&(this.ec(this.props),this.Zu(this.props)),"failed"!==s&&(this._u.clear(),this.ku=!1,this.xu.clear()),"written"===s&&this._c(),e&&this.$u.forEach(t=>t())}wc(){const{main:t,groups:i}=this.Bu(),e=this.kc(this.nu,this.Mu,t,oa);"written"===e&&(this.ec(t),this.Zu(t)),"failed"!==e&&(this.ku=!1,this.xu.clear(),la.forEach(t=>{var i;(null===(i=Ol(t))||void 0===i?void 0:i.storageGroup)||this._u.delete(t)})),"written"===e&&this._c();for(const t of El){var s;const e=i[t];if(mi(e)&&!(null===(s=this.fu[t])||void 0===s?void 0:s.persisted)){la.forEach(i=>{var e;(null===(e=Ol(i))||void 0===e?void 0:e.storageGroup)===t&&this._u.delete(i)});continue}const n=this.kc(ao,this.Pu(t),e,t);"failed"!==n&&la.forEach(i=>{const e=Ol(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this._u.delete(i)})}}Bu(){const t={},i={flags:{},surveys:{}};return Lr(this.props,(e,s)=>{var n;const r=null===(n=Ol(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}Hu(t,i){if(i===oa)return JSON.stringify(t)+"|"+this.Sc+"|"+this.xc+"|"+this.$c;const e={};return Lr(t,(t,i)=>{var s;e[i]=(null===(s=Ol(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}kc(t,i,e,s){const n=this.Du(s);if(s!==oa&&!n.dirty&&!yi(n.fingerprint))return"skipped";let r,o=e;try{if(o=va(e),r=this.Hu(o,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(i,o,this.Sc,this.xc,this.$c,this.Yr.debug)?(n.dirty=!1,s!==oa&&(n.persisted=!0),yi(r)||(n.fingerprint=r),this.pu&&(n.storageValue=ao.Lt(i)),"written"):(this.Yr.debug&&Fr.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Yu(),yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0),this.nu.Dt(this.Mu,!1),this.nu.Dt(this.Mu,!0),!t&&this.Cu)for(const t of El)ao.Dt(this.Pu(t));t?delete this.fu[oa]:this.fu={},this.nc=void 0,this.sc=void 0,this.Qu=void 0}clear(){this.remove(),this.props={},this.Tu=void 0}register_once(t,i,e){if(_i(t)){this.syncCookieProperties(),yi(i)&&(i="None"),this.Sc=yi(e)?this.Cc:e;let s=!1;if(Lr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Wu(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(_i(t)){this.syncCookieProperties(),this.Sc=yi(i)?this.Cc:i;let e=!1;if(Lr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||_i(i)||pi(i))&&(this.Wu(s,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=!1;for(const t of i)t in this.props&&(this.Vu(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==o?void 0:o.URL;if(t===this.Tu)return;const i=Vl(this.Yr.custom_campaign_params,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties),e=!mi(zr(i));return e&&this.register(i),this.Tu=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==o?void 0:o.referrer;return t?Kl(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Xl(),$referring_domain:(null==o?void 0:o.referrer)&&(null===(t=Rl(o.referrer))||void 0===t?void 0:t.host)||Zl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Ql(this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties,this.Yr.disable_capture_url_hashes);this.register_once({[Mt]:this.gu?{r:ra(t.r),u:t.u?ra(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Lr([It,At],i=>{const e=this.props[i];e&&Lr(e,function(i,e){t["$initial_"+hi(e)]=i})});const i=this.props[Mt];if(i){const e=function(t,i=!1,e,s){const n=ta(t,i,e,s),r={};return Lr(n,function(t,i){r[`$initial_${hi(i)}`]=t}),r}(i,this.Yr.disable_capture_url_hashes,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties);Nr(t,e)}return t}safe_merge(t){return Lr(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,a=!!this.Ai&&!l;l||this.rc(i,a),this.Yr=t,!l&&(s||n||o)&&(this.nc=void 0,this.sc=void 0,this.Qu=void 0,this.rc(us(us({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.Iu(t):this.nu;this.Tc();const h=this.Eu(t),c=r||h!==this.mu,d=!l&&(c||t.cross_subdomain_cookie!==this.xc||t.secure_cookie!==this.$c)&&this.oc(a);this.wu=c;try{if(this.Cc=this.Sc=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.nu=u,this.mu=h,this.props=t,this.save()}else o&&(this.nu=u,l||(delete this.fu[oa],this.uc()))}finally{this.wu=!1,d&&this.cc()}}Tc(){const t=this.props[Mt];if(!this.gu||!_i(t)||"string"!=typeof t.r)return;const i=ra(t.r),e="string"==typeof t.u?ra(t.u):t.u;i===t.r&&e===t.u||this.Wu(Mt,us(us({},t),{},{r:i,u:e}))}set_disabled(t){this.Ai=t,this.Ai?this.remove():this.save()}set_cross_subdomain(t){t!==this.xc&&(this.xc=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.$c&&(this.$c=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.Wu(Z,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return yi(e)||(delete i[t],this.Wu(Z,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Wu(t,i),this.save()}Wu(t,i,e=!0){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.ku=!0),ha(t)&&!ca(n,i)&&this.xu.add(t),this.Xu(t,n,i),(null===(s=Ol(t))||void 0===s?void 0:s.volatile)||this.Ku(t))}Vu(t,i=!0){delete this.props[t],i&&(aa(t)&&this.Lu(t,!0),ha(t)&&this.xu.add(t),this.Ku(t))}Ku(t){var i;const e=null===(i=Ol(t))||void 0===i?void 0:i.storageGroup;e&&(this.Du(e).dirty=!0)}Du(t){return this.fu[t]||(this.fu[t]={})}};const ga={GZipJS:"gzip-js",Base64:"base64"},_a={Activation:"events",Cancellation:"cancelEvents"},ma={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ya={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ba={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"},wa={Popover:"popover",Inline:"inline"};function $a(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&gi(e.then)&&e.then(void 0,()=>{})}}}}const xa={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"},Sa={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"},ka=Dr("[RateLimiter]");var Ea=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{ka.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void ka.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?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}get isClientRateLimited(){return 1>this.Mc().tokens}clientRateLimitContext(t=!1){var i;const e=this.Mc(),s=1>e.tokens;if(s||t||(e.tokens=Math.max(0,e.tokens-1)),s&&!t){const t=(Si(e.dropped)?e.dropped:0)+1;e.dropped=t,!this.lastEventRateLimited&&this.Ic(t)&&(e.dropped=0)}return this.lastEventRateLimited=s,null===(i=this.instance.persistence)||void 0===i||i.set_property("$capture_rate_limit",e),{isRateLimited:s,remainingTokens:e.tokens}}Mc(){var t;const{captureEventsBurstLimit:i,captureEventsPerSecond:e}=this,s=(new Date).getTime(),n=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Rt),r=n?us({},n):{tokens:i,last:s};return r.tokens+=Math.max(0,s-r.last)/1e3*e,r.last=Math.max(r.last,s),r.tokens>i&&(r.tokens=i),r}Ec(t){const i=this.instance.config.property_denylist;return!pi(i)||!i.includes(t)}Ac(){var t;if(this.Ec("$current_url")&&this.Ec("$pathname")&&(null==l?void 0:l.pathname))return`${null!==(t=l.origin)&&void 0!==t?t:""}${l.pathname}`}Ic(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Ac(),o=this.Ec("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}};const Ta=Dr("[RemoteConfig]");var Pa=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=f._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Rc(t){const i=g(this._instance);i?i(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Pc(t){const i=this._instance.__pending_remote_config_callbacks;if(i)return void i.push(t);const e=[t];this._instance.__pending_remote_config_callbacks=e;try{this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),batchKey:"remote_config",fireCallbackOnDrop:!0,callback:t=>{this._instance.__pending_remote_config_callbacks=void 0,e.forEach(i=>i(t))}})}catch(t){throw this._instance.__pending_remote_config_callbacks=void 0,t}}load(){try{if(this.remoteConfig)return Ta.info("Using preloaded remote config",this.remoteConfig),void this.Oc(this.remoteConfig);if(this._instance.Fc())return void Ta.warn("Remote config is disabled. Falling back to local config.");if(!this._instance.config.opt_in_site_apps)return void this.Pc(t=>{this.Oc(t.json,t)});this.Rc(t=>{if(!t)return Ta.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pc(t=>{this.Oc(t.json,t)});this.Oc(t)})}catch(t){Ta.error("Error loading remote config",t),this.Oc()}}Oc(t,i){!t&&i&&(0===i.statusCode?i.error||Ta.warn("Failed to fetch remote config from PostHog."):Ta.error("Failed to fetch remote config from PostHog."));try{this._instance.Oc(t?{ok:!0,config:t}:{ok:!1})}catch(t){Ta.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)||void 0===e||e.ensureFlagsLoaded()}catch(t){Ta.error("Error loading feature flags",t)}}},Oa=Uint8Array,Ca=Uint16Array,Ra=Uint32Array,Aa=new Oa([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]),Ia=new Oa([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]),Ma=new Oa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fa=function(t,i){for(var e=new Ca(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new Ra(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return[e,n]},Da=Fa(Aa,2),ja=Da[1];Da[0][28]=258,ja[258]=28;for(var La=Fa(Ia,0)[1],Na=new Ca(32768),Ba=0;32768>Ba;++Ba){var Ua=(43690&Ba)>>>1|(21845&Ba)<<1;Na[Ba]=((65280&(Ua=(61680&(Ua=(52428&Ua)>>>2|(13107&Ua)<<2))>>>4|(3855&Ua)<<4))>>>8|(255&Ua)<<8)>>>1}var za=function(t,i,e){for(var s=t.length,n=0,r=new Ca(i);s>n;++n)++r[t[n]-1];var o,l=new Ca(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new Ca(1<<i);var a=15-i;for(n=0;s>n;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],c=l[t[n]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Na[c]>>>a]=u}else for(o=new Ca(s),n=0;s>n;++n)o[n]=Na[l[t[n]-1]++]>>>15-t[n];return o},Ha=new Oa(288);for(Ba=0;144>Ba;++Ba)Ha[Ba]=8;for(Ba=144;256>Ba;++Ba)Ha[Ba]=9;for(Ba=256;280>Ba;++Ba)Ha[Ba]=7;for(Ba=280;288>Ba;++Ba)Ha[Ba]=8;var qa=new Oa(32);for(Ba=0;32>Ba;++Ba)qa[Ba]=5;var Wa=za(Ha,9,0),Va=za(qa,5,0),Ga=function(t){return(t/8|0)+(7&t&&1)},Ka=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof Ca?Ca:t instanceof Ra?Ra:Oa)(e-i);return s.set(t.subarray(i,e)),s},Ja=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Ya=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},Za=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return[new Oa(0),0];if(1==n){var o=new Oa(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 l=e[0],a=e[1],u=0,h=1,c=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[c].f>e[u].f?u++:c++],a=e[u!=h&&e[c].f>e[u].f?u++:c++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var v=new Ca(d+1),f=Xa(e[h-1],v,0);if(f>i){s=0;var p=0,g=f-i,_=1<<g;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=_-(1<<f-v[m]),v[m]=i}for(p>>>=g;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p)}f=i}return[new Oa(v),f]},Xa=function(t,i,e){return-1==t.s?Math.max(Xa(t.l,i,e+1),Xa(t.r,i,e+1)):i[t.s]=e},Qa=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ca(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=t[l]}return[e.subarray(0,s),i]},tu=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},iu=function(t,i,e){var s=e.length,n=Ga(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},eu=function(t,i,e,s,n,r,o,l,a,u,h){Ja(i,h++,e),++n[256];for(var c=Za(n,15),d=c[0],v=c[1],f=Za(r,15),p=f[0],g=f[1],_=Qa(d),m=_[0],y=_[1],b=Qa(p),w=b[0],x=b[1],S=new Ca(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Za(S,7),T=E[0],P=E[1],O=19;O>4&&!T[Ma[O-1]];--O);var C,R,A,I,M=u+5<<3,F=tu(n,Ha)+tu(r,qa)+o,D=tu(n,d)+tu(r,p)+o+14+3*O+tu(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=M&&D>=M)return iu(i,h,t.subarray(a,a+u));if(Ja(i,h,1+(F>D)),h+=2,F>D){C=za(d,v,0),R=d,A=za(p,g,0),I=p;var j=za(T,P,0);for(Ja(i,h,y-257),Ja(i,h+5,x-1),Ja(i,h+10,O-4),h+=14,k=0;O>k;++k)Ja(i,h+3*k,T[Ma[k]]);h+=3*O;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)Ja(i,h,j[U=31&B[k]]),h+=T[U],U>15&&(Ja(i,h,B[k]>>>5&127),h+=B[k]>>>12)}}else C=Wa,R=Ha,A=Va,I=qa;for(k=0;l>k;++k)if(s[k]>255){var U;Ya(i,h,C[257+(U=s[k]>>>18&31)]),h+=R[U+257],U>7&&(Ja(i,h,s[k]>>>23&31),h+=Aa[U]);var z=31&s[k];Ya(i,h,A[z]),h+=I[z],z>3&&(Ya(i,h,s[k]>>>5&8191),h+=Ia[z])}else Ya(i,h,C[s[k]]),h+=R[s[k]];return Ya(i,h,C[256]),h+R[256]},su=new Ra([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nu=new Oa(0),ru=function(){for(var t=new Ra(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ou=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function lu(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,s=0;i.length>s;++s)e=ru[255&e^i[s]]^e>>>8;t=e},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,a,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),a=8,function(t,i,e,s,n,r){var o=t.length,l=new Oa(s+o+5*(1+Math.floor(o/7e3))+n),a=l.subarray(s,l.length-n),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=iu(a,u,t.subarray(h,c)):(a[h]=r,u=iu(a,u,t.subarray(h,o)))}else{for(var d=su[i-1],v=d>>>13,f=8191&d,p=(1<<e)-1,g=new Ca(32768),_=new Ca(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Ra(25e3),x=new Ca(288),S=new Ca(32),k=0,E=0,T=(h=0,0),P=0,O=0;o>h;++h){var C=b(h),R=32767&h,A=_[C];if(g[R]=A,_[C]=R,h>=P){var I=o-h;if((k>7e3||T>24576)&&I>423){u=eu(t,a,0,w,x,S,E,T,O,h-O,u),T=k=E=0,O=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var F=2,D=0,j=f,L=R-A&32767;if(I>2&&C==b(h-L))for(var N=Math.min(v,I)-1,B=Math.min(32767,h),U=Math.min(258,I);B>=L&&--j&&R!=A;){if(t[h+F]==t[h+F-L]){for(var z=0;U>z&&t[h+z]==t[h+z-L];++z);if(z>F){if(F=z,D=L,z>N)break;var H=Math.min(L,z-2),q=0;for(M=0;H>M;++M){var W=h-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,A=W)}}}L+=(R=A)-(A=g[R])+32768&32767}if(D){w[T++]=268435456|ja[F]<<18|La[D];var G=31&ja[F],K=31&La[D];E+=Aa[G]+Ia[K],++x[257+G],++S[K],P=h+F,++k}else w[T++]=t[h],++x[t[h]]}}u=eu(t,a,r,w,x,S,E,T,O,h-O,u),r||(u=iu(a,u,nu))}return Ka(l,0,s+Ga(u)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,a,!u)),c=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&&ou(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s)}}(h,i),ou(h,c-8,e.d()),ou(h,c-4,s),h}const au=!!u||!!a,uu=new WeakMap,hu="text/plain";let cu=0,du=!1;const vu=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},fu=(t,i,e=!0)=>{const s=t.indexOf("#"),n=-1===s?"":t.slice(s),r=-1===s?t:t.slice(0,s),o=r.indexOf("?"),l=-1===o?r:r.slice(0,o),a=-1===o?"":r.slice(o+1),u=us({},i),h=a.split("&").filter(t=>""!==t).map(t=>{const i=t.indexOf("="),s=-1===i?t:t.slice(0,i),n=e?u[s]:void 0;return delete u[s],xi(n)?t:`${s}=${n}`}),c=function(t,i="&"){let e,s;const n=[];return Lr(t,function(t,i){yi(t)||yi(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e)}),n.join(i)}(u);return c&&h.push(c),`${h.length>0?`${l}?${h.join("&")}`:l}${n}`},pu=t=>{if(t.Mr)return t.Mr;const{data:i,compression:e}=t;if(!i)return;if(e===ga.GZipJS){const t=lu(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new Oa(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t},r=0;i>r;++r){if(s+5>e.length){var o=new Oa(s+8+(i-r<<1));o.set(e),e=o}var l=t.charCodeAt(r);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(++r))>>>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 Ka(e,0,s)}(Fl(i)),{mtime:0});return{contentType:hu,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===ga.Base64){const e=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(Fl(i)),s="sendBeacon"===t.transport,n=s?e:(t=>"data="+encodeURIComponent("string"==typeof t?t:Fl(t)))(e);return{contentType:s?hu:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const s=Fl(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},gu=t=>{const i=()=>"sendBeacon"===t.transport?{url:fu(t.url,{compression:ga.Base64}),encodedBody:pu(us(us({},t),{},{compression:ga.Base64,Mr:void 0}))}:{url:vu(t.url,"compression"),encodedBody:pu(us(us({},t),{},{compression:void 0,Mr:void 0}))};let e;try{e=pu(t)}catch(e){if(an(t.compression,Dl(t.url,"compression")))return Fr.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&an(t.compression,Dl(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?ln(new Uint8Array(s)):ArrayBuffer.isView(s)&&ln(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(du=!0,i()):{url:t.url,encodedBody:e};var s},_u=t=>{try{return gu(t)}catch(e){var i;return Fr.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},mu=function(){var t=Li(function*(t){const i=yield function(t){return pn.apply(this,arguments)}(Fl(t.data),e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return us(us({},t),{},{Mr:{contentType:hu,body:s,estimatedSize:s.byteLength}})});return function(i){return t.apply(this,arguments)}}(),yu=t=>ts("AbortError","PostHog request timed out"+(t?` after ${t}ms`:"")),bu=/Failed to fetch|NetworkError|Load failed/i,wu=t=>"TypeError"===(null==t?void 0:t.name)&&bu.test((null==t?void 0:t.message)||""),$u=t=>{try{const i=function(t,i=Date.now(),e=3e5){if("string"!=typeof t||!t)return;const s=t.trim(),n=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),e/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const r=/^\w{3} \w{3} /.test(n)?n+" GMT":n,o=Date.parse(r)-i;return Number.isFinite(o)&&o>0?Math.min(o,e):void 0}(t());return yi(i)?void 0:Math.min(i,3e4)}catch(t){return}},xu=t=>{var i;const e=_u(t);if(!e)return;const s=new u;uu.set(s,!0);const{url:n,encodedBody:r}=e;s.open(t.method||"GET",n,!0);const{contentType:o,body:l}=null!=r?r:{};Lr(t.headers,function(t,i){s.setRequestHeader(i,t)}),o&&s.setRequestHeader("Content-Type",o),t.timeout&&(s.timeout=t.timeout);let a=!1;s.ontimeout=()=>{a=!0},s.onloadend=()=>{var i;if(a){var e;const i=yu(t.timeout);return Fr.warn(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}const n={statusCode:s.status,text:s.responseText};if(200===s.status)try{n.json=JSON.parse(s.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,n,$u(()=>s.getResponseHeader("Retry-After")))},null===(i=t.onSend)||void 0===i||i.call(t,n),s.send(l)},Su=t=>{const i=_u(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},l=new Headers;Lr(t.headers,function(t,i){l.append(i,t)}),n&&l.append("Content-Type",n);let u=null,c=!1;if(h){const i=new h;u={signal:i.signal,timeout:setTimeout(()=>{c=!0;try{i.abort(yu(t.timeout))}catch(t){v(t)}},t.timeout)}}let d=!1;const v=i=>{var e;d||(d=!0,c&&"AbortError"===(null==i?void 0:i.name)||wu(i)?Fr.warn(i):Fr.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))};let f=0;const p=()=>{cu-=f,f=0,u&&clearTimeout(u.timeout)};try{var g;const i=us({method:(null==t?void 0:t.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:r,signal:null==u?void 0:u.signal},t.fetchOptions);null===(g=t.onSend)||void 0===g||g.call(t,e);const s=null!=o?o:yi(r)?0:void 0;i.keepalive="POST"===i.method&&!t.tu&&!1!==i.keepalive&&i.body===r&&!yi(s)&&s>=0&&52428.8>cu+s,i.keepalive&&(f=s,cu+=f),a(e,i).then(i=>i.text().then(e=>{var s;if(d)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){Fr.error(t)}d=!0,p(),null===(s=t.callback)||void 0===s||s.call(t,n,$u(()=>i.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},ku=t=>{try{var i;const{url:e,encodedBody:s}=gu(t),{contentType:n,body:o,estimatedSize:l}=null!=s?s:{};if(!o)return;const u=o instanceof Blob?o:new Blob([o],{type:n});if(r.sendBeacon(e,u))return;const h=pi(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(pi(h)&&h.length>1&&(null!=l?l:0)>16384){const i=Math.ceil(h.length/2),e=i=>pi(t.data)?i:us(us({},t.data),{},{batch:i});return ku(us(us({},t),{},{data:e(h.slice(0,i))})),void ku(us(us({},t),{},{data:e(h.slice(i))}))}Fr.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${a?"fetch":"XHR"}`),a?Su(us(us({},t),{},{tu:!0})):xu(t)}catch(t){Fr.warn("Beacon send failed",t)}},Eu=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return fu(e===ga.GZipJS?vu(t,"compression"):t,us(us({},n?{[n]:Date.now().toString()}:{}),e===ga.GZipJS?{}:{compression:e}))},Tu=(()=>{const t=[];return a&&t.push({transport:"fetch",method:Su}),u&&t.push({transport:"XHR",method:xu}),(null==r?void 0:r.sendBeacon)&&t.push({transport:"sendBeacon",method:ku}),t})();let Pu=!au&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla"));function Ou(t,i,e){var s,n,r,o;e&&(i=us(us({},i),{},{callback:t=>e(t)})),t.__loaded?Pu?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=us(us({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(yi(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,null===(n=i.onDispatch)||void 0===n||n.call(i),((t,i)=>{var e,s,n;const r=us(us({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&yi(r.compression)&&r.data&&(r.compression=ga.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(pi(t)?t:[t]).map(t=>us(us({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>pi(t)?t.map(t=>us(us({},t),{},{sent_at:i})):us(us({},t),{},{sent_at:i}))(r.data))),r.url=Eu(r.url,r.method,r.compression,r.timestampMode);const l=Tu.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),a=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!a)throw new Error("No available transport method");const u=t=>{try{a(t)}catch(t){var i;wu(t)?Fr.warn(t):Fr.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===ga.GZipJS&&c&&"undefined"!=typeof Promise&&!du?mu(r).then(t=>{u(t)}).catch(i=>{if(un(i))return du=!0,void u(us(us({},r),{},{compression:void 0,url:Eu(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;const i="name"in t?String(t.name):"";return un(t)||i===on})(i)&&(du=!0),u(r)}):u(r)})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s)})):i.fireCallbackOnDrop&&(null===(o=i.callback)||void 0===o||o.call(i,{statusCode:0}))}var Cu=class{constructor(t,i){this.Lc=!0,this.Dc=[],this.Nc=zi((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Fr.createLogger("flush interval"),3e3),this.jc=t}enqueue(t){this.Dc.push(t),this.qc||this.Bc()}unload(){this.zc();const t=this.Dc.length>0?this.Hc():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Uc(us(us({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.Lc=!1,this.Bc()}Bc(){this.Lc||(this.qc=setTimeout(()=>{this.zc(),this.Wc()},this.Nc))}Wc(){if(this.Dc.length>0){const t=this.Hc();for(const i in t)this.Uc(t[i])}}Uc(t,i){try{this.jc(t,i)}catch(t){Fr.error(t)}}zc(){clearTimeout(this.qc),this.qc=void 0}Hc(){const t={},i={};Lr(this.Dc,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");yi(t[r])&&(t[r]=us(us({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback)});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t)})}return this.Dc=[],t}};const Ru=["retriesPerformedSoFar"];var Au=class{constructor(t){this._instance=t,this.Vc=!1,this.Gc=3e3,this.Dc=[],this.Dc=[],this.Jc=!0,this.resume()}resume(){if(!yi(s)&&"onLine"in s.navigator){if(this.Jc=s.navigator.onLine,this.Qc)return;this.Qc=()=>{this.Jc=!0,this.Wc()},this.Zc=()=>{this.Jc=!1},Vr(s,"online",this.Qc),Vr(s,"offline",this.Zc)}}get length(){return this.Dc.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=gn(t,Ru);ki(e)&&(s.url=fu(s.url,{retry_count:e})),Ou(this._instance,i?us(us({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.js(us({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Fr.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!=e?e:0} retries.`)}null===(n=s.callback)||void 0===n||n.call(s,t)})}js(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.Dc.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Fr.warn(r),this.Vc||(this.Vc=!0,this.Kc())}Kc(){if(this.Yc&&clearTimeout(this.Yc),0===this.Dc.length)return this.Vc=!1,void(this.Yc=void 0);this.Yc=setTimeout(()=>{this.Jc&&this.Dc.length>0&&this.Wc(),this.Kc()},this.Gc)}Wc(){const t=Date.now(),i=[],e=this.Dc.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.Dc=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.Yc&&(clearTimeout(this.Yc),this.Yc=void 0),this.Vc=!1,yi(s)||(this.Qc&&(s.removeEventListener("online",this.Qc),this.Qc=void 0),this.Zc&&(s.removeEventListener("offline",this.Zc),this.Zc=void 0));for(const{requestOptions:t}of this.Dc)try{this._instance._send_request(us(us({},t),{},{callback:pi(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Fr.error(t)}this.Dc=[]}},Iu=class{constructor(t){this._instance=t,this.Xc=()=>{var t,i,e,s;this.eh||(this.eh={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),a=(null==n?void 0:n.scrollHeight)||0;this.eh.lastScrollY=Math.ceil(r),this.eh.maxScrollY=Math.max(r,null!==(t=this.eh.maxScrollY)&&void 0!==t?t:0),this.eh.maxScrollHeight=Math.max(o,null!==(i=this.eh.maxScrollHeight)&&void 0!==i?i:0),this.eh.lastContentY=l,this.eh.maxContentY=Math.max(l,null!==(e=this.eh.maxContentY)&&void 0!==e?e:0),this.eh.maxContentHeight=Math.max(a,null!==(s=this.eh.maxContentHeight)&&void 0!==s?s:0)}}get ih(){return this._instance.config.scroll_root_selector}getContext(){return this.eh}resetContext(){const t=this.eh;return this.eh=void 0,setTimeout(this.Xc,0),t}startMeasuringScrollPosition(){Vr(s,"scroll",this.Xc,{capture:!0}),Vr(s,"scrollend",this.Xc,{capture:!0}),Vr(s,"resize",this.Xc)}scrollElement(){if(this.ih){const i=pi(this.ih)?this.ih:[this.ih];for(const e of i){var t;const i=null==s||null===(t=s.document)||void 0===t?void 0:t.querySelector(e);if(i)return i}return}var i;return null==s||null===(i=s.document)||void 0===i?void 0:i.documentElement}nh(t){var i,e;const n="y"===t?"scrollTop":"scrollLeft";if(this.ih){const t=this.scrollElement();return t&&t[n]||0}return s?"y"===t?s.scrollY||s.pageYOffset||(null===(i=s.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:s.scrollX||s.pageXOffset||(null===(e=s.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollLeft)||0:0}scrollY(){return this.nh("y")}scrollX(){return this.nh("x")}};const Mu=t=>Ql(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);var Fu=class{constructor(t,i,e,s){this.Je=t=>{const i=this.sh();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.rh(this._instance)};this.oh.register({[Ct]:e})},this._instance=t,this.ah=i,this.oh=e,this.rh=s||Mu,this.ah.onSessionId(this.Je)}sh(){return this.oh.props[Ct]}getSetOnceProps(){var t;const i=null===(t=this.sh())||void 0===t?void 0:t.props;return i?"r"in i?ta(i,this._instance.config.disable_capture_url_hashes,this._instance.config.mask_personal_data_properties,this._instance.config.custom_personal_data_properties):{$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(){const t={};return Lr(zr(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${hi(e)}`]=i}),t}},Du=class{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(const e of this.Zo[t]||[])e(i);for(const e of this.Zo["*"]||[])e(t,i)}constructor(){this.Zo={}}};const ju=Dr("[SessionId]"),Lu=864e5;var Nu=class{on(t,i){return this.uh.on(t,i)}constructor(t,i,e){var s;if(this.hh=null,this.dh=null,this.fh=[],this.ph=void 0,this.gh=!1,this.uh=new Du,this.mh=(t,i)=>!(!ki(t)||!ki(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Yr=t.config,this.oh=t.persistence,this.Ye=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.yh=void 0,this._sessionActivityTimestamp=null,this.bh=i||io,this._h=e||io;const n=this.Yr.persistence_name||this.Yr.token;if(this._sessionTimeoutMs=1e3*zi(this.Yr.session_idle_timeout_seconds||1800,60,36e3,ju.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.wh(),this.kh="ph_"+n+"_window_id",this.Sh="ph_"+n+"_primary_window_exists",this.xh()){const t=xo.Pt(this.kh),i=xo.Pt(this.Sh);t&&!i?this.Ye=t:xo.Dt(this.kh),xo.$t(this.Sh,!0)}(null===(s=this.Yr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Yr.bootstrap.sessionID),this.$h()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return yi(this.fh)&&(this.fh=[]),this.fh.push(t),this.Xt&&t(this.Xt,this.Ye),()=>{this.fh=this.fh.filter(i=>i!==t)}}xh(){return"memory"!==this.Yr.persistence&&!this.oh.Ai&&xo.Ot()}Ch(t){t!==this.Ye&&(this.Ye=t,this.xh()&&xo.$t(this.kh,t))}Th(){return this.Ye?this.Ye:this.xh()?xo.Pt(this.kh):null}Mh(t){const i=this.hh;return!$i(i)&&!$i(t)&&5e3>Math.abs(t-i)}Ih(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.Mh(i)||(this.hh=i,this.oh.register({[ft]:[i,t,e]}))}Eh(){var t;const i=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return ki(i)&&i>0}Ah(){this.Eh()?this.oh.refreshKey(ft):(this.oh.flush(),this.oh.load())}Rh(){var t;if($i(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.hh)return;this.Ah();const[,i,e]=this.Ph();i===this.Xt&&e===this._sessionStartTimestamp&&(this.hh=this._sessionActivityTimestamp,this.oh.register({[ft]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.oh.flush())}Oh(){const[t]=this.Ph(),i=ki(t)?t:0,e=ki(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Fh(t){return this.Ah(),this.mh(t,this.Oh())}Ph(){const t=this.oh.props[ft];return pi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.hh=null,this.yh=void 0,clearTimeout(this.Lh),this.Lh=void 0,this.Ih(null,null,null)}setBootstrapSessionId(t,i=!1){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const 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 ju.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void ju.error("Invalid sessionID in bootstrap",t)}})(t);return!yi(e)&&(i?this.yh={sessionId:t,sessionStartTimestamp:e}:this.Ih(t,(new Date).getTime(),e),!0)}destroy(){this.gh=!0,this.Rh(),clearTimeout(this.Lh),this.Lh=void 0,this.ph&&s&&(s.removeEventListener(Qt,this.ph,{capture:!1}),this.ph=void 0),this.fh=[]}$h(){this.ph=()=>{this.Rh(),this.xh()&&xo.Dt(this.Sh)},Vr(s,Qt,this.ph,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Yr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.dh=s;else if($i(this.dh)||this.dh>s||s-this.dh>=1e3){var r,o;null===(r=(o=this.oh).syncCookieProperties)||void 0===r||r.call(o),this.dh=s}let[,l,a]=this.Ph();const u=!yi(n)&&l!==n,h=this.Oh();let c=this.Th();const d=this.yh,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>Lu),f=d?v:ki(a)&&Math.abs(s-a)>Lu;let p=!1,g=u,_=!l||!!d;const m=l;let y=!_&&!t&&this.mh(s,h);if(y&&(y=this.Fh(s),y||ju.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Ph(),y||(_=!l||!!d)),_||y||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.bh(),c=this._h(),ju.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:s,this.yh=void 0,p=!0}else c||(c=this._h(),p=!0),g=g||l!==m,g&&(ju.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=ki(h)&&t&&!f?h:s,w=ki(a)?a:(new Date).getTime();this.Ch(c),this.Ih(l,b,w),t||this.wh();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.fh.forEach(t=>t(l,c,x)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?x:void 0,lastActivityTimestamp:h}}wh(){this.gh||(clearTimeout(this.Lh),this.Lh=setTimeout(()=>{if(!this.gh)if(this.Fh((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.uh.emit("forcedIdleReset",{idleSessionId:t})}else this.wh()},1.1*this.sessionTimeoutMs))}};const Bu=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Uu=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&Ui(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>Ui(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function zu(){return(zu=Li(function*(){const t=null==r?void 0:r.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return bi(e)&&e.length>0?e:void 0}catch(t){return void Fr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Hu(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function qu(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const Wu=(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}},Vu=t=>t.toLowerCase(),Gu={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=>Wu(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Wu(i,t))),icontains:(t,i)=>i.map(Vu).some(i=>t.map(Vu).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Vu).every(i=>t.map(Vu).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Ku(t,i){return!t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return!1;const n=Gu[e.operator];return!!n&&n(e.values.map(String),[String(s)])})}function Ju(t,i,e){return Fl({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Yu="custom",Zu="i.posthog.com",Xu=/^\/static\//,Qu=["/s/","/e/","/i/"];var th=class{constructor(t){this.Dh={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Zu}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Dh[this.apiHost]||(this.Dh[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":Yu),this.Dh[this.apiHost]}Nh(t){if(!Xu.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}jh(t){const i=Rl(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}qh(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=Rl(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&Qu.some(t=>0===i.indexOf(t))){const t=this.jh(s);if(t){const i=this.apiHost;let e=this.Bh;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.Bh=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.Bh,e=this.jh(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(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.qh(t,i,this.uiHost+i);if("flags"===t)return this.qh(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.Nh(i);if(e)return this.qh(t,i,`${e}${i}`)}if(this.region===Yu)return this.qh(t,i,this.apiHost+i);const e=Zu+i;switch(t){case"assets":return this.qh(t,i,`https://${this.region}-assets.${e}`);case"api":return this.qh(t,i,`https://${this.region}.${e}`)}}};const ih=Dr("[Surveys]"),eh=t=>{try{const i=(t=>((t,i)=>`seenSurvey_${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){ih.error("Failed to persist survey seen state",t)}},sh=[ma.Popover,ma.Widget,ma.API],nh={ignoreConditions:!1,ignoreDelay:!1,displayType:wa.Popover},rh=Dr("[PostHog ExternalIntegrations]"),oh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var lh=class{constructor(t){this._instance=t}lu(t,i){var e;null===(e=g(this._instance))||void 0===e||e(this._instance,t,t=>{if(t)return rh.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=f.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.lu(oh[n],()=>{var t;null===(t=f.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance)}),!r&&(null===(e=f.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=f.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},ah=class{constructor(t){this.disabled=!1===t;const i=_i(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;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.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}};const uh=()=>typeof window>"u"?void 0:window,hh=()=>typeof document>"u"?void 0:document,ch="$copy_autocapture",dh=["password","hidden","file","checkbox","button","submit","reset","image"],vh=Dr("[AutoCapture]");function fh(t,i){return i.length>t?i.slice(0,t)+"...":i}function ph(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!To(i));return i}function gh(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!To(t))return{props:{}};const u=[t],h=new Set([t]);let c=t;for(;!Po(c,"body")&&1e3>u.length;){const t=c.assignedSlot||c.parentNode,i=Co(t)?t.host:t&&To(t)?t:null;if(!i||h.has(i))break;h.add(i),u.push(i),c=i}const d="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>Po(t,"button")||Po(t,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some(t=>!el(t)||sl(t)));const v=[],f={};let p,g=!1,_=!1;if(Lr(u,t=>{const i=el(t);if(i&&Po(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");g=!!(i&&e&&cl(e))&&(o?is(e):e)}ai(Io(t),"ph-no-capture")&&(_=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};jo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?fh(1024,dl(t)):fh(1024,Fo(t)));const l=Io(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Lr(il(t)?[]:t.attributes,function(e){var r;if((!sl(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&cl(e.value)&&(!bi(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=Ro(t).join(" ")),o["attr__"+e.name]=fh(1024,"href"===e.name&&n?is(t):t)}});let a=1,u=1,h=t;for(;h=ph(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Lr(function(t){if(!el(t))return{};const i={};return Lr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&cl(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(t=u[d],v.splice(0,d)),s||(v[0].$el_text=Po(t,"a")||Po(t,"button")?dl(t):Fo(t)),g){var m,y;v[0].attr__href=g;const t=null===(m=Rl(g))||void 0===m?void 0:m.host,i=null===(y=uh())||void 0===y||null===(y=y.location)||void 0===y?void 0:y.host;t&&i&&t!==i&&(p=g)}return{props:Nr((w=i.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(b=v,pi(b)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`}const n=us(us(us(us({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Br(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[fl(t.toString())]=fl(i.toString())),s+=":",s+=Br(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:pl(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Br(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(b)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var b,w}const _h="autocapture";var mh=class{Pa(){this.Oa=void 0,clearTimeout(this.Fa),this.Fa=void 0}La(t){var i;if(!el(t))return!0;const e=null!==(i=this.Da().css_selector_ignorelist)&&void 0!==i?i:Uo,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Io(t);if(ai(i,"ph-no-capture")||ai(i,"ph-sensitive")||sl(t)||e.some(i=>Lo(t,i)))return!0;const r=n.assignedSlot||n.parentNode;n=Co(r)?r.host:r&&To(r)?r:null}return!1}Na(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.Pa();if("pointerdown"===t.type){var i;this.Pa();const e=Do(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&To(e)&&(this.Oa={target:e,excluded:this.La(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.ia)||void 0===i?void 0:i.distinctId}))}const e=this.Oa;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.Pa():"pointerup"===t.type&&(e.released=!0,this.Fa=setTimeout(()=>this.Pa(),0)))}ja(t){var i;const e=this.Oa;this.Pa();const s=Do(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.ia)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(Po(s,"html")||Po(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.Da().css_selector_ignorelist)&&void 0!==n?n:Uo;return[s,null===(r=hh())||void 0===r?void 0:r.documentElement,null===(o=hh())||void 0===o?void 0:o.body].some(i=>{if(!i)return!1;const e=Io(i);return ai(e,"ph-no-capture")||ai(e,"ph-sensitive")||!el(i)||sl(i)||t.some(t=>Lo(i,t))})?null:e.target}}constructor(t){this.ra=t,this.name=_h,this.qa=!1,this.Ba=null,this.za=!1,this.Ha=new Map,this.Ua=!1,this.Yr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.qi=!1,this.ra.refresh(this.Yr),this.rageclicks=new ah(this.Yr.rageclick),this.Wa=null}setup(t){this.Va(),this.ia=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.qi?i.dispose():(this.ma=i,this.startIfEnabled())}dispose(){var t;this.qi||(this.qi=!0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.Ha.clear(),this.Wa=null,this.Ga())}Da(){return this.ra.refresh(this.Yr),this.Yr}Va(){var t,i;return this.Da(),this.Yr.url_allowlist=null===(t=this.Yr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Yr.url_ignorelist=null===(i=this.Yr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Yr}Ja(){const t=uh(),i=hh();if(!this.isBrowserSupported())return void vh.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.Qa=t,this.Za=i;const e=this.Ka=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.Pa();if(0===i.type.indexOf("pointer"))return void this.Na(i);const t="click"===i.type?this.ja(i):void 0;if($i(t))return;this.Ya(i,"$autocapture",t)}catch(t){vh.error("Failed to capture event",t)}};if(Vr(t,"blur",e),Vr(i,"submit",e,{capture:!0}),Vr(i,"change",e,{capture:!0}),Vr(i,"click",e,{capture:!0}),Lr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Vr(i,t,e,{capture:!0})}),this.Da().capture_copied_text){const e=this.Xa=i=>{i=i||(null==t?void 0:t.event);try{this.Ya(i,ch)}catch(t){vh.error("Failed to capture clipboard event",t)}};Vr(i,"copy",e,{capture:!0}),Vr(i,"cut",e,{capture:!0}),Vr(i,"paste",e,{capture:!0})}}Ga(){const t=this.Qa,i=this.Za;this.Pa(),this.Ka&&(null==t||t.removeEventListener("blur",this.Ka),Lr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.Ka,!0)}),null==i||i.removeEventListener("submit",this.Ka,!0),null==i||i.removeEventListener("change",this.Ka,!0),null==i||i.removeEventListener("click",this.Ka,!0),this.Ka=void 0),this.Xa&&(null==i||i.removeEventListener("copy",this.Xa,!0),null==i||i.removeEventListener("cut",this.Xa,!0),null==i||i.removeEventListener("paste",this.Xa,!0),this.Xa=void 0),this.Qa=void 0,this.Za=void 0,this.qa=!1}startIfEnabled(){this.isEnabled||this.Pa(),!this.qi&&this.ia&&this.isEnabled&&!this.qa&&(this.Ja(),this.qa=!0)}onRemoteConfig(t){if(this.qi)return;if(this.za=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.Ua=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;Ei(e)&&(null===(s=this.ia)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.Ba=e),this.startIfEnabled()}setElementSelectors(t,i=this){if(this.qi)return;t.size?this.Ha.set(i,new Set(t)):this.Ha.delete(i);const e=new Set;this.Ha.forEach(t=>{t.forEach(t=>e.add(t))}),this.Wa=e}getElementSelectors(t,i){var e;const s=[];return null===(e=this.Wa)||void 0===e||e.forEach(e=>{var n;const r=null===(n=hh())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||ai(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.qi)return!1;const e=null===(t=this.ia)||void 0===t?void 0:t.kv.get(M),s=this.Ba,n=this.Da();if(!n.remoteRequestsDisabled&&!this.za)return!1;const r=n.remoteRequestsDisabled&&!this.za;if($i(s)&&!Ei(e)&&!r)return!1;const o=null!==(i=this.Ba)&&void 0!==i?i:!!e;return!!n.enabled&&!o}Ya(t,i="$autocapture",e){if(!this.isEnabled)return void this.Pa();let s=e||Do(t);Oo(s)&&(s=s.parentNode||null);const n=this.Va();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Xo(s,n.rageclick)&&this.Ya(t,"$rageclick",e);const o=i===ch,l=o?us(us({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Qo(t))return!1;if((null==e?void 0:e.url_allowlist)&&!Ao(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&Ao(e.url_ignorelist,r))return!1;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u,isComplete:h}=tl(t,s);if(!h)return!1;if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(yi(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(u,e))return!1;if(!No(u,null==e?void 0:e.css_selector_allowlist))return!1;if(No(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Uo))return!1;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(jo.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a;const{props:e,explicitNoCapture:r,target:o}=gh(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Ua,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===ch){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null===(u=uh())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),i=Mo(t);if(!i)return!1;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0}e.$copy_type=i}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(Po(c=s,"input")?!ai(dh,c.type):Po(c,"textarea")||Po(c,"select")&&!c.multiple)&&function(t,i){var e;if(!el(t))return!1;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:Uo,n=new Set;let r=t;for(Po(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Io(t);if(n.size>=1e3||n.has(r)||ai(i,"ph-sensitive")||ai(i,"ph-no-capture")||s.some(i=>Lo(t,i)))return!1;n.add(r);const e=r.assignedSlot||r.parentNode;r=Co(e)?e.host:e&&To(e)?e:null}return!0}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=!1;try{i=gi(t)?!!t(s):pi(t)&&t.some(t=>Lo(s,t))}catch(t){vh.error("capture_value_css_selector_allowlist threw",t)}i&&(e.$input_value=s.value)}return null===(a=this.ia)||void 0===a||a.capture(i,e),!0}var c}isBrowserSupported(){var t;return gi(null===(t=hh())||void 0===t?void 0:t.querySelectorAll)}};const yh="featureFlags",bh="logs",wh=()=>{var t;return(null==s||null===(t=s.performance)||void 0===t?void 0:t.now)?s.performance.now():Date.now()},$h=[],xh=[50,75,100,150,200,300,400,500,750,1e3,1500,2e3,3e3,5e3,1e4],Sh=[5,10,25,...xh];var kh=class{constructor(t){this._instance=t}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);yi(t)||(e[s]=t)}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t)}},Eh=class{constructor(t){this.instance=t,this.R=Fr,this.kv=new kh(t),this.onSession=t=>$a(this.instance.onSessionId(i=>{try{t(i)}catch(t){this.R.error("Browser extension session listener failed",t)}})),this.onEvent=t=>$a(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties})}catch(t){this.R.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i)}catch(t){this.R.error("Browser extension remote config listener failed",t)}},e=this.instance.Tr.on("extensionsRemoteConfig",i);return this.instance.Ir&&i(this.instance.Ir),$a(e)}}get logger(){return this.R}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(H);return"string"==typeof t?t:void 0}get library(){return{name:e.LIB_NAME,version:e.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return gi(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var t;return!!(null===(t=this.instance.rateLimiter)||void 0===t?void 0:t.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case yh:case"featureFlagsCommon":i=this.instance.featureFlags;break;case bh:i=this.instance.logs;break;case"surveys":i=this.instance.surveys;break;case _h:i=this.instance.autocapture}return i}capture(t,i,e){if(!e)return this.Ar(this.instance.capture(t,i));const s=us(us({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:!0}:{}),"immediate"===e.delivery?{send_instantly:!0}:{});return this.Ar(this.instance.capture(t,i,s))}Ar(t){var i;return!yi(t)||!(null===(i=this.instance.rateLimiter)||void 0===i?void 0:i.lastEventRateLimited)}registerDynamicEventProperties(t){return $a(this.instance.Rr(t))}sendRequest(t){var i=this;return Li(function*(t,e={}){var n;const r=null!==(n=e.target)&&void 0!==n?n:"api",o=e.query?fu(t,e.query):t,l=i.instance.requestRouter.endpointFor(r,o),a={method:e.method,url:l,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?ri.Base64:void 0,timestampMode:e.sentAt};return"api"===r&&"/i/v1/logs"===t&&(a.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(t=>{var e;if(a.callback=t,"flags"===r&&(null===(e=i.instance.config.metrics)||void 0===e?void 0:e.flags)){let e,n;a.onDispatch=()=>{e=wh()},a.onSend=t=>{n=(t=>{try{return(t=>{var i;const e=null==s?void 0:s.PerformanceObserver,n=null===(i=Rl(t))||void 0===i?void 0:i.href;if(!e||!n)return;const r=wh(),o={name:n,before:1/0,inFlight:!0};let l,a,u,h=1/0,c=!1;const d=()=>{c||(c=!0,clearTimeout(u),p.disconnect(),$h.splice($h.indexOf(o),1))};let v=!1;const f=t=>{for(const i of t){const t=i.startTime;i.name!==n||(v?r>=t:r>t)||t>=o.before||l&&t>=l.startTime||(l=i)}if(l&&a&&h>=l.startTime){const t=a;d(),t(l)}},p=new e(t=>f(t.getEntriesByName(n,"resource")));p.observe({entryTypes:["resource"]});for(const t of $h)t.name===n&&(t.before=Math.min(t.before,r),v=v||t.inFlight);return $h.push(o),{take(t,i){c||(h=t,o.inFlight=!1,a=i,u=setTimeout(d,5e3),gi(p.takeRecords)&&f(p.takeRecords()))},stop:d}})(t)}catch(t){return}})(t)},a.callback=s=>{if(t(s),yi(e))return;const r=e,o=wh();try{const t=((t,i)=>{var e,s;const n=i.statusCode||void 0,r={"server.address":(null!==(e=null===(s=Rl(t))||void 0===s?void 0:s.hostname)&&void 0!==e?e:t).replace(/^\[(.*)\]$/,"$1")};n&&(r["http.response.status_code"]=n);const o=((t,i)=>t?400>t?void 0:String(t):"AbortError"===(null==i?void 0:i.name)?"timeout":"_OTHER")(n,i.error);o&&(r["error.type"]=o);const l=Cl();return l&&(r["client.timezone"]=l),r})(l,s);if(i.Er("posthog.flags.request.duration",o-r,xh,t),s.statusCode&&n)return void n.take(o,e=>i.Or(e,r,o,t))}catch(t){Fr.error("Failed to record the /flags request timing",t)}null==n||n.stop()}}i.instance._send_request(a)})}).apply(this,arguments)}Or(t,i,e,s){if(t.responseEnd>=t.startTime)try{const n=Math.min(t.responseEnd,e);this.Er("posthog.flags.request.pre_send_duration",t.startTime-i,Sh,s),this.Er("posthog.flags.request.network_duration",n-t.startTime,xh,s),this.Er("posthog.flags.request.main_thread_duration",e-n,Sh,s)}catch(t){Fr.error("Failed to record the /flags request timing split",t)}}Er(t,i,e,s){var n;null===(n=this.instance.metrics)||void 0===n||n.histogram(t,i,{unit:"ms",attributes:us({},s),bounds:e})}};const Th={};let Ph=0;const Oh=()=>{},Ch='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Rh="Surveys module not available",Ah="sanitize_properties is deprecated. Use before_send instead",Ih="Invalid value for property_denylist config: ",Mh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Fh=["$feature_flag_called","$$heatmap","$snapshot"],Dh=t=>"$"===t.charAt(0)&&!ai(Fh,t),jh=/^[A-Za-z0-9_-]{1,400}$/,Lh=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Nh=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Bh=["token","distinct_id",jt],Uh="posthog",zh=[...Bu].sort()[Bu.length-1],Hh=t=>{const 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},qh=t=>{var i;return us({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wr(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Oh,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_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&bi(null==l?void 0:l.search)&&-1!==l.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,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null===(i=s.location)||void 0===i?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,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Fr.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:Xt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Oh},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ho,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Hh(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))},Wh=[["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"]],Vh=t=>{const i={};for(const[e,s]of Wh)yi(t[e])||(i[s]=t[e]);const e=Nr({},i,t),s=t.__preview_external_dependency_versioned_paths;return yi(s)||(yi(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),bi(s)&&yi(t.asset_host)&&(e.asset_host=s)),pi(t.property_blacklist)&&(yi(t.property_denylist)?e.property_denylist=t.property_blacklist:pi(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Fr.error(Ih+t.property_denylist)),e};var Gh=class{constructor(){this.__forceAllowLocalhost=!1}get zh(){return this.__forceAllowLocalhost}set zh(t){Fr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Kh=class t{Hh(t){if(!t)return;const i=this.Uh.indexOf(t);-1!==i&&this.Uh.splice(i,1)}Wh(t,i){var e;return this.Hh(t),this.Uh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}Vh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Gh(){if(this.Jh)return;if(!this.Qh||!("capture_pageview"in this.Qh))return;if(us(us({},t.__defaultExtensionClasses),this.config.__extensionClasses).historyAutocapture)return;const i=this.config.capture_pageview;("history_change"===i||_i(i)&&(i.path||i.search||i.hash&&!this.config.disable_capture_url_hashes))&&(this.Jh=!0,Fr.warn("capture_pageview is set to capture history changes, but the history autocapture extension is not loaded, so only the first pageview of each page load is captured. With the slim bundle, pass __extensionClasses: { historyAutocapture: AnalyticsExtensions.historyAutocapture } from 'posthog-js/dist/extension-bundles', or set capture_pageview: true to capture page loads only."))}Zh(){if(this.Kh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.Vh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.Yh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Kh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, 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. ${s}`)}Xh(){const t=this.persistence;if(!t||this.ed)return;if(this.Vh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.nd(),this.sd()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.rd()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(io());this.register({distinct_id:i,$device_id:i}),t.set_property(Ot,Yt)}this.nd()}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this.od=!1,this.ld=!1,this.ad=!1,this.webPerformance=new Gh,this.ud=!1,this.version=e.LIB_VERSION,this.__loadExternalDependency=p,this.hd=new Set,this.dd="",this.Tr=new Du,this.Uh=[],this.vd=[],this.fd=!1,this.Yh=!1,this.Kh=!1,this.Jh=!1,this.ed=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=qh(),this.SentryIntegration=Sl,this.sentryIntegration=t=>function(t,i){const e=xl(t,i);return{name:$l,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pd=!1,this.gd=null,this.md=null,this.yd=null,this.scrollManager=new Iu(this),this.pageViewManager=new kl(this),this.rateLimiter=new Ea(this),this.requestRouter=new th(this),this.consent=new So(this),this.externalIntegrations=new lh(this);const s=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(t,i,e)=>{const s=bi(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=bi(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>Fr.info(`send "${null==t?void 0:t.event}"`,t))}init(i,e,s){if(s&&s!==Uh){var n;const r=null!==(n=Th[s])&&void 0!==n?n:new t;return r._init(i,e,s),Th[s]=r,Th[Uh][s]=r,r}return this._init(i,e,s)}_init(t,i={},n){var r,o,l;const a=bi(t)?t.trim():"";if(!a)return Fr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var u;if(this.__loaded)return a!==(null===(u=this.config)||void 0===u?void 0:u.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=qh(i.defaults),i.debug=this.bd(i.debug),this.Qh=i,this._d=[],i.person_profiles?this.md=i.person_profiles:i.process_person&&(this.md=i.process_person);const h=qh(i.defaults),c=Vh(i),d=Nr({},h,c,{name:n,token:a});_i(h.rageclick)&&_i(c.rageclick)&&(d.rageclick=Nr({},h.rageclick,c.rageclick)),_i(h.session_recording)&&_i(c.session_recording)&&(d.session_recording=Nr({},h.session_recording,c.session_recording)),this.set_config(d),this.config.on_xhr_error&&Fr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ga.GZipJS;const v=this.rd(),f=!this.Vh();if(this.persistence=new pa(this.config,v,!0,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new pa(us(us({},this.config),{},{persistence:"sessionStorage"}),v,!1,f),this.dd="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!v&&xo.Ot()){const t=xo.Pt(this.dd);pi(t)&&t.forEach(t=>{bi(t)&&this.hd.add(t)})}else xo.Dt(this.dd);const p=us({},this.persistence.props),g=us({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.wd=new Cu((t,i)=>this.kd(t,i),this.config.request_queue_config),this.Sd=new Au(this),this.__request_queue=[];const _=this.Vh();_||(this.sessionManager=new Nu(this),this.sessionPropsManager=new Fu(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.xd()})),this.$d(),this.config.__preview_deferred_init_extensions?(Fr.info("Deferring extension initialization to improve startup performance"),this.Cd=setTimeout(()=>{this.Cd=void 0,this.Td(_)},0)):(Fr.info("Initializing extensions synchronously"),this.Td(_)),e.DEBUG=e.DEBUG||this.config.debug,e.DEBUG&&Fr.info("Starting in debug mode",{this:this,config:i,thisC:us({},this.config),p:p,s:g}),this.config.identity_distinct_id&&!(null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID)&&(i.bootstrap=us(us({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID;if(this.Yh=!!m&&!wi(m),null===(l=i.bootstrap)||void 0===l?void 0:l.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),s=this.persistence.get_property(Ot);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===s)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===s)Fr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(io()),s=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(Ot,i.bootstrap.isIdentifiedID?Zt:Yt),this.register({distinct_id:t,$device_id:s})}}if(_)this.register_once({distinct_id:Dt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(io());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(Ot,Yt)}return Vr(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Vr(s,"pageshow",t=>{if(this.ld=!1,!this.ad){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(z),i=this.persistence.get_property(Ot);this.persistence.load(),this.Md()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.Id()}null===(i=this.Sd)||void 0===i||i.resume()}}),i.segment?wl(this,()=>this.Ed()):this.Ed(),gi(this.config._onCapture)&&this.config._onCapture!==Oh&&(Fr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Fr.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 zu.apply(this,arguments)}().then(t=>{t&&this.register({[q]:t})}).catch(Oh),this}Ad(t){const i=t;return bi(i.name)&&gi(i.setup)}Rd(t,i){var e=this;this.Ad(t)?i.push(Li(function*(){try{yield t.setup(e.Pd())}catch(e){Fr.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t)}catch(i){Fr.error(`Failed to dispose extension "${t.name}"`,i)}}})):this.Uh.push(t)}$d(){var i,e,s,n=this;const r=null!==(i=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==i?i:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Od)||void 0===o||o.call(this),this.Od=void 0,this.featureFlags=new r(this)),gi(this.featureFlags.onReloading)&&gi(this.featureFlags.setup)){if(!this.Od){this.Od=this.featureFlags.onReloading(()=>{this.Tr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;Li(function*(){try{yield t.setup(n.Pd())}catch(i){Fr.error("Failed to set up feature flags",i);const e=n.Od;n.Od=void 0;try{null==e||e()}catch(t){Fr.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Fr.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}Td(i){const e=performance.now(),s=us(us({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,c,d;s.exceptions&&this.Uh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.Uh.push(this.historyAutocapture=new s.historyAutocapture(this)),this.Gh(),s.tracingHeaders&&this.Uh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.Uh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!i&&this.Uh.push(this.sessionRecording=new s.sessionRecording(this)),s.autocapture&&this.Rd(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Rd(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Rd(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.Uh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.Uh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.Uh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.Uh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.Uh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.Uh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.Uh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,ml)),s.toolbar&&this.Uh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.Uh.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new s.experiments(this)),s.webMCP&&this.Uh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new s.webMCP(this));const v=this.Uh.length>0||n.length>0;this.config.disable_scroll_properties||n.unshift(()=>{this.scrollManager.startMeasuringScrollPosition()}),this.Uh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Fd){const t=this.Fd;this.Fd=void 0,this.Uh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Ld(n,e,v)}Ld(t,i,e){for(var s,n;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.Cd=setTimeout(()=>{this.Cd=void 0,this.Ld(t,i,e)},0));const s=t.shift();if(s)try{s()}catch(t){Fr.error("Error initializing extension:",t)}}const r=Math.round(performance.now()-i);e&&r>0?this.register_for_session({[Lt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Nt]:r}):yi(null===(s=this.sessionPersistence)||void 0===s?void 0:s.props.$sdk_debug_extensions_init_method)&&yi(null===(n=this.sessionPersistence)||void 0===n?void 0:n.props.$sdk_debug_extensions_init_time_ms)||(this.unregister_for_session(Lt),this.unregister_for_session(Nt)),this.config.__preview_deferred_init_extensions&&Fr.info(`PostHog extensions initialized (${r}ms)`)}Oc(t){if(!o||!o.body)return Fr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Oc(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Fd=t),this.Ir=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=ai(e.supportedCompression,ga.GZipJS)?ga.GZipJS:ai(e.supportedCompression,ga.Base64)?ga.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.md?this.md:Xt}),this.Tr.emit("extensionsRemoteConfig",t),this.Uh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}Ed(){try{this.config.loaded(this)}catch(t){Fr.critical("`loaded` function failed",t)}if(this.Dd(),this.config.internal_or_test_user_hostname&&(null==l?void 0:l.hostname)){const t=l.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.Vh())&&this.Nd()},1),this.jd=new Pa(this),this.jd.load()}Dd(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.wd)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&jr(this.__request_queue,t=>this.kd(t)),this.__request_queue=[],this.Dd()}_handle_unload(){var t,i,e,s,n,r;this.ld=!0,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.qd()&&this.capture(ii),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.wd)||void 0===n||n.unload(),null===(r=this.Sd)||void 0===r||r.unload()):this.qd()&&this.capture(ii,null,{transport:"sendBeacon"})}_send_request(t){Ou(this,t)}kd(t,i){this.Sd?this.Sd.retriableRequest(t,i):this._send_request(i?us(us({},t),{},{transport:i}):t)}_execute_array(t){Ph++;try{let i;const e=[],s=[],n=[];jr(t,t=>{if(t)if(i=t[0],pi(i))n.push(t);else if(gi(t))try{t.call(this)}catch(i){Fr.error("Error executing queued PostHog call",t,i)}else pi(t)&&"alias"===i?e.push(t):pi(t)&&-1!==i.indexOf("capture")&&gi(this[i])?n.push(t):s.push(t)});const r=function(t,i){jr(t,function(t){try{if(pi(t[0])){let e=i;Lr(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Fr.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{Ph--}}push(i){if(Ph>0&&pi(i)&&bi(i[0])){const e=t.prototype[i[0]];return void(gi(e)&&e.apply(this,i.slice(1)))}this._execute_array([i])}get Bd(){return{property:G,persistenceKey:K,cookieName:"_fbc",pattern:Lh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[K]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(K)}}}get zd(){return{property:J,persistenceKey:Y,cookieName:"_fbp",pattern:Nh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[Y]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(Y)}}}Hd(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return bi(e)&&t.pattern.test(e)?{value:e,delivered:!1}:_i(e)&&bi(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Ud(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,!1),{value:i,pending:!0})}Wd(t){if(!this.config.save_campaign_params||this.Vh())return;const i=Kr(t.cookieName);return bi(i)&&t.pattern.test(i)?i:void 0}Vd(t,i,e,s){if(!this.persistence)return;const n=this.Bd,r=this.Hd(n);if(s)return void n.unregister();if(e)return bi(i)&&Lh.test(i)?this.Ud(n,i,r):void n.unregister();const o=bi(t)&&jh.test(t)?t:void 0,l=this.Wd(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return!0;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.Ud(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.Ud(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}Gd(t,i,e){if(!this.persistence)return;const s=this.zd,n=this.Hd(s);if(e)return void s.unregister();if(i)return bi(t)&&Nh.test(t)?this.Ud(s,t,n):void s.unregister();const r=this.Wd(s);return r?this.Ud(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}Jd(t){if(!this.persistence)return;const i=({channel:t,value:i})=>{const e=this.Hd(t);return(null==e?void 0:e.value)===i&&!e.delivered},e=t.filter(i);e.length&&(this.persistence.refreshMetaIdentifiers(),e.filter(i).forEach(({channel:t,value:i})=>t.register(i,!0)))}capture(t,i,e){var s,n,r,o,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.wd))return void Fr.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Fr.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(yi(t)||!bi(t))return void Fr.error("No event name provided to posthog.capture");if(this.Xh(),"$snapshot"===t&&this.Vh())return;const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return this.od||(this.od=!0,console.warn("[PostHog.js] Events are being dropped because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture them, e.g. in end-to-end tests. Note that logs from `captureLog` are not subject to this filter.")),void Fr.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const u=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==u?void 0:u.isRateLimited)return void Fr.critical("This capture call is ignored due to client rate limiting.");let h;(null==i?void 0:i.$current_url)&&!bi(null==i?void 0:i.$current_url)&&(Fr.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==e?void 0:e.Qd)||Fr.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.persistence.syncCookieProperties(),this.Md(),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(h=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const c=new Date,d=(null==e?void 0:e.timestamp)||c,v=Qe(null==e?void 0:e.uuid,io);let f={uuid:v,event:t,properties:this.Zd(t,i||{},d,v,!1,!0)};const p=null===(s=this.featureFlags)||void 0===s||null===(n=s.flagEventCapture)||void 0===n?void 0:n.call(s,i);var g;if(p&&(Lr(p.omit,t=>{delete f.properties[t]}),!1===(null===(g=p.resolved)||void 0===g?void 0:g.call(p,f.properties))))return;"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&a&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);const _="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!_&&(f.$set=null==e?void 0:e.$set);const m=_i(null==i?void 0:i.$set)?i.$set:void 0,y=pi(null==i?void 0:i.$unset)?i.$unset:[],b=(null==e?void 0:e.$unset)||[],w=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return{hasProvided:s||!!m&&t in m,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==m?void 0:m[t],unset:-1!==y.indexOf(t)||-1!==b.indexOf(t)}};this.persistence.refreshMetaIdentifiersBeforeCapture();const x=w(G),S=w(J),k=[{channel:this.Bd,hasProvided:x.hasProvided,update:this.Vd(null==h?void 0:h.fbclid,x.provided,x.hasProvided,x.unset)},{channel:this.zd,hasProvided:S.hasProvided,update:this.Gd(S.provided,S.hasProvided,S.unset)}];for(const{channel:t,hasProvided:i,update:e}of k)e&&!0===f.properties.$process_person_profile&&e.pending&&!i&&!_&&(f.$set=us({[t.property]:e.value},f.$set));const E=null==e?void 0:e.$unset;E&&(f.$unset=E);const T=_?void 0:this.Kd(null==e?void 0:e.$set_once,t!==si,t===ei);if(T&&(f.$set_once=T),(null==e?void 0:e._noTruncate)||(P=this.config.properties_string_max_length,f=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),pi(s))r=[],jr(s,i=>{r.push(t(i))});else{const i={};Lr(Ri(s)?Hr(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(f,t=>bi(t)?t.slice(0,P):t)),f.timestamp=d,yi(null==e?void 0:e.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=c),_&&(f.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return rn.forEach(s),i.forEach(s),e})(f.properties,p?Bh.concat(p.keep):Bh)),t===ya.DISMISSED||t===ya.SENT){const e=null==i?void 0:i[ba.SURVEY_ID],s=null==i?void 0:i[ba.SURVEY_ITERATION];eh({id:e,current_iteration:s}),f.$set=us(us({},f.$set),{},{[Hu({id:e,current_iteration:s},t===ya.SENT?"responded":"dismissed")]:!0})}else t===ya.SHOWN&&(f.$set=us(us({},f.$set),{},{[ba.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var P;if(t===xa.SHOWN){const t=null==i?void 0:i[Sa.TOUR_TYPE];t&&(f.$set=us(us({},f.$set),{},{[`${Sa.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const O=us(us({},f.properties.$set),f.$set);if(mi(O)||this.setPersonPropertiesForFlags(O),!xi(this.config.before_send)){const t=this.Ds(f,null==p?void 0:p.failed);if(!t)return;f=t,f.uuid=Qe(f.uuid,io)}this.sessionRecording&&!this.sessionRecording.isReplayOff&&!this.fd&&Dh(t)&&(this.fd=!0,setTimeout(()=>this.fd=!1,3e4));const C=[];k.forEach(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=f.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:_i(null===(n=f.properties)||void 0===n?void 0:n.$set)?f.properties.$set[t.property]:void 0;(null==i?void 0:i.pending)&&r===i.value&&C.push({channel:t,value:i.value})}),this.Tr.emit("eventCaptured",f);const R=null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(R),I=us(us(us({method:"POST",url:R,data:f,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:A?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},A&&(null===(o=f.properties)||void 0===o?void 0:o.$session_id)?{batchGroup:f.properties.$session_id+(f.properties.$window_id?`-${f.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),C.length?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Jd(C)}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var M;let t;!I.transport&&!I.callback&&mi(null!==(M=this.config.request_headers)&&void 0!==M?M:{})&&this.ld&&(t="sendBeacon"),this.kd(I,t)}else this.wd.enqueue(I);return null===(l=this.featureFlags)||void 0===l||l.sendFlagCallsPendingCapture(),f}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.Yd)||void 0===i?void 0:i.getExtension(t)}Pd(){var t;return null!==(t=this.Yd)&&void 0!==t?t:this.Yd=new Eh(this)}Rr(t){this.vd.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.vd.indexOf(t);-1!==e&&this.vd.splice(e,1)}}Md(t=!0){var i;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Id(t),!0)}Id(t=!0){var i,e,s;this.yd=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.hd.clear(),this.Xd()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,i,e,s,n){return this.Zd(t,i,e,s,n,!1)}Zd(t,e,n,r,a,u=!1){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;this.Xh(),u||(this.persistence.syncCookieProperties(),this.Md());const h=a?void 0:this.persistence.remove_event_timer(t);let c=us({},e);if(c.token=this.config.token,c.$config_defaults="latest"===this.config.defaults?zh:this.config.defaults,this.Vh()&&(c[jt]=!0),"$snapshot"===t){const t=us(us({},this.persistence.properties()),this.sessionPersistence.properties());return c.distinct_id=t.distinct_id,(!bi(c.distinct_id)&&!Si(c.distinct_id)||wi(c.distinct_id))&&Fr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}const v=function(t,e,n,r=!1){var o,a,u,h;if(!d)return{};const c=t?[...zl,...e||[]]:[],[v,f]=Ue(d),[p,g]=function(t){for(let i=0;We.length>i;i++){const[e,s,n]=We[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(d),_=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};yi(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,w=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,x=null==s||null===(u=s.screen)||void 0===u?void 0:u.width,S=null==s||null===(h=s.screen)||void 0===h?void 0:h.height,k=null==s?void 0:s.devicePixelRatio;yi(b)||(y.userAgentDataPlatform=b),yi(w)||(y.maxTouchPoints=w),yi(x)||(y.screenWidth=x),yi(S)||(y.screenHeight=S),yi(k)||(y.devicePixelRatio=k);const E=Nr(zr({$os:v,$os_version:f,$browser:je(d,navigator.vendor,_,m),$webview_app:p,$webview_app_version:g,$device:ze(d),$device_type:He(d,y),$timezone:Cl(),$timezone_offset:ia()}),{$current_url:jl(r?is(null==l?void 0:l.href):null==l?void 0:l.href,c,ql),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Ne(d,navigator.vendor,_,m),$browser_language:Jl(),$browser_language_prefix:Yl(),$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:i.LIB_NAME,$lib_version:i.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return i.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=i.SDK_DIST_CHANNEL),E}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0);c.$session_id=t,c.$window_id=i}let f,p;this.sessionPropsManager&&Nr(c,this.sessionPropsManager.getSessionProps());try{var g;if(this.sessionRecording){const i=this.sessionRecording.sdkDebugProperties,e=!this.fd&&Dh(t);for(const t in i)(e||ai(Mh,t))&&(c[t]=i[t])}f=null===(g=this.Sd)||void 0===g?void 0:g.length}catch(t){c.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Yu&&(c.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),c=Nr(c,p),"$pageview"===t&&o&&(c.title=o.title),!yi(h)){const t=n.getTime()-h;c.$duration=parseFloat((t/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");const _=this.persistence.properties(),m=this.sessionPersistence.properties(),y=c.$groups,b=_.$groups;_i(y)&&!mi(y)&&(c.$groups=us(us({},_i(b)?b:{}),y)),Lr(["$referrer","$referring_domain"],t=>{t in _&&delete m[t]});const w={};if(this.vd.length>0)for(const t of this.vd.slice())try{Nr(w,t())}catch(t){Fr.error("Failed to produce browser extension event properties",t)}c=Nr({},v,_,m,us(us({},w),c)),f?c.$sdk_debug_retry_queue_size=f:delete c.$sdk_debug_retry_queue_size,c.$is_identified=this._isIdentified(),pi(this.config.property_denylist)?Lr(this.config.property_denylist,function(t){delete c[t]}):Fr.error(Ih+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const x=this.config.sanitize_properties;x&&(Fr.error(Ah),c=x(c,t));const S=this.tv();return c.$process_person_profile=S,S&&!a&&this.ev("_calculate_event_properties"),c}Kd(t,i=!0,e=!1){var s;if(!this.persistence||!this.tv())return t;if(this.ud&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Nr({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Fr.error(Ah),o=l(o,"$set_once")),i&&(this.ud=!0),mi(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i)}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e)}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Md(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.hd.add(t)),this.Xd()}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t)}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.hd.delete(t),this.Xd()}iv(t,i){this.register({[t]:i})}xd(){this.hd.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.hd.clear(),this.Xd()}Xd(){var t;if(!this.dd)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.Ai)||!xo.Ot())return void xo.Dt(this.dd);const i=[];this.hd.forEach(t=>i.push(t)),i.length>0?xo.$t(this.dd,i):xo.Dt(this.dd)}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i=!1,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Tr.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:Rh}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Rh})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Rh})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Rh}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=nh){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Rh}}canRenderSurveyAsync(t,i=!1){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Rh})}nv(t){return!t||wi(t)?(Fr.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Fr.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())||(Fr.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 Fr.uninitializedWarning("posthog.identify");if(Si(t)&&(t=t.toString(),Fr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.nv(t))return;if(!this.ev("posthog.identify"))return;this.Xh();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Md(!1),o=this.persistence.oc();let l=!1;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister(W),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Yt,u=t!==s,h=!u&&o;if(u&&o){var a;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(Ot,Zt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.yd=Ju(t,i,e)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(Ot,Zt);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$set",{$set:s,$set_once:n})&&(this.yd=Ju(t,i,e))}else(i||e)&&this.setPersonProperties(i,e);u||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(P)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.cc(l)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.ev("posthog.setPersonProperties"))return;const e=Ju(this.get_distinct_id(),t,i);this.yd!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.yd=e)):Fr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(pi(t)?t:[t]).filter(t=>bi(t)&&t.length>0);0!==e.length&&this.ev("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.yd=null)}group(t,i,e){var s;if(!t||!i)return void Fr.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Md();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:us(us({},n),{},{[t]:i})}),(r||e)&&this.tv()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(si,s)}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var e;this.ev("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t)}reset(t){const i=Ei(t)?t:null==t?void 0:t.resetDeviceID,e=Ei(t)||null==t?void 0:t.bootstrap;this.sv(i,!1,e)}sv(t,i=!1,e){var s,n,r,o,l,a;if(Fr.info("reset"),!this.__loaded)return Fr.uninitializedWarning("posthog.reset");const u=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Qh)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Fc());const h=this.get_property(H),c=this.get_property(q),d=this.get_property(lt);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.oc)||void 0===a?void 0:a.call(l),p=this.ed;this.ed=p||i;let g=!1;try{var _,m,y,b,w,x,S,k,E,T,P,O,C;if(null===(_=this.persistence)||void 0===_||_.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.hd.clear(),this.Xd(),yi(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(x=this.logs)||void 0===x||x.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(k=this.persistence)||void 0===k||k.set_property("$user_state","anonymous"),null===(E=this.sessionManager)||void 0===E||E.resetSessionId(),this.yd=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Dt,$device_id:null},"");else{const i=this.config.get_device_id(io());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||yi(c)||this.register({[q]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.Vh()&&(null===(C=this.persistence)||void 0===C||C.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!xi(u)&&!(null===(O=this.sessionManager)||void 0===O?void 0:O.setBootstrapSessionId(u,!0))){const t=us({},e);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var R,A;this.ed=p,f&&(null===(R=this.persistence)||void 0===R||null===(A=R.cc)||void 0===A||A.call(R,g))}var I;this.Ir&&(null===(I=this.conversations)||void 0===I||I.onRemoteConfig(this.Ir)),this.reloadFeatureFlags()}shutdown(t){var i=this;return Li(function*(){if(!i.__loaded)return void Fr.uninitializedWarning("posthog.shutdown");i.ad=!0,clearTimeout(i.Cd),i.Cd=void 0;const t=i.Od;i.Od=void 0;for(const e of[()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.wd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.Sd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&gi(t.then)&&t.then(void 0,t=>{Fr.error("Error during shutdown",t)})}catch(t){Fr.error("Error during shutdown",t)}})()}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)||void 0===e||e.rv()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.ov()}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?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Fr.critical("Attempting to create alias for existing People user - aborting."),-2):this.ev("posthog.alias")?(yi(i)&&(i=this.get_distinct_id()),t!==i?(this.iv(W,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Fr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=us({},this.config);if(_i(t)){var s,n,r,o,l,a,u,h,c,d,v,f,p,g;Nr(this.config,Vh(t));const w=this.rd();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var _,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(_=this.sessionPersistence)||void 0===_||_.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,i,w),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new pa(us(us({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(us(us({},this.config),{},{persistence:"sessionStorage"}),us(us({},i),{},{persistence:"sessionStorage"}),w)}}const x=this.bd(this.config.debug);var b;Ei(x)&&(this.config.debug=x),Ei(this.config.debug)&&(this.config.debug?(e.DEBUG=!0,ao.Ot()&&ao.$t("ph_debug",!0),Fr.info("set_config",{config:t,oldConfig:i,newConfig:us({},this.config)})):(e.DEBUG=!1,ao.Ot()&&ao.Dt("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this.Fc()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.webMCP)||void 0===a||a.startIfEnabled(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.tracingHeaders)||void 0===h||h.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(v=this.exceptionObserver)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.deadClicksAutocapture)||void 0===f||f.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this.nd(),null===(g=this.externalIntegrations)||void 0===g||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&wl(this,Oh,!1)}}_overrideSDKInfo(t,i){e.LIB_NAME=t,e.LIB_VERSION=i}startSessionRecording(t){const i=!0===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.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)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(us(us({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i)}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t)}get logger(){var i,e;return null!==(i=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==i?i:t.lv}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?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:Uh;return i!==Uh&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}tv(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&mi(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}qd(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.tv()||this.ev("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ev("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ev(t){return"never"===this.config.person_profiles?(Fr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Zh(),this.iv(Ft,!0),!0)}rd(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}nd(){var t,i;const e=this.rd();var s,n,r,o;return this.is_capturing()||(null===(s=this.logs)||void 0===s||s.av(),null===(n=this.heatmaps)||void 0===n||n.discardPending()),(null===(t=this.persistence)||void 0===t?void 0:t.Ai)!==e&&(null===(r=this.persistence)||void 0===r||r.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.Ai)!==e&&(null===(o=this.sessionPersistence)||void 0===o||o.set_disabled(e)),this.Xd(),e}opt_in_capturing(i){var e,s,n;if("always"===this.config.cookieless_mode)return void Fr.warn(Ch);if(this.Vh()){var r,o,l,a,u,h;null===(r=this.sessionRecording)||void 0===r||r.dispose({discardBufferedEvents:!0}),this.sv(!0,!0),null===(o=this.sessionManager)||void 0===o||o.destroy(),null===(l=this.pageViewManager)||void 0===l||l.destroy(),this.sessionManager=new Nu(this),this.pageViewManager=new kl(this),this.persistence&&(this.sessionPropsManager=new Fu(this,this.sessionManager,this.persistence));const i=null!==(a=null===(u=this.config.__extensionClasses)||void 0===u?void 0:u.sessionRecording)&&void 0!==a?a:null===(h=t.__defaultExtensionClasses)||void 0===h?void 0:h.sessionRecording;var c,d;i&&(this.sessionRecording=this.Wh(this.sessionRecording,new i(this)),this.Ir&&(null===(c=this.sessionRecording)||void 0===c||null===(d=c.onRemoteConfig)||void 0===d||d.call(c,this.Ir)))}const v=1===this.consent.consent;var f,p,g,_;v?this.Xh():null===(f=this.heatmaps)||void 0===f||f.discardPending(),this.consent.optInOut(!0),this.nd(),this.Dd(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),null===(g=this.conversations)||void 0===g||g.loadIfEnabled()),v||!yi(null==i?void 0:i.captureEventName)&&!(null==i?void 0:i.captureEventName)||this.capture(null!==(_=null==i?void 0:i.captureEventName)&&void 0!==_?_:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Md(),null===(n=this.featureFlags)||void 0===n||n.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this.Nd()}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.nd(),"on_reject"===this.config.cookieless_mode&&this.sd()):Fr.warn(Ch)}sd(){var t,i,e;const s=this.sessionRecording;null==s||s.dispose({discardBufferedEvents:!0}),null===(t=this.heatmaps)||void 0===t||t.discardPending(),"$posthog_cookieless"!==this.get_distinct_id()&&this.sv(!0,!0),this.register({distinct_id:Dt,$device_id:null}),this.Hh(s),this.sessionRecording=void 0,null===(i=this.sessionManager)||void 0===i||i.destroy(),null===(e=this.pageViewManager)||void 0===e||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Nd(),this.Dd()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.ed&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.nd()}_is_bot(){return r?Uu(r,this.config.custom_blocked_useragents):void 0}Nd(){o&&("visible"===o.visibilityState?this.pd||(this.pd=!0,this.capture(ti,{title:o.title},{send_instantly:!0}),this.gd&&(o.removeEventListener(I,this.gd),this.gd=null)):this.gd||(this.gd=this.Nd.bind(this),Vr(o,I,this.gd)))}debug(t){!1===t?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}Fc(){const t=this.Qh||{};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?(Fr.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,s,n){const r=i in t&&!xi(t[i]),o=e in t&&!xi(t[e]);return r?t[i]:!!o&&(n&&n.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,Fr)}Ds(t,i){var e;if(xi(this.config.before_send))return t;const s=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Pi),n=pi(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=t;for(const e of n)try{if(r=e(r),xi(r)){const i=`Event '${t.event}' was rejected in beforeSend function`;return Ti(t.event)?Fr.warn(`${i}. This can cause unexpected behavior.`):Fr.info(i),null}r.properties&&!mi(r.properties)||Fr.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Fr.error(`Error in beforeSend function for event '${t.event}':`,e),null==i||i(),null}for(const i of s)if(r.properties&&xi(r.properties[i]))return Fr.warn(`Event '${t.event}' had its '${i}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var t;return null===(t=this.pageViewManager.cu)||void 0===t?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)})}bd(t){const i=Ei(t)&&!t,e=ao.Ot()&&"true"===ao.Lt("ph_debug");return!i&&(!!e||t)}};Kh.__defaultExtensionClasses={},Kh.lv=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=Ur(t.prototype[i[e]])}(Kh,["identify"]);const Jh=["[data-ph-capture-value]"];var Yh=class{constructor(t){this._instance=t}refresh(t){var i;const e=this._instance.config,s=_i(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Fc(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Jh}};const Zh=Dr("[ExceptionAutocapture]"),Xh=()=>{},Qh=t=>{var i;if(gi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function tc(t,i,e){try{if(!(i in t))return Xh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return gi(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Qh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Qh(e)}}}catch(t){return Xh}}const ic=Dr("[TracingHeaders]"),ec=Dr("[Web Vitals]"),sc=9e5,nc=["CLS","FCP","INP","LCP"],rc=["INP","LCP"],oc=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],lc="disabled",ac="lazy_loading";function uc(t){return"ph_replay_pending_buffer_"+JSON.stringify([t.persistence_name||t.token,t.token])}const hc=Dr("[SessionRecording]"),cc=[Bt,Ut,zt,Ht,qt,Wt,Vt,Gt,Kt],dc=Dr("[Heatmaps]");function vc(t){return _i(t)&&"clientX"in t&&"clientY"in t&&Si(t.clientX)&&Si(t.clientY)}const fc=Dr("[Product Tours]"),pc=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(nt))},gc=["$set_once","$set"],_c=Dr("[SiteApps]"),mc="Error while initializing PostHog app with config id ";function yc(t,i,e){if(xi(t))return!1;switch(e){case"exact":return t===i;case"contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var bc=class{constructor(t){this.Gi=t,this.Ko=new Set,this.Yo=new Set,this.Xo=new Du,this.tl=(t,i)=>this.el(t,i)&&this.il(t,i)&&this.nl(t,i)&&this.sl(t,i),this.el=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;yi(null===(t=this.Gi)||void 0===t?void 0:t.subscribeCapture)||(this.rl=null===(i=this.Gi)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i,e;null===(t=this.rl)||void 0===t||t.call(this),this.rl=void 0,null===(i=this.Gi)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.Xo=new Du}register(t){var i,e;if(!yi(null===(i=this.Gi)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this.Ko.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.Yo.add((null==t?void 0:t.event)||"")})}),null===(e=this.Gi)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this.Ko.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector)})}),this.Gi.setElementSelectors(t,this)}}replace(t){this.Ko.clear(),this.Yo.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Yo.has(t)||this.Yo.has(i.event))&&this.Ko.forEach(t=>{this.ll(i,t)&&this.Xo.emit("actionCaptured",t.name)})}al(t){this.onAction("actionCaptured",i=>t(i))}ll(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.tl(t,e))return!0;return!1}onAction(t,i){return this.Xo.on(t,i)}il(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.Gi)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!yc(r,i.url,i.url_matching||"contains"))return!1}return!0}nl(t,i){return!!this.ul(t,i)&&!!this.cl(t,i)&&!!this.hl(t,i)}ul(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.dl(t);if(s.length>0)return s.some(t=>yc(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&yc(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}cl(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.dl(t);if(s.length>0)return s.some(t=>yc(t.text,i.text,i.text_matching||"exact")||yc(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!xi(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>yc(t,o,l)));var r,o,l}hl(t,i){var e,s;if(!(null==i?void 0:i.selector))return!0;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return!0;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return!1}dl(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}sl(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||Ku(i.properties.reduce((t,i)=>{const e=pi(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)}},wc=class{constructor(t,i){this.vl=i,this.fl=[],this.Gi=t,this.pl=new Map,this.gl=new Map,this.ml=new Map}yl(){var t,i;this.bl=null===(t=(i=this.Gi).subscribeSession)||void 0===t?void 0:t.call(i,t=>this._l(t))}wl(t){return!1}kl(){return null}Sl(t){}xl(){}$l(t,i){return!!t&&Ku(t.propertyFilters,null==i?void 0:i.properties)}Cl(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s)}})}),e}Tl(t,i,e){const s=(e===_a.Activation?this.pl:this.gl).get(t);let n=[];return this.Ml(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.$l(r,i)})}register(t){this.Il(t,!1)}replace(t){this.Il(t,!0)}Il(t,i){yi(this.Gi.subscribeCapture)||(this.El(t,i),this.Al(t,i))}Al(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.ml.clear(),0===e.length)return void(i&&(null===(s=this.Rl)||void 0===s||s.replace([])));this.Rl||(this.Rl=new bc(this.Gi),this.Rl.init(),this.Rl.al(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.ml.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.ml.set(i.name,s)}})}),i?this.Rl.replace(n):this.Rl.register(n)}Pl(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t)}),t.set(e,n)})}El(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Cl(t,_a.Activation),a=this.Cl(t,_a.Cancellation);i?(this.pl=l,this.gl=a):(this.Pl(this.pl,l),this.Pl(this.gl,a)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.rl)&&void 0!==e||(this.rl=null===(s=(n=this.Gi).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.Ol(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.Fl(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Ll([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.Dl(r),void this.Nl([r])}if(this.gl.has(t)){const e=this.Tl(t,i,_a.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.Ll(e.map(t=>t.id)),e.forEach(t=>this.jl(t.id)))}if(!this.pl.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.pl.get(t)});const o=this.Tl(t,i,_a.Activation);this.ql(o.map(t=>t.id))}onAction(t){this.ml.has(t)&&this.ql(this.ml.get(t)||[])}ql(t){if(0===t.length)return;const i=!!this.Gi.getSessionId(),e=[];for(const s of t)i&&this.wl(s)?this.Dl(s)&&this.Bl(s):e.push(s);e.length>0&&(this.fl=[...new Set([...this.fl,...e])]),this.Ol().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.zl()}Dl(t){this.fl=this.fl.filter(i=>i!==t);const i=this.Hl();return!i.includes(t)&&(this.Ul([...i,t]),this.Wl(),!0)}Ll(t){const i=new Set(t);this.fl=this.fl.filter(t=>!i.has(t));const e=this.Vl(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.Ul(s),0===s.length&&this.Gl()),this.Nl(t),this.zl()}zl(){try{var t;null===(t=this.vl)||void 0===t||t.call(this)}catch(t){this.Ol().error("Error while handling activated items change",t)}}Jl(){const t=this.kl();if(!t)return{};const i=this.Gi.getProperty(t);return i&&"object"==typeof i?i:{}}Bl(t){if(!this.kl())return;const i=this.Jl();this.Sl(us(us({},i),{},{[t]:Date.now()}))}Nl(t){if(!this.kl())return;const i=this.Jl(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(mi(e)?this.xl():this.Sl(e))}Ql(){this.kl()&&this.xl()}getActivationTimestamp(t){if(!this.Hl().includes(t))return;const i=this.Jl()[t];return Si(i)?i:void 0}Vl(){const t=this.Zl();return this.Gi.getProperty(t)||[]}Hl(){const t=this.Vl();if(0===t.length)return[];const i=this.Gi.getProperty(this.Kl()),e=this.Gi.getSessionId();return e&&i===e?t:[]}Wl(){const t=this.Gi.getSessionId();t&&this.Yl(t)}Gl(){this.Xl()}_l(t){const i=this.Gi.getProperty(this.Kl());if(i&&i!==t){const t=this.Vl(),i=this.Jl();t.length>0&&(this.Ul([]),t.filter(t=>Si(i[t])).forEach(t=>this.jl(t))),this.Gl(),this.Ql(),t.length>0&&this.zl()}}getActivatedIds(){return[...new Set([...this.Hl(),...this.fl])].filter(t=>!this.ta(t))}dispose(){var t,i,e;null===(t=this.bl)||void 0===t||t.call(this),this.bl=void 0,null===(i=this.rl)||void 0===i||i.call(this),this.rl=void 0,null===(e=this.Rl)||void 0===e||e.dispose(),this.Rl=void 0}reset(){this.fl=[],this.Vl().length>0&&this.Ul([]),this.Gl(),this.Ql(),this.zl()}getEventToItemsMap(){return this.pl}ea(){return this.Rl}},$c=class extends wc{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.ia=t,this.na=i,this.yl()}Zl(){return L}Kl(){return N}kl(){return B}Sl(t){this.ia.kv.set({[B]:t})}xl(){this.ia.kv.remove(B)}wl(t){var i;let e;this.Ml(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return Si(s)&&s>0}sa(){return ya.SHOWN}Ml(t){this.na.getSurveys(t)}jl(t){this.na.cancelPendingSurvey(t)}Ol(){return ih}Ul(t){this.ia.kv.set({[L]:t})}Yl(t){this.ia.kv.set({[N]:t})}Xl(){this.ia.kv.remove(N)}ta(){return!1}Fl(t,i,e){var s;if(t===ya.SENT&&!1===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return"ignore";let n;return this.Ml(t=>{n=t.find(t=>t.id===i)}),!n||function(t){var i;return qu(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===ya.SHOWN?"consume":"ignore":t===ya.SHOWN?"persist":t===ya.DISMISSED||t===ya.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const xc=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),Sc="SDK is not enabled or survey functionality is not yet loaded",kc="Disabled. Not loading surveys.";var Ec=class{constructor(t){this.ra=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.oa=!1,this.la=!1,this.aa=[],this.ua=[],this.ca=null,this.ha=null,this.qi=!1,this.da=new Set,this.onRemoteConfig=t=>{if(this.qi)return;if(this.Yr.disableSurveys)return;if(!t.ok)return this.la=!0,this.va({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),ih.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(xi(i))return ih.warn("Flags not loaded yet. Not loading surveys.");this.fa=Ei(i)?i:i.length>0,ih.info(`flags response received, isSurveysEnabled: ${this.fa}`),this.loadIfEnabled()},this.va=t=>{this.ua.slice().forEach(i=>this.pa(i,t))}}setup(t){if(!this.qi)return this.ga=t,xc(t.kv.initialize(),()=>{if(this.ga!==t||this.qi)return;this.ga=void 0,this.ia=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.qi?i.dispose():(this.ma=i,this.loadIfEnabled())})}dispose(){var t,i,e,s,n;this.qi||(this.qi=!0,this.ga=void 0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.aa=[],this.ua.forEach(t=>{t.active=!1}),this.ua=[],null===(n=this.ya)||void 0===n||n.call(this),this.ya=void 0,this.ca=null,this.da.forEach(t=>clearTimeout(t)),this.da.clear())}get Yr(){return this.ra.get()}getRenderContext(){if(!this.ia)return;const t=this;return{client:this.ia,get config(){return t.Yr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.va()}loadIfEnabled(){if(this.qi||!this.ia)return;const t=this.Yr;if(this._surveyManager)return;if(this.oa)return void ih.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void ih.info(kc);if(t.cookielessMode&&this.ia.isOptedOut)return void ih.info("Not loading surveys in cookieless mode without consent.");const i=this.ra.getExtensions();if(!i)return void this.ba("PostHog Extensions not found.");if(yi(this.fa)&&!t.advancedEnableSurveys)return;const e=this.fa||t.advancedEnableSurveys;this.oa=!0,this.la=!1;try{const t=i.generateSurveys;if(t)return this._a(t,e),void(this.oa=!1);const s=i.loadExternalDependency;if(!s)return this.ba(j),void(this.oa=!1);s(t=>{try{if(this.qi)return;const i=this.ra.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.ba("Could not load surveys script",t):this._a(i.generateSurveys,e)}finally{this.oa=!1}})}catch(t){throw this.oa=!1,this.ba("Error initializing surveys",t),t}}_a(t,i){var e;if(this.qi)return;this._surveyManager=t(i),this._surveyEventReceiver=this.wa(this.ia,this.va);const s=null===(e=this.ia)||void 0===e?void 0:e.kv.get(F);s&&this.ka(s),ih.info("Surveys loaded successfully"),this.Sa(),this.va(),this.xa({isLoaded:!0})}wa(t,i){return new $c(t,this,void 0,i)}ba(t,i){this.la=!0,ih.error(t,i),this.va({isLoaded:!1,error:t}),this.xa({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.aa.push(t),this._surveyManager&&this.xa({isLoaded:!0}),()=>{this.aa=this.aa.filter(i=>i!==t)}}getSurveys(t,i=!1){if(this.qi)return;const e=this.ia;if(!e)return t([],{isLoaded:!1,error:Sc});if(this.Yr.disableSurveys)return ih.info(kc),t([]);const s=e.kv.get(F);if(s&&!i)return t(s,{isLoaded:!0}),void(this.$a()&&this.getSurveys(()=>{},!0));if(this.ca)return void this.ca.then(({surveys:i,context:e})=>{this.qi||t(i,e)}).catch(t=>ih.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{try{return this.Ca(e,t)}catch(t){return ih.error("Error processing surveys response",t),this.Ca(e,{statusCode:0,error:t})}},t=>this.Ca(e,{statusCode:0,error:t}));this.ca=n;const r=()=>{this.ca===n&&(this.ca=null)};n.then(i=>{r(),this.qi||(this.va(i.context),t(i.surveys,i.context))},r).catch(t=>ih.error("Error in survey callback",t))}Ca(t,i){if(this.qi)return{surveys:[],context:{isLoaded:!1,error:Sc}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?ih.error(t):i.error||ih.warn(t),this.ha=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.ha=null;const s=i.json.surveys||[];return t.kv.set({[F]:s,[D]:Date.now()}),this.ka(s),{surveys:s,context:{isLoaded:!0}}}ka(t){const i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(qu(t)||function(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.Ta(i)}Ta(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t)}$a(){return this.Ma()&&!this.ca&&!this.Ia()}Ma(){var t;const i=null===(t=this.ia)||void 0===t?void 0:t.kv.get(D);return Si(i)&&Date.now()-i>3e5}Ia(){return Si(this.ha)&&3e5>Date.now()-this.ha}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};eh(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.va()}xa(t){for(const i of this.aa){if(this.qi)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){ih.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i=!1){if(!xi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ih.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.qi)return()=>{};const e={callback:t,active:!0,revision:0};this.ua.push(e),this.Sa();const s=null===(i=this.ia)||void 0===i?void 0:i.kv.get(F);return this.Yr.disableSurveys||!this._surveyManager&&this.la&&!this.oa||!s&&!xi(this.ha)&&!this.ca?this.pa(e,{isLoaded:!1}):this._surveyManager&&this.pa(e),()=>{var t;e.active=!1,this.ua=this.ua.filter(t=>t!==e),0===this.ua.length&&(null===(t=this.ya)||void 0===t||t.call(this),this.ya=void 0)}}Sa(){var t,i,e;this._surveyManager&&this.ua.length>0&&(null!==(t=this.ya)&&void 0!==t||(this.ya=null===(i=(e=this.ra).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.va)))}pa(t,i){if(this.qi||!t.active)return;const e=++t.revision,s=s=>{if(!this.qi&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e)}catch(t){ih.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(t){ih.error("Error in active matching surveys callback",t)}}Ea(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null}),i}Aa(t){if(xi(this._surveyManager))return{eligible:!1,reason:Sc};const i="string"==typeof t?this.Ea(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Ra(t){var i;if(!(null===(i=this.ia)||void 0===i?void 0:i.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(xi(this._surveyManager))return{eligible:!1,reason:Sc};const e="string"==typeof t?this.Ea(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(xi(this._surveyManager))return ih.warn("init was not called"),{visible:!1,disabledReason:Sc};const i=this.Ra(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return xi(this._surveyManager)?(ih.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Sc})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.Ra(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.ia)||void 0===s?void 0:s.canCapture))return;if(xi(this._surveyManager))return void ih.warn("init was not called");const o="string"==typeof t?this.Ea(t):t;if(!(null==o?void 0:o.id))return void ih.warn("Survey not found");if(!sh.includes(o.type))return void ih.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){ih.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.da.delete(t),!this.qi&&(null===(i=this.ia)||void 0===i?void 0:i.canCapture)&&(ih.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),ih.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.da.add(t)}this._surveyManager.renderSurvey(o,l,e)}else ih.warn("Survey element not found")}displaySurvey(t,i){var e,s;if(!(null===(e=this.ia)||void 0===e?void 0:e.canCapture))return;if(xi(this._surveyManager))return void ih.warn("init was not called");const n=this.Ea(t);if(!n)return void ih.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=us(us({},n),{},{appearance:us(us({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==wa.Popover&&i.initialResponses&&ih.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.Aa(n);if(!t.eligible)return void ih.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==wa.Inline?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties)}cancelPendingSurvey(t){xi(this._surveyManager)?ih.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t)}},Tc=class{constructor(t){this._instance=t}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==f?void 0:f.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e}=t,s=g(i);return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(t){var i,e;const n=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(i=>{"$pageview"!==i&&i!==ya.SHOWN&&i!==ya.DISMISSED&&i!==ya.SENT||t()}),r=()=>t();Vr(s,"PHSurveyShown",r);let o=!1;const l=null===(e=this._instance)||void 0===e?void 0:e.onFeatureFlags(()=>{o&&t()});return o=!0,()=>{o=!1,null==n||n(),null==l||l(),null==s||s.removeEventListener("PHSurveyShown",r)}}};const Pc=(()=>(null==s?void 0:s.location)?Ll(s.location.hash,"__posthog")||Ll(location.hash,"state"):null)(),Oc="_postHogToolbarParams",Cc=Dr("[Toolbar]"),Rc=Dr("[FeatureFlags]"),Ac=Dr("[FeatureFlags]",{debugEnabled:!0}),Ic="\" failed. Feature flags didn't load in time.",Mc=[502,504],Fc=["click","keydown","wheel","touchstart","pointerdown"],Dc="connection_error",jc=(t,i)=>{const e=Object.keys(i||{}).filter(t=>{var e;return null==i||null===(e=i[t])||void 0===e?void 0:e.failed});if(!e.length)return t||{};const s=us({},t);return e.forEach(t=>delete s[t]),s},Lc=(t,i)=>{const e=us({},t);return i.forEach(t=>{var i;(null===(i=e[t])||void 0===i?void 0:i.failed)&&delete e[t]}),e},Nc=(t,i)=>!!(null==i?void 0:i.partialResponse)||!!t.errorsWhileComputingFlags,Bc=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},Uc=t=>{const i={};for(const[e,s]of Br(t||{}))s&&(i[e]=s);return i},zc={version:2},Hc=(t,i)=>t.distinctId===i.distinctId&&t.sessionId===i.sessionId&&((t,i)=>{const e=Object.keys(t);return e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e])})(t.groups,i.groups);var qc=class{constructor(t){this.name="featureFlags",this.uv=!1,this.featureFlagEventHandlers=[],this.R=Rc,this.hv={},this.dv={},this.vv=[],this.fv=new Set,this.pv=new Set,this.gv=!1,this.mv=!1,this.yv=0,this.bv=!1,this._v=!1,this.wv=!1,this.Sv=new Map,this.xv=!1,this.$v=!1,this.Cv=!1,this.Tv=0,this.Mv=!1,this.Iv=!1,this.Ev=new WeakMap,this.Av=new Map,this.mn=()=>{const t=this.Rv();this.Tv=0,t&&this.reloadFeatureFlags()},this.Pv=()=>{var t,i;const e=this.Ov,s=null!==(t=this.Fv)&&void 0!==t?t:e;yi(e)||yi(s)||this.Yr.remoteRequestsDisabled||!this.Lv||"hidden"===this.Lv.visibilityState||Date.now()-(null!==(i=this.Dv)&&void 0!==i?i:0)<s||(this.Fv=this.Mv||!this.Yr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.Mv=!1,this.reloadFeatureFlags(),this.Nv())},this.jv=()=>{this.Mv&&this.Fv===this.Ov||this.qv()},this.gn=()=>{var t;"visible"===(null===(t=this.Lv)||void 0===t?void 0:t.visibilityState)&&this.qv()},this.ra=t}get Bv(){return zc}get zv(){}Hv(){this.ia&&this.Uv()}setup(t){try{this.Wv=typeof window>"u"?void 0:window,this.Lv=typeof document>"u"?void 0:document}catch(t){this.Wv=void 0,this.Lv=void 0}return this.ga=t,this.R=t.logger.createLogger("[FeatureFlags]"),xc(t.kv.initialize(),()=>{this.ga===t&&(this.ga=void 0,this.ia=t,this.Vv(t))})}Vv(t){var i;if(this.ia===t)return this.Wv&&Vr(this.Wv,"online",this.mn),this.Uv(),this.Gv=t.registerDynamicEventProperties(()=>this.Jv()?this.hv:this.dv),this.Qv=null===(i=this.zv)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Zv(),this.Kv(),this.Yv()}),this.Kv(),this.initialize()}qv(){this.Mv=!0,this.Fv=this.Ov,this.Pv()}Uv(){var t;const i=this.Yr.refreshIntervalMs,e=!this.Yr.remoteRequestsDisabled&&this.Lv&&!yi(i)&&i>0?i:void 0;this.Yr.idleRefreshBackoff||(this.Fv=e),e!==this.Ov&&(this.Xv(),yi(e)||(this.Ov=e,this.Fv=e,this.Nv(),(null===(t=this.Lv)||void 0===t?void 0:t.addEventListener)&&(Vr(this.Lv,I,this.gn),jr(Fc,t=>{Vr(this.Lv,t,this.jv,{capture:!0})}))))}Nv(){yi(this.Ov)||(yi(this.tf)||clearInterval(this.tf),this.Dv=Date.now(),this.tf=setInterval(this.Pv,this.Ov))}Xv(){var t,i;yi(this.tf)||(clearInterval(this.tf),this.tf=void 0,null===(t=this.Lv)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.gn),jr(Fc,t=>{var i,e;null===(i=this.Lv)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.jv,{capture:!0})})),this.Ov=void 0,this.Fv=void 0,this.Mv=!1,this.Dv=void 0}destroy(){this.ef()}dispose(){this.ef()}ef(){var t,i,e;this.Xv(),this.yv++,this._v=!1,this.ga=void 0,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this.ia&&(this.nf(),null===(t=this.Gv)||void 0===t||t.dispose(),this.Gv=void 0,null===(i=this.Qv)||void 0===i||i.call(this),this.Qv=void 0,this.vv=[],null===(e=this.Wv)||void 0===e||e.removeEventListener("online",this.mn),this.ia=void 0)}get Yr(){return this.ra.get()}sf(t){var i;return this.rf&&t in this.rf?this.rf[t]:null===(i=this.ia)||void 0===i?void 0:i.kv.get(t)}Zv(){return!!this.rf&&(this.rf=void 0,!0)}lf(){var t;return!yi(null===(t=this.ia)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Zv()}$t(t){this.af(()=>{var i;return null===(i=this.ia)||void 0===i?void 0:i.kv.set(t)})}uf(t,i,e){if(!this.zv||!t.$enabled_feature_flags)return;const s=this.sf("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},r=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,a=l||e&&i.flags?o:e&&!pi(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.sf("$feature_flag_payloads")||{},h=t.$feature_flag_payloads||{},c=l||e?a:Array.from(new Set([...Object.keys(u),...Object.keys(h)])),d=!l&&!e,v=!!d||a,f=!!d||c,p={[m]:v,[k]:v,[C]:f};t.$feature_flag_details&&(p[y]=v);for(const i of[x,w,S])yi(t[i])||(p[i]=!0);this.zv.markCrossTabFeatureFlagChanges(p)}Dt(t){this.af(()=>{var i;return null===(i=this.ia)||void 0===i?void 0:i.kv.remove(t)})}af(t){try{t()}catch(t){this.R.error("Failed to update feature flag persistence",t)}}Kv(){const t={},i=this.sf(y);for(const i of[x,R]){const e=this.sf(i);yi(e)||(t[i]=e)}const e=this.sf(m);e&&(t[m]=e.filter(t=>{var e;return!(null==i||null===(e=i[t])||void 0===e?void 0:e.failed)}));const s=this.sf(C);s&&(t[C]=jc(s,i)),this.hv=t;const n=us({},t),r=jc(this.sf(k),i);if(r)for(const[t,i]of Object.entries(r))n[`$feature/${t}`]=i;this.dv=n}Jv(){const t=this.Yr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.sf(w);return"number"!=typeof i||Date.now()-i>t}cf(){return!!this.Jv()&&(this.Cv||this.mv||(this.Cv=!0,this.R.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hf(){const t=this.Yr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}df(){const t=this.Yr.flagKeys;if(!yi(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Yr,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!yi(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,s)=>(i[s]=e.encodeBootstrapPayloads?JSON.stringify(t[s]):t[s],i),{});return this.vf({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){const s=(null==e?void 0:e.merge)?jc(this.sf(k),this.sf(y)):{},n=(null==e?void 0:e.merge)?jc(this.sf(C),this.sf(y)):{},r=us(us({},s),t),o=us(us({},n),i),l={};for(const[t,i]of Object.entries(r))l[t]={key:t,enabled:sn(i),variant:nn(i),reason:void 0,metadata:yi(null==o?void 0:o[t])?void 0:{id:0,version:void 0,description:void 0,payload:o[t]}};this.vf({flags:l})}get hasLoadedFlags(){return this.gv}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.ff(),i=this.Bv.publicDetail;return i?Object.fromEntries(Object.entries(t).map(([t,e])=>[t,i(e)])):t}ff(){const t=this.sf(y),i=this.sf(R),e=this.sf(A);if(!e&&!i)return t||{};const s=Nr({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r,o;const n=s[t],l=null==i?void 0:i[t],a=yi(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,u=yi(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],c=us(us({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});a!==(null==n?void 0:n.enabled)&&(c.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(c.original_variant=null==n?void 0:n.variant),h&&(c.metadata=us(us({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[t]=c}return this.uv||(this.R.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.uv=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:sn(s),variant:nn(s),payload:en(i[e])}})}getFlagVariants(){const t=jc(this.sf(k),this.sf(y)),i=this.sf(R);if(!i)return t||{};const e=Nr({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.uv||(this.R.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.uv=!0),e}getFlagPayloads(){const t=jc(this.sf(C),this.sf(y)),i=this.sf(A);if(!i)return t||{};const e=Nr({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.uv||(this.R.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.uv=!0),e}reloadFeatureFlags(){this.bv||this.Yr.featureFlagsDisabled||this.Rv()||(this.wv&&this.R.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.mv&&(this._v=!0),this.pf||(this.pf=setTimeout(()=>{this.gf()},5),this.vv.slice().forEach(t=>{try{t()}catch(t){this.R.error("Error while running feature flags reloading callback",t)}})))}reloadFeatureFlagsAsync(){return!this.ia||this.bv||this.Yr.featureFlagsDisabled||this.Yr.remoteRequestsDisabled||this.Rv()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.fv.add(t),this.reloadFeatureFlags()})}if(t,i){t.forEach(t=>t({status:i})),t.clear()}nf(){clearTimeout(this.pf),this.pf=void 0}onReloading(t){return this.vv.push(t),()=>{this.vv=this.vv.filter(i=>i!==t)}}ensureFlagsLoaded(){this.gv||this.mv||this.pf||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.bv=t}resetFlagCallReported(){this.Dt(P),this.Sv=new Map,this.Av=new Map}sendFlagCallsPendingCapture(){var t;if(0!==this.Sv.size&&!this.xv&&(null===(t=this.ia)||void 0===t?void 0:t.canCapture)&&!this.ia.isRateLimited){this.xv=!0;try{const t=this.getFlagVariants();for(const e of Array.from(this.Sv.keys())){var i;const s=this.Sv.get(e);if(!s)continue;const n=null===(i=this.mf(e,t[e]))||void 0===i?void 0:i.calledKey;if(s.value!==String(t[e])||s.calledKey&&s.calledKey!==n||!Hc(s.context,this.yf()))this.Sv.delete(e);else if(this.getFeatureFlagResult(e),this.Sv.has(e))break}}finally{this.xv=!1}}}gf(t){var i;this.nf();const e=this.ia;if(!e||this.Yr.remoteRequestsDisabled||this.Rv())return void this.if(this.fv,"skipped");if(this.mv)return void(this._v=!0);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:us(us(us({},e.initialPersonProperties),this.sf("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.sf(E),timezone:Cl()};yi(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Yr.featureFlagsDisabled)&&(s.disable_flags=!0);const n=this.hf();n.length&&(s.evaluation_contexts=n);const r=this.df();yi(r)||(s.flag_keys=r);const o=this.Yr.onlyEvaluateSurveyFeatureFlags,l=`/flags/?v=${this.Bv.version}${o?"&only_evaluate_survey_feature_flags=true":""}`,a=this.yv,u=this.fv;this.fv=new Set,this.pv=u,this.mv=!0;const h=()=>{this._v&&(this._v=!1,this.gf())},c=t=>{var i;const e=this.bf(t.json),n=200!==t.statusCode;if(this.mv=!1,a!==this.yv)return void h();if(this._f(t.statusCode),n||this._v||(this.$anon_distinct_id=void 0),s.disable_flags&&!this._v)return void this.if(u,"skipped");this.$v=!n;const r=[];t.error?r.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Dc:"unknown_error"):200!==t.statusCode&&r.push(`api_error_${t.statusCode}`),e.errorsWhileComputingFlags&&r.push("errors_while_computing_flags");const l=!!(null===(i=e.quotaLimited)||void 0===i?void 0:i.includes("feature_flags"));l&&r.push("quota_limited"),this.$t({[b]:r}),l?this.R.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):s.disable_flags||this.vf(e,n,{partialResponse:o}),this.if(u,s.disable_flags?"skipped":r.length||!e.flags&&!e.featureFlags?"error":"loaded"),h()},d=t=>{this.mv=!1,a===this.yv?(this.$t({[b]:[Dc]}),this.R.error("Feature flag request failed",t),this.lf()&&this.Yv(!0),this.if(u,"error"),h()):h()};let v=null!==(i=this.Yr.requestMaxRetries)&&void 0!==i?i:1;const f=()=>v>0&&a===this.yv,p=()=>{if(a!==this.yv||!this.ia||this.Yr.remoteRequestsDisabled)return this.mv=!1,this.if(u,"skipped"),void h();try{e.sendRequest(l,{target:"flags",method:"POST",body:s,compression:this.Yr.compression,sentAt:"body",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{if((t=>Mc.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(p,500);c(t)}).catch(d)}catch(t){d(t)}};p()}bf(t){const i=null!=t?t:{},e=this.Bv.read;if(!e)return i;const{body:s,withoutTypedValues:n}=e(i);return n&&!this.Iv&&(this.Iv=!0,this.R.info("The /flags response has no typed flag values. Its flags are read as before.")),s}Rv(){return Il(this.Tv,3)}_f(t){this.Tv=Ml(t,this.Tv,3,()=>this.R.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."))}wf(t){var i;return!this.gv&&!this.getFlags().length&&!(null===(i=this.getFeatureFlagDetails(t))||void 0===i?void 0:i.failed)}getFeatureFlag(t,i={}){var e;if(i.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlag for key "'+t+Ic);if(this.cf())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){const i=this.ff()[t],e=this.Bv.publicDetail;return i&&e?e(i):i}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){var e;if(i.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlagResult for key "'+t+Ic);if(this.cf())return;const s=null===(e=this.sf("$feature_flag_details"))||void 0===e||null===(e=e[t])||void 0===e?void 0:e.failed,n=s?void 0:this.sf(k),r=s?void 0:this.sf(C),o=this.sf(R),l=!!o&&{}.hasOwnProperty.call(o,t),a=l||!!n&&t in n,u=l?o[t]:null==n?void 0:n[t],h=this.sf(A),c=h&&{}.hasOwnProperty.call(h,t)?h[t]:null==r?void 0:r[t],d=String(u),v=this.sf("$feature_flag_request_id")||void 0,f=this.sf("$feature_flag_evaluated_at")||void 0;let p,g=this.sf("$flag_call_reported")||{};if(this.Yr.deduplicateCallsPerSession){var _;const t=null===(_=this.ia)||void 0===_||null===(_=_.session)||void 0===_?void 0:_.sessionId,i=this.sf(O);t&&t!==i&&(g={},p=t)}if(!i.send_event&&"send_event"in i)p&&this.$t({[P]:g,[O]:p});else{var m,y,b,w;const i=!(null===(m=this.ia)||void 0===m?void 0:m.canCapture),e=!i&&!(null===(y=this.ia)||void 0===y?void 0:y.isRateLimited),s=this.mf(t,u),n=s?s.calledKey:d,r=null==s?void 0:s.exposureKey,o=()=>this.kf(t,d,null==s?void 0:s.calledKey);var x,S;e?this.Sv.delete(t):(i&&Object.keys(g).length>0&&(g={},this.$t({[P]:g})),(!(null===(x=g[t])||void 0===x?void 0:x.includes(n))||r&&!(null===(S=g[t])||void 0===S?void 0:S.includes(r)))&&o());const l=!(null===(b=g[t])||void 0===b?void 0:b.includes(n)),a=!!r&&!(null===(w=g[t])||void 0===w?void 0:w.includes(r));if(e&&s&&(l||a)){p&&this.$t({[P]:g,[O]:p});const i=s.build(this.Sf(t,u,c,v,f)),e=l?this.xf(t,n,i.called,o):void 0;a&&i.exposure&&this.xf(t,r,i.exposure,o,e)}else if(e&&l){pi(g[t])?g[t].push(d):g[t]=[d],this.$t(us({[P]:g},p?{[O]:p}:{}));const i=this.Sf(t,u,c,v,f);this.$f(i)||(this.Cf(t,d),o())}else p&&this.$t({[P]:g,[O]:p})}return a?{key:t,enabled:!!u,variant:"string"==typeof u?u:void 0,payload:en(c)}:void 0}Sf(t,i,e,s,n){var r,o,l,a,u,h,c,d,v,f,p,g,_;const m=this.ff()[t],y=[...null!==(r=this.sf("$feature_flag_errors"))&&void 0!==r?r:[]];yi(i)&&y.push((null==m?void 0:m.failed)?"evaluation_failed":"flag_missing");const b={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:null!=e?e:null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:null!==(o=null===(l=this.Yr.bootstrap)||void 0===l||null===(l=l.featureFlags)||void 0===l?void 0:l[t])&&void 0!==o?o:null,$feature_flag_bootstrapped_payload:null!==(a=null===(u=this.Yr.bootstrap)||void 0===u||null===(u=u.featureFlagPayloads)||void 0===u?void 0:u[t])&&void 0!==a?a:null,$used_bootstrap_value:!this.$v};yi(null==m||null===(h=m.metadata)||void 0===h?void 0:h.has_experiment)||(b.$feature_flag_has_experiment=m.metadata.has_experiment),yi(null==m||null===(c=m.metadata)||void 0===c?void 0:c.version)||(b.$feature_flag_version=m.metadata.version);const w=null!==(d=null==m||null===(v=m.reason)||void 0===v?void 0:v.description)&&void 0!==d?d:null==m||null===(f=m.reason)||void 0===f?void 0:f.code;return w&&(b.$feature_flag_reason=w),(null==m||null===(p=m.metadata)||void 0===p?void 0:p.id)&&(b.$feature_flag_id=m.metadata.id),yi(null==m?void 0:m.original_variant)&&yi(null==m?void 0:m.original_enabled)||(b.$feature_flag_original_response=yi(m.original_variant)?m.original_enabled:m.original_variant),(null==m||null===(g=m.metadata)||void 0===g?void 0:g.original_payload)&&(b.$feature_flag_original_payload=null==m||null===(_=m.metadata)||void 0===_?void 0:_.original_payload),y.length&&(b.$feature_flag_error=y.join(",")),b}mf(t,i){var e,s,n;const r=this.Bv.flagEvents,o=this.sf(R);if(!(!r||_i(o)&&vi.call(o,t)))return r({key:t,response:i,groups:null!==(e=null===(s=this.ia)||void 0===s?void 0:s.groups)&&void 0!==e?e:{},record:null===(n=this.sf("$feature_flag_details"))||void 0===n?void 0:n[t]})}xf(t,i,e,s,n){var r;const o=this.sf("$flag_call_reported")||{},l=t+i,a=this.Av.get(l)||0;if((null===(r=o[t])||void 0===r?void 0:r.includes(i))||a>1)return;this.$t({[P]:us(us({},o),{},{[t]:[...o[t]||[],i].slice(-10)})});let u,h,c=!1,d=!1;this.Ev.set(e.properties,us(us({},e.capture),{},{failed(){c=!0},resolved:t=>(h=t.$session_id,u=JSON.stringify([t.distinct_id,t.$groups,h,t.$process_person_profile]),d=!!n&&u!==n,!d)}));let v=!1;try{var f,p;v=!1!==(null===(f=this.ia)||void 0===f?void 0:f.capture(e.event,e.properties))&&!!(null===(p=this.ia)||void 0===p?void 0:p.canCapture),v||s()}catch(t){c=!0,this.R.error("Failed to capture "+e.event,t)}c&&this.Av.set(l,a+1);const g=v&&!c&&!d;return g||this.Cf(t,i),this.Yr.deduplicateCallsPerSession&&h&&h!==this.sf("$flag_call_reported_session_id")&&this.$t({[P]:g?{[t]:[i]}:{},[O]:h}),u}flagEventCapture(t){return t?this.Ev.get(t):void 0}$f(t){try{var i;return!1!==(null===(i=this.ia)||void 0===i?void 0:i.capture("$feature_flag_called",t))}catch(t){return this.R.error("Failed to capture feature flag call",t),!0}}kf(t,i,e){this.Sv.set(t,{value:i,calledKey:e,context:this.yf()})}yf(){var t,i,e;return{distinctId:null===(t=this.ia)||void 0===t?void 0:t.distinctId,groups:us({},null===(i=this.ia)||void 0===i?void 0:i.groups),sessionId:this.Yr.deduplicateCallsPerSession?null===(e=this.ia)||void 0===e||null===(e=e.session)||void 0===e?void 0:e.sessionId:void 0}}Cf(t,i){const e=this.sf("$flag_call_reported")||{},s=e[t];pi(s)&&s.includes(i)&&(e[t]=s.filter(t=>t!==i),this.$t({[P]:e}))}getRemoteConfigPayload(t,i){this.Tf(t,i)}Tf(t,i){var e=this;return Li(function*(){const s=e.ia;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.hf();r.length&&(n.evaluation_contexts=r);const o=e.df();let l;yi(o)||(n.flag_keys=o);try{var a;const i=null===(a=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Yr.compression,sentAt:"body",timeoutMs:e.Yr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.R.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.R.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.$v)return i.defaultValue;if(this.wf(t))return this.R.warn('isFeatureEnabled for key "'+t+Ic),i.defaultValue;const e=this.getFeatureFlag(t,i);return yi(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.vf(t,i,e)}vf(t,i,e){if(!this.ia)return;var s,n;this.gv=!0,!1!==(null==e?void 0:e.persist)&&Nc(t,e)&&(null===(s=this.zv)||void 0===s||null===(n=s.reconcileFeatureFlagsBeforeMerge)||void 0===n?void 0:n.call(s))&&this.Zv();const r=this.getFlagVariants(),o=!t.flags&&pi(t.featureFlags),l=((t,i={},e={},s={},n,r=Rc)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).filter(t=>!e[t].failed).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>!e[t].failed&&e[t].enabled).filter(t=>{var i;return!yi(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return[t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return us(us({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(pi(a)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(a)for(let i=0;a.length>i;i++)t[a[i]]=!0;return{[m]:a,[k]:t,[y]:Lc(s,a),[C]:jc(e,s),[S]:!1}}let d=a,v=u,f=l;if(Nc(t,n)){const t=t=>({}.hasOwnProperty.call(i,t)&&!yi(i[t])),r=Object.keys(d),o=v||{};d=us(us({},i),d),v=us(us({},e),o),((null==n?void 0:n.partialResponse)||l)&&r.forEach(t=>{t in o||null==v||delete v[t]}),f=l?us(us({},s),Object.fromEntries(Object.entries(l).filter(([i,e])=>!e.failed||!t(i)))):Lc(s,r)}return us(us({[m]:Object.keys(Uc(d)),[k]:d||{},[C]:v||{},[y]:f||{},[S]:!0===t.minimalFlagCalledEvents},h?{[x]:h}:{}),c?{[w]:c}:{})})(t,r,o?this.sf("$feature_flag_payloads")||{}:this.getFlagPayloads(),o?this.sf("$feature_flag_details")||{}:this.ff(),e,this.R);if(l)if(!1===(null==e?void 0:e.persist)){const t=!yi(this.ia.kv.get(k));this.rf=l,t||this.$t(l)}else this.Zv(),this.uf(l,t,!!(null==e?void 0:e.partialResponse)),this.$t(l);else i&&this.lf();i||(this.Cv=!1),this.Yv(i)}override(t,i=!1){this.R.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Mf(t)}Mf(t){if(this.ia){if(!1===t)return this.Dt([R,A]),this.Yv(),void Ac.info("All overrides cleared");if(pi(t))return this.$t({[R]:Bc(t)}),this.Yv(),void Ac.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.uv=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[R]=pi(n)?Bc(n):n),r&&(s[A]=r),Object.keys(s).length&&this.$t(s),!1===n&&!1===r?this.Dt([R,A]):!1===n?this.Dt(R):!1===r&&this.Dt(A),this.Yv(),!1===n?Ac.info("Flag overrides cleared"):n&&Ac.info("Flag overrides set",{flags:n}),void(!1===r?Ac.info("Payload overrides cleared"):r&&Ac.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[R]:t}),this.Yv(),void Ac.info("Flag overrides set",{flags:t});this.R.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.R.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.gv){const{flags:i,flagVariants:e}=this.If();try{t(i,e)}catch(t){this.R.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s,n;const r=(this.sf("$early_access_features")||[]).find(i=>i.flagKey===t),o={[`$feature_enrollment/${t}`]:i},l={$feature_flag:t,$feature_enrollment:i,$set:o};r&&(l.$early_access_feature_name=r.name),e&&(l.$feature_enrollment_stage=e);const a=us(us({},this.getFlagVariants()),{},{[t]:i}),u=us({},this.sf(y)),h=null===(s=u[t])||void 0===s?void 0:s.failed,c=us({},this.sf(C));h&&(delete u[t],delete c[t]),null===(n=this.zv)||void 0===n||n.markCrossTabFeatureFlagChanges(us(us({$active_feature_flags:[t],$enabled_feature_flags:[t]},h?{$feature_flag_details:[t],$feature_flag_payloads:[t]}:{}),{},{$stored_person_properties:Object.keys(o)})),this.$t(us(us({[m]:Object.keys(Uc(a)),[k]:a},h?{[y]:u,[C]:c}:{}),{},{[T]:us(us({},this.sf("$stored_person_properties")||{}),o)})),this.Yv();try{var d;null===(d=this.ia)||void 0===d||d.capture("$feature_enrollment_update",l)}catch(t){this.R.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const s=this.sf(_);!s||i?this.Ef(t,e):t(s)}Ef(t,i){var e=this;return Li(function*(){const s=e.ia;if(!s)return;const n=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,e.$t({[_]:r})}catch(t){return void e.R.error("Early access feature request failed",t)}try{t(r)}catch(t){e.R.error("Early access feature callback failed",t)}})()}If(){const 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),{})}}Yv(t){this.Kv();const{flags:i,flagVariants:e}=this.If(),s=this.wv;this.wv=!0,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.R.error("Error while running feature flags callback",t)}}),this.wv=s}setPersonPropertiesForFlags(t,i=!0){this.Af(t,i)}Af(t,i=!0){const e=this.sf("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.$t({[T]:us(us(us({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=us({},this.sf("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.$t({[T]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(T),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.sf("$stored_group_properties")||{},s=us({},e);for(const i of Object.keys(t))s[i]=us(us({},e[i]),t[i]);this.$t({[E]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.sf("$stored_group_properties")||{};this.$t({[E]:us(us({},i),{},{[t]:{}})})}else this.Dt(E)}reset(){this.yv++,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this._v=!1,this.hv={},this.dv={},this.rf=void 0,this.gv=!1,this.bv=!1,this.$v=!1,this.$anon_distinct_id=void 0,this.nf(),this.uv=!1,this.Tv=0,this.Sv=new Map,this.Av=new Map}};const Wc=t=>_i(t)&&"value"in t?t:void 0,Vc=t=>bi(t)?t:Si(t)||_i(t)||!0===t,Gc="$experiment_exposure",Kc="experiment_split",Jc="experiment",Yc={targeting_match:["targeted_release","percentage_rollout"],[Kc]:[Jc],rollout_miss:["percentage_rollout",Jc],experiment_paused:[Jc],holdout:[Jc]},Zc="$feature_flag_config_version",Xc="$feature_flag_reason_code",Qc="$feature_flag_rule_id",td="$feature_flag_rule_type",id="$feature_flag_variant_key",ed="$feature_flag_experiment_id",sd="$feature_flag_forced_variant",nd=[Zc,Xc,Qc,td,id],rd=[...nd,"$feature_flag_reason",sd,ed],od=[Zc,Xc,td,"$experiment_exposure_source",ed,sd],ld=["$feature_flag_id","$feature_flag_version","$feature_flag_request_id","$feature_flag_evaluated_at"],ad=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ud=t=>bi(t)?t:void 0,hd={},cd=t=>Si(t)&&t%1==0,dd=[["key",bi],["failed",Ei]],vd=[["code",bi],["condition_index",cd],["description",bi]],fd=[["id",cd],["version",cd],["description",bi],["has_experiment",Ei],["config_version",cd],["rule_type",bi],["rule_id",bi],["variant_key",bi],["forced_variant",Ei],["experiment_id",cd]],pd=(t,i)=>{if(xi(t))return;if(!_i(t))throw hd;const e={};for(const[s,n]of i){const i=t[s];if(!xi(i)){if(!n(i))throw hd;e[s]=i}}return e},gd=(t,i)=>{const e=pd(i,dd),s=null==i?void 0:i.value;if(!e||!($i(s)||Ei(s)||bi(s)||_i(s)||Si(s)&&isFinite(s)))throw hd;const n=i.metadata,r=pd(n,fd),o=!0===e.failed,l=o?null:s,a=Si(l)||_i(l),u=Vc(l);return{key:t,enabled:!1!==u,variant:bi(u)?u:null,value:l,reason:pd(i.reason,vd),metadata:r||a?us(us({},r),{},{payload:o?null:a?JSON.stringify(l):null==n?void 0:n.payload,experiment_id:void 0}):void 0,failed:o||void 0}},_d=["config_version","rule_type","rule_id","variant_key","forced_variant"],md={version:4,read(t){const i=_i(t)?t.flags:void 0;let e=!1;if(!_i(i)){const i=_i(t)?t.featureFlags:void 0;return{body:t,withoutTypedValues:_i(i)&&Object.keys(i).length>0}}const s=Object.fromEntries(Object.keys(i).map(t=>{const s=i[t];if(_i(s)&&!("value"in s))return e=!0,[t,s];try{return[t,gd(t,s)]}catch(i){return[t,{key:t,enabled:!1}]}}));return{body:us(us({},t),{},{flags:s}),withoutTypedValues:e}},publicDetail(t){if(!Wc(t))return t;const i=us({},t);if(delete i.value,_i(i.metadata)){const t=i.metadata=us({},i.metadata);for(const i of _d)delete t[i]}return i},flagEvents(t){const{key:i,response:e,record:s}=t,n=(t=>{var i;const e=Wc(t),s=null==e?void 0:e.metadata;if(!e||2!==(null==s?void 0:s.config_version))return;const n=ud(null===(i=e.reason)||void 0===i?void 0:i.code)||void 0;let r,o,l;const a=n&&vi.call(Yc,n)?Yc[n]:void 0,u=ud(s.rule_id),h=ud(s.rule_type);return!e.failed&&a&&u&&ad.test(u)&&h&&-1!==a.indexOf(h)&&(n!==Kc?(r=u,o=h):bi(s.variant_key)&&(r=u,o=h,l=s.variant_key)),{reasonCode:n,ruleId:r,ruleType:o,variantKey:l}})(s),r=Wc(s);if(!n||!r||(r.failed?!yi(e):Vc(r.value)!==e))return;const{reasonCode:o,ruleId:l,ruleType:a,variantKey:u}=n,h=Object.keys(t.groups).sort().map(i=>[i,t.groups[i]]),c={[Zc]:2};o&&(c[Xc]=o),l&&(c[Qc]=l,c[td]=a);const d=bi(u);return d&&(c[id]=u),{calledKey:JSON.stringify([e,h,2,o||null,l||null,a||null,d?u:null]),exposureKey:d?JSON.stringify([Gc,h,2,l,u]):void 0,build(t){const s=us(us({},t),c);delete s.$feature_flag_reason;const n={event:"$feature_flag_called",properties:s,capture:{omit:rd.filter(t=>!(t in s)),keep:nd}};if(!d)return{called:n,exposure:void 0};const r={};for(const t of ld)yi(s[t])||(r[t]=s[t]);return r.$feature_flag=i,r.$feature_flag_response=e,r[id]=u,r[Qc]=l,r.locally_evaluated=!1,{called:n,exposure:{event:Gc,properties:r,capture:{omit:od,keep:[]}}}}}}},yd=Dr("[FeatureFlags]");var bd=class{constructor(t,i=!1){this.Rf=!1,this.update(t,i)}update(t,i){this.Pf=((t,i)=>{var e,s,n,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},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!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:yi(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:pi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Rf||(yd.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Rf=!0),yi(t.flag_keys)||pi(t.flag_keys)||yd.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Pf}};const wd=t=>Ri(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),$d=Dr("[Error tracking]"),xd="webkit-masked-url:",Sd=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],kd=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",xd],Ed=["__firefox__","__gCrWeb"];function Td(t,i){this.v=t,this.k=i}function Pd(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);i>e;e++)s[e]=t[e];return s}function Od(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var s,n,r,o,l=[],a=!0,u=!1;try{if(r=(e=e.call(t)).next,0===i){if(Object(e)!==e)return;a=!1}else for(;!(a=(s=r.call(e)).done)&&(l.push(s.value),l.length!==i);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return Pd(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Pd(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cd(t){var i,e;function s(i,e){try{var r=t[i](e),o=r.value,l=o instanceof Td;Promise.resolve(l?o.v:o).then(function(e){if(l){var a="return"===i&&o.k?i:"next";if(!o.k||e.done)return s(a,e);e=t[a](e).value}n(!!r.done,e)},function(t){s("throw",t)})}catch(t){n(2,t)}}function n(t,n){2===t?i.reject(n):i.resolve({value:n,done:t}),(i=i.next)?s(i.key,i.arg):e=null}this._invoke=function(t,n){return new Promise(function(r,o){var l={key:t,arg:n,resolve:r,reject:o,next:null};e?e=e.next=l:(i=e=l,s(t,n))})},"function"!=typeof t.return&&(this.return=void 0)}Cd.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Cd.prototype.next=function(t){return this._invoke("next",t)},Cd.prototype.throw=function(t){return this._invoke("throw",t)},Cd.prototype.return=function(t){return this._invoke("return",t)};const Rd=Object.entries,Ad=Object.keys,Id=Object.setPrototypeOf,Md=Object.isFrozen,Fd=Object.getPrototypeOf,Dd=Object.getOwnPropertyDescriptor;let jd=Object.freeze,Ld=Object.seal,Nd=Object.create,Bd="undefined"!=typeof Reflect&&Reflect,Ud=Bd.apply,zd=Bd.construct;jd||(jd=function(t){return t}),Ld||(Ld=function(t){return t}),Ud||(Ud=function(t,i){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return t.apply(i,s)}),zd||(zd=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return new t(...e)});const Hd=fv([].forEach),qd=fv([].lastIndexOf),Wd=fv([].pop),Vd=fv([].push),Gd=fv([].slice),Kd=fv([].splice),Jd=Array.isArray,Yd=pv(Set),Zd=fv(Set.prototype.add),Xd=fv(Set.prototype.has),Qd=fv("".toLowerCase),tv=fv("".toString),iv=fv("".match),ev=fv("".replace),sv=fv("".indexOf),nv=fv("".trim),rv=fv((0).toString),ov=fv(Boolean.prototype.toString),lv="undefined"==typeof BigInt?null:fv(BigInt.prototype.toString),av="undefined"==typeof Symbol?null:fv(Symbol.prototype.toString),uv=fv({}.hasOwnProperty),hv=fv({}.toString),cv=/t/.test,dv=function(t,i){return t instanceof RegExp&&(t.lastIndex=0),Ud(cv,t,[i])},vv=pv(TypeError);function fv(t){return function(i){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;e>n;n++)s[n-1]=arguments[n];return Ud(t,i,s)}}function pv(t){return function(){for(var i=arguments.length,e=new Array(i),s=0;i>s;s++)e[s]=arguments[s];return zd(t,e)}}function gv(t,i){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Qd;if(Id&&Id(t,null),!Jd(i))return t;let s=i.length;for(;s--;){let n=i[s];if("string"==typeof n){const t=e(n);t!==n&&(Md(i)||(i[s]=t),n=t)}t[n]=!0}return t}function _v(t){for(let i=0;t.length>i;i++)uv(t,i)||(t[i]=null);return t}function mv(t){const i=Nd(null);for(const s of Rd(t)){var e=Od(s,2);const n=e[0],r=e[1];uv(t,n)&&(i[n]=Jd(r)?_v(r):r&&"object"==typeof r&&r.constructor===Object?mv(r):r)}return i}function yv(t){const i=Nd(null),e=Ad(t);let s=e.length;for(;s--;)i[e[s]]=t[e[s]];return i}function bv(t,i){for(;null!==t;){const e=Dd(t,i);if(e){if(e.get)return fv(e.get);if("function"==typeof e.value)return fv(e.value)}t=Fd(t)}return function(){return null}}const wv=jd(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$v=jd(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),xv=jd(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Sv=jd(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kv=jd(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ev=jd(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tv=jd(["#text"]),Pv=jd(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ov=jd(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Cv=jd(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Rv=jd(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Av=Ld(/{{[\w\W]*|^[\w\W]*}}/g),Iv=Ld(/<%[\w\W]*|^[\w\W]*%>/g),Mv=Ld(/\${[\w\W]*/g),Fv=Ld(/{{|}}|\${|<%|%>|<%|%>/),Dv=Ld(/^data-[\-\w.\u00B7-\uFFFF]+$/),jv=Ld(/^aria-[\-\w]+$/),Lv=Ld(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nv=Ld(/^(?:\w+script|data):/i),Bv=Ld(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Uv=Ld(/^html$/i),zv=Ld(/^[a-z][.\w]*(-[.\w]+)+$/i),Hv=Ld(/<[/\w!]/g),qv=Ld(/<[/\w]/g),Wv=Ld(/<\/no(script|embed|frames)/i),Vv=Ld(/\/>/i),Gv=Ld(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),Kv=Ld(/^[\r\n\t ]+/),Jv=jd(gv({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Yv=function(){return"undefined"==typeof window?null:window},Zv=function(t,i,e,s){return uv(t,i)&&Jd(t[i])?gv(s.base?yv(s.base):{},t[i],s.transform):e},Xv=function(t,i,e){const s=uv(t,i)?t[i]:void 0;return s&&"object"==typeof s?mv(s):e};var Qv=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Yv();const e=i=>t(i);if(e.version="3.4.18",e.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return e.isSupported=!1,e;let s=i.document;const n=s,r=n.currentScript,o=i.HTMLTemplateElement,l=i.Node,a=i.NodeFilter,u=i.DOMParser,h=i.trustedTypes,c=i.Element.prototype,d=bv(c,"cloneNode"),v=bv(c,"remove"),f=bv(c,"removeAttributeNode"),p=bv(c,"nextSibling"),g=bv(c,"childNodes"),_=bv(c,"parentNode"),m=bv(c,"shadowRoot"),y=bv(c,"attributes"),b=l&&l.prototype?bv(l.prototype,"nodeType"):null,w=l&&l.prototype?bv(l.prototype,"nodeName"):null,x=l&&l.prototype?bv(l.prototype,"ownerDocument"):null,S=function(t){return b?b(t):t.nodeType},k=function(t){return w?w(t):t.nodeName},E=function(t){for(;null!==t;){const i=Dd(t,"namespaceURI");if(i)return i.get?fv(i.get):null;t=Fd(t)}return null}(c),T=function(t){return E?E(t):t.namespaceURI};if("function"==typeof o){const t=s.createElement("template");t.content&&t.content.ownerDocument&&(s=t.content.ownerDocument)}let P,O,C="",R=!1,A=0;const I=function(){if(A>0)throw vv('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},M=function(t){I(),A++;try{return P.createHTML(t)}finally{A--}},F=function(t){return P&&mt?M(t):t},D=s.implementation,j=s.createNodeIterator,L=s.createDocumentFragment,N=s.getElementsByTagName,B=n.importNode;let U={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported="function"==typeof Rd&&"function"==typeof _&&D&&void 0!==D.createHTMLDocument;const z=Av,H=Iv,q=Mv,W=Dv,V=jv,G=Nv,K=Bv,J=zv;let Y=Lv,Z=null;const X=gv({},[...wv,...$v,...xv,...kv,...Tv]);let Q=null;const tt=gv({},[...Pv,...Ov,...Cv,...Rv]);let it=null,et=null,st=null;const nt=Object.seal(Nd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let rt=!0,ot=!0,lt=!1,at=!0,ut=!1,ht=!0,ct=!1,dt=!1,vt=null,ft=null,pt=!1,gt=!1,_t=!1,mt=!1,yt=!0,bt=!1;const wt="user-content-";let $t=!0,xt=!1,St=null,kt=!1,Et=null;const Tt=gv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Pt=null;const Ot=gv({},["audio","video","img","source","image","track"]);let Ct=null;const Rt=gv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),At="http://www.w3.org/1998/Math/MathML",It="http://www.w3.org/2000/svg",Mt="http://www.w3.org/1999/xhtml";let Ft=Mt,Dt=!1,jt=null;const Lt=gv({},[At,It,Mt],tv),Nt=jd(gv({},["mi","mo","mn","ms","mtext"]));let Bt=null;const Ut=jd(gv({},["annotation-xml"]));let zt=null;const Ht=jd(Nd(null)),qt=gv({},["title","style","font","a","script"]);let Wt=null;const Vt=["application/xhtml+xml","text/html"];let Gt=null,Kt=null;const Jt=s.createElement("form"),Yt=function(t){return t instanceof RegExp||t instanceof Function},Zt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t&&"object"==typeof t||(t={}),t=mv(t),Wt=-1===Vt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Gt="application/xhtml+xml"===Wt?tv:Qd,Z=Zv(t,"ALLOWED_TAGS",X,{transform:Gt}),Q=Zv(t,"ALLOWED_ATTR",tt,{transform:Gt}),jt=Zv(t,"ALLOWED_NAMESPACES",Lt,{transform:tv}),Ct=Zv(t,"ADD_URI_SAFE_ATTR",Rt,{transform:Gt,base:Rt}),Pt=Zv(t,"ADD_DATA_URI_TAGS",Ot,{transform:Gt,base:Ot}),Et=Zv(t,"FORBID_CONTENTS",Tt,{transform:Gt}),et=Zv(t,"FORBID_TAGS",Nd(null),{transform:Gt}),st=Zv(t,"FORBID_ATTR",Nd(null),{transform:Gt}),kt=!!uv(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?mv(t.USE_PROFILES):t.USE_PROFILES),rt=!1!==t.ALLOW_ARIA_ATTR,ot=!1!==t.ALLOW_DATA_ATTR,lt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,at=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,ut=t.SAFE_FOR_TEMPLATES||!1,ht=!1!==t.SAFE_FOR_XML,ct=t.WHOLE_DOCUMENT||!1,gt=t.RETURN_DOM||!1,_t=t.RETURN_DOM_FRAGMENT||!1,mt=t.RETURN_TRUSTED_TYPE||!1,pt=t.FORCE_BODY||!1,yt=!1!==t.SANITIZE_DOM,bt=t.SANITIZE_NAMED_PROPS||!1,$t=!1!==t.KEEP_CONTENT,xt=t.IN_PLACE||!1,Y=function(t){if(!t)return!1;try{return dv(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Lv,Ft="string"==typeof t.NAMESPACE?t.NAMESPACE:Mt,Bt=Xv(t,"MATHML_TEXT_INTEGRATION_POINTS",Nt),zt=Xv(t,"HTML_INTEGRATION_POINTS",Ut);const i=Xv(t,"CUSTOM_ELEMENT_HANDLING",Ht);if(it=Nd(null),uv(i,"tagNameCheck")&&Yt(i.tagNameCheck)&&(it.tagNameCheck=i.tagNameCheck),uv(i,"attributeNameCheck")&&Yt(i.attributeNameCheck)&&(it.attributeNameCheck=i.attributeNameCheck),uv(i,"allowCustomizedBuiltInElements")&&"boolean"==typeof i.allowCustomizedBuiltInElements&&(it.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),Ld(it),ut&&(ot=!1),_t&&(gt=!0),kt&&((uv(t,"ALLOWED_TAGS")||uv(t,"ALLOWED_ATTR"))&&"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),Z=gv({},Tv),Q=Nd(null),!0===kt.html&&(gv(Z,wv),gv(Q,Pv)),!0===kt.svg&&(gv(Z,$v),gv(Q,Ov),gv(Q,Rv)),!0===kt.svgFilters&&(gv(Z,xv),gv(Q,Ov),gv(Q,Rv)),!0===kt.mathMl&&(gv(Z,kv),gv(Q,Cv),gv(Q,Rv))),nt.tagCheck=null,nt.attributeCheck=null,uv(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?nt.tagCheck=t.ADD_TAGS:Jd(t.ADD_TAGS)&&(Z===X&&(Z=yv(Z)),gv(Z,t.ADD_TAGS,Gt))),uv(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?nt.attributeCheck=t.ADD_ATTR:Jd(t.ADD_ATTR)&&(Q===tt&&(Q=yv(Q)),gv(Q,t.ADD_ATTR,Gt))),uv(t,"ADD_FORBID_CONTENTS")&&Jd(t.ADD_FORBID_CONTENTS)&&(Et===Tt&&(Et=yv(Et)),gv(Et,t.ADD_FORBID_CONTENTS,Gt)),$t&&(Z["#text"]=!0),ct&&gv(Z,["html","head","body"]),Z.table&&(Z.tbody=!0,delete et.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw vv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw vv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=P;P=t.TRUSTED_TYPES_POLICY;try{C=M("")}catch(t){throw P=i,t}}else null===t.TRUSTED_TYPES_POLICY?(P=void 0,C=""):(void 0===P&&(R||(O=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let e=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(e=i.getAttribute(s));const n="dompurify"+(e?"#"+e:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(h,r),R=!0),P=O),P&&"string"==typeof C&&(C=M("")));Kt=jd(t)},Xt=gv({},[...$v,...xv,...Sv]),Qt=gv({},[...kv,...Ev]),ti=function(t){Vd(e.removed,{element:t});try{_(t).removeChild(t)}catch(i){if(v(t),!_(t))throw vv("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ii=function(t,i,e){try{f(t,i)}catch(i){try{t.removeAttribute(e)}catch(t){}}},ei=function(t){oi(t);const i=g(t);i&&Hd(Gd(i),t=>{try{v(t)}catch(t){}}),1===S(t)&&ni(t,!1)},si=function(t,i,s){if(!s)try{s=i.getAttributeNode(t)}catch(t){s=null}if(Vd(e.removed,{attribute:s||null,from:i}),s)ii(i,s,t);else try{i.removeAttribute(t)}catch(t){}if("is"===t)if(gt||_t)try{ti(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},ni=function(t,i){const e=y(t);if(e)for(let s=e.length-1;s>=0;--s){const n=e[s],r=n&&n.name;"string"!=typeof r||i&&Q[Gt(r)]||ii(t,n,r)}},ri=function(t,i){let e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=[t];for(;s.length>0;){const t=s.pop();if(!1===i(t))continue;if(e&&1===S(t)){const i=m(t);mi(i)&&s.push(i)}const n=g(t);if(n)for(let t=n.length-1;t>=0;--t)s.push(n[t])}},oi=function(t){ri(t,t=>{1===S(t)&&ni(t,!0)})},li=function(t){const i=[];return ri(t,t=>{i.push(t)},!0),i},ai=function(t,i){let s=!1;return Hd(e.removed,i=>{i.element&&(s=s||i.element===t,oi(i.element))}),function(t,i){const e=Yd();Hd(li(t),t=>{1===S(t)&&Zd(e,t)}),Hd(i,t=>{1!==S(t)||Xd(e,t)||ni(t,!0)})}(t,i),s},ui=function(t,i,e,s){const n=di(t);let r;for(;r=n.nextNode();)Xd(s,r)&&!Xd(St,r)&&(i&&bi(U.uponSanitizeShadowNode,r,null),Ri(r,e))},hi=function(t,i){return!!ht&&("patchsrc"===t||"for"===t&&"label"!==i&&"output"!==i)},ci=function(t){let i=null,e=null;if(pt)t="<remove></remove>"+t;else{const i=iv(t,Kv);e=i&&i[0]}"application/xhtml+xml"===Wt&&Ft===Mt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=P?M(t):t;if(Ft===Mt)try{i=(new u).parseFromString(n,Wt)}catch(t){}if(!i||!i.documentElement){i=D.createDocument(Ft,"template",null);try{i.documentElement.innerHTML=Dt?C:n}catch(t){}}const r=i.body||i.documentElement;return t&&e&&r.insertBefore(s.createTextNode(e),r.childNodes[0]||null),Ft===Mt?N.call(i,ct?"html":"body")[0]:ct?i.documentElement:r},di=function(t){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const e=x?x(t):t.ownerDocument;return j.call(e||t,t,(i?0:a.SHOW_ELEMENT)|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},vi=function(t){return t=ev(t,z," "),t=ev(t,H," "),ev(t,q," ")},fi=function(t){var i;pi(t);const e=null===(i=t.querySelectorAll)||void 0===i?void 0:i.call(t,"template");e&&Hd(e,t=>{mi(t.content)&&fi(t.content)})},pi=function(t){t.normalize();const i=di(t,!0);let e=i.nextNode();for(;e;)e.data=vi(e.data),e=i.nextNode()},gi=function(t){const i=w?w(t):null;return"string"==typeof i&&"form"===Gt(i)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==y(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.removeAttributeNode||"function"!=typeof t.getAttributeNode||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==b(t)||t.childNodes!==g(t))},_i=function(t){if(!b||"object"!=typeof t||null===t)return null;try{const i=b(t);return"number"==typeof i?i:null}catch(t){return null}},mi=function(t){return 11===_i(t)},yi=function(t){return null!==_i(t)};function bi(t,i,s){0!==t.length&&Hd(t,t=>{t.call(e,i,s,Kt)})}const wi=function(t,i){if(t instanceof RegExp)return dv(t,i);if(t instanceof Function){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return Boolean(t(i,...s))}return!1},$i=function(t,i,e,s){return 0===t.length?i:i===e||i===s?yv(i):i},xi=function(t,i){return t!==i&&null===_(t)&&(xt&&oi(t),!0)},Si=function(t,i){if(St&&Zd(St,t),bi(U.beforeSanitizeElements,t,null),xi(t,i))return!0;if(gi(t))return ti(t),!0;const s=Gt(k(t)),n=S(t);if(Z=$i(U.uponSanitizeElement,Z,X,vt),bi(U.uponSanitizeElement,t,{tagName:s,allowedTags:Z}),xi(t,i))return!0;if(function(t,i,e){return!!(ht&&1===e&&t.hasChildNodes()&&!yi(t.firstElementChild)&&dv(Hv,t.textContent)&&dv(Hv,t.innerHTML))||!!(ht&&Jv[i]&&1===e&&T(t)===Mt&&(yi(t.firstElementChild)||"string"==typeof t.textContent&&dv(Hv,t.textContent)))||7===e||!(!ht||8!==e||!dv(qv,t.data))}(t,s,n))return ti(t),!0;if(et[s]||!(nt.tagCheck instanceof Function&&nt.tagCheck(s))&&!Z[s]){const e=function(t,i,e){if(!et[i]&&Ti(i)&&wi(it.tagNameCheck,i))return!1;if($t&&!Et[i]&&!Et[Qd(i)]){const i=_(t),s=g(t);if(s&&i)for(let n=s.length-1;n>=0;--n){const r=t===e?d(s[n],!0):s[n];i.insertBefore(r,p(t))}}return ti(t),!0}(t,s,i);return!(!1!==e||(bi(U.afterSanitizeElements,t,null),!xi(t,i)))||e}if(1===n&&!function(t){const i=T(t),e=Qd(k(t)),s=_(t);let n=Ft,r="template";return s&&1===S(s)&&(n=T(s),r=Qd(k(s))),!!jt[i]&&(i===It?function(t,i,e){return i===Mt?"svg"===t:i===At?"svg"===t&&("annotation-xml"===e||Bt[e]):Boolean(Xt[t])}(e,n,r):i===At?function(t,i,e){return i===Mt?"math"===t:i===It?"math"===t&&zt[e]:Boolean(Qt[t])}(e,n,r):i===Mt?function(t,i,e){return!(i===It&&!zt[e])&&!(i===At&&!Bt[e])&&!Qt[t]&&(qt[t]||!Xt[t])}(e,n,r):"application/xhtml+xml"===Wt)}(t))return ti(t),!0;if(("noscript"===s||"noembed"===s||"noframes"===s)&&dv(Wv,t.innerHTML))return ti(t),!0;if(ut&&3===n){const i=t.textContent,s=vi(i);i!==s&&(Vd(e.removed,{element:t.cloneNode()}),t.textContent=s)}return bi(U.afterSanitizeElements,t,null),xi(t,i)},ki=function(t,i,e){if(st[i])return!1;if(hi(i,t))return!1;if(yt&&("id"===i||"name"===i)&&(e in s||e in Jt))return!1;const n=Q[i]||nt.attributeCheck instanceof Function&&nt.attributeCheck(i,t);if(ot&&dv(W,i))return!0;if(rt&&dv(V,i))return!0;if(!n)return Ti(t)&&wi(it.tagNameCheck,t)&&wi(it.attributeNameCheck,i,t)||"is"===i&&it.allowCustomizedBuiltInElements&&wi(it.tagNameCheck,e);if(Ct[i])return!0;const r=ev(e,K,"");return!(!dv(Y,r)&&("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==sv(e,"data:")||!Pt[t])&&(!lt||dv(G,r))&&e)},Ei=gv({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ti=function(t){return!Ei[Qd(t)]&&dv(J,t)},Pi=function(t,i,e,s){if(P&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!e)switch(h.getAttributeType(t,i)){case"TrustedHTML":return M(s);case"TrustedScriptURL":return function(t){I(),A++;try{return P.createScriptURL(t)}finally{A--}}(s)}return s},Oi=function(t,i,e,s){try{return e?t.setAttributeNS(e,i,s):t.setAttribute(i,s),!gi(t)||(ti(t),!1)}catch(e){return si(i,t),!1}},Ci=function(t,i){return!(!ht||!dv(Gv,i))||"attributename"===Qd(t)&&-1!==sv(i,"href")},Ri=function(t,i){Si(t,i),function(t,i){if(bi(U.beforeSanitizeAttributes,t,null),xi(t,i))return;const s=t.attributes;if(!s||gi(t))return;Q=$i(U.uponSanitizeAttribute,Q,tt,ft);const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let r=s.length;const o=Gt(k(t));for(;r--;){const i=s[r],l=i.name,a=i.namespaceURI,u=i.value,h=Gt(l),c=u;let d="value"===l?c:nv(c),v=!1;n.attrName=h,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,bi(U.uponSanitizeAttribute,t,n),d=n.attrValue,!bt||"id"!==h&&"name"!==h||0===sv(d,wt)||(si(l,t,i),d=wt+d,v=!0),Ci(l,d)?si(l,t,i):n.forceKeepAttr||(!n.keepAttr||!at&&dv(Vv,d)?si(l,t,i):(ut&&(d=vi(d)),ki(o,h,d)?(d=Pi(o,h,a,d),d!==c&&Oi(t,l,a,d)&&v&&Wd(e.removed)):si(l,t,i)))}bi(U.afterSanitizeAttributes,t,null),xi(t,i)}(t,i),mi(t.content)&&Ai(t.content)},Ai=function(t){let i=null;const e=di(t);for(bi(U.beforeSanitizeShadowDOM,t,null);i=e.nextNode();)if(bi(U.uponSanitizeShadowNode,i,null),Ri(i,t),1===S(i)){const t=m(i);mi(t)&&(Ii(t),Ai(t))}ut&&pi(t),bi(U.afterSanitizeShadowDOM,t,null)},Ii=function(t){const i=[{node:t,shadow:null}];for(;i.length>0;){const t=i.pop();if(t.shadow){Ai(t.shadow);continue}const e=t.node,s=1===S(e),n=g(e);if(n)for(let t=n.length-1;t>=0;--t)i.push({node:n[t],shadow:null});if(s){const t=w?w(e):null;if("string"==typeof t&&"template"===Gt(t)){const t=e.content;mi(t)&&i.push({node:t,shadow:null})}}if(s){const t=m(e);mi(t)&&i.push({node:null,shadow:t},{node:t,shadow:null})}}};return e.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,r=null,o=null,l=null;if(Dt=!t,Dt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yi(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return rv(t);case"boolean":return ov(t);case"bigint":return lv?lv(t):"0";case"symbol":return av?av(t):"Symbol()";case"undefined":default:return hv(t);case"function":case"object":{if(null===t)return hv(t);const i=t,e=bv(i,"toString");if("function"==typeof e){const t=e(i);return"string"==typeof t?t:hv(t)}return hv(t)}}}(t)))throw vv("dirty is not a string, aborting");if(!e.isSupported)return t;dt?(Z=vt,Q=ft):Zt(i),e.removed=[];const a=xt&&"string"!=typeof t&&yi(t);let u=[];const h=St;if(a){ht&&ri(t,t=>{const i=S(t);if(7===i||8===i&&dv(qv,t.data)){try{v(t)}catch(t){}return!1}if(1===i){const i=t,e=Gt(k(t));try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&hi("for",e)&&i.removeAttribute("for")}catch(t){}}return!0});const i=k(t);if("string"==typeof i){const e=Gt(i);if(!Z[e]||et[e])throw ei(t),vv("root node is forbidden and cannot be sanitized in-place")}if(gi(t))throw ei(t),vv("root node is clobbered and cannot be sanitized in-place");u=li(t),St=Yd()}else if(yi(t))s=ci("\x3c!----\x3e"),r=s.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?s=r:s.appendChild(r),Ii(s);else{if(!gt&&!ut&&!ct&&-1===t.indexOf("<"))return F(t);if(s=ci(t),!s)return gt?null:mt?C:""}s&&pt&&ti(s.firstChild);const c=a?t:s;try{a&&Ii(t);const i=di(c);for(;o=i.nextNode();)Ri(o,c);a&&function(t,i){const e=St;let s=null;const n=()=>(s||(s=Yd(),Hd(i,t=>{Zd(s,t)})),s);for(let i=0;;i++){const s=li(t),r=[t];let o=!1;if(Hd(s,t=>{11===S(t)?Vd(r,t):o||Xd(e,t)||(o=Xd(n(),t))}),!o)return;if(i>=8)throw vv("the tree kept changing during in-place sanitization; refusing to return it");Hd(r,(i,e)=>{ui(i,e>0,t,n())})}}(t,u)}catch(i){throw a&&(ei(t),ai(t,u)),i}finally{St=h}if(a){if(ai(t,u))throw vv("a node selected for removal could not be safely returned; refusing to sanitize in place");return ut&&fi(t),t}if(gt){if(ut&&fi(s),_t)for(l=L.call(s.ownerDocument);s.firstChild;)l.appendChild(s.firstChild);else l=s;return(Q.shadowroot||Q.shadowrootmode)&&(l=B.call(n,l,!0)),l}const d=()=>ct?s.outerHTML:s.innerHTML;let f=d();return ut&&dv(Fv,f)&&(pi(s),f=d()),ct&&Z["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&dv(Uv,s.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+f),F(f)},e.setConfig=function(){Zt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),dt=!0,vt=Z,ft=Q},e.clearConfig=function(){Kt=null,dt=!1,vt=null,ft=null,P=O,C=""},e.isValidAttribute=function(t,i,e){Kt||Zt({});const s=Gt(t),n=Gt(i);return("string"!=typeof e||!(Ci(i,e)||!at&&dv(Vv,e)))&&ki(s,n,e)},e.addHook=function(t,i){"function"==typeof i&&uv(U,t)&&Vd(U[t],i)},e.removeHook=function(t,i){if(uv(U,t)){if(void 0!==i){const e=qd(U[t],i);return-1===e?void 0:Kd(U[t],e,1)[0]}return Wd(U[t])}},e.removeHooks=function(t){uv(U,t)&&(U[t]=[])},e.removeAllHooks=function(){U={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e}();const tf="Refusing to render web experiment since the viewer is a likely bot",ef={ADD_ATTR:(t,i)=>"target"===t&&"a"===i||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(i),ADD_URI_SAFE_ATTR:["form"]};let sf;const nf={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Wu(i,t),not_regex:(t,i)=>!Wu(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},rf=Dr("[Conversations]"),of="Conversations not available yet.";function lf(t,i){var e,s,n,r,o,l,a;const u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,d=yi(c)?Math.max(h,2048):Math.max(h,c),v=us(us({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Ue(n))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(dr,t)?dr[t]:t}(t);return us(us({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const af=["debug","log","warn","error","info"],uf=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},hf="console",cf="__posthogHandledLogsRequestError",df=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[cf]=!0,e},vf=t=>!!t&&"object"==typeof t&&!0===t[cf];var ff=class{get Of(){return us(us({},this.R),{},{error:(...t)=>{t.some(vf)||this.R.error(...t)}})}constructor(t,i){var e;this.ra=t,this.Ff=i,this.name="logs",this.Lf=!1,this.Df=!1,this.Nf=!1,this.R=Dr("[logs]"),this.Dc=[],this.jf=[],this.Tv=0,this.qf=!1,this.qi=!1,this.Bf=[],this.zf=[],this.Hf=!1,this.Uf=!1,this.Wf=!1,this.Vf=()=>{var t,i;this.qi||(this.Tv=0,null===(t=this.Gf)||void 0===t||t.onReconnect(),null===(i=this.Jf)||void 0===i||i.onReconnect())},this.Lf=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs)}get Qf(){return!0}Zf(){}Kf(){if(!this.Wf){try{this.Wv=typeof window>"u"?void 0:window}catch(t){this.Wv=void 0}this.Wv&&(Vr(this.Wv,"online",this.Vf),this.Wf=!0)}}Yf(t,i,e,s){this.Kf();const n=lf(this.ra.get(),e);return[new $r(this.Xf(t,i),n,this.Of,()=>this.Ff(),t=>t(),void 0,s),n]}tp(){const t=this.ra.get();var i;return this.Gf&&this.ep===t||(null===(i=this.Gf)||void 0===i||i.reset(),this.ep=t,[this.Gf,this.np]=this.Yf(()=>this.Dc,t=>{this.Dc=t})),this.Gf}sp(){const t=this.ra.get();var i;return this.Jf&&this.rp===t||(null===(i=this.Jf)||void 0===i||i.reset(),this.rp=t,[this.Jf,this.op]=this.Yf(()=>this.jf,t=>{this.jf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},hf)),this.Jf}setup(t){if(!this.qi&&!this.qf)return this.qf=!0,this.ia=t,this.R=t.logger.createLogger("[logs]"),xc(t.kv.initialize(),()=>{this.qi||this.Vv(t)})}Vv(t){var i;this.Kf(),(null===(i=this.ra.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Lf=!0),(this.Lf||this.ra.remoteConfigWillArrive&&t.kv.get(this.ra.captureHintKey))&&this.lp();let e=!1;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.qi?s.dispose():(this.ma=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s,n,r,o;this.qi||(this.qi=!0,this.ap(),null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.ia=void 0,this.Nf=!1,null===(i=this.Wv)||void 0===i||i.removeEventListener("online",this.Vf),null===(e=this.up)||void 0===e||e.call(this),this.up=void 0,null===(s=this.Gf)||void 0===s||s.clearQueue(),null===(n=this.Jf)||void 0===n||n.clearQueue(),null===(r=this.Gf)||void 0===r||r.reset(),null===(o=this.Jf)||void 0===o||o.reset())}onRemoteConfig(t){var i,e;if(this.qi)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;xi(s)?this.cp():(null===(e=this.ia)||void 0===e||e.kv.set(this.ra.captureHintKey,!!s),s?(this.Lf=!0,this.Df||this.lp(),this.loadIfEnabled()):this.cp())}reset(){var t,i,e,s;this.ap(),null===(t=this.Gf)||void 0===t||t.clearQueue(),this.Dc=[],null===(i=this.Gf)||void 0===i||i.reset(),null===(e=this.Jf)||void 0===e||e.clearQueue(),this.jf=[],null===(s=this.Jf)||void 0===s||s.reset(),this.Tv=0}captureLog(t){!this.qi&&this.ia&&this.tp().captureLog(t)}captureConsoleLog(t){!this.qi&&this.ia&&this.sp().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.qi&&this.ia&&this.sp().captureLog(t,{context:i,occurredAtMs:e})}av(){var t;this.ap(),null===(t=this.Jf)||void 0===t||t.clearQueue(),this.jf=[]}cp(){this.Lf||this.ap()}lp(){var t;if(this.Hf||!(null===(t=this.Wv)||void 0===t?void 0:t.console))return;const i=lf(this.ra.get()).maxBufferSize;let e=!0;this.zf.push(()=>{e=!1});for(const t of af){let s;try{s=uf(this.Wv.console[t])}catch(t){continue}s&&this.zf.push(tc(this.Wv.console,t,n=>{const r=(...s)=>{try{e&&this.hp(t,s,i)}catch(t){}return n.apply(this.Wv.console,s)};return r.__rrweb_original__=s,r}))}this.Hf=!0,this.dp=setTimeout(()=>{this.ap()},3e4)}hp(t,i,e){var s;if(this.Hf&&!this.Uf&&0!==i.length)if(null===(s=this.ia)||void 0===s?void 0:s.canCapture){if(e>this.Bf.length){this.Uf=!0;try{this.Bf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Ff()})}finally{this.Uf=!1}}}else this.ap()}ap(){if(this.Bf=[],this.Hf){this.Hf=!1,this.dp&&(clearTimeout(this.dp),this.dp=void 0);for(const t of this.zf)t();this.zf=[]}}vp(){const t=this.Bf;return this.ap(),t}get logger(){return this.fp||(this.fp={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.fp}flushLogs(t){this.ia&&(t?this.pp(t):(this.Gf&&this.Gf.flush().catch(t=>this.gp(t)),this.Jf&&this.Jf.flush().catch(t=>this.gp(t))))}flush(){var t=this;return Li(function*(){var i,e;const s=null===(i=t.Gf)||void 0===i?void 0:i.flush().catch(i=>t.gp(i)),n=null===(e=t.Jf)||void 0===e?void 0:e.flush().catch(i=>t.gp(i));yield s,yield n})()}gp(t){vf(t)||this.R.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.qi||!this.Lf||this.Df||this.Nf)return;const t=this.Zf();if(t){this.Nf=!0;try{t((t,i)=>{if(this.Nf=!1,!this.qi&&this.Lf)if(t||!i)this.R.error("Could not load logs script",t),this.ap();else{const t=this.vp();this.up=i.initialize(this.ia),this.Df=!0,t.length>0&&i.replay(this.ia,t)}})}catch(t){throw this.Nf=!1,t}}else this.ap()}Xf(t,i){const e=this.ia;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===ni.LogsQueue?t():void 0,setPersistedProperty(t,e){t===ni.LogsQueue&&i(null!=e?e:[])},Hs:t=>this.Hs(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}Hs(t){return new Promise(i=>{if(Il(this.Tv,3))return void i({kind:"fatal",error:df(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.R.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:df(void 0,"logs request timed out")})},9e4),r=this.Qf;this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.mp(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.R.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:df(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})},t=>{s({kind:"retry-later",error:t})})})}mp(t,i){(0!==t||i)&&(this.Tv=Ml(t,this.Tv,3,()=>this.R.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.")))}pp(t){this.Dc.length>0&&this.yp(t,this.Dc,this.np,this.ia.library.name,t=>{this.Dc=t}),this.jf.length>0&&this.yp(t,this.jf,this.op,hf,t=>{this.jf=t})}yp(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=mr(r,_r(e,this.ia.library.name,this.ia.library.version),s,this.ia.library.version);this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.gp(t))}};const pf=Dr("[NetworkMetrics]"),gf={"http:":80,"https:":443},_f=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),mf=t=>bi(t)&&0===t.toLowerCase().indexOf("text/event-stream"),yf=t=>{try{return t()}catch(t){return}},bf=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=Rl(s))||void 0===e?void 0:e.href)||s}},wf=(t,i,e,s,n,r,o=!1)=>{try{var l,a;const u=n();if(!u)return;const h=e||void 0,c=wh()-s,d=Rl(i.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||i.url,method:i.method},f=gi(u.name)?u.name(v):bi(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),g=us(us(us(us(us({},(t=>{const i=_f.has(t)?t:"_OTHER";return us({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||gf[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:h,durationMs:c}));null===(a=t.metrics)||void 0===a||a.histogram(f,c,{unit:"ms",attributes:g})}catch(t){pf.error("Failed to record network metric",t)}},$f=()=>{},xf=(t,i)=>gi(null==s?void 0:s.fetch)?tc(s,"fetch",e=>function(...s){const n=wh(),r=e.apply(this,s);if(!i())return r;try{var o,l,a;const[e,u]=s,h=bf(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(a=null==e?void 0:e.url)&&void 0!==a?a:e);return r.then(e=>(mf(yf(()=>{var t;return null==e||null===(t=e.headers)||void 0===t?void 0:t.get("content-type")}))||wf(t,h,null==e?void 0:e.status,n,i,void 0,!0),e),e=>{throw wf(t,h,void 0,n,i,e),e})}catch(t){return pf.error("Failed to observe fetch",t),r}}):$f,Sf=(t,i)=>{var e;const n=null==s||null===(e=s.XMLHttpRequest)||void 0===e?void 0:e.prototype;if(!n)return $f;const r=new WeakMap,o=tc(n,"open",t=>function(...i){try{(()=>uu.has(this))()||r.set(this,bf(i[0],i[1]))}catch(t){pf.error("Failed to observe XHR open",t)}return t.apply(this,i)}),l=tc(n,"send",e=>function(...s){let n,o;try{const e=r.get(this);if(e&&i()){const s=wh(),r=()=>mf(yf(()=>this.getResponseHeader("content-type")));let l=!1;o=()=>{2===this.readyState&&(l=r())},n=()=>{this.removeEventListener("loadend",n),this.removeEventListener("readystatechange",o),l||r()||wf(t,e,this.status,s,i)},Vr(this,"readystatechange",o),Vr(this,"loadend",n)}}catch(t){pf.error("Failed to observe XHR send",t)}try{return e.apply(this,s)}catch(t){throw n&&this.removeEventListener("loadend",n),o&&this.removeEventListener("readystatechange",o),t}});return()=>{o(),l()}},kf=new WeakMap,Ef=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),Tf={maxStringLength:2048,truncationSuffix:"..."},Pf={maxStringLength:2048,truncationSuffix:"..."};function Of(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function Cf(t,i){return{}.hasOwnProperty.call(t,i)}function Rf(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function Af(t,i,e=!1){if(!bi(t))return;const s=t.trim();return s?(e?Zn(s,Tf):s).slice(0,i):void 0}function If(t){try{return _i(t)&&!0===t.isError}catch(t){return!1}}function Mf(t){return Zn(t||"Unknown error",Pf).slice(0,2048)}function Ff(t,i){try{return Mf(i?function(t){try{if(!_i(t)||!pi(t.content))return;return t.content.filter(t=>_i(t)&&"text"===t.type&&bi(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):_i(t)&&bi(t.message)?t.message:bi(t)?t:String(t))}catch(t){return"Unknown error"}}function Df(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(i.error,{handled:!0}).$exception_list.map(t=>us(us({},t),{},{value:Mf(t.value)}))}function jf(t,i){if(i)return"Error";try{if(!_i(t))return"Error";let i=bi(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!gi(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return"Error"}}function Lf(t,i){return{message:Ff(t,i),type:jf(t,i)}}Kh.__defaultExtensionClasses=us({},{featureFlags:class extends qc{constructor(t){const i=new bd(t.config,t.Fc());super(i),this.name=yh,this._instance=t,this.bp=i}get zv(){return this._instance.persistence}get Bv(){return md}updateConfig(t,i){this.bp.update(t,i),this.Hv()}},sessionRecording:class{get Yr(){return this._instance.config}get oh(){return this._instance.persistence}get started(){var t;return!!(null===(t=this._p)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return this.isReplayOff?lc:"awaiting_config"===this.wp||"missing_config"===this.wp?this.wp:null!==(t=null===(i=this._p)||void 0===i?void 0:i.status)&&void 0!==t?t:this.wp}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.wp=lc,this.kp=void 0,this.Sp=!1,this.li=void 0,this.un=(()=>{var t,i;if(!(null==o?void 0:o.visibilityState)||"visible"===o.visibilityState)return!0;const e=null==s||null===(t=s.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==e?void 0:e.length)||e.some(t=>"visible"===t.name)})(),this.gn=()=>{var t,i;"visible"===(null==o?void 0:o.visibilityState)&&(this.un=!0,null===(t=this._p)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw hc.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Yr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');const i=this._instance.get_property(pt);var e;bi(i)&&"!"===i[0]&&(null===(e=this.oh)||void 0===e||e.unregister("$session_is_sampled")),(null==o?void 0:o.addEventListener)&&Vr(o,"visibilitychange",this.gn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.Sp=!0,null==o||null===(i=o.removeEventListener)||void 0===i||i.call(o,"visibilitychange",this.gn),t?this.xp(!0):this.stopRecording()}get $p(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),e=!this.Yr.disable_session_recording,n=this.Yr.disable_session_recording||this._instance.consent.isOptedOut();return s&&i&&e&&!n}get isReplayOff(){var t;return!!this.Yr.disable_session_recording||this._instance.consent.isOptedOut()||!1===(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled)}startIfEnabledOrStop(t){if(this.Sp)return;var i;if(this._p)if(this.li!==(null===(i=this.Yr.session_recording)||void 0===i?void 0:i.selectMaskingFn))xo.Dt(uc(this.Yr)),this._p.discard({discardProducerEvents:!0}),this.li=void 0;else if(this._p.isStarted&&this.$p)return void(this.Cp()||this.xp(!0));const e=!yi(Object.assign)&&!yi(Array.from);this.$p&&e?(this.Tp(t),hc.info("starting")):(this.wp=lc,this.stopRecording())}Tp(t){var i,e;if(this.$p)if("awaiting_config"!==this.wp&&"missing_config"!==this.wp&&(this.wp=ac),(null==f||null===(i=f.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=f.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Mp(t);else{var s;const i=this._instance.sessionManager;null===(s=g(this._instance))||void 0===s||s(this._instance,this.Ip,e=>{if(!this.Sp&&this.$p&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),hc.error("could not load recorder",e)):void this.Mp(t);this.wp="disabled"})}}stopRecording(){var t,i;null===(t=this.kp)||void 0===t||t.call(this),this.kp=void 0,null===(i=this._p)||void 0===i||i.stop()}xp(t=!1){var i,e,s;t&&(this.li||(null===(i=this.Yr.session_recording)||void 0===i?void 0:i.selectMaskingFn))&&xo.Dt(uc(this.Yr)),null===(e=this.kp)||void 0===e||e.call(this),this.kp=void 0,null===(s=this._p)||void 0===s||s.discard({discardProducerEvents:t}),this.li=void 0}Ep(){var t,i;null===(t=this.oh)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.oh)||void 0===i||i.unregister("$replay_sample_rate")}Ap(t,i){if(xi(t))return null;const e=Si(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(hc.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Rp(t){if(this.oh){var i,e;const s=this.oh,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ap(null===(i=this.Yr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Ap(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;xi(o)&&this.Ep();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[lt]:us(us({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:us({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:yi(l)?null:l,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};n(),null===(i=this.kp)||void 0===i||i.call(this),this.kp=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n)}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Rp(i),void this.xp()):(this.Rp(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.wp&&(this.wp="missing_config",this._instance.register_for_session({[Ut]:!0}),hc.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this._p)||void 0===e?void 0:e.log)?this._p.log(t,i):hc.warn("log called before recorder was ready")}get Ip(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(lt);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}Pp(){const t=this._instance.get_property(lt);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return hc.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!xi(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Cp(){var t,i,e;return!(null===(t=this.Yr.session_recording)||void 0===t?void 0:t.selectMaskingFn)||!(!0!==(null===(i=f.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i||null===(i=i.record)||void 0===i?void 0:i.supportsSelectMasking)||!0!==(null===(e=f.__PosthogExtensions__)||void 0===e||null===(e=e.initSessionRecording)||void 0===e?void 0:e.supportsSelectMasking)||this._p&&!0!==this._p.supportsSelectMasking)||(this.wp=lc,hc.error("Session recording has not started: the recorder does not support selectMaskingFn."),!1)}Mp(t){var i,e,s,n,r,o;if(this.Sp||!this.$p||!this._instance.sessionManager)return void(this.wp=lc);if(!(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return hc.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Bt]:!0});if(!this.Cp())return;if(this._p||(this._p=null===(o=f.__PosthogExtensions__)||void 0===o?void 0:o.initSessionRecording(this._instance,this.un),this._p._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Cp())return void this.xp(!0);if(!this.Pp()){if("missing_config"===this.wp||"awaiting_config"===this.wp)return;return this.wp="awaiting_config",hc.info("persisted remote config is stale, requesting fresh config before starting"),void new Pa(this._instance).load()}this.wp=ac,null===(e=(s=this._p).setDocumentWasEverVisible)||void 0===e||e.call(s,this.un);const l=null===(n=this.Yr.session_recording)||void 0===n?void 0:n.selectMaskingFn;this._p.start(t),this.li=l,this._p.isStarted&&l!==(null===(r=this.Yr.session_recording)||void 0===r?void 0:r.selectMaskingFn)&&this.startIfEnabledOrStop()}onRRwebEmit(t){var i,e;null===(i=this._p)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this._p||null===(i=this.oh)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this._p)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this._p||null===(i=this.oh)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this._p)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this._p||null===(e=this.oh)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this._p)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;if(this.isReplayOff)return{$recording_status:lc};const i={};for(const t of cc){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);yi(s)||(i[t]=s)}return us(us({},i),(null===(t=this._p)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!!(null===(e=this._p)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this._p)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}},autocapture:class extends mh{constructor(t){super(new Yh(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Op=!1,this._instance=t,this.Fp=this.Lp()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Dp();return!!(t.path||t.search||this.Np(t))}startIfEnabled(){this.isEnabled&&(Fr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Fp=this.Lp(),this.startIfEnabled()}stop(){this.jp&&this.jp(),this.jp=void 0,this.qp&&this.qp(),this.qp=void 0,Fr.info("History API monitoring stopped")}monitorHistoryChanges(){s&&s.history&&(this.Bp("pushState"),this.Bp("replaceState"),this.zp(),this.Np()&&this.Hp())}Bp(t){var i;if(!s||(null===(i=s.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const e=this;tc(s.history,t,i=>function(n,r,o){var l;e.Up(o)&&e.Wp(),i.call(this,n,r,o),e.Vp(t,!e.Op&&"popstate"!==(null==s||null===(l=s.event)||void 0===l?void 0:l.type))})}Lp(){const t=null==s?void 0:s.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Dp(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:_i(t)?t:{}}Np(t=this.Dp()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Gp(t){const i=this.Dp(),e=this.Fp;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Np(i)&&t.hash!==e.hash))}Vp(t,i=!1){try{i||this.Wp();const e=this.Lp();if(!e)return;if(this.Gp(e)){const e=()=>this._instance.capture(ti,{navigation_type:t});i?(this.Jp=e,Promise.resolve().then(()=>this.Wp())):e()}this.Fp=e}catch(i){Fr.error(`Error capturing ${t} pageview`,i)}}Up(t){var i,e;return!(xi(t)||!s)&&(null===(i=Rl(String(t)))||void 0===i?void 0:i.href)!==(null===(e=s.location)||void 0===e?void 0:e.href)}Wp(){const t=this.Jp;if(t){this.Jp=void 0,this.Op=!0;try{t()}catch(t){Fr.error("Error capturing deferred pageview",t)}finally{this.Op=!1}this.Fp=this.Lp()}}zp(){if(this.jp)return;const t=()=>{this.Vp("popstate")};Vr(s,"popstate",t),this.jp=()=>{s&&s.removeEventListener("popstate",t)}}Hp(){if(this.qp)return;const t=()=>{this.Vp("hashchange")};Vr(s,"hashchange",t),this.qp=()=>{s&&s.removeEventListener("hashchange",t)}}},heatmaps:class{get Yr(){return this.instance.config}constructor(t){var i;this.Qp=!1,this.qa=!1,this.Zp=!1,this.Kp=0,this.Yp=null,this.instance=t,this.Qp=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[X]),this.rageclicks=new ah(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return _i(this.Yr.capture_heatmaps)&&this.Yr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Yr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return xi(this.Yr.capture_heatmaps)?xi(this.Yr.enable_heatmaps)?this.Qp:this.Yr.enable_heatmaps:!1!==this.Yr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.qa)return;dc.info("starting..."),this.Xp(),this.gn()}else{var t;clearInterval(null!==(t=this.Yp)&&void 0!==t?t:void 0),this.tg(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[X]:e}),this.Qp=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}discardPending(){this.Kp=Date.now(),clearTimeout(this.eg),this.eg=void 0,this.getAndClearBuffer()}ig(t){vc(t.originalEvent)&&t.timestamp>this.Kp&&this.Jr(t.originalEvent,"deadclick")}gn(){this.Yp&&clearInterval(this.Yp),this.Yp="visible"===(null==o?void 0:o.visibilityState)?setInterval(this.Wc.bind(this),this.flushIntervalMilliseconds):null}Xp(){s&&o&&(this.ng=this.Wc.bind(this),Vr(s,Qt,this.ng),this.sg=t=>this.Jr(t||(null==s?void 0:s.event)),Vr(o,"click",this.sg,{capture:!0}),this.rg=t=>this.og(t||(null==s?void 0:s.event)),Vr(o,"mousemove",this.rg,{capture:!0}),this.lg=new yl(this.instance,_l,this.ig.bind(this)),this.lg.startIfEnabledOrStop(),this.ag=this.gn.bind(this),Vr(o,I,this.ag),this.qa=!0)}tg(){var t;s&&o&&(this.ng&&s.removeEventListener(Qt,this.ng),this.sg&&o.removeEventListener("click",this.sg,{capture:!0}),this.rg&&o.removeEventListener("mousemove",this.rg,{capture:!0}),this.ag&&o.removeEventListener(I,this.ag),clearTimeout(this.eg),this.eg=void 0,null===(t=this.lg)||void 0===t||t.stop(),this.qa=!1)}ug(t,i){const e=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,e){let n=t;for(;n&&To(n)&&!Po(n,"body");){if(n===e)return!1;let t;try{var r,o,l;t=null===(r=null!==(o=null===(l=n.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:s)||void 0===r?void 0:r.getComputedStyle(n).position}catch(t){return!1}if(ai(i,t))return!0;n=Bo(n)}return!1}(Do(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:e),target_fixed:o,type:i}}Jr(t,i="click"){var e;if(Eo(t.target)||!vc(t)||!this.instance.is_capturing())return;const s=this.ug(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Xo(Do(t),this.instance.config.rageclick)&&this.Fo(us(us({},s),{},{type:"rageclick"})),this.Fo(s)}og(t){!Eo(t.target)&&vc(t)&&(yi(this.eg)&&(this.Zp=this.instance.is_capturing()),clearTimeout(this.eg),this.eg=setTimeout(()=>{this.eg=void 0,this.Zp&&this.instance.is_capturing()&&this.Fo(this.ug(t,"mousemove"))},500))}Fo(t){if(!s)return;const i=this.Yr.disable_capture_url_hashes?is(s.location.href):s.location.href,e=this.Yr.custom_personal_data_properties,n=this.Yr.mask_personal_data_properties?[...zl,...e||[]]:[],r=jl(i,n,ql);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(t)}Wc(){this.Rt&&!mi(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:yl,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.Qp=!1,this.qa=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.cg=(t=!1)=>{clearTimeout(this.hg),this.hg=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",us({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>us(us({},t),{},{[`$web_vitals_${i.name}_event`]:us({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dg=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},xi(null==t?void 0:t.name)||xi(null==t?void 0:t.value))return void ec.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.vg(e);if(yi(s))return;const n=Si(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.fg&&t.value>=this.fg)return void ec.error("Ignoring metric with value >= "+this.fg,t);this.Rt.navigationKey!==n&&(this.cg(),this.hg=setTimeout(this.cg,this.flushToCaptureTimeoutMs)),yi(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=yi(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=us(us(us({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,_i(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of oc){const s="url"===e&&"string"==typeof t.attribution[e]?this.vg(t.attribution[e]):t.attribution[e];yi(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;yi(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.cg()},this.pg=()=>{if(this.qa)return;let t,i,e,n,r=!1;const o=f.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,a=(null==l?void 0:l[this.gg])||("web-vitals"===this.gg&&yi(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!yi(a)){const s=a.withoutAttribution,o=this.attributionMetrics;r=!yi(s),t=o.indexOf("LCP")>-1?a.onLCP:(null==s?void 0:s.onLCP)||a.onLCP,i=o.indexOf("CLS")>-1?a.onCLS:(null==s?void 0:s.onCLS)||a.onCLS,e=o.indexOf("FCP")>-1?a.onFCP:(null==s?void 0:s.onFCP)||a.onFCP,n=o.indexOf("INP")>-1?a.onINP:(null==s?void 0:s.onINP)||a.onINP}if(!(t&&i&&e&&n))return void ec.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},h=r&&this.attributionMetrics.indexOf("INP")>-1?us(us({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&t(this.dg.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.dg.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&e(this.dg.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&n(this.dg.bind(this),h);const c=null==s?void 0:s.document;Vr(c,I,()=>{"hidden"===(null==c?void 0:c.visibilityState)&&this.cg(!0)}),Vr(s,"pagehide",()=>this.cg(!0)),this.qa=!0},this.Qp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[et]),this.startIfEnabled()}get mg(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=_i(this.mg)?null===(t=this.mg)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return xi(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||nc:e}get flushToCaptureTimeoutMs(){return(_i(this.mg)?this.mg.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=_i(this.mg)?this.mg.web_vitals_attribution:void 0;return Ei(t)?t?nc:[]:pi(t)?t:rc}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=_i(this.mg)?this.mg.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get fg(){const t=_i(this.mg)&&Si(this.mg.__web_vitals_max_value)?this.mg.__web_vitals_max_value:sc;return t>0&&6e4>=t?sc:t}get isEnabled(){const t=null==l?void 0:l.protocol;if("http:"!==t&&"https:"!==t)return ec.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=_i(this.mg)?this.mg.web_vitals:Ei(this.mg)?this.mg:void 0;return Ei(i)?i:this.Qp}startIfEnabled(){this.isEnabled&&!this.qa&&(ec.info("enabled, starting..."),this.lu(this.pg))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=_i(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=_i(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[et]:e}),this._instance.persistence.register({[ot]:s})),this.Qp=e,this.startIfEnabled()}get gg(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}lu(t){var i;const e=f.__PosthogExtensions__,s=this.gg,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&yi(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null===(i=g(this._instance))||void 0===i||i(this._instance,s,i=>{i?ec.error("failed to load script",i):t()})}vg(t){const i=t||(null==s?void 0:s.location.href);if(!i)return void ec.error("Could not determine current URL");const e=this._instance.config.disable_capture_url_hashes?is(i):i,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...zl,...n||[]]:[];return jl(e,r,ql)}},exceptionObserver:class{constructor(t){var i;this.pg=()=>{var t;if(!s||!this.isEnabled||!(null===(t=f.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=f.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=f.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=f.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.yg&&this.Yr.capture_unhandled_errors&&(this.yg=i(this.captureException.bind(this))),!this.bg&&this.Yr.capture_unhandled_rejections&&(this.bg=e(this.captureException.bind(this))),!this._g&&this.Yr.capture_console_errors&&(this._g=n(this.captureException.bind(this)))}catch(t){Zh.error("failed to start",t),this.wg()}},this._instance=t,this.kg=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[Q]),this.kt=new Hi(us(us({},function(t={}){var i,e,s,n;return{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,R:Zh})),this.Yr=this.Sg(),this.startIfEnabledOrStop()}Sg(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return _i(t)?i=us(us({},i),t):(yi(t)?this.kg:t)&&(i=us(us({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Yr.capture_console_errors||this.Yr.capture_unhandled_errors||this.Yr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Zh.info("enabled"),this.wg(),this.lu(this.pg)):this.wg()}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=g(this._instance))||void 0===e||e(this._instance,"exception-autocapture",i=>{if(i)return Zh.error("failed to load script",i);t()})}wg(){var t,i,e;null===(t=this.yg)||void 0===t||t.call(this),this.yg=void 0,null===(i=this.bg)||void 0===i||i.call(this),this.bg=void 0,null===(e=this._g)||void 0===e||e.call(this),this._g=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.kg=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Q]:this.kg}),this.Yr=this.Sg(),this.startIfEnabledOrStop())}onConfigChange(){this.Yr=this.Sg()}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.kt.consumeRateLimit(n))return void Zh.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.xg=[],this.$g=new gs([new js,new Gs,new Ns,new Ls,new Ws,new qs,new Us,new Vs],function(t,...i){return(e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=Os.test(s)?s.replace(Os,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Rs(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop()}l.push(t)}break}}if(Fs(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=Is(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)As(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Ds(i,t,e)&&(e=t);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return us(us({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",ks,Ps)),this._instance=t,this.xg=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.Cg=Xs(this.Tg()),this.Mg=new Qs(this.Cg)}onConfigChange(){this.Cg=Xs(this.Tg()),this.Mg.setConfig(this.Cg)}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.xg=r,this._instance.persistence&&this._instance.persistence.register({[tt]:this.xg,[it]:o})}get Ig(){var t;const i=!!this._instance.get_property(it),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.$g.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Cg.enabled)try{if(!bi(t)||0===t.trim().length)return void $d.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(t).reduce((e,s)=>Ys.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Eg(i));s.length>0&&$d.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Mg.add(us({[Ks]:t,[Js]:(new Date).toISOString()},e))}catch(t){$d.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Ag(i)){if(this.Rg(i))return this.Pg("Exception dropped: matched a suppression rule"),void $d.info("Skipping exception capture because a suppression rule matched");if(!this.Ig&&this.Og(i))return this.Pg("Exception dropped: thrown by a browser extension"),void $d.info("Skipping exception capture because it was thrown by an extension");if(!this.Ig&&this.Fg(i))return this.Pg("Exception dropped: thrown by an injected browser script"),void $d.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Lg(i))return this.Pg("Exception dropped: thrown by the PostHog SDK"),void $d.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.Cg.enabled&&xi(t.$exception_steps)?this.Dg(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return"string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Qd:!0});return t&&this.Mg.clear(),t}catch(t){return wd(t)||$d.error("Failed to capture exception event. Dropping this exception.",t),void this.Mg.clear()}}catch(t){return void(wd(t)||$d.error("Failed to process exception event. Ignoring this exception.",t))}}Dg(t){try{const i=this.Mg.getAttachable();return 0===i.length?t:us(us({},t),{},{$exception_steps:i})}catch(i){return $d.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Pg(t){this.Cg.enabled&&this.Mg.add({[Ks]:t,[Js]:(new Date).toISOString()})}Eg(t){return _i(t)?us({},t):{}}Tg(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Rg(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(bi(i)&&i.length>0&&t.$exception_types.push(i),bi(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.xg.some(t=>{const e=t.values.map(t=>{const e=Gu[t.operator],s=i[t.key];if(!e||!s)return!1;const n=pi(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return $d.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Og(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&kd.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(xd))||t.some(({type:t,value:i})=>"NoResponse"===t||bi(i)&&Sd.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(xd))))}Fg(t){return t.some(({value:t})=>bi(t)&&Ed.some(i=>t.includes(i)))}Lg(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Ag(t){return!xi(t)&&pi(t)}},productTours:class{get oh(){return this._instance.persistence}constructor(t){this.Ng=null,this.jg=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this.oh&&this.oh.register({[nt]:!!i.productTours}),!pc(this._instance))return!this.Ng&&xi(null===(e=this.oh)||void 0===e?void 0:e.props.ph_product_tours)||fc.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Ng)||void 0===s||s.stop(),this.Ng=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ng&&pc(this._instance)&&this.lu(()=>this.qg())}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=g(this._instance))||void 0===e||e(this._instance,"product-tours",i=>{i?fc.error("Could not load product tours script",i):t()})}qg(){var t;!this.Ng&&(null===(t=f.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Ng=f.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(pi(this.jg)&&!i)return void t(this.jg,{isLoaded:!0});const e=this.oh;if(e){const s=e.props[$t];if(pi(s)&&!i)return this.jg=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!pc(this._instance))return void t([],{isLoaded:!0});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||fc.warn(e):fc.error(e),void t([],{isLoaded:!1,error:e})}const n=pi(i.json.product_tours)?i.json.product_tours:[];this.jg=n,e&&e.register({[$t]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){xi(this.Ng)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ng.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.Ng)||void 0===i||i.showTourById(t)}previewTour(t){this.Ng?this.Ng.previewTour(t):this.lu(()=>{var i;this.qg(),null===(i=this.Ng)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Ng)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Ng)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Ng)||void 0===t||t.previousStep()}clearCache(){var t;this.jg=null,null===(t=this.oh)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.Ng)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.Ng)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.Ng)||void 0===i||i.cancelPendingTour(t)}},siteApps:class{constructor(t){this._instance=t,this.Bg=0,this.zg=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps&&!this._instance.config.require_subresource_integrity}Hg(t,i){if(!i)return;const e=this.globalsForEvent(i);this.zg.push(e),this.zg.length>1e3&&(this.zg=this.zg.slice(10))}get siteAppLoaders(){var t;return null===(t=f._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this._instance.config.opt_in_site_apps&&!this.isEnabled&&_c.critical("opt_in_site_apps is ignored: require_subresource_integrity disables site apps"),this.isEnabled){const t=this._instance._addCaptureHook(this.Hg.bind(this));this.Ug=()=>{t(),this.zg=[],this.Ug=void 0}}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))a[t]={id:u[t],type:t,properties:i};const{$set_once:c,$set:d}=t;return{event:us(us({},gn(t,gc)),{},{properties:us(us(us({},t.properties),d?{$set:us(us({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),d)}:{}),c?{$set_once:us(us({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Wg(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(_c.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(_c.error("prepare_external_dependency_script returned null"),null)}return t}Vg(){var t,i,e,s,n,r,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==o?void 0:o.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Bg++,this.Gg)return this.Jg();const c=[],d=this,v=new WeakSet,f=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),c.push(()=>{t[i]=s})},p=t=>{if(v.has(t))return t;const i=d.Wg(t);return i&&v.add(i),i},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!$i(t));return f(h,"appendChild",t=>function(i){const e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):i}),f(h,"replaceChild",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):e}),[null===(i=u.Element)||void 0===i?void 0:i.prototype,null===(e=u.Document)||void 0===e?void 0:e.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...i){return t.apply(this,g(i))}),f(t,"prepend",t=>function(...i){return t.apply(this,g(i))})}),[null===(n=u.Element)||void 0===n?void 0:n.prototype,null===(r=u.CharacterData)||void 0===r?void 0:r.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...i){return t.apply(this,g(i))}),f(t,"after",t=>function(...i){return t.apply(this,g(i))}),f(t,"replaceWith",t=>function(...i){const e=g(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){const s=p(e);return s?t.call(this,i,s):null}),this.Gg=()=>{c.forEach(t=>t()),this.Gg=void 0},this.Jg()}Jg(){let t=!1;return()=>{var i;t||(t=!0,this.Bg--,0===this.Bg&&(null===(i=this.Gg)||void 0===i||i.call(this)))}}Qg(t,i=!0){const e=this.Vg();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.zg.length&&(_c.info(`Processing ${this.zg.length} events for site app with id ${t.id}`),this.zg.forEach(t=>this.Qg(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Ug)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,_c.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.Qg(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){_c.error(mc+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){_c.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}Zg(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(const i of t)this.setupSiteApp(i)}Kg(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.Qg(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){_c.error(`Error while processing event ${t.event} for site app ${e.id}`,i)}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.Zg(),void this._instance.on("eventCaptured",t=>this.Kg(t))):void _c.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Ug)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;f[`__$$ph_site_app_${t}`]=this._instance,null===(r=f.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return _c.error(mc+t,i)})}else _c.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},surveys:class extends Ec{constructor(t){super(new Tc(t))}},tracingHeaders:class{constructor(t){this._instance=t,this.Yg=void 0,this.Xg=void 0,this.tm=void 0,this.im=void 0,this.nm=[],this.pg=()=>{const{hostnames:t,traceparentTargets:i}=this.sm();var e,s;t||i?(t||pi(this.tm)||(this.tm=[]),this.im!==this.tm&&(this.wg(),this.im=this.tm),yi(this.Yg)&&(this.Yg=null===(e=f.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm)),yi(this.Xg)&&(this.Xg=null===(s=f.__PosthogExtensions__)||void 0===s||null===(s=s.tracingHeadersPatchFns)||void 0===s?void 0:s._patchFetch(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm))):this.wg()}}initialize(){this.startIfEnabledOrStop()}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=g(this._instance))||void 0===e||e(this._instance,"tracing-headers",i=>{if(i)return ic.error("failed to load script",i);t()})}rm(){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}om(){const t=this.rm();return pi(t)?(pi(this.tm)?this.tm.splice(0,this.tm.length,...t):this.tm=[...t],t.length>0?this.tm:void 0):!pi(this.tm)||(this.tm.splice(0),t)?(this.tm=t||void 0,this.tm):void 0}lm(){const t=this._instance.config.trace_propagation_targets,i=pi(t)?t.filter(t=>bi(t)&&!!t):[];return this.nm.splice(0,this.nm.length,...i),i.length>0?this.nm:void 0}sm(){return{hostnames:this.om(),traceparentTargets:this.lm()}}wg(){var t,i;null===(t=this.Yg)||void 0===t||t.call(this),null===(i=this.Xg)||void 0===i||i.call(this),this.Yg=void 0,this.Xg=void 0}startIfEnabledOrStop(){const{hostnames:t,traceparentTargets:i}=this.sm();t||i?this.lu(this.pg):this.wg()}},toolbar:class{constructor(t){this.instance=t}am(t){f.ph_toolbar_state=t}um(){var t;return null!==(t=f.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,e=void 0){var n,r;if(Gr(this.instance.config))return!1;if(!s||!o)return!1;t=null!==(n=t)&&void 0!==n?n:s.location,e=null!==(r=e)&&void 0!==r?r:s.history;try{if(!i){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(t){return!1}i=null==s?void 0:s.localStorage}const n=Pc||Ll(t.hash,"__posthog")||Ll(t.hash,"state");let r;const o=n?es(()=>JSON.parse(atob(decodeURIComponent(n))))||es(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(Oc)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}hm(t){const i=f.ph_load_toolbar||f.ph_load_editor;!xi(i)&&gi(i)?i(t,this.instance):Cc.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==o?void 0:o.getElementById("__POSTHOG_TOOLBAR__"));if(!s||i)return!1;const e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=us(us({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(s.localStorage.setItem(Oc,JSON.stringify(us(us({},n),{},{source:void 0}))),2===this.um())this.hm(n);else if(0===this.um()){var r;this.am(1),null===(r=g(this.instance))||void 0===r||r(this.instance,"toolbar",t=>{if(t)return Cc.error("[Toolbar] Failed to load",t),void this.am(0);this.am(2),this.hm(n)}),Vr(s,"turbolinks:load",()=>{this.am(0),this.loadToolbar(n)})}return!0}dm(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}},experiments:class t{get Yr(){return this._instance.config}constructor(i){this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(i=>{t.vm("retrieved web experiments from the server"),this.fm=new Map,i.forEach(i=>{if(i.feature_flag_key){var e;this.fm&&(t.vm("setting flag key ",i.feature_flag_key," to web experiment ",i),null===(e=this.fm)||void 0===e||e.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);bi(s)&&i.variants[s]&&this.pm(i,s)}else if(i.variants)for(const e in i.variants){const s=i.variants[e];t.gm(s,this._instance)&&this.ym(i.name,e,s.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.vm(tf);else if(!this.Yr.disable_web_experiments){if(xi(this.fm))return this.fm=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.vm("applying feature flags",i),i.forEach(t=>{var i;if(this.fm&&(null===(i=this.fm)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.fm)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.pm(s,i)}})}}previewWebExperiment(){const i=t.getWindowLocation();if(null==i?void 0:i.search){const e=Dl(null==i?void 0:i.search,"__experiment_id"),s=Dl(null==i?void 0:i.search,"__experiment_variant");e&&s&&(t.vm(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.bm(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Yr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Yr.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Yr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}bm(i,e,s){const n=s.filter(t=>t.id===i);n&&n.length>0&&(t.vm(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.ym(n[0].name,e,n[0].variants[e].transforms))}pm(i,e){const s=i.variants[e];t._m(s,this._instance)?this.ym(i.name,e,s.transforms):t.vm(`skipping variant ${e} of experiment ${i.name} because this page does not match its url conditions`)}static gm(i,e){return!xi(i.conditions)&&t._m(i,e)&&t.wm(i)}static _m(i,e){var s;if(xi(i.conditions)||xi(null===(s=i.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,l;const t=ko(e,n.href);return!(null===(r=i.conditions)||void 0===r?void 0:r.url)||nf[null!==(o=null===(l=i.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,t)}return!1}static getWindowLocation(){return null==s?void 0:s.location}static wm(t){var i;if(xi(t.conditions)||xi(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Vl();if(e.utm_source){var s,n,r,o,l,a,u,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==e.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&d&&v&&c}return!1}static vm(t,...i){Fr.info(`[WebExperiments] ${t}`,i)}static km(t,...i){Fr.warn(`[WebExperiments] ${t}`,i)}static Sm(i){("http://www.w3.org/1999/xhtml"===i.namespaceURI&&"template"===i.localName?i.content:i).querySelectorAll("a[target], template").forEach(i=>{var e;if("template"===i.localName)return void("http://www.w3.org/1999/xhtml"===i.namespaceURI&&t.Sm(i));if("http://www.w3.org/1999/xhtml"!==i.namespaceURI||"_blank"!==(null===(e=i.getAttribute("target"))||void 0===e?void 0:e.toLowerCase()))return void i.removeAttribute("target");const s=(i.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));s.push("noopener"),i.setAttribute("rel",s.join(" "))})}ym(i,e,s){this._is_bot()?t.vm(tf):"control"!==e?s.forEach(s=>{if(s.selector){var n;t.vm(`applying transform of variant ${e} for experiment ${i} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);if(!(null==r?void 0:r.length))return void t.km(`no element on this page matches selector ${s.selector} of variant ${e} for experiment ${i}`);const o=new Map;null==r||r.forEach(i=>{if("script"===i.localName.toLowerCase())return;const e=i;if(s.html){var n;const l="http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&"annotation-xml"===i.localName&&(null===(n=i.getAttribute("encoding"))||void 0===n?void 0:n.toLowerCase())||"",a=JSON.stringify([i.namespaceURI,i.localName,l]);let u=o.get(a);if(xi(u)){var r;const e=null!==(r=sf)&&void 0!==r?r:sf=Qv(),n=i.ownerDocument.implementation.createHTMLDocument(""),h=n.createElementNS(i.namespaceURI,i.localName);l&&h.setAttribute("encoding",l);const c=n.createRange();c.selectNodeContents(h);const d="http://www.w3.org/2000/svg"===i.namespaceURI&&/^(foreignObject|desc|title)$/.test(i.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":i.namespaceURI,v=c.createContextualFragment(s.html);"http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(i.localName)?(h.appendChild(v),e.sanitize(h,us(us({},ef),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===h.namespaceURI&&"template"===h.localName?h.content:h).appendChild(e.sanitize(v,us(us({},ef),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),t.Sm(h),u=h.innerHTML,o.set(a,u)}e.innerHTML=u}s.css&&e.setAttribute("style",s.css)})}}):t.vm("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?Uu(r,this.Yr.custom_blocked_useragents):void 0}},conversations:class{constructor(t){this._instance=t,this.xm=void 0,this._conversationsManager=null,this.$m=!1,this.ie=null,this.Cm=!1,this.Tm=0,this.Mm=null,this.Im=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.Mm=null);if(this.Em=t.ok,!t.ok)return;const i=t.config.conversations;xi(i)?this.Mm=null:(Ei(i)?this.xm=i:(this.xm=i.enabled,this.ie=i),this.xm||(this.Mm=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Tm++,this.xm=void 0,this.ie=null,this.Em=void 0,this.Cm=!1,this.Mm=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.$m)return;if(this._instance.config.disable_conversations)return;if(Gr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==f?void 0:f.__PosthogExtensions__;if(t&&!yi(this.xm)&&this.xm)if(this.ie&&this.ie.token){this.$m=!0;try{const i=t.initConversations;if(i)return this.Am(i),void(this.$m=!1);const e=g(this._instance);if(!e)return void this.Rm(j);const s=this.Tm;e(this._instance,"conversations",i=>{if(s!==this.Tm)return this.$m=!1,void this.loadIfEnabled();i||!t.initConversations?this.Rm("Could not load conversations script",i):this.Am(t.initConversations),this.$m=!1})}catch(t){this.Rm("Error initializing conversations",t),this.$m=!1}}else rf.error("Conversations enabled but missing token in remote config.")}Am(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.Cm=!1,rf.info("Conversations loaded successfully")}catch(t){return void this.Rm("Error completing conversations initialization",t)}this.Im&&this._conversationsManager.setTheme(this.Im),this.Pm()}else rf.error("Cannot complete initialization: remote config is null")}Pm(){const t=this.Mm;this.Mm=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}Rm(t,i){rf.error(t,i),this._conversationsManager=null,this.$m=!1,this.Cm=!0}show(){this._conversationsManager?this._conversationsManager.show():rf.warn("Conversations not loaded yet.")}hide(){"open"===this.Mm&&(this.Mm=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.Mm=null,this._conversationsManager.open()):this.Mm="open"}close(){this._conversationsManager?(this.Mm=null,this._conversationsManager.close()):this.Mm="close"}setTheme(t){var i,e;this.Im=us(us(us({},this.Im),t),{},{dark:us(us({},null===(i=this.Im)||void 0===i?void 0:i.dark),null==t?void 0:t.dark)}),null===(e=this._conversationsManager)||void 0===e||e.setTheme(t)}isAvailable(){return!0===this.xm&&!$i(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Gr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Em?"remote_config_failed":yi(this.xm)?this.Em?"disabled_in_project":"remote_config_pending":this.xm?xi(this.ie)||!this.ie.token?"missing_token":(null==f?void 0:f.__PosthogExtensions__)?this.$m?"initializing":this.Cm?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return Li(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(rf.warn(of),null)})()}getMessages(t,i){var e=this;return Li(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(rf.warn(of),null)})()}markAsRead(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(rf.warn(of),null)})()}getTickets(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(rf.warn(of),null)})()}requestRestoreLink(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(rf.warn(of),null)})()}restoreFromToken(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(rf.warn(of),null)})()}restoreFromUrlToken(){var t=this;return Li(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(rf.warn(of),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}rv(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}ov(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}},logs:class extends ff{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:rt,get remoteConfigWillArrive(){var i,e;return!(null===(i=t.Fc)||void 0===i?void 0:i.call(t))||!!(null===(e=f._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=s,xi(n)||(e.sessionStartTimestamp=n),xi(r)||(e.lastActivityTimestamp=r)}if((null==f||null===(i=f.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?is(f.location.href):f.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i)}return e}(t)),this._instance=t,this.name=bh,this.Kf()}get Qf(){return this._instance.__loaded}Zf(){const t=Dr("[logs]"),i=null==f?void 0:f.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=g(this._instance);if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0)})};t.error(j)}},metrics:class{constructor(t){this._instance=t,this.R=Dr("[metrics]"),this.qi=!1,this.Om=!1,this.gn=()=>{"hidden"===(null==o?void 0:o.visibilityState)&&this.flush()}}initialize(){this.onConfigChange(),this.qi||this.Om||!(null==o?void 0:o.addEventListener)||(Vr(o,"visibilitychange",this.gn),this.Om=!0)}onConfigChange(){var t;if(this.qi)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.Fm?this.Fm=(t=>{let i=!0;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,s=xf(t,e),n=Sf(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.Fm&&(this.Fm(),this.Fm=void 0)}tp(){var t;if(this.qi)return;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;if(!this.Gf||this.ep!==i){var e;null===(e=this.Gf)||void 0===e||e.reset(),this.ep=i;const t=function(t){var i,e,s,n,r;const 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!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i);yi(null==i?void 0:i.flushIntervalMs)&&(t.flushIntervalMs=6e4),this.Gf=new Cr(this.Xf(),t,this.R)}return this.Gf}count(t,i=1,e){var s;null===(s=this.tp())||void 0===s||s.count(t,i,e)}gauge(t,i,e){var s;null===(s=this.tp())||void 0===s||s.gauge(t,i,e)}histogram(t,i,e){var s;null===(s=this.tp())||void 0===s||s.histogram(t,i,e)}flush(t){if(!this.Gf)return Promise.resolve();if(t){const i=this.Gf.drainWindow();return i&&this.Go(i,t),Promise.resolve()}return this.Gf.flush().catch(t=>this.R.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Gf)||void 0===t||t.reset()}dispose(){var t,i,e;this.qi=!0,null==o||null===(t=o.removeEventListener)||void 0===t||t.call(o,"visibilitychange",this.gn),this.Om=!1,null===(i=this.Fm)||void 0===i||i.call(this),this.Fm=void 0,null===(e=this.Gf)||void 0===e||e.reset()}Xf(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Go:t=>i.Go(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}Go(t,i){return new Promise(e=>{let s=!1;const n=t=>{s||(s=!0,clearTimeout(r),e(t))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(us(us(us({method:"POST",url:this.Lm(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),"hidden"===(null==o?void 0:o.visibilityState)&&{preferSyncCompression:!0}),{},{fireCallbackOnDrop:!0,callback(t){const 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}`)})}}}))})}Lm(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}},webMCP:class{constructor(t){this._instance=t,this.Dm=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.Dm)return;const t=null==o?void 0:o.modelContext;if(!t||!gi(t.registerTool))return;const i=kf.get(t);if(i)return i.instances.add(this._instance),void(this.Dm=!0);const e={instances:new Set([this._instance])},s=t.registerTool,n=this;tc(t,"registerTool",t=>{const i=t;return function(t,...s){let r=t;try{r=n.Nm(t,e)}catch(e){return i.call(this,t,...s)}return i.call(this,r,...s)}}),t.registerTool!==s&&(kf.set(t,e),this.Dm=!0)}Nm(t,i){if(!t||!gi(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!yi(t)||_i(t)&&Object.keys(t).every(t=>Ef.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!_i(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||_i(t.properties))&&(!t.required||pi(t.required))}(s))return{tool:Rf(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>Cf(n,t)||pi(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return{tool:Rf(t),injected:e};const o=us({},n),l=pi(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The model identifier you are running as, for example "claude-opus-4-8" or "gpt-5.2". Pass "unknown" if you are not certain. Recorded for the site developer\'s analytics.'},l.includes("llm_model")||l.push("llm_model")),{tool:Rf(t,us(us({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:!1,model:!1};for(const e of t.instances){const t=Of(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==t?void 0:t.intent)),i.model||(i.model=!0===(null==t?void 0:t.model))}return i}(i));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,i){if(!_i(t))return{};try{const e=i.intent?Af(t.context,2048,!0):void 0,s=i.model?Af(t.llm_model,256):void 0;return us(us({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(o[0],r),u=function(t,i){const e=t[0];if(!_i(e))return t;try{const s=i.intent&&Cf(e,"context"),n=i.model&&Cf(e,"llm_model");if(!s&&!n)return t;const r=us({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,u)}catch(t){throw s.jm(i,n,l,{error:t,errorResult:!1},a),t}if((c=h)&&"function"==typeof c.then)return Promise.resolve(h).then(t=>{const e=If(t)?{error:t,errorResult:!0}:void 0;return s.jm(i,n,l,e,a),t},t=>{throw s.jm(i,n,l,{error:t,errorResult:!1},a),t});var c;const d=If(h)?{error:h,errorResult:!0}:void 0;return s.jm(i,n,l,d,a),h}}),n}jm(t,i,e,s,n){const r=Date.now()-e.getTime();let o;for(const u of t.instances){var a;const t=Of(u.config.capture_webmcp);if(t){s&&!o&&(o=Lf(s.error,s.errorResult));try{u.capture("$mcp_tool_call",us(us(us({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==l?void 0:l.hostname,$mcp_duration_ms:r,$mcp_is_error:!!s},o?{$mcp_error_type:o.type,$mcp_error_message:o.message}:{}),t.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e})}catch(t){continue}if(s&&o&&u.exceptions&&(null===(a=u.exceptionObserver)||void 0===a?void 0:a.isEnabled))try{const t={$exception_list:Df(u.exceptions,s,o.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==l?void 0:l.hostname};u.exceptionObserver.captureException(t)}catch(t){}}}}}});const Nf={"conversations.js":"sha384-8fPy3IASBzA8AWqnw4GisFo+FugHLE1xLpCaDmKKa+sdTroMj7fsaSQxeJdciOoP","crisp-chat-integration.js":"sha384-qVSPPiM5PHJlVNpiLPyETnf0VXOGevtCqjm2K8EmWnKpLQnY/TMu+iLJ8wWLW8iA","dead-clicks-autocapture.js":"sha384-MYefNCyD6/XLhTOKa8DavuGsgGJvAJO/X4iqoFkAqgGk7H9qgcIoysU9F2qVGMk1","exception-autocapture.js":"sha384-Ot3PAv2xl7Vye6W3KF/aQEiQCB6EmsnQVaLKN/6s0WyUBnPoJUdyyEzh1gGYgqGY","intercom-integration.js":"sha384-gWEoUxf+HEPSZ4GZthxep/3LlEectgXxzj8uWkW7dnvRRV6AKkHXtZEmcb0OqOvn","lazy-recorder.js":"sha384-wvfcx3cUmMBWsygl+eSTZvGBcUaZjgCJcoYUNRc+gUcUy8NfZZV11pqEVwCQ975g","logs.js":"sha384-HGXa+FeVH5JwY3bwubM1EJrP+LG95rh6oU9TbtzHZLs1ECpl5mCXv5FcYF8SgNjk","product-tours.js":"sha384-TlWlQfnDBI1yB3+CuhSTePe38C4bKqQwtK1m0/T6kk/EAsKbWvIya0UeuVkDmSV7","recorder.js":"sha384-t08QiFh+RHB6Jdz9IrPZ5yxf3Dzwdz92Mz0l8Ga/nox8o5+oO0I0gosm16hHDlCF","surveys.js":"sha384-YzGVGUYhh29eFCBFPwTkXhwXFO/T1ZmnwGr4caQVpv1GZg84B0VxXGH7LlB2Gw7g","tracing-headers.js":"sha384-Zb7V2jbC5lJGl7yFzBe8HpCvO3xgJln/lEcqY5xAQ9Z1LLCnbi2glbsfvRPRIYcD","web-vitals-soft-navs.js":"sha384-recN8i2tLQWaeNtCAnErAmFlgg4+33FAHvs8l84aE+SHr6oqLAPwhFVZdP4SfKT6","web-vitals-with-attribution-soft-navs.js":"sha384-f9L4YQQre9lKeUzyvy2Kt4dHLIXECipeMmbr7SPQAOqLi+ZCHbh1I1g/OwsK/zrp","web-vitals-with-attribution.js":"sha384-QVSLDmgzPE1K6g6gBB8QKx/YDQbI2ot0gAcajFIAkGf34SWA3oe6m+WzcmbzpVjD","web-vitals.js":"sha384-wNvgQ2MIesvfVwpUOblaIO/5weiMjR0Ld1eSNtW14MURV24BwfW8Svo6TsBJ3Bk9"},Bf=/^sha384-[A-Za-z0-9+/]{64}$/,Uf=Dr("[ExternalScriptsLoader]"),zf=t=>{const i=null==o?void 0:o.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Hf=(t,i,e)=>{e?Uf.critical(i):Uf.warn(i),t(i)},qf=(t,i,e,s)=>{if(t.config.disable_external_dependency_loading)return Uf.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const n=()=>{if(null==o||o.removeEventListener("DOMContentLoaded",n),t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");if(!o)return e("document not found");let l=o.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",s&&(l.integrity=s),l.src=i,l.onload=t=>{l.__posthog_loading_callback_fired=!0,e(void 0,t)},l.onerror=t=>{l.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return e("prepare_external_dependency_script returned null");if(s&&(!l.src||l.integrity!==s||"anonymous"!==l.crossOrigin))return Hf(e,`prepare_external_dependency_script must keep src, integrity and crossOrigin 'anonymous' for ${i}`,!0);if(t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");const a=zf(l.src);if(a){if(a.integrity!==l.integrity||a.crossOrigin!==l.crossOrigin||a.nonce!==l.nonce)return e("Existing script conflicts with prepared script policy");if(a.__posthog_loading_callback_fired)return e();const t=a.__posthog_loading_error;return t?e(t):(a.addEventListener("load",t=>{a.__posthog_loading_callback_fired=!0,e(void 0,t)}),void a.addEventListener("error",t=>{a.__posthog_loading_error=t,e(t)}))}if(!o.body)return r();if("head"===t.config.external_scripts_inject_target)o.head.appendChild(l);else{const t=o.querySelectorAll("body > script");var u;t.length>0?null===(u=t[0].parentNode)||void 0===u||u.insertBefore(l,t[0]):o.body.appendChild(l)}},r=()=>{null==o||o.addEventListener("DOMContentLoaded",n)};(null==o?void 0:o.body)||zf(i)?n():r()},Wf={},Vf=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",e)};f.__PosthogExtensions__=f.__PosthogExtensions__||{};const Gf=(t,i,e)=>{if(t.config.require_subresource_integrity){if("remote-config"===i||"toolbar"===i)return Hf(e,`${i} can't be integrity-verified, so it is not loaded with require_subresource_integrity`);if(!o||!("integrity"in o.createElement("script")))return Hf(e,"This browser does not support Subresource Integrity",!0);const s=`${i}.js`,n=Nf[s];return bi(n)&&Bf.test(n)?void qf(t,t.requestRouter.endpointFor("assets",`/static/${t.version}/${s}`),e,n):Hf(e,`No integrity hash for ${s}`,!0)}if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void qf(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Wf[n];if("fallback"===s&&r){if(zf(r))return void qf(t,r,e);delete Wf[n]}return void qf(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=Vf(t,i);Wf[n]=s;const r=zf(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),qf(t,s,e)}else e(void 0,r)}:e)}qf(t,Vf(t,i),e)};p=Gf,f.__PosthogExtensions__.loadExternalDependency=Gf,f.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{if(t.config.require_subresource_integrity)return Hf(e,`Site apps can't be integrity-verified, so ${i} is not loaded with require_subresource_integrity`);const s=t.requestRouter.endpointFor("api",i);qf(t,s,e)};const Kf=function(){e.SDK_DIST_CHANNEL="npm";const t=Th[Uh]=new Kh;return function(){function t(){t.done||(t.done=!0,Pu=!1,Lr(Th,function(t){t._dom_loaded()}))}(null==o?void 0:o.addEventListener)?"complete"===o.readyState?t():Vr(o,"DOMContentLoaded",t,{capture:!1}):s&&Fr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=ga,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=wa,exports.PostHog=Kh,exports.ProductTourEventName=xa,exports.ProductTourEventProperties=Sa,exports.SurveyEventName=ya,exports.SurveyEventProperties=ba,exports.SurveyEventType=_a,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=ma,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Kf,exports.posthog=Kf,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="0.14.1",i={DEBUG:(!1,!1),LIB_VERSION:(t,"1.455.1"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:t};var e=i;const s="u">typeof window?window:void 0,n="u">typeof globalThis?globalThis:s,r=null==n?void 0:n.navigator,o=null==n?void 0:n.document,l=null==n?void 0:n.location,a=null==n?void 0:n.fetch,u=(null==n?void 0:n.XMLHttpRequest)&&"withCredentials"in new n.XMLHttpRequest?n.XMLHttpRequest:void 0,h=null==n?void 0:n.AbortController,c=null==n?void 0:n.CompressionStream,d=null==r?void 0:r.userAgent,v="undefined"!=typeof globalThis?globalThis:s;v&&"undefined"==typeof self&&(v.self=v),v&&"undefined"==typeof File&&(v.File=function(){});const f=null!=s?s:{};let p;const g=t=>{var i;return(null==t?void 0:t.config.require_subresource_integrity)?t.__loadExternalDependency:null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency},_="$early_access_features",m="$active_feature_flags",y="$feature_flag_details",b="$feature_flag_errors",w="$feature_flag_evaluated_at",x="$feature_flag_request_id",S="$minimal_flag_called_events",k="$enabled_feature_flags",E="$stored_group_properties",T="$stored_person_properties",P="$flag_call_reported",O="$flag_call_reported_session_id",C="$feature_flag_payloads",R="$override_feature_flags",A="$override_feature_flag_payloads",I="visibilitychange",M="$autocapture_disabled_server_side",F="$surveys",D="$surveys_loaded_at",j="PostHog loadExternalDependency extension not found.",L="$surveys_activated",N="$surveys_activated_session",B="$surveys_activated_timestamps",U="$people_distinct_id",z="distinct_id",H="$device_id",q="$device_model",W="__alias",V="__cmpns",G="$fbc",K="$fbc_persistence",J="$fbp",Y="$fbp_persistence",Z="__timers",X="$heatmaps_enabled_server_side",Q="$exception_capture_enabled_server_side",tt="$error_tracking_suppression_rules",it="$error_tracking_capture_extension_exceptions",et="$web_vitals_enabled_server_side",st="$dead_clicks_enabled_server_side",nt="$product_tours_enabled_server_side",rt="$logs_capture_enabled_server_side",ot="$web_vitals_allowed_metrics",lt="$session_recording_remote_config",at="$session_recording_enabled_server_side",ut="$replay_sample_rate",ht="$replay_override_sampling",ct="$replay_override_linked_flag",dt="$replay_override_url_trigger",vt="$replay_override_event_trigger",ft="$sesid",pt="$session_is_sampled",gt="$session_past_minimum_duration",_t="$session_recording_url_trigger_activated_session",mt="$session_recording_event_trigger_activated_session",yt="$debug_first_full_snapshot_timestamp",bt="$sess_rec_flush_size",wt="$groups",$t="ph_product_tours",xt="$product_tours_activated",St="$product_tours_activated_session",kt="$conversations_widget_session_id",Et="$conversations_ticket_id",Tt="$conversations_widget_state",Pt="$conversations_user_traits",Ot="$user_state",Ct="$client_session_props",Rt="$capture_rate_limit",At="$initial_campaign_params",It="$initial_referrer_info",Mt="$initial_person_info",Ft="$epp",Dt="$posthog_cookieless",jt="$cookieless_mode",Lt="$sdk_debug_extensions_init_method",Nt="$sdk_debug_extensions_init_time_ms",Bt="$sdk_debug_recording_script_not_loaded",Ut="$sdk_debug_replay_stale_config",zt="$sdk_debug_replay_event_trigger_status",Ht="$sdk_debug_replay_linked_flag_trigger_status",qt="$sdk_debug_replay_matched_recording_trigger_groups",Wt="$sdk_debug_replay_pending_trigger_conditions",Vt="$sdk_debug_replay_remote_trigger_matching_config",Gt="$sdk_debug_replay_trigger_groups_count",Kt="$sdk_debug_replay_url_trigger_status",Jt="$session_recording_start_reason",Yt="anonymous",Zt="identified",Xt="identified_only",Qt="beforeunload",ti="$pageview",ii="$pageleave",ei="$identify",si="$groupidentify";var ni=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.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ri=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const oi=["$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"],li=["token"];function ai(t,i){return-1!==t.indexOf(i)}const ui=function(t){return t.trim()},hi=function(t){return t.replace(/^\$/,"")};function ci(t){var i;const 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"}const di=Object.prototype,vi=di.hasOwnProperty,fi=di.toString,pi=Array.isArray||function(t){return"[object Array]"===fi.call(t)},gi=t=>"function"==typeof t,_i=t=>t===Object(t)&&!pi(t),mi=t=>{if(_i(t)){for(const i in t)if(vi.call(t,i))return!1;return!0}return!1},yi=t=>void 0===t,bi=t=>"[object String]"==fi.call(t),wi=t=>bi(t)&&0===t.trim().length,$i=t=>null===t,xi=t=>yi(t)||$i(t),Si=t=>"[object Number]"==fi.call(t)&&t==t,ki=t=>Si(t)&&t>0,Ei=t=>"[object Boolean]"===fi.call(t),Ti=t=>ai(oi,t),Pi=t=>ai(li,t);function Oi(t){return null===t||"object"!=typeof t}function Ci(t,i){return{}.toString.call(t)===`[object ${i}]`}function Ri(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 Ii(t,Error)}}function Ai(t){return"u">typeof Event&&Ii(t,Event)}function Ii(t,i){try{return t instanceof i}catch(t){return!1}}const Mi=[!0,"true",1,"1","yes"],Fi=t=>ai(Mi,t),Di=[!1,"false",0,"0","no"];function ji(t,i,e,s,n,r,o){try{var l=t[r](o),a=l.value}catch(t){return void e(t)}l.done?i(a):Promise.resolve(a).then(s,n)}function Li(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){ji(r,s,n,o,l,"next",t)}function l(t){ji(r,s,n,o,l,"throw",t)}o(void 0)})}}const Ni=["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","lightpanda","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"],Bi=new Map,Ui=function(t,i=[]){if(!t)return!1;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Bi.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Ni.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Bi.size||Bi.clear(),Bi.set(e,r),r};function zi(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),Si(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),zi(null!=n?n:e,i,e,s))}var Hi=class{constructor(t){this.C={},this.I=t.I,this.A=zi(t.bucketSize,0,100,t.R),this.O=zi(t.refillRate,0,this.A,t.R),this.$=zi(t.refillInterval,0,864e5,t.R)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.$);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.A),t.lastAccess=t.lastAccess+e*this.$)}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.A,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={}}};const qi="Mobile",Wi="Android",Vi="Tablet",Gi="Android Tablet",Ki="iPad",Ji="Apple Watch",Yi="Safari",Zi="BlackBerry",Xi="Samsung Internet",Qi="Chrome",te="Chrome iOS",ie="Internet Explorer",ee="Internet Explorer Mobile",se="Opera",ne="Microsoft Edge",re="Firefox",oe="Firefox iOS",le="Nintendo",ae="PlayStation",ue="Xbox",he="Android Mobile",ce="Mobile Safari",de="Windows",ve="Windows Phone",fe="Nokia",pe="Ouya",ge="Generic tablet",_e="Konqueror",me="Oculus Browser",ye="Vivaldi",be="Yandex",we="Whale",$e="DuckDuckGo",xe="Pale Moon",Se="Waterfox",ke="Brave",Ee="Claude",Te="Codex",Pe="ChatGPT",Oe="Google Search App",Ce=new RegExp("Version/(\\d+(\\.\\d+)?)"),Re=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ae=new RegExp(ue,"i"),Ie=new RegExp("PlayStation \\w+","i"),Me=new RegExp("Nintendo \\w+","i"),Fe=new RegExp("BlackBerry|PlayBook|BB10","i"),De={"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"},je=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?ke:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&ai(t,"GSA/")?Oe:ai(t," OPR/")&&ai(t,"Mini")?"Opera Mini":ai(t," OPR/")?se:Fe.test(t)?Zi:ai(t,"IEMobile")||ai(t,"WPDesktop")?ee:ai(t,"OculusBrowser")?me:ai(t,"SamsungBrowser")?Xi:ai(t,"Edge")||ai(t,"Edg/")?ne:ai(t,"Vivaldi/")?ye:ai(t,"YaBrowser/")?be:ai(t,"Whale/")?we:ai(t,"DuckDuckGo/")||ai(t,"Ddg/")?$e:ai(t,"Claude/")?Ee:ai(t,"Codex/")?Te:ai(t,"ChatGPT/")?Pe:ai(t,"FBIOS")?"Facebook Mobile":ai(t,"UCWEB")||ai(t,"UCBrowser")?"UC Browser":ai(t,"CriOS")?te:ai(t,"CrMo")||ai(t,Qi)?Qi:ai(t,Wi)&&ai(t,Yi)?he:ai(t,"FxiOS")?oe:ai(t.toLowerCase(),_e.toLowerCase())?_e:ai(t,"Brave/")?ke:((t,i)=>i&&ai(i,"Apple")||function(t){return ai(t,Yi)&&!ai(t,Qi)&&!ai(t,Wi)}(t))(t,i)?ai(t,qi)?ce:Yi:ai(t,"PaleMoon/")?xe:ai(t,"Waterfox/")?Se:ai(t,re)?re:ai(t,"MSIE")||ai(t,"Trident/")?ie:ai(t,"Gecko")?re:"")},Le={[ee]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Qi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Yi]:[Ce],[ce]:[Ce],[se]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[re]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[oe]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Zi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ce],[he]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Xi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[ke]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ee]:[Re],[Te]:[Re],[Pe]:[Re],[$e]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[xe]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Oe]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ie]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ne=function(t,i,e,s){const n=je(t,i,e,s),r=Le[n];if(yi(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},Be=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[ue,t&&t[1]||""]],[new RegExp(le,"i"),[le,""]],[new RegExp(ae,"i"),[ae,""]],[Fe,[Zi,""]],[new RegExp(de,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ve,""];if(new RegExp(qi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=De[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[de,t]}return[de,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let i="";return t&&t.length>=3&&(i=yi(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Wi,[t[2],t[3],t[4]||"0"].join(".")]:[Wi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const 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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ue=function(t){for(let i=0;Be.length>i;i++){const[e,s]=Be[i],n=e.exec(t),r=n&&(gi(s)?s(n,t):s);if(r)return r}return["",""]},ze=function(t){return Me.test(t)?le:Ie.test(t)?ae:Ae.test(t)?ue:new RegExp(pe,"i").test(t)?pe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ve:/iPad/.test(t)?Ki:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ji:Fe.test(t)?Zi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(fe,"i").test(t)?fe:/(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(qi).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)?Wi:Gi:new RegExp("(pda|Mobile)","i").test(t)?"Generic mobile":new RegExp(Vi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ge:""},He=function(t,i){var e;const s=ze(t);return s===Ki||s===Gi||"Kobo"===s||"Kindle Fire"===s||s===ge?Vi:s===le||s===ue||s===ae||s===pe?"Console":s===Ji?"Wearable":s?qi:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?qi:Vi:"Desktop";var n,r,o},qe=/\bFBAV\/(\d+(?:\.\d+)*)/i,We=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",qe],[/\bFBAN\/EMA\b/i,"Facebook Lite",qe],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",qe],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Ve="[Truncated]",Ge="[Unserializable]";function Ke(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else{const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function Je(t,i){if(!i)return t;let e=[];try{e=Object.keys(i)}catch(t){e=[]}for(const s of e){let e;try{e=i[s]}catch(t){e=Ge}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const Ye=3e5;var Ze=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,Ye);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+Ye))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(Ye,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qe(t,i){return"string"==typeof(e=t)&&Xe.test(e)?t:i();var e}function ts(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function is(t){return t?t.split("#")[0]:t}function es(t){try{return t()}catch(t){return}}function ss(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function ns(t,i,e){return rs.apply(this,arguments)}function rs(){return(rs=Li(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=ss(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function os(t){return os="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},os(t)}function ls(t,i,e){return(i=function(t){var i=function(t){if("object"!=os(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=os(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==os(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function as(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function us(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?as(Object(e),!0).forEach(function(i){ls(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):as(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}let hs,cs,ds,vs;function fs(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(vs&&ps(e,n,cs)&&ps(s,r,ds))return vs;cs=e?us({},e):void 0,ds=s?us({},s):void 0,vs={},null!==(i=hs)&&void 0!==i||(hs={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==hs?void 0:hs[n];if(r){vs[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){vs[e]=i,hs[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),vs}function ps(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var gs=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return Li(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&pi(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)}catch(t){}return us(us({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return Li(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,a=void 0===n?us(us({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),e.push(u),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member")};return s(t),e}buildParsingContext(t){var i;return{chunkIdMap:fs(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(Ri(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return pi(i)?i:void 0}e=Object.getPrototypeOf(e)}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=!1;const o=new Set,l=[],a={},u=(t,i,e=0)=>{const u=h(i,e),c=u.apply;if(u.apply=i=>{l.push(t);try{return c(i)}finally{l.pop()}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||d&&o.has(t))return;d&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||s>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=u.next(v[t])}catch(t){s++,e=this.coerceFallback(h(i+1))}e&&g.push(e)}return us(us({},f),{},{errors:g})},h=(e,s=0)=>us(us({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=u(t,e,s+1);if(!i)throw a;return i},next:t=>u(t,e+1)}),c=h(e);return us(us({},c),{},{apply:t=>{var i;return null!==(i=u(t,e))&&void 0!==i?i:this.coerceFallback(c)}})}};const _s=/^([a-z][a-z0-9.+-]+):/i,ms=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ys(t){if(!t||"<anonymous>"===t)return!1;const i=_s.exec(t);return!i||ms.includes(i[1].toLowerCase())}function bs(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ys(i)};return yi(s)||(r.lineno=s),yi(n)||(r.colno=n),r}const ws=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},$s=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xs=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ss=/\((\S*)(?::(\d+))(?::(\d+))\)/,ks=(t,i)=>{const e=$s.exec(t);if(e){const[,t,s,n]=e;return bs(i,t,"?",+s,+n)}const s=xs.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=Ss.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=ws(s[1]||"?",s[2]);return bs(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Es=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ts=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ps=(t,i)=>{const e=Es.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Ts.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],s=e[1]||"?";return[s,t]=ws(s,t),bs(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Os=/\(error: (.*)\)/;function Cs(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Rs(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=!0;for(let n=0;i>n;n++)if(!Cs(t[e+n],t[e+i+n])){s=!1;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function As(t,i){const e=i.start+i.length,s=Ms(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function Is(t,i){let e=i.start;for(;e>0&&Cs(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Ms(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&Cs(t[s],t[s-i.length]);)s++;return s-e}function Fs(t,i){const e=i[0];let s=t.length-(e?Is(t,e):0);for(const e of i)s-=Ms(t,e);return s}function Ds(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return!1}var js=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=bi(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){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return Ci(t,"DOMException")}isDOMError(t){return Ci(t,"DOMError")}},Ls=class{match(t){return Ri(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Ns=class{match(t){return!!Ci(t,"ErrorEvent")&&(null!=t.error||this.$r(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return us(us({},s),{},{stack:null!==(e=this.Lr(t))&&void 0!==e?e:s.stack,synthetic:!0})}$r(t){return bi(t.message)&&t.message.length>0}Lr(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(bi(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Bs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Us=class{match(t){return"string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}getInfos(t){let i="Error",e=t;const s=t.match(Bs);return s&&(i=s[1],e=s[2]),[i,e]}};const zs=["fatal","error","warning","log","info","debug"];function Hs(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";let s="";for(const t of e){const e=s?`${s}, ${t}`:t;if(e.length>i)break;s=e}return s}var qs=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Ai(t))return t.constructor.name;const i="name"in t?t.name:void 0;return bi(i)&&!wi(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let 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;const i=this.getObjectClassName(t);return`${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${Hs(t)}`}isSeverityLevel(t){return bi(t)&&!wi(t)&&zs.indexOf(t)>=0}getStack(t){try{return bi(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:bi(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(Ri(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ws=class{match(t){return Ai(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Hs(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},Vs=class{match(t){return Oi(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?void 0:e.stack,synthetic:!0}}},Gs=class{match(t){return Ci(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ai(t))return!1;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return Oi(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}:i.apply(s)}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}};const Ks="$message",Js="$timestamp",Ys=new Set([Ks,Js]),Zs={enabled:!0,max_bytes:32768};function Xs(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Zs.enabled,max_bytes:tn(t.max_bytes,Zs.max_bytes)}:us({},Zs)}var Qs=class{constructor(t){this.ns=[],this.ss=0,this.Yr=Xs(t)}setConfig(t){this.Yr=Xs(t),this.rs()}add(t){const i=function(t){let i;try{i=ci(t)}catch(t){return}try{const t=JSON.parse(i);if(!_i(t))return;const e=t,s=e[Ks],n=e[Js];if(!bi(s)||0===s.trim().length)return;if(!bi(n)&&!Si(n))return;return{step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Yr.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Yr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function tn(t,i){if(!Si(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const en=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function sn(t){return"string"==typeof t||t}function nn(t){return"string"==typeof t?t:void 0}const rn=["$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","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],on="NativeGzipValidationError",ln=t=>t.length>=2&&31===t[0]&&139===t[1],an=(t,i)=>t===ri.GZipJS||i===ri.GZipJS||"gzip"===i,un=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let hn;const cn=t=>{throw ts(on,`Native gzip produced invalid output: ${t}`)};let dn=0,vn=!1;const fn=function(){var t=Li(function*(t,i){18>t.size&&cn("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());ln(e)&&8===e[2]||cn("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer()),n=i.length>>>0;s.getUint32(4,!0)!==n&&cn("invalid-size"),(vn||3>dn)&&(s.getUint32(0,!0)!==(t=>{const i=(()=>{if(hn)return hn;hn=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;hn[t]=i>>>0}return hn})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&(vn=!0,cn("invalid-crc")),dn++)});return function(i,e){return t.apply(this,arguments)}}();function pn(){return pn=Li(function*(t,i=!0,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=Li(function*(t){try{yield n.abort(t)}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield fn(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s}),pn.apply(this,arguments)}function gn(t,i){if(null==t)return{};var e,s,n=function(t,i){if(null==t)return{};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s]}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}const _n="[redacted]",mn=/^[A-Za-z0-9+/\n\r]+=*$/,yn=/^[A-Za-z0-9_-]+={0,2}$/,bn=/[-_]/,wn=/^data:[^,\s]*;base64,/i,$n=/^[A-Za-z0-9+/_-]+={0,2}$/,xn=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Sn=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,kn=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,En=/[\s<>"]/,Tn=(()=>new RegExp(kn.source,"i"))(),Pn=/[a-z][a-z0-9+.-]{0,63}:\/\//i,On=(()=>new RegExp(`^${Pn.source}`,"i"))(),Cn=(()=>new RegExp(Pn.source,"gi"))(),Rn=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,An=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,In=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Mn=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Fn=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Dn=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,jn=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Ln=/\d+/g,Nn=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Bn=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Un(t){return function(t){return Sn.test(t)}(t)||Rn.test(t)||An.test(t)}function zn(t){return t.split("&",129).length>128}function Hn(t,i,e){return Un(t)||i.includes(";")&&function(t){return t.split(";").some(t=>Un(t.split("=",1)[0]))}(i)?_n:Tn.test(i)?e?Jn(i,{allowNestedUrls:!1,stripPunctuation:!0}):_n:i}function qn(t,i){const e=new URLSearchParams;let s=!1,n=!1;for(const[r,o]of new URLSearchParams(t)){const t=Yn(r),l=Yn(o);s||(s=t!==r||l!==o);const a=Hn(t,l,i);s||(s=a!==l),n=Un(t)||a!==l,e.append(t,a)}return{changed:s,lastFieldSensitive:n,serialized:e.toString()}}function Wn(t,i){if(!t.includes("="))return{value:Vn(t,i),lastFieldSensitive:!1};const e=qn(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function Vn(t,i){return i?Jn(t,{allowNestedUrls:!1,stripPunctuation:!0}):Tn.test(t)?_n:t}function Gn(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function Kn(t,i){var e;if(t.length>8192&&On.test(t))return _n;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s)}catch(t){return _n+n}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(zn(o)||zn(a.head)||zn(null!==(e=a.tail)&&void 0!==e?e:""))return _n+n;let u=!1;(r.username||r.password)&&(r.username=_n,r.password="",u=!0);const h=qn(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,u=!0);const c=Wn(a.head,i.allowNestedUrls),d=null===a.tail?null:(v=a.tail,c.lastFieldSensitive?{value:""===v?"":_n,lastFieldSensitive:!0}:Wn(v,i.allowNestedUrls));var v;const f=null===d?c.value:`${c.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:c:h;return(u?Yn(r.toString()):s)+(p.lastFieldSensitive?"":n)}function Jn(t,i){return t.replace(kn,e=>function(t,i){const e=function(t){if(!t.includes("://"))return[];const i=[...t.matchAll(Cn)].map(t=>t.index),e=[],s={query:!1,fragment:!1,fragmentQuery:!1};let n=0,r=!1,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const a=t[l];Gn(a,s,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return e}(t);if(0===e.length)return Kn(t,i);let s="",n=0;for(const r of e)s+=Kn(t.slice(n,r),us(us({},i),{},{stripPunctuation:!1})),n=r;return s+Kn(t.slice(n),i)}(e,us(us({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function Yn(t){return t.replace(xn,_n)}function Zn(t,i){return function(t){return t.length>=10240&&(mn.test(t)||function(t){const i=wn.exec(t);if(!i)return!1;let e;try{e=decodeURIComponent(t.slice(i[0].length))}catch(t){return!1}return $n.test(e.replace(/[\r\n]/g,""))}(t)||bn.test(t)&&yn.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!En.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return Jn(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let i=t.replace(In," ");return i=i.replace(Mn,_n),i=i.replace(Fn,_n),i=i.replace(Dn,`$1${_n}`),i=function(t){let i="",e=0;for(let s=er(t,0);null!==s;s=er(t,s[1]))i+=t.slice(e,s[0])+sr(t.slice(s[0],s[1])),e=s[1];return i+t.slice(e)}(i),i=i.replace(jn,_n),i=i.replace(Nn,`$1${_n}`),i=i.replace(Bn,`$1${_n}`),i}(Yn(t))),i)}function Xn(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return!1;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function Qn(t,i){const e=t.charCodeAt(i);return e>=48&&57>=e}function tr(t,i){const e=t.charCodeAt(i);return Qn(t,i)||95===e||e>=65&&90>=e||e>=97&&122>=e}function ir(t,i){let e=i;for(;Qn(t,e);)e++;return e}function er(t,i){for(let e=i;t.length>e;e++){if(!Qn(t,e)||tr(t,e-1))continue;let i=0,s=-1,n=e;for(;;){const e=ir(t,n);if(i+=e-n,13>i||tr(t,e)||(s=e),n=e+1,!" ./-".includes(t.charAt(e))||!Qn(t,n))break}if(s>=0)return[e,s];e=n-1}return null}function sr(t){const i=[];for(let e=Ln.exec(t);null!==e;e=Ln.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&Xn(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+_n,s=i[o].end,n=o+1)}return e+t.slice(s)}const nr={}.propertyIsEnumerable;function rr(t,i){try{return ar(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function or(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:Ve};if(e.remainingNodes--,Ei(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>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)};const e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Ke(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Ve};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?Ke(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return or(n.call(t),i,e,s+1)}catch(t){}return pi(t)?{arrayValue:{values:lr(t,i,e,s+1)}}:{kvlistValue:{values:ar(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ke(String(t))}}function lr(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(xi(r))continue;n.push(or(r,i,e,s))}catch(t){n.push({stringValue:Ge})}return t.length>o&&n.push({stringValue:Ve}),n}function ar(t,i,e,s){const n=[];for(const r in t)if(nr.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if($i(o)||yi(o))continue;n.push({key:Ke(r),value:or(o,i,e,s)})}catch(t){n.push({key:Ke(r),value:{stringValue:Ge}})}}return n}function ur(t,i,e){return us(us(us(us({},Je({},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":e})}const hr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function cr(t,i){const e=Je({},t),s={};for(const t of hr)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...rr(e,i),...rr(s,i)]}const dr={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const vr={text:"INFO",number:9},fr={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:vr,warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}};function pr(t){try{return Ke(String(t))}catch(t){return Ge}}function gr(t,i,e,s){const n=t.level||"info",{text:r,number:o}=fr[n]||vr,l=function(t=Date.now()){return String(t)+"000000"}(Si(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),xi(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),xi(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);const u=us({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(i){t=[]}for(const i of t){let t;try{t=h[i]}catch(i){t=Ge}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:pr(t.body)},attributes:rr(u,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),yi(t.trace_flags)||(c.flags=t.trace_flags),c}function _r(t,i,e){return ur(t,i,e)}function mr(t,i,e,s){return{resourceLogs:[{resource:{attributes:cr(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var yr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=ss(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function br(){return.75+.5*Math.random()}function wr(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,t)))*e)}var $r=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o,l=()=>!1){var a;this._instance=t,this.Yr=i,this.R=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=l,this.gs=new yr(()=>this.ys()),this.bs=null,this._s=0,this.ws=0,this.ks=null,this.Ss=new Ze,this.xs=0,this.$s=1,this.Cs=0,this.Ts=0,this.Ms=!1,this.Is=i.maxBufferSize,this.Es=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.As=i.flushIntervalMs,this.Rs=i.maxBatchRecordsPerPost,this.Ps=i.rateCapWindowMs,this.Os=i.maxLogsPerInterval}clearQueue(){this.ws++,this._instance.setPersistedProperty(ni.LogsQueue,[])}get throttled(){return this.Ss.isOpen()}reset(){this.gs.clear(),this.Cs=0,this.Ts=0,this.Ms=!1,this.xs=0,this.$s=1,this.Ss.reset(),this.Rs=this.Yr.maxBatchRecordsPerPost}onReconnect(){this.xs=0,this.$s=1,this.Ss.isOpen()?this.Fs()&&this.Ls():this.ys()}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Ds(t);if(null===s)return;if(!s.body)return void this.R.info("Log was rejected in beforeSend function");if(!this.Ns())return;const n={record:gr(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.R,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.js(n))}Ds(t){const i=this.Yr.beforeSend;if(!i)return t;const e=pi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for log:",t),null}return s}Ns(){if(void 0===this.Os)return!0;const t=Date.now(),i=t-this.Cs;return this.Ps>i&&i>=0||(this.Cs=t,this.Ts=0,this.Ms=!1),this.Os>this.Ts?(this.Ts++,!0):(this.Ms||(this.R.warn(`captureLog dropping logs: exceeded ${this.Os} logs per ${this.Ps}ms`),this.Ms=!0),!1)}flush(){var t=this;return Li(function*(){if(!t._instance.isDisabled)return t.bs||(t.bs=t.qs().finally(()=>{t.bs=null})),t.bs})()}qs(){var t=this;return Li(function*(){var i;if(t.gs.clear(),t.Bs())return;let e=null!==(i=t._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;if(t.Bs())return;const i=t.ws;t._s=0;const s=Math.min(e.length,t.Rs),l=e.slice(0,s),a=mr(l.map(t=>t.record),t.zs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Hs(a);if(t.ws!==i)return;if("too-large"===u.kind&&l.length>1)t.Rs=Math.max(1,Math.floor(l.length/2)),t.R.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Rs}`);else{if(t.Ss.record(u),t.gs.pending&&t.gs.arm(Math.max(t.As,t.Ss.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.R.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Yr.maxBatchRecordsPerPost>t.Rs&&(t.Rs=Math.min(t.Yr.maxBatchRecordsPerPost,t.Rs+1)),yield t.Us(l.length),e=null!==(o=t._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(){return!!this.ps()&&(this.Fs()&&this.clearQueue(),!0)}Us(t){var i=this;return Li(function*(){var e;const s=Math.max(0,t-i._s),n=null!==(e=i._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ni.LogsQueue,n.slice(s)),yield i.vs()})()}zs(){return _r(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}js(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(ni.LogsQueue))&&void 0!==i?i:[];this.Es>e.length||(e.shift(),this._s++,this.R.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ni.LogsQueue,e),this.Is>e.length||this.Ss.isOpen()?this.Ls():this.ys()}Ls(){this.gs.pending||this.gs.arm(Math.max(this.As,this.Ss.remainingMs()))}Ws(){return Math.max(wr(this.As,this.xs,this.$s,3e4),this.Ss.remainingMs())}Fs(){const t=this._instance.getPersistedProperty(ni.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return Li(function*(){i.gs.clear();const e=i.flush().catch(()=>{});void 0!==t?yield ns(e,t):yield e})()}flushWithTimeout(t){var i=this;return Li(function*(){const e=i.flush();yield ns(e,t,()=>{e.catch(()=>{})})})()}flushInBackground(){if(this.ks)return this.ks;const t=this.flush().then(()=>{this.xs=0,this.$s=1},t=>{this.xs++,this.$s=br(),this.R.error("PostHog logs flush failed:",t)}).finally(()=>{this.ks===t&&(this.ks=null),!this._instance.isDisabled&&this.Fs()&&this.gs.armNoEarlierThan(this.Ws())});return this.ks=t,t}ys(){this.flushInBackground()}};const xr=/^[0-9a-f]+$/;function Sr(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&xr.test(t)}const kr=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Er="00",Tr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Pr(t){return String(t)+"000000"}function Or(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Cr=class{constructor(t,i,e){this._instance=t,this.Yr=i,this.R=e,this.Vs=new Map,this.gs=new yr(()=>this.flush().catch(t=>{this.R.error("Metrics flush failed:",t)})),this.bs=null,this.Gs=null,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ks=new Map,this.Ys=new Set,this.Xs=!1,this.Ss=new Ze,this.xs=0,this.$s=1,this.Po=0}count(t,i=1,e){this.Fo({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.Fo({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.Fo({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes,bounds:pi(null==e?void 0:e.bounds)?e.bounds.slice():null==e?void 0:e.bounds})}flush(){var t=this;const i=this.bs,e=function(){var e=Li(function*(){i&&(yield i.catch(()=>{})),yield t.No()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.bs===e&&(this.bs=null)});return this.bs=e,e}flushCoalesced(){var t,i;return this.jo()?null!==(t=this.bs)&&void 0!==t?t:Promise.resolve():(this.Gs||(this.Gs=(null!==(i=this.bs)&&void 0!==i?i:Promise.resolve()).catch(()=>{}).then(()=>(this.Gs=null,this.jo()?void 0:this.flush()))),this.Gs)}jo(){return this.xs>0||this.Ss.remainingMs()>0}drainWindow(){if(0===this.Vs.size)return null;const t=this.Vs;return this.qo(),this.Bo(t)}reset(){this.Po++,this.Ss.reset(),this.xs=0,this.$s=1,this.gs.clear(),this.bs=null,this.Gs=null,this.qo(),this.Ks=new Map,this.Xs=!1}qo(){this.Vs=new Map,this.Js=!1,this.Qs=new Map,this.Zs=new Set,this.Ys=new Set}Fo(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Ds(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.R.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.R.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"!==i.type&&"gauge"!==i.type&&"histogram"!==i.type)return void this.R.warn(`Dropping metric '${i.name}': unknown type '${String(i.type)}'`);if("count"===i.type&&0>i.value)return void this.R.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?us({},i.attributes):void 0,s=Or(i.type,i.name,i.unit,e)}catch(t){return void this.R.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n,r=this.Vs.get(s);if(!r&&!this.zo())return;if("histogram"===i.type&&(n=this.Ho(i.name,i.unit,i.bounds),!n))return;r||(r={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now(),hist:n&&Ar(n)},this.Vs.set(s,r));const o=this.Qs.get(i.name);void 0===o?this.Qs.set(i.name,i.type):o===i.type||this.Zs.has(i.name)||(this.Zs.add(i.name),this.R.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.Uo(r,i.value);const l=this.Wo();l&&(r.exemplar=us(us({},l),{},{value:i.value,timeMs:Date.now()})),this.Ls()}Wo(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=kr.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return"ff"===e||"00"===e&&o||!function(t){return Sr(t,32,"00000000000000000000000000000000")}(s)||!function(t){return Sr(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":Er)};var e}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}}zo(){return this.Yr.maxSeriesPerFlush>this.Vs.size||(this.Js||(this.Js=!0,this.R.warn(`Metric series cap reached (${this.Yr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ho(t,i,e){if(void 0!==e&&!function(t){if(!pi(t)||0===t.length)return!1;for(let i=0;t.length>i;i++)if(!Number.isFinite(t[i])||i>0&&t[i-1]>=t[i])return!1;return!0}(e))return void this.R.warn(`Dropping histogram '${t}': bounds must be a non-empty array of finite, strictly increasing numbers`);const s=Or("histogram",t,i,void 0),n=this.Ks.get(s);if(n)return this.Vo(t,s,n,e),n;if(this.Ks.size>=this.Yr.maxSeriesPerFlush){if(this.Xs||(this.Xs=!0,this.R.warn(`Histogram bounds limit reached (${this.Yr.maxSeriesPerFlush} distinct histograms); new histograms that pass custom bounds are dropped. Reduce histogram name cardinality.`)),e&&!Rr(e,Tr))return;return Tr}const r=e?e.slice():Tr;return this.Ks.set(s,r),r}Vo(t,i,e,s){Rr(e,null!=s?s:Tr)||this.Ys.has(i)||(this.Ys.add(i),this.R.warn(`Histogram '${t}' already uses the bounds [${e.join(", ")}]; samples that pass different bounds are recorded in those buckets.`))}Uo(t,i){switch(t.type){case"count":var e;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":{const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,e.bounds)]+=1;break}}}Ds(t){const i=this.Yr.beforeSend;if(!i)return t;const e=pi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for metric:",t),null}return s}Ls(){this.gs.pending||this.gs.arm(this.Ws())}Ws(){return Math.max(wr(this.Yr.flushIntervalMs,this.xs,this.$s,3e4),this.Ss.remainingMs())}No(){var t=this;return Li(function*(){if(t.gs.clear(),0===t.Vs.size)return;const i=t.Vs;t.qo();const e=t.Po,s=yield t._instance.Go(t.Bo(i));if(e===t.Po)switch(t.Ss.record(s),"retry-later"===s.kind?(t.xs++,t.$s=br()):(t.xs=0,t.$s=1),t.gs.pending&&t.gs.arm(t.Ws()),s.kind){case"ok":return;case"retry-later":return t.Jo(i),void t.gs.armNoEarlierThan(t.Ws());case"too-large":return void t.R.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.R.error("Failed to send metrics batch:",s.error)}})()}Bo(t){return i=this.Qo(t),e=function(t,i,e){return ur(t,i,e)}(this.Yr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:cr(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}Qo(t){const i=Pr(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Or(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=us({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const a=rr(null!==(s=o.attributes)&&void 0!==s?s:{},this.R),u=Pr(o.windowStartMs),h=Ir(o.exemplar);if("count"===o.type){var n;const t=us({attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=us({attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t)}else{const t=o.hist,e=us({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:t.count,sum:t.sum,min:t.min,max:t.max,bucketCounts:t.bucketCounts,explicitBounds:t.bounds},h);l.histogram.dataPoints.push(e)}}return Array.from(e.values())}Jo(t){for(const[n,r]of t){var i;const t=this.Vs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case"count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case"gauge":break;case"histogram":{const i=t.hist,e=r.hist;i.count+=e.count,i.sum+=e.sum,i.min=Math.min(i.min,e.min),i.max=Math.max(i.max,e.max);for(let t=0;i.bucketCounts.length>t;t++)i.bucketCounts[t]+=e.bucketCounts[t];break}}else this.zo()&&this.Vs.set(n,r)}}};function Rr(t,i){if(t===i)return!0;if(t.length!==i.length)return!1;for(let e=0;t.length>e;e++)if(t[e]!==i[e])return!1;return!0}function Ar(t){return{bounds:t,count:0,sum:0,min:1/0,max:-1/0,bucketCounts:new Array(t.length+1).fill(0)}}function Ir(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Pr(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const Mr=(t,{debugEnabled:e}={})=>{const s={N(s,...n){let r;try{r=typeof window>"u"?void 0:window}catch(t){return}r&&(i.DEBUG||r.POSTHOG_DEBUG||e)&&!yi(r.console)&&r.console&&("__rrweb_original__"in r.console[s]?r.console[s].__rrweb_original__:r.console[s])(t,...n)},debug(...t){s.N("debug",...t)},info(...t){s.N("log",...t)},warn(...t){s.N("warn",...t)},error(...t){s.N("error",...t)},critical(...i){console.error(t,...i)},uninitializedWarning(t){s.error(`You must initialize PostHog before calling ${t}`)},createLogger:(i,e)=>Mr(`${t} ${i}`,e)};return s},Fr=Mr("[PostHog.js]"),Dr=(t,i)=>Fr.createLogger(t,i);function jr(t,i){pi(t)&&t.forEach(i)}function Lr(t,i){if(!xi(t))if(pi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)vi.call(t,e)&&i(t[e],e)}const Nr=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Br(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const Ur=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Fr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Fr.critical(t)}}},zr=function(t){const i={};return Lr(t,function(t,e){(bi(t)&&t.length>0||Si(t))&&(i[e]=t)}),i};function Hr(t){const i=us({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const qr=["herokuapp.com","vercel.app","netlify.app"];function Wr(t){const i=null==t?void 0:t.hostname;if(!bi(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of qr)if(e===t)return!1;return!0}function Vr(t,i,e,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r})}function Gr(t){return"ph_toolbar_internal"===t.name}const Kr=t=>{if(o){try{const i=t+"=",e=o.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==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}};var Jr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let 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 t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Yr=class{generate(){const t=this.generateOrAbort();if(!yi(t))return t;{this.Mt=0;const t=this.generateOrAbort();if(yi(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Si(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Mt)this.Mt=t,this.Tt();else{if(this.Mt>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Mt++,this.Tt())}return Jr.fromFieldsV7(this.Mt,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.At.nextUint32())}Tt(){this.It=1024*this.At.nextUint32()+(1023&this.At.nextUint32())}constructor(){this.Mt=0,this.It=0,this.At=new Qr}};const Zr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let Xr;var Qr=class{nextUint32(){var t;return this.Rt.length>this.Et||((null!==(t=Xr)&&void 0!==t?t:Xr="u">typeof window&&!yi(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Zr(t)}}:Zr)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let to;const io=()=>eo().toString(),eo=()=>(to||(to=new Yr)).generate();let so="";const no=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let ro=null;const oo={Ot(){if(!$i(ro))return ro;if(ro=!1,o)try{const t=`__ph_cookie_support_${io()}`;oo.$t(t,"xyz"),ro='"xyz"'===Kr(t),oo.Dt(t)}catch(t){ro=!1}return ro},Ft(t){Fr.error("cookieStore error: "+t)},Lt:Kr,Pt(t){let i;try{i=JSON.parse(oo.Lt(t))||{}}catch(t){}return i},$t(t,i,e,s,n){if(!o)return!1;try{let r="",l="";const a=function(t,i){if(i){let i=function(t,i=o){if(so)return so;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";const e=t.split(".");let s=Math.min(e.length,8);const n="dmn_chk_"+io();for(;!so&&s--;){const t=e.slice(s).join("."),r=n+"=1;domain=."+t+";path=/";i.cookie=r+";max-age=3",i.cookie.includes(n)&&(i.cookie=r+";max-age=0",so=t)}return so}(t);if(!i){const e=(t=>{const i=t.match(no);return i?i[0]:""})(t);e!==i&&Fr.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(o.location.hostname,s);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),r="; expires="+t.toUTCString()}n&&(l="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(i))+r+"; SameSite=Lax; path=/"+a+l;return u.length>3686.4&&Fr.warn("cookieStore warning: large cookie, len="+u.length),o.cookie=u,!0}catch(t){return!1}},Dt(t,i){if((null==o?void 0:o.cookie)&&(!i||!$i(Kr(t))))try{oo.$t(t,"",-1,i)}catch(t){return}}};let lo=null;const ao={Ot(){if(!$i(lo))return lo;let t=!0;if(yi(s))t=!1;else try{const i="__mplssupport__";ao.$t(i,"xyz"),'"xyz"'!==ao.Lt(i)&&(t=!1),ao.Dt(i)}catch(i){t=!1}return t||Fr.error("localStorage unsupported; falling back to cookie store"),lo=t,t},Ft(t){Fr.error("localStorage error: "+t)},Lt(t){try{return null==s?void 0:s.localStorage.getItem(t)}catch(t){ao.Ft(t)}return null},Pt(t){try{return JSON.parse(ao.Lt(t))||{}}catch(t){}return null},$t(t,i){try{return null==s||s.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){ao.Ft(t)}return!1},Dt(t){try{null==s||s.localStorage.removeItem(t)}catch(t){ao.Ft(t)}}},uo=[T,m,k,y,C,x,w,b,P],ho=[H,z,ft,pt,Ft,Mt,K,Ot],co=t=>t+"_cpm",vo=["__proto__","constructor","prototype"],fo=t=>{if(!_i(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===vo.indexOf(e)&&(i[e]=t[e])}),i},po=(t,i=[])=>{const e={};return[...ho,...i].forEach(i=>{const s=t[i];yi(s)||$i(s)||""===s||(e[i]=s)}),e},go=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},_o=(t,i)=>({p:i,f:go(JSON.stringify(t))}),mo=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=oo.Pt(co(t)),s=(null==e?void 0:e.f)===go(i)&&pi(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},yo=(t,i)=>i+"|"+(oo.Lt(co(t))||""),bo={},wo={Ot:()=>!0,Ft(t){Fr.error("memoryStorage error: "+t)},Lt:t=>t in bo?bo[t]:null,Pt:t=>t in bo?bo[t]:null,$t:(t,i)=>(bo[t]=i,!0),Dt(t){delete bo[t]}};let $o=null;const xo={Ot(){if(!$i($o))return $o;if($o=!0,yi(s))$o=!1;else try{const t="__support__";xo.$t(t,"xyz"),'"xyz"'!==xo.Lt(t)&&($o=!1),xo.Dt(t)}catch(t){$o=!1}return $o},Ft(t){Fr.error("sessionStorage error: ",t)},Lt(t){try{return null==s?void 0:s.sessionStorage.getItem(t)}catch(t){xo.Ft(t)}return null},Pt(t){try{return JSON.parse(xo.Lt(t))||null}catch(t){}return null},$t(t,i){try{return null==s||s.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){xo.Ft(t)}return!1},Dt(t){try{null==s||s.sessionStorage.removeItem(t)}catch(t){xo.Ft(t)}}};var So=class{constructor(t){this._instance=t}get Yr(){return this._instance.config}get consent(){return this.eu()?0:this.iu}isOptedOut(){return"always"===this.Yr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Yr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Yr.opt_out_capturing_by_default}optInOut(t){this.nu.$t(this.su,t?1:0,this.Yr.cookie_expiration,this.Yr.cross_subdomain_cookie,this.Yr.secure_cookie)}reset(){this.nu.Dt(this.su,this.Yr.cross_subdomain_cookie)}get su(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get iu(){const t=this.nu.Lt(this.su);return Fi(t)?1:ai(Di,t)?0:-1}get nu(){const t=this.Yr.opt_out_capturing_persistence_type,i="localStorage"===t?ao:oo,e=i.Ot()?i:wo;if(!this.ru||this.ru!==e){this.ru=e;const i="localStorage"===t?oo:ao;i.Lt(this.su)&&(this.ru.Lt(this.su)||this.optInOut(Fi(i.Lt(this.su))),i.Dt(this.su,this.Yr.cross_subdomain_cookie))}return this.ru}eu(){return!!this.Yr.respect_dnt&&[null==r?void 0:r.doNotTrack,null==r?void 0:r.msDoNotTrack,f.doNotTrack,null==r?void 0:r.globalPrivacyControl].some(t=>Fi(t))}};function ko(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!gi(s))return i;try{const t=s(i);return bi(t)&&t?t:i}catch(t){return Fr.error("Error in get_current_url, falling back to window.location.href",t),i}}function Eo(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function To(t){return!!t&&1===t.nodeType}function Po(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Oo(t){return!!t&&3===t.nodeType}function Co(t){return!!t&&11===t.nodeType&&To(t.host)}function Ro(t){return t?ui(t).split(/\s+/):[]}function Ao(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return yi(s)?void 0:ko(t,s)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Io(t){let 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 Ro(i)}function Mo(t){return xi(t)?null:ui(t).split(/(\s+)/).filter(t=>cl(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fo(t){let i="";return el(t)&&!sl(t)&&t.childNodes&&t.childNodes.length&&Lr(t.childNodes,function(t){var e;Oo(t)&&t.textContent&&(i+=null!==(e=Mo(t.textContent))&&void 0!==e?e:"")}),ui(i)}function Do(t){var i;return yi(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const jo=["a","button","form","input","select","textarea","label"];function Lo(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function No(t,i){if(yi(i))return!0;for(const e of t)if(i.some(t=>Lo(e,t)))return!0;return!1}function Bo(t){const i=t.parentNode;return!(!i||!To(i))&&i}const Uo=[".ph-no-autocapture","[data-ph-no-autocapture]"],zo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Ho=(()=>[...zo,"+","-","−","–"])(),qo=(()=>Ho.length+10)(),Wo=["button","a","input","select","textarea","label"],Vo=["button","link","tab","menuitem","option"],Go=(t,i)=>/[a-z0-9]/i.test(i)?ai(Ho,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,Ko=t=>ai(Wo,t.tagName.toLowerCase())||ai(Vo,(t.getAttribute("role")||"").toLowerCase());function Jo(t){let i="",e="";const s=t=>{To(t)&&el(t)&&!sl(t)&&(i+=` ${Fo(t)}`,e=e||t.getAttribute("aria-label")||"",Lr(t.childNodes,s))};s(t),i=ui(i.replace(/\s+/g," "));const n=(cl(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return{safeText:n,ariaLabel:ui(r).toLowerCase()}}const Yo=[".ph-no-rageclick",".ph-no-capture"],Zo=["","text","search","email","password","url","tel","number"];function Xo(t,i){if(!(typeof window>"u"?void 0:window)||Qo(t))return!1;let e,s,n;var r,o;if(Ei(i)?(e=!!i&&Yo,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:Yo,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!To(t))&&(!!Po(t,"textarea")||(Po(t,"input")?ai(Zo,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return!0;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return"true"===e||""===e}(t)))}(t))return!1;const{targetElementList:l,isComplete:a}=tl(t,!1);return!(!a||s&&function(t,{safeText:i,ariaLabel:e}){let s;if(!0===t)s=zo;else{if(!pi(t))return!1;if(t.length>qo)return Fr.error(`[PostHog] content_ignorelist array cannot exceed ${qo} items. Use css_selector_ignorelist for more complex matching.`),!1;s=t.map(t=>t.toLowerCase())}return s.some(t=>Go(i,t)||Go(e,t))}(s,function(t,i){for(const t of i)if(Ko(t))return Jo(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Jo(t);if(i.safeText||i.ariaLabel)return i}return Jo(t)}(t,l))||No(l,e))}const Qo=t=>!t||Po(t,"html")||!To(t),tl=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Qo(t))return{parentIsUsefulElement:!1,targetElementList:[],isComplete:!1};let s=!1;const n=[t];let r=t;const o=new Set([t]);for(;!Po(r,"body");){const t=r.assignedSlot||r.parentNode,l=Co(t)?t.host:t&&To(t)?t:null;if(!l)break;if(o.has(l)||o.size>=1e3)return{parentIsUsefulElement:s,targetElementList:n,isComplete:!1};if(o.add(l),Co(t))n.push(l),r=l;else{if(i||jo.indexOf(l.tagName.toLowerCase())>-1)s=!0;else try{const t=e.getComputedStyle(l);t&&"pointer"===t.getPropertyValue("cursor")&&(s=!0)}catch(t){}n.push(l),r=l}}return{parentIsUsefulElement:s,targetElementList:n,isComplete:!0}};function il(t){const i=new Set;let e=0,s=t;for(;s;){if(e++>=1e3||i.has(s))return!0;i.add(s);const t=Io(s);if(ai(t,"ph-sensitive")||ai(t,"ph-no-capture"))return!0;const n=s.assignedSlot||s.parentNode;s=Co(n)?n.host:n&&To(n)?n:null}return!1}function el(t){if(il(t))return!1;if(ai(Io(t),"ph-include"))return!0;const i=t.type||"";if(bi(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const e=t.name||t.id||"";return!bi(e)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(e.replace(/[^a-zA-Z0-9]/g,""))}function sl(t){return!!(Po(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Po(t,"select")||Po(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const nl=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}))$"),rl=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,ol=[16,15,14,13],ll=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),al=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ul=/[0-9A-Za-z_]/;function hl(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function cl(t,i=!0){if(xi(t))return!1;if(bi(t)){if(t=ui(t),i?nl.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(rl.lastIndex=0;i=rl.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of ol){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(nl.test(i)&&hl(i))return!0}}}return!1}(t))return!1;if(i?ll.test(t):function(t){let i;for(al.lastIndex=0;i=al.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&ul.test(t)&&ul.test(e)))return!0}return!1}(t))return!1}return!0}function dl(t){let i=Fo(t);return i=`${i} ${vl(t)}`.trim(),cl(i)?i:""}function vl(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Lr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Fo(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${vl(t)}`.trim())}catch(t){Fr.error("[AutoCapture]",t)}}),i}function fl(t){return t.replace(/"|\\"/g,'\\"')}function pl(t){const i=t.attr__class;if(i)return pi(i)?i:Ro(i)}const gl=Dr("[Dead Clicks]"),_l=()=>!0,ml=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(st)),s=t.instance.config.capture_dead_clicks;return Ei(s)?s:!!_i(s)||e};var yl=class{get lazyLoadedDeadClicksAutocapture(){return this.ou}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[st]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lu(()=>{this.au()}):this.stop()}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=g(this.instance))||void 0===e||e(this.instance,"dead-clicks-autocapture",i=>{i?gl.error("failed to load script",i):t()})}au(){var t;if(o){if(!this.ou&&(null===(t=f.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=_i(this.instance.config.capture_dead_clicks)?us({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.ou=f.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ou.start(o),gl.info("starting...")}}else gl.error("`document` not found. Cannot start.")}stop(){this.ou&&(this.ou.stop(),this.ou=void 0,gl.info("stopping..."))}};const bl=Dr("[SegmentIntegration]");function wl(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>gi(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||io();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(Ot,Zt)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&gi(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||bl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(bl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(bl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!xi(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))vi.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=pi(t)?t:[t];let s=us({},i);for(const t of e)try{if(s=t(s),xi(s))return null}catch(t){return bl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(xi(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,ti)},identify(t){return s(t,ei)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{bl.error("Failed to register the Segment integration",t),i()})},e)}const $l="posthog-js";function xl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>us(us({},t),{},{stacktrace:t.stacktrace?us(us({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>us(us({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var Sl=class{constructor(t,i,e,s,n,r){this.name=$l,this.setupOnce=function(o){o(xl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},kl=class{constructor(t){this.uu=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Fr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.cu=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hu()}hu(){var t;this.du=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.uu)}destroy(){var t;null===(t=this.du)||void 0===t||t.call(this),this.du=void 0}doPageView(t,i){var e;const n=this.vu(t,i);return this.cu={pathname:null!==(e=null==s?void 0:s.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(t){var i;return this.vu(t,null===(i=this.cu)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.cu)||void 0===t?void 0:t.pageViewId}}vu(t,i){const e=this.cu;if(!e)return{$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(yi(t)||yi(i)||yi(e)||yi(r)||yi(o)||yi(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?zi(i/t,0,1,Fr):1,a=t>1?zi(e/t,0,1,Fr):1,u=r>1?zi(o/r,0,1,Fr):1,h=r>1?zi(l/r,0,1,Fr):1;s=Nr(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const El=["flags","surveys"],Tl={[U]:{exposure:"hidden"},[W]:{exposure:"hidden"},[V]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[M]:{exposure:"event"},[X]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[Q]:{exposure:"event"},[tt]:{exposure:"hidden"},[it]:{exposure:"event"},[et]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{exposure:"hidden"},[ot]:{exposure:"event"},[lt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"event"},[ut]:{exposure:"event",shouldSkipFromEventProperties:t=>$i(t)},[gt]:{exposure:"event"},[_t]:{exposure:"event"},[mt]:{exposure:"event"},[yt]:{exposure:"event"},[bt]:{exposure:"hidden"},[k]:{exposure:"hidden",storageGroup:"flags"},[m]:{exposure:"hidden",storageGroup:"flags"},[_]:{exposure:"hidden"},[y]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[S]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"hidden"},[A]:{exposure:"hidden"},[T]:{exposure:"hidden"},[E]:{exposure:"hidden"},[F]:{exposure:"hidden",storageGroup:"surveys"},[D]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[L]:{exposure:"event"},[N]:{exposure:"hidden"},[B]:{exposure:"hidden"},[$t]:{exposure:"hidden"},[xt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[kt]:{exposure:"event"},[Et]:{exposure:"event"},[Tt]:{exposure:"event"},[Pt]:{exposure:"event"},[P]:{exposure:"hidden"},[O]:{exposure:"hidden"},[wt]:{exposure:"event"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ot]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[At]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Ft]:{exposure:"hidden"},[ht]:{exposure:"event"},[ct]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[Bt]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[qt]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Vt]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[Kt]:{exposure:"hidden"},[Jt]:{exposure:"event"}},Pl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ol=t=>{const i=Tl[t];if(i)return i;for(const[i,e]of Pl)if(0===t.indexOf(i))return e};function Cl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const Rl=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return yi(e)?null:(e.href=t,e)},Al=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Il=(t,i)=>t>=i&&Al(),Ml=(t,i,e,s)=>{if(0===t){if(Al()){const t=i+1;return t===e&&s(),t}return i}return 0},Fl=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return Ri(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Hr(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return ci(t)}},Dl=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!pi(s)||2>s.length)return"";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(i){Fr.error("Skipping decoding for malformed query param: "+t)}return t}},jl=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const s=a[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;u.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):a[t])}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Ll=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Nl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Bl=["ScCid","SsCid"],Ul={sccid:Bl},zl=(()=>[...Nl,...Bl,"sscid"])(),Hl=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Nl])(),ql="<masked>",Wl=["li_fat_id"];function Vl(t,i,e){if(!o)return{};const s=i?[...zl,...e||[]]:[],n=Gl(jl(o.URL,s,ql),t),r=function(){const t={};return Lr(Wl,function(i){const e=Kr(i);t[i]=e||null}),t}();return Nr(r,n)}function Gl(t,i){const e=Hl.concat(i||[]),s={};return Lr(e,function(i){let e=Dl(t,i);!e&&vi.call(Ul,i)&&jr(Ul[i],function(i){e=e||Dl(t,i)}),s[i]=e||null}),s}function Kl(t){const i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!$i(i)){s.$search_engine=i;const t=o?Dl(o.referrer,e):"";t.length&&(s.ph_keyword=t)}return s}function Jl(){return navigator.language||navigator.userLanguage}function Yl(){const t=Jl();return"string"==typeof t?t.split("-")[0]:void 0}const Zl="$direct";function Xl(){return(null==o?void 0:o.referrer)||Zl}function Ql(t,i,e=!1){const s=t?[...zl,...i||[]]:[],n=e?is(null==l?void 0:l.href):null==l?void 0:l.href,r=null==n?void 0:n.substring(0,1e3);return{r:Xl().substring(0,1e3),u:r?jl(r,s,ql):void 0}}function ta(t,i=!1,e,s){var n;const{r:r,u:o}=t,l=i?is(o):o,a=l&&e?jl(l,[...zl,...s||[]],ql):l,u={$referrer:r,$referring_domain:null==r?void 0:r==Zl?Zl:null===(n=Rl(r))||void 0===n?void 0:n.host};if(a){u.$current_url=a;const t=Rl(a);u.$host=null==t?void 0:t.host,u.$pathname=null==t?void 0:t.pathname,Nr(u,Gl(a))}if(r){const t=Kl(r);Nr(u,t)}return u}function ia(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const ea={flags:w,surveys:D},sa=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],na=t=>`${t}_cookie_identity_change_pending`,ra=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t}return i},oa="main",la=[k,m,y,C,x,w,S,T],aa=t=>-1!==la.indexOf(t),ua=[K,Y],ha=t=>-1!==ua.indexOf(t),ca=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},da=t=>{if(!t)return{};const i=JSON.parse(t);return _i(i)?i:{}},va=t=>{const i=t[y];return _i(i)?us(us({},t),{},{[y]:Object.fromEntries(Object.entries(i).map(([t,i])=>{var e;if(!_i(i)||!("value"in i)||1!==(null===(e=i.metadata)||void 0===e?void 0:e.config_version))return[t,i];const s=us(us({},i),{},{metadata:us({},i.metadata)});delete s.value;for(const t of["config_version","rule_type","rule_id","variant_key","forced_variant"])delete s.metadata[t];return[t,s]}))}):t},fa=(t,i)=>{Lr(t,(e,s)=>{const n=Ol(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var pa=class{constructor(t,i,e=!0,n=!t.cookieless_mode){if(this.fu={},this.pu=!1,this.gu=!1,this.mu=!1,this.yu=!1,this.bu=!1,this._u=new Map,this.wu=!1,this.ku=!1,this.Su=!1,this.xu=new Set,this.$u=new Set,this.Yr=t,this.Cu=e,this.props={},this.Tu=void 0,this.Mu=(t=>{let 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.Ai=t.disable_persistence||!!i,this.nu=this.Iu(t),this.mu=this.Eu(t),this.load(n),this.Au(),t.debug&&Fr.info("Persistence loaded",t.persistence,us({},this.props)),this.update_config(t,t,i),this.save(),s){const t=()=>this.flush();Vr(s,"beforeunload",t,{capture:!1}),Vr(s,"pagehide",t,{capture:!1}),this.Ru=t=>{if(this.pu&&(!t.storageArea||t.storageArea===(null==s?void 0:s.localStorage))&&t.key)if(t.key!==this.Mu){if(this.mu){const i=El.find(i=>t.key===this.Pu(i));i&&this.Ou(t.key,i)}}else this.Ou(t.key,oa)},Vr(s,"storage",this.Ru)}}reconcileFeatureFlagsBeforeMerge(){return!(this.Ai||this.bu||this.wu)&&this.Fu()}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this._u.get(t);if(!aa(t)||!0===e)return;if(!0===i)return void this.Lu(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.Lu(t,s)})}onCrossTabFeatureFlagChange(t){return this.$u.add(t),()=>this.$u.delete(t)}destroy(){this.Ru&&s&&(s.removeEventListener("storage",this.Ru),this.Ru=void 0),this.$u.clear()}Ou(t,i,e=!0){if(this.Ai)return!1;let s,n;try{if(n=ao.Lt(t),$i(n)){const t=this.Du(i);return t.storageValue=null,i!==oa?t.persisted=!1:this.Nu({}),!1}s=da(n)}catch(t){return!1}i===oa&&this.Nu(s);const r=i===oa?s:ao.Pt(this.Mu);if(r&&this.ju(r))return!1;const o=this.qu(s,i,e);return i===oa&&this.mu&&!ca(this.Bu().main,s)||this.zu(s,i,!0,n),o}ju(t){const i=this.props[z],e=t[z];return!yi(i)&&!yi(e)&&i!==e}zu(t,i,e,s){const n=this.Du(i);n.storageValue=s,i!==oa&&(n.persisted=e);try{n.fingerprint=this.Hu(t,i)}catch(t){n.fingerprint=void 0}}qu(t,i,e){let s=!1;return la.forEach(e=>{var n;const r=null===(n=Ol(e))||void 0===n?void 0:n.storageGroup;if(i===oa&&this.mu&&r||i!==oa&&r!==i)return;const o=e in t,l=this.Uu(e,o?t[e]:void 0),a=this._u.has(e)?e in this.props:o;a===e in this.props&&ca(l,this.props[e])||(a?this.Wu(e,l,!1):this.Vu(e,!1),s=!0)}),s&&e&&this.$u.forEach(t=>t()),s}Nu(t){const i=this.gu&&this.Yr.cookieWinsOnConflict?[...ho,...this.Yr.cookie_persisted_properties||[]]:[];ua.forEach(e=>{this.xu.has(e)||-1!==i.indexOf(e)||(e in t?ca(t[e],this.props[e])||this.Wu(e,t[e],!1):e in this.props&&this.Vu(e,!1))})}Gu(){return this.gu&&this.pu&&!this.Yr.cookieWinsOnConflict}Ju(){if(!this.Gu())return;let t,i;try{t=oo.Lt(this.Mu)||void 0}catch(t){return}if(t&&t!==this.Qu){this.Qu=t;try{i=fo(JSON.parse(t))}catch(t){return}ua.forEach(t=>{!(t in i)||t in this.props||this.xu.has(t)||this.Wu(t,i[t],!1)})}}Zu(t){if(this.Gu())try{const i=JSON.stringify(po(t,this.Yr.cookie_persisted_properties||[])),e=oo.Lt(this.Mu)||void 0;e===i&&(this.Qu=e)}catch(t){}}Fu(){if(!this.pu)return!1;try{this.Su=!1;const t=ao.Lt(this.Mu),i=this.Du(oa);let e,s=!1,n=!1;if(t!==i.storageValue)if($i(t))bi(i.storageValue)&&this.Nu({}),i.storageValue=null;else{if(e=da(t),this.Nu(e),this.Su=!this.ku&&this.ju(e),this.Su)return!1;n=this.qu(e,oa,!1),!this.mu||ca(this.Bu().main,e)?this.zu(e,oa,!0,t):i.storageValue=t,s=!0}return this.mu&&El.forEach(t=>{const i=ao.Lt(this.Pu(t)),r=this.Du(t),o=e||{},l=s&&la.some(i=>{var e;return(null===(e=Ol(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if($i(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.qu(o,t,!1)||n));const a=da(i);n=this.qu(a,t,!1)||n,this.zu(a,t,!0,i)}),n}catch(t){return!1}}Lu(t,i){this._u.set(t,i);const e=Ol(t);(null==e?void 0:e.volatile)||(this.Du((this.mu?null==e?void 0:e.storageGroup:void 0)||oa).fingerprint=void 0,this.Ku(t))}Yu(){la.forEach(t=>this._u.set(t,!0))}Au(){if(this.pu)try{const t=ao.Lt(this.Mu),i=da(t);this.Du(oa).storageValue=t,la.forEach(t=>{var e;const s=this.mu?null===(e=Ol(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?ao.Lt(this.Pu(s)):null;if(s){const t=this.Du(s);t.storageValue=n,t.persisted=!$i(n)}const r=s&&!$i(n)?da(n):i;t in this.props?this.Xu(t,r[t],this.props[t]):t in r&&this.Lu(t,!0)})}catch(t){}}Uu(t,i){const e=this._u.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(pi(i)?i:[]),n=new Set(pi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=_i(i)?us({},i):{},n=_i(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}Xu(t,i,e){if(!aa(t))return;const s=this._u.get(t);if(!0===s)return;let n=i;if(this.pu)try{var r;const i=this.mu?null===(r=Ol(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.Pu(i):this.Mu;n=da(ao.Lt(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!yi(i)&&!pi(i)||!yi(n)&&!pi(n)||!pi(e))return void this.Lu(t,!0);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!_i(e))return void(ca(n,e)?this._u.delete(t):this.Lu(t,!0));{if(!yi(i)&&!_i(i)||yi(i)&&mi(e)&&yi(n))return void this.Lu(t,!0);const s=_i(i)?i:{},r=_i(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&ca(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&ca(r[t],e[t])&&o.delete(t)})}}o.size?this.Lu(t,o):this._u.delete(t)}tc(){var t;const i=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Si(i)&&i>0?i:0}ec(t){if(this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase())if(t)try{const i=po(t,this.Yr.cookie_persisted_properties||[]),e=_o(i,this.Yr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=oo.Lt(this.Mu)||void 0;n&&yo(this.Mu,n)===s&&(this.nc=s,this.sc=n)}catch(t){}else try{const t=oo.Lt(this.Mu)||void 0;this.nc=t?yo(this.Mu,t):void 0,this.sc=t}catch(t){}}syncCookieProperties(){return this.rc(this.Yr)}rc(t,i=!1){if(this.Ai&&!i||this.bu||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=oo.Lt(this.Mu)||void 0}catch(t){}if(!e||e===this.sc)return!1;const s=yo(this.Mu,e);let n;try{n=fo(JSON.parse(e))}catch(t){return!1}if((oo.Lt(this.Mu)||void 0)!==e)return!1;this.nc=s,this.sc=e;const r=mo(this.Mu,e),o=[...ho,...r.properties],l={};if(Object.keys(n).forEach(t=>{const i=n[t];(yi(i)||$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(l[t]=!0,delete n[t])}),mi(n))return!1;const a="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,u=this.props,h=u[z],c=u[Ot],d=Nr({},u);[...ho,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in n)&&!l[t]&&(a||"distinct_id"!==t&&"$user_state"!==t)){const i=d[t];(r.isValid||-1===ho.indexOf(t)||!1!==i&&0!==i)&&delete d[t]}}),this.props=Nr(d,n),la.forEach(t=>{const i=t in this.props;t in u===i&&ca(u[t],this.props[t])||(i?this.Xu(t,u[t],this.props[t]):this.Lu(t,!0))}),!a||"$user_state"in n||"$user_state"in this.props||this.Wu(Ot,Yt);const v=this.props[z],f=this.props[Ot];return!a||v===h&&f===c||(this.ku=!0,this.yu=!0,xo.$t(na(this.Mu),!0),this.Vu(T),this.Vu(m),this.Vu(k),this.Vu(y),this.Vu(C),this.Vu(x),this.Vu(w),this.Vu(b),this.Vu(P),"anonymous"!==f||"identified"!==c&&"anonymous"!==n.$user_state&&(yi(h)||v===h)||(fa(this.props,n),this.Vu(E)),"identified"===f?this.props.$user_id=v:delete this.props.$user_id,this.Vu(W)),!0}consumeCookieIdentityChange(){const t=na(this.Mu),i=this.yu||!!xo.Lt(t);return this.yu=!1,i&&xo.Dt(t),i}oc(t=!1){return!(this.bu||this.Ai&&!t||!this.Yr.cookieWinsOnConflict||"localstorage+cookie"!==this.Yr.persistence.toLowerCase()||(this.bu=!0,0))}lc(){this.bu&&(yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0),delete this.fu[oa],this.uc(!0))}cc(t=!0){if(this.bu)try{t?this.lc():yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0)}finally{this.bu=!1}}isDisabled(){return!!this.Ai}Iu(t){-1===sa.indexOf(t.persistence.toLowerCase())&&(Fr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1,e=()=>!1)=>{const n=[...ho,...t];return us(us({},ao),{},{Pt(t){try{let r,o={};try{r=oo.Lt(t)||void 0,o=r?fo(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(ao.Lt(t)||"{}");let a;if(i){const i=mo(t,r),e=[...ho,...i.properties],u={};Object.keys(o).forEach(t=>{const i=o[t];$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(u[t]=i)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var s;const t=l[z],r=null!==(s=l.$user_state)&&void 0!==s?s:Yt;n.forEach(t=>{if(-1!==e.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===ho.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!h||"$user_state"in o||"$user_state"in l||(l[Ot]=Yt),!h||("distinct_id"in u?u[z]:l[z])===t&&("$user_state"in u?u[Ot]:l[Ot])===r||(uo.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[z]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[wt],delete l[E]),delete l.__alias)}a=Nr(l,u)}else a=Nr(o,l);return e()||ao.$t(t,a),a}catch(t){}return null},$t(e,s,n,r,o,l){const a=ao.$t(e,s,void 0,void 0,l);try{const u=po(s,t);if(Object.keys(u).length){if(i){const i=co(e),h=_o(u,t);if(oo.$t(i,h,n,r,o,l),oo.Lt(i)!==JSON.stringify(h)){oo.Dt(i,r);const t=po(s);return oo.$t(e,t,n,r,o,l),a}}oo.$t(e,u,n,r,o,l)}}catch(t){ao.Ft(t)}return a},Dt(t,i){try{null==s||s.localStorage.removeItem(t),oo.Dt(t,i),oo.Dt(co(t),i)}catch(t){ao.Ft(t)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this.Ai);let e,n=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&ao.Ot()?(e=ao,r=!0):"localstorage+cookie"===o&&i.Ot()?(e=i,r=!0,n=!0):"sessionstorage"===o&&xo.Ot()?e=xo:"memory"===o?e=wo:"cookie"===o&&oo.Ot()?(e=oo,n=!0):i.Ot()?(e=i,r=!0,n=!0):oo.Ot()?(e=oo,n=!0):e=wo,this.pu=r,this.gu=n,e}Pu(t){return`${this.Mu}__${t}`}Eu(t){return this.pu&&!!t.split_storage}properties(){const t={};return Lr(this.props,(i,e)=>{const s=Ol(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i}}),t}load(t=!1){if(this.Ai&&!t)return;const i=this.Yr.cookieWinsOnConflict&&"localstorage+cookie"===this.Yr.persistence.toLowerCase(),e=i?ao.Pt(this.Mu):null;let s={};if(i)try{s=fo(oo.Pt(this.Mu)),Lr(s,(t,i)=>{(yi(t)||$i(t)||""===t)&&delete s[i]})}catch(t){}const n=this.nu.Pt(this.Mu);if(n&&(this.props=Nr({},n)),this.mu&&this.hc(),i&&n){var r,o;const t=null==e?void 0:e[z],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:Yt,l=n[z],a=null!==(o=n.$user_state)&&void 0!==o?o:Yt,u=xo.Pt(this.Mu),h=!yi(t)||!yi(null==e?void 0:e.$user_state)||!!u&&!mi(u);if(l!==t||a!==i){h&&(this.yu=!0,this.Ai||xo.$t(na(this.Mu),!0));const e=Nr({},this.props);uo.forEach(t=>delete e[t]),h&&"anonymous"===a&&("identified"===i||"anonymous"===s.$user_state||!yi(t)&&l!==t)&&(fa(e,s),delete e[E]),this.props=e;const n=new Set;uo.forEach(t=>{var i;const e=null===(i=Ol(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{if(this.Ai)return;const i={};Lr(this.props,(e,s)=>{var n;(null===(n=Ol(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)});const e=va(i);mi(i)?(ao.Dt(this.Pu(t)),this.fu[t]={}):ao.$t(this.Pu(t),e)&&(this.fu[t]={persisted:!0,fingerprint:this.Hu(e,t)})})}}xo.Lt(na(this.Mu))&&(this.yu=!0)}hc(){for(const t of El){const i=ao.Pt(this.Pu(t));if(i&&!mi(i)){const e=this.Du(t);e.persisted=!0,this.dc(t)||(e.fingerprint=this.Hu(i,t)),this.vc(t,i)||Nr(this.props,i)}}}dc(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=Ol(i))||void 0===e?void 0:e.storageGroup)===t})}vc(t,i){const e=ea[t];if(!e)return!1;const s=i[e],n=this.props[e];return Si(s)&&Si(n)&&n>s}refreshKey(t){this.fc([t])}fc(t){if(this.Ai)return;let i,e=!1;const s=()=>(e||(i=this.nu.Pt(this.Mu),e=!0),i);t.forEach(t=>{var i;if(this.xu.has(t))return;const e=this.mu?null===(i=Ol(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?ao.Pt(this.Pu(e)):s();if(n&&t in n)this.Wu(t,n[t],!1);else{if(e){const i=s();if(i&&t in i)return void this.Wu(t,i[t],!1)}this.Vu(t,!1)}})}refreshMetaIdentifiers(){this.Ai||(this.gc()?this.mc():this.fc(ua))}mc(){const t=this.yc();(yi(t)||t!==this.bc)&&(this.fc(ua),this._c(t))}_c(t=this.yc()){this.bc=0===this.xu.size?t:void 0}refreshMetaIdentifiersBeforeCapture(){this.Ai||this.bu||(this.gc()||this.Ju(),this.mc())}gc(){return this.nu===oo||this.nu===xo||this.nu===wo}yc(){const t=this.nu.Lt(this.Mu);return bi(t)?t:void 0}save(){if(this.Ai)return;const t=this.tc();t>0?yi(this.ac)&&(this.ac=setTimeout(()=>{this.ac=void 0,this.uc()},t)):this.uc()}flush(){yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0,this.uc())}uc(t=!1){if(this.Ai||this.bu&&!t)return;t||(this.syncCookieProperties(),this.gc()&&this.refreshMetaIdentifiers());const i=!t&&!this.wu;i||(this.Su=!1);const e=!!i&&this.Fu();if(this.Su)return void(this.Yr.debug&&Fr.warn("skipping persistence write because storage belongs to a different distinct ID"));if(t||this.Ju(),this.mu)return this.wc(),void(e&&this.$u.forEach(t=>t()));const s=this.kc(this.nu,this.Mu,this.props,oa);"written"===s&&(this.ec(this.props),this.Zu(this.props)),"failed"!==s&&(this._u.clear(),this.ku=!1,this.xu.clear()),"written"===s&&this._c(),e&&this.$u.forEach(t=>t())}wc(){const{main:t,groups:i}=this.Bu(),e=this.kc(this.nu,this.Mu,t,oa);"written"===e&&(this.ec(t),this.Zu(t)),"failed"!==e&&(this.ku=!1,this.xu.clear(),la.forEach(t=>{var i;(null===(i=Ol(t))||void 0===i?void 0:i.storageGroup)||this._u.delete(t)})),"written"===e&&this._c();for(const t of El){var s;const e=i[t];if(mi(e)&&!(null===(s=this.fu[t])||void 0===s?void 0:s.persisted)){la.forEach(i=>{var e;(null===(e=Ol(i))||void 0===e?void 0:e.storageGroup)===t&&this._u.delete(i)});continue}const n=this.kc(ao,this.Pu(t),e,t);"failed"!==n&&la.forEach(i=>{const e=Ol(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this._u.delete(i)})}}Bu(){const t={},i={flags:{},surveys:{}};return Lr(this.props,(e,s)=>{var n;const r=null===(n=Ol(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}Hu(t,i){if(i===oa)return JSON.stringify(t)+"|"+this.Sc+"|"+this.xc+"|"+this.$c;const e={};return Lr(t,(t,i)=>{var s;e[i]=(null===(s=Ol(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}kc(t,i,e,s){const n=this.Du(s);if(s!==oa&&!n.dirty&&!yi(n.fingerprint))return"skipped";let r,o=e;try{if(o=va(e),r=this.Hu(o,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(i,o,this.Sc,this.xc,this.$c,this.Yr.debug)?(n.dirty=!1,s!==oa&&(n.persisted=!0),yi(r)||(n.fingerprint=r),this.pu&&(n.storageValue=ao.Lt(i)),"written"):(this.Yr.debug&&Fr.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Yu(),yi(this.ac)||(clearTimeout(this.ac),this.ac=void 0),this.nu.Dt(this.Mu,!1),this.nu.Dt(this.Mu,!0),!t&&this.Cu)for(const t of El)ao.Dt(this.Pu(t));t?delete this.fu[oa]:this.fu={},this.nc=void 0,this.sc=void 0,this.Qu=void 0}clear(){this.remove(),this.props={},this.Tu=void 0}register_once(t,i,e){if(_i(t)){this.syncCookieProperties(),yi(i)&&(i="None"),this.Sc=yi(e)?this.Cc:e;let s=!1;if(Lr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Wu(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(_i(t)){this.syncCookieProperties(),this.Sc=yi(i)?this.Cc:i;let e=!1;if(Lr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||_i(i)||pi(i))&&(this.Wu(s,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=!1;for(const t of i)t in this.props&&(this.Vu(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==o?void 0:o.URL;if(t===this.Tu)return;const i=Vl(this.Yr.custom_campaign_params,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties),e=!mi(zr(i));return e&&this.register(i),this.Tu=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==o?void 0:o.referrer;return t?Kl(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Xl(),$referring_domain:(null==o?void 0:o.referrer)&&(null===(t=Rl(o.referrer))||void 0===t?void 0:t.host)||Zl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Ql(this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties,this.Yr.disable_capture_url_hashes);this.register_once({[Mt]:this.gu?{r:ra(t.r),u:t.u?ra(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Lr([It,At],i=>{const e=this.props[i];e&&Lr(e,function(i,e){t["$initial_"+hi(e)]=i})});const i=this.props[Mt];if(i){const e=function(t,i=!1,e,s){const n=ta(t,i,e,s),r={};return Lr(n,function(t,i){r[`$initial_${hi(i)}`]=t}),r}(i,this.Yr.disable_capture_url_hashes,this.Yr.mask_personal_data_properties,this.Yr.custom_personal_data_properties);Nr(t,e)}return t}safe_merge(t){return Lr(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,a=!!this.Ai&&!l;l||this.rc(i,a),this.Yr=t,!l&&(s||n||o)&&(this.nc=void 0,this.sc=void 0,this.Qu=void 0,this.rc(us(us({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.Iu(t):this.nu;this.Tc();const h=this.Eu(t),c=r||h!==this.mu,d=!l&&(c||t.cross_subdomain_cookie!==this.xc||t.secure_cookie!==this.$c)&&this.oc(a);this.wu=c;try{if(this.Cc=this.Sc=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.nu=u,this.mu=h,this.props=t,this.save()}else o&&(this.nu=u,l||(delete this.fu[oa],this.uc()))}finally{this.wu=!1,d&&this.cc()}}Tc(){const t=this.props[Mt];if(!this.gu||!_i(t)||"string"!=typeof t.r)return;const i=ra(t.r),e="string"==typeof t.u?ra(t.u):t.u;i===t.r&&e===t.u||this.Wu(Mt,us(us({},t),{},{r:i,u:e}))}set_disabled(t){this.Ai=t,this.Ai?this.remove():this.save()}set_cross_subdomain(t){t!==this.xc&&(this.xc=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.$c&&(this.$c=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.Wu(Z,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return yi(e)||(delete i[t],this.Wu(Z,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Wu(t,i),this.save()}Wu(t,i,e=!0){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.ku=!0),ha(t)&&!ca(n,i)&&this.xu.add(t),this.Xu(t,n,i),(null===(s=Ol(t))||void 0===s?void 0:s.volatile)||this.Ku(t))}Vu(t,i=!0){delete this.props[t],i&&(aa(t)&&this.Lu(t,!0),ha(t)&&this.xu.add(t),this.Ku(t))}Ku(t){var i;const e=null===(i=Ol(t))||void 0===i?void 0:i.storageGroup;e&&(this.Du(e).dirty=!0)}Du(t){return this.fu[t]||(this.fu[t]={})}};const ga={GZipJS:"gzip-js",Base64:"base64"},_a={Activation:"events",Cancellation:"cancelEvents"},ma={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ya={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ba={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"},wa={Popover:"popover",Inline:"inline"};function $a(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&gi(e.then)&&e.then(void 0,()=>{})}}}}const xa={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"},Sa={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"},ka=Dr("[RateLimiter]");var Ea=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{ka.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void ka.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?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}get isClientRateLimited(){return 1>this.Mc().tokens}clientRateLimitContext(t=!1){var i;const e=this.Mc(),s=1>e.tokens;if(s||t||(e.tokens=Math.max(0,e.tokens-1)),s&&!t){const t=(Si(e.dropped)?e.dropped:0)+1;e.dropped=t,!this.lastEventRateLimited&&this.Ic(t)&&(e.dropped=0)}return this.lastEventRateLimited=s,null===(i=this.instance.persistence)||void 0===i||i.set_property("$capture_rate_limit",e),{isRateLimited:s,remainingTokens:e.tokens}}Mc(){var t;const{captureEventsBurstLimit:i,captureEventsPerSecond:e}=this,s=(new Date).getTime(),n=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(Rt),r=n?us({},n):{tokens:i,last:s};return r.tokens+=Math.max(0,s-r.last)/1e3*e,r.last=Math.max(r.last,s),r.tokens>i&&(r.tokens=i),r}Ec(t){const i=this.instance.config.property_denylist;return!pi(i)||!i.includes(t)}Ac(){var t;if(this.Ec("$current_url")&&this.Ec("$pathname")&&(null==l?void 0:l.pathname))return`${null!==(t=l.origin)&&void 0!==t?t:""}${l.pathname}`}Ic(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Ac(),o=this.Ec("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}};const Ta=Dr("[RemoteConfig]");var Pa=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=f._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Rc(t){const i=g(this._instance);i?i(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Pc(t){const i=this._instance.__pending_remote_config_callbacks;if(i)return void i.push(t);const e=[t];this._instance.__pending_remote_config_callbacks=e;try{this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),batchKey:"remote_config",fireCallbackOnDrop:!0,callback:t=>{this._instance.__pending_remote_config_callbacks=void 0,e.forEach(i=>i(t))}})}catch(t){throw this._instance.__pending_remote_config_callbacks=void 0,t}}load(){try{if(this.remoteConfig)return Ta.info("Using preloaded remote config",this.remoteConfig),void this.Oc(this.remoteConfig);if(this._instance.Fc())return void Ta.warn("Remote config is disabled. Falling back to local config.");if(!this._instance.config.opt_in_site_apps)return void this.Pc(t=>{this.Oc(t.json,t)});this.Rc(t=>{if(!t)return Ta.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pc(t=>{this.Oc(t.json,t)});this.Oc(t)})}catch(t){Ta.error("Error loading remote config",t),this.Oc()}}Oc(t,i){!t&&i&&(0===i.statusCode?i.error||Ta.warn("Failed to fetch remote config from PostHog."):Ta.error("Failed to fetch remote config from PostHog."));try{this._instance.Oc(t?{ok:!0,config:t}:{ok:!1})}catch(t){Ta.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)||void 0===e||e.ensureFlagsLoaded()}catch(t){Ta.error("Error loading feature flags",t)}}},Oa=Uint8Array,Ca=Uint16Array,Ra=Uint32Array,Aa=new Oa([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]),Ia=new Oa([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]),Ma=new Oa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fa=function(t,i){for(var e=new Ca(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new Ra(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return[e,n]},Da=Fa(Aa,2),ja=Da[1];Da[0][28]=258,ja[258]=28;for(var La=Fa(Ia,0)[1],Na=new Ca(32768),Ba=0;32768>Ba;++Ba){var Ua=(43690&Ba)>>>1|(21845&Ba)<<1;Na[Ba]=((65280&(Ua=(61680&(Ua=(52428&Ua)>>>2|(13107&Ua)<<2))>>>4|(3855&Ua)<<4))>>>8|(255&Ua)<<8)>>>1}var za=function(t,i,e){for(var s=t.length,n=0,r=new Ca(i);s>n;++n)++r[t[n]-1];var o,l=new Ca(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new Ca(1<<i);var a=15-i;for(n=0;s>n;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],c=l[t[n]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Na[c]>>>a]=u}else for(o=new Ca(s),n=0;s>n;++n)o[n]=Na[l[t[n]-1]++]>>>15-t[n];return o},Ha=new Oa(288);for(Ba=0;144>Ba;++Ba)Ha[Ba]=8;for(Ba=144;256>Ba;++Ba)Ha[Ba]=9;for(Ba=256;280>Ba;++Ba)Ha[Ba]=7;for(Ba=280;288>Ba;++Ba)Ha[Ba]=8;var qa=new Oa(32);for(Ba=0;32>Ba;++Ba)qa[Ba]=5;var Wa=za(Ha,9,0),Va=za(qa,5,0),Ga=function(t){return(t/8|0)+(7&t&&1)},Ka=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof Ca?Ca:t instanceof Ra?Ra:Oa)(e-i);return s.set(t.subarray(i,e)),s},Ja=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Ya=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},Za=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return[new Oa(0),0];if(1==n){var o=new Oa(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 l=e[0],a=e[1],u=0,h=1,c=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[c].f>e[u].f?u++:c++],a=e[u!=h&&e[c].f>e[u].f?u++:c++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var v=new Ca(d+1),f=Xa(e[h-1],v,0);if(f>i){s=0;var p=0,g=f-i,_=1<<g;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=_-(1<<f-v[m]),v[m]=i}for(p>>>=g;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p)}f=i}return[new Oa(v),f]},Xa=function(t,i,e){return-1==t.s?Math.max(Xa(t.l,i,e+1),Xa(t.r,i,e+1)):i[t.s]=e},Qa=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ca(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=t[l]}return[e.subarray(0,s),i]},tu=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},iu=function(t,i,e){var s=e.length,n=Ga(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},eu=function(t,i,e,s,n,r,o,l,a,u,h){Ja(i,h++,e),++n[256];for(var c=Za(n,15),d=c[0],v=c[1],f=Za(r,15),p=f[0],g=f[1],_=Qa(d),m=_[0],y=_[1],b=Qa(p),w=b[0],x=b[1],S=new Ca(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Za(S,7),T=E[0],P=E[1],O=19;O>4&&!T[Ma[O-1]];--O);var C,R,A,I,M=u+5<<3,F=tu(n,Ha)+tu(r,qa)+o,D=tu(n,d)+tu(r,p)+o+14+3*O+tu(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=M&&D>=M)return iu(i,h,t.subarray(a,a+u));if(Ja(i,h,1+(F>D)),h+=2,F>D){C=za(d,v,0),R=d,A=za(p,g,0),I=p;var j=za(T,P,0);for(Ja(i,h,y-257),Ja(i,h+5,x-1),Ja(i,h+10,O-4),h+=14,k=0;O>k;++k)Ja(i,h+3*k,T[Ma[k]]);h+=3*O;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)Ja(i,h,j[U=31&B[k]]),h+=T[U],U>15&&(Ja(i,h,B[k]>>>5&127),h+=B[k]>>>12)}}else C=Wa,R=Ha,A=Va,I=qa;for(k=0;l>k;++k)if(s[k]>255){var U;Ya(i,h,C[257+(U=s[k]>>>18&31)]),h+=R[U+257],U>7&&(Ja(i,h,s[k]>>>23&31),h+=Aa[U]);var z=31&s[k];Ya(i,h,A[z]),h+=I[z],z>3&&(Ya(i,h,s[k]>>>5&8191),h+=Ia[z])}else Ya(i,h,C[s[k]]),h+=R[s[k]];return Ya(i,h,C[256]),h+R[256]},su=new Ra([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nu=new Oa(0),ru=function(){for(var t=new Ra(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ou=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function lu(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,s=0;i.length>s;++s)e=ru[255&e^i[s]]^e>>>8;t=e},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,a,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),a=8,function(t,i,e,s,n,r){var o=t.length,l=new Oa(s+o+5*(1+Math.floor(o/7e3))+n),a=l.subarray(s,l.length-n),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=iu(a,u,t.subarray(h,c)):(a[h]=r,u=iu(a,u,t.subarray(h,o)))}else{for(var d=su[i-1],v=d>>>13,f=8191&d,p=(1<<e)-1,g=new Ca(32768),_=new Ca(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Ra(25e3),x=new Ca(288),S=new Ca(32),k=0,E=0,T=(h=0,0),P=0,O=0;o>h;++h){var C=b(h),R=32767&h,A=_[C];if(g[R]=A,_[C]=R,h>=P){var I=o-h;if((k>7e3||T>24576)&&I>423){u=eu(t,a,0,w,x,S,E,T,O,h-O,u),T=k=E=0,O=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var F=2,D=0,j=f,L=R-A&32767;if(I>2&&C==b(h-L))for(var N=Math.min(v,I)-1,B=Math.min(32767,h),U=Math.min(258,I);B>=L&&--j&&R!=A;){if(t[h+F]==t[h+F-L]){for(var z=0;U>z&&t[h+z]==t[h+z-L];++z);if(z>F){if(F=z,D=L,z>N)break;var H=Math.min(L,z-2),q=0;for(M=0;H>M;++M){var W=h-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,A=W)}}}L+=(R=A)-(A=g[R])+32768&32767}if(D){w[T++]=268435456|ja[F]<<18|La[D];var G=31&ja[F],K=31&La[D];E+=Aa[G]+Ia[K],++x[257+G],++S[K],P=h+F,++k}else w[T++]=t[h],++x[t[h]]}}u=eu(t,a,r,w,x,S,E,T,O,h-O,u),r||(u=iu(a,u,nu))}return Ka(l,0,s+Ga(u)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,a,!u)),c=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&&ou(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s)}}(h,i),ou(h,c-8,e.d()),ou(h,c-4,s),h}const au=!!u||!!a,uu=new WeakMap,hu="text/plain";let cu=0,du=!1;const vu=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},fu=(t,i,e=!0)=>{const s=t.indexOf("#"),n=-1===s?"":t.slice(s),r=-1===s?t:t.slice(0,s),o=r.indexOf("?"),l=-1===o?r:r.slice(0,o),a=-1===o?"":r.slice(o+1),u=us({},i),h=a.split("&").filter(t=>""!==t).map(t=>{const i=t.indexOf("="),s=-1===i?t:t.slice(0,i),n=e?u[s]:void 0;return delete u[s],xi(n)?t:`${s}=${n}`}),c=function(t,i="&"){let e,s;const n=[];return Lr(t,function(t,i){yi(t)||yi(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e)}),n.join(i)}(u);return c&&h.push(c),`${h.length>0?`${l}?${h.join("&")}`:l}${n}`},pu=t=>{if(t.Mr)return t.Mr;const{data:i,compression:e}=t;if(!i)return;if(e===ga.GZipJS){const t=lu(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new Oa(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t},r=0;i>r;++r){if(s+5>e.length){var o=new Oa(s+8+(i-r<<1));o.set(e),e=o}var l=t.charCodeAt(r);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(++r))>>>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 Ka(e,0,s)}(Fl(i)),{mtime:0});return{contentType:hu,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===ga.Base64){const e=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(Fl(i)),s="sendBeacon"===t.transport,n=s?e:(t=>"data="+encodeURIComponent("string"==typeof t?t:Fl(t)))(e);return{contentType:s?hu:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const s=Fl(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},gu=t=>{const i=()=>"sendBeacon"===t.transport?{url:fu(t.url,{compression:ga.Base64}),encodedBody:pu(us(us({},t),{},{compression:ga.Base64,Mr:void 0}))}:{url:vu(t.url,"compression"),encodedBody:pu(us(us({},t),{},{compression:void 0,Mr:void 0}))};let e;try{e=pu(t)}catch(e){if(an(t.compression,Dl(t.url,"compression")))return Fr.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&an(t.compression,Dl(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?ln(new Uint8Array(s)):ArrayBuffer.isView(s)&&ln(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(du=!0,i()):{url:t.url,encodedBody:e};var s},_u=t=>{try{return gu(t)}catch(e){var i;return Fr.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},mu=function(){var t=Li(function*(t){const i=yield function(t){return pn.apply(this,arguments)}(Fl(t.data),e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return us(us({},t),{},{Mr:{contentType:hu,body:s,estimatedSize:s.byteLength}})});return function(i){return t.apply(this,arguments)}}(),yu=t=>ts("AbortError","PostHog request timed out"+(t?` after ${t}ms`:"")),bu=/Failed to fetch|NetworkError|Load failed/i,wu=t=>"TypeError"===(null==t?void 0:t.name)&&bu.test((null==t?void 0:t.message)||""),$u=t=>{try{const i=function(t,i=Date.now(),e=3e5){if("string"!=typeof t||!t)return;const s=t.trim(),n=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),e/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const r=/^\w{3} \w{3} /.test(n)?n+" GMT":n,o=Date.parse(r)-i;return Number.isFinite(o)&&o>0?Math.min(o,e):void 0}(t());return yi(i)?void 0:Math.min(i,3e4)}catch(t){return}},xu=t=>{var i;const e=_u(t);if(!e)return;const s=new u;uu.set(s,!0);const{url:n,encodedBody:r}=e;s.open(t.method||"GET",n,!0);const{contentType:o,body:l}=null!=r?r:{};Lr(t.headers,function(t,i){s.setRequestHeader(i,t)}),o&&s.setRequestHeader("Content-Type",o),t.timeout&&(s.timeout=t.timeout);let a=!1;s.ontimeout=()=>{a=!0},s.onloadend=()=>{var i;if(a){var e;const i=yu(t.timeout);return Fr.warn(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}const n={statusCode:s.status,text:s.responseText};if(200===s.status)try{n.json=JSON.parse(s.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,n,$u(()=>s.getResponseHeader("Retry-After")))},null===(i=t.onSend)||void 0===i||i.call(t,n),s.send(l)},Su=t=>{const i=_u(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},l=new Headers;Lr(t.headers,function(t,i){l.append(i,t)}),n&&l.append("Content-Type",n);let u=null,c=!1;if(h){const i=new h;u={signal:i.signal,timeout:setTimeout(()=>{c=!0;try{i.abort(yu(t.timeout))}catch(t){v(t)}},t.timeout)}}let d=!1;const v=i=>{var e;d||(d=!0,c&&"AbortError"===(null==i?void 0:i.name)||wu(i)?Fr.warn(i):Fr.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))};let f=0;const p=()=>{cu-=f,f=0,u&&clearTimeout(u.timeout)};try{var g;const i=us({method:(null==t?void 0:t.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:r,signal:null==u?void 0:u.signal},t.fetchOptions);null===(g=t.onSend)||void 0===g||g.call(t,e);const s=null!=o?o:yi(r)?0:void 0;i.keepalive="POST"===i.method&&!t.tu&&!1!==i.keepalive&&i.body===r&&!yi(s)&&s>=0&&52428.8>cu+s,i.keepalive&&(f=s,cu+=f),a(e,i).then(i=>i.text().then(e=>{var s;if(d)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){Fr.error(t)}d=!0,p(),null===(s=t.callback)||void 0===s||s.call(t,n,$u(()=>i.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},ku=t=>{try{var i;const{url:e,encodedBody:s}=gu(t),{contentType:n,body:o,estimatedSize:l}=null!=s?s:{};if(!o)return;const u=o instanceof Blob?o:new Blob([o],{type:n});if(r.sendBeacon(e,u))return;const h=pi(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(pi(h)&&h.length>1&&(null!=l?l:0)>16384){const i=Math.ceil(h.length/2),e=i=>pi(t.data)?i:us(us({},t.data),{},{batch:i});return ku(us(us({},t),{},{data:e(h.slice(0,i))})),void ku(us(us({},t),{},{data:e(h.slice(i))}))}Fr.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${a?"fetch":"XHR"}`),a?Su(us(us({},t),{},{tu:!0})):xu(t)}catch(t){Fr.warn("Beacon send failed",t)}},Eu=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return fu(e===ga.GZipJS?vu(t,"compression"):t,us(us({},n?{[n]:Date.now().toString()}:{}),e===ga.GZipJS?{}:{compression:e}))},Tu=(()=>{const t=[];return a&&t.push({transport:"fetch",method:Su}),u&&t.push({transport:"XHR",method:xu}),(null==r?void 0:r.sendBeacon)&&t.push({transport:"sendBeacon",method:ku}),t})();let Pu=!au&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla"));function Ou(t,i,e){var s,n,r,o;e&&(i=us(us({},i),{},{callback:t=>e(t)})),t.__loaded?Pu?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=us(us({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(yi(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,null===(n=i.onDispatch)||void 0===n||n.call(i),((t,i)=>{var e,s,n;const r=us(us({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&yi(r.compression)&&r.data&&(r.compression=ga.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(pi(t)?t:[t]).map(t=>us(us({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>pi(t)?t.map(t=>us(us({},t),{},{sent_at:i})):us(us({},t),{},{sent_at:i}))(r.data))),r.url=Eu(r.url,r.method,r.compression,r.timestampMode);const l=Tu.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),a=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!a)throw new Error("No available transport method");const u=t=>{try{a(t)}catch(t){var i;wu(t)?Fr.warn(t):Fr.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===ga.GZipJS&&c&&"undefined"!=typeof Promise&&!du?mu(r).then(t=>{u(t)}).catch(i=>{if(un(i))return du=!0,void u(us(us({},r),{},{compression:void 0,url:Eu(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;const i="name"in t?String(t.name):"";return un(t)||i===on})(i)&&(du=!0),u(r)}):u(r)})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s)})):i.fireCallbackOnDrop&&(null===(o=i.callback)||void 0===o||o.call(i,{statusCode:0}))}var Cu=class{constructor(t,i){this.Lc=!0,this.Dc=[],this.Nc=zi((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Fr.createLogger("flush interval"),3e3),this.jc=t}enqueue(t){this.Dc.push(t),this.qc||this.Bc()}unload(){this.zc();const t=this.Dc.length>0?this.Hc():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Uc(us(us({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.Lc=!1,this.Bc()}Bc(){this.Lc||(this.qc=setTimeout(()=>{this.zc(),this.Wc()},this.Nc))}Wc(){if(this.Dc.length>0){const t=this.Hc();for(const i in t)this.Uc(t[i])}}Uc(t,i){try{this.jc(t,i)}catch(t){Fr.error(t)}}zc(){clearTimeout(this.qc),this.qc=void 0}Hc(){const t={},i={};Lr(this.Dc,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");yi(t[r])&&(t[r]=us(us({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback)});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t)})}return this.Dc=[],t}};const Ru=["retriesPerformedSoFar"];var Au=class{constructor(t){this._instance=t,this.Vc=!1,this.Gc=3e3,this.Dc=[],this.Dc=[],this.Jc=!0,this.resume()}resume(){if(!yi(s)&&"onLine"in s.navigator){if(this.Jc=s.navigator.onLine,this.Qc)return;this.Qc=()=>{this.Jc=!0,this.Wc()},this.Zc=()=>{this.Jc=!1},Vr(s,"online",this.Qc),Vr(s,"offline",this.Zc)}}get length(){return this.Dc.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=gn(t,Ru);ki(e)&&(s.url=fu(s.url,{retry_count:e})),Ou(this._instance,i?us(us({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.js(us({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Fr.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!=e?e:0} retries.`)}null===(n=s.callback)||void 0===n||n.call(s,t)})}js(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.Dc.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Fr.warn(r),this.Vc||(this.Vc=!0,this.Kc())}Kc(){if(this.Yc&&clearTimeout(this.Yc),0===this.Dc.length)return this.Vc=!1,void(this.Yc=void 0);this.Yc=setTimeout(()=>{this.Jc&&this.Dc.length>0&&this.Wc(),this.Kc()},this.Gc)}Wc(){const t=Date.now(),i=[],e=this.Dc.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.Dc=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.Yc&&(clearTimeout(this.Yc),this.Yc=void 0),this.Vc=!1,yi(s)||(this.Qc&&(s.removeEventListener("online",this.Qc),this.Qc=void 0),this.Zc&&(s.removeEventListener("offline",this.Zc),this.Zc=void 0));for(const{requestOptions:t}of this.Dc)try{this._instance._send_request(us(us({},t),{},{callback:pi(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Fr.error(t)}this.Dc=[]}},Iu=class{constructor(t){this._instance=t,this.Xc=()=>{var t,i,e,s;this.eh||(this.eh={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),a=(null==n?void 0:n.scrollHeight)||0;this.eh.lastScrollY=Math.ceil(r),this.eh.maxScrollY=Math.max(r,null!==(t=this.eh.maxScrollY)&&void 0!==t?t:0),this.eh.maxScrollHeight=Math.max(o,null!==(i=this.eh.maxScrollHeight)&&void 0!==i?i:0),this.eh.lastContentY=l,this.eh.maxContentY=Math.max(l,null!==(e=this.eh.maxContentY)&&void 0!==e?e:0),this.eh.maxContentHeight=Math.max(a,null!==(s=this.eh.maxContentHeight)&&void 0!==s?s:0)}}get ih(){return this._instance.config.scroll_root_selector}getContext(){return this.eh}resetContext(){const t=this.eh;return this.eh=void 0,setTimeout(this.Xc,0),t}startMeasuringScrollPosition(){Vr(s,"scroll",this.Xc,{capture:!0}),Vr(s,"scrollend",this.Xc,{capture:!0}),Vr(s,"resize",this.Xc)}scrollElement(){if(this.ih){const i=pi(this.ih)?this.ih:[this.ih];for(const e of i){var t;const i=null==s||null===(t=s.document)||void 0===t?void 0:t.querySelector(e);if(i)return i}return}var i;return null==s||null===(i=s.document)||void 0===i?void 0:i.documentElement}nh(t){var i,e;const n="y"===t?"scrollTop":"scrollLeft";if(this.ih){const t=this.scrollElement();return t&&t[n]||0}return s?"y"===t?s.scrollY||s.pageYOffset||(null===(i=s.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:s.scrollX||s.pageXOffset||(null===(e=s.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollLeft)||0:0}scrollY(){return this.nh("y")}scrollX(){return this.nh("x")}};const Mu=t=>Ql(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);var Fu=class{constructor(t,i,e,s){this.Je=t=>{const i=this.sh();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.rh(this._instance)};this.oh.register({[Ct]:e})},this._instance=t,this.ah=i,this.oh=e,this.rh=s||Mu,this.ah.onSessionId(this.Je)}sh(){return this.oh.props[Ct]}getSetOnceProps(){var t;const i=null===(t=this.sh())||void 0===t?void 0:t.props;return i?"r"in i?ta(i,this._instance.config.disable_capture_url_hashes,this._instance.config.mask_personal_data_properties,this._instance.config.custom_personal_data_properties):{$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(){const t={};return Lr(zr(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${hi(e)}`]=i}),t}},Du=class{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(const e of this.Zo[t]||[])e(i);for(const e of this.Zo["*"]||[])e(t,i)}constructor(){this.Zo={}}};const ju=Dr("[SessionId]"),Lu=864e5;var Nu=class{on(t,i){return this.uh.on(t,i)}constructor(t,i,e){var s;if(this.hh=null,this.dh=null,this.fh=[],this.ph=void 0,this.gh=!1,this.uh=new Du,this.mh=(t,i)=>!(!ki(t)||!ki(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Yr=t.config,this.oh=t.persistence,this.Ye=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.yh=void 0,this._sessionActivityTimestamp=null,this.bh=i||io,this._h=e||io;const n=this.Yr.persistence_name||this.Yr.token;if(this._sessionTimeoutMs=1e3*zi(this.Yr.session_idle_timeout_seconds||1800,60,36e3,ju.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.wh(),this.kh="ph_"+n+"_window_id",this.Sh="ph_"+n+"_primary_window_exists",this.xh()){const t=xo.Pt(this.kh),i=xo.Pt(this.Sh);t&&!i?this.Ye=t:xo.Dt(this.kh),xo.$t(this.Sh,!0)}(null===(s=this.Yr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Yr.bootstrap.sessionID),this.$h()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return yi(this.fh)&&(this.fh=[]),this.fh.push(t),this.Xt&&t(this.Xt,this.Ye),()=>{this.fh=this.fh.filter(i=>i!==t)}}xh(){return"memory"!==this.Yr.persistence&&!this.oh.Ai&&xo.Ot()}Ch(t){t!==this.Ye&&(this.Ye=t,this.xh()&&xo.$t(this.kh,t))}Th(){return this.Ye?this.Ye:this.xh()?xo.Pt(this.kh):null}Mh(t){const i=this.hh;return!$i(i)&&!$i(t)&&5e3>Math.abs(t-i)}Ih(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.Mh(i)||(this.hh=i,this.oh.register({[ft]:[i,t,e]}))}Eh(){var t;const i=null===(t=this.Yr)||void 0===t?void 0:t.persistence_save_debounce_ms;return ki(i)&&i>0}Ah(){this.Eh()?this.oh.refreshKey(ft):(this.oh.flush(),this.oh.load())}Rh(){var t;if($i(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.hh)return;this.Ah();const[,i,e]=this.Ph();i===this.Xt&&e===this._sessionStartTimestamp&&(this.hh=this._sessionActivityTimestamp,this.oh.register({[ft]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.oh.flush())}Oh(){const[t]=this.Ph(),i=ki(t)?t:0,e=ki(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Fh(t){return this.Ah(),this.mh(t,this.Oh())}Ph(){const t=this.oh.props[ft];return pi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.hh=null,this.yh=void 0,clearTimeout(this.Lh),this.Lh=void 0,this.Ih(null,null,null)}setBootstrapSessionId(t,i=!1){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const 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 ju.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void ju.error("Invalid sessionID in bootstrap",t)}})(t);return!yi(e)&&(i?this.yh={sessionId:t,sessionStartTimestamp:e}:this.Ih(t,(new Date).getTime(),e),!0)}destroy(){this.gh=!0,this.Rh(),clearTimeout(this.Lh),this.Lh=void 0,this.ph&&s&&(s.removeEventListener(Qt,this.ph,{capture:!1}),this.ph=void 0),this.fh=[]}$h(){this.ph=()=>{this.Rh(),this.xh()&&xo.Dt(this.Sh)},Vr(s,Qt,this.ph,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Yr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.dh=s;else if($i(this.dh)||this.dh>s||s-this.dh>=1e3){var r,o;null===(r=(o=this.oh).syncCookieProperties)||void 0===r||r.call(o),this.dh=s}let[,l,a]=this.Ph();const u=!yi(n)&&l!==n,h=this.Oh();let c=this.Th();const d=this.yh,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>Lu),f=d?v:ki(a)&&Math.abs(s-a)>Lu;let p=!1,g=u,_=!l||!!d;const m=l;let y=!_&&!t&&this.mh(s,h);if(y&&(y=this.Fh(s),y||ju.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Ph(),y||(_=!l||!!d)),_||y||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.bh(),c=this._h(),ju.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:s,this.yh=void 0,p=!0}else c||(c=this._h(),p=!0),g=g||l!==m,g&&(ju.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=ki(h)&&t&&!f?h:s,w=ki(a)?a:(new Date).getTime();this.Ch(c),this.Ih(l,b,w),t||this.wh();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.fh.forEach(t=>t(l,c,x)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?x:void 0,lastActivityTimestamp:h}}wh(){this.gh||(clearTimeout(this.Lh),this.Lh=setTimeout(()=>{if(!this.gh)if(this.Fh((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.uh.emit("forcedIdleReset",{idleSessionId:t})}else this.wh()},1.1*this.sessionTimeoutMs))}};const Bu=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Uu=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&Ui(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>Ui(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function zu(){return(zu=Li(function*(){const t=null==r?void 0:r.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return bi(e)&&e.length>0?e:void 0}catch(t){return void Fr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Hu(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function qu(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const Wu=(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}},Vu=t=>t.toLowerCase(),Gu={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=>Wu(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Wu(i,t))),icontains:(t,i)=>i.map(Vu).some(i=>t.map(Vu).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Vu).every(i=>t.map(Vu).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Ku(t,i){return!t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return!1;const n=Gu[e.operator];return!!n&&n(e.values.map(String),[String(s)])})}function Ju(t,i,e){return Fl({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Yu="custom",Zu="i.posthog.com",Xu=/^\/static\//,Qu=["/s/","/e/","/i/"];var th=class{constructor(t){this.Dh={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Zu}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Dh[this.apiHost]||(this.Dh[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":Yu),this.Dh[this.apiHost]}Nh(t){if(!Xu.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}jh(t){const i=Rl(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}qh(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=Rl(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&Qu.some(t=>0===i.indexOf(t))){const t=this.jh(s);if(t){const i=this.apiHost;let e=this.Bh;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.Bh=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.Bh,e=this.jh(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(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.qh(t,i,this.uiHost+i);if("flags"===t)return this.qh(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.Nh(i);if(e)return this.qh(t,i,`${e}${i}`)}if(this.region===Yu)return this.qh(t,i,this.apiHost+i);const e=Zu+i;switch(t){case"assets":return this.qh(t,i,`https://${this.region}-assets.${e}`);case"api":return this.qh(t,i,`https://${this.region}.${e}`)}}};const ih=Dr("[Surveys]"),eh=t=>{try{const i=(t=>((t,i)=>`seenSurvey_${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){ih.error("Failed to persist survey seen state",t)}},sh=[ma.Popover,ma.Widget,ma.API],nh={ignoreConditions:!1,ignoreDelay:!1,displayType:wa.Popover},rh=Dr("[PostHog ExternalIntegrations]"),oh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var lh=class{constructor(t){this._instance=t}lu(t,i){var e;null===(e=g(this._instance))||void 0===e||e(this._instance,t,t=>{if(t)return rh.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=f.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.lu(oh[n],()=>{var t;null===(t=f.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance)}),!r&&(null===(e=f.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=f.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},ah=class{constructor(t){this.disabled=!1===t;const i=_i(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;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.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}};const uh=()=>typeof window>"u"?void 0:window,hh=()=>typeof document>"u"?void 0:document,ch="$copy_autocapture",dh=["password","hidden","file","checkbox","button","submit","reset","image"],vh=Dr("[AutoCapture]");function fh(t,i){return i.length>t?i.slice(0,t)+"...":i}function ph(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!To(i));return i}function gh(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!To(t))return{props:{}};const u=[t],h=new Set([t]);let c=t;for(;!Po(c,"body")&&1e3>u.length;){const t=c.assignedSlot||c.parentNode,i=Co(t)?t.host:t&&To(t)?t:null;if(!i||h.has(i))break;h.add(i),u.push(i),c=i}const d="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>Po(t,"button")||Po(t,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some(t=>!el(t)||sl(t)));const v=[],f={};let p,g=!1,_=!1;if(Lr(u,t=>{const i=el(t);if(i&&Po(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");g=!!(i&&e&&cl(e))&&(o?is(e):e)}ai(Io(t),"ph-no-capture")&&(_=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};jo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?fh(1024,dl(t)):fh(1024,Fo(t)));const l=Io(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Lr(il(t)?[]:t.attributes,function(e){var r;if((!sl(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&cl(e.value)&&(!bi(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=Ro(t).join(" ")),o["attr__"+e.name]=fh(1024,"href"===e.name&&n?is(t):t)}});let a=1,u=1,h=t;for(;h=ph(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Lr(function(t){if(!el(t))return{};const i={};return Lr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&cl(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(t=u[d],v.splice(0,d)),s||(v[0].$el_text=Po(t,"a")||Po(t,"button")?dl(t):Fo(t)),g){var m,y;v[0].attr__href=g;const t=null===(m=Rl(g))||void 0===m?void 0:m.host,i=null===(y=uh())||void 0===y||null===(y=y.location)||void 0===y?void 0:y.host;t&&i&&t!==i&&(p=g)}return{props:Nr((w=i.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(b=v,pi(b)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`}const n=us(us(us(us({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Br(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[fl(t.toString())]=fl(i.toString())),s+=":",s+=Br(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:pl(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Br(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(b)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var b,w}const _h="autocapture";var mh=class{Pa(){this.Oa=void 0,clearTimeout(this.Fa),this.Fa=void 0}La(t){var i;if(!el(t))return!0;const e=null!==(i=this.Da().css_selector_ignorelist)&&void 0!==i?i:Uo,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Io(t);if(ai(i,"ph-no-capture")||ai(i,"ph-sensitive")||sl(t)||e.some(i=>Lo(t,i)))return!0;const r=n.assignedSlot||n.parentNode;n=Co(r)?r.host:r&&To(r)?r:null}return!1}Na(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.Pa();if("pointerdown"===t.type){var i;this.Pa();const e=Do(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&To(e)&&(this.Oa={target:e,excluded:this.La(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.ia)||void 0===i?void 0:i.distinctId}))}const e=this.Oa;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.Pa():"pointerup"===t.type&&(e.released=!0,this.Fa=setTimeout(()=>this.Pa(),0)))}ja(t){var i;const e=this.Oa;this.Pa();const s=Do(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.ia)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(Po(s,"html")||Po(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.Da().css_selector_ignorelist)&&void 0!==n?n:Uo;return[s,null===(r=hh())||void 0===r?void 0:r.documentElement,null===(o=hh())||void 0===o?void 0:o.body].some(i=>{if(!i)return!1;const e=Io(i);return ai(e,"ph-no-capture")||ai(e,"ph-sensitive")||!el(i)||sl(i)||t.some(t=>Lo(i,t))})?null:e.target}}constructor(t){this.ra=t,this.name=_h,this.qa=!1,this.Ba=null,this.za=!1,this.Ha=new Map,this.Ua=!1,this.Yr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.qi=!1,this.ra.refresh(this.Yr),this.rageclicks=new ah(this.Yr.rageclick),this.Wa=null}setup(t){this.Va(),this.ia=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.qi?i.dispose():(this.ma=i,this.startIfEnabled())}dispose(){var t;this.qi||(this.qi=!0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.Ha.clear(),this.Wa=null,this.Ga())}Da(){return this.ra.refresh(this.Yr),this.Yr}Va(){var t,i;return this.Da(),this.Yr.url_allowlist=null===(t=this.Yr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Yr.url_ignorelist=null===(i=this.Yr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Yr}Ja(){const t=uh(),i=hh();if(!this.isBrowserSupported())return void vh.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.Qa=t,this.Za=i;const e=this.Ka=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.Pa();if(0===i.type.indexOf("pointer"))return void this.Na(i);const t="click"===i.type?this.ja(i):void 0;if($i(t))return;this.Ya(i,"$autocapture",t)}catch(t){vh.error("Failed to capture event",t)}};if(Vr(t,"blur",e),Vr(i,"submit",e,{capture:!0}),Vr(i,"change",e,{capture:!0}),Vr(i,"click",e,{capture:!0}),Lr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Vr(i,t,e,{capture:!0})}),this.Da().capture_copied_text){const e=this.Xa=i=>{i=i||(null==t?void 0:t.event);try{this.Ya(i,ch)}catch(t){vh.error("Failed to capture clipboard event",t)}};Vr(i,"copy",e,{capture:!0}),Vr(i,"cut",e,{capture:!0}),Vr(i,"paste",e,{capture:!0})}}Ga(){const t=this.Qa,i=this.Za;this.Pa(),this.Ka&&(null==t||t.removeEventListener("blur",this.Ka),Lr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.Ka,!0)}),null==i||i.removeEventListener("submit",this.Ka,!0),null==i||i.removeEventListener("change",this.Ka,!0),null==i||i.removeEventListener("click",this.Ka,!0),this.Ka=void 0),this.Xa&&(null==i||i.removeEventListener("copy",this.Xa,!0),null==i||i.removeEventListener("cut",this.Xa,!0),null==i||i.removeEventListener("paste",this.Xa,!0),this.Xa=void 0),this.Qa=void 0,this.Za=void 0,this.qa=!1}startIfEnabled(){this.isEnabled||this.Pa(),!this.qi&&this.ia&&this.isEnabled&&!this.qa&&(this.Ja(),this.qa=!0)}onRemoteConfig(t){if(this.qi)return;if(this.za=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.Ua=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;Ei(e)&&(null===(s=this.ia)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.Ba=e),this.startIfEnabled()}setElementSelectors(t,i=this){if(this.qi)return;t.size?this.Ha.set(i,new Set(t)):this.Ha.delete(i);const e=new Set;this.Ha.forEach(t=>{t.forEach(t=>e.add(t))}),this.Wa=e}getElementSelectors(t,i){var e;const s=[];return null===(e=this.Wa)||void 0===e||e.forEach(e=>{var n;const r=null===(n=hh())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||ai(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.qi)return!1;const e=null===(t=this.ia)||void 0===t?void 0:t.kv.get(M),s=this.Ba,n=this.Da();if(!n.remoteRequestsDisabled&&!this.za)return!1;const r=n.remoteRequestsDisabled&&!this.za;if($i(s)&&!Ei(e)&&!r)return!1;const o=null!==(i=this.Ba)&&void 0!==i?i:!!e;return!!n.enabled&&!o}Ya(t,i="$autocapture",e){if(!this.isEnabled)return void this.Pa();let s=e||Do(t);Oo(s)&&(s=s.parentNode||null);const n=this.Va();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Xo(s,n.rageclick)&&this.Ya(t,"$rageclick",e);const o=i===ch,l=o?us(us({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Qo(t))return!1;if((null==e?void 0:e.url_allowlist)&&!Ao(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&Ao(e.url_ignorelist,r))return!1;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u,isComplete:h}=tl(t,s);if(!h)return!1;if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(yi(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(u,e))return!1;if(!No(u,null==e?void 0:e.css_selector_allowlist))return!1;if(No(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Uo))return!1;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(jo.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a;const{props:e,explicitNoCapture:r,target:o}=gh(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Ua,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===ch){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null===(u=uh())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),i=Mo(t);if(!i)return!1;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0}e.$copy_type=i}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(Po(c=s,"input")?!ai(dh,c.type):Po(c,"textarea")||Po(c,"select")&&!c.multiple)&&function(t,i){var e;if(!el(t))return!1;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:Uo,n=new Set;let r=t;for(Po(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Io(t);if(n.size>=1e3||n.has(r)||ai(i,"ph-sensitive")||ai(i,"ph-no-capture")||s.some(i=>Lo(t,i)))return!1;n.add(r);const e=r.assignedSlot||r.parentNode;r=Co(e)?e.host:e&&To(e)?e:null}return!0}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=!1;try{i=gi(t)?!!t(s):pi(t)&&t.some(t=>Lo(s,t))}catch(t){vh.error("capture_value_css_selector_allowlist threw",t)}i&&(e.$input_value=s.value)}return null===(a=this.ia)||void 0===a||a.capture(i,e),!0}var c}isBrowserSupported(){var t;return gi(null===(t=hh())||void 0===t?void 0:t.querySelectorAll)}};const yh="featureFlags",bh="logs",wh=()=>{var t;return(null==s||null===(t=s.performance)||void 0===t?void 0:t.now)?s.performance.now():Date.now()},$h=[],xh=[50,75,100,150,200,300,400,500,750,1e3,1500,2e3,3e3,5e3,1e4],Sh=[5,10,25,...xh];var kh=class{constructor(t){this._instance=t}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);yi(t)||(e[s]=t)}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t)}},Eh=class{constructor(t){this.instance=t,this.R=Fr,this.kv=new kh(t),this.onSession=t=>$a(this.instance.onSessionId(i=>{try{t(i)}catch(t){this.R.error("Browser extension session listener failed",t)}})),this.onEvent=t=>$a(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties})}catch(t){this.R.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i)}catch(t){this.R.error("Browser extension remote config listener failed",t)}},e=this.instance.Tr.on("extensionsRemoteConfig",i);return this.instance.Ir&&i(this.instance.Ir),$a(e)}}get logger(){return this.R}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(H);return"string"==typeof t?t:void 0}get library(){return{name:e.LIB_NAME,version:e.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return gi(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var t;return!!(null===(t=this.instance.rateLimiter)||void 0===t?void 0:t.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case yh:case"featureFlagsCommon":i=this.instance.featureFlags;break;case bh:i=this.instance.logs;break;case"surveys":i=this.instance.surveys;break;case _h:i=this.instance.autocapture}return i}capture(t,i,e){if(!e)return this.Ar(this.instance.capture(t,i));const s=us(us({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:!0}:{}),"immediate"===e.delivery?{send_instantly:!0}:{});return this.Ar(this.instance.capture(t,i,s))}Ar(t){var i;return!yi(t)||!(null===(i=this.instance.rateLimiter)||void 0===i?void 0:i.lastEventRateLimited)}registerDynamicEventProperties(t){return $a(this.instance.Rr(t))}sendRequest(t){var i=this;return Li(function*(t,e={}){var n;const r=null!==(n=e.target)&&void 0!==n?n:"api",o=e.query?fu(t,e.query):t,l=i.instance.requestRouter.endpointFor(r,o),a={method:e.method,url:l,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?ri.Base64:void 0,timestampMode:e.sentAt};return"api"===r&&"/i/v1/logs"===t&&(a.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(a),{statusCode:202}):new Promise(t=>{var e;if(a.callback=t,"flags"===r&&(null===(e=i.instance.config.metrics)||void 0===e?void 0:e.flags)){let e,n;a.onDispatch=()=>{e=wh()},a.onSend=t=>{n=(t=>{try{return(t=>{var i;const e=null==s?void 0:s.PerformanceObserver,n=null===(i=Rl(t))||void 0===i?void 0:i.href;if(!e||!n)return;const r=wh(),o={name:n,before:1/0,inFlight:!0};let l,a,u,h=1/0,c=!1;const d=()=>{c||(c=!0,clearTimeout(u),p.disconnect(),$h.splice($h.indexOf(o),1))};let v=!1;const f=t=>{for(const i of t){const t=i.startTime;i.name!==n||(v?r>=t:r>t)||t>=o.before||l&&t>=l.startTime||(l=i)}if(l&&a&&h>=l.startTime){const t=a;d(),t(l)}},p=new e(t=>f(t.getEntriesByName(n,"resource")));p.observe({entryTypes:["resource"]});for(const t of $h)t.name===n&&(t.before=Math.min(t.before,r),v=v||t.inFlight);return $h.push(o),{take(t,i){c||(h=t,o.inFlight=!1,a=i,u=setTimeout(d,5e3),gi(p.takeRecords)&&f(p.takeRecords()))},stop:d}})(t)}catch(t){return}})(t)},a.callback=s=>{if(t(s),yi(e))return;const r=e,o=wh();try{const t=((t,i)=>{var e,s;const n=i.statusCode||void 0,r={"server.address":(null!==(e=null===(s=Rl(t))||void 0===s?void 0:s.hostname)&&void 0!==e?e:t).replace(/^\[(.*)\]$/,"$1")};n&&(r["http.response.status_code"]=n);const o=((t,i)=>t?400>t?void 0:String(t):"AbortError"===(null==i?void 0:i.name)?"timeout":"_OTHER")(n,i.error);o&&(r["error.type"]=o);const l=Cl();return l&&(r["client.timezone"]=l),r})(l,s);if(i.Er("posthog.flags.request.duration",o-r,xh,t),s.statusCode&&n)return void n.take(o,e=>i.Or(e,r,o,t))}catch(t){Fr.error("Failed to record the /flags request timing",t)}null==n||n.stop()}}i.instance._send_request(a)})}).apply(this,arguments)}Or(t,i,e,s){if(t.responseEnd>=t.startTime)try{const n=Math.min(t.responseEnd,e);this.Er("posthog.flags.request.pre_send_duration",t.startTime-i,Sh,s),this.Er("posthog.flags.request.network_duration",n-t.startTime,xh,s),this.Er("posthog.flags.request.main_thread_duration",e-n,Sh,s)}catch(t){Fr.error("Failed to record the /flags request timing split",t)}}Er(t,i,e,s){var n;null===(n=this.instance.metrics)||void 0===n||n.histogram(t,i,{unit:"ms",attributes:us({},s),bounds:e})}};const Th={};let Ph=0;const Oh=()=>{},Ch='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Rh="Surveys module not available",Ah="sanitize_properties is deprecated. Use before_send instead",Ih="Invalid value for property_denylist config: ",Mh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Fh=["$feature_flag_called","$$heatmap","$snapshot"],Dh=t=>"$"===t.charAt(0)&&!ai(Fh,t),jh=/^[A-Za-z0-9_-]{1,400}$/,Lh=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Nh=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Bh=["token","distinct_id",jt],Uh="posthog",zh=[...Bu].sort()[Bu.length-1],Hh=t=>{const 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},qh=t=>{var i;return us({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wr(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Oh,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_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&bi(null==l?void 0:l.search)&&-1!==l.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,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null===(i=s.location)||void 0===i?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,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Fr.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:Xt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Oh},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ho,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Hh(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))},Wh=[["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"]],Vh=t=>{const i={};for(const[e,s]of Wh)yi(t[e])||(i[s]=t[e]);const e=Nr({},i,t),s=t.__preview_external_dependency_versioned_paths;return yi(s)||(yi(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),bi(s)&&yi(t.asset_host)&&(e.asset_host=s)),pi(t.property_blacklist)&&(yi(t.property_denylist)?e.property_denylist=t.property_blacklist:pi(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Fr.error(Ih+t.property_denylist)),e};var Gh=class{constructor(){this.__forceAllowLocalhost=!1}get zh(){return this.__forceAllowLocalhost}set zh(t){Fr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Kh=class t{Hh(t){if(!t)return;const i=this.Uh.indexOf(t);-1!==i&&this.Uh.splice(i,1)}Wh(t,i){var e;return this.Hh(t),this.Uh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}Vh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Gh(){if(this.Jh)return;if(!this.Qh||!("capture_pageview"in this.Qh))return;if(us(us({},t.__defaultExtensionClasses),this.config.__extensionClasses).historyAutocapture)return;const i=this.config.capture_pageview;("history_change"===i||_i(i)&&(i.path||i.search||i.hash&&!this.config.disable_capture_url_hashes))&&(this.Jh=!0,Fr.warn("capture_pageview is set to capture history changes, but the history autocapture extension is not loaded, so only the first pageview of each page load is captured. With the slim bundle, pass __extensionClasses: { historyAutocapture: AnalyticsExtensions.historyAutocapture } from 'posthog-js/dist/extension-bundles', or set capture_pageview: true to capture page loads only."))}Zh(){if(this.Kh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.Vh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.Yh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Kh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, 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. ${s}`)}Xh(){const t=this.persistence;if(!t||this.ed)return;if(this.Vh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.nd(),this.sd()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.rd()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(io());this.register({distinct_id:i,$device_id:i}),t.set_property(Ot,Yt)}this.nd()}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this.od=!1,this.ld=!1,this.ad=!1,this.webPerformance=new Gh,this.ud=!1,this.version=e.LIB_VERSION,this.__loadExternalDependency=p,this.hd=new Set,this.dd="",this.Tr=new Du,this.Uh=[],this.vd=[],this.fd=!1,this.Yh=!1,this.Kh=!1,this.Jh=!1,this.ed=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=qh(),this.SentryIntegration=Sl,this.sentryIntegration=t=>function(t,i){const e=xl(t,i);return{name:$l,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pd=!1,this.gd=null,this.md=null,this.yd=null,this.scrollManager=new Iu(this),this.pageViewManager=new kl(this),this.rateLimiter=new Ea(this),this.requestRouter=new th(this),this.consent=new So(this),this.externalIntegrations=new lh(this);const s=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(t,i,e)=>{const s=bi(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=bi(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>Fr.info(`send "${null==t?void 0:t.event}"`,t))}init(i,e,s){if(s&&s!==Uh){var n;const r=null!==(n=Th[s])&&void 0!==n?n:new t;return r._init(i,e,s),Th[s]=r,Th[Uh][s]=r,r}return this._init(i,e,s)}_init(t,i={},n){var r,o,l;const a=bi(t)?t.trim():"";if(!a)return Fr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var u;if(this.__loaded)return a!==(null===(u=this.config)||void 0===u?void 0:u.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=qh(i.defaults),i.debug=this.bd(i.debug),this.Qh=i,this._d=[],i.person_profiles?this.md=i.person_profiles:i.process_person&&(this.md=i.process_person);const h=qh(i.defaults),c=Vh(i),d=Nr({},h,c,{name:n,token:a});_i(h.rageclick)&&_i(c.rageclick)&&(d.rageclick=Nr({},h.rageclick,c.rageclick)),_i(h.session_recording)&&_i(c.session_recording)&&(d.session_recording=Nr({},h.session_recording,c.session_recording)),this.set_config(d),this.config.on_xhr_error&&Fr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ga.GZipJS;const v=this.rd(),f=!this.Vh();if(this.persistence=new pa(this.config,v,!0,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new pa(us(us({},this.config),{},{persistence:"sessionStorage"}),v,!1,f),this.dd="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!v&&xo.Ot()){const t=xo.Pt(this.dd);pi(t)&&t.forEach(t=>{bi(t)&&this.hd.add(t)})}else xo.Dt(this.dd);const p=us({},this.persistence.props),g=us({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.wd=new Cu((t,i)=>this.kd(t,i),this.config.request_queue_config),this.Sd=new Au(this),this.__request_queue=[];const _=this.Vh();_||(this.sessionManager=new Nu(this),this.sessionPropsManager=new Fu(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.xd()})),this.$d(),this.config.__preview_deferred_init_extensions?(Fr.info("Deferring extension initialization to improve startup performance"),this.Cd=setTimeout(()=>{this.Cd=void 0,this.Td(_)},0)):(Fr.info("Initializing extensions synchronously"),this.Td(_)),e.DEBUG=e.DEBUG||this.config.debug,e.DEBUG&&Fr.info("Starting in debug mode",{this:this,config:i,thisC:us({},this.config),p:p,s:g}),this.config.identity_distinct_id&&!(null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID)&&(i.bootstrap=us(us({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID;if(this.Yh=!!m&&!wi(m),null===(l=i.bootstrap)||void 0===l?void 0:l.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),s=this.persistence.get_property(Ot);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===s)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===s)Fr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(io()),s=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(Ot,i.bootstrap.isIdentifiedID?Zt:Yt),this.register({distinct_id:t,$device_id:s})}}if(_)this.register_once({distinct_id:Dt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(io());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(Ot,Yt)}return Vr(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Vr(s,"pageshow",t=>{if(this.ld=!1,!this.ad){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(z),i=this.persistence.get_property(Ot);this.persistence.load(),this.Md()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.Id()}null===(i=this.Sd)||void 0===i||i.resume()}}),i.segment?wl(this,()=>this.Ed()):this.Ed(),gi(this.config._onCapture)&&this.config._onCapture!==Oh&&(Fr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Fr.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 zu.apply(this,arguments)}().then(t=>{t&&this.register({[q]:t})}).catch(Oh),this}Ad(t){const i=t;return bi(i.name)&&gi(i.setup)}Rd(t,i){var e=this;this.Ad(t)?i.push(Li(function*(){try{yield t.setup(e.Pd())}catch(e){Fr.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t)}catch(i){Fr.error(`Failed to dispose extension "${t.name}"`,i)}}})):this.Uh.push(t)}$d(){var i,e,s,n=this;const r=null!==(i=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==i?i:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Od)||void 0===o||o.call(this),this.Od=void 0,this.featureFlags=new r(this)),gi(this.featureFlags.onReloading)&&gi(this.featureFlags.setup)){if(!this.Od){this.Od=this.featureFlags.onReloading(()=>{this.Tr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;Li(function*(){try{yield t.setup(n.Pd())}catch(i){Fr.error("Failed to set up feature flags",i);const e=n.Od;n.Od=void 0;try{null==e||e()}catch(t){Fr.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Fr.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}Td(i){const e=performance.now(),s=us(us({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,c,d;s.exceptions&&this.Uh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.Uh.push(this.historyAutocapture=new s.historyAutocapture(this)),this.Gh(),s.tracingHeaders&&this.Uh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.Uh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!i&&this.Uh.push(this.sessionRecording=new s.sessionRecording(this)),s.autocapture&&this.Rd(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Rd(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Rd(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.Uh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.Uh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.Uh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.Uh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.Uh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.Uh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.Uh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,ml)),s.toolbar&&this.Uh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.Uh.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new s.experiments(this)),s.webMCP&&this.Uh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new s.webMCP(this));const v=this.Uh.length>0||n.length>0;this.config.disable_scroll_properties||n.unshift(()=>{this.scrollManager.startMeasuringScrollPosition()}),this.Uh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Fd){const t=this.Fd;this.Fd=void 0,this.Uh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Ld(n,e,v)}Ld(t,i,e){for(var s,n;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.Cd=setTimeout(()=>{this.Cd=void 0,this.Ld(t,i,e)},0));const s=t.shift();if(s)try{s()}catch(t){Fr.error("Error initializing extension:",t)}}const r=Math.round(performance.now()-i);e&&r>0?this.register_for_session({[Lt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Nt]:r}):yi(null===(s=this.sessionPersistence)||void 0===s?void 0:s.props.$sdk_debug_extensions_init_method)&&yi(null===(n=this.sessionPersistence)||void 0===n?void 0:n.props.$sdk_debug_extensions_init_time_ms)||(this.unregister_for_session(Lt),this.unregister_for_session(Nt)),this.config.__preview_deferred_init_extensions&&Fr.info(`PostHog extensions initialized (${r}ms)`)}Oc(t){if(!o||!o.body)return Fr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Oc(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Fd=t),this.Ir=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=ai(e.supportedCompression,ga.GZipJS)?ga.GZipJS:ai(e.supportedCompression,ga.Base64)?ga.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.md?this.md:Xt}),this.Tr.emit("extensionsRemoteConfig",t),this.Uh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}Ed(){try{this.config.loaded(this)}catch(t){Fr.critical("`loaded` function failed",t)}if(this.Dd(),this.config.internal_or_test_user_hostname&&(null==l?void 0:l.hostname)){const t=l.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.Vh())&&this.Nd()},1),this.jd=new Pa(this),this.jd.load()}Dd(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.wd)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&jr(this.__request_queue,t=>this.kd(t)),this.__request_queue=[],this.Dd()}_handle_unload(){var t,i,e,s,n,r;this.ld=!0,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.qd()&&this.capture(ii),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.wd)||void 0===n||n.unload(),null===(r=this.Sd)||void 0===r||r.unload()):this.qd()&&this.capture(ii,null,{transport:"sendBeacon"})}_send_request(t){Ou(this,t)}kd(t,i){this.Sd?this.Sd.retriableRequest(t,i):this._send_request(i?us(us({},t),{},{transport:i}):t)}_execute_array(t){Ph++;try{let i;const e=[],s=[],n=[];jr(t,t=>{if(t)if(i=t[0],pi(i))n.push(t);else if(gi(t))try{t.call(this)}catch(i){Fr.error("Error executing queued PostHog call",t,i)}else pi(t)&&"alias"===i?e.push(t):pi(t)&&-1!==i.indexOf("capture")&&gi(this[i])?n.push(t):s.push(t)});const r=function(t,i){jr(t,function(t){try{if(pi(t[0])){let e=i;Lr(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Fr.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{Ph--}}push(i){if(Ph>0&&pi(i)&&bi(i[0])){const e=t.prototype[i[0]];return void(gi(e)&&e.apply(this,i.slice(1)))}this._execute_array([i])}get Bd(){return{property:G,persistenceKey:K,cookieName:"_fbc",pattern:Lh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[K]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(K)}}}get zd(){return{property:J,persistenceKey:Y,cookieName:"_fbp",pattern:Nh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[Y]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(Y)}}}Hd(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return bi(e)&&t.pattern.test(e)?{value:e,delivered:!1}:_i(e)&&bi(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Ud(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,!1),{value:i,pending:!0})}Wd(t){if(!this.config.save_campaign_params||this.Vh())return;const i=Kr(t.cookieName);return bi(i)&&t.pattern.test(i)?i:void 0}Vd(t,i,e,s){if(!this.persistence)return;const n=this.Bd,r=this.Hd(n);if(s)return void n.unregister();if(e)return bi(i)&&Lh.test(i)?this.Ud(n,i,r):void n.unregister();const o=bi(t)&&jh.test(t)?t:void 0,l=this.Wd(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return!0;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.Ud(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.Ud(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}Gd(t,i,e){if(!this.persistence)return;const s=this.zd,n=this.Hd(s);if(e)return void s.unregister();if(i)return bi(t)&&Nh.test(t)?this.Ud(s,t,n):void s.unregister();const r=this.Wd(s);return r?this.Ud(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}Jd(t){if(!this.persistence)return;const i=({channel:t,value:i})=>{const e=this.Hd(t);return(null==e?void 0:e.value)===i&&!e.delivered},e=t.filter(i);e.length&&(this.persistence.refreshMetaIdentifiers(),e.filter(i).forEach(({channel:t,value:i})=>t.register(i,!0)))}capture(t,i,e){var s,n,r,o,l;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.wd))return void Fr.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Fr.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(yi(t)||!bi(t))return void Fr.error("No event name provided to posthog.capture");if(this.Xh(),"$snapshot"===t&&this.Vh())return;const a=!this.config.opt_out_useragent_filter&&this._is_bot();if(a&&!this.config.__preview_capture_bot_pageviews)return this.od||(this.od=!0,console.warn("[PostHog.js] Events are being dropped because the user agent looks like a bot. Set `opt_out_useragent_filter: true` to capture them, e.g. in end-to-end tests. Note that logs from `captureLog` are not subject to this filter.")),void Fr.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const u=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==u?void 0:u.isRateLimited)return void Fr.critical("This capture call is ignored due to client rate limiting.");let h;(null==i?void 0:i.$current_url)&&!bi(null==i?void 0:i.$current_url)&&(Fr.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==e?void 0:e.Qd)||Fr.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.persistence.syncCookieProperties(),this.Md(),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(h=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const c=new Date,d=(null==e?void 0:e.timestamp)||c,v=Qe(null==e?void 0:e.uuid,io);let f={uuid:v,event:t,properties:this.Zd(t,i||{},d,v,!1,!0)};const p=null===(s=this.featureFlags)||void 0===s||null===(n=s.flagEventCapture)||void 0===n?void 0:n.call(s,i);var g;if(p&&(Lr(p.omit,t=>{delete f.properties[t]}),!1===(null===(g=p.resolved)||void 0===g?void 0:g.call(p,f.properties))))return;"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&a&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);const _="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!_&&(f.$set=null==e?void 0:e.$set);const m=_i(null==i?void 0:i.$set)?i.$set:void 0,y=pi(null==i?void 0:i.$unset)?i.$unset:[],b=(null==e?void 0:e.$unset)||[],w=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return{hasProvided:s||!!m&&t in m,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==m?void 0:m[t],unset:-1!==y.indexOf(t)||-1!==b.indexOf(t)}};this.persistence.refreshMetaIdentifiersBeforeCapture();const x=w(G),S=w(J),k=[{channel:this.Bd,hasProvided:x.hasProvided,update:this.Vd(null==h?void 0:h.fbclid,x.provided,x.hasProvided,x.unset)},{channel:this.zd,hasProvided:S.hasProvided,update:this.Gd(S.provided,S.hasProvided,S.unset)}];for(const{channel:t,hasProvided:i,update:e}of k)e&&!0===f.properties.$process_person_profile&&e.pending&&!i&&!_&&(f.$set=us({[t.property]:e.value},f.$set));const E=null==e?void 0:e.$unset;E&&(f.$unset=E);const T=_?void 0:this.Kd(null==e?void 0:e.$set_once,t!==si,t===ei);if(T&&(f.$set_once=T),(null==e?void 0:e._noTruncate)||(P=this.config.properties_string_max_length,f=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),pi(s))r=[],jr(s,i=>{r.push(t(i))});else{const i={};Lr(Ri(s)?Hr(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(f,t=>bi(t)?t.slice(0,P):t)),f.timestamp=d,yi(null==e?void 0:e.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=c),_&&(f.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return rn.forEach(s),i.forEach(s),e})(f.properties,p?Bh.concat(p.keep):Bh)),t===ya.DISMISSED||t===ya.SENT){const e=null==i?void 0:i[ba.SURVEY_ID],s=null==i?void 0:i[ba.SURVEY_ITERATION];eh({id:e,current_iteration:s}),f.$set=us(us({},f.$set),{},{[Hu({id:e,current_iteration:s},t===ya.SENT?"responded":"dismissed")]:!0})}else t===ya.SHOWN&&(f.$set=us(us({},f.$set),{},{[ba.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var P;if(t===xa.SHOWN){const t=null==i?void 0:i[Sa.TOUR_TYPE];t&&(f.$set=us(us({},f.$set),{},{[`${Sa.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const O=us(us({},f.properties.$set),f.$set);if(mi(O)||this.setPersonPropertiesForFlags(O),!xi(this.config.before_send)){const t=this.Ds(f,null==p?void 0:p.failed);if(!t)return;f=t,f.uuid=Qe(f.uuid,io)}this.sessionRecording&&!this.sessionRecording.isReplayOff&&!this.fd&&Dh(t)&&(this.fd=!0,setTimeout(()=>this.fd=!1,3e4));const C=[];k.forEach(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=f.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:_i(null===(n=f.properties)||void 0===n?void 0:n.$set)?f.properties.$set[t.property]:void 0;(null==i?void 0:i.pending)&&r===i.value&&C.push({channel:t,value:i.value})}),this.Tr.emit("eventCaptured",f);const R=null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(R),I=us(us(us({method:"POST",url:R,data:f,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:A?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},A&&(null===(o=f.properties)||void 0===o?void 0:o.$session_id)?{batchGroup:f.properties.$session_id+(f.properties.$window_id?`-${f.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),C.length?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Jd(C)}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var M;let t;!I.transport&&!I.callback&&mi(null!==(M=this.config.request_headers)&&void 0!==M?M:{})&&this.ld&&(t="sendBeacon"),this.kd(I,t)}else this.wd.enqueue(I);return null===(l=this.featureFlags)||void 0===l||l.sendFlagCallsPendingCapture(),f}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.Yd)||void 0===i?void 0:i.getExtension(t)}Pd(){var t;return null!==(t=this.Yd)&&void 0!==t?t:this.Yd=new Eh(this)}Rr(t){this.vd.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.vd.indexOf(t);-1!==e&&this.vd.splice(e,1)}}Md(t=!0){var i;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Id(t),!0)}Id(t=!0){var i,e,s;this.yd=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.hd.clear(),this.Xd()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,i,e,s,n){return this.Zd(t,i,e,s,n,!1)}Zd(t,e,n,r,a,u=!1){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;this.Xh(),u||(this.persistence.syncCookieProperties(),this.Md());const h=a?void 0:this.persistence.remove_event_timer(t);let c=us({},e);if(c.token=this.config.token,c.$config_defaults="latest"===this.config.defaults?zh:this.config.defaults,this.Vh()&&(c[jt]=!0),"$snapshot"===t){const t=us(us({},this.persistence.properties()),this.sessionPersistence.properties());return c.distinct_id=t.distinct_id,(!bi(c.distinct_id)&&!Si(c.distinct_id)||wi(c.distinct_id))&&Fr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}const v=function(t,e,n,r=!1){var o,a,u,h;if(!d)return{};const c=t?[...zl,...e||[]]:[],[v,f]=Ue(d),[p,g]=function(t){for(let i=0;We.length>i;i++){const[e,s,n]=We[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(d),_=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};yi(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,w=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,x=null==s||null===(u=s.screen)||void 0===u?void 0:u.width,S=null==s||null===(h=s.screen)||void 0===h?void 0:h.height,k=null==s?void 0:s.devicePixelRatio;yi(b)||(y.userAgentDataPlatform=b),yi(w)||(y.maxTouchPoints=w),yi(x)||(y.screenWidth=x),yi(S)||(y.screenHeight=S),yi(k)||(y.devicePixelRatio=k);const E=Nr(zr({$os:v,$os_version:f,$browser:je(d,navigator.vendor,_,m),$webview_app:p,$webview_app_version:g,$device:ze(d),$device_type:He(d,y),$timezone:Cl(),$timezone_offset:ia()}),{$current_url:jl(r?is(null==l?void 0:l.href):null==l?void 0:l.href,c,ql),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Ne(d,navigator.vendor,_,m),$browser_language:Jl(),$browser_language_prefix:Yl(),$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:i.LIB_NAME,$lib_version:i.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return i.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=i.SDK_DIST_CHANNEL),E}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0);c.$session_id=t,c.$window_id=i}let f,p;this.sessionPropsManager&&Nr(c,this.sessionPropsManager.getSessionProps());try{var g;if(this.sessionRecording){const i=this.sessionRecording.sdkDebugProperties,e=!this.fd&&Dh(t);for(const t in i)(e||ai(Mh,t))&&(c[t]=i[t])}f=null===(g=this.Sd)||void 0===g?void 0:g.length}catch(t){c.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Yu&&(c.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),c=Nr(c,p),"$pageview"===t&&o&&(c.title=o.title),!yi(h)){const t=n.getTime()-h;c.$duration=parseFloat((t/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");const _=this.persistence.properties(),m=this.sessionPersistence.properties(),y=c.$groups,b=_.$groups;_i(y)&&!mi(y)&&(c.$groups=us(us({},_i(b)?b:{}),y)),Lr(["$referrer","$referring_domain"],t=>{t in _&&delete m[t]});const w={};if(this.vd.length>0)for(const t of this.vd.slice())try{Nr(w,t())}catch(t){Fr.error("Failed to produce browser extension event properties",t)}c=Nr({},v,_,m,us(us({},w),c)),f?c.$sdk_debug_retry_queue_size=f:delete c.$sdk_debug_retry_queue_size,c.$is_identified=this._isIdentified(),pi(this.config.property_denylist)?Lr(this.config.property_denylist,function(t){delete c[t]}):Fr.error(Ih+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const x=this.config.sanitize_properties;x&&(Fr.error(Ah),c=x(c,t));const S=this.tv();return c.$process_person_profile=S,S&&!a&&this.ev("_calculate_event_properties"),c}Kd(t,i=!0,e=!1){var s;if(!this.persistence||!this.tv())return t;if(this.ud&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Nr({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Fr.error(Ah),o=l(o,"$set_once")),i&&(this.ud=!0),mi(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i)}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e)}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Md(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.hd.add(t)),this.Xd()}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t)}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.hd.delete(t),this.Xd()}iv(t,i){this.register({[t]:i})}xd(){this.hd.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.hd.clear(),this.Xd()}Xd(){var t;if(!this.dd)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.Ai)||!xo.Ot())return void xo.Dt(this.dd);const i=[];this.hd.forEach(t=>i.push(t)),i.length>0?xo.$t(this.dd,i):xo.Dt(this.dd)}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i=!1,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Tr.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:Rh}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Rh})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Rh})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Rh}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=nh){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Rh}}canRenderSurveyAsync(t,i=!1){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Rh})}nv(t){return!t||wi(t)?(Fr.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Fr.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())||(Fr.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 Fr.uninitializedWarning("posthog.identify");if(Si(t)&&(t=t.toString(),Fr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.nv(t))return;if(!this.ev("posthog.identify"))return;this.Xh();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Md(!1),o=this.persistence.oc();let l=!1;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister(W),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Yt,u=t!==s,h=!u&&o;if(u&&o){var a;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(Ot,Zt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.yd=Ju(t,i,e)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(Ot,Zt);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.lc(),this.capture("$set",{$set:s,$set_once:n})&&(this.yd=Ju(t,i,e))}else(i||e)&&this.setPersonProperties(i,e);u||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(P)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.cc(l)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.ev("posthog.setPersonProperties"))return;const e=Ju(this.get_distinct_id(),t,i);this.yd!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.yd=e)):Fr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(pi(t)?t:[t]).filter(t=>bi(t)&&t.length>0);0!==e.length&&this.ev("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.yd=null)}group(t,i,e){var s;if(!t||!i)return void Fr.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Md();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:us(us({},n),{},{[t]:i})}),(r||e)&&this.tv()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(si,s)}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var e;this.ev("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t)}reset(t){const i=Ei(t)?t:null==t?void 0:t.resetDeviceID,e=Ei(t)||null==t?void 0:t.bootstrap;this.sv(i,!1,e)}sv(t,i=!1,e){var s,n,r,o,l,a;if(Fr.info("reset"),!this.__loaded)return Fr.uninitializedWarning("posthog.reset");const u=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Qh)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Fc());const h=this.get_property(H),c=this.get_property(q),d=this.get_property(lt);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.oc)||void 0===a?void 0:a.call(l),p=this.ed;this.ed=p||i;let g=!1;try{var _,m,y,b,w,x,S,k,E,T,P,O,C;if(null===(_=this.persistence)||void 0===_||_.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.hd.clear(),this.Xd(),yi(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(x=this.logs)||void 0===x||x.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(k=this.persistence)||void 0===k||k.set_property("$user_state","anonymous"),null===(E=this.sessionManager)||void 0===E||E.resetSessionId(),this.yd=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Dt,$device_id:null},"");else{const i=this.config.get_device_id(io());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||yi(c)||this.register({[q]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.Vh()&&(null===(C=this.persistence)||void 0===C||C.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!xi(u)&&!(null===(O=this.sessionManager)||void 0===O?void 0:O.setBootstrapSessionId(u,!0))){const t=us({},e);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var R,A;this.ed=p,f&&(null===(R=this.persistence)||void 0===R||null===(A=R.cc)||void 0===A||A.call(R,g))}var I;this.Ir&&(null===(I=this.conversations)||void 0===I||I.onRemoteConfig(this.Ir)),this.reloadFeatureFlags()}shutdown(t){var i=this;return Li(function*(){if(!i.__loaded)return void Fr.uninitializedWarning("posthog.shutdown");i.ad=!0,clearTimeout(i.Cd),i.Cd=void 0;const t=i.Od;i.Od=void 0;for(const e of[()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.wd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.Sd)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&gi(t.then)&&t.then(void 0,t=>{Fr.error("Error during shutdown",t)})}catch(t){Fr.error("Error during shutdown",t)}})()}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)||void 0===e||e.rv()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.ov()}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?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Fr.critical("Attempting to create alias for existing People user - aborting."),-2):this.ev("posthog.alias")?(yi(i)&&(i=this.get_distinct_id()),t!==i?(this.iv(W,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Fr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=us({},this.config);if(_i(t)){var s,n,r,o,l,a,u,h,c,d,v,f,p,g;Nr(this.config,Vh(t));const w=this.rd();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var _,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(_=this.sessionPersistence)||void 0===_||_.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,i,w),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new pa(us(us({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(us(us({},this.config),{},{persistence:"sessionStorage"}),us(us({},i),{},{persistence:"sessionStorage"}),w)}}const x=this.bd(this.config.debug);var b;Ei(x)&&(this.config.debug=x),Ei(this.config.debug)&&(this.config.debug?(e.DEBUG=!0,ao.Ot()&&ao.$t("ph_debug",!0),Fr.info("set_config",{config:t,oldConfig:i,newConfig:us({},this.config)})):(e.DEBUG=!1,ao.Ot()&&ao.Dt("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this.Fc()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.webMCP)||void 0===a||a.startIfEnabled(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.tracingHeaders)||void 0===h||h.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(v=this.exceptionObserver)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.deadClicksAutocapture)||void 0===f||f.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this.nd(),null===(g=this.externalIntegrations)||void 0===g||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&wl(this,Oh,!1)}}_overrideSDKInfo(t,i){e.LIB_NAME=t,e.LIB_VERSION=i}startSessionRecording(t){const i=!0===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.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)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(us(us({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i)}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t)}get logger(){var i,e;return null!==(i=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==i?i:t.lv}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?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:Uh;return i!==Uh&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}tv(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&mi(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}qd(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.tv()||this.ev("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ev("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ev(t){return"never"===this.config.person_profiles?(Fr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Zh(),this.iv(Ft,!0),!0)}rd(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}nd(){var t,i;const e=this.rd();var s,n,r,o;return this.is_capturing()||(null===(s=this.logs)||void 0===s||s.av(),null===(n=this.heatmaps)||void 0===n||n.discardPending()),(null===(t=this.persistence)||void 0===t?void 0:t.Ai)!==e&&(null===(r=this.persistence)||void 0===r||r.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.Ai)!==e&&(null===(o=this.sessionPersistence)||void 0===o||o.set_disabled(e)),this.Xd(),e}opt_in_capturing(i){var e,s,n;if("always"===this.config.cookieless_mode)return void Fr.warn(Ch);if(this.Vh()){var r,o,l,a,u,h;null===(r=this.sessionRecording)||void 0===r||r.dispose({discardBufferedEvents:!0}),this.sv(!0,!0),null===(o=this.sessionManager)||void 0===o||o.destroy(),null===(l=this.pageViewManager)||void 0===l||l.destroy(),this.sessionManager=new Nu(this),this.pageViewManager=new kl(this),this.persistence&&(this.sessionPropsManager=new Fu(this,this.sessionManager,this.persistence));const i=null!==(a=null===(u=this.config.__extensionClasses)||void 0===u?void 0:u.sessionRecording)&&void 0!==a?a:null===(h=t.__defaultExtensionClasses)||void 0===h?void 0:h.sessionRecording;var c,d;i&&(this.sessionRecording=this.Wh(this.sessionRecording,new i(this)),this.Ir&&(null===(c=this.sessionRecording)||void 0===c||null===(d=c.onRemoteConfig)||void 0===d||d.call(c,this.Ir)))}const v=1===this.consent.consent;var f,p,g,_;v?this.Xh():null===(f=this.heatmaps)||void 0===f||f.discardPending(),this.consent.optInOut(!0),this.nd(),this.Dd(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),null===(g=this.conversations)||void 0===g||g.loadIfEnabled()),v||!yi(null==i?void 0:i.captureEventName)&&!(null==i?void 0:i.captureEventName)||this.capture(null!==(_=null==i?void 0:i.captureEventName)&&void 0!==_?_:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Md(),null===(n=this.featureFlags)||void 0===n||n.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this.Nd()}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.nd(),"on_reject"===this.config.cookieless_mode&&this.sd()):Fr.warn(Ch)}sd(){var t,i,e;const s=this.sessionRecording;null==s||s.dispose({discardBufferedEvents:!0}),null===(t=this.heatmaps)||void 0===t||t.discardPending(),"$posthog_cookieless"!==this.get_distinct_id()&&this.sv(!0,!0),this.register({distinct_id:Dt,$device_id:null}),this.Hh(s),this.sessionRecording=void 0,null===(i=this.sessionManager)||void 0===i||i.destroy(),null===(e=this.pageViewManager)||void 0===e||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Nd(),this.Dd()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.ed&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.nd()}_is_bot(){return r?Uu(r,this.config.custom_blocked_useragents):void 0}Nd(){o&&("visible"===o.visibilityState?this.pd||(this.pd=!0,this.capture(ti,{title:o.title},{send_instantly:!0}),this.gd&&(o.removeEventListener(I,this.gd),this.gd=null)):this.gd||(this.gd=this.Nd.bind(this),Vr(o,I,this.gd)))}debug(t){!1===t?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}Fc(){const t=this.Qh||{};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?(Fr.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,s,n){const r=i in t&&!xi(t[i]),o=e in t&&!xi(t[e]);return r?t[i]:!!o&&(n&&n.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,Fr)}Ds(t,i){var e;if(xi(this.config.before_send))return t;const s=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Pi),n=pi(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=t;for(const e of n)try{if(r=e(r),xi(r)){const i=`Event '${t.event}' was rejected in beforeSend function`;return Ti(t.event)?Fr.warn(`${i}. This can cause unexpected behavior.`):Fr.info(i),null}r.properties&&!mi(r.properties)||Fr.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Fr.error(`Error in beforeSend function for event '${t.event}':`,e),null==i||i(),null}for(const i of s)if(r.properties&&xi(r.properties[i]))return Fr.warn(`Event '${t.event}' had its '${i}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var t;return null===(t=this.pageViewManager.cu)||void 0===t?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)})}bd(t){const i=Ei(t)&&!t,e=ao.Ot()&&"true"===ao.Lt("ph_debug");return!i&&(!!e||t)}};Kh.__defaultExtensionClasses={},Kh.lv=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=Ur(t.prototype[i[e]])}(Kh,["identify"]);const Jh=["[data-ph-capture-value]"];var Yh=class{constructor(t){this._instance=t}refresh(t){var i;const e=this._instance.config,s=_i(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Fc(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Jh}};const Zh=Dr("[ExceptionAutocapture]"),Xh=()=>{},Qh=t=>{var i;if(gi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function tc(t,i,e){try{if(!(i in t))return Xh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return gi(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Qh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Qh(e)}}}catch(t){return Xh}}const ic=Dr("[TracingHeaders]"),ec=Dr("[Web Vitals]"),sc=9e5,nc=["CLS","FCP","INP","LCP"],rc=["INP","LCP"],oc=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],lc="disabled",ac="lazy_loading";function uc(t){return"ph_replay_pending_buffer_"+JSON.stringify([t.persistence_name||t.token,t.token])}const hc=Dr("[SessionRecording]"),cc=[Bt,Ut,zt,Ht,qt,Wt,Vt,Gt,Kt],dc=Dr("[Heatmaps]");function vc(t){return _i(t)&&"clientX"in t&&"clientY"in t&&Si(t.clientX)&&Si(t.clientY)}const fc=Dr("[Product Tours]"),pc=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(nt))},gc=["$set_once","$set"],_c=Dr("[SiteApps]"),mc="Error while initializing PostHog app with config id ";function yc(t,i,e){if(xi(t))return!1;switch(e){case"exact":return t===i;case"contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var bc=class{constructor(t){this.Gi=t,this.Ko=new Set,this.Yo=new Set,this.Xo=new Du,this.tl=(t,i)=>this.el(t,i)&&this.il(t,i)&&this.nl(t,i)&&this.sl(t,i),this.el=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;yi(null===(t=this.Gi)||void 0===t?void 0:t.subscribeCapture)||(this.rl=null===(i=this.Gi)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i,e;null===(t=this.rl)||void 0===t||t.call(this),this.rl=void 0,null===(i=this.Gi)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.Xo=new Du}register(t){var i,e;if(!yi(null===(i=this.Gi)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this.Ko.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.Yo.add((null==t?void 0:t.event)||"")})}),null===(e=this.Gi)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this.Ko.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector)})}),this.Gi.setElementSelectors(t,this)}}replace(t){this.Ko.clear(),this.Yo.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Yo.has(t)||this.Yo.has(i.event))&&this.Ko.forEach(t=>{this.ll(i,t)&&this.Xo.emit("actionCaptured",t.name)})}al(t){this.onAction("actionCaptured",i=>t(i))}ll(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.tl(t,e))return!0;return!1}onAction(t,i){return this.Xo.on(t,i)}il(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.Gi)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!yc(r,i.url,i.url_matching||"contains"))return!1}return!0}nl(t,i){return!!this.ul(t,i)&&!!this.cl(t,i)&&!!this.hl(t,i)}ul(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.dl(t);if(s.length>0)return s.some(t=>yc(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&yc(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}cl(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.dl(t);if(s.length>0)return s.some(t=>yc(t.text,i.text,i.text_matching||"exact")||yc(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!xi(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>yc(t,o,l)));var r,o,l}hl(t,i){var e,s;if(!(null==i?void 0:i.selector))return!0;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return!0;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return!1}dl(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}sl(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||Ku(i.properties.reduce((t,i)=>{const e=pi(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)}},wc=class{constructor(t,i){this.vl=i,this.fl=[],this.Gi=t,this.pl=new Map,this.gl=new Map,this.ml=new Map}yl(){var t,i;this.bl=null===(t=(i=this.Gi).subscribeSession)||void 0===t?void 0:t.call(i,t=>this._l(t))}wl(t){return!1}kl(){return null}Sl(t){}xl(){}$l(t,i){return!!t&&Ku(t.propertyFilters,null==i?void 0:i.properties)}Cl(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s)}})}),e}Tl(t,i,e){const s=(e===_a.Activation?this.pl:this.gl).get(t);let n=[];return this.Ml(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.$l(r,i)})}register(t){this.Il(t,!1)}replace(t){this.Il(t,!0)}Il(t,i){yi(this.Gi.subscribeCapture)||(this.El(t,i),this.Al(t,i))}Al(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.ml.clear(),0===e.length)return void(i&&(null===(s=this.Rl)||void 0===s||s.replace([])));this.Rl||(this.Rl=new bc(this.Gi),this.Rl.init(),this.Rl.al(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.ml.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.ml.set(i.name,s)}})}),i?this.Rl.replace(n):this.Rl.register(n)}Pl(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t)}),t.set(e,n)})}El(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Cl(t,_a.Activation),a=this.Cl(t,_a.Cancellation);i?(this.pl=l,this.gl=a):(this.Pl(this.pl,l),this.Pl(this.gl,a)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.rl)&&void 0!==e||(this.rl=null===(s=(n=this.Gi).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.Ol(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.Fl(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Ll([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.Dl(r),void this.Nl([r])}if(this.gl.has(t)){const e=this.Tl(t,i,_a.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.Ll(e.map(t=>t.id)),e.forEach(t=>this.jl(t.id)))}if(!this.pl.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.pl.get(t)});const o=this.Tl(t,i,_a.Activation);this.ql(o.map(t=>t.id))}onAction(t){this.ml.has(t)&&this.ql(this.ml.get(t)||[])}ql(t){if(0===t.length)return;const i=!!this.Gi.getSessionId(),e=[];for(const s of t)i&&this.wl(s)?this.Dl(s)&&this.Bl(s):e.push(s);e.length>0&&(this.fl=[...new Set([...this.fl,...e])]),this.Ol().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.zl()}Dl(t){this.fl=this.fl.filter(i=>i!==t);const i=this.Hl();return!i.includes(t)&&(this.Ul([...i,t]),this.Wl(),!0)}Ll(t){const i=new Set(t);this.fl=this.fl.filter(t=>!i.has(t));const e=this.Vl(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.Ul(s),0===s.length&&this.Gl()),this.Nl(t),this.zl()}zl(){try{var t;null===(t=this.vl)||void 0===t||t.call(this)}catch(t){this.Ol().error("Error while handling activated items change",t)}}Jl(){const t=this.kl();if(!t)return{};const i=this.Gi.getProperty(t);return i&&"object"==typeof i?i:{}}Bl(t){if(!this.kl())return;const i=this.Jl();this.Sl(us(us({},i),{},{[t]:Date.now()}))}Nl(t){if(!this.kl())return;const i=this.Jl(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(mi(e)?this.xl():this.Sl(e))}Ql(){this.kl()&&this.xl()}getActivationTimestamp(t){if(!this.Hl().includes(t))return;const i=this.Jl()[t];return Si(i)?i:void 0}Vl(){const t=this.Zl();return this.Gi.getProperty(t)||[]}Hl(){const t=this.Vl();if(0===t.length)return[];const i=this.Gi.getProperty(this.Kl()),e=this.Gi.getSessionId();return e&&i===e?t:[]}Wl(){const t=this.Gi.getSessionId();t&&this.Yl(t)}Gl(){this.Xl()}_l(t){const i=this.Gi.getProperty(this.Kl());if(i&&i!==t){const t=this.Vl(),i=this.Jl();t.length>0&&(this.Ul([]),t.filter(t=>Si(i[t])).forEach(t=>this.jl(t))),this.Gl(),this.Ql(),t.length>0&&this.zl()}}getActivatedIds(){return[...new Set([...this.Hl(),...this.fl])].filter(t=>!this.ta(t))}dispose(){var t,i,e;null===(t=this.bl)||void 0===t||t.call(this),this.bl=void 0,null===(i=this.rl)||void 0===i||i.call(this),this.rl=void 0,null===(e=this.Rl)||void 0===e||e.dispose(),this.Rl=void 0}reset(){this.fl=[],this.Vl().length>0&&this.Ul([]),this.Gl(),this.Ql(),this.zl()}getEventToItemsMap(){return this.pl}ea(){return this.Rl}},$c=class extends wc{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.ia=t,this.na=i,this.yl()}Zl(){return L}Kl(){return N}kl(){return B}Sl(t){this.ia.kv.set({[B]:t})}xl(){this.ia.kv.remove(B)}wl(t){var i;let e;this.Ml(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return Si(s)&&s>0}sa(){return ya.SHOWN}Ml(t){this.na.getSurveys(t)}jl(t){this.na.cancelPendingSurvey(t)}Ol(){return ih}Ul(t){this.ia.kv.set({[L]:t})}Yl(t){this.ia.kv.set({[N]:t})}Xl(){this.ia.kv.remove(N)}ta(){return!1}Fl(t,i,e){var s;if(t===ya.SENT&&!1===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return"ignore";let n;return this.Ml(t=>{n=t.find(t=>t.id===i)}),!n||function(t){var i;return qu(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===ya.SHOWN?"consume":"ignore":t===ya.SHOWN?"persist":t===ya.DISMISSED||t===ya.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const xc=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),Sc="SDK is not enabled or survey functionality is not yet loaded",kc="Disabled. Not loading surveys.";var Ec=class{constructor(t){this.ra=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.oa=!1,this.la=!1,this.aa=[],this.ua=[],this.ca=null,this.ha=null,this.qi=!1,this.da=new Set,this.onRemoteConfig=t=>{if(this.qi)return;if(this.Yr.disableSurveys)return;if(!t.ok)return this.la=!0,this.va({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),ih.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(xi(i))return ih.warn("Flags not loaded yet. Not loading surveys.");this.fa=Ei(i)?i:i.length>0,ih.info(`flags response received, isSurveysEnabled: ${this.fa}`),this.loadIfEnabled()},this.va=t=>{this.ua.slice().forEach(i=>this.pa(i,t))}}setup(t){if(!this.qi)return this.ga=t,xc(t.kv.initialize(),()=>{if(this.ga!==t||this.qi)return;this.ga=void 0,this.ia=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.qi?i.dispose():(this.ma=i,this.loadIfEnabled())})}dispose(){var t,i,e,s,n;this.qi||(this.qi=!0,this.ga=void 0,this.ia=void 0,null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.aa=[],this.ua.forEach(t=>{t.active=!1}),this.ua=[],null===(n=this.ya)||void 0===n||n.call(this),this.ya=void 0,this.ca=null,this.da.forEach(t=>clearTimeout(t)),this.da.clear())}get Yr(){return this.ra.get()}getRenderContext(){if(!this.ia)return;const t=this;return{client:this.ia,get config(){return t.Yr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.va()}loadIfEnabled(){if(this.qi||!this.ia)return;const t=this.Yr;if(this._surveyManager)return;if(this.oa)return void ih.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void ih.info(kc);if(t.cookielessMode&&this.ia.isOptedOut)return void ih.info("Not loading surveys in cookieless mode without consent.");const i=this.ra.getExtensions();if(!i)return void this.ba("PostHog Extensions not found.");if(yi(this.fa)&&!t.advancedEnableSurveys)return;const e=this.fa||t.advancedEnableSurveys;this.oa=!0,this.la=!1;try{const t=i.generateSurveys;if(t)return this._a(t,e),void(this.oa=!1);const s=i.loadExternalDependency;if(!s)return this.ba(j),void(this.oa=!1);s(t=>{try{if(this.qi)return;const i=this.ra.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.ba("Could not load surveys script",t):this._a(i.generateSurveys,e)}finally{this.oa=!1}})}catch(t){throw this.oa=!1,this.ba("Error initializing surveys",t),t}}_a(t,i){var e;if(this.qi)return;this._surveyManager=t(i),this._surveyEventReceiver=this.wa(this.ia,this.va);const s=null===(e=this.ia)||void 0===e?void 0:e.kv.get(F);s&&this.ka(s),ih.info("Surveys loaded successfully"),this.Sa(),this.va(),this.xa({isLoaded:!0})}wa(t,i){return new $c(t,this,void 0,i)}ba(t,i){this.la=!0,ih.error(t,i),this.va({isLoaded:!1,error:t}),this.xa({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.aa.push(t),this._surveyManager&&this.xa({isLoaded:!0}),()=>{this.aa=this.aa.filter(i=>i!==t)}}getSurveys(t,i=!1){if(this.qi)return;const e=this.ia;if(!e)return t([],{isLoaded:!1,error:Sc});if(this.Yr.disableSurveys)return ih.info(kc),t([]);const s=e.kv.get(F);if(s&&!i)return t(s,{isLoaded:!0}),void(this.$a()&&this.getSurveys(()=>{},!0));if(this.ca)return void this.ca.then(({surveys:i,context:e})=>{this.qi||t(i,e)}).catch(t=>ih.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{try{return this.Ca(e,t)}catch(t){return ih.error("Error processing surveys response",t),this.Ca(e,{statusCode:0,error:t})}},t=>this.Ca(e,{statusCode:0,error:t}));this.ca=n;const r=()=>{this.ca===n&&(this.ca=null)};n.then(i=>{r(),this.qi||(this.va(i.context),t(i.surveys,i.context))},r).catch(t=>ih.error("Error in survey callback",t))}Ca(t,i){if(this.qi)return{surveys:[],context:{isLoaded:!1,error:Sc}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?ih.error(t):i.error||ih.warn(t),this.ha=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.ha=null;const s=i.json.surveys||[];return t.kv.set({[F]:s,[D]:Date.now()}),this.ka(s),{surveys:s,context:{isLoaded:!0}}}ka(t){const i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(qu(t)||function(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.Ta(i)}Ta(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t)}$a(){return this.Ma()&&!this.ca&&!this.Ia()}Ma(){var t;const i=null===(t=this.ia)||void 0===t?void 0:t.kv.get(D);return Si(i)&&Date.now()-i>3e5}Ia(){return Si(this.ha)&&3e5>Date.now()-this.ha}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};eh(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.va()}xa(t){for(const i of this.aa){if(this.qi)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){ih.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i=!1){if(!xi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ih.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.qi)return()=>{};const e={callback:t,active:!0,revision:0};this.ua.push(e),this.Sa();const s=null===(i=this.ia)||void 0===i?void 0:i.kv.get(F);return this.Yr.disableSurveys||!this._surveyManager&&this.la&&!this.oa||!s&&!xi(this.ha)&&!this.ca?this.pa(e,{isLoaded:!1}):this._surveyManager&&this.pa(e),()=>{var t;e.active=!1,this.ua=this.ua.filter(t=>t!==e),0===this.ua.length&&(null===(t=this.ya)||void 0===t||t.call(this),this.ya=void 0)}}Sa(){var t,i,e;this._surveyManager&&this.ua.length>0&&(null!==(t=this.ya)&&void 0!==t||(this.ya=null===(i=(e=this.ra).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.va)))}pa(t,i){if(this.qi||!t.active)return;const e=++t.revision,s=s=>{if(!this.qi&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e)}catch(t){ih.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(t){ih.error("Error in active matching surveys callback",t)}}Ea(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null}),i}Aa(t){if(xi(this._surveyManager))return{eligible:!1,reason:Sc};const i="string"==typeof t?this.Ea(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Ra(t){var i;if(!(null===(i=this.ia)||void 0===i?void 0:i.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(xi(this._surveyManager))return{eligible:!1,reason:Sc};const e="string"==typeof t?this.Ea(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(xi(this._surveyManager))return ih.warn("init was not called"),{visible:!1,disabledReason:Sc};const i=this.Ra(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return xi(this._surveyManager)?(ih.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Sc})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.Ra(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.ia)||void 0===s?void 0:s.canCapture))return;if(xi(this._surveyManager))return void ih.warn("init was not called");const o="string"==typeof t?this.Ea(t):t;if(!(null==o?void 0:o.id))return void ih.warn("Survey not found");if(!sh.includes(o.type))return void ih.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){ih.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.da.delete(t),!this.qi&&(null===(i=this.ia)||void 0===i?void 0:i.canCapture)&&(ih.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),ih.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.da.add(t)}this._surveyManager.renderSurvey(o,l,e)}else ih.warn("Survey element not found")}displaySurvey(t,i){var e,s;if(!(null===(e=this.ia)||void 0===e?void 0:e.canCapture))return;if(xi(this._surveyManager))return void ih.warn("init was not called");const n=this.Ea(t);if(!n)return void ih.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=us(us({},n),{},{appearance:us(us({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==wa.Popover&&i.initialResponses&&ih.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.Aa(n);if(!t.eligible)return void ih.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==wa.Inline?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties)}cancelPendingSurvey(t){xi(this._surveyManager)?ih.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t)}},Tc=class{constructor(t){this._instance=t}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==f?void 0:f.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e}=t,s=g(i);return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(t){var i,e;const n=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(i=>{"$pageview"!==i&&i!==ya.SHOWN&&i!==ya.DISMISSED&&i!==ya.SENT||t()}),r=()=>t();Vr(s,"PHSurveyShown",r);let o=!1;const l=null===(e=this._instance)||void 0===e?void 0:e.onFeatureFlags(()=>{o&&t()});return o=!0,()=>{o=!1,null==n||n(),null==l||l(),null==s||s.removeEventListener("PHSurveyShown",r)}}};const Pc=(()=>(null==s?void 0:s.location)?Ll(s.location.hash,"__posthog")||Ll(location.hash,"state"):null)(),Oc="_postHogToolbarParams",Cc=Dr("[Toolbar]"),Rc=Dr("[FeatureFlags]"),Ac=Dr("[FeatureFlags]",{debugEnabled:!0}),Ic="\" failed. Feature flags didn't load in time.",Mc=[502,504],Fc=["click","keydown","wheel","touchstart","pointerdown"],Dc="connection_error",jc=(t,i)=>{const e=Object.keys(i||{}).filter(t=>{var e;return null==i||null===(e=i[t])||void 0===e?void 0:e.failed});if(!e.length)return t||{};const s=us({},t);return e.forEach(t=>delete s[t]),s},Lc=(t,i)=>{const e=us({},t);return i.forEach(t=>{var i;(null===(i=e[t])||void 0===i?void 0:i.failed)&&delete e[t]}),e},Nc=(t,i)=>!!(null==i?void 0:i.partialResponse)||!!t.errorsWhileComputingFlags,Bc=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},Uc=t=>{const i={};for(const[e,s]of Br(t||{}))s&&(i[e]=s);return i},zc={version:2},Hc=(t,i)=>t.distinctId===i.distinctId&&t.sessionId===i.sessionId&&((t,i)=>{const e=Object.keys(t);return e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e])})(t.groups,i.groups);var qc=class{constructor(t){this.name="featureFlags",this.uv=!1,this.featureFlagEventHandlers=[],this.R=Rc,this.hv={},this.dv={},this.vv=[],this.fv=new Set,this.pv=new Set,this.gv=!1,this.mv=!1,this.yv=0,this.bv=!1,this._v=!1,this.wv=!1,this.Sv=new Map,this.xv=!1,this.$v=!1,this.Cv=!1,this.Tv=0,this.Mv=!1,this.Iv=!1,this.Ev=new WeakMap,this.Av=new Map,this.mn=()=>{const t=this.Rv();this.Tv=0,t&&this.reloadFeatureFlags()},this.Pv=()=>{var t,i;const e=this.Ov,s=null!==(t=this.Fv)&&void 0!==t?t:e;yi(e)||yi(s)||this.Yr.remoteRequestsDisabled||!this.Lv||"hidden"===this.Lv.visibilityState||Date.now()-(null!==(i=this.Dv)&&void 0!==i?i:0)<s||(this.Fv=this.Mv||!this.Yr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.Mv=!1,this.reloadFeatureFlags(),this.Nv())},this.jv=()=>{this.Mv&&this.Fv===this.Ov||this.qv()},this.gn=()=>{var t;"visible"===(null===(t=this.Lv)||void 0===t?void 0:t.visibilityState)&&this.qv()},this.ra=t}get Bv(){return zc}get zv(){}Hv(){this.ia&&this.Uv()}setup(t){try{this.Wv=typeof window>"u"?void 0:window,this.Lv=typeof document>"u"?void 0:document}catch(t){this.Wv=void 0,this.Lv=void 0}return this.ga=t,this.R=t.logger.createLogger("[FeatureFlags]"),xc(t.kv.initialize(),()=>{this.ga===t&&(this.ga=void 0,this.ia=t,this.Vv(t))})}Vv(t){var i;if(this.ia===t)return this.Wv&&Vr(this.Wv,"online",this.mn),this.Uv(),this.Gv=t.registerDynamicEventProperties(()=>this.Jv()?this.hv:this.dv),this.Qv=null===(i=this.zv)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Zv(),this.Kv(),this.Yv()}),this.Kv(),this.initialize()}qv(){this.Mv=!0,this.Fv=this.Ov,this.Pv()}Uv(){var t;const i=this.Yr.refreshIntervalMs,e=!this.Yr.remoteRequestsDisabled&&this.Lv&&!yi(i)&&i>0?i:void 0;this.Yr.idleRefreshBackoff||(this.Fv=e),e!==this.Ov&&(this.Xv(),yi(e)||(this.Ov=e,this.Fv=e,this.Nv(),(null===(t=this.Lv)||void 0===t?void 0:t.addEventListener)&&(Vr(this.Lv,I,this.gn),jr(Fc,t=>{Vr(this.Lv,t,this.jv,{capture:!0})}))))}Nv(){yi(this.Ov)||(yi(this.tf)||clearInterval(this.tf),this.Dv=Date.now(),this.tf=setInterval(this.Pv,this.Ov))}Xv(){var t,i;yi(this.tf)||(clearInterval(this.tf),this.tf=void 0,null===(t=this.Lv)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.gn),jr(Fc,t=>{var i,e;null===(i=this.Lv)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.jv,{capture:!0})})),this.Ov=void 0,this.Fv=void 0,this.Mv=!1,this.Dv=void 0}destroy(){this.ef()}dispose(){this.ef()}ef(){var t,i,e;this.Xv(),this.yv++,this._v=!1,this.ga=void 0,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this.ia&&(this.nf(),null===(t=this.Gv)||void 0===t||t.dispose(),this.Gv=void 0,null===(i=this.Qv)||void 0===i||i.call(this),this.Qv=void 0,this.vv=[],null===(e=this.Wv)||void 0===e||e.removeEventListener("online",this.mn),this.ia=void 0)}get Yr(){return this.ra.get()}sf(t){var i;return this.rf&&t in this.rf?this.rf[t]:null===(i=this.ia)||void 0===i?void 0:i.kv.get(t)}Zv(){return!!this.rf&&(this.rf=void 0,!0)}lf(){var t;return!yi(null===(t=this.ia)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Zv()}$t(t){this.af(()=>{var i;return null===(i=this.ia)||void 0===i?void 0:i.kv.set(t)})}uf(t,i,e){if(!this.zv||!t.$enabled_feature_flags)return;const s=this.sf("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},r=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,a=l||e&&i.flags?o:e&&!pi(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.sf("$feature_flag_payloads")||{},h=t.$feature_flag_payloads||{},c=l||e?a:Array.from(new Set([...Object.keys(u),...Object.keys(h)])),d=!l&&!e,v=!!d||a,f=!!d||c,p={[m]:v,[k]:v,[C]:f};t.$feature_flag_details&&(p[y]=v);for(const i of[x,w,S])yi(t[i])||(p[i]=!0);this.zv.markCrossTabFeatureFlagChanges(p)}Dt(t){this.af(()=>{var i;return null===(i=this.ia)||void 0===i?void 0:i.kv.remove(t)})}af(t){try{t()}catch(t){this.R.error("Failed to update feature flag persistence",t)}}Kv(){const t={},i=this.sf(y);for(const i of[x,R]){const e=this.sf(i);yi(e)||(t[i]=e)}const e=this.sf(m);e&&(t[m]=e.filter(t=>{var e;return!(null==i||null===(e=i[t])||void 0===e?void 0:e.failed)}));const s=this.sf(C);s&&(t[C]=jc(s,i)),this.hv=t;const n=us({},t),r=jc(this.sf(k),i);if(r)for(const[t,i]of Object.entries(r))n[`$feature/${t}`]=i;this.dv=n}Jv(){const t=this.Yr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.sf(w);return"number"!=typeof i||Date.now()-i>t}cf(){return!!this.Jv()&&(this.Cv||this.mv||(this.Cv=!0,this.R.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hf(){const t=this.Yr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}df(){const t=this.Yr.flagKeys;if(!yi(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Yr,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!yi(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,s)=>(i[s]=e.encodeBootstrapPayloads?JSON.stringify(t[s]):t[s],i),{});return this.vf({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){const s=(null==e?void 0:e.merge)?jc(this.sf(k),this.sf(y)):{},n=(null==e?void 0:e.merge)?jc(this.sf(C),this.sf(y)):{},r=us(us({},s),t),o=us(us({},n),i),l={};for(const[t,i]of Object.entries(r))l[t]={key:t,enabled:sn(i),variant:nn(i),reason:void 0,metadata:yi(null==o?void 0:o[t])?void 0:{id:0,version:void 0,description:void 0,payload:o[t]}};this.vf({flags:l})}get hasLoadedFlags(){return this.gv}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.ff(),i=this.Bv.publicDetail;return i?Object.fromEntries(Object.entries(t).map(([t,e])=>[t,i(e)])):t}ff(){const t=this.sf(y),i=this.sf(R),e=this.sf(A);if(!e&&!i)return t||{};const s=Nr({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r,o;const n=s[t],l=null==i?void 0:i[t],a=yi(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,u=yi(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],c=us(us({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});a!==(null==n?void 0:n.enabled)&&(c.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(c.original_variant=null==n?void 0:n.variant),h&&(c.metadata=us(us({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[t]=c}return this.uv||(this.R.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.uv=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:sn(s),variant:nn(s),payload:en(i[e])}})}getFlagVariants(){const t=jc(this.sf(k),this.sf(y)),i=this.sf(R);if(!i)return t||{};const e=Nr({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.uv||(this.R.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.uv=!0),e}getFlagPayloads(){const t=jc(this.sf(C),this.sf(y)),i=this.sf(A);if(!i)return t||{};const e=Nr({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.uv||(this.R.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.uv=!0),e}reloadFeatureFlags(){this.bv||this.Yr.featureFlagsDisabled||this.Rv()||(this.wv&&this.R.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.mv&&(this._v=!0),this.pf||(this.pf=setTimeout(()=>{this.gf()},5),this.vv.slice().forEach(t=>{try{t()}catch(t){this.R.error("Error while running feature flags reloading callback",t)}})))}reloadFeatureFlagsAsync(){return!this.ia||this.bv||this.Yr.featureFlagsDisabled||this.Yr.remoteRequestsDisabled||this.Rv()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.fv.add(t),this.reloadFeatureFlags()})}if(t,i){t.forEach(t=>t({status:i})),t.clear()}nf(){clearTimeout(this.pf),this.pf=void 0}onReloading(t){return this.vv.push(t),()=>{this.vv=this.vv.filter(i=>i!==t)}}ensureFlagsLoaded(){this.gv||this.mv||this.pf||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.bv=t}resetFlagCallReported(){this.Dt(P),this.Sv=new Map,this.Av=new Map}sendFlagCallsPendingCapture(){var t;if(0!==this.Sv.size&&!this.xv&&(null===(t=this.ia)||void 0===t?void 0:t.canCapture)&&!this.ia.isRateLimited){this.xv=!0;try{const t=this.getFlagVariants();for(const e of Array.from(this.Sv.keys())){var i;const s=this.Sv.get(e);if(!s)continue;const n=null===(i=this.mf(e,t[e]))||void 0===i?void 0:i.calledKey;if(s.value!==String(t[e])||s.calledKey&&s.calledKey!==n||!Hc(s.context,this.yf()))this.Sv.delete(e);else if(this.getFeatureFlagResult(e),this.Sv.has(e))break}}finally{this.xv=!1}}}gf(t){var i;this.nf();const e=this.ia;if(!e||this.Yr.remoteRequestsDisabled||this.Rv())return void this.if(this.fv,"skipped");if(this.mv)return void(this._v=!0);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:us(us(us({},e.initialPersonProperties),this.sf("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.sf(E),timezone:Cl()};yi(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Yr.featureFlagsDisabled)&&(s.disable_flags=!0);const n=this.hf();n.length&&(s.evaluation_contexts=n);const r=this.df();yi(r)||(s.flag_keys=r);const o=this.Yr.onlyEvaluateSurveyFeatureFlags,l=`/flags/?v=${this.Bv.version}${o?"&only_evaluate_survey_feature_flags=true":""}`,a=this.yv,u=this.fv;this.fv=new Set,this.pv=u,this.mv=!0;const h=()=>{this._v&&(this._v=!1,this.gf())},c=t=>{var i;const e=this.bf(t.json),n=200!==t.statusCode;if(this.mv=!1,a!==this.yv)return void h();if(this._f(t.statusCode),n||this._v||(this.$anon_distinct_id=void 0),s.disable_flags&&!this._v)return void this.if(u,"skipped");this.$v=!n;const r=[];t.error?r.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Dc:"unknown_error"):200!==t.statusCode&&r.push(`api_error_${t.statusCode}`),e.errorsWhileComputingFlags&&r.push("errors_while_computing_flags");const l=!!(null===(i=e.quotaLimited)||void 0===i?void 0:i.includes("feature_flags"));l&&r.push("quota_limited"),this.$t({[b]:r}),l?this.R.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):s.disable_flags||this.vf(e,n,{partialResponse:o}),this.if(u,s.disable_flags?"skipped":r.length||!e.flags&&!e.featureFlags?"error":"loaded"),h()},d=t=>{this.mv=!1,a===this.yv?(this.$t({[b]:[Dc]}),this.R.error("Feature flag request failed",t),this.lf()&&this.Yv(!0),this.if(u,"error"),h()):h()};let v=null!==(i=this.Yr.requestMaxRetries)&&void 0!==i?i:1;const f=()=>v>0&&a===this.yv,p=()=>{if(a!==this.yv||!this.ia||this.Yr.remoteRequestsDisabled)return this.mv=!1,this.if(u,"skipped"),void h();try{e.sendRequest(l,{target:"flags",method:"POST",body:s,compression:this.Yr.compression,sentAt:"body",timeoutMs:this.Yr.requestTimeoutMs}).then(t=>{if((t=>Mc.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(p,500);c(t)}).catch(d)}catch(t){d(t)}};p()}bf(t){const i=null!=t?t:{},e=this.Bv.read;if(!e)return i;const{body:s,withoutTypedValues:n}=e(i);return n&&!this.Iv&&(this.Iv=!0,this.R.info("The /flags response has no typed flag values. Its flags are read as before.")),s}Rv(){return Il(this.Tv,3)}_f(t){this.Tv=Ml(t,this.Tv,3,()=>this.R.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."))}wf(t){var i;return!this.gv&&!this.getFlags().length&&!(null===(i=this.getFeatureFlagDetails(t))||void 0===i?void 0:i.failed)}getFeatureFlag(t,i={}){var e;if(i.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlag for key "'+t+Ic);if(this.cf())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){const i=this.ff()[t],e=this.Bv.publicDetail;return i&&e?e(i):i}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){var e;if(i.fresh&&!this.$v)return;if(this.wf(t))return void this.R.warn('getFeatureFlagResult for key "'+t+Ic);if(this.cf())return;const s=null===(e=this.sf("$feature_flag_details"))||void 0===e||null===(e=e[t])||void 0===e?void 0:e.failed,n=s?void 0:this.sf(k),r=s?void 0:this.sf(C),o=this.sf(R),l=!!o&&{}.hasOwnProperty.call(o,t),a=l||!!n&&t in n,u=l?o[t]:null==n?void 0:n[t],h=this.sf(A),c=h&&{}.hasOwnProperty.call(h,t)?h[t]:null==r?void 0:r[t],d=String(u),v=this.sf("$feature_flag_request_id")||void 0,f=this.sf("$feature_flag_evaluated_at")||void 0;let p,g=this.sf("$flag_call_reported")||{};if(this.Yr.deduplicateCallsPerSession){var _;const t=null===(_=this.ia)||void 0===_||null===(_=_.session)||void 0===_?void 0:_.sessionId,i=this.sf(O);t&&t!==i&&(g={},p=t)}if(!i.send_event&&"send_event"in i)p&&this.$t({[P]:g,[O]:p});else{var m,y,b,w;const i=!(null===(m=this.ia)||void 0===m?void 0:m.canCapture),e=!i&&!(null===(y=this.ia)||void 0===y?void 0:y.isRateLimited),s=this.mf(t,u),n=s?s.calledKey:d,r=null==s?void 0:s.exposureKey,o=()=>this.kf(t,d,null==s?void 0:s.calledKey);var x,S;e?this.Sv.delete(t):(i&&Object.keys(g).length>0&&(g={},this.$t({[P]:g})),(!(null===(x=g[t])||void 0===x?void 0:x.includes(n))||r&&!(null===(S=g[t])||void 0===S?void 0:S.includes(r)))&&o());const l=!(null===(b=g[t])||void 0===b?void 0:b.includes(n)),a=!!r&&!(null===(w=g[t])||void 0===w?void 0:w.includes(r));if(e&&s&&(l||a)){p&&this.$t({[P]:g,[O]:p});const i=s.build(this.Sf(t,u,c,v,f)),e=l?this.xf(t,n,i.called,o):void 0;a&&i.exposure&&this.xf(t,r,i.exposure,o,e)}else if(e&&l){pi(g[t])?g[t].push(d):g[t]=[d],this.$t(us({[P]:g},p?{[O]:p}:{}));const i=this.Sf(t,u,c,v,f);this.$f(i)||(this.Cf(t,d),o())}else p&&this.$t({[P]:g,[O]:p})}return a?{key:t,enabled:!!u,variant:"string"==typeof u?u:void 0,payload:en(c)}:void 0}Sf(t,i,e,s,n){var r,o,l,a,u,h,c,d,v,f,p,g,_;const m=this.ff()[t],y=[...null!==(r=this.sf("$feature_flag_errors"))&&void 0!==r?r:[]];yi(i)&&y.push((null==m?void 0:m.failed)?"evaluation_failed":"flag_missing");const b={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:null!=e?e:null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:null!==(o=null===(l=this.Yr.bootstrap)||void 0===l||null===(l=l.featureFlags)||void 0===l?void 0:l[t])&&void 0!==o?o:null,$feature_flag_bootstrapped_payload:null!==(a=null===(u=this.Yr.bootstrap)||void 0===u||null===(u=u.featureFlagPayloads)||void 0===u?void 0:u[t])&&void 0!==a?a:null,$used_bootstrap_value:!this.$v};yi(null==m||null===(h=m.metadata)||void 0===h?void 0:h.has_experiment)||(b.$feature_flag_has_experiment=m.metadata.has_experiment),yi(null==m||null===(c=m.metadata)||void 0===c?void 0:c.version)||(b.$feature_flag_version=m.metadata.version);const w=null!==(d=null==m||null===(v=m.reason)||void 0===v?void 0:v.description)&&void 0!==d?d:null==m||null===(f=m.reason)||void 0===f?void 0:f.code;return w&&(b.$feature_flag_reason=w),(null==m||null===(p=m.metadata)||void 0===p?void 0:p.id)&&(b.$feature_flag_id=m.metadata.id),yi(null==m?void 0:m.original_variant)&&yi(null==m?void 0:m.original_enabled)||(b.$feature_flag_original_response=yi(m.original_variant)?m.original_enabled:m.original_variant),(null==m||null===(g=m.metadata)||void 0===g?void 0:g.original_payload)&&(b.$feature_flag_original_payload=null==m||null===(_=m.metadata)||void 0===_?void 0:_.original_payload),y.length&&(b.$feature_flag_error=y.join(",")),b}mf(t,i){var e,s,n;const r=this.Bv.flagEvents,o=this.sf(R);if(!(!r||_i(o)&&vi.call(o,t)))return r({key:t,response:i,groups:null!==(e=null===(s=this.ia)||void 0===s?void 0:s.groups)&&void 0!==e?e:{},record:null===(n=this.sf("$feature_flag_details"))||void 0===n?void 0:n[t]})}xf(t,i,e,s,n){var r;const o=this.sf("$flag_call_reported")||{},l=t+i,a=this.Av.get(l)||0;if((null===(r=o[t])||void 0===r?void 0:r.includes(i))||a>1)return;this.$t({[P]:us(us({},o),{},{[t]:[...o[t]||[],i].slice(-10)})});let u,h,c=!1,d=!1;this.Ev.set(e.properties,us(us({},e.capture),{},{failed(){c=!0},resolved:t=>(h=t.$session_id,u=JSON.stringify([t.distinct_id,t.$groups,h,t.$process_person_profile]),d=!!n&&u!==n,!d)}));let v=!1;try{var f,p;v=!1!==(null===(f=this.ia)||void 0===f?void 0:f.capture(e.event,e.properties))&&!!(null===(p=this.ia)||void 0===p?void 0:p.canCapture),v||s()}catch(t){c=!0,this.R.error("Failed to capture "+e.event,t)}c&&this.Av.set(l,a+1);const g=v&&!c&&!d;return g||this.Cf(t,i),this.Yr.deduplicateCallsPerSession&&h&&h!==this.sf("$flag_call_reported_session_id")&&this.$t({[P]:g?{[t]:[i]}:{},[O]:h}),u}flagEventCapture(t){return t?this.Ev.get(t):void 0}$f(t){try{var i;return!1!==(null===(i=this.ia)||void 0===i?void 0:i.capture("$feature_flag_called",t))}catch(t){return this.R.error("Failed to capture feature flag call",t),!0}}kf(t,i,e){this.Sv.set(t,{value:i,calledKey:e,context:this.yf()})}yf(){var t,i,e;return{distinctId:null===(t=this.ia)||void 0===t?void 0:t.distinctId,groups:us({},null===(i=this.ia)||void 0===i?void 0:i.groups),sessionId:this.Yr.deduplicateCallsPerSession?null===(e=this.ia)||void 0===e||null===(e=e.session)||void 0===e?void 0:e.sessionId:void 0}}Cf(t,i){const e=this.sf("$flag_call_reported")||{},s=e[t];pi(s)&&s.includes(i)&&(e[t]=s.filter(t=>t!==i),this.$t({[P]:e}))}getRemoteConfigPayload(t,i){this.Tf(t,i)}Tf(t,i){var e=this;return Li(function*(){const s=e.ia;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.hf();r.length&&(n.evaluation_contexts=r);const o=e.df();let l;yi(o)||(n.flag_keys=o);try{var a;const i=null===(a=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Yr.compression,sentAt:"body",timeoutMs:e.Yr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.R.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.R.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.$v)return i.defaultValue;if(this.wf(t))return this.R.warn('isFeatureEnabled for key "'+t+Ic),i.defaultValue;const e=this.getFeatureFlag(t,i);return yi(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.vf(t,i,e)}vf(t,i,e){if(!this.ia)return;var s,n;this.gv=!0,!1!==(null==e?void 0:e.persist)&&Nc(t,e)&&(null===(s=this.zv)||void 0===s||null===(n=s.reconcileFeatureFlagsBeforeMerge)||void 0===n?void 0:n.call(s))&&this.Zv();const r=this.getFlagVariants(),o=!t.flags&&pi(t.featureFlags),l=((t,i={},e={},s={},n,r=Rc)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).filter(t=>!e[t].failed).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>!e[t].failed&&e[t].enabled).filter(t=>{var i;return!yi(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return[t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return us(us({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(pi(a)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(a)for(let i=0;a.length>i;i++)t[a[i]]=!0;return{[m]:a,[k]:t,[y]:Lc(s,a),[C]:jc(e,s),[S]:!1}}let d=a,v=u,f=l;if(Nc(t,n)){const t=t=>({}.hasOwnProperty.call(i,t)&&!yi(i[t])),r=Object.keys(d),o=v||{};d=us(us({},i),d),v=us(us({},e),o),((null==n?void 0:n.partialResponse)||l)&&r.forEach(t=>{t in o||null==v||delete v[t]}),f=l?us(us({},s),Object.fromEntries(Object.entries(l).filter(([i,e])=>!e.failed||!t(i)))):Lc(s,r)}return us(us({[m]:Object.keys(Uc(d)),[k]:d||{},[C]:v||{},[y]:f||{},[S]:!0===t.minimalFlagCalledEvents},h?{[x]:h}:{}),c?{[w]:c}:{})})(t,r,o?this.sf("$feature_flag_payloads")||{}:this.getFlagPayloads(),o?this.sf("$feature_flag_details")||{}:this.ff(),e,this.R);if(l)if(!1===(null==e?void 0:e.persist)){const t=!yi(this.ia.kv.get(k));this.rf=l,t||this.$t(l)}else this.Zv(),this.uf(l,t,!!(null==e?void 0:e.partialResponse)),this.$t(l);else i&&this.lf();i||(this.Cv=!1),this.Yv(i)}override(t,i=!1){this.R.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Mf(t)}Mf(t){if(this.ia){if(!1===t)return this.Dt([R,A]),this.Yv(),void Ac.info("All overrides cleared");if(pi(t))return this.$t({[R]:Bc(t)}),this.Yv(),void Ac.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.uv=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[R]=pi(n)?Bc(n):n),r&&(s[A]=r),Object.keys(s).length&&this.$t(s),!1===n&&!1===r?this.Dt([R,A]):!1===n?this.Dt(R):!1===r&&this.Dt(A),this.Yv(),!1===n?Ac.info("Flag overrides cleared"):n&&Ac.info("Flag overrides set",{flags:n}),void(!1===r?Ac.info("Payload overrides cleared"):r&&Ac.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[R]:t}),this.Yv(),void Ac.info("Flag overrides set",{flags:t});this.R.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.R.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.gv){const{flags:i,flagVariants:e}=this.If();try{t(i,e)}catch(t){this.R.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s,n;const r=(this.sf("$early_access_features")||[]).find(i=>i.flagKey===t),o={[`$feature_enrollment/${t}`]:i},l={$feature_flag:t,$feature_enrollment:i,$set:o};r&&(l.$early_access_feature_name=r.name),e&&(l.$feature_enrollment_stage=e);const a=us(us({},this.getFlagVariants()),{},{[t]:i}),u=us({},this.sf(y)),h=null===(s=u[t])||void 0===s?void 0:s.failed,c=us({},this.sf(C));h&&(delete u[t],delete c[t]),null===(n=this.zv)||void 0===n||n.markCrossTabFeatureFlagChanges(us(us({$active_feature_flags:[t],$enabled_feature_flags:[t]},h?{$feature_flag_details:[t],$feature_flag_payloads:[t]}:{}),{},{$stored_person_properties:Object.keys(o)})),this.$t(us(us({[m]:Object.keys(Uc(a)),[k]:a},h?{[y]:u,[C]:c}:{}),{},{[T]:us(us({},this.sf("$stored_person_properties")||{}),o)})),this.Yv();try{var d;null===(d=this.ia)||void 0===d||d.capture("$feature_enrollment_update",l)}catch(t){this.R.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const s=this.sf(_);!s||i?this.Ef(t,e):t(s)}Ef(t,i){var e=this;return Li(function*(){const s=e.ia;if(!s)return;const n=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,e.$t({[_]:r})}catch(t){return void e.R.error("Early access feature request failed",t)}try{t(r)}catch(t){e.R.error("Early access feature callback failed",t)}})()}If(){const 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),{})}}Yv(t){this.Kv();const{flags:i,flagVariants:e}=this.If(),s=this.wv;this.wv=!0,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.R.error("Error while running feature flags callback",t)}}),this.wv=s}setPersonPropertiesForFlags(t,i=!0){this.Af(t,i)}Af(t,i=!0){const e=this.sf("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.$t({[T]:us(us(us({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=us({},this.sf("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.$t({[T]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(T),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.sf("$stored_group_properties")||{},s=us({},e);for(const i of Object.keys(t))s[i]=us(us({},e[i]),t[i]);this.$t({[E]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.sf("$stored_group_properties")||{};this.$t({[E]:us(us({},i),{},{[t]:{}})})}else this.Dt(E)}reset(){this.yv++,this.if(this.fv,"cancelled"),this.if(this.pv,"cancelled"),this._v=!1,this.hv={},this.dv={},this.rf=void 0,this.gv=!1,this.bv=!1,this.$v=!1,this.$anon_distinct_id=void 0,this.nf(),this.uv=!1,this.Tv=0,this.Sv=new Map,this.Av=new Map}};const Wc=t=>_i(t)&&"value"in t?t:void 0,Vc=t=>bi(t)?t:Si(t)||_i(t)||!0===t,Gc="$experiment_exposure",Kc="experiment_split",Jc="experiment",Yc={targeting_match:["targeted_release","percentage_rollout"],[Kc]:[Jc],rollout_miss:["percentage_rollout",Jc],experiment_paused:[Jc],holdout:[Jc]},Zc="$feature_flag_config_version",Xc="$feature_flag_reason_code",Qc="$feature_flag_rule_id",td="$feature_flag_rule_type",id="$feature_flag_variant_key",ed="$feature_flag_experiment_id",sd="$feature_flag_forced_variant",nd=[Zc,Xc,Qc,td,id],rd=[...nd,"$feature_flag_reason",sd,ed],od=[Zc,Xc,td,"$experiment_exposure_source",ed,sd],ld=["$feature_flag_id","$feature_flag_version","$feature_flag_request_id","$feature_flag_evaluated_at"],ad=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ud=t=>bi(t)?t:void 0,hd={},cd=t=>Si(t)&&t%1==0,dd=[["key",bi],["failed",Ei]],vd=[["code",bi],["condition_index",cd],["description",bi]],fd=[["id",cd],["version",cd],["description",bi],["has_experiment",Ei],["config_version",cd],["rule_type",bi],["rule_id",bi],["variant_key",bi],["forced_variant",Ei],["experiment_id",cd]],pd=(t,i)=>{if(xi(t))return;if(!_i(t))throw hd;const e={};for(const[s,n]of i){const i=t[s];if(!xi(i)){if(!n(i))throw hd;e[s]=i}}return e},gd=(t,i)=>{const e=pd(i,dd),s=null==i?void 0:i.value;if(!e||!($i(s)||Ei(s)||bi(s)||_i(s)||Si(s)&&isFinite(s)))throw hd;const n=i.metadata,r=pd(n,fd),o=!0===e.failed,l=o?null:s,a=Si(l)||_i(l),u=Vc(l);return{key:t,enabled:!1!==u,variant:bi(u)?u:null,value:l,reason:pd(i.reason,vd),metadata:r||a?us(us({},r),{},{payload:o?null:a?JSON.stringify(l):null==n?void 0:n.payload,experiment_id:void 0}):void 0,failed:o||void 0}},_d=["config_version","rule_type","rule_id","variant_key","forced_variant"],md={version:4,read(t){const i=_i(t)?t.flags:void 0;let e=!1;if(!_i(i)){const i=_i(t)?t.featureFlags:void 0;return{body:t,withoutTypedValues:_i(i)&&Object.keys(i).length>0}}const s=Object.fromEntries(Object.keys(i).map(t=>{const s=i[t];if(_i(s)&&!("value"in s))return e=!0,[t,s];try{return[t,gd(t,s)]}catch(i){return[t,{key:t,enabled:!1}]}}));return{body:us(us({},t),{},{flags:s}),withoutTypedValues:e}},publicDetail(t){if(!Wc(t))return t;const i=us({},t);if(delete i.value,_i(i.metadata)){const t=i.metadata=us({},i.metadata);for(const i of _d)delete t[i]}return i},flagEvents(t){const{key:i,response:e,record:s}=t,n=(t=>{var i;const e=Wc(t),s=null==e?void 0:e.metadata;if(!e||2!==(null==s?void 0:s.config_version))return;const n=ud(null===(i=e.reason)||void 0===i?void 0:i.code)||void 0;let r,o,l;const a=n&&vi.call(Yc,n)?Yc[n]:void 0,u=ud(s.rule_id),h=ud(s.rule_type);return!e.failed&&a&&u&&ad.test(u)&&h&&-1!==a.indexOf(h)&&(n!==Kc?(r=u,o=h):bi(s.variant_key)&&(r=u,o=h,l=s.variant_key)),{reasonCode:n,ruleId:r,ruleType:o,variantKey:l}})(s),r=Wc(s);if(!n||!r||(r.failed?!yi(e):Vc(r.value)!==e))return;const{reasonCode:o,ruleId:l,ruleType:a,variantKey:u}=n,h=Object.keys(t.groups).sort().map(i=>[i,t.groups[i]]),c={[Zc]:2};o&&(c[Xc]=o),l&&(c[Qc]=l,c[td]=a);const d=bi(u);return d&&(c[id]=u),{calledKey:JSON.stringify([e,h,2,o||null,l||null,a||null,d?u:null]),exposureKey:d?JSON.stringify([Gc,h,2,l,u]):void 0,build(t){const s=us(us({},t),c);delete s.$feature_flag_reason;const n={event:"$feature_flag_called",properties:s,capture:{omit:rd.filter(t=>!(t in s)),keep:nd}};if(!d)return{called:n,exposure:void 0};const r={};for(const t of ld)yi(s[t])||(r[t]=s[t]);return r.$feature_flag=i,r.$feature_flag_response=e,r[id]=u,r[Qc]=l,r.locally_evaluated=!1,{called:n,exposure:{event:Gc,properties:r,capture:{omit:od,keep:[]}}}}}}},yd=Dr("[FeatureFlags]");var bd=class{constructor(t,i=!1){this.Rf=!1,this.update(t,i)}update(t,i){this.Pf=((t,i)=>{var e,s,n,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},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!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:yi(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:pi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Rf||(yd.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Rf=!0),yi(t.flag_keys)||pi(t.flag_keys)||yd.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Pf}};const wd=t=>Ri(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),$d=Dr("[Error tracking]"),xd="webkit-masked-url:",Sd=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],kd=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",xd],Ed=["__firefox__","__gCrWeb"];function Td(t,i){this.v=t,this.k=i}function Pd(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);i>e;e++)s[e]=t[e];return s}function Od(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var s,n,r,o,l=[],a=!0,u=!1;try{if(r=(e=e.call(t)).next,0===i){if(Object(e)!==e)return;a=!1}else for(;!(a=(s=r.call(e)).done)&&(l.push(s.value),l.length!==i);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return Pd(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Pd(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cd(t){var i,e;function s(i,e){try{var r=t[i](e),o=r.value,l=o instanceof Td;Promise.resolve(l?o.v:o).then(function(e){if(l){var a="return"===i&&o.k?i:"next";if(!o.k||e.done)return s(a,e);e=t[a](e).value}n(!!r.done,e)},function(t){s("throw",t)})}catch(t){n(2,t)}}function n(t,n){2===t?i.reject(n):i.resolve({value:n,done:t}),(i=i.next)?s(i.key,i.arg):e=null}this._invoke=function(t,n){return new Promise(function(r,o){var l={key:t,arg:n,resolve:r,reject:o,next:null};e?e=e.next=l:(i=e=l,s(t,n))})},"function"!=typeof t.return&&(this.return=void 0)}Cd.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Cd.prototype.next=function(t){return this._invoke("next",t)},Cd.prototype.throw=function(t){return this._invoke("throw",t)},Cd.prototype.return=function(t){return this._invoke("return",t)};const Rd=Object.entries,Ad=Object.keys,Id=Object.setPrototypeOf,Md=Object.isFrozen,Fd=Object.getPrototypeOf,Dd=Object.getOwnPropertyDescriptor;let jd=Object.freeze,Ld=Object.seal,Nd=Object.create,Bd="undefined"!=typeof Reflect&&Reflect,Ud=Bd.apply,zd=Bd.construct;jd||(jd=function(t){return t}),Ld||(Ld=function(t){return t}),Ud||(Ud=function(t,i){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return t.apply(i,s)}),zd||(zd=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return new t(...e)});const Hd=fv([].forEach),qd=fv([].lastIndexOf),Wd=fv([].pop),Vd=fv([].push),Gd=fv([].slice),Kd=fv([].splice),Jd=Array.isArray,Yd=pv(Set),Zd=fv(Set.prototype.add),Xd=fv(Set.prototype.has),Qd=fv("".toLowerCase),tv=fv("".toString),iv=fv("".match),ev=fv("".replace),sv=fv("".indexOf),nv=fv("".trim),rv=fv((0).toString),ov=fv(Boolean.prototype.toString),lv="undefined"==typeof BigInt?null:fv(BigInt.prototype.toString),av="undefined"==typeof Symbol?null:fv(Symbol.prototype.toString),uv=fv({}.hasOwnProperty),hv=fv({}.toString),cv=/t/.test,dv=function(t,i){return t instanceof RegExp&&(t.lastIndex=0),Ud(cv,t,[i])},vv=pv(TypeError);function fv(t){return function(i){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;e>n;n++)s[n-1]=arguments[n];return Ud(t,i,s)}}function pv(t){return function(){for(var i=arguments.length,e=new Array(i),s=0;i>s;s++)e[s]=arguments[s];return zd(t,e)}}function gv(t,i){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Qd;if(Id&&Id(t,null),!Jd(i))return t;let s=i.length;for(;s--;){let n=i[s];if("string"==typeof n){const t=e(n);t!==n&&(Md(i)||(i[s]=t),n=t)}t[n]=!0}return t}function _v(t){for(let i=0;t.length>i;i++)uv(t,i)||(t[i]=null);return t}function mv(t){const i=Nd(null);for(const s of Rd(t)){var e=Od(s,2);const n=e[0],r=e[1];uv(t,n)&&(i[n]=Jd(r)?_v(r):r&&"object"==typeof r&&r.constructor===Object?mv(r):r)}return i}function yv(t){const i=Nd(null),e=Ad(t);let s=e.length;for(;s--;)i[e[s]]=t[e[s]];return i}function bv(t,i){for(;null!==t;){const e=Dd(t,i);if(e){if(e.get)return fv(e.get);if("function"==typeof e.value)return fv(e.value)}t=Fd(t)}return function(){return null}}const wv=jd(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$v=jd(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),xv=jd(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Sv=jd(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),kv=jd(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ev=jd(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Tv=jd(["#text"]),Pv=jd(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Ov=jd(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Cv=jd(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Rv=jd(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Av=Ld(/{{[\w\W]*|^[\w\W]*}}/g),Iv=Ld(/<%[\w\W]*|^[\w\W]*%>/g),Mv=Ld(/\${[\w\W]*/g),Fv=Ld(/{{|}}|\${|<%|%>|<%|%>/),Dv=Ld(/^data-[\-\w.\u00B7-\uFFFF]+$/),jv=Ld(/^aria-[\-\w]+$/),Lv=Ld(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nv=Ld(/^(?:\w+script|data):/i),Bv=Ld(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Uv=Ld(/^html$/i),zv=Ld(/^[a-z][.\w]*(-[.\w]+)+$/i),Hv=Ld(/<[/\w!]/g),qv=Ld(/<[/\w]/g),Wv=Ld(/<\/no(script|embed|frames)/i),Vv=Ld(/\/>/i),Gv=Ld(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i),Kv=Ld(/^[\r\n\t ]+/),Jv=jd(gv({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Yv=function(){return"undefined"==typeof window?null:window},Zv=function(t,i,e,s){return uv(t,i)&&Jd(t[i])?gv(s.base?yv(s.base):{},t[i],s.transform):e},Xv=function(t,i,e){const s=uv(t,i)?t[i]:void 0;return s&&"object"==typeof s?mv(s):e};var Qv=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Yv();const e=i=>t(i);if(e.version="3.4.18",e.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return e.isSupported=!1,e;let s=i.document;const n=s,r=n.currentScript,o=i.HTMLTemplateElement,l=i.Node,a=i.NodeFilter,u=i.DOMParser,h=i.trustedTypes,c=i.Element.prototype,d=bv(c,"cloneNode"),v=bv(c,"remove"),f=bv(c,"removeAttributeNode"),p=bv(c,"nextSibling"),g=bv(c,"childNodes"),_=bv(c,"parentNode"),m=bv(c,"shadowRoot"),y=bv(c,"attributes"),b=l&&l.prototype?bv(l.prototype,"nodeType"):null,w=l&&l.prototype?bv(l.prototype,"nodeName"):null,x=l&&l.prototype?bv(l.prototype,"ownerDocument"):null,S=function(t){return b?b(t):t.nodeType},k=function(t){return w?w(t):t.nodeName},E=function(t){for(;null!==t;){const i=Dd(t,"namespaceURI");if(i)return i.get?fv(i.get):null;t=Fd(t)}return null}(c),T=function(t){return E?E(t):t.namespaceURI};if("function"==typeof o){const t=s.createElement("template");t.content&&t.content.ownerDocument&&(s=t.content.ownerDocument)}let P,O,C="",R=!1,A=0;const I=function(){if(A>0)throw vv('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},M=function(t){I(),A++;try{return P.createHTML(t)}finally{A--}},F=function(t){return P&&mt?M(t):t},D=s.implementation,j=s.createNodeIterator,L=s.createDocumentFragment,N=s.getElementsByTagName,B=n.importNode;let U={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported="function"==typeof Rd&&"function"==typeof _&&D&&void 0!==D.createHTMLDocument;const z=Av,H=Iv,q=Mv,W=Dv,V=jv,G=Nv,K=Bv,J=zv;let Y=Lv,Z=null;const X=gv({},[...wv,...$v,...xv,...kv,...Tv]);let Q=null;const tt=gv({},[...Pv,...Ov,...Cv,...Rv]);let it=null,et=null,st=null;const nt=Object.seal(Nd(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let rt=!0,ot=!0,lt=!1,at=!0,ut=!1,ht=!0,ct=!1,dt=!1,vt=null,ft=null,pt=!1,gt=!1,_t=!1,mt=!1,yt=!0,bt=!1;const wt="user-content-";let $t=!0,xt=!1,St=null,kt=!1,Et=null;const Tt=gv({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Pt=null;const Ot=gv({},["audio","video","img","source","image","track"]);let Ct=null;const Rt=gv({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),At="http://www.w3.org/1998/Math/MathML",It="http://www.w3.org/2000/svg",Mt="http://www.w3.org/1999/xhtml";let Ft=Mt,Dt=!1,jt=null;const Lt=gv({},[At,It,Mt],tv),Nt=jd(gv({},["mi","mo","mn","ms","mtext"]));let Bt=null;const Ut=jd(gv({},["annotation-xml"]));let zt=null;const Ht=jd(Nd(null)),qt=gv({},["title","style","font","a","script"]);let Wt=null;const Vt=["application/xhtml+xml","text/html"];let Gt=null,Kt=null;const Jt=s.createElement("form"),Yt=function(t){return t instanceof RegExp||t instanceof Function},Zt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t&&"object"==typeof t||(t={}),t=mv(t),Wt=-1===Vt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Gt="application/xhtml+xml"===Wt?tv:Qd,Z=Zv(t,"ALLOWED_TAGS",X,{transform:Gt}),Q=Zv(t,"ALLOWED_ATTR",tt,{transform:Gt}),jt=Zv(t,"ALLOWED_NAMESPACES",Lt,{transform:tv}),Ct=Zv(t,"ADD_URI_SAFE_ATTR",Rt,{transform:Gt,base:Rt}),Pt=Zv(t,"ADD_DATA_URI_TAGS",Ot,{transform:Gt,base:Ot}),Et=Zv(t,"FORBID_CONTENTS",Tt,{transform:Gt}),et=Zv(t,"FORBID_TAGS",Nd(null),{transform:Gt}),st=Zv(t,"FORBID_ATTR",Nd(null),{transform:Gt}),kt=!!uv(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?mv(t.USE_PROFILES):t.USE_PROFILES),rt=!1!==t.ALLOW_ARIA_ATTR,ot=!1!==t.ALLOW_DATA_ATTR,lt=t.ALLOW_UNKNOWN_PROTOCOLS||!1,at=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,ut=t.SAFE_FOR_TEMPLATES||!1,ht=!1!==t.SAFE_FOR_XML,ct=t.WHOLE_DOCUMENT||!1,gt=t.RETURN_DOM||!1,_t=t.RETURN_DOM_FRAGMENT||!1,mt=t.RETURN_TRUSTED_TYPE||!1,pt=t.FORCE_BODY||!1,yt=!1!==t.SANITIZE_DOM,bt=t.SANITIZE_NAMED_PROPS||!1,$t=!1!==t.KEEP_CONTENT,xt=t.IN_PLACE||!1,Y=function(t){if(!t)return!1;try{return dv(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Lv,Ft="string"==typeof t.NAMESPACE?t.NAMESPACE:Mt,Bt=Xv(t,"MATHML_TEXT_INTEGRATION_POINTS",Nt),zt=Xv(t,"HTML_INTEGRATION_POINTS",Ut);const i=Xv(t,"CUSTOM_ELEMENT_HANDLING",Ht);if(it=Nd(null),uv(i,"tagNameCheck")&&Yt(i.tagNameCheck)&&(it.tagNameCheck=i.tagNameCheck),uv(i,"attributeNameCheck")&&Yt(i.attributeNameCheck)&&(it.attributeNameCheck=i.attributeNameCheck),uv(i,"allowCustomizedBuiltInElements")&&"boolean"==typeof i.allowCustomizedBuiltInElements&&(it.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),Ld(it),ut&&(ot=!1),_t&&(gt=!0),kt&&((uv(t,"ALLOWED_TAGS")||uv(t,"ALLOWED_ATTR"))&&"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("DOMPurify: USE_PROFILES overrides ALLOWED_TAGS and ALLOWED_ATTR. Do not use these options together."),Z=gv({},Tv),Q=Nd(null),!0===kt.html&&(gv(Z,wv),gv(Q,Pv)),!0===kt.svg&&(gv(Z,$v),gv(Q,Ov),gv(Q,Rv)),!0===kt.svgFilters&&(gv(Z,xv),gv(Q,Ov),gv(Q,Rv)),!0===kt.mathMl&&(gv(Z,kv),gv(Q,Cv),gv(Q,Rv))),nt.tagCheck=null,nt.attributeCheck=null,uv(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?nt.tagCheck=t.ADD_TAGS:Jd(t.ADD_TAGS)&&(Z===X&&(Z=yv(Z)),gv(Z,t.ADD_TAGS,Gt))),uv(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?nt.attributeCheck=t.ADD_ATTR:Jd(t.ADD_ATTR)&&(Q===tt&&(Q=yv(Q)),gv(Q,t.ADD_ATTR,Gt))),uv(t,"ADD_FORBID_CONTENTS")&&Jd(t.ADD_FORBID_CONTENTS)&&(Et===Tt&&(Et=yv(Et)),gv(Et,t.ADD_FORBID_CONTENTS,Gt)),$t&&(Z["#text"]=!0),ct&&gv(Z,["html","head","body"]),Z.table&&(Z.tbody=!0,delete et.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw vv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw vv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=P;P=t.TRUSTED_TYPES_POLICY;try{C=M("")}catch(t){throw P=i,t}}else null===t.TRUSTED_TYPES_POLICY?(P=void 0,C=""):(void 0===P&&(R||(O=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let e=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(e=i.getAttribute(s));const n="dompurify"+(e?"#"+e:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(h,r),R=!0),P=O),P&&"string"==typeof C&&(C=M("")));Kt=jd(t)},Xt=gv({},[...$v,...xv,...Sv]),Qt=gv({},[...kv,...Ev]),ti=function(t){Vd(e.removed,{element:t});try{_(t).removeChild(t)}catch(i){if(v(t),!_(t))throw vv("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ii=function(t,i,e){try{f(t,i)}catch(i){try{t.removeAttribute(e)}catch(t){}}},ei=function(t){oi(t);const i=g(t);i&&Hd(Gd(i),t=>{try{v(t)}catch(t){}}),1===S(t)&&ni(t,!1)},si=function(t,i,s){if(!s)try{s=i.getAttributeNode(t)}catch(t){s=null}if(Vd(e.removed,{attribute:s||null,from:i}),s)ii(i,s,t);else try{i.removeAttribute(t)}catch(t){}if("is"===t)if(gt||_t)try{ti(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},ni=function(t,i){const e=y(t);if(e)for(let s=e.length-1;s>=0;--s){const n=e[s],r=n&&n.name;"string"!=typeof r||i&&Q[Gt(r)]||ii(t,n,r)}},ri=function(t,i){let e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=[t];for(;s.length>0;){const t=s.pop();if(!1===i(t))continue;if(e&&1===S(t)){const i=m(t);mi(i)&&s.push(i)}const n=g(t);if(n)for(let t=n.length-1;t>=0;--t)s.push(n[t])}},oi=function(t){ri(t,t=>{1===S(t)&&ni(t,!0)})},li=function(t){const i=[];return ri(t,t=>{i.push(t)},!0),i},ai=function(t,i){let s=!1;return Hd(e.removed,i=>{i.element&&(s=s||i.element===t,oi(i.element))}),function(t,i){const e=Yd();Hd(li(t),t=>{1===S(t)&&Zd(e,t)}),Hd(i,t=>{1!==S(t)||Xd(e,t)||ni(t,!0)})}(t,i),s},ui=function(t,i,e,s){const n=di(t);let r;for(;r=n.nextNode();)Xd(s,r)&&!Xd(St,r)&&(i&&bi(U.uponSanitizeShadowNode,r,null),Ri(r,e))},hi=function(t,i){return!!ht&&("patchsrc"===t||"for"===t&&"label"!==i&&"output"!==i)},ci=function(t){let i=null,e=null;if(pt)t="<remove></remove>"+t;else{const i=iv(t,Kv);e=i&&i[0]}"application/xhtml+xml"===Wt&&Ft===Mt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=P?M(t):t;if(Ft===Mt)try{i=(new u).parseFromString(n,Wt)}catch(t){}if(!i||!i.documentElement){i=D.createDocument(Ft,"template",null);try{i.documentElement.innerHTML=Dt?C:n}catch(t){}}const r=i.body||i.documentElement;return t&&e&&r.insertBefore(s.createTextNode(e),r.childNodes[0]||null),Ft===Mt?N.call(i,ct?"html":"body")[0]:ct?i.documentElement:r},di=function(t){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const e=x?x(t):t.ownerDocument;return j.call(e||t,t,(i?0:a.SHOW_ELEMENT)|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},vi=function(t){return t=ev(t,z," "),t=ev(t,H," "),ev(t,q," ")},fi=function(t){var i;pi(t);const e=null===(i=t.querySelectorAll)||void 0===i?void 0:i.call(t,"template");e&&Hd(e,t=>{mi(t.content)&&fi(t.content)})},pi=function(t){t.normalize();const i=di(t,!0);let e=i.nextNode();for(;e;)e.data=vi(e.data),e=i.nextNode()},gi=function(t){const i=w?w(t):null;return"string"==typeof i&&"form"===Gt(i)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==y(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.removeAttributeNode||"function"!=typeof t.getAttributeNode||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==b(t)||t.childNodes!==g(t))},_i=function(t){if(!b||"object"!=typeof t||null===t)return null;try{const i=b(t);return"number"==typeof i?i:null}catch(t){return null}},mi=function(t){return 11===_i(t)},yi=function(t){return null!==_i(t)};function bi(t,i,s){0!==t.length&&Hd(t,t=>{t.call(e,i,s,Kt)})}const wi=function(t,i){if(t instanceof RegExp)return dv(t,i);if(t instanceof Function){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return Boolean(t(i,...s))}return!1},$i=function(t,i,e,s){return 0===t.length?i:i===e||i===s?yv(i):i},xi=function(t,i){return t!==i&&null===_(t)&&(xt&&oi(t),!0)},Si=function(t,i){if(St&&Zd(St,t),bi(U.beforeSanitizeElements,t,null),xi(t,i))return!0;if(gi(t))return ti(t),!0;const s=Gt(k(t)),n=S(t);if(Z=$i(U.uponSanitizeElement,Z,X,vt),bi(U.uponSanitizeElement,t,{tagName:s,allowedTags:Z}),xi(t,i))return!0;if(function(t,i,e){return!!(ht&&1===e&&t.hasChildNodes()&&!yi(t.firstElementChild)&&dv(Hv,t.textContent)&&dv(Hv,t.innerHTML))||!!(ht&&Jv[i]&&1===e&&T(t)===Mt&&(yi(t.firstElementChild)||"string"==typeof t.textContent&&dv(Hv,t.textContent)))||7===e||!(!ht||8!==e||!dv(qv,t.data))}(t,s,n))return ti(t),!0;if(et[s]||!(nt.tagCheck instanceof Function&&nt.tagCheck(s))&&!Z[s]){const e=function(t,i,e){if(!et[i]&&Ti(i)&&wi(it.tagNameCheck,i))return!1;if($t&&!Et[i]&&!Et[Qd(i)]){const i=_(t),s=g(t);if(s&&i)for(let n=s.length-1;n>=0;--n){const r=t===e?d(s[n],!0):s[n];i.insertBefore(r,p(t))}}return ti(t),!0}(t,s,i);return!(!1!==e||(bi(U.afterSanitizeElements,t,null),!xi(t,i)))||e}if(1===n&&!function(t){const i=T(t),e=Qd(k(t)),s=_(t);let n=Ft,r="template";return s&&1===S(s)&&(n=T(s),r=Qd(k(s))),!!jt[i]&&(i===It?function(t,i,e){return i===Mt?"svg"===t:i===At?"svg"===t&&("annotation-xml"===e||Bt[e]):Boolean(Xt[t])}(e,n,r):i===At?function(t,i,e){return i===Mt?"math"===t:i===It?"math"===t&&zt[e]:Boolean(Qt[t])}(e,n,r):i===Mt?function(t,i,e){return!(i===It&&!zt[e])&&!(i===At&&!Bt[e])&&!Qt[t]&&(qt[t]||!Xt[t])}(e,n,r):"application/xhtml+xml"===Wt)}(t))return ti(t),!0;if(("noscript"===s||"noembed"===s||"noframes"===s)&&dv(Wv,t.innerHTML))return ti(t),!0;if(ut&&3===n){const i=t.textContent,s=vi(i);i!==s&&(Vd(e.removed,{element:t.cloneNode()}),t.textContent=s)}return bi(U.afterSanitizeElements,t,null),xi(t,i)},ki=function(t,i,e){if(st[i])return!1;if(hi(i,t))return!1;if(yt&&("id"===i||"name"===i)&&(e in s||e in Jt))return!1;const n=Q[i]||nt.attributeCheck instanceof Function&&nt.attributeCheck(i,t);if(ot&&dv(W,i))return!0;if(rt&&dv(V,i))return!0;if(!n)return Ti(t)&&wi(it.tagNameCheck,t)&&wi(it.attributeNameCheck,i,t)||"is"===i&&it.allowCustomizedBuiltInElements&&wi(it.tagNameCheck,e);if(Ct[i])return!0;const r=ev(e,K,"");return!(!dv(Y,r)&&("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==sv(e,"data:")||!Pt[t])&&(!lt||dv(G,r))&&e)},Ei=gv({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ti=function(t){return!Ei[Qd(t)]&&dv(J,t)},Pi=function(t,i,e,s){if(P&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!e)switch(h.getAttributeType(t,i)){case"TrustedHTML":return M(s);case"TrustedScriptURL":return function(t){I(),A++;try{return P.createScriptURL(t)}finally{A--}}(s)}return s},Oi=function(t,i,e,s){try{return e?t.setAttributeNS(e,i,s):t.setAttribute(i,s),!gi(t)||(ti(t),!1)}catch(e){return si(i,t),!1}},Ci=function(t,i){return!(!ht||!dv(Gv,i))||"attributename"===Qd(t)&&-1!==sv(i,"href")},Ri=function(t,i){Si(t,i),function(t,i){if(bi(U.beforeSanitizeAttributes,t,null),xi(t,i))return;const s=t.attributes;if(!s||gi(t))return;Q=$i(U.uponSanitizeAttribute,Q,tt,ft);const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Q,forceKeepAttr:void 0};let r=s.length;const o=Gt(k(t));for(;r--;){const i=s[r],l=i.name,a=i.namespaceURI,u=i.value,h=Gt(l),c=u;let d="value"===l?c:nv(c),v=!1;n.attrName=h,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,bi(U.uponSanitizeAttribute,t,n),d=n.attrValue,!bt||"id"!==h&&"name"!==h||0===sv(d,wt)||(si(l,t,i),d=wt+d,v=!0),Ci(l,d)?si(l,t,i):n.forceKeepAttr||(!n.keepAttr||!at&&dv(Vv,d)?si(l,t,i):(ut&&(d=vi(d)),ki(o,h,d)?(d=Pi(o,h,a,d),d!==c&&Oi(t,l,a,d)&&v&&Wd(e.removed)):si(l,t,i)))}bi(U.afterSanitizeAttributes,t,null),xi(t,i)}(t,i),mi(t.content)&&Ai(t.content)},Ai=function(t){let i=null;const e=di(t);for(bi(U.beforeSanitizeShadowDOM,t,null);i=e.nextNode();)if(bi(U.uponSanitizeShadowNode,i,null),Ri(i,t),1===S(i)){const t=m(i);mi(t)&&(Ii(t),Ai(t))}ut&&pi(t),bi(U.afterSanitizeShadowDOM,t,null)},Ii=function(t){const i=[{node:t,shadow:null}];for(;i.length>0;){const t=i.pop();if(t.shadow){Ai(t.shadow);continue}const e=t.node,s=1===S(e),n=g(e);if(n)for(let t=n.length-1;t>=0;--t)i.push({node:n[t],shadow:null});if(s){const t=w?w(e):null;if("string"==typeof t&&"template"===Gt(t)){const t=e.content;mi(t)&&i.push({node:t,shadow:null})}}if(s){const t=m(e);mi(t)&&i.push({node:null,shadow:t},{node:t,shadow:null})}}};return e.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,r=null,o=null,l=null;if(Dt=!t,Dt&&(t="\x3c!--\x3e"),"string"!=typeof t&&!yi(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return rv(t);case"boolean":return ov(t);case"bigint":return lv?lv(t):"0";case"symbol":return av?av(t):"Symbol()";case"undefined":default:return hv(t);case"function":case"object":{if(null===t)return hv(t);const i=t,e=bv(i,"toString");if("function"==typeof e){const t=e(i);return"string"==typeof t?t:hv(t)}return hv(t)}}}(t)))throw vv("dirty is not a string, aborting");if(!e.isSupported)return t;dt?(Z=vt,Q=ft):Zt(i),e.removed=[];const a=xt&&"string"!=typeof t&&yi(t);let u=[];const h=St;if(a){ht&&ri(t,t=>{const i=S(t);if(7===i||8===i&&dv(qv,t.data)){try{v(t)}catch(t){}return!1}if(1===i){const i=t,e=Gt(k(t));try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&hi("for",e)&&i.removeAttribute("for")}catch(t){}}return!0});const i=k(t);if("string"==typeof i){const e=Gt(i);if(!Z[e]||et[e])throw ei(t),vv("root node is forbidden and cannot be sanitized in-place")}if(gi(t))throw ei(t),vv("root node is clobbered and cannot be sanitized in-place");u=li(t),St=Yd()}else if(yi(t))s=ci("\x3c!----\x3e"),r=s.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?s=r:s.appendChild(r),Ii(s);else{if(!gt&&!ut&&!ct&&-1===t.indexOf("<"))return F(t);if(s=ci(t),!s)return gt?null:mt?C:""}s&&pt&&ti(s.firstChild);const c=a?t:s;try{a&&Ii(t);const i=di(c);for(;o=i.nextNode();)Ri(o,c);a&&function(t,i){const e=St;let s=null;const n=()=>(s||(s=Yd(),Hd(i,t=>{Zd(s,t)})),s);for(let i=0;;i++){const s=li(t),r=[t];let o=!1;if(Hd(s,t=>{11===S(t)?Vd(r,t):o||Xd(e,t)||(o=Xd(n(),t))}),!o)return;if(i>=8)throw vv("the tree kept changing during in-place sanitization; refusing to return it");Hd(r,(i,e)=>{ui(i,e>0,t,n())})}}(t,u)}catch(i){throw a&&(ei(t),ai(t,u)),i}finally{St=h}if(a){if(ai(t,u))throw vv("a node selected for removal could not be safely returned; refusing to sanitize in place");return ut&&fi(t),t}if(gt){if(ut&&fi(s),_t)for(l=L.call(s.ownerDocument);s.firstChild;)l.appendChild(s.firstChild);else l=s;return(Q.shadowroot||Q.shadowrootmode)&&(l=B.call(n,l,!0)),l}const d=()=>ct?s.outerHTML:s.innerHTML;let f=d();return ut&&dv(Fv,f)&&(pi(s),f=d()),ct&&Z["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&dv(Uv,s.ownerDocument.doctype.name)&&(f="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+f),F(f)},e.setConfig=function(){Zt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),dt=!0,vt=Z,ft=Q},e.clearConfig=function(){Kt=null,dt=!1,vt=null,ft=null,P=O,C=""},e.isValidAttribute=function(t,i,e){Kt||Zt({});const s=Gt(t),n=Gt(i);return("string"!=typeof e||!(Ci(i,e)||!at&&dv(Vv,e)))&&ki(s,n,e)},e.addHook=function(t,i){"function"==typeof i&&uv(U,t)&&Vd(U[t],i)},e.removeHook=function(t,i){if(uv(U,t)){if(void 0!==i){const e=qd(U[t],i);return-1===e?void 0:Kd(U[t],e,1)[0]}return Wd(U[t])}},e.removeHooks=function(t){uv(U,t)&&(U[t]=[])},e.removeAllHooks=function(){U={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e}();const tf="Refusing to render web experiment since the viewer is a likely bot",ef={ADD_ATTR:(t,i)=>"target"===t&&"a"===i||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(i),ADD_URI_SAFE_ATTR:["form"]};let sf;const nf={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Wu(i,t),not_regex:(t,i)=>!Wu(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},rf=Dr("[Conversations]"),of="Conversations not available yet.";function lf(t,i){var e,s,n,r,o,l,a;const u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,d=yi(c)?Math.max(h,2048):Math.max(h,c),v=us(us({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Ue(n))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(dr,t)?dr[t]:t}(t);return us(us({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const af=["debug","log","warn","error","info"],uf=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},hf="console",cf="__posthogHandledLogsRequestError",df=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[cf]=!0,e},vf=t=>!!t&&"object"==typeof t&&!0===t[cf];var ff=class{get Of(){return us(us({},this.R),{},{error:(...t)=>{t.some(vf)||this.R.error(...t)}})}constructor(t,i){var e;this.ra=t,this.Ff=i,this.name="logs",this.Lf=!1,this.Df=!1,this.Nf=!1,this.R=Dr("[logs]"),this.Dc=[],this.jf=[],this.Tv=0,this.qf=!1,this.qi=!1,this.Bf=[],this.zf=[],this.Hf=!1,this.Uf=!1,this.Wf=!1,this.Vf=()=>{var t,i;this.qi||(this.Tv=0,null===(t=this.Gf)||void 0===t||t.onReconnect(),null===(i=this.Jf)||void 0===i||i.onReconnect())},this.Lf=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs)}get Qf(){return!0}Zf(){}Kf(){if(!this.Wf){try{this.Wv=typeof window>"u"?void 0:window}catch(t){this.Wv=void 0}this.Wv&&(Vr(this.Wv,"online",this.Vf),this.Wf=!0)}}Yf(t,i,e,s){this.Kf();const n=lf(this.ra.get(),e);return[new $r(this.Xf(t,i),n,this.Of,()=>this.Ff(),t=>t(),void 0,s),n]}tp(){const t=this.ra.get();var i;return this.Gf&&this.ep===t||(null===(i=this.Gf)||void 0===i||i.reset(),this.ep=t,[this.Gf,this.np]=this.Yf(()=>this.Dc,t=>{this.Dc=t})),this.Gf}sp(){const t=this.ra.get();var i;return this.Jf&&this.rp===t||(null===(i=this.Jf)||void 0===i||i.reset(),this.rp=t,[this.Jf,this.op]=this.Yf(()=>this.jf,t=>{this.jf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},hf)),this.Jf}setup(t){if(!this.qi&&!this.qf)return this.qf=!0,this.ia=t,this.R=t.logger.createLogger("[logs]"),xc(t.kv.initialize(),()=>{this.qi||this.Vv(t)})}Vv(t){var i;this.Kf(),(null===(i=this.ra.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Lf=!0),(this.Lf||this.ra.remoteConfigWillArrive&&t.kv.get(this.ra.captureHintKey))&&this.lp();let e=!1;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.qi?s.dispose():(this.ma=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s,n,r,o;this.qi||(this.qi=!0,this.ap(),null===(t=this.ma)||void 0===t||t.dispose(),this.ma=void 0,this.ia=void 0,this.Nf=!1,null===(i=this.Wv)||void 0===i||i.removeEventListener("online",this.Vf),null===(e=this.up)||void 0===e||e.call(this),this.up=void 0,null===(s=this.Gf)||void 0===s||s.clearQueue(),null===(n=this.Jf)||void 0===n||n.clearQueue(),null===(r=this.Gf)||void 0===r||r.reset(),null===(o=this.Jf)||void 0===o||o.reset())}onRemoteConfig(t){var i,e;if(this.qi)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;xi(s)?this.cp():(null===(e=this.ia)||void 0===e||e.kv.set(this.ra.captureHintKey,!!s),s?(this.Lf=!0,this.Df||this.lp(),this.loadIfEnabled()):this.cp())}reset(){var t,i,e,s;this.ap(),null===(t=this.Gf)||void 0===t||t.clearQueue(),this.Dc=[],null===(i=this.Gf)||void 0===i||i.reset(),null===(e=this.Jf)||void 0===e||e.clearQueue(),this.jf=[],null===(s=this.Jf)||void 0===s||s.reset(),this.Tv=0}captureLog(t){!this.qi&&this.ia&&this.tp().captureLog(t)}captureConsoleLog(t){!this.qi&&this.ia&&this.sp().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.qi&&this.ia&&this.sp().captureLog(t,{context:i,occurredAtMs:e})}av(){var t;this.ap(),null===(t=this.Jf)||void 0===t||t.clearQueue(),this.jf=[]}cp(){this.Lf||this.ap()}lp(){var t;if(this.Hf||!(null===(t=this.Wv)||void 0===t?void 0:t.console))return;const i=lf(this.ra.get()).maxBufferSize;let e=!0;this.zf.push(()=>{e=!1});for(const t of af){let s;try{s=uf(this.Wv.console[t])}catch(t){continue}s&&this.zf.push(tc(this.Wv.console,t,n=>{const r=(...s)=>{try{e&&this.hp(t,s,i)}catch(t){}return n.apply(this.Wv.console,s)};return r.__rrweb_original__=s,r}))}this.Hf=!0,this.dp=setTimeout(()=>{this.ap()},3e4)}hp(t,i,e){var s;if(this.Hf&&!this.Uf&&0!==i.length)if(null===(s=this.ia)||void 0===s?void 0:s.canCapture){if(e>this.Bf.length){this.Uf=!0;try{this.Bf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Ff()})}finally{this.Uf=!1}}}else this.ap()}ap(){if(this.Bf=[],this.Hf){this.Hf=!1,this.dp&&(clearTimeout(this.dp),this.dp=void 0);for(const t of this.zf)t();this.zf=[]}}vp(){const t=this.Bf;return this.ap(),t}get logger(){return this.fp||(this.fp={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.fp}flushLogs(t){this.ia&&(t?this.pp(t):(this.Gf&&this.Gf.flush().catch(t=>this.gp(t)),this.Jf&&this.Jf.flush().catch(t=>this.gp(t))))}flush(){var t=this;return Li(function*(){var i,e;const s=null===(i=t.Gf)||void 0===i?void 0:i.flush().catch(i=>t.gp(i)),n=null===(e=t.Jf)||void 0===e?void 0:e.flush().catch(i=>t.gp(i));yield s,yield n})()}gp(t){vf(t)||this.R.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.qi||!this.Lf||this.Df||this.Nf)return;const t=this.Zf();if(t){this.Nf=!0;try{t((t,i)=>{if(this.Nf=!1,!this.qi&&this.Lf)if(t||!i)this.R.error("Could not load logs script",t),this.ap();else{const t=this.vp();this.up=i.initialize(this.ia),this.Df=!0,t.length>0&&i.replay(this.ia,t)}})}catch(t){throw this.Nf=!1,t}}else this.ap()}Xf(t,i){const e=this.ia;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===ni.LogsQueue?t():void 0,setPersistedProperty(t,e){t===ni.LogsQueue&&i(null!=e?e:[])},Hs:t=>this.Hs(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}Hs(t){return new Promise(i=>{if(Il(this.Tv,3))return void i({kind:"fatal",error:df(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.R.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:df(void 0,"logs request timed out")})},9e4),r=this.Qf;this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.mp(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.R.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:df(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})},t=>{s({kind:"retry-later",error:t})})})}mp(t,i){(0!==t||i)&&(this.Tv=Ml(t,this.Tv,3,()=>this.R.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.")))}pp(t){this.Dc.length>0&&this.yp(t,this.Dc,this.np,this.ia.library.name,t=>{this.Dc=t}),this.jf.length>0&&this.yp(t,this.jf,this.op,hf,t=>{this.jf=t})}yp(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=mr(r,_r(e,this.ia.library.name,this.ia.library.version),s,this.ia.library.version);this.ia.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.ia.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.gp(t))}};const pf=Dr("[NetworkMetrics]"),gf={"http:":80,"https:":443},_f=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),mf=t=>bi(t)&&0===t.toLowerCase().indexOf("text/event-stream"),yf=t=>{try{return t()}catch(t){return}},bf=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=Rl(s))||void 0===e?void 0:e.href)||s}},wf=(t,i,e,s,n,r,o=!1)=>{try{var l,a;const u=n();if(!u)return;const h=e||void 0,c=wh()-s,d=Rl(i.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||i.url,method:i.method},f=gi(u.name)?u.name(v):bi(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),g=us(us(us(us(us({},(t=>{const i=_f.has(t)?t:"_OTHER";return us({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||gf[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:h,durationMs:c}));null===(a=t.metrics)||void 0===a||a.histogram(f,c,{unit:"ms",attributes:g})}catch(t){pf.error("Failed to record network metric",t)}},$f=()=>{},xf=(t,i)=>gi(null==s?void 0:s.fetch)?tc(s,"fetch",e=>function(...s){const n=wh(),r=e.apply(this,s);if(!i())return r;try{var o,l,a;const[e,u]=s,h=bf(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(a=null==e?void 0:e.url)&&void 0!==a?a:e);return r.then(e=>(mf(yf(()=>{var t;return null==e||null===(t=e.headers)||void 0===t?void 0:t.get("content-type")}))||wf(t,h,null==e?void 0:e.status,n,i,void 0,!0),e),e=>{throw wf(t,h,void 0,n,i,e),e})}catch(t){return pf.error("Failed to observe fetch",t),r}}):$f,Sf=(t,i)=>{var e;const n=null==s||null===(e=s.XMLHttpRequest)||void 0===e?void 0:e.prototype;if(!n)return $f;const r=new WeakMap,o=tc(n,"open",t=>function(...i){try{(()=>uu.has(this))()||r.set(this,bf(i[0],i[1]))}catch(t){pf.error("Failed to observe XHR open",t)}return t.apply(this,i)}),l=tc(n,"send",e=>function(...s){let n,o;try{const e=r.get(this);if(e&&i()){const s=wh(),r=()=>mf(yf(()=>this.getResponseHeader("content-type")));let l=!1;o=()=>{2===this.readyState&&(l=r())},n=()=>{this.removeEventListener("loadend",n),this.removeEventListener("readystatechange",o),l||r()||wf(t,e,this.status,s,i)},Vr(this,"readystatechange",o),Vr(this,"loadend",n)}}catch(t){pf.error("Failed to observe XHR send",t)}try{return e.apply(this,s)}catch(t){throw n&&this.removeEventListener("loadend",n),o&&this.removeEventListener("readystatechange",o),t}});return()=>{o(),l()}},kf=new WeakMap,Ef=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),Tf={maxStringLength:2048,truncationSuffix:"..."},Pf={maxStringLength:2048,truncationSuffix:"..."};function Of(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function Cf(t,i){return{}.hasOwnProperty.call(t,i)}function Rf(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function Af(t,i,e=!1){if(!bi(t))return;const s=t.trim();return s?(e?Zn(s,Tf):s).slice(0,i):void 0}function If(t){try{return _i(t)&&!0===t.isError}catch(t){return!1}}function Mf(t){return Zn(t||"Unknown error",Pf).slice(0,2048)}function Ff(t,i){try{return Mf(i?function(t){try{if(!_i(t)||!pi(t.content))return;return t.content.filter(t=>_i(t)&&"text"===t.type&&bi(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):_i(t)&&bi(t.message)?t.message:bi(t)?t:String(t))}catch(t){return"Unknown error"}}function Df(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(i.error,{handled:!0}).$exception_list.map(t=>us(us({},t),{},{value:Mf(t.value)}))}function jf(t,i){if(i)return"Error";try{if(!_i(t))return"Error";let i=bi(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!gi(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return"Error"}}function Lf(t,i){return{message:Ff(t,i),type:jf(t,i)}}Kh.__defaultExtensionClasses=us({},{featureFlags:class extends qc{constructor(t){const i=new bd(t.config,t.Fc());super(i),this.name=yh,this._instance=t,this.bp=i}get zv(){return this._instance.persistence}get Bv(){return md}updateConfig(t,i){this.bp.update(t,i),this.Hv()}},sessionRecording:class{get Yr(){return this._instance.config}get oh(){return this._instance.persistence}get started(){var t;return!!(null===(t=this._p)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return this.isReplayOff?lc:"awaiting_config"===this.wp||"missing_config"===this.wp?this.wp:null!==(t=null===(i=this._p)||void 0===i?void 0:i.status)&&void 0!==t?t:this.wp}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.wp=lc,this.kp=void 0,this.Sp=!1,this.li=void 0,this.un=(()=>{var t,i;if(!(null==o?void 0:o.visibilityState)||"visible"===o.visibilityState)return!0;const e=null==s||null===(t=s.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==e?void 0:e.length)||e.some(t=>"visible"===t.name)})(),this.gn=()=>{var t,i;"visible"===(null==o?void 0:o.visibilityState)&&(this.un=!0,null===(t=this._p)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw hc.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Yr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');const i=this._instance.get_property(pt);var e;bi(i)&&"!"===i[0]&&(null===(e=this.oh)||void 0===e||e.unregister("$session_is_sampled")),(null==o?void 0:o.addEventListener)&&Vr(o,"visibilitychange",this.gn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.Sp=!0,null==o||null===(i=o.removeEventListener)||void 0===i||i.call(o,"visibilitychange",this.gn),t?this.xp(!0):this.stopRecording()}get $p(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),e=!this.Yr.disable_session_recording,n=this.Yr.disable_session_recording||this._instance.consent.isOptedOut();return s&&i&&e&&!n}get isReplayOff(){var t;return!!this.Yr.disable_session_recording||this._instance.consent.isOptedOut()||!1===(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled)}startIfEnabledOrStop(t){if(this.Sp)return;var i;if(this._p)if(this.li!==(null===(i=this.Yr.session_recording)||void 0===i?void 0:i.selectMaskingFn))xo.Dt(uc(this.Yr)),this._p.discard({discardProducerEvents:!0}),this.li=void 0;else if(this._p.isStarted&&this.$p)return void(this.Cp()||this.xp(!0));const e=!yi(Object.assign)&&!yi(Array.from);this.$p&&e?(this.Tp(t),hc.info("starting")):(this.wp=lc,this.stopRecording())}Tp(t){var i,e;if(this.$p)if("awaiting_config"!==this.wp&&"missing_config"!==this.wp&&(this.wp=ac),(null==f||null===(i=f.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=f.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Mp(t);else{var s;const i=this._instance.sessionManager;null===(s=g(this._instance))||void 0===s||s(this._instance,this.Ip,e=>{if(!this.Sp&&this.$p&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),hc.error("could not load recorder",e)):void this.Mp(t);this.wp="disabled"})}}stopRecording(){var t,i;null===(t=this.kp)||void 0===t||t.call(this),this.kp=void 0,null===(i=this._p)||void 0===i||i.stop()}xp(t=!1){var i,e,s;t&&(this.li||(null===(i=this.Yr.session_recording)||void 0===i?void 0:i.selectMaskingFn))&&xo.Dt(uc(this.Yr)),null===(e=this.kp)||void 0===e||e.call(this),this.kp=void 0,null===(s=this._p)||void 0===s||s.discard({discardProducerEvents:t}),this.li=void 0}Ep(){var t,i;null===(t=this.oh)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.oh)||void 0===i||i.unregister("$replay_sample_rate")}Ap(t,i){if(xi(t))return null;const e=Si(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(hc.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Rp(t){if(this.oh){var i,e;const s=this.oh,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ap(null===(i=this.Yr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Ap(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;xi(o)&&this.Ep();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[lt]:us(us({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:us({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:yi(l)?null:l,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};n(),null===(i=this.kp)||void 0===i||i.call(this),this.kp=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n)}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Rp(i),void this.xp()):(this.Rp(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.wp&&(this.wp="missing_config",this._instance.register_for_session({[Ut]:!0}),hc.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this._p)||void 0===e?void 0:e.log)?this._p.log(t,i):hc.warn("log called before recorder was ready")}get Ip(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(lt);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}Pp(){const t=this._instance.get_property(lt);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return hc.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!xi(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Cp(){var t,i,e;return!(null===(t=this.Yr.session_recording)||void 0===t?void 0:t.selectMaskingFn)||!(!0!==(null===(i=f.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i||null===(i=i.record)||void 0===i?void 0:i.supportsSelectMasking)||!0!==(null===(e=f.__PosthogExtensions__)||void 0===e||null===(e=e.initSessionRecording)||void 0===e?void 0:e.supportsSelectMasking)||this._p&&!0!==this._p.supportsSelectMasking)||(this.wp=lc,hc.error("Session recording has not started: the recorder does not support selectMaskingFn."),!1)}Mp(t){var i,e,s,n,r,o;if(this.Sp||!this.$p||!this._instance.sessionManager)return void(this.wp=lc);if(!(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return hc.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Bt]:!0});if(!this.Cp())return;if(this._p||(this._p=null===(o=f.__PosthogExtensions__)||void 0===o?void 0:o.initSessionRecording(this._instance,this.un),this._p._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Cp())return void this.xp(!0);if(!this.Pp()){if("missing_config"===this.wp||"awaiting_config"===this.wp)return;return this.wp="awaiting_config",hc.info("persisted remote config is stale, requesting fresh config before starting"),void new Pa(this._instance).load()}this.wp=ac,null===(e=(s=this._p).setDocumentWasEverVisible)||void 0===e||e.call(s,this.un);const l=null===(n=this.Yr.session_recording)||void 0===n?void 0:n.selectMaskingFn;this._p.start(t),this.li=l,this._p.isStarted&&l!==(null===(r=this.Yr.session_recording)||void 0===r?void 0:r.selectMaskingFn)&&this.startIfEnabledOrStop()}onRRwebEmit(t){var i,e;null===(i=this._p)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this._p||null===(i=this.oh)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this._p)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this._p||null===(i=this.oh)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this._p)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this._p||null===(e=this.oh)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this._p)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;if(this.isReplayOff)return{$recording_status:lc};const i={};for(const t of cc){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);yi(s)||(i[t]=s)}return us(us({},i),(null===(t=this._p)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!!(null===(e=this._p)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this._p)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}},autocapture:class extends mh{constructor(t){super(new Yh(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Op=!1,this._instance=t,this.Fp=this.Lp()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Dp();return!!(t.path||t.search||this.Np(t))}startIfEnabled(){this.isEnabled&&(Fr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Fp=this.Lp(),this.startIfEnabled()}stop(){this.jp&&this.jp(),this.jp=void 0,this.qp&&this.qp(),this.qp=void 0,Fr.info("History API monitoring stopped")}monitorHistoryChanges(){s&&s.history&&(this.Bp("pushState"),this.Bp("replaceState"),this.zp(),this.Np()&&this.Hp())}Bp(t){var i;if(!s||(null===(i=s.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const e=this;tc(s.history,t,i=>function(n,r,o){var l;e.Up(o)&&e.Wp(),i.call(this,n,r,o),e.Vp(t,!e.Op&&"popstate"!==(null==s||null===(l=s.event)||void 0===l?void 0:l.type))})}Lp(){const t=null==s?void 0:s.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Dp(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:_i(t)?t:{}}Np(t=this.Dp()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Gp(t){const i=this.Dp(),e=this.Fp;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Np(i)&&t.hash!==e.hash))}Vp(t,i=!1){try{i||this.Wp();const e=this.Lp();if(!e)return;if(this.Gp(e)){const e=()=>this._instance.capture(ti,{navigation_type:t});i?(this.Jp=e,Promise.resolve().then(()=>this.Wp())):e()}this.Fp=e}catch(i){Fr.error(`Error capturing ${t} pageview`,i)}}Up(t){var i,e;return!(xi(t)||!s)&&(null===(i=Rl(String(t)))||void 0===i?void 0:i.href)!==(null===(e=s.location)||void 0===e?void 0:e.href)}Wp(){const t=this.Jp;if(t){this.Jp=void 0,this.Op=!0;try{t()}catch(t){Fr.error("Error capturing deferred pageview",t)}finally{this.Op=!1}this.Fp=this.Lp()}}zp(){if(this.jp)return;const t=()=>{this.Vp("popstate")};Vr(s,"popstate",t),this.jp=()=>{s&&s.removeEventListener("popstate",t)}}Hp(){if(this.qp)return;const t=()=>{this.Vp("hashchange")};Vr(s,"hashchange",t),this.qp=()=>{s&&s.removeEventListener("hashchange",t)}}},heatmaps:class{get Yr(){return this.instance.config}constructor(t){var i;this.Qp=!1,this.qa=!1,this.Zp=!1,this.Kp=0,this.Yp=null,this.instance=t,this.Qp=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[X]),this.rageclicks=new ah(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return _i(this.Yr.capture_heatmaps)&&this.Yr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Yr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return xi(this.Yr.capture_heatmaps)?xi(this.Yr.enable_heatmaps)?this.Qp:this.Yr.enable_heatmaps:!1!==this.Yr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.qa)return;dc.info("starting..."),this.Xp(),this.gn()}else{var t;clearInterval(null!==(t=this.Yp)&&void 0!==t?t:void 0),this.tg(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[X]:e}),this.Qp=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}discardPending(){this.Kp=Date.now(),clearTimeout(this.eg),this.eg=void 0,this.getAndClearBuffer()}ig(t){vc(t.originalEvent)&&t.timestamp>this.Kp&&this.Jr(t.originalEvent,"deadclick")}gn(){this.Yp&&clearInterval(this.Yp),this.Yp="visible"===(null==o?void 0:o.visibilityState)?setInterval(this.Wc.bind(this),this.flushIntervalMilliseconds):null}Xp(){s&&o&&(this.ng=this.Wc.bind(this),Vr(s,Qt,this.ng),this.sg=t=>this.Jr(t||(null==s?void 0:s.event)),Vr(o,"click",this.sg,{capture:!0}),this.rg=t=>this.og(t||(null==s?void 0:s.event)),Vr(o,"mousemove",this.rg,{capture:!0}),this.lg=new yl(this.instance,_l,this.ig.bind(this)),this.lg.startIfEnabledOrStop(),this.ag=this.gn.bind(this),Vr(o,I,this.ag),this.qa=!0)}tg(){var t;s&&o&&(this.ng&&s.removeEventListener(Qt,this.ng),this.sg&&o.removeEventListener("click",this.sg,{capture:!0}),this.rg&&o.removeEventListener("mousemove",this.rg,{capture:!0}),this.ag&&o.removeEventListener(I,this.ag),clearTimeout(this.eg),this.eg=void 0,null===(t=this.lg)||void 0===t||t.stop(),this.qa=!1)}ug(t,i){const e=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,e){let n=t;for(;n&&To(n)&&!Po(n,"body");){if(n===e)return!1;let t;try{var r,o,l;t=null===(r=null!==(o=null===(l=n.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:s)||void 0===r?void 0:r.getComputedStyle(n).position}catch(t){return!1}if(ai(i,t))return!0;n=Bo(n)}return!1}(Do(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:e),target_fixed:o,type:i}}Jr(t,i="click"){var e;if(Eo(t.target)||!vc(t)||!this.instance.is_capturing())return;const s=this.ug(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Xo(Do(t),this.instance.config.rageclick)&&this.Fo(us(us({},s),{},{type:"rageclick"})),this.Fo(s)}og(t){!Eo(t.target)&&vc(t)&&(yi(this.eg)&&(this.Zp=this.instance.is_capturing()),clearTimeout(this.eg),this.eg=setTimeout(()=>{this.eg=void 0,this.Zp&&this.instance.is_capturing()&&this.Fo(this.ug(t,"mousemove"))},500))}Fo(t){if(!s)return;const i=this.Yr.disable_capture_url_hashes?is(s.location.href):s.location.href,e=this.Yr.custom_personal_data_properties,n=this.Yr.mask_personal_data_properties?[...zl,...e||[]]:[],r=jl(i,n,ql);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(t)}Wc(){this.Rt&&!mi(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:yl,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.Qp=!1,this.qa=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.cg=(t=!1)=>{clearTimeout(this.hg),this.hg=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",us({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>us(us({},t),{},{[`$web_vitals_${i.name}_event`]:us({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dg=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},xi(null==t?void 0:t.name)||xi(null==t?void 0:t.value))return void ec.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.vg(e);if(yi(s))return;const n=Si(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.fg&&t.value>=this.fg)return void ec.error("Ignoring metric with value >= "+this.fg,t);this.Rt.navigationKey!==n&&(this.cg(),this.hg=setTimeout(this.cg,this.flushToCaptureTimeoutMs)),yi(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=yi(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=us(us(us({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,_i(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of oc){const s="url"===e&&"string"==typeof t.attribution[e]?this.vg(t.attribution[e]):t.attribution[e];yi(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;yi(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.cg()},this.pg=()=>{if(this.qa)return;let t,i,e,n,r=!1;const o=f.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,a=(null==l?void 0:l[this.gg])||("web-vitals"===this.gg&&yi(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!yi(a)){const s=a.withoutAttribution,o=this.attributionMetrics;r=!yi(s),t=o.indexOf("LCP")>-1?a.onLCP:(null==s?void 0:s.onLCP)||a.onLCP,i=o.indexOf("CLS")>-1?a.onCLS:(null==s?void 0:s.onCLS)||a.onCLS,e=o.indexOf("FCP")>-1?a.onFCP:(null==s?void 0:s.onFCP)||a.onFCP,n=o.indexOf("INP")>-1?a.onINP:(null==s?void 0:s.onINP)||a.onINP}if(!(t&&i&&e&&n))return void ec.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},h=r&&this.attributionMetrics.indexOf("INP")>-1?us(us({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&t(this.dg.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.dg.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&e(this.dg.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&n(this.dg.bind(this),h);const c=null==s?void 0:s.document;Vr(c,I,()=>{"hidden"===(null==c?void 0:c.visibilityState)&&this.cg(!0)}),Vr(s,"pagehide",()=>this.cg(!0)),this.qa=!0},this.Qp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[et]),this.startIfEnabled()}get mg(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=_i(this.mg)?null===(t=this.mg)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return xi(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||nc:e}get flushToCaptureTimeoutMs(){return(_i(this.mg)?this.mg.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=_i(this.mg)?this.mg.web_vitals_attribution:void 0;return Ei(t)?t?nc:[]:pi(t)?t:rc}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=_i(this.mg)?this.mg.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get fg(){const t=_i(this.mg)&&Si(this.mg.__web_vitals_max_value)?this.mg.__web_vitals_max_value:sc;return t>0&&6e4>=t?sc:t}get isEnabled(){const t=null==l?void 0:l.protocol;if("http:"!==t&&"https:"!==t)return ec.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=_i(this.mg)?this.mg.web_vitals:Ei(this.mg)?this.mg:void 0;return Ei(i)?i:this.Qp}startIfEnabled(){this.isEnabled&&!this.qa&&(ec.info("enabled, starting..."),this.lu(this.pg))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=_i(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=_i(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[et]:e}),this._instance.persistence.register({[ot]:s})),this.Qp=e,this.startIfEnabled()}get gg(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}lu(t){var i;const e=f.__PosthogExtensions__,s=this.gg,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&yi(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null===(i=g(this._instance))||void 0===i||i(this._instance,s,i=>{i?ec.error("failed to load script",i):t()})}vg(t){const i=t||(null==s?void 0:s.location.href);if(!i)return void ec.error("Could not determine current URL");const e=this._instance.config.disable_capture_url_hashes?is(i):i,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...zl,...n||[]]:[];return jl(e,r,ql)}},exceptionObserver:class{constructor(t){var i;this.pg=()=>{var t;if(!s||!this.isEnabled||!(null===(t=f.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=f.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=f.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=f.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.yg&&this.Yr.capture_unhandled_errors&&(this.yg=i(this.captureException.bind(this))),!this.bg&&this.Yr.capture_unhandled_rejections&&(this.bg=e(this.captureException.bind(this))),!this._g&&this.Yr.capture_console_errors&&(this._g=n(this.captureException.bind(this)))}catch(t){Zh.error("failed to start",t),this.wg()}},this._instance=t,this.kg=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[Q]),this.kt=new Hi(us(us({},function(t={}){var i,e,s,n;return{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,R:Zh})),this.Yr=this.Sg(),this.startIfEnabledOrStop()}Sg(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return _i(t)?i=us(us({},i),t):(yi(t)?this.kg:t)&&(i=us(us({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Yr.capture_console_errors||this.Yr.capture_unhandled_errors||this.Yr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Zh.info("enabled"),this.wg(),this.lu(this.pg)):this.wg()}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=g(this._instance))||void 0===e||e(this._instance,"exception-autocapture",i=>{if(i)return Zh.error("failed to load script",i);t()})}wg(){var t,i,e;null===(t=this.yg)||void 0===t||t.call(this),this.yg=void 0,null===(i=this.bg)||void 0===i||i.call(this),this.bg=void 0,null===(e=this._g)||void 0===e||e.call(this),this._g=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.kg=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Q]:this.kg}),this.Yr=this.Sg(),this.startIfEnabledOrStop())}onConfigChange(){this.Yr=this.Sg()}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.kt.consumeRateLimit(n))return void Zh.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.xg=[],this.$g=new gs([new js,new Gs,new Ns,new Ls,new Ws,new qs,new Us,new Vs],function(t,...i){return(e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=Os.test(s)?s.replace(Os,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Rs(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop()}l.push(t)}break}}if(Fs(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=Is(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)As(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Ds(i,t,e)&&(e=t);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return us(us({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",ks,Ps)),this._instance=t,this.xg=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.Cg=Xs(this.Tg()),this.Mg=new Qs(this.Cg)}onConfigChange(){this.Cg=Xs(this.Tg()),this.Mg.setConfig(this.Cg)}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.xg=r,this._instance.persistence&&this._instance.persistence.register({[tt]:this.xg,[it]:o})}get Ig(){var t;const i=!!this._instance.get_property(it),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.$g.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Cg.enabled)try{if(!bi(t)||0===t.trim().length)return void $d.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(t).reduce((e,s)=>Ys.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Eg(i));s.length>0&&$d.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Mg.add(us({[Ks]:t,[Js]:(new Date).toISOString()},e))}catch(t){$d.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Ag(i)){if(this.Rg(i))return this.Pg("Exception dropped: matched a suppression rule"),void $d.info("Skipping exception capture because a suppression rule matched");if(!this.Ig&&this.Og(i))return this.Pg("Exception dropped: thrown by a browser extension"),void $d.info("Skipping exception capture because it was thrown by an extension");if(!this.Ig&&this.Fg(i))return this.Pg("Exception dropped: thrown by an injected browser script"),void $d.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Lg(i))return this.Pg("Exception dropped: thrown by the PostHog SDK"),void $d.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.Cg.enabled&&xi(t.$exception_steps)?this.Dg(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return"string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Qd:!0});return t&&this.Mg.clear(),t}catch(t){return wd(t)||$d.error("Failed to capture exception event. Dropping this exception.",t),void this.Mg.clear()}}catch(t){return void(wd(t)||$d.error("Failed to process exception event. Ignoring this exception.",t))}}Dg(t){try{const i=this.Mg.getAttachable();return 0===i.length?t:us(us({},t),{},{$exception_steps:i})}catch(i){return $d.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Pg(t){this.Cg.enabled&&this.Mg.add({[Ks]:t,[Js]:(new Date).toISOString()})}Eg(t){return _i(t)?us({},t):{}}Tg(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Rg(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(bi(i)&&i.length>0&&t.$exception_types.push(i),bi(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.xg.some(t=>{const e=t.values.map(t=>{const e=Gu[t.operator],s=i[t.key];if(!e||!s)return!1;const n=pi(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return $d.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Og(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&kd.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(xd))||t.some(({type:t,value:i})=>"NoResponse"===t||bi(i)&&Sd.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(xd))))}Fg(t){return t.some(({value:t})=>bi(t)&&Ed.some(i=>t.includes(i)))}Lg(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Ag(t){return!xi(t)&&pi(t)}},productTours:class{get oh(){return this._instance.persistence}constructor(t){this.Ng=null,this.jg=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this.oh&&this.oh.register({[nt]:!!i.productTours}),!pc(this._instance))return!this.Ng&&xi(null===(e=this.oh)||void 0===e?void 0:e.props.ph_product_tours)||fc.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Ng)||void 0===s||s.stop(),this.Ng=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ng&&pc(this._instance)&&this.lu(()=>this.qg())}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=g(this._instance))||void 0===e||e(this._instance,"product-tours",i=>{i?fc.error("Could not load product tours script",i):t()})}qg(){var t;!this.Ng&&(null===(t=f.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Ng=f.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(pi(this.jg)&&!i)return void t(this.jg,{isLoaded:!0});const e=this.oh;if(e){const s=e.props[$t];if(pi(s)&&!i)return this.jg=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!pc(this._instance))return void t([],{isLoaded:!0});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||fc.warn(e):fc.error(e),void t([],{isLoaded:!1,error:e})}const n=pi(i.json.product_tours)?i.json.product_tours:[];this.jg=n,e&&e.register({[$t]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){xi(this.Ng)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ng.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.Ng)||void 0===i||i.showTourById(t)}previewTour(t){this.Ng?this.Ng.previewTour(t):this.lu(()=>{var i;this.qg(),null===(i=this.Ng)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Ng)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Ng)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Ng)||void 0===t||t.previousStep()}clearCache(){var t;this.jg=null,null===(t=this.oh)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.Ng)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.Ng)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.Ng)||void 0===i||i.cancelPendingTour(t)}},siteApps:class{constructor(t){this._instance=t,this.Bg=0,this.zg=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps&&!this._instance.config.require_subresource_integrity}Hg(t,i){if(!i)return;const e=this.globalsForEvent(i);this.zg.push(e),this.zg.length>1e3&&(this.zg=this.zg.slice(10))}get siteAppLoaders(){var t;return null===(t=f._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this._instance.config.opt_in_site_apps&&!this.isEnabled&&_c.critical("opt_in_site_apps is ignored: require_subresource_integrity disables site apps"),this.isEnabled){const t=this._instance._addCaptureHook(this.Hg.bind(this));this.Ug=()=>{t(),this.zg=[],this.Ug=void 0}}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))a[t]={id:u[t],type:t,properties:i};const{$set_once:c,$set:d}=t;return{event:us(us({},gn(t,gc)),{},{properties:us(us(us({},t.properties),d?{$set:us(us({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),d)}:{}),c?{$set_once:us(us({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Wg(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(_c.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(_c.error("prepare_external_dependency_script returned null"),null)}return t}Vg(){var t,i,e,s,n,r,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==o?void 0:o.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Bg++,this.Gg)return this.Jg();const c=[],d=this,v=new WeakSet,f=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),c.push(()=>{t[i]=s})},p=t=>{if(v.has(t))return t;const i=d.Wg(t);return i&&v.add(i),i},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!$i(t));return f(h,"appendChild",t=>function(i){const e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):i}),f(h,"replaceChild",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):e}),[null===(i=u.Element)||void 0===i?void 0:i.prototype,null===(e=u.Document)||void 0===e?void 0:e.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...i){return t.apply(this,g(i))}),f(t,"prepend",t=>function(...i){return t.apply(this,g(i))})}),[null===(n=u.Element)||void 0===n?void 0:n.prototype,null===(r=u.CharacterData)||void 0===r?void 0:r.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...i){return t.apply(this,g(i))}),f(t,"after",t=>function(...i){return t.apply(this,g(i))}),f(t,"replaceWith",t=>function(...i){const e=g(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){const s=p(e);return s?t.call(this,i,s):null}),this.Gg=()=>{c.forEach(t=>t()),this.Gg=void 0},this.Jg()}Jg(){let t=!1;return()=>{var i;t||(t=!0,this.Bg--,0===this.Bg&&(null===(i=this.Gg)||void 0===i||i.call(this)))}}Qg(t,i=!0){const e=this.Vg();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.zg.length&&(_c.info(`Processing ${this.zg.length} events for site app with id ${t.id}`),this.zg.forEach(t=>this.Qg(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Ug)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,_c.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.Qg(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){_c.error(mc+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){_c.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}Zg(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(const i of t)this.setupSiteApp(i)}Kg(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.Qg(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){_c.error(`Error while processing event ${t.event} for site app ${e.id}`,i)}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.Zg(),void this._instance.on("eventCaptured",t=>this.Kg(t))):void _c.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Ug)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;f[`__$$ph_site_app_${t}`]=this._instance,null===(r=f.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return _c.error(mc+t,i)})}else _c.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},surveys:class extends Ec{constructor(t){super(new Tc(t))}},tracingHeaders:class{constructor(t){this._instance=t,this.Yg=void 0,this.Xg=void 0,this.tm=void 0,this.im=void 0,this.nm=[],this.pg=()=>{const{hostnames:t,traceparentTargets:i}=this.sm();var e,s;t||i?(t||pi(this.tm)||(this.tm=[]),this.im!==this.tm&&(this.wg(),this.im=this.tm),yi(this.Yg)&&(this.Yg=null===(e=f.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm)),yi(this.Xg)&&(this.Xg=null===(s=f.__PosthogExtensions__)||void 0===s||null===(s=s.tracingHeadersPatchFns)||void 0===s?void 0:s._patchFetch(this.tm,()=>this._instance.get_distinct_id(),this._instance.sessionManager,this.nm))):this.wg()}}initialize(){this.startIfEnabledOrStop()}lu(t){var i,e;(null===(i=f.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=g(this._instance))||void 0===e||e(this._instance,"tracing-headers",i=>{if(i)return ic.error("failed to load script",i);t()})}rm(){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}om(){const t=this.rm();return pi(t)?(pi(this.tm)?this.tm.splice(0,this.tm.length,...t):this.tm=[...t],t.length>0?this.tm:void 0):!pi(this.tm)||(this.tm.splice(0),t)?(this.tm=t||void 0,this.tm):void 0}lm(){const t=this._instance.config.trace_propagation_targets,i=pi(t)?t.filter(t=>bi(t)&&!!t):[];return this.nm.splice(0,this.nm.length,...i),i.length>0?this.nm:void 0}sm(){return{hostnames:this.om(),traceparentTargets:this.lm()}}wg(){var t,i;null===(t=this.Yg)||void 0===t||t.call(this),null===(i=this.Xg)||void 0===i||i.call(this),this.Yg=void 0,this.Xg=void 0}startIfEnabledOrStop(){const{hostnames:t,traceparentTargets:i}=this.sm();t||i?this.lu(this.pg):this.wg()}},toolbar:class{constructor(t){this.instance=t}am(t){f.ph_toolbar_state=t}um(){var t;return null!==(t=f.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,e=void 0){var n,r;if(Gr(this.instance.config))return!1;if(!s||!o)return!1;t=null!==(n=t)&&void 0!==n?n:s.location,e=null!==(r=e)&&void 0!==r?r:s.history;try{if(!i){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(t){return!1}i=null==s?void 0:s.localStorage}const n=Pc||Ll(t.hash,"__posthog")||Ll(t.hash,"state");let r;const o=n?es(()=>JSON.parse(atob(decodeURIComponent(n))))||es(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(Oc)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}hm(t){const i=f.ph_load_toolbar||f.ph_load_editor;!xi(i)&&gi(i)?i(t,this.instance):Cc.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==o?void 0:o.getElementById("__POSTHOG_TOOLBAR__"));if(!s||i)return!1;const e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=us(us({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(s.localStorage.setItem(Oc,JSON.stringify(us(us({},n),{},{source:void 0}))),2===this.um())this.hm(n);else if(0===this.um()){var r;this.am(1),null===(r=g(this.instance))||void 0===r||r(this.instance,"toolbar",t=>{if(t)return Cc.error("[Toolbar] Failed to load",t),void this.am(0);this.am(2),this.hm(n)}),Vr(s,"turbolinks:load",()=>{this.am(0),this.loadToolbar(n)})}return!0}dm(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}},experiments:class t{get Yr(){return this._instance.config}constructor(i){this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(i=>{t.vm("retrieved web experiments from the server"),this.fm=new Map,i.forEach(i=>{if(i.feature_flag_key){var e;this.fm&&(t.vm("setting flag key ",i.feature_flag_key," to web experiment ",i),null===(e=this.fm)||void 0===e||e.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);bi(s)&&i.variants[s]&&this.pm(i,s)}else if(i.variants)for(const e in i.variants){const s=i.variants[e];t.gm(s,this._instance)&&this.ym(i.name,e,s.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.vm(tf);else if(!this.Yr.disable_web_experiments){if(xi(this.fm))return this.fm=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.vm("applying feature flags",i),i.forEach(t=>{var i;if(this.fm&&(null===(i=this.fm)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.fm)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.pm(s,i)}})}}previewWebExperiment(){const i=t.getWindowLocation();if(null==i?void 0:i.search){const e=Dl(null==i?void 0:i.search,"__experiment_id"),s=Dl(null==i?void 0:i.search,"__experiment_variant");e&&s&&(t.vm(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.bm(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Yr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Yr.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Yr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}bm(i,e,s){const n=s.filter(t=>t.id===i);n&&n.length>0&&(t.vm(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.ym(n[0].name,e,n[0].variants[e].transforms))}pm(i,e){const s=i.variants[e];t._m(s,this._instance)?this.ym(i.name,e,s.transforms):t.vm(`skipping variant ${e} of experiment ${i.name} because this page does not match its url conditions`)}static gm(i,e){return!xi(i.conditions)&&t._m(i,e)&&t.wm(i)}static _m(i,e){var s;if(xi(i.conditions)||xi(null===(s=i.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,l;const t=ko(e,n.href);return!(null===(r=i.conditions)||void 0===r?void 0:r.url)||nf[null!==(o=null===(l=i.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,t)}return!1}static getWindowLocation(){return null==s?void 0:s.location}static wm(t){var i;if(xi(t.conditions)||xi(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Vl();if(e.utm_source){var s,n,r,o,l,a,u,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==e.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&d&&v&&c}return!1}static vm(t,...i){Fr.info(`[WebExperiments] ${t}`,i)}static km(t,...i){Fr.warn(`[WebExperiments] ${t}`,i)}static Sm(i){("http://www.w3.org/1999/xhtml"===i.namespaceURI&&"template"===i.localName?i.content:i).querySelectorAll("a[target], template").forEach(i=>{var e;if("template"===i.localName)return void("http://www.w3.org/1999/xhtml"===i.namespaceURI&&t.Sm(i));if("http://www.w3.org/1999/xhtml"!==i.namespaceURI||"_blank"!==(null===(e=i.getAttribute("target"))||void 0===e?void 0:e.toLowerCase()))return void i.removeAttribute("target");const s=(i.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));s.push("noopener"),i.setAttribute("rel",s.join(" "))})}ym(i,e,s){this._is_bot()?t.vm(tf):"control"!==e?s.forEach(s=>{if(s.selector){var n;t.vm(`applying transform of variant ${e} for experiment ${i} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);if(!(null==r?void 0:r.length))return void t.km(`no element on this page matches selector ${s.selector} of variant ${e} for experiment ${i}`);const o=new Map;null==r||r.forEach(i=>{if("script"===i.localName.toLowerCase())return;const e=i;if(s.html){var n;const l="http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&"annotation-xml"===i.localName&&(null===(n=i.getAttribute("encoding"))||void 0===n?void 0:n.toLowerCase())||"",a=JSON.stringify([i.namespaceURI,i.localName,l]);let u=o.get(a);if(xi(u)){var r;const e=null!==(r=sf)&&void 0!==r?r:sf=Qv(),n=i.ownerDocument.implementation.createHTMLDocument(""),h=n.createElementNS(i.namespaceURI,i.localName);l&&h.setAttribute("encoding",l);const c=n.createRange();c.selectNodeContents(h);const d="http://www.w3.org/2000/svg"===i.namespaceURI&&/^(foreignObject|desc|title)$/.test(i.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":i.namespaceURI,v=c.createContextualFragment(s.html);"http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(i.localName)?(h.appendChild(v),e.sanitize(h,us(us({},ef),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===h.namespaceURI&&"template"===h.localName?h.content:h).appendChild(e.sanitize(v,us(us({},ef),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),t.Sm(h),u=h.innerHTML,o.set(a,u)}e.innerHTML=u}s.css&&e.setAttribute("style",s.css)})}}):t.vm("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?Uu(r,this.Yr.custom_blocked_useragents):void 0}},conversations:class{constructor(t){this._instance=t,this.xm=void 0,this._conversationsManager=null,this.$m=!1,this.ie=null,this.Cm=!1,this.Tm=0,this.Mm=null,this.Im=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.Mm=null);if(this.Em=t.ok,!t.ok)return;const i=t.config.conversations;xi(i)?this.Mm=null:(Ei(i)?this.xm=i:(this.xm=i.enabled,this.ie=i),this.xm||(this.Mm=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Tm++,this.xm=void 0,this.ie=null,this.Em=void 0,this.Cm=!1,this.Mm=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.$m)return;if(this._instance.config.disable_conversations)return;if(Gr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==f?void 0:f.__PosthogExtensions__;if(t&&!yi(this.xm)&&this.xm)if(this.ie&&this.ie.token){this.$m=!0;try{const i=t.initConversations;if(i)return this.Am(i),void(this.$m=!1);const e=g(this._instance);if(!e)return void this.Rm(j);const s=this.Tm;e(this._instance,"conversations",i=>{if(s!==this.Tm)return this.$m=!1,void this.loadIfEnabled();i||!t.initConversations?this.Rm("Could not load conversations script",i):this.Am(t.initConversations),this.$m=!1})}catch(t){this.Rm("Error initializing conversations",t),this.$m=!1}}else rf.error("Conversations enabled but missing token in remote config.")}Am(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.Cm=!1,rf.info("Conversations loaded successfully")}catch(t){return void this.Rm("Error completing conversations initialization",t)}this.Im&&this._conversationsManager.setTheme(this.Im),this.Pm()}else rf.error("Cannot complete initialization: remote config is null")}Pm(){const t=this.Mm;this.Mm=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}Rm(t,i){rf.error(t,i),this._conversationsManager=null,this.$m=!1,this.Cm=!0}show(){this._conversationsManager?this._conversationsManager.show():rf.warn("Conversations not loaded yet.")}hide(){"open"===this.Mm&&(this.Mm=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.Mm=null,this._conversationsManager.open()):this.Mm="open"}close(){this._conversationsManager?(this.Mm=null,this._conversationsManager.close()):this.Mm="close"}setTheme(t){var i,e;this.Im=us(us(us({},this.Im),t),{},{dark:us(us({},null===(i=this.Im)||void 0===i?void 0:i.dark),null==t?void 0:t.dark)}),null===(e=this._conversationsManager)||void 0===e||e.setTheme(t)}isAvailable(){return!0===this.xm&&!$i(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Gr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Em?"remote_config_failed":yi(this.xm)?this.Em?"disabled_in_project":"remote_config_pending":this.xm?xi(this.ie)||!this.ie.token?"missing_token":(null==f?void 0:f.__PosthogExtensions__)?this.$m?"initializing":this.Cm?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return Li(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(rf.warn(of),null)})()}getMessages(t,i){var e=this;return Li(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(rf.warn(of),null)})()}markAsRead(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(rf.warn(of),null)})()}getTickets(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(rf.warn(of),null)})()}requestRestoreLink(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(rf.warn(of),null)})()}restoreFromToken(t){var i=this;return Li(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(rf.warn(of),null)})()}restoreFromUrlToken(){var t=this;return Li(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(rf.warn(of),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}rv(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}ov(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}},logs:class extends ff{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:rt,get remoteConfigWillArrive(){var i,e;return!(null===(i=t.Fc)||void 0===i?void 0:i.call(t))||!!(null===(e=f._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=s,xi(n)||(e.sessionStartTimestamp=n),xi(r)||(e.lastActivityTimestamp=r)}if((null==f||null===(i=f.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?is(f.location.href):f.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i)}return e}(t)),this._instance=t,this.name=bh,this.Kf()}get Qf(){return this._instance.__loaded}Zf(){const t=Dr("[logs]"),i=null==f?void 0:f.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=g(this._instance);if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0)})};t.error(j)}},metrics:class{constructor(t){this._instance=t,this.R=Dr("[metrics]"),this.qi=!1,this.Om=!1,this.gn=()=>{"hidden"===(null==o?void 0:o.visibilityState)&&this.flush()}}initialize(){this.onConfigChange(),this.qi||this.Om||!(null==o?void 0:o.addEventListener)||(Vr(o,"visibilitychange",this.gn),this.Om=!0)}onConfigChange(){var t;if(this.qi)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.Fm?this.Fm=(t=>{let i=!0;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,s=xf(t,e),n=Sf(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.Fm&&(this.Fm(),this.Fm=void 0)}tp(){var t;if(this.qi)return;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;if(!this.Gf||this.ep!==i){var e;null===(e=this.Gf)||void 0===e||e.reset(),this.ep=i;const t=function(t){var i,e,s,n,r;const 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!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i);yi(null==i?void 0:i.flushIntervalMs)&&(t.flushIntervalMs=6e4),this.Gf=new Cr(this.Xf(),t,this.R)}return this.Gf}count(t,i=1,e){var s;null===(s=this.tp())||void 0===s||s.count(t,i,e)}gauge(t,i,e){var s;null===(s=this.tp())||void 0===s||s.gauge(t,i,e)}histogram(t,i,e){var s;null===(s=this.tp())||void 0===s||s.histogram(t,i,e)}flush(t){if(!this.Gf)return Promise.resolve();if(t){const i=this.Gf.drainWindow();return i&&this.Go(i,t),Promise.resolve()}return this.Gf.flush().catch(t=>this.R.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Gf)||void 0===t||t.reset()}dispose(){var t,i,e;this.qi=!0,null==o||null===(t=o.removeEventListener)||void 0===t||t.call(o,"visibilitychange",this.gn),this.Om=!1,null===(i=this.Fm)||void 0===i||i.call(this),this.Fm=void 0,null===(e=this.Gf)||void 0===e||e.reset()}Xf(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Go:t=>i.Go(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}Go(t,i){return new Promise(e=>{let s=!1;const n=t=>{s||(s=!0,clearTimeout(r),e(t))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(us(us(us({method:"POST",url:this.Lm(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),"hidden"===(null==o?void 0:o.visibilityState)&&{preferSyncCompression:!0}),{},{fireCallbackOnDrop:!0,callback(t){const 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}`)})}}}))})}Lm(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}},webMCP:class{constructor(t){this._instance=t,this.Dm=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.Dm)return;const t=null==o?void 0:o.modelContext;if(!t||!gi(t.registerTool))return;const i=kf.get(t);if(i)return i.instances.add(this._instance),void(this.Dm=!0);const e={instances:new Set([this._instance])},s=t.registerTool,n=this;tc(t,"registerTool",t=>{const i=t;return function(t,...s){let r=t;try{r=n.Nm(t,e)}catch(e){return i.call(this,t,...s)}return i.call(this,r,...s)}}),t.registerTool!==s&&(kf.set(t,e),this.Dm=!0)}Nm(t,i){if(!t||!gi(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!yi(t)||_i(t)&&Object.keys(t).every(t=>Ef.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!_i(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||_i(t.properties))&&(!t.required||pi(t.required))}(s))return{tool:Rf(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>Cf(n,t)||pi(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return{tool:Rf(t),injected:e};const o=us({},n),l=pi(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The model identifier you are running as, for example "claude-opus-4-8" or "gpt-5.2". Pass "unknown" if you are not certain. Recorded for the site developer\'s analytics.'},l.includes("llm_model")||l.push("llm_model")),{tool:Rf(t,us(us({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:!1,model:!1};for(const e of t.instances){const t=Of(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==t?void 0:t.intent)),i.model||(i.model=!0===(null==t?void 0:t.model))}return i}(i));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,i){if(!_i(t))return{};try{const e=i.intent?Af(t.context,2048,!0):void 0,s=i.model?Af(t.llm_model,256):void 0;return us(us({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(o[0],r),u=function(t,i){const e=t[0];if(!_i(e))return t;try{const s=i.intent&&Cf(e,"context"),n=i.model&&Cf(e,"llm_model");if(!s&&!n)return t;const r=us({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,u)}catch(t){throw s.jm(i,n,l,{error:t,errorResult:!1},a),t}if((c=h)&&"function"==typeof c.then)return Promise.resolve(h).then(t=>{const e=If(t)?{error:t,errorResult:!0}:void 0;return s.jm(i,n,l,e,a),t},t=>{throw s.jm(i,n,l,{error:t,errorResult:!1},a),t});var c;const d=If(h)?{error:h,errorResult:!0}:void 0;return s.jm(i,n,l,d,a),h}}),n}jm(t,i,e,s,n){const r=Date.now()-e.getTime();let o;for(const u of t.instances){var a;const t=Of(u.config.capture_webmcp);if(t){s&&!o&&(o=Lf(s.error,s.errorResult));try{u.capture("$mcp_tool_call",us(us(us({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==l?void 0:l.hostname,$mcp_duration_ms:r,$mcp_is_error:!!s},o?{$mcp_error_type:o.type,$mcp_error_message:o.message}:{}),t.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e})}catch(t){continue}if(s&&o&&u.exceptions&&(null===(a=u.exceptionObserver)||void 0===a?void 0:a.isEnabled))try{const t={$exception_list:Df(u.exceptions,s,o.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==l?void 0:l.hostname};u.exceptionObserver.captureException(t)}catch(t){}}}}}});const Nf={"conversations.js":"sha384-8fPy3IASBzA8AWqnw4GisFo+FugHLE1xLpCaDmKKa+sdTroMj7fsaSQxeJdciOoP","crisp-chat-integration.js":"sha384-qVSPPiM5PHJlVNpiLPyETnf0VXOGevtCqjm2K8EmWnKpLQnY/TMu+iLJ8wWLW8iA","dead-clicks-autocapture.js":"sha384-MYefNCyD6/XLhTOKa8DavuGsgGJvAJO/X4iqoFkAqgGk7H9qgcIoysU9F2qVGMk1","exception-autocapture.js":"sha384-miJNvXEqyiBQpQrLVO7Yfby3J/doNarkjZX+a1eOKpGkF23r0WwtkxSSPyz/ngDx","intercom-integration.js":"sha384-gWEoUxf+HEPSZ4GZthxep/3LlEectgXxzj8uWkW7dnvRRV6AKkHXtZEmcb0OqOvn","lazy-recorder.js":"sha384-Ge58ONxarh9k88Xh0cuyu9EsN4wEhFQkA+e2lQbzD6COVKkGG/s1EeLkGhaXCZf1","logs.js":"sha384-HGXa+FeVH5JwY3bwubM1EJrP+LG95rh6oU9TbtzHZLs1ECpl5mCXv5FcYF8SgNjk","product-tours.js":"sha384-TlWlQfnDBI1yB3+CuhSTePe38C4bKqQwtK1m0/T6kk/EAsKbWvIya0UeuVkDmSV7","recorder.js":"sha384-t08QiFh+RHB6Jdz9IrPZ5yxf3Dzwdz92Mz0l8Ga/nox8o5+oO0I0gosm16hHDlCF","surveys.js":"sha384-voLXJFCjNwKYjWdB/DrH+XOQ4hYyH7Vi7xz/L+k8Z3WqCkKR6AnlC/ypiOR3UVIT","tracing-headers.js":"sha384-Zb7V2jbC5lJGl7yFzBe8HpCvO3xgJln/lEcqY5xAQ9Z1LLCnbi2glbsfvRPRIYcD","web-vitals-soft-navs.js":"sha384-recN8i2tLQWaeNtCAnErAmFlgg4+33FAHvs8l84aE+SHr6oqLAPwhFVZdP4SfKT6","web-vitals-with-attribution-soft-navs.js":"sha384-f9L4YQQre9lKeUzyvy2Kt4dHLIXECipeMmbr7SPQAOqLi+ZCHbh1I1g/OwsK/zrp","web-vitals-with-attribution.js":"sha384-QVSLDmgzPE1K6g6gBB8QKx/YDQbI2ot0gAcajFIAkGf34SWA3oe6m+WzcmbzpVjD","web-vitals.js":"sha384-wNvgQ2MIesvfVwpUOblaIO/5weiMjR0Ld1eSNtW14MURV24BwfW8Svo6TsBJ3Bk9"},Bf=/^sha384-[A-Za-z0-9+/]{64}$/,Uf=Dr("[ExternalScriptsLoader]"),zf=t=>{const i=null==o?void 0:o.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Hf=(t,i,e)=>{e?Uf.critical(i):Uf.warn(i),t(i)},qf=(t,i,e,s)=>{if(t.config.disable_external_dependency_loading)return Uf.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const n=()=>{if(null==o||o.removeEventListener("DOMContentLoaded",n),t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");if(!o)return e("document not found");let l=o.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",s&&(l.integrity=s),l.src=i,l.onload=t=>{l.__posthog_loading_callback_fired=!0,e(void 0,t)},l.onerror=t=>{l.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return e("prepare_external_dependency_script returned null");if(s&&(!l.src||l.integrity!==s||"anonymous"!==l.crossOrigin))return Hf(e,`prepare_external_dependency_script must keep src, integrity and crossOrigin 'anonymous' for ${i}`,!0);if(t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");const a=zf(l.src);if(a){if(a.integrity!==l.integrity||a.crossOrigin!==l.crossOrigin||a.nonce!==l.nonce)return e("Existing script conflicts with prepared script policy");if(a.__posthog_loading_callback_fired)return e();const t=a.__posthog_loading_error;return t?e(t):(a.addEventListener("load",t=>{a.__posthog_loading_callback_fired=!0,e(void 0,t)}),void a.addEventListener("error",t=>{a.__posthog_loading_error=t,e(t)}))}if(!o.body)return r();if("head"===t.config.external_scripts_inject_target)o.head.appendChild(l);else{const t=o.querySelectorAll("body > script");var u;t.length>0?null===(u=t[0].parentNode)||void 0===u||u.insertBefore(l,t[0]):o.body.appendChild(l)}},r=()=>{null==o||o.addEventListener("DOMContentLoaded",n)};(null==o?void 0:o.body)||zf(i)?n():r()},Wf={},Vf=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",e)};f.__PosthogExtensions__=f.__PosthogExtensions__||{};const Gf=(t,i,e)=>{if(t.config.require_subresource_integrity){if("remote-config"===i||"toolbar"===i)return Hf(e,`${i} can't be integrity-verified, so it is not loaded with require_subresource_integrity`);if(!o||!("integrity"in o.createElement("script")))return Hf(e,"This browser does not support Subresource Integrity",!0);const s=`${i}.js`,n=Nf[s];return bi(n)&&Bf.test(n)?void qf(t,t.requestRouter.endpointFor("assets",`/static/${t.version}/${s}`),e,n):Hf(e,`No integrity hash for ${s}`,!0)}if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void qf(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Wf[n];if("fallback"===s&&r){if(zf(r))return void qf(t,r,e);delete Wf[n]}return void qf(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=Vf(t,i);Wf[n]=s;const r=zf(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),qf(t,s,e)}else e(void 0,r)}:e)}qf(t,Vf(t,i),e)};p=Gf,f.__PosthogExtensions__.loadExternalDependency=Gf,f.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{if(t.config.require_subresource_integrity)return Hf(e,`Site apps can't be integrity-verified, so ${i} is not loaded with require_subresource_integrity`);const s=t.requestRouter.endpointFor("api",i);qf(t,s,e)};const Kf=function(){e.SDK_DIST_CHANNEL="npm";const t=Th[Uh]=new Kh;return function(){function t(){t.done||(t.done=!0,Pu=!1,Lr(Th,function(t){t._dom_loaded()}))}(null==o?void 0:o.addEventListener)?"complete"===o.readyState?t():Vr(o,"DOMContentLoaded",t,{capture:!1}):s&&Fr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=ga,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=wa,exports.PostHog=Kh,exports.ProductTourEventName=xa,exports.ProductTourEventProperties=Sa,exports.SurveyEventName=ya,exports.SurveyEventProperties=ba,exports.SurveyEventType=_a,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=ma,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Kf,exports.posthog=Kf,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
2
2
|
//# sourceMappingURL=main.js.map
|