posthog-js 1.431.2 → 1.431.3
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/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +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/extension-bundles.js +1 -1
- 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.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +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/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="0.8.3",i={DEBUG:(!1,!1),LIB_VERSION:(t,"1.431.2"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:t};var e=i;const s="$people_distinct_id",n="distinct_id",r="$device_id",o="$device_model",l="__alias",a="__cmpns",u="$fbc",h="$fbc_persistence",d="__timers",c="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",f="$exception_capture_enabled_server_side",p="$error_tracking_suppression_rules",_="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",m="$dead_clicks_enabled_server_side",b="$product_tours_enabled_server_side",y="$logs_capture_enabled_server_side",w="$web_vitals_allowed_metrics",S="$session_recording_remote_config",x="$session_recording_enabled_server_side",E="$replay_sample_rate",k="$replay_override_sampling",T="$replay_override_linked_flag",P="$replay_override_url_trigger",C="$replay_override_event_trigger",O="$sesid",R="$session_is_sampled",I="$session_past_minimum_duration",F="$session_recording_url_trigger_activated_session",A="$session_recording_event_trigger_activated_session",M="$debug_first_full_snapshot_timestamp",D="$sess_rec_flush_size",N="$enabled_feature_flags",j="$active_feature_flags",L="$early_access_features",B="$feature_flag_details",U="$feature_flag_payloads",z="$feature_flag_request_id",H="$minimal_flag_called_events",q="$override_feature_flags",V="$override_feature_flag_payloads",W="$stored_person_properties",G="$stored_group_properties",K="$groups",J="$surveys",Y="$surveys_loaded_at",X="$surveys_activated",Q="$surveys_activated_session",Z="$surveys_activated_timestamps",tt="ph_product_tours",it="$product_tours_activated",et="$product_tours_activated_session",st="$conversations_widget_session_id",nt="$conversations_ticket_id",rt="$conversations_widget_state",ot="$conversations_user_traits",lt="$flag_call_reported",at="$flag_call_reported_session_id",ut="$feature_flag_errors",ht="$feature_flag_evaluated_at",dt="$user_state",ct="$client_session_props",vt="$capture_rate_limit",ft="$initial_campaign_params",pt="$initial_referrer_info",_t="$initial_person_info",gt="$epp",mt="$posthog_cookieless",bt="$cookieless_mode",yt="$sdk_debug_extensions_init_method",wt="$sdk_debug_extensions_init_time_ms",$t="$sdk_debug_recording_script_not_loaded",St="$sdk_debug_replay_event_trigger_status",xt="$sdk_debug_replay_linked_flag_trigger_status",Et="$sdk_debug_replay_matched_recording_trigger_groups",kt="$sdk_debug_replay_pending_trigger_conditions",Tt="$sdk_debug_replay_remote_trigger_matching_config",Pt="$sdk_debug_replay_trigger_groups_count",Ct="$sdk_debug_replay_url_trigger_status",Ot="$session_recording_start_reason",Rt="PostHog loadExternalDependency extension not found.",It="anonymous",Ft="identified",At="identified_only",Mt="visibilitychange",Dt="beforeunload",Nt="$pageview",jt="$pageleave",Lt="$identify",Bt="$groupidentify",Ut="u">typeof window?window:void 0,zt="u">typeof globalThis?globalThis:Ut,Ht=null==zt?void 0:zt.navigator,qt=null==zt?void 0:zt.document,Vt=null==zt?void 0:zt.location,Wt=null==zt?void 0:zt.fetch,Gt=(null==zt?void 0:zt.XMLHttpRequest)&&"withCredentials"in new zt.XMLHttpRequest?zt.XMLHttpRequest:void 0,Kt=null==zt?void 0:zt.AbortController,Jt=null==zt?void 0:zt.CompressionStream,Yt=null==Ht?void 0:Ht.userAgent;function Xt(){return!(!Ut||!1===Ut.navigator.onLine)}const Qt="undefined"!=typeof globalThis?globalThis:Ut;Qt&&"undefined"==typeof self&&(Qt.self=Qt),Qt&&"undefined"==typeof File&&(Qt.File=function(){});const Zt=null!=Ut?Ut:{};var ti=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ii=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ei=["$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"],si=["token"];function ni(t,i){return-1!==t.indexOf(i)}const ri=function(t){return t.trim()},oi=function(t){return t.replace(/^\$/,"")};function li(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 ai=Object.prototype,ui=ai.hasOwnProperty,hi=ai.toString,di=Array.isArray||function(t){return"[object Array]"===hi.call(t)},ci=t=>"function"==typeof t,vi=t=>t===Object(t)&&!di(t),fi=t=>{if(vi(t)){for(const i in t)if(ui.call(t,i))return!1;return!0}return!1},pi=t=>void 0===t,_i=t=>"[object String]"==hi.call(t),gi=t=>_i(t)&&0===t.trim().length,mi=t=>null===t,bi=t=>pi(t)||mi(t),yi=t=>"[object Number]"==hi.call(t)&&t==t,wi=t=>yi(t)&&t>0,$i=t=>"[object Boolean]"===hi.call(t),Si=t=>ni(ei,t),xi=t=>ni(si,t);function Ei(t){return null===t||"object"!=typeof t}function ki(t,i){return{}.toString.call(t)===`[object ${i}]`}function Ti(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 Ci(t,Error)}}function Pi(t){return"u">typeof Event&&Ci(t,Event)}function Ci(t,i){try{return t instanceof i}catch(t){return!1}}const Oi=[!0,"true",1,"1","yes"],Ri=t=>ni(Oi,t),Ii=[!1,"false",0,"0","no"];function Fi(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 Ai(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){Fi(r,s,n,o,l,"next",t)}function l(t){Fi(r,s,n,o,l,"throw",t)}o(void 0)})}}const Mi=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Di=function(t,i=[]){if(!t)return!1;const e=t.toLowerCase();return Mi.concat(i).some(t=>{const i=t.toLowerCase();return-1!==e.indexOf(i)})};function Ni(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),yi(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),Ni(null!=n?n:e,i,e,s))}var ji=class{constructor(t){this.C={},this.I=t.I,this.R=Ni(t.bucketSize,0,100,t.$),this.A=Ni(t.refillRate,0,this.R,t.$),this.O=Ni(t.refillInterval,0,864e5,t.$)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.O);e>0&&(t.tokens=Math.min(t.tokens+e*this.A,this.R),t.lastAccess=t.lastAccess+e*this.O)}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.R,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 Li="Mobile",Bi="Android",Ui="Tablet",zi="Android Tablet",Hi="iPad",qi="Apple Watch",Vi="Safari",Wi="BlackBerry",Gi="Samsung Internet",Ki="Chrome",Ji="Chrome iOS",Yi="Internet Explorer",Xi="Internet Explorer Mobile",Qi="Opera",Zi="Microsoft Edge",te="Firefox",ie="Firefox iOS",ee="Nintendo",se="PlayStation",ne="Xbox",re="Android Mobile",oe="Mobile Safari",le="Windows",ae="Windows Phone",ue="Nokia",he="Ouya",de="Generic "+Li.toLowerCase(),ce="Generic "+Ui.toLowerCase(),ve="Konqueror",fe="Oculus Browser",pe="Vivaldi",_e="Yandex",ge="Whale",me="DuckDuckGo",be="Pale Moon",ye="Waterfox",we="Brave",$e="Claude",Se="Codex",xe="ChatGPT",Ee="Google Search App",ke=new RegExp("Version/(\\d+(\\.\\d+)?)"),Te=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Pe=new RegExp(ne,"i"),Ce=new RegExp("PlayStation \\w+","i"),Oe=new RegExp("Nintendo \\w+","i"),Re=new RegExp("BlackBerry|PlayBook|BB10","i"),Ie={"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"},Fe=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?we:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&ni(t,"GSA/")?Ee:ni(t," OPR/")&&ni(t,"Mini")?"Opera Mini":ni(t," OPR/")?Qi:Re.test(t)?Wi:ni(t,"IEMobile")||ni(t,"WPDesktop")?Xi:ni(t,"OculusBrowser")?fe:ni(t,"SamsungBrowser")?Gi:ni(t,"Edge")||ni(t,"Edg/")?Zi:ni(t,"Vivaldi/")?pe:ni(t,"YaBrowser/")?_e:ni(t,"Whale/")?ge:ni(t,"DuckDuckGo/")||ni(t,"Ddg/")?me:ni(t,"Claude/")?$e:ni(t,"Codex/")?Se:ni(t,"ChatGPT/")?xe:ni(t,"FBIOS")?"Facebook Mobile":ni(t,"UCWEB")||ni(t,"UCBrowser")?"UC Browser":ni(t,"CriOS")?Ji:ni(t,"CrMo")||ni(t,Ki)?Ki:ni(t,Bi)&&ni(t,Vi)?re:ni(t,"FxiOS")?ie:ni(t.toLowerCase(),ve.toLowerCase())?ve:ni(t,"Brave/")?we:((t,i)=>i&&ni(i,"Apple")||function(t){return ni(t,Vi)&&!ni(t,Ki)&&!ni(t,Bi)}(t))(t,i)?ni(t,Li)?oe:Vi:ni(t,"PaleMoon/")?be:ni(t,"Waterfox/")?ye:ni(t,te)?te:ni(t,"MSIE")||ni(t,"Trident/")?Yi:ni(t,"Gecko")?te:"")},Ae={[Xi]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ki]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Ji]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Vi]:[ke],[oe]:[ke],[Qi]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ie]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ve]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Wi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ke],[re]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Gi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[fe]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[pe]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[ge]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[$e]:[Te],[Se]:[Te],[xe]:[Te],[me]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Yi]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Me=function(t,i,e,s){const n=Fe(t,i,e,s),r=Ae[n];if(pi(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},De=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[ne,t&&t[1]||""]],[new RegExp(ee,"i"),[ee,""]],[new RegExp(se,"i"),[se,""]],[Re,[Wi,""]],[new RegExp(le,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ae,""];if(new RegExp(Li).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Ie[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[le,t]}return[le,""]}],[/((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=pi(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Bi,[t[2],t[3],t[4]||"0"].join(".")]:[Bi,""]],[/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",""]]],Ne=function(t){for(let i=0;De.length>i;i++){const[e,s]=De[i],n=e.exec(t),r=n&&(ci(s)?s(n,t):s);if(r)return r}return["",""]},je=function(t){return Oe.test(t)?ee:Ce.test(t)?se:Pe.test(t)?ne:new RegExp(he,"i").test(t)?he:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ae:/iPad/.test(t)?Hi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?qi:Re.test(t)?Wi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ue,"i").test(t)?ue:/(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(Li).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)?Bi:zi:new RegExp("(pda|Mobile)","i").test(t)?de:new RegExp(Ui,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ce:""},Le=function(t,i){var e;const s=je(t);return s===Hi||s===zi||"Kobo"===s||"Kindle Fire"===s||s===ce?Ui:s===ee||s===ne||s===se||s===he?"Console":s===qi?"Wearable":s?Li:"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)?Li:Ui:"Desktop";var n,r,o},Be=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ue=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Be],[/\bFBAN\/EMA\b/i,"Facebook Lite",Be],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Be],[/\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"]],ze="[Truncated]",He="[Unserializable]";function qe(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 Ve(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=He}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const We=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ge(t,i){return"string"==typeof(e=t)&&We.test(e)?t:i();var e}function Ke(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 Je(t){return t?t.split("#")[0]:t}function Ye(t){try{return t()}catch(t){return}}function Xe(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function Qe(t,i,e){return Ze.apply(this,arguments)}function Ze(){return(Ze=Ai(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=Xe(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let ts,is,es;function ss(t){const i=globalThis._posthogChunkIds;if(!i)return;const e=Object.keys(i);return es&&e.length===is||(is=e.length,es=e.reduce((e,s)=>{ts||(ts={});const n=ts[s];if(n)e[n[0]]=n[1];else{const n=t(s);for(let t=n.length-1;t>=0;t--){const r=n[t],o=null==r?void 0:r.filename,l=i[s];if(o&&l){e[o]=l,ts[s]=[o,l];break}}}return e},{})),es}function ns(t){return ns="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},ns(t)}function rs(t,i,e){return(i=function(t){var i=function(t){if("object"!=ns(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=ns(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ns(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function os(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 ls(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?os(Object(e),!0).forEach(function(i){rs(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):os(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}var as=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 Ai(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&di(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){let e,s;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),ls(ls({},t),{},{cause:e,stack:s})}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 Ai(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){var e,s,n;const r={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(r.stacktrace={type:"raw",frames:t.stack});const o=[r];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,ls(ls({},i),{},{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:ss(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e=0){const s=(e,s)=>{if(4>=s){const n=this.buildCoercingContext(t,i,s);return this.applyCoercers(e,n)}};return ls(ls({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,e),next:t=>s(t,e+1)})}};const us=/^([a-z][a-z0-9.+-]+):/i,hs=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ds(t){if(!t||"<anonymous>"===t)return!1;const i=us.exec(t);return!i||hs.includes(i[1].toLowerCase())}function cs(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ds(i)};return pi(s)||(r.lineno=s),pi(n)||(r.colno=n),r}const vs=(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]},fs=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ps=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_s=/\((\S*)(?::(\d+))(?::(\d+))\)/,gs=(t,i)=>{const e=fs.exec(t);if(e){const[,t,s,n]=e;return cs(i,t,"?",+s,+n)}const s=ps.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=_s.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=vs(s[1]||"?",s[2]);return cs(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ms=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,bs=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ys=(t,i)=>{const e=ms.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=bs.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]=vs(s,t),cs(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ws=/\(error: (.*)\)/;function $s(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Ss(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(!$s(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 xs(t,i){const e=i.start+i.length,s=ks(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function Es(t,i){let e=i.start;for(;e>0&&$s(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function ks(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&$s(t[s],t[s-i.length]);)s++;return s-e}function Ts(t,i){const e=i[0];let s=t.length-(e?Es(t,e):0);for(const e of i)s-=ks(t,e);return s}function Ps(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 Cs=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=_i(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 ki(t,"DOMException")}isDOMError(t){return ki(t,"DOMError")}},Os=class{match(t){return Ti(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:n}}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){return t.stacktrace||t.stack||void 0}},Rs=class{match(t){return!!ki(t,"ErrorEvent")&&(null!=t.error||this.lr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return ls(ls({},s),{},{stack:null!==(e=this.ur(t))&&void 0!==e?e:s.stack,synthetic:!0})}lr(t){return _i(t.message)&&t.message.length>0}ur(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(_i(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Is=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Fs=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(Is);return s&&(i=s[1],e=s[2]),[i,e]}};const As=["fatal","error","warning","log","info","debug"];function Ms(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return""}var Ds=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(Pi(t))return t.constructor.name;const i="name"in t?t.name:void 0;return _i(i)&&!gi(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: ${Ms(t)}`}isSeverityLevel(t){return _i(t)&&!gi(t)&&As.indexOf(t)>=0}getStack(t){try{return _i(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:_i(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(Ti(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ns=class{match(t){return Pi(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Ms(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},js=class{match(t){return Ei(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}}},Ls=class{match(t){return ki(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Pi(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 Ei(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 Bs="$message",Us="$timestamp",zs=new Set([Bs,Us]),Hs={enabled:!0,max_bytes:32768};function qs(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Hs.enabled,max_bytes:Ws(t.max_bytes,Hs.max_bytes)}:ls({},Hs)}var Vs=class{constructor(t){this.ts=[],this.es=0,this.Mr=qs(t)}setConfig(t){this.Mr=qs(t),this.ns()}add(t){const i=function(t){let i;try{i=li(t)}catch(t){return}try{const t=JSON.parse(i);if(!vi(t))return;const e=t,s=e[Bs],n=e[Us];if(!_i(s)||0===s.trim().length)return;if(!_i(n)&&!yi(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.Mr.max_bytes||(this.ts.push({step:i.step,bytes:e}),this.es+=e,this.ns())}getAttachable(){return this.ts.map(t=>t.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const t=this.ts.shift();t&&(this.es-=t.bytes)}}};function Ws(t,i){if(!yi(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const Gs=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Ks(t){return"string"==typeof t||t}function Js(t){return"string"==typeof t?t:void 0}const Ys=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Xs="NativeGzipValidationError",Qs=t=>t.length>=2&&31===t[0]&&139===t[1],Zs=(t,i)=>t===ii.GZipJS||i===ii.GZipJS||"gzip"===i,tn=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let en;const sn=t=>{throw Ke(Xs,`Native gzip produced invalid output: ${t}`)},nn=(rn=Ai(function*(t,i){18>t.size&&sn("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Qs(e)&&8===e[2]||sn("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,!0)!==(t=>{const i=(()=>{if(en)return en;en=[];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;en[t]=i>>>0}return en})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&sn("invalid-crc");const n=i.length>>>0;s.getUint32(4,!0)!==n&&sn("invalid-size")}),function(t,i){return rn.apply(this,arguments)});var rn;function on(){return on=Ai(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=Ai(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 nn(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}),on.apply(this,arguments)}const ln=3e5;var an=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,ln);if(!i)return this.ss=e,void(this.rs=e+s);this.rs=Math.max(this.rs,Math.min(e+s,this.ss+ln))}remainingMs(){const t=Date.now();if(this.ss-5e3>t)return this.reset(),0;const i=Math.min(ln,Math.max(0,this.rs-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function un(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 hn={}.propertyIsEnumerable;function dn(t,i){try{return fn(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function cn(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:ze};if(e.remainingNodes--,$i(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:qe(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:ze};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?qe(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return cn(n.call(t),i,e,s+1)}catch(t){}return di(t)?{arrayValue:{values:vn(t,i,e,s+1)}}:{kvlistValue:{values:fn(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:qe(String(t))}}function vn(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(bi(r))continue;n.push(cn(r,i,e,s))}catch(t){n.push({stringValue:He})}return t.length>o&&n.push({stringValue:ze}),n}function fn(t,i,e,s){const n=[];for(const r in t)if(hn.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(mi(o)||pi(o))continue;n.push({key:qe(r),value:cn(o,i,e,s)})}catch(t){n.push({key:qe(r),value:{stringValue:He}})}}return n}function pn(t,i,e){return ls(ls(ls(ls({},Ve({},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 _n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function gn(t,i){const e=Ve({},t),s={};for(const t of _n)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...dn(e,i),...dn(s,i)]}const mn={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 bn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},yn=bn.info;function wn(t){try{return qe(String(t))}catch(t){return He}}function $n(t,i,e,s){const n=t.level||"info",{text:r,number:o}=bn[n]||yn,l=function(t=Date.now()){return String(t)+"000000"}(yi(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),bi(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),bi(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=ls({},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=He}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:wn(t.body)},attributes:dn(u,e)};return t.trace_id&&(d.traceId=t.trace_id),t.span_id&&(d.spanId=t.span_id),pi(t.trace_flags)||(d.flags=t.trace_flags),d}function Sn(t,i,e){return pn(t,i,e)}function xn(t,i,e,s){return{resourceLogs:[{resource:{attributes:gn(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var En=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=Xe(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function kn(){return.75+.5*Math.random()}function Tn(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 Pn=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=i,this.$=e,this.cs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new En(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new an,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Ms=i.flushIntervalMs,this.Es=i.maxBatchRecordsPerPost,this.Ps=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ti.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}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.Os(t);if(null===s)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:$n(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.cs(),this.$,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(t){const i=this.Mr.beforeSend;if(!i)return t;const e=di(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.$.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),i=t-this.xs;return this.Ps>i&&i>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return Ai(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return Ai(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(ti.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;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Es),l=e.slice(0,s),a=xn(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(a);if(t._s!==i)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.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.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(ti.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var i=this;return Ai(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(ti.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ti.LogsQueue,n.slice(s)),yield i.vs()})()}qs(){return Sn(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(ti.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ti.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Tn(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ti.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return Ai(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield Qe(e,t):yield e})()}flushWithTimeout(t){var i=this;return Ai(function*(){const e=i.flush();yield Qe(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=kn(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Cn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function On(t){return String(t)+"000000"}function Rn(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 In=class{constructor(t,i,e){this._instance=t,this.Mr=i,this.$=e,this.zs=new Map,this.ps=new En(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new an,this.ks=0,this.Ss=1,this.Gs=0}count(t,i=1,e){this.Zs({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.Zs({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.Zs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this;const i=this.ys,e=function(){var e=Ai(function*(){i&&(yield i.catch(()=>{})),yield t.Qs()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Os(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.$.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.$.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?ls({},i.attributes):void 0,s=Rn(i.type,i.name,i.unit,e)}catch(t){return void this.$.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.zs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.zs.set(s,n)}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.$.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,i.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(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":{t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Cn.length+1).fill(0)});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,Cn)]+=1;break}}}Os(t){const i=this.Mr.beforeSend;if(!i)return t;const e=di(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.$.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Tn(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return Ai(function*(){if(t.ps.clear(),0===t.zs.size)return;const i=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance.Ys(t.Js(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=kn()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),s.kind){case"ok":return;case"retry-later":return t.lo(i),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",s.error)}})()}Js(t){return i=this.ao(t),e=function(t,i,e){return pn(t,i,e)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gn(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}ao(t){const i=On(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Rn(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=ls({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=dn(null!==(s=o.attributes)&&void 0!==s?s:{},this.$),u=On(o.windowStartMs);if("count"===o.type){var n;const t={attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0};l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0};l.gauge.dataPoints.push(t)}else o.hist&&l.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Cn})}return Array.from(e.values())}lo(t){for(const[s,n]of t){const t=this.zs.get(s);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,n.windowStartMs),t.type){case"count":var i,e;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(t.hist){t.hist.count+=n.hist.count,t.hist.sum+=n.hist.sum,t.hist.min=Math.min(t.hist.min,n.hist.min),t.hist.max=Math.max(t.hist.max,n.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=n.hist.bucketCounts[i]}else t.hist=n.hist}else this.Ks()&&this.zs.set(s,n)}}};const Fn=(t,{debugEnabled:e}={})=>{const s={N(s,...n){Ut&&(i.DEBUG||Ut.POSTHOG_DEBUG||e)&&!pi(Ut.console)&&Ut.console&&("__rrweb_original__"in Ut.console[s]?Ut.console[s].__rrweb_original__:Ut.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)=>Fn(`${t} ${i}`,e)};return s},An=Fn("[PostHog.js]"),Mn=An.createLogger;function Dn(t,i){di(t)&&t.forEach(i)}function Nn(t,i){if(!bi(t))if(di(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)ui.call(t,e)&&i(t[e],e)}const jn=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Ln(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 Bn=function(t){return function(...i){try{return t.apply(this,i)}catch(t){An.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),An.critical(t)}}},Un=function(t){const i={};return Nn(t,function(t,e){(_i(t)&&t.length>0||yi(t))&&(i[e]=t)}),i};function zn(t){const i=ls({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const Hn=["herokuapp.com","vercel.app","netlify.app"];function qn(t){const i=null==t?void 0:t.hostname;if(!_i(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of Hn)if(e===t)return!1;return!0}function Vn(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 Wn(t){return"ph_toolbar_internal"===t.name}const Gn=t=>{if(qt){try{const i=t+"=",e=qt.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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return yi(t)&&isFinite(t)&&Math.floor(t)===t});var Kn=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}},Jn=class{generate(){const t=this.generateOrAbort();if(!pi(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(pi(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return yi(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return Kn.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new Xn}};let Yn=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};Ut&&!pi(Ut.crypto)&&crypto.getRandomValues&&(Yn=t=>crypto.getRandomValues(t));var Xn=class{nextUint32(){return this.Rt.length>this.$t||(Yn(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Qn;const Zn=()=>tr().toString(),tr=()=>(Qn||(Qn=new Jn)).generate();let ir="";const er=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let sr=null;const nr={Et(){if(!mi(sr))return sr;if(sr=!1,qt)try{const t=`__ph_cookie_support_${Zn()}`;nr.At(t,"xyz"),sr='"xyz"'===Gn(t),nr.Lt(t)}catch(t){sr=!1}return sr},Pt(t){An.error("cookieStore error: "+t)},Ot:Gn,Dt(t){let i;try{i=JSON.parse(nr.Ot(t))||{}}catch(t){}return i},At(t,i,e,s,n){if(!qt)return!1;try{let r="",o="";const l=function(t,i){if(i){let i=function(t,i=qt){if(ir)return ir;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_"+Zn();for(;!ir&&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",ir=t)}return ir}(t);if(!i){const e=(t=>{const i=t.match(er);return i?i[0]:""})(t);e!==i&&An.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(qt.location.hostname,s);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),r="; expires="+t.toUTCString()}n&&(o="; secure");const a=t+"="+encodeURIComponent(JSON.stringify(i))+r+"; SameSite=Lax; path=/"+l+o;return a.length>3686.4&&An.warn("cookieStore warning: large cookie, len="+a.length),qt.cookie=a,!0}catch(t){return!1}},Lt(t,i){if(null==qt?void 0:qt.cookie)try{nr.At(t,"",-1,i)}catch(t){return}}};let rr=null;const or={Et(){if(!mi(rr))return rr;let t=!0;if(pi(Ut))t=!1;else try{const i="__mplssupport__";or.At(i,"xyz"),'"xyz"'!==or.Ot(i)&&(t=!1),or.Lt(i)}catch(i){t=!1}return t||An.error("localStorage unsupported; falling back to cookie store"),rr=t,t},Pt(t){An.error("localStorage error: "+t)},Ot(t){try{return null==Ut?void 0:Ut.localStorage.getItem(t)}catch(t){or.Pt(t)}return null},Dt(t){try{return JSON.parse(or.Ot(t))||{}}catch(t){}return null},At(t,i){try{return null==Ut||Ut.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){or.Pt(t)}return!1},Lt(t){try{null==Ut||Ut.localStorage.removeItem(t)}catch(t){or.Pt(t)}}},lr=[W,j,N,B,U,z,ht,ut,lt],ar=[r,n,O,R,gt,_t,h,dt],ur=t=>t+"_cpm",hr=["__proto__","constructor","prototype"],dr=t=>{if(!vi(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===hr.indexOf(e)&&(i[e]=t[e])}),i},cr=(t,i=[])=>{const e={};return[...ar,...i].forEach(i=>{const s=t[i];pi(s)||mi(s)||""===s||(e[i]=s)}),e},vr=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)},fr=(t,i)=>({p:i,f:vr(JSON.stringify(t))}),pr=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=nr.Dt(ur(t)),s=(null==e?void 0:e.f)===vr(i)&&di(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},_r=(t,i)=>i+"|"+(nr.Ot(ur(t))||""),gr={},mr={Et:()=>!0,Pt(t){An.error("memoryStorage error: "+t)},Ot:t=>t in gr?gr[t]:null,Dt:t=>t in gr?gr[t]:null,At:(t,i)=>(gr[t]=i,!0),Lt(t){delete gr[t]}};let br=null;const yr={Et(){if(!mi(br))return br;if(br=!0,pi(Ut))br=!1;else try{const t="__support__";yr.At(t,"xyz"),'"xyz"'!==yr.Ot(t)&&(br=!1),yr.Lt(t)}catch(t){br=!1}return br},Pt(t){An.error("sessionStorage error: ",t)},Ot(t){try{return null==Ut?void 0:Ut.sessionStorage.getItem(t)}catch(t){yr.Pt(t)}return null},Dt(t){try{return JSON.parse(yr.Ot(t))||null}catch(t){}return null},At(t,i){try{return null==Ut||Ut.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){yr.Pt(t)}return!1},Lt(t){try{null==Ut||Ut.sessionStorage.removeItem(t)}catch(t){yr.Pt(t)}}};var wr=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){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 Ao(){const t=this.Fo.Ot(this.Oo);return Ri(t)?1:ni(Ii,t)?0:-1}get Fo(){const t=this.Mr.opt_out_capturing_persistence_type,i="localStorage"===t?or:nr,e=i.Et()?i:mr;if(!this.Do||this.Do!==e){this.Do=e;const i="localStorage"===t?nr:or;i.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(Ri(i.Ot(this.Oo))),i.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==Ht?void 0:Ht.doNotTrack,null==Ht?void 0:Ht.msDoNotTrack,Zt.doNotTrack,null==Ht?void 0:Ht.globalPrivacyControl].some(t=>Ri(t))}};function $r(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!ci(s))return i;try{const t=s(i);return _i(t)&&t?t:i}catch(t){return An.error("Error in get_current_url, falling back to window.location.href",t),i}}function Sr(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 xr(t){return!!t&&1===t.nodeType}function Er(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function kr(t){return!!t&&3===t.nodeType}function Tr(t){return!!t&&11===t.nodeType&&xr(t.host)}function Pr(t){return t?ri(t).split(/\s+/):[]}function Cr(t,i){const e=function(t){var i;const e=null==Ut||null===(i=Ut.location)||void 0===i?void 0:i.href;return pi(e)?void 0:$r(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Or(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 Pr(i)}function Rr(t){return bi(t)?null:ri(t).split(/(\s+)/).filter(t=>eo(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ir(t){let i="";return Gr(t)&&!Kr(t)&&t.childNodes&&t.childNodes.length&&Nn(t.childNodes,function(t){var e;kr(t)&&t.textContent&&(i+=null!==(e=Rr(t.textContent))&&void 0!==e?e:"")}),ri(i)}function Fr(t){var i;return pi(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Ar=["a","button","form","input","select","textarea","label"];function Mr(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 Dr(t,i){if(pi(i))return!0;for(const e of t)if(i.some(t=>Mr(e,t)))return!0;return!1}function Nr(t){const i=t.parentNode;return!(!i||!xr(i))&&i}const jr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Lr=["next","previous","prev",">","<"],Br=[...Lr,"+","-","−","–"],Ur=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,zr=[".ph-no-rageclick",".ph-no-capture"],Hr=["","text","search","email","password","url","tel","number"];function qr(t,i){if(!Ut||Vr(t))return!1;let e,s,n;var r,o;if($i(i)?(e=!!i&&zr,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:zr,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||!xr(t))&&(!!Er(t,"textarea")||(Er(t,"input")?ni(Hr,(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}=Wr(t,!1);return!function(t,i){if(!1===t||pi(t))return!1;let e;if(!0===t)e=Lr;else{if(!di(t))return!1;if(t.length>10)return An.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(({safeText:t,ariaLabel:i})=>e.some(e=>Ur(t,e)||Ur(i,e)))}(s,l.map(t=>{var i;return{safeText:Ir(t).toLowerCase(),ariaLabel:(null===(i=t.getAttribute("aria-label"))||void 0===i?void 0:i.toLowerCase().trim())||""}}))&&!Dr(l,e)}const Vr=t=>!t||Er(t,"html")||!xr(t),Wr=(t,i)=>{if(!Ut||Vr(t))return{parentIsUsefulElement:!1,targetElementList:[]};let e=!1;const s=[t];let n=t;for(;n.parentNode&&!Er(n,"body");){if(Tr(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}const t=Nr(n);if(!t)break;if(i||Ar.indexOf(t.tagName.toLowerCase())>-1)e=!0;else try{const i=Ut.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(e=!0)}catch(t){}s.push(t),n=t}return{parentIsUsefulElement:e,targetElementList:s}};function Gr(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!Er(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return!1;i.add(s);const t=Or(s);if(ni(t,"ph-sensitive")||ni(t,"ph-no-capture"))return!1}if(ni(Or(t),"ph-include"))return!0;const s=t.type||"";if(_i(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=t.name||t.id||"";return!_i(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Kr(t){return!!(Er(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Er(t,"select")||Er(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Jr=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}))$"),Yr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Xr=[16,15,14,13],Qr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),to=/[0-9A-Za-z_]/;function io(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 eo(t,i=!0){if(bi(t))return!1;if(_i(t)){if(t=ri(t),i?Jr.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(Yr.lastIndex=0;i=Yr.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 Xr){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(Jr.test(i)&&io(i))return!0}}}return!1}(t))return!1;if(i?Qr.test(t):function(t){let i;for(Zr.lastIndex=0;i=Zr.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&to.test(t)&&to.test(e)))return!0}return!1}(t))return!1}return!0}function so(t){let i=Ir(t);return i=`${i} ${no(t)}`.trim(),eo(i)?i:""}function no(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Nn(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Ir(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${no(t)}`.trim())}catch(t){An.error("[AutoCapture]",t)}}),i}function ro(t){return t.replace(/"|\\"/g,'\\"')}function oo(t){const i=t.attr__class;if(i)return di(i)?i:Pr(i)}const lo=Mn("[Dead Clicks]"),ao=()=>!0,uo=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(m)),s=t.instance.config.capture_dead_clicks;return $i(s)?s:!!vi(s)||e};var ho=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}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({[m]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?lo.error("failed to load script",i):t()})}qo(){var t;if(qt){if(!this.Lo&&(null===(t=Zt.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=vi(this.instance.config.capture_dead_clicks)?ls({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=Zt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(qt),lo.info("starting...")}}else lo.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,lo.info("stopping..."))}};const co=Mn("[SegmentIntegration]");function vo(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>ci(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Zn();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(dt,Ft)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&ci(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||co.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()||(co.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(co.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!bi(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))ui.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=di(t)?t:[t];let s=ls({},i);for(const t of e)try{if(s=t(s),bi(s))return null}catch(t){return co.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(bi(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,Nt)},identify(t){return s(t,Lt)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{co.error("Failed to register the Segment integration",t),i()})},e)}const fo="posthog-js";function po(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,d;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const c=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=c,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=>ls(ls({},t),{},{stacktrace:t.stacktrace?ls(ls({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>ls(ls({},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===(d=v[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var _;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(_=t.exceptions)||void 0===_||_.sendExceptionEvent(p)),o}}var _o=class{constructor(t,i,e,s,n,r){this.name=fo,this.setupOnce=function(o){o(po(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},go=class{constructor(t){this.jo=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(An.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.jo)}destroy(){var t;null===(t=this.zo)||void 0===t||t.call(this),this.zo=void 0}doPageView(t,i){var e;const s=this.Uo(t,i);return this.Bo={pathname:null!==(e=null==Ut?void 0:Ut.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.Uo(t,null===(i=this.Bo)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Bo)||void 0===t?void 0:t.pageViewId}}Uo(t,i){const e=this.Bo;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(!(pi(t)||pi(i)||pi(e)||pi(r)||pi(o)||pi(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?Ni(i/t,0,1,An):1,a=t>1?Ni(e/t,0,1,An):1,u=r>1?Ni(o/r,0,1,An):1,h=r>1?Ni(l/r,0,1,An):1;s=jn(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 mo=["flags","surveys"],bo={[s]:{exposure:"hidden"},[l]:{exposure:"hidden"},[a]:{exposure:"hidden"},[d]:{exposure:"hidden"},[h]:{exposure:"hidden"},[c]:{exposure:"event"},[v]:{exposure:"hidden"},[y]:{exposure:"hidden"},[f]:{exposure:"event"},[p]:{exposure:"hidden"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},[w]:{exposure:"event"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},[O]:{exposure:"hidden"},[R]:{exposure:"event"},[E]:{exposure:"event",shouldSkipFromEventProperties:t=>mi(t)},[I]:{exposure:"event"},[F]:{exposure:"event"},[A]:{exposure:"event"},[M]:{exposure:"event"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden",storageGroup:"flags"},[L]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"flags"},[U]:{exposure:"hidden",storageGroup:"flags"},[z]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[H]:{exposure:"hidden",storageGroup:"flags"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[J]:{exposure:"hidden",storageGroup:"surveys"},[Y]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[X]:{exposure:"event"},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[st]:{exposure:"event"},[nt]:{exposure:"event"},[rt]:{exposure:"event"},[ot]:{exposure:"event"},[lt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[K]:{exposure:"event"},[ut]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[dt]:{exposure:"hidden"},[ct]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[k]:{exposure:"event"},[T]:{exposure:"event"},[P]:{exposure:"event"},[C]:{exposure:"event"},[yt]:{exposure:"event"},[wt]:{exposure:"event"},[$t]:{exposure:"event"},[St]:{exposure:"event"},[xt]:{exposure:"event"},[Et]:{exposure:"event"},[kt]:{exposure:"event"},[Tt]:{exposure:"event"},[Pt]:{exposure:"event"},[Ct]:{exposure:"event"},[Ot]:{exposure:"event"}},yo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],wo=t=>{const i=bo[t];if(i)return i;for(const[i,e]of yo)if(0===t.indexOf(i))return e},$o=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return Ti(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,zn(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return li(t)}},So=t=>{const i=null==qt?void 0:qt.createElement("a");return pi(i)?null:(i.href=t,i)},xo=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(!di(s)||2>s.length)return"";{let t=s[1];try{t=decodeURIComponent(t)}catch(i){An.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},Eo=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("=");di(s)&&(i.includes(s[0])?u.push(s[0]+"="+e):u.push(a[t]))}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},ko=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},To=(t,i)=>t>=i&&Xt(),Po=(t,i,e,s)=>{if(0===t){if(Xt()){const t=i+1;return t===e&&s(),t}return i}return 0},Co=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Co],Ro="<masked>",Io=["li_fat_id"];function Fo(t,i,e){if(!qt)return{};const s=i?[...Co,...e||[]]:[],n=Ao(Eo(qt.URL,s,Ro),t),r=function(){const t={};return Nn(Io,function(i){const e=Gn(i);t[i]=e||null}),t}();return jn(r,n)}function Ao(t,i){const e=Oo.concat(i||[]),s={};return Nn(e,function(i){const e=xo(t,i);s[i]=e||null}),s}function Mo(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(!mi(i)){s.$search_engine=i;const t=qt?xo(qt.referrer,e):"";t.length&&(s.ph_keyword=t)}return s}function Do(){return navigator.language||navigator.userLanguage}function No(){const t=Do();return"string"==typeof t?t.split("-")[0]:void 0}const jo="$direct";function Lo(){return(null==qt?void 0:qt.referrer)||jo}function Bo(t,i,e=!1){const s=t?[...Co,...i||[]]:[],n=e?Je(null==Vt?void 0:Vt.href):null==Vt?void 0:Vt.href,r=null==n?void 0:n.substring(0,1e3);return{r:Lo().substring(0,1e3),u:r?Eo(r,s,Ro):void 0}}function Uo(t,i=!1){var e;const{r:s,u:n}=t,r=i?Je(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==jo?jo:null===(e=So(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=So(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Ao(r);jn(o,i)}if(s){const t=Mo(s);jn(o,t)}return o}function zo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Ho(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const qo={flags:ht,surveys:Y},Vo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Wo=t=>`${t}_cookie_identity_change_pending`,Go=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},Ko="main",Jo=[N,j,B,U,z,ht,H,W],Yo=t=>-1!==Jo.indexOf(t),Xo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Qo=t=>{if(!t)return{};const i=JSON.parse(t);return vi(i)?i:{}},Zo=(t,i)=>{Nn(t,(e,s)=>{const n=wo(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var tl=class{constructor(t,i,e=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=t,this.nl=e,this.props={},this.sl=void 0,this.rl=(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.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&An.info("Persistence loaded",t.persistence,ls({},this.props)),this.update_config(t,t,i),this.save(),Ut){const t=()=>this.flush();Vn(Ut,"beforeunload",t,{capture:!1}),Vn(Ut,"pagehide",t,{capture:!1}),this.ul=t=>{if(this.Vo&&(!t.storageArea||t.storageArea===(null==Ut?void 0:Ut.localStorage))&&t.key)if(t.key!==this.rl){if(this.Zo){const i=mo.find(i=>t.key===this.hl(i));i&&this.cl(t.key,i)}}else this.cl(t.key,Ko)},Vn(Ut,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.Ko.get(t);if(!Yo(t)||!0===e)return;if(!0===i)return void this.dl(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.dl(t,s)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&Ut&&(Ut.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,i,e=!0){if(this.pi)return!1;let s,n;try{if(n=or.Ot(t),mi(n)){const t=this.vl(i);return t.storageValue=null,i!==Ko&&(t.persisted=!1),!1}s=Qo(n)}catch(t){return!1}const r=i===Ko?s:or.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(s,i,e);return i===Ko&&this.Zo&&!Xo(this.gl().main,s)||this.ml(s,i,!0,n),o}fl(t){const i=this.props[n],e=t[n];return!pi(i)&&!pi(e)&&i!==e}ml(t,i,e,s){const n=this.vl(i);n.storageValue=s,i!==Ko&&(n.persisted=e);try{n.fingerprint=this.yl(t,i)}catch(t){n.fingerprint=void 0}}pl(t,i,e){let s=!1;return Jo.forEach(e=>{var n;const r=null===(n=wo(e))||void 0===n?void 0:n.storageGroup;if(i===Ko&&this.Zo&&r||i!==Ko&&r!==i)return;const o=e in t,l=this.bl(e,o?t[e]:void 0),a=this.Ko.has(e)?e in this.props:o;a===e in this.props&&Xo(l,this.props[e])||(a?this._l(e,l,!1):this.wl(e,!1),s=!0)}),s&&e&&this.il.forEach(t=>t()),s}kl(){if(!this.Vo)return!1;try{this.tl=!1;const t=or.Ot(this.rl),i=this.vl(Ko);let e,s=!1,n=!1;if(t!==i.storageValue)if(mi(t))i.storageValue=null;else{if(e=Qo(t),this.tl=!this.Yo&&this.fl(e),this.tl)return!1;n=this.pl(e,Ko,!1),!this.Zo||Xo(this.gl().main,e)?this.ml(e,Ko,!0,t):i.storageValue=t,s=!0}return this.Zo&&mo.forEach(t=>{const i=or.Ot(this.hl(t)),r=this.vl(t),o=e||{},l=s&&Jo.some(i=>{var e;return(null===(e=wo(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(mi(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.pl(o,t,!1)||n));const a=Qo(i);n=this.pl(a,t,!1)||n,this.ml(a,t,!0,i)}),n}catch(t){return!1}}dl(t,i){this.Ko.set(t,i);const e=wo(t);(null==e?void 0:e.volatile)||(this.vl((this.Zo?null==e?void 0:e.storageGroup:void 0)||Ko).fingerprint=void 0,this.Sl(t))}xl(){Jo.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{const t=or.Ot(this.rl),i=Qo(t);this.vl(Ko).storageValue=t,Jo.forEach(t=>{var e;const s=this.Zo?null===(e=wo(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?or.Ot(this.hl(s)):null;if(s){const t=this.vl(s);t.storageValue=n,t.persisted=!mi(n)}const r=s&&!mi(n)?Qo(n):i;t in this.props?this.Cl(t,r[t],this.props[t]):t in r&&this.dl(t,!0)})}catch(t){}}bl(t,i){const e=this.Ko.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(di(i)?i:[]),n=new Set(di(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=vi(i)?ls({},i):{},n=vi(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}Cl(t,i,e){if(!Yo(t))return;const s=this.Ko.get(t);if(!0===s)return;let n=i;if(this.Vo)try{var r;const i=this.Zo?null===(r=wo(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.hl(i):this.rl;n=Qo(or.Ot(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!pi(i)&&!di(i)||!pi(n)&&!di(n)||!di(e))return void this.dl(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(!vi(e))return void(Xo(n,e)?this.Ko.delete(t):this.dl(t,!0));{if(!pi(i)&&!vi(i)||pi(i)&&fi(e)&&pi(n))return void this.dl(t,!0);const s=vi(i)?i:{},r=vi(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&Xo(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&Xo(r[t],e[t])&&o.delete(t)})}}o.size?this.dl(t,o):this.Ko.delete(t)}$l(){var t;const i=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return yi(i)&&i>0?i:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const i=cr(t,this.Mr.cookie_persisted_properties||[]),e=fr(i,this.Mr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=nr.Ot(this.rl)||void 0;n&&_r(this.rl,n)===s&&(this.Il=s,this.Ml=n)}catch(t){}else try{const t=nr.Ot(this.rl)||void 0;this.Il=t?_r(this.rl,t):void 0,this.Ml=t}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,i=!1){if(this.pi&&!i||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=nr.Ot(this.rl)||void 0}catch(t){}if(!e||e===this.Ml)return!1;const s=_r(this.rl,e);let r;try{r=dr(JSON.parse(e))}catch(t){return!1}if((nr.Ot(this.rl)||void 0)!==e)return!1;this.Il=s,this.Ml=e;const o=pr(this.rl,e),a=[...ar,...o.properties],u={};if(Object.keys(r).forEach(t=>{const i=r[t];(pi(i)||mi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(u[t]=!0,delete r[t])}),fi(r))return!1;const h="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,d=this.props,c=d[n],v=d[dt],f=jn({},d);[...ar,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!u[t]&&(h||"distinct_id"!==t&&"$user_state"!==t)){const i=f[t];(o.isValid||-1===ar.indexOf(t)||!1!==i&&0!==i)&&delete f[t]}}),this.props=jn(f,r),Jo.forEach(t=>{const i=t in this.props;t in d===i&&Xo(d[t],this.props[t])||(i?this.Cl(t,d[t],this.props[t]):this.dl(t,!0))}),!h||"$user_state"in r||"$user_state"in this.props||this._l(dt,It);const p=this.props[n],_=this.props[dt];return!h||p===c&&_===v||(this.Yo=!0,this.Qo=!0,yr.At(Wo(this.rl),!0),this.wl(W),this.wl(j),this.wl(N),this.wl(B),this.wl(U),this.wl(z),this.wl(ht),this.wl(ut),this.wl(lt),"anonymous"!==_||"identified"!==v&&"anonymous"!==r.$user_state&&(pi(c)||p===c)||(Zo(this.props,r),this.wl(G)),"identified"===_?this.props.$user_id=p:delete this.props.$user_id,this.wl(l)),!0}consumeCookieIdentityChange(){const t=Wo(this.rl),i=this.Qo||!!yr.Ot(t);return this.Qo=!1,i&&yr.Lt(t),i}Pl(t=!1){return!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[Ko],this.Fl(!0))}Ol(t=!0){if(this.Jo)try{t?this.Rl():pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(t){-1===Vo.indexOf(t.persistence.toLowerCase())&&(An.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1)=>{const e=[...ar,...t];return ls(ls({},or),{},{Dt(t){try{let r,o={};try{r=nr.Ot(t)||void 0,o=r?dr(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(or.Ot(t)||"{}");let a;if(i){const i=pr(t,r),u=[...ar,...i.properties],h={};Object.keys(o).forEach(t=>{const i=o[t];mi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});const d="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var s;const t=l[n],r=null!==(s=l.$user_state)&&void 0!==s?s:It;e.forEach(t=>{if(-1!==u.indexOf(t)&&!(t in o)&&(d||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===ar.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!d||"$user_state"in o||"$user_state"in l||(l[dt]=It),!d||("distinct_id"in h?h[n]:l[n])===t&&("$user_state"in h?h[dt]:l[dt])===r||(lr.forEach(t=>delete l[t]),"identified"===h.$user_state&&"distinct_id"in h?l.$user_id=h[n]:delete l.$user_id,"identified"!==h.$user_state&&(delete l[K],delete l[G]),delete l.__alias)}a=jn(l,h)}else a=jn(o,l);return or.At(t,a),a}catch(t){}return null},At(e,s,n,r,o,l){const a=or.At(e,s,void 0,void 0,l);try{const u=cr(s,t);if(Object.keys(u).length){if(i){const i=ur(e),h=fr(u,t);if(nr.At(i,h,n,r,o,l),nr.Ot(i)!==JSON.stringify(h)){nr.Lt(i,r);const t=cr(s);return nr.At(e,t,n,r,o,l),a}}nr.At(e,u,n,r,o,l)}}catch(t){or.Pt(t)}return a},Lt(t,i){try{null==Ut||Ut.localStorage.removeItem(t),nr.Lt(t,i),nr.Lt(ur(t),i)}catch(t){or.Pt(t)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let e,s=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&or.Et()?(e=or,r=!0):"localstorage+cookie"===o&&i.Et()?(e=i,r=!0,s=!0):"sessionstorage"===o&&yr.Et()?e=yr:"memory"===o?e=mr:"cookie"===o&&nr.Et()?(e=nr,s=!0):i.Et()?(e=i,r=!0,s=!0):nr.Et()?(e=nr,s=!0):e=mr,this.Vo=r,this.Go=s,e}hl(t){return`${this.rl}__${t}`}ll(t){return this.Vo&&!!t.split_storage}properties(){const t={};return Nn(this.props,(i,e)=>{const s=wo(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.pi&&!t)return;const i=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),e=i?or.Dt(this.rl):null;let s={};if(i)try{s=dr(nr.Dt(this.rl)),Nn(s,(t,i)=>{(pi(t)||mi(t)||""===t)&&delete s[i]})}catch(t){}const r=this.Fo.Dt(this.rl);if(r&&(this.props=jn({},r)),this.Zo&&this.Dl(),i&&r){var o,l;const t=null==e?void 0:e[n],i=null!==(o=null==e?void 0:e.$user_state)&&void 0!==o?o:It,a=r[n],u=null!==(l=r.$user_state)&&void 0!==l?l:It;if(a!==t||u!==i){this.Qo=!0,yr.At(Wo(this.rl),!0);const e=jn({},this.props);lr.forEach(t=>delete e[t]),"anonymous"!==u||"identified"!==i&&"anonymous"!==s.$user_state&&(pi(t)||a===t)||(Zo(e,s),delete e[G]),this.props=e;const n=new Set;lr.forEach(t=>{var i;const e=null===(i=wo(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{const i={};Nn(this.props,(e,s)=>{var n;(null===(n=wo(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)}),fi(i)?(or.Lt(this.hl(t)),this.Wo[t]={}):or.At(this.hl(t),i)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(i,t)})})}}yr.Ot(Wo(this.rl))&&(this.Qo=!0)}Dl(){for(const t of mo){const i=or.Dt(this.hl(t));if(i&&!fi(i)){const e=this.vl(t);e.persisted=!0,this.Ll(t)||(e.fingerprint=this.yl(i,t)),this.Nl(t,i)||jn(this.props,i)}}}Ll(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=wo(i))||void 0===e?void 0:e.storageGroup)===t})}Nl(t,i){const e=qo[t];if(!e)return!1;const s=i[e],n=this.props[e];return yi(s)&&yi(n)&&n>s}refreshKey(t){var i;if(this.pi)return;if("$fbc_persistence"===t&&this.el)return;const e=this.Zo?null===(i=wo(t))||void 0===i?void 0:i.storageGroup:void 0,s=e?or.Dt(this.hl(e)):this.Fo.Dt(this.rl);if(s&&t in s)this._l(t,s[t],!1);else{if(e){const i=this.Fo.Dt(this.rl);if(i&&t in i)return void this._l(t,i[t],!1)}this.wl(t,!1)}}save(){if(this.pi)return;const t=this.$l();t>0?pi(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}flush(){pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t=!1){if(this.pi||this.Jo&&!t)return;t||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(h));const i=!t&&!this.Xo;i||(this.tl=!1);const e=!!i&&this.kl();if(this.tl)return void(this.Mr.debug&&An.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(e&&this.il.forEach(t=>t()));const s=this.jl(this.Fo,this.rl,this.props,Ko);"written"===s&&this.Tl(this.props),"failed"!==s&&(this.Ko.clear(),this.Yo=!1,this.el=!1),e&&this.il.forEach(t=>t())}ql(){const{main:t,groups:i}=this.gl(),e=this.jl(this.Fo,this.rl,t,Ko);"written"===e&&this.Tl(t),"failed"!==e&&(this.Yo=!1,this.el=!1,Jo.forEach(t=>{var i;(null===(i=wo(t))||void 0===i?void 0:i.storageGroup)||this.Ko.delete(t)}));for(const t of mo){var s;const e=i[t];if(fi(e)&&!(null===(s=this.Wo[t])||void 0===s?void 0:s.persisted)){Jo.forEach(i=>{var e;(null===(e=wo(i))||void 0===e?void 0:e.storageGroup)===t&&this.Ko.delete(i)});continue}const n=this.jl(or,this.hl(t),e,t);"failed"!==n&&Jo.forEach(i=>{const e=wo(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.Ko.delete(i)})}}gl(){const t={},i={flags:{},surveys:{}};return Nn(this.props,(e,s)=>{var n;const r=null===(n=wo(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}yl(t,i){if(i===Ko)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const e={};return Nn(t,(t,i)=>{var s;e[i]=(null===(s=wo(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}jl(t,i,e,s){const n=this.vl(s);if(s!==Ko&&!n.dirty&&!pi(n.fingerprint))return"skipped";let r;try{if(r=this.yl(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(i,e,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,s!==Ko&&(n.persisted=!0),pi(r)||(n.fingerprint=r),this.Vo&&(n.storageValue=or.Ot(i)),"written"):(this.Mr.debug&&An.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.xl(),pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!t&&this.nl)for(const t of mo)or.Lt(this.hl(t));t?delete this.Wo[Ko]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(vi(t)){this.syncCookieProperties(),pi(i)&&(i="None"),this.Bl=pi(e)?this.Ul:e;let s=!1;if(Nn(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this._l(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(vi(t)){this.syncCookieProperties(),this.Bl=pi(i)?this.Ul:i;let e=!1;if(Nn(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||vi(i)||di(i))&&(this._l(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.wl(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==qt?void 0:qt.URL;if(t===this.sl)return;const i=Fo(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),e=!fi(Un(i));return e&&this.register(i),this.sl=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==qt?void 0:qt.referrer;return t?Mo(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Lo(),$referring_domain:(null==qt?void 0:qt.referrer)&&(null===(t=So(qt.referrer))||void 0===t?void 0:t.host)||jo},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Bo(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[_t]:this.Go?{r:Go(t.r),u:t.u?Go(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Nn([pt,ft],i=>{const e=this.props[i];e&&Nn(e,function(i,e){t["$initial_"+oi(e)]=i})});const i=this.props[_t];if(i){const e=function(t,i=!1){const e=Uo(t,i),s={};return Nn(e,function(t,i){s[`$initial_${oi(i)}`]=t}),s}(i,this.Mr.disable_capture_url_hashes);jn(t,e)}return t}safe_merge(t){return Nn(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.pi&&!l;l||this.El(i,a),this.Mr=t,!l&&(s||n||o)&&(this.Il=void 0,this.Ml=void 0,this.El(ls(ls({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.ol(t):this.Fo;this.Wl();const h=this.ll(t),d=r||h!==this.Zo,c=!l&&(d||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(a);this.Xo=d;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){const t=this.props;this.clear(),this.Fo=u,this.Zo=h,this.props=t,this.save()}else o&&(this.Fo=u,l||(delete this.Wo[Ko],this.Fl()))}finally{this.Xo=!1,c&&this.Ol()}}Wl(){const t=this.props[_t];if(!this.Go||!vi(t)||"string"!=typeof t.r)return;const i=Go(t.r),e="string"==typeof t.u?Go(t.u):t.u;i===t.r&&e===t.u||this._l(_t,ls(ls({},t),{},{r:i,u:e}))}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this._l(d,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return pi(e)||(delete i[t],this._l(d,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this._l(t,i),this.save()}_l(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.Yo=!0),"$fbc_persistence"!==t||Xo(n,i)||(this.el=!0),this.Cl(t,n,i),(null===(s=wo(t))||void 0===s?void 0:s.volatile)||this.Sl(t))}wl(t,i=!0){delete this.props[t],i&&(Yo(t)&&this.dl(t,!0),"$fbc_persistence"===t&&(this.el=!0),this.Sl(t))}Sl(t){var i;const e=null===(i=wo(t))||void 0===i?void 0:i.storageGroup;e&&(this.vl(e).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}};const il={GZipJS:"gzip-js",Base64:"base64"},el={Activation:"events",Cancellation:"cancelEvents"},sl={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},nl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},rl={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"},ol={Popover:"popover",Inline:"inline"};function ll(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&ci(e.then)&&e.then(void 0,()=>{})}}}}const al={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"},ul={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"},hl=Mn("[RateLimiter]");var dl=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=>{hl.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void hl.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)}clientRateLimitContext(t=!1){var i,e,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(i=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*r,l.last=o,l.tokens>n&&(l.tokens=n);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=(yi(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gl(t){const i=this.instance.config.property_denylist;return!di(i)||!i.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==Vt?void 0:Vt.pathname))return`${null!==(t=Vt.origin)&&void 0!==t?t:""}${Vt.pathname}`}Vl(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Zl(),o=this.Gl("$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 cl=Mn("[RemoteConfig]");var vl=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=Zt._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ql(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return cl.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void cl.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return cl.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){cl.error("Error loading remote config",t),this.Kl()}}Kl(t,i){!t&&i&&(0===i.statusCode?i.error||cl.warn("Failed to fetch remote config from PostHog."):cl.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){cl.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){cl.error("Error loading feature flags",t)}}},fl=Uint8Array,pl=Uint16Array,_l=Uint32Array,gl=new fl([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]),ml=new fl([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]),bl=new fl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yl=function(t,i){for(var e=new pl(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new _l(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]},wl=yl(gl,2),$l=wl[1];wl[0][28]=258,$l[258]=28;for(var Sl=yl(ml,0)[1],xl=new pl(32768),El=0;32768>El;++El){var kl=(43690&El)>>>1|(21845&El)<<1;xl[El]=((65280&(kl=(61680&(kl=(52428&kl)>>>2|(13107&kl)<<2))>>>4|(3855&kl)<<4))>>>8|(255&kl)<<8)>>>1}var Tl=function(t,i,e){for(var s=t.length,n=0,r=new pl(i);s>n;++n)++r[t[n]-1];var o,l=new pl(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new pl(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],d=l[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)o[xl[d]>>>a]=u}else for(o=new pl(s),n=0;s>n;++n)o[n]=xl[l[t[n]-1]++]>>>15-t[n];return o},Pl=new fl(288);for(El=0;144>El;++El)Pl[El]=8;for(El=144;256>El;++El)Pl[El]=9;for(El=256;280>El;++El)Pl[El]=7;for(El=280;288>El;++El)Pl[El]=8;var Cl=new fl(32);for(El=0;32>El;++El)Cl[El]=5;var Ol=Tl(Pl,9,0),Rl=Tl(Cl,5,0),Il=function(t){return(t/8|0)+(7&t&&1)},Fl=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof pl?pl:t instanceof _l?_l:fl)(e-i);return s.set(t.subarray(i,e)),s},Al=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Ml=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},Dl=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 fl(0),0];if(1==n){var o=new fl(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,d=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[d].f>e[u].f?u++:d++],a=e[u!=h&&e[d].f>e[u].f?u++:d++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var c=r[0].s;for(s=1;n>s;++s)r[s].s>c&&(c=r[s].s);var v=new pl(c+1),f=Nl(e[h-1],v,0);if(f>i){s=0;var p=0,_=f-i,g=1<<_;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+=g-(1<<f-v[m]),v[m]=i}for(p>>>=_;p>0;){var b=r[s].s;i>v[b]?p-=1<<i-v[b]++-1:++s}for(;s>=0&&p;--s){var y=r[s].s;v[y]==i&&(--v[y],++p)}f=i}return[new fl(v),f]},Nl=function(t,i,e){return-1==t.s?Math.max(Nl(t.l,i,e+1),Nl(t.r,i,e+1)):i[t.s]=e},jl=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new pl(++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]},Ll=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},Bl=function(t,i,e){var s=e.length,n=Il(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)},Ul=function(t,i,e,s,n,r,o,l,a,u,h){Al(i,h++,e),++n[256];for(var d=Dl(n,15),c=d[0],v=d[1],f=Dl(r,15),p=f[0],_=f[1],g=jl(c),m=g[0],b=g[1],y=jl(p),w=y[0],S=y[1],x=new pl(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=Dl(x,7),T=k[0],P=k[1],C=19;C>4&&!T[bl[C-1]];--C);var O,R,I,F,A=u+5<<3,M=Ll(n,Pl)+Ll(r,Cl)+o,D=Ll(n,c)+Ll(r,p)+o+14+3*C+Ll(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=A&&D>=A)return Bl(i,h,t.subarray(a,a+u));if(Al(i,h,1+(M>D)),h+=2,M>D){O=Tl(c,v,0),R=c,I=Tl(p,_,0),F=p;var N=Tl(T,P,0);for(Al(i,h,b-257),Al(i,h+5,S-1),Al(i,h+10,C-4),h+=14,E=0;C>E;++E)Al(i,h+3*E,T[bl[E]]);h+=3*C;for(var j=[m,w],L=0;2>L;++L){var B=j[L];for(E=0;B.length>E;++E)Al(i,h,N[U=31&B[E]]),h+=T[U],U>15&&(Al(i,h,B[E]>>>5&127),h+=B[E]>>>12)}}else O=Ol,R=Pl,I=Rl,F=Cl;for(E=0;l>E;++E)if(s[E]>255){var U;Ml(i,h,O[257+(U=s[E]>>>18&31)]),h+=R[U+257],U>7&&(Al(i,h,s[E]>>>23&31),h+=gl[U]);var z=31&s[E];Ml(i,h,I[z]),h+=F[z],z>3&&(Ml(i,h,s[E]>>>5&8191),h+=ml[z])}else Ml(i,h,O[s[E]]),h+=R[s[E]];return Ml(i,h,O[256]),h+R[256]},zl=new _l([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hl=new fl(0),ql=function(){for(var t=new _l(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Vl=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Wl(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=ql[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 fl(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 d=h+65535;o>d?u=Bl(a,u,t.subarray(h,d)):(a[h]=r,u=Bl(a,u,t.subarray(h,o)))}else{for(var c=zl[i-1],v=c>>>13,f=8191&c,p=(1<<e)-1,_=new pl(32768),g=new pl(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new _l(25e3),S=new pl(288),x=new pl(32),E=0,k=0,T=(h=0,0),P=0,C=0;o>h;++h){var O=y(h),R=32767&h,I=g[O];if(_[R]=I,g[O]=R,h>=P){var F=o-h;if((E>7e3||T>24576)&&F>423){u=Ul(t,a,0,w,S,x,k,T,C,h-C,u),T=E=k=0,C=h;for(var A=0;286>A;++A)S[A]=0;for(A=0;30>A;++A)x[A]=0}var M=2,D=0,N=f,j=R-I&32767;if(F>2&&O==y(h-j))for(var L=Math.min(v,F)-1,B=Math.min(32767,h),U=Math.min(258,F);B>=j&&--N&&R!=I;){if(t[h+M]==t[h+M-j]){for(var z=0;U>z&&t[h+z]==t[h+z-j];++z);if(z>M){if(M=z,D=j,z>L)break;var H=Math.min(j,z-2),q=0;for(A=0;H>A;++A){var V=h-j+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,I=V)}}}j+=(R=I)-(I=_[R])+32768&32767}if(D){w[T++]=268435456|$l[M]<<18|Sl[D];var G=31&$l[M],K=31&Sl[D];k+=gl[G]+ml[K],++S[257+G],++x[K],P=h+M,++E}else w[T++]=t[h],++S[t[h]]}}u=Ul(t,a,r,w,S,x,k,T,C,h-C,u),r||(u=Bl(a,u,Hl))}return Fl(l,0,s+Il(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)),d=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&&Vl(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),Vl(h,d-8,e.d()),Vl(h,d-4,s),h}const Gl=!!Gt||!!Wt,Kl=new WeakMap,Jl="text/plain";let Yl=!1;const Xl=(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}`:""}`},Ql=(t,i,e=!0)=>{var s;const[n,r]=t.split("?"),o=ls({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],a=function(t,i="&"){let e,s;const n=[];return Nn(t,function(t,i){pi(t)||pi(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)}(o);return a&&l.push(a),l.length>0?`${n}?${l.join("&")}`:n},Zl=t=>{if(t.Yl)return t.Yl;const{data:i,compression:e}=t;if(!i)return;if(e===il.GZipJS){const t=Wl(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new fl(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 fl(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 Fl(e,0,s)}($o(i)),{mtime:0});return{contentType:Jl,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===il.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}($o(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:$o(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=$o(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},ta=t=>{const i=()=>"sendBeacon"===t.transport?{url:Ql(t.url,{compression:il.Base64}),encodedBody:Zl(ls(ls({},t),{},{compression:il.Base64,Yl:void 0}))}:{url:Xl(t.url,"compression"),encodedBody:Zl(ls(ls({},t),{},{compression:void 0,Yl:void 0}))};let e;try{e=Zl(t)}catch(e){if(Zs(t.compression,xo(t.url,"compression")))return An.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&Zs(t.compression,xo(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?Qs(new Uint8Array(s)):ArrayBuffer.isView(s)&&Qs(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Yl=!0,i()):{url:t.url,encodedBody:e};var s},ia=t=>{try{return ta(t)}catch(e){var i;return An.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},ea=function(){var t=Ai(function*(t){const i=yield function(t){return on.apply(this,arguments)}($o(t.data),e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return ls(ls({},t),{},{Yl:{contentType:Jl,body:s,estimatedSize:s.byteLength}})});return function(i){return t.apply(this,arguments)}}(),sa=/Failed to fetch|NetworkError|Load failed/i,na=t=>"TypeError"===(null==t?void 0:t.name)&&sa.test((null==t?void 0:t.message)||""),ra=t=>{const i=ia(t);if(!i)return;const e=new Gt;Kl.set(e,!0);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,!0);const{contentType:r,body:o}=null!=n?n:{};Nn(t.headers,function(t,i){e.setRequestHeader(i,t)}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i;const s={statusCode:e.status,text:e.responseText};if(200===e.status)try{s.json=JSON.parse(e.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,s)}},e.send(o)},oa=t=>{const i=ia(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},l=new Headers;Nn(t.headers,function(t,i){l.append(i,t)}),n&&l.append("Content-Type",n);let a=null,u=!1;if(Kt){const i=new Kt;a={signal:i.signal,timeout:setTimeout(()=>{var e;u=!0,i.abort(Ke("AbortError","PostHog request timed out"+((e=t.timeout)?` after ${e}ms`:"")))},t.timeout)}}const h=i=>{var e;u&&"AbortError"===(null==i?void 0:i.name)||na(i)?An.warn(i):An.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i})};try{Wt(e,ls({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&!t.ta&&52428.8>(o||0),body:r,signal:null==a?void 0:a.signal},t.fetchOptions)).then(i=>i.text().then(e=>{var s;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){An.error(t)}null===(s=t.callback)||void 0===s||s.call(t,n)})).catch(h).finally(()=>a?clearTimeout(a.timeout):null)}catch(t){a&&clearTimeout(a.timeout),h(t)}},la=t=>{try{var i;const{url:e,encodedBody:s}=ta(t),{contentType:n,body:r,estimatedSize:o}=null!=s?s:{};if(!r)return;const l=r instanceof Blob?r:new Blob([r],{type:n});if(Ht.sendBeacon(e,l))return;const a=di(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(di(a)&&a.length>1&&(null!=o?o:0)>16384){const i=Math.ceil(a.length/2),e=i=>di(t.data)?i:ls(ls({},t.data),{},{batch:i});return la(ls(ls({},t),{},{data:e(a.slice(0,i))})),void la(ls(ls({},t),{},{data:e(a.slice(i))}))}An.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${Wt?"fetch":"XHR"}`),Wt?oa(ls(ls({},t),{},{ta:!0})):ra(t)}catch(t){An.warn("Beacon send failed",t)}},aa=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return Ql(e===il.GZipJS?Xl(t,"compression"):t,ls(ls({},n?{[n]:Date.now().toString()}:{}),e===il.GZipJS?{}:{compression:e}))},ua=(()=>{const t=[];return Wt&&t.push({transport:"fetch",method:oa}),Gt&&t.push({transport:"XHR",method:ra}),(null==Ht?void 0:Ht.sendBeacon)&&t.push({transport:"sendBeacon",method:la}),t})();var ha=class{constructor(t,i){this.ea=!0,this.ia=[],this.na=Ni((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,An.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();const t=this.ia.length>0?this.aa():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(ls(ls({},t),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const t=this.aa();for(const i in t)this.ua(t[i])}},this.na))}ua(t){try{this.sa(t)}catch(t){An.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const t={};return Nn(this.ia,i=>{var e;const s=i,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");pi(t[n])&&(t[n]=ls(ls({},s),{},{data:[]})),null===(e=t[n].data)||void 0===e||e.push(s.data)}),this.ia=[],t}};const da=["retriesPerformedSoFar"];var ca=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!pi(Ut)&&"onLine"in Ut.navigator){if(this.da=Ut.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},Vn(Ut,"online",this.va),Vn(Ut,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t){let{retriesPerformedSoFar:i}=t,e=un(t,da);wi(i)&&(e.url=Ql(e.url,{retry_count:i})),this._instance._send_request(ls(ls({},e),{},{callback:t=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(ls({retriesPerformedSoFar:i},e));0===t.statusCode&&An.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null===(s=e.callback)||void 0===s||s.call(e,t)}}))}Ls(t){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const e=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)}(i),s=Date.now()+e;this.ia.push({retryAt:s,requestOptions:t});let n=`Enqueued failed request for retry in ${e}`;navigator.onLine||(n+=" (Browser is offline)"),An.warn(n),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const t=Date.now(),i=[],e=this.ia.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.ia=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,pi(Ut)||(this.va&&(Ut.removeEventListener("online",this.va),this.va=void 0),this.pa&&(Ut.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:t}of this.ia)try{this._instance._send_request(ls(ls({},t),{},{transport:"sendBeacon"}))}catch(t){An.error(t)}this.ia=[]}},va=class{constructor(t){this._instance=t,this.ya=()=>{var t,i,e,s;this.ba||(this.ba={});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.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(i=this.ba.maxScrollHeight)&&void 0!==i?i:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,null!==(e=this.ba.maxContentY)&&void 0!==e?e:0),this.ba.maxContentHeight=Math.max(a,null!==(s=this.ba.maxContentHeight)&&void 0!==s?s:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){Vn(Ut,"scroll",this.ya,{capture:!0}),Vn(Ut,"scrollend",this.ya,{capture:!0}),Vn(Ut,"resize",this.ya)}scrollElement(){if(this._a){const i=di(this._a)?this._a:[this._a];for(const e of i){var t;const i=null==Ut||null===(t=Ut.document)||void 0===t?void 0:t.querySelector(e);if(i)return i}return}var i;return null==Ut||null===(i=Ut.document)||void 0===i?void 0:i.documentElement}wa(t){var i,e;const s="y"===t?"scrollTop":"scrollLeft";if(this._a){const t=this.scrollElement();return t&&t[s]||0}return Ut?"y"===t?Ut.scrollY||Ut.pageYOffset||(null===(i=Ut.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:Ut.scrollX||Ut.pageXOffset||(null===(e=Ut.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const fa=t=>Bo(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 pa=class{constructor(t,i,e,s){this.je=t=>{const i=this.ka();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[ct]:e})},this._instance=t,this.Ca=i,this.xa=e,this.Sa=s||fa,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[ct]}getSetOnceProps(){var t;const i=null===(t=this.ka())||void 0===t?void 0:t.props;return i?"r"in i?Uo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){const t={};return Nn(Un(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${oi(e)}`]=i}),t}},_a=class{on(t,i){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(i),()=>{this.$a[t]=this.$a[t].filter(t=>t!==i)}}emit(t,i){for(const e of this.$a[t]||[])e(i);for(const e of this.$a["*"]||[])e(t,i)}constructor(){this.$a={}}};const ga=Mn("[SessionId]"),ma=864e5;var ba=class{on(t,i){return this.Ta.on(t,i)}constructor(t,i,e){var s;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new _a,this.Aa=(t,i)=>!(!wi(t)||!wi(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.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=i||Zn,this.Da=e||Zn;const n=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ni(this.Mr.session_idle_timeout_seconds||1800,60,36e3,ga.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+n+"_window_id",this.qa="ph_"+n+"_primary_window_exists",this.ja()){const t=yr.Dt(this.Na),i=yr.Dt(this.qa);t&&!i?this.Be=t:yr.Lt(this.Na),yr.At(this.qa,!0)}(null===(s=this.Mr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return pi(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(i=>i!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&yr.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&yr.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?yr.Dt(this.Na):null}Ua(t){const i=this.Ia;return!mi(i)&&!mi(t)&&5e3>Math.abs(t-i)}Wa(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.Ua(i)||(this.Ia=i,this.xa.register({[O]:[i,t,e]}))}Va(){var t;const i=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return wi(i)&&i>0}Ga(){this.Va()?this.xa.refreshKey(O):(this.xa.flush(),this.xa.load())}Za(){var t;if(mi(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,i,e]=this.Qa();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[O]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[t]=this.Qa(),i=wi(t)?t:0,e=wi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){const t=this.xa.props[O];return di(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(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 ga.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void ga.error("Invalid sessionID in bootstrap",t)}})(t);return!pi(e)&&(i?this.Fa={sessionId:t,sessionStartTimestamp:e}:this.Wa(t,(new Date).getTime(),e),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&Ut&&(Ut.removeEventListener(Dt,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&yr.Lt(this.qa)},Vn(Ut,Dt,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Mr.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.Ma=s;else if(mi(this.Ma)||this.Ma>s||s-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=s}let[,l,a]=this.Qa();const u=!pi(n)&&l!==n,h=this.Ja();let d=this.za();const c=this.Fa,v=!!c&&(c.sessionStartTimestamp>s+6e4||s-c.sessionStartTimestamp>ma),f=c?v:wi(a)&&Math.abs(s-a)>ma;let p=!1,_=u;const g=!l||!!c,m=l;let b=!g&&!t&&this.Aa(s,h);if(b&&(b=this.Ka(s),b||ga.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qa()),g||b||f){_=!1;const t=c&&!v;l=t?c.sessionId:this.Oa(),d=this.Da(),ga.info("new session ID assigned",{sessionId:l,windowId:d,bootstrapped:!!t,changeReason:{noSessionId:g,activityTimeout:b,sessionPastMaximumLength:f}}),a=t?c.sessionStartTimestamp:s,this.Fa=void 0,p=!0}else d||(d=this.Da(),p=!0),_=_||l!==m,_&&(ga.info("adopted cross-tab session id",{sessionId:l,windowId:d}),p=!0);const y=wi(h)&&t&&!f?h:s,w=wi(a)?a:(new Date).getTime();this.Ha(d),this.Wa(l,y,w),t||this.La();const S={noSessionId:g,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:_};return p&&this.Ea.forEach(t=>t(l,d,S)),{sessionId:l,windowId:d,sessionStartTimestamp:w,changeReason:p?S:void 0,lastActivityTimestamp:h}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};const ya=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&Di(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>Di(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function wa(){return(wa=Ai(function*(){const t=null==Ht?void 0:Ht.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return _i(e)&&e.length>0?e:void 0}catch(t){return void An.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function $a(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 Sa(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 xa=(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}},Ea=t=>t.toLowerCase(),ka={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=>xa(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!xa(i,t))),icontains:(t,i)=>i.map(Ea).some(i=>t.map(Ea).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Ea).every(i=>t.map(Ea).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 Ta(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=ka[e.operator];return!!n&&n(e.values,[String(s)])})}function Pa(t,i,e){return $o({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Ca="custom",Oa="i.posthog.com",Ra=/^\/static\//,Ia=["/s/","/e/","/i/"];var Fa=class{constructor(t){this.Ya={},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(`.${Oa}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Ya[this.apiHost]||(this.Ya[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":Ca),this.Ya[this.apiHost]}tu(t){if(!Ra.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}eu(t){const i=So(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}iu(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=So(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&Ia.some(t=>0===i.indexOf(t))){const t=this.eu(s);if(t){const i=this.apiHost;let e=this.nu;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.nu=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.nu,e=this.eu(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.iu(t,i,this.uiHost+i);if("flags"===t)return this.iu(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.tu(i);if(e)return this.iu(t,i,`${e}${i}`)}if(this.region===Ca)return this.iu(t,i,this.apiHost+i);const e=Oa+i;switch(t){case"assets":return this.iu(t,i,`https://${this.region}-assets.${e}`);case"api":return this.iu(t,i,`https://${this.region}.${e}`)}}};const Aa=Mn("[Surveys]"),Ma=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){Aa.error("Failed to persist survey seen state",t)}},Da=[sl.Popover,sl.Widget,sl.API],Na={ignoreConditions:!1,ignoreDelay:!1,displayType:ol.Popover},ja=Mn("[PostHog ExternalIntegrations]"),La={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Ba=class{constructor(t){this._instance=t}No(t,i){var e,s;null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return ja.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=Zt.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.No(La[n],()=>{var t;null===(t=Zt.__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=Zt.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=Zt.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},Ua=class{constructor(t,i){this.$=t,this.po=i,this.su=new Map,this.So=!1}add(t){var i=this;return Ai(function*(){if(i.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.su.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);i.su.set(t.name,t);try{const e=t.setup(i.po);e&&(yield e)}catch(e){const s=i.su.get(t.name)===t;s&&i.su.delete(t.name),i.$.error(`Failed to set up browser extension "${t.name}"`,e),s&&i.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(this.So)return;this.So=!0;const t=Array.from(this.su.values()).reverse();this.su.clear();for(const i of t)this.ru(i)}ru(t){try{var i;const e=null===(i=t.dispose)||void 0===i?void 0:i.call(t);e&&ci(e.then)&&e.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,i)})}catch(i){this.$.error(`Failed to dispose browser extension "${t.name}"`,i)}}},za=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);pi(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)}};const Ha="extensionsRemoteConfig";var qa=class{constructor(t){this.instance=t,this.So=!1,this.$=An,this.ou=t.lu,this.kv=new za(t),this.onEvent=t=>ll(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return ll(()=>{});const i=i=>{try{t(i)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},e=this.instance.au.on(Ha,i);return this.ou&&i(this.ou),ll(e)},this.uu=new Ua(An.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}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(r);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;const n=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==n?void 0:n.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==n?void 0:n.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,i,e){var s=this;return Ai(function*(){e?s.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):s.instance.capture(t,i)})()}registerDynamicEventProperties(t){return ll(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(Ha,t))}sendRequest(t){var i=this;return Ai(function*(t,e={}){var s;const n=i.instance.requestRouter.endpointFor(null!==(s=e.target)&&void 0!==s?s:"api",t),r={method:e.method,url:e.query?Ql(n,e.query):n,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?ii.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,i.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const Va={};let Wa=0;const Ga=()=>{},Ka='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ja="Surveys module not available",Ya="sanitize_properties is deprecated. Use before_send instead",Xa="Invalid value for property_denylist config: ",Qa=/^[A-Za-z0-9_-]{1,400}$/,Za=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,tu=["token","distinct_id",bt],iu="posthog";let eu=!Gl&&-1===(null==Yt?void 0:Yt.indexOf("MSIE"))&&-1===(null==Yt?void 0:Yt.indexOf("Mozilla"));const su=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},nu=t=>{var i;return ls({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:qn(null==qt?void 0:qt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ga,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Vt&&_i(null==Vt?void 0:Vt.search)&&-1!==Vt.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==Ut||null===(i=Ut.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,surveys_request_timeout_ms:1e4,on_request_error(t){An.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:At,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Ga},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Br,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:su(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))},ru=[["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"]],ou=t=>{const i={};for(const[e,s]of ru)pi(t[e])||(i[s]=t[e]);const e=jn({},i,t),s=t.__preview_external_dependency_versioned_paths;return pi(s)||(pi(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),_i(s)&&pi(t.asset_host)&&(e.asset_host=s)),di(t.property_blacklist)&&(pi(t.property_denylist)?e.property_denylist=t.property_blacklist:di(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:An.error(Xa+t.property_denylist)),e};var lu=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){An.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},au=class t{du(t){if(!t)return;const i=this.su.indexOf(t);-1!==i&&this.su.splice(i,1)}vu(t,i){var e;return this.du(t),this.su.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mu)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.gu=!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}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Zn());this.register({distinct_id:i,$device_id:i}),t.set_property(dt,It)}this._u()}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.wu=!1,this.ku=!1,this.webPerformance=new lu,this.Su=!1,this.version=e.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new _a,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=nu(),this.SentryIntegration=_o,this.sentryIntegration=t=>function(t,i){const e=po(t,i);return{name:fo,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new va(this),this.pageViewManager=new go(this),this.rateLimiter=new dl(this),this.requestRouter=new Fa(this),this.consent=new wr(this),this.externalIntegrations=new Ba(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=_i(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=_i(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>An.info(`send "${null==t?void 0:t.event}"`,t))}init(i,e,s){if(s&&s!==iu){var n;const r=null!==(n=Va[s])&&void 0!==n?n:new t;return r._init(i,e,s),Va[s]=r,Va[iu][s]=r,r}return this._init(i,e,s)}_init(t,i={},s){var n,r,l;const a=_i(t)?t.trim():"";if(!a)return An.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=nu(i.defaults),i.debug=this.Pu(i.debug),this.Ru=i,this.Au=[],i.person_profiles?this.Mu=i.person_profiles:i.process_person&&(this.Mu=i.process_person);const h=nu(i.defaults),d=ou(i),c=jn({},h,d,{name:s,token:a});vi(h.rageclick)&&vi(d.rageclick)&&(c.rageclick=jn({},h.rageclick,d.rageclick)),vi(h.session_recording)&&vi(d.session_recording)&&(c.session_recording=jn({},h.session_recording,d.session_recording)),this.set_config(c),this.config.on_xhr_error&&An.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:il.GZipJS;const v=this.bu();if(this.persistence=new tl(this.config,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tl(ls(ls({},this.config),{},{persistence:"sessionStorage"}),v,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!v&&yr.Et()){const t=yr.Dt(this.Cu);di(t)&&t.forEach(t=>{_i(t)&&this.xu.add(t)})}else yr.Lt(this.Cu);const f=ls({},this.persistence.props),p=ls({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new ha(t=>this.Ou(t),this.config.request_queue_config),this.Du=new ca(this),this.__request_queue=[];const _=this.fu();_||(this.sessionManager=new ba(this),this.sessionPropsManager=new pa(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.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(An.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(_)},0)):(An.info("Initializing extensions synchronously"),this.qu(_)),e.DEBUG=e.DEBUG||this.config.debug,e.DEBUG&&An.info("Starting in debug mode",{this:this,config:i,thisC:ls({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=ls(ls({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const g=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mu=!!g&&!gi(g),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(dt);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===s)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===s)An.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(Zn()),s=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(dt,i.bootstrap.isIdentifiedID?Ft:It),this.register({distinct_id:t,$device_id:s})}}if(_)this.register_once({distinct_id:mt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Zn());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(dt,It)}return Vn(Ut,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Vn(Ut,"pageshow",()=>{var t;this.wu=!1,this.ku||null===(t=this.Du)||void 0===t||t.resume()}),i.segment?vo(this,()=>this.ju()):this.ju(),ci(this.config._onCapture)&&this.config._onCapture!==Ga&&(An.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&An.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return wa.apply(this,arguments)}().then(t=>{t&&this.register({[o]:t})}).catch(Ga),this}Bu(t){const i=t;return _i(i.name)&&ci(i.setup)}Hu(t,i){this.Bu(t)?i.push(()=>{this.zu().add(t).catch(()=>{var i;return null===(i=t.dispose)||void 0===i?void 0:i.call(t)}).catch(i=>{An.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.su.push(t)}Nu(){var i,e,s;const n=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 r,o,l;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new n(this)),ci(this.featureFlags.onReloading)&&ci(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}qu(i){const e=performance.now(),s=ls(ls({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,d;s.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.su.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.su.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.su.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!i&&this.su.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Hu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Hu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.su.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.su.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.su.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.su.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.su.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,uo)),s.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.su.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this.su.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Wu){const t=this.Wu;this.Wu=void 0,this.su.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Vu(n,e)}Vu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,i)},0);const e=t.shift();if(e)try{e()}catch(t){An.error("Error initializing extension:",t)}}const e=Math.round(performance.now()-i);this.register_for_session({[yt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[wt]:e}),this.config.__preview_deferred_init_extensions&&An.info(`PostHog extensions initialized (${e}ms)`)}Kl(t){var i;if(!qt||!qt.body)return An.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var e;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ni(i.supportedCompression,il.GZipJS)?il.GZipJS:ni(i.supportedCompression,il.Base64)?il.Base64:void 0),(null===(e=i.analytics)||void 0===e?void 0:e.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:At}),null===(i=this.Gu)||void 0===i||i.handleRemoteConfig(t),this.su.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}ju(){try{this.config.loaded(this)}catch(t){An.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==Vt?void 0:Vt.hostname)){const t=Vt.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.fu())&&this.Qu()},1),this.Ju=new vl(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Fu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Dn(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,i,e,s,n,r;this.wu=!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.Ku()&&this.capture(jt),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Fu)||void 0===n||n.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(jt,null,{transport:"sendBeacon"})}_send_request(t){var i,e,s;this.__loaded?eu?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=ls(ls({},this.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(pi(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,s;const n=ls({},t);n.timeout=n.timeout||6e4;const r=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===r&&pi(n.compression)&&n.data&&(n.compression=il.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data=(t=>{var i,e;const s=(di(t)?t:[t]).map(t=>ls(ls({},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()}})(n.data):"body"===n.timestampMode&&(n.data=((t,i=(new Date).toISOString())=>di(t)?t.map(t=>ls(ls({},t),{},{sent_at:i})):ls(ls({},t),{},{sent_at:i}))(n.data))),n.url=aa(n.url,n.method,n.compression,n.timestampMode);const o=ua.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),l=null!==(e=null===(s=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(o,t=>t.transport===r))||void 0===s?void 0:s.method)&&void 0!==e?e:o[0].method;if(!l)throw new Error("No available transport method");const a=t=>{try{l(t)}catch(t){var i;na(t)?An.warn(t):An.error(t),null===(i=n.callback)||void 0===i||i.call(n,{statusCode:0,error:t})}};"sendBeacon"!==r&&n.data&&n.compression===il.GZipJS&&Jt&&"undefined"!=typeof Promise&&!Yl?ea(n).then(t=>{a(t)}).catch(i=>{if(tn(i))return Yl=!0,void a(ls(ls({},n),{},{compression:void 0,url:aa(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 tn(t)||i===Xs})(i)&&(Yl=!0),a(n)}):l(n)})(ls(ls({},t),{},{callback:i=>{var e,s,n;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null===(s=(n=this.config).on_request_error)||void 0===s||s.call(n,i),null===(e=t.callback)||void 0===e||e.call(t,i)}}))):t.fireCallbackOnDrop&&(null===(s=t.callback)||void 0===s||s.call(t,{statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){Wa++;try{let i;const e=[],s=[],n=[];Dn(t,t=>{if(t)if(i=t[0],di(i))n.push(t);else if(ci(t))try{t.call(this)}catch(i){An.error("Error executing queued PostHog call",t,i)}else di(t)&&"alias"===i?e.push(t):di(t)&&-1!==i.indexOf("capture")&&ci(this[i])?n.push(t):s.push(t)});const r=function(t,i){Dn(t,function(t){try{if(di(t[0])){let e=i;Nn(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){An.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{Wa--}}push(i){if(Wa>0&&di(i)&&_i(i[0])){const e=t.prototype[i[0]];return void(ci(e)&&e.apply(this,i.slice(1)))}this._execute_array([i])}Xu(){var t;const i=null===(t=this.persistence)||void 0===t?void 0:t.get_property(h);return _i(i)&&Za.test(i)?{value:i,delivered:!1}:vi(i)&&_i(i.value)&&Za.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Yu(t,i,e,s){if(!this.persistence)return;this.persistence.refreshKey(h);const n=this.Xu();if(!s){if(e)return _i(i)&&Za.test(i)?(i!==(null==n?void 0:n.value)&&this.persistence.register({[h]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==n?void 0:n.value)||!n.delivered}):void this.persistence.unregister(h);if(_i(t)&&Qa.test(t)){if((null==n?void 0:n.value.split(".")[3])===t)return{value:n.value,pending:!n.delivered};const i=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[h]:{value:i,delivered:!1}}),{value:i,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(h)}th(t){if(!this.persistence)return;this.persistence.refreshKey(h);const i=this.Xu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[h]:{value:t,delivered:!0}})}capture(t,i,e){var s,n,r,o,l,a;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void An.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(pi(t)||!_i(t))return void An.error("No event name provided to posthog.capture");this.yu();const h=!this.config.opt_out_useragent_filter&&this._is_bot();if(h&&!this.config.__preview_capture_bot_pageviews)return;const d=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==d?void 0:d.isRateLimited)return void An.critical("This capture call is ignored due to client rate limiting.");let c;(null==i?void 0:i.$current_url)&&!_i(null==i?void 0:i.$current_url)&&(An.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.eh)||An.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=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 v=new Date,f=(null==e?void 0:e.timestamp)||v,p=Ge(null==e?void 0:e.uuid,Zn);let _={uuid:p,event:t,properties:this.calculateEventProperties(t,i||{},f,p)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&h&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),d&&(_.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);const g="$feature_flag_called"===t&&!1===_.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!g&&(_.$set=null==e?void 0:e.$set);const m=vi(null==i?void 0:i.$set)?i.$set:void 0,b=!!(null==e?void 0:e.$set)&&"$fbc"in e.$set,y=b||!!m&&"$fbc"in m,w=b?null==e||null===(s=e.$set)||void 0===s?void 0:s[u]:null==m?void 0:m[u],S=di(null==i?void 0:i.$unset)?i.$unset:[],x=(null==e?void 0:e.$unset)||[],E=-1!==S.indexOf("$fbc")||-1!==x.indexOf("$fbc"),k=this.Yu(null==c?void 0:c.fbclid,w,y,E);k&&!0===_.properties.$process_person_profile&&k.pending&&!y&&!g&&(_.$set=ls({[u]:k.value},_.$set));const T=null==e?void 0:e.$unset;T&&(_.$unset=T);const P=g?void 0:this.ih(null==e?void 0:e.$set_once,t!==Bt,t===Lt);if(P&&(_.$set_once=P),(null==e?void 0:e._noTruncate)||(C=this.config.properties_string_max_length,_=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),di(s))r=[],Dn(s,i=>{r.push(t(i))});else{const i={};Nn(Ti(s)?zn(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(_,t=>_i(t)?t.slice(0,C):t)),_.timestamp=f,pi(null==e?void 0:e.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),g&&(_.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return Ys.forEach(s),i.forEach(s),e})(_.properties,tu)),t===nl.DISMISSED||t===nl.SENT){const e=null==i?void 0:i[rl.SURVEY_ID],s=null==i?void 0:i[rl.SURVEY_ITERATION];Ma({id:e,current_iteration:s}),_.$set=ls(ls({},_.$set),{},{[$a({id:e,current_iteration:s},t===nl.SENT?"responded":"dismissed")]:!0})}else t===nl.SHOWN&&(_.$set=ls(ls({},_.$set),{},{[rl.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var C;if(t===al.SHOWN){const t=null==i?void 0:i[ul.TOUR_TYPE];t&&(_.$set=ls(ls({},_.$set),{},{[`${ul.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const O=ls(ls({},_.properties.$set),_.$set);if(fi(O)||this.setPersonPropertiesForFlags(O),!bi(this.config.before_send)){const t=this.Os(_);if(!t)return;_=t,_.uuid=Ge(_.uuid,Zn)}const R=null!==(n=null===(r=_.$set)||void 0===r?void 0:r.$fbc)&&void 0!==n?n:vi(null===(o=_.properties)||void 0===o?void 0:o.$set)?_.properties.$set[u]:void 0,I=(null==k?void 0:k.pending)&&R===k.value?k.value:void 0;this.au.emit("eventCaptured",_);const F=null!==(l=null==e?void 0:e._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(F),M=ls(ls(ls({method:"POST",url:F,data:_,compression:"best-available",timestampMode:A?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},A&&(null===(a=_.properties)||void 0===a?void 0:a.$session_id)?{batchGroup:_.properties.$session_id}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),I?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.th(I)}}:{});var D;return!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)||I?(!M.transport&&!M.callback&&fi(null!==(D=this.config.request_headers)&&void 0!==D?D:{})&&this.wu&&(M.transport="sendBeacon"),this.Ou(M)):this.Fu.enqueue(M),_}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.Gu)||void 0===i?void 0:i.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new qa(this)}hu(t){this.$u.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.$u.indexOf(t);-1!==e&&this.$u.splice(e,1)}}nh(t=!0){var i,e,s;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.xu.clear(),this.sh()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.nh();const o=r?void 0:this.persistence.remove_event_timer(t);let l=ls({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.fu()&&(l[bt]=!0),"$snapshot"===t){const t=ls(ls({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=t.distinct_id,(!_i(l.distinct_id)&&!yi(l.distinct_id)||gi(l.distinct_id))&&An.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}const a=function(t,e,s,n=!1){var r,o,l,a;if(!Yt)return{};const u=t?[...Co,...e||[]]:[],[h,d]=Ne(Yt),[c,v]=function(t){for(let i=0;Ue.length>i;i++){const[e,s,n]=Ue[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(Yt),f=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),p={};pi(s)||(p.detectGoogleSearchApp=s);const _={},g=null===(r=navigator)||void 0===r||null===(r=r.userAgentData)||void 0===r?void 0:r.platform,m=null===(o=navigator)||void 0===o?void 0:o.maxTouchPoints,b=null==Ut||null===(l=Ut.screen)||void 0===l?void 0:l.width,y=null==Ut||null===(a=Ut.screen)||void 0===a?void 0:a.height,w=null==Ut?void 0:Ut.devicePixelRatio;pi(g)||(_.userAgentDataPlatform=g),pi(m)||(_.maxTouchPoints=m),pi(b)||(_.screenWidth=b),pi(y)||(_.screenHeight=y),pi(w)||(_.devicePixelRatio=w);const S=jn(Un({$os:h,$os_version:d,$browser:Fe(Yt,navigator.vendor,f,p),$webview_app:c,$webview_app_version:v,$device:je(Yt),$device_type:Le(Yt,_),$timezone:zo(),$timezone_offset:Ho()}),{$current_url:Eo(n?Je(null==Vt?void 0:Vt.href):null==Vt?void 0:Vt.href,u,Ro),$host:null==Vt?void 0:Vt.host,$pathname:null==Vt?void 0:Vt.pathname,$raw_user_agent:Yt.length>1e3?Yt.substring(0,997)+"...":Yt,$browser_version:Me(Yt,navigator.vendor,f,p),$browser_language:Do(),$browser_language_prefix:No(),$screen_height:null==Ut?void 0:Ut.screen.height,$screen_width:null==Ut?void 0:Ut.screen.width,$viewport_height:null==Ut?void 0:Ut.innerHeight,$viewport_width:null==Ut?void 0:Ut.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&&(S.$sdk_dist_channel=i.SDK_DIST_CHANNEL),S}(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(r,s.getTime(),!0);l.$session_id=t,l.$window_id=i}this.sessionPropsManager&&jn(l,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&jn(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null===(u=this.Du)||void 0===u?void 0:u.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}let h;if(this.requestRouter.region===Ca&&(l.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||r?"$pageleave"!==t||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=jn(l,h),"$pageview"===t&&qt&&(l.title=qt.title),!pi(o)){const t=s.getTime()-o;l.$duration=parseFloat((t/1e3).toFixed(3))}Yt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");const d=this.persistence.properties(),c=this.sessionPersistence.properties(),v=l.$groups,f=d.$groups;vi(v)&&!fi(v)&&(l.$groups=ls(ls({},vi(f)?f:{}),v)),Nn(["$referrer","$referring_domain"],t=>{t in d&&delete c[t]});const p={};if(this.$u.length>0)for(const t of this.$u.slice())try{jn(p,t())}catch(t){An.error("Failed to produce browser extension event properties",t)}l=jn({},a,d,c,ls(ls({},p),l)),l.$is_identified=this._isIdentified(),di(this.config.property_denylist)?Nn(this.config.property_denylist,function(t){delete l[t]}):An.error(Xa+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(An.error(Ya),l=_(l,t));const g=this.rh();return l.$process_person_profile=g,g&&!r&&this.oh("_calculate_event_properties"),l}ih(t,i=!0,e=!1){var s;if(!this.persistence||!this.rh())return t;if(this.Su&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=jn({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(An.error(Ya),o=l(o,"$set_once")),i&&(this.Su=!0),fi(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.nh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.sh()}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.xu.delete(t),this.sh()}ah(t,i){this.register({[t]:i})}Lu(){this.xu.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!yr.Et())return void yr.Lt(this.Cu);const i=[];this.xu.forEach(t=>i.push(t)),i.length>0?yr.At(this.Cu,i):yr.Lt(this.Cu)}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.au.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:Ja}),()=>{})}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:Ja})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ja})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=Na){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:Ja}}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:Ja})}uh(t){return!t||gi(t)?(An.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(An.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())||(An.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 An.uninitializedWarning("posthog.identify");if(yi(t)&&(t=t.toString(),An.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t))return;if(!this.oh("posthog.identify"))return;this.yu();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.nh(!1),o=this.persistence.Pl();let a=!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(l),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===It,h=t!==s,d=!h&&o;if(h&&o){var u;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(dt,Ft),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(Lt,n,{$set:i||{},$set_once:e||{}}),this.Eu=Pa(t,i,e),null===(u=this.featureFlags)||void 0===u||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(d){this.persistence.set_property(dt,Ft);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:s,$set_once:n}),this.Eu=Pa(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);h||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(lt)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.oh("posthog.setPersonProperties"))return;const e=Pa(this.get_distinct_id(),t,i);this.Eu!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Eu=e):An.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(di(t)?t:[t]).filter(t=>_i(t)&&t.length>0);0!==e.length&&this.oh("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Eu=null)}group(t,i,e){var s;if(!t||!i)return void An.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.nh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ls(ls({},n),{},{[t]:i})}),(r||e)&&this.rh()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Bt,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.oh("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=$i(t)?t:null==t?void 0:t.resetDeviceID,e=$i(t)||null==t?void 0:t.bootstrap;this.hh(i,!1,e)}hh(t,i=!1,e){var s,n,l,a,u,h;if(An.info("reset"),!this.__loaded)return An.uninitializedWarning("posthog.reset");const d=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Ru)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(l=n.updateConfig)||void 0===l||l.call(n,this.config,this.Xl());const c=this.get_property(r),v=this.get_property(o),f=this.get_property(S);null===(a=this.sessionRecording)||void 0===a||a.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),i||!p||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 _=null===(u=this.persistence)||void 0===u||null===(h=u.Pl)||void 0===h?void 0:h.call(u);let g=!1;try{var m,b,y,w,x,E,k,T,P,C,O,R,I;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(b=this.sessionPersistence)||void 0===b||b.clear(),this.xu.clear(),this.sh(),pi(f)||null===(C=this.persistence)||void 0===C||C.register({$session_recording_remote_config:f}),null===(y=this.surveys)||void 0===y||y.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(x=this.conversations)||void 0===x||x.reset(),null===(E=this.logs)||void 0===E||E.reset(),null===(k=this.metrics)||void 0===k||k.reset(),null===(T=this.persistence)||void 0===T||T.set_property("$user_state","anonymous"),null===(P=this.sessionManager)||void 0===P||P.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:mt,$device_id:null},"");else{const i=this.config.get_device_id(Zn());this.register_once({distinct_id:i,$device_id:t?i:c},""),t||pi(v)||this.register({[o]:v})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.fu()&&(null===(I=this.persistence)||void 0===I||I.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(O=this.featureFlags)||void 0===O||O.initialize(),!bi(d)&&!(null===(R=this.sessionManager)||void 0===R?void 0:R.setBootstrapSessionId(d,!0))){const t=ls({},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 F,A;_&&(null===(F=this.persistence)||void 0===F||null===(A=F.Ol)||void 0===A||A.call(F,g))}this.reloadFeatureFlags()}shutdown(t){var i=this;return Ai(function*(){var t,e,s,n,r,o,l,a;if(i.__loaded){i.ku=!0,i.zu().dispose(),null===(t=i.sessionRecording)||void 0===t||t.dispose(),null===(e=i.logs)||void 0===e||e.flushLogs("sendBeacon"),null===(s=i.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=i.metrics)||void 0===n||n.dispose(),null===(r=i.Fu)||void 0===r||r.unload(),null===(o=i.Du)||void 0===o||o.unload();try{var u;null===(u=i.featureFlags)||void 0===u||u.destroy()}catch(t){An.error("Error while destroying feature flags",t)}null===(l=i.persistence)||void 0===l||l.destroy(),null===(a=i.sessionPersistence)||void 0===a||a.destroy()}else An.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null===(e=this.conversations)||void 0===e||e.dh()}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.fh()}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")?(An.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(pi(i)&&(i=this.get_distinct_id()),t!==i?(this.ah(l,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(An.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=ls({},this.config);if(vi(t)){var s,n,r,o,l,a,u,h,d,c,v,f,p,_;jn(this.config,ou(t));const m=this.bu();null===(s=this.persistence)||void 0===s||s.update_config(this.config,i,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tl(ls(ls({},this.config),{},{persistence:"sessionStorage"}),m,!1);const b=this.Pu(this.config.debug);var g;$i(b)&&(this.config.debug=b),$i(this.config.debug)&&(this.config.debug?(e.DEBUG=!0,or.Et()&&or.At("ph_debug",!0),An.info("set_config",{config:t,oldConfig:i,newConfig:ls({},this.config)})):(e.DEBUG=!1,or.Et()&&or.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Xl()),null===(o=this.exceptionObserver)||void 0===o||o.onConfigChange(),null===(l=this.exceptions)||void 0===l||l.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.tracingHeaders)||void 0===h||h.startIfEnabledOrStop(),null===(d=this.autocapture)||void 0===d||d.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.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._u(),null===(_=this.externalIntegrations)||void 0===_||_.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&vo(this,Ga,!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(ls(ls({},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.ph}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:iu;return i!==iu&&(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"))}rh(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&fi(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))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return"never"===this.config.person_profiles?(An.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(gt,!0),!0)}bu(){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)}_u(){var t,i;const e=this.bu();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.gh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.pi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),e&&(this.xu.clear(),this.sh()),e}opt_in_capturing(i){var e;if("always"!==this.config.cookieless_mode){if(this.fu()){var s,n,r,o,l,a;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new ba(this),this.pageViewManager=new go(this),this.persistence&&(this.sessionPropsManager=new pa(this,this.sessionManager,this.persistence));const i=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=t.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;i&&(this.sessionRecording=this.vu(this.sessionRecording,new i(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.lu)))}var d,c;this.consent.optInOut(!0),this._u(),this.Zu(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(pi(null==i?void 0:i.captureEventName)||(null==i?void 0:i.captureEventName))&&this.capture(null!==(c=null==i?void 0:i.captureEventName)&&void 0!==c?c:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else An.warn(Ka)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void An.warn(Ka);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var i,e;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:mt,$device_id:null}),this.du(t),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.Qu(),this.Zu())}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"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._u()}_is_bot(){return Ht?ya(Ht,this.config.custom_blocked_useragents):void 0}Qu(){qt&&("visible"===qt.visibilityState?this.Tu||(this.Tu=!0,this.capture(Nt,{title:qt.title},{send_instantly:!0}),this.Iu&&(qt.removeEventListener(Mt,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),Vn(qt,Mt,this.Iu)))}debug(t){!1===t?(null==Ut||Ut.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Ut||Ut.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}))}Xl(){const t=this.Ru||{};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?(An.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&&!bi(t[i]),o=e in t&&!bi(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,An)}Os(t){var i;if(bi(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(xi),s=di(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),bi(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return Si(t.event)?An.warn(`${i}. This can cause unexpected behavior.`):An.info(i),null}n.properties&&!fi(n.properties)||An.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return An.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&bi(n.properties[i]))return An.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 n}getPageViewId(){var t;return null===(t=this.pageViewManager.Bo)||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)})}Pu(t){const i=$i(t)&&!t,e=or.Et()&&"true"===or.Ot("ph_debug");return!i&&(!!e||t)}};au.__defaultExtensionClasses={},au.ph=(()=>{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]]=Bn(t.prototype[i[e]])}(au,["identify"]);var uu=class{constructor(t){this.disabled=!1===t;const i=vi(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 hu="$copy_autocapture",du=Mn("[AutoCapture]");function cu(t,i){return i.length>t?i.slice(0,t)+"...":i}function vu(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!xr(i));return i}function fu(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!xr(t))return{props:{}};const u=[t],h=new Set([t]);let d=t;for(;d.parentNode&&!Er(d,"body")&&1e3>u.length;){if(Tr(d.parentNode)){const t=d.parentNode.host;if(h.has(t))break;h.add(t),u.push(t),d=t;continue}if(!xr(d.parentNode))break;if(h.has(d.parentNode))break;h.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}const c="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>Er(t,"button")||Er(t,"a")):-1;c>0&&(s=s||u.slice(0,c+1).some(t=>!Gr(t)||Kr(t)));const v=[],f={};let p,_=!1,g=!1;if(Nn(u,t=>{const i=Gr(t);if(Er(t,"a")){const e=t.getAttribute("href");_=!!(i&&e&&eo(e))&&(o?Je(e):e)}ni(Or(t),"ph-no-capture")&&(g=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Ar.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?cu(1024,so(t)):cu(1024,Ir(t)));const l=Or(t);l.length>0&&(o.classes=l.filter(function(t){return""!==t})),Nn(t.attributes,function(e){var r;if((!Kr(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&eo(e.value)&&(!_i(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=Pr(t).join(" ")),o["attr__"+e.name]=cu(1024,"href"===e.name&&n?Je(t):t)}});let a=1,u=1,h=t;for(;h=vu(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Nn(function(t){if(!Gr(t))return{};const i={};return Nn(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&&eo(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),g)return{props:{},explicitNoCapture:g};if(c>0&&(t=u[c],v.splice(0,c)),s||(v[0].$el_text=Er(t,"a")||Er(t,"button")?so(t):Ir(t)),_){var m,b;v[0].attr__href=_;const t=null===(m=So(_))||void 0===m?void 0:m.host,i=null==Ut||null===(b=Ut.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(p=_)}return{props:jn((w=i.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(y=v,di(y)?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=ls(ls(ls(ls({},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 Ln(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[ro(t.toString())]=ro(i.toString())),s+=":",s+=Ln(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:oo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ln(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(y)):"")},(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 y,w}var pu=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(t){var i;if(!Gr(t))return!0;const e=null!==(i=this.vo().css_selector_ignorelist)&&void 0!==i?i:jr,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Or(t);if(ni(i,"ph-no-capture")||ni(i,"ph-sensitive")||Kr(t)||e.some(i=>Mr(t,i)))return!0;const r=n.parentNode;n=Tr(r)?r.host:r&&xr(r)?r:null}return!1}fo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.uo();if("pointerdown"===t.type){this.uo();const e=Fr(t);var i;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&xr(e)&&(this.ho={target:e,excluded:this.do(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.po)||void 0===i?void 0:i.distinctId}))}const e=this.ho;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.uo():"pointerup"===t.type&&(e.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(t){var i;const e=this.ho;this.uo();const s=Fr(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.po)||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&&(Er(s,"html")||Er(s,"body"))){var n;if(e.excluded)return null;const t=null!==(n=this.vo().css_selector_ignorelist)&&void 0!==n?n:jr;return[s,null==qt?void 0:qt.documentElement,null==qt?void 0:qt.body].some(i=>{if(!i)return!1;const e=Or(i);return ni(e,"ph-no-capture")||ni(e,"ph-sensitive")||!Gr(i)||Kr(i)||t.some(t=>Mr(i,t))})?null:e.target}}constructor(t){this.yo=t,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new uu(this.Mr.rageclick),this.xo=null}setup(t){this.Co(),this.po=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?i.dispose():(this.$o=i,this.startIfEnabled())}dispose(){var t;this.So||(this.So=!0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var t,i;return this.vo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(i=this.Mr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Mr}Io(){if(!this.isBrowserSupported())return void du.info("Disabling Automatic Event Collection because this browser is not supported");if(!Ut||!qt)return;const t=this.Mo=t=>{t=t||(null==Ut?void 0:Ut.event);try{if("blur"===t.type)return void this.uo();if(0===t.type.indexOf("pointer"))return void this.fo(t);const i="click"===t.type?this.mo(t):void 0;if(mi(i))return;this.Eo(t,"$autocapture",i)}catch(t){du.error("Failed to capture event",t)}};if(Vn(Ut,"blur",t),Vn(qt,"submit",t,{capture:!0}),Vn(qt,"change",t,{capture:!0}),Vn(qt,"click",t,{capture:!0}),Nn(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Vn(qt,i,t,{capture:!0})}),this.vo().capture_copied_text){const t=this.Po=t=>{t=t||(null==Ut?void 0:Ut.event);try{this.Eo(t,hu)}catch(t){du.error("Failed to capture clipboard event",t)}};Vn(qt,"copy",t,{capture:!0}),Vn(qt,"cut",t,{capture:!0}),Vn(qt,"paste",t,{capture:!0})}}To(){this.uo(),this.Mo&&(null==Ut||Ut.removeEventListener("blur",this.Mo),Nn(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==qt||qt.removeEventListener(t,this.Mo,!0)}),null==qt||qt.removeEventListener("submit",this.Mo,!0),null==qt||qt.removeEventListener("change",this.Mo,!0),null==qt||qt.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==qt||qt.removeEventListener("copy",this.Po,!0),null==qt||qt.removeEventListener("cut",this.Po,!0),null==qt||qt.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(t){if(this.So)return;if(this.wo=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.ko=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;$i(e)&&(null===(s=this.po)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this._o=e),this.startIfEnabled()}setElementSelectors(t){this.xo=t}getElementSelectors(t,i){var e;const s=[];return null===(e=this.xo)||void 0===e||e.forEach(e=>{const n=null==qt?void 0:qt.querySelectorAll(e);null==n||n.forEach(n=>{t!==n&&i!==n||ni(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.So)return!1;const e=null===(t=this.po)||void 0===t?void 0:t.kv.get(c),s=this._o,n=this.vo();if(!n.remoteRequestsDisabled&&!this.wo)return!1;const r=n.remoteRequestsDisabled&&!this.wo;if(mi(s)&&!$i(e)&&!r)return!1;const o=null!==(i=this._o)&&void 0!==i?i:!!e;return!!n.enabled&&!o}Eo(t,i="$autocapture",e){if(!this.isEnabled)return void this.uo();let s=e||Fr(t);kr(s)&&(s=s.parentNode||null);const n=this.Co();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()))&&qr(s,n.rageclick)&&this.Eo(t,"$rageclick",e);const o=i===hu,l=o?ls(ls({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;if(!Ut||Vr(t))return!1;if((null==e?void 0:e.url_allowlist)&&!Cr(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&Cr(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:l,targetElementList:a}=Wr(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(pi(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(a,e))return!1;if(!Dr(a,null==e?void 0:e.css_selector_allowlist))return!1;if(Dr(a,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:jr))return!1;try{const e=Ut.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const u=t.tagName.toLowerCase();switch(u){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 l?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Ar.indexOf(u)>-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}=fu(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===hu){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null==Ut||null===(u=Ut.getSelection())||void 0===u?void 0:u.toString(),i=Rr(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}return null===(a=this.po)||void 0===a||a.capture(i,e).catch(t=>du.error("Failed to capture event",t)),!0}}isBrowserSupported(){return ci(null==qt?void 0:qt.querySelectorAll)}},_u=class{constructor(t){this._instance=t}refresh(t){const i=this._instance.config,e=vi(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Xl(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}};const gu=Mn("[ExceptionAutocapture]"),mu=()=>{},bu=t=>{var i;if(ci(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function yu(t,i,e){try{if(!(i in t))return mu;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return ci(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=bu(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=bu(e)}}}catch(t){return mu}}const wu=Mn("[TracingHeaders]"),$u=Mn("[Web Vitals]"),Su=9e5,xu=["CLS","FCP","INP","LCP"],Eu=["INP","LCP"],ku=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Tu="disabled",Pu="lazy_loading",Cu=Mn("[SessionRecording]"),Ou=Mn("[Heatmaps]");function Ru(t){return vi(t)&&"clientX"in t&&"clientY"in t&&yi(t.clientX)&&yi(t.clientY)}const Iu=Mn("[Product Tours]"),Fu=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(b))},Au=["$set_once","$set"],Mu=Mn("[SiteApps]"),Du="Error while initializing PostHog app with config id ",Nu=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),ju="SDK is not enabled or survey functionality is not yet loaded",Lu="Disabled. Not loading surveys.";var Bu=class{constructor(t,i){this.yo=t,this.mh=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=t=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!t.ok)return Aa.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(bi(i))return Aa.warn("Flags not loaded yet. Not loading surveys.");this.Sh=$i(i)?i:i.length>0,Aa.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(t){if(!this.So)return this.xh=t,Nu(t.kv.initialize(),()=>{if(this.xh!==t||this.So)return;this.xh=void 0,this.po=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.So?i.dispose():(this.$o=i,this.loadIfEnabled())})}dispose(){var t,i,e,s;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=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.bh=[],this._h=null,this.kh.forEach(t=>clearTimeout(t)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let t=0;t<localStorage.length;t++){const e=localStorage.key(t);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&i.push(e)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.So||!this.po)return;const t=this.Mr;if(this._surveyManager)return;if(this.yh)return void Aa.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Aa.info(Lu);if(t.cookielessMode&&this.yo.isOptedOut())return void Aa.info("Not loading surveys in cookieless mode without consent.");const i=this.yo.getExtensions();if(!i)return void Aa.error("PostHog Extensions not found.");if(pi(this.Sh)&&!t.advancedEnableSurveys)return;const e=this.Sh||t.advancedEnableSurveys;this.yh=!0;try{const t=i.generateSurveys;if(t)return this.Ch(t,e),void(this.yh=!1);const s=i.loadExternalDependency;if(!s)return this.$h(Rt),void(this.yh=!1);s(t=>{try{if(this.So)return;const i=this.yo.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.$h("Could not load surveys script",t):this.Ch(i.generateSurveys,e)}finally{this.yh=!1}})}catch(t){throw this.yh=!1,this.$h("Error initializing surveys",t),t}}Ch(t,i){this.So||(this._surveyManager=t(i),this._surveyEventReceiver=this.yo.createEventReceiver(),Aa.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(t,i){Aa.error(t,i),this.Th({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.bh.push(t),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(i=>i!==t)}}getSurveys(t,i=!1){var e;const s=null!==(e=this.po)&&void 0!==e?e:this.mh;if(!s||this.So)return;if(this.Mr.disableSurveys)return Aa.info(Lu),t([]);const n=s.kv.get(J);if(n&&!i)return t(n,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:i,context:e})=>{this.So||t(i,e)}).catch(t=>Aa.error("Error in survey callback",t));const r=this.Mh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Eh(s,t)}catch(t){return Aa.error("Error processing surveys response",t),this.Eh(s,{statusCode:0,error:t})}},t=>this.Eh(s,{statusCode:0,error:t}));this._h=r;const o=()=>{this._h===r&&(this._h=null)};r.then(i=>{o(),this.So||t(i.surveys,i.context)},o).catch(t=>Aa.error("Error in survey callback",t))}Mh(t,i){const e=this.po;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(ju)}))}Eh(t,i){if(this.So)return{surveys:[],context:{isLoaded:!1,error:ju}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?Aa.error(t):i.error||Aa.warn(t),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.wh=null;const s=i.json.surveys||[],n=s.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Sa(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)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),t.kv.set({[J]:s,[Y]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var t,i;const e=null===(t=null!==(i=this.po)&&void 0!==i?i:this.mh)||void 0===t?void 0:t.kv.get(Y);return yi(e)&&Date.now()-e>3e5}Rh(){return yi(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ma(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Th(t){for(const i of this.bh)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Aa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i=!1){if(!bi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Aa.warn("init was not called")}Ah(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}Fh(t){if(bi(this._surveyManager))return{eligible:!1,reason:ju};const i="string"==typeof t?this.Ah(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Oh(t){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(bi(this._surveyManager))return{eligible:!1,reason:ju};const i="string"==typeof t?this.Ah(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(bi(this._surveyManager))return Aa.warn("init was not called"),{visible:!1,disabledReason:ju};const i=this.Oh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return bi(this._surveyManager)?(Aa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ju})):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.Oh(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s;if(!this.yo.isCapturing())return;if(bi(this._surveyManager))return void Aa.warn("init was not called");const n="string"==typeof t?this.Ah(t):t;if(!(null==n?void 0:n.id))return void Aa.warn("Survey not found");if(!Da.includes(n.type))return void Aa.warn(`Surveys of type ${n.type} cannot be rendered in the app`);const r=null==qt?void 0:qt.querySelector(i);if(r){if(null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Aa.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s;this.kh.delete(t),!this.So&&this.yo.isCapturing()&&(Aa.info(`Rendering survey ${n.id} with delay of ${null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(n,r,e),Aa.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this.kh.add(t)}this._surveyManager.renderSurvey(n,r,e)}else Aa.warn("Survey element not found")}displaySurvey(t,i){var e;if(!this.yo.isCapturing())return;if(bi(this._surveyManager))return void Aa.warn("init was not called");const s=this.Ah(t);if(!s)return void Aa.warn("Survey not found");let n=s;if((null===(e=s.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds)&&i.ignoreDelay&&(n=ls(ls({},s),{},{appearance:ls(ls({},s.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==ol.Popover&&i.initialResponses&&Aa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.Fh(s);if(!t.eligible)return void Aa.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==ol.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}cancelPendingSurvey(t){bi(this._surveyManager)?Aa.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)}};function Uu(t,i,e){if(bi(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 zu=class{constructor(t){this._instance=t,this.Dh=new Set,this.Lh=new Set,this.Nh=new _a,this.qh=(t,i)=>this.jh(t,i)&&this.Bh(t,i)&&this.Hh(t,i)&&this.zh(t,i),this.jh=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;pi(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.Uh=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null===(t=this.Uh)||void 0===t||t.call(this),this.Uh=void 0,this.Nh=new _a}register(t){var i,e;if(!pi(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.Dh.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.Lh.add((null==t?void 0:t.event)||"")})}),null===(e=this._instance)||void 0===e?void 0:e.autocapture)){const t=new Set;this.Dh.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._instance.autocapture.setElementSelectors(t)}}replace(t){this.Dh.clear(),this.Lh.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Lh.has(t)||this.Lh.has(i.event))&&this.Dh.forEach(t=>{this.Wh(i,t)&&this.Nh.emit("actionCaptured",t.name)})}Vh(t){this.onAction("actionCaptured",i=>t(i))}Wh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.qh(t,e))return!0;return!1}onAction(t,i){return this.Nh.on(t,i)}Bh(t,i){if(null==i?void 0:i.url){var e;const s=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!s||"string"!=typeof s)return!1;if(!Uu(s,i.url,i.url_matching||"contains"))return!1}return!0}Hh(t,i){return!!this.Gh(t,i)&&!!this.Zh(t,i)&&!!this.Qh(t,i)}Gh(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.Jh(t);if(s.length>0)return s.some(t=>Uu(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&&Uu(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Zh(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.Jh(t);if(s.length>0)return s.some(t=>Uu(t.text,i.text,i.text_matching||"exact")||Uu(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(;!bi(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=>Uu(t,o,l)));var r,o,l}Qh(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}return!1}Jh(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}zh(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||Ta(i.properties.reduce((t,i)=>{const e=di(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)}},Hu=class{constructor(t){var i,e;this.Kh=[],this._instance=t,this.Xh=new Map,this.Yh=new Map,this.tc=new Map,this.ec=null===(i=this._instance)||void 0===i||null===(e=i.onSessionId)||void 0===e?void 0:e.call(i,t=>this.nc(t))}sc(t){return!1}rc(){return null}oc(t){}lc(){}ac(t,i){return!!t&&Ta(t.propertyFilters,null==i?void 0:i.properties)}uc(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}hc(t,i,e){const s=(e===el.Activation?this.Xh:this.Yh).get(t);let n=[];return this.cc(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.ac(r,i)})}register(t){this.dc(t,!1)}replace(t){this.dc(t,!0)}dc(t,i){var e;pi(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this.vc(t,i),this.fc(t,i))}fc(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.tc.clear(),0===e.length)return void(i&&(null===(s=this.gc)||void 0===s||s.replace([])));this.gc||(this.gc=new zu(this._instance),this.gc.init(),this.gc.Vh(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.tc.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.tc.set(i.name,s)}})}),i?this.gc.replace(n):this.gc.register(n)}mc(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)})}vc(t,i){var e,s;const n=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}),r=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}),o=this.uc(t,el.Activation),l=this.uc(t,el.Cancellation);i?(this.Xh=o,this.Yh=l):(this.mc(this.Xh,o),this.mc(this.Yh,l)),(0!==n.length||0!==r.length)&&(null!==(e=this.Uh)&&void 0!==e||(this.Uh=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.yc(),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 i=this.bc(t,r);if("consume"===i)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this._c([r]);if("persist"===i)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.wc(r),void this.kc([r])}if(this.Yh.has(t)){const e=this.hc(t,i,el.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this._c(e.map(t=>t.id)),e.forEach(t=>this.Sc(t.id)))}if(!this.Xh.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.Xh.get(t)});const o=this.hc(t,i,el.Activation);this.xc(o.map(t=>t.id))}onAction(t){this.tc.has(t)&&this.xc(this.tc.get(t)||[])}xc(t){var i,e;if(0===t.length)return;const s=!!(null===(i=this._instance)||void 0===i||null===(e=i.get_session_id)||void 0===e?void 0:e.call(i)),n=[];for(const i of t)s&&this.sc(i)?this.wc(i)&&this.Cc(i):n.push(i);n.length>0&&(this.Kh=[...new Set([...this.Kh,...n])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(t){this.Kh=this.Kh.filter(i=>i!==t);const i=this.$c();return!i.includes(t)&&(this.Tc([...i,t]),this.Ic(),!0)}_c(t){const i=new Set(t);this.Kh=this.Kh.filter(t=>!i.has(t));const e=this.Mc(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.Tc(s),0===s.length&&this.Ec()),this.kc(t)}Pc(){var t;const i=this.rc();if(!i)return{};const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Cc(t){if(!this.rc())return;const i=this.Pc();this.oc(ls(ls({},i),{},{[t]:Date.now()}))}kc(t){if(!this.rc())return;const i=this.Pc(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(fi(e)?this.lc():this.oc(e))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(t){if(!this.$c().includes(t))return;const i=this.Pc()[t];return yi(i)?i:void 0}Mc(){var t;const i=this.Ac();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[i])||[]}$c(){var t,i,e;const s=this.Mc();if(0===s.length)return[];const n=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Fc()],r=null===(i=this._instance)||void 0===i||null===(e=i.get_session_id)||void 0===e?void 0:e.call(i);return r&&n===r?s:[]}Ic(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);e&&this.Oc(e)}Ec(){this.Dc()}nc(t){var i;const e=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.props[this.Fc()];if(e&&e!==t){const t=this.Mc(),i=this.Pc();t.length>0&&(this.Tc([]),t.filter(t=>yi(i[t])).forEach(t=>this.Sc(t))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(t=>!this.Lc(t))}dispose(){var t,i,e;null===(t=this.ec)||void 0===t||t.call(this),this.ec=void 0,null===(i=this.Uh)||void 0===i||i.call(this),this.Uh=void 0,null===(e=this.gc)||void 0===e||e.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Xh}Nc(){return this.gc}},qu=class extends Hu{constructor(t){super(t)}Ac(){return X}Fc(){return Q}rc(){return Z}oc(t){var i;null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$surveys_activated_timestamps:t})}lc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}sc(t){var i;let e;this.cc(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return yi(s)&&s>0}qc(){return nl.SHOWN}cc(t){var i;null===(i=this._instance)||void 0===i||i.getSurveys(t)}Sc(t){var i;null===(i=this._instance)||void 0===i||i.cancelPendingSurvey(t)}yc(){return Aa}Tc(t){var i;null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$surveys_activated:t})}Oc(t){var i;null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$surveys_activated_session:t})}Dc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Lc(){return!1}bc(t,i){let e;return this.cc(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return Sa(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(e)?t===nl.SHOWN?"consume":"ignore":t===nl.SHOWN?"persist":t===nl.DISMISSED||t===nl.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Vu=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const i={};for(const e of t){const t=this._instance.get_property(e);pi(t)||(i[e]=t)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},Wu=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==Zt?void 0:Zt.__PosthogExtensions__;if(!t)return;const{generateSurveys:i,loadExternalDependency:e}=t;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}createEventReceiver(){return new qu(this._instance)}};const Gu=(null==Ut?void 0:Ut.location)?ko(Ut.location.hash,"__posthog")||ko(location.hash,"state"):null,Ku="_postHogToolbarParams",Ju=Mn("[Toolbar]"),Yu=Mn("[FeatureFlags]");var Xu=class{constructor(t,i=!1){this.jc=!1,this.update(t,i)}update(t,i){this.Bc=((t,i)=>{var e,s,n,r,o,l,a;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:pi(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:di(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.jc||(Yu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),pi(t.flag_keys)||di(t.flag_keys)||Yu.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const Qu=Mn("[FeatureFlags]"),Zu=Mn("[FeatureFlags]",{debugEnabled:!0}),th="\" failed. Feature flags didn't load in time.",ih=["click","keydown","wheel","touchstart","pointerdown"],eh="connection_error",sh=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},nh=t=>{const i={};for(const[e,s]of Ln(t||{}))s&&(i[e]=s);return i},rh=t=>Ti(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),oh=Mn("[Error tracking]"),lh="webkit-masked-url:",ah=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],uh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",lh],hh=["__firefox__","__gCrWeb"],dh="Refusing to render web experiment since the viewer is a likely bot",ch={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>xa(i,t),not_regex:(t,i)=>!xa(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},vh=Mn("[Conversations]"),fh="Conversations not available yet.";function ph(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,d=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=pi(d)?Math.max(h,2048):Math.max(h,d),v=ls(ls({},function(){let t="",i="";try{const e=null==Ht?void 0:Ht.userAgent;e&&([t,i]=Ne(e))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(mn,t)?mn[t]:t}(t);return ls(ls({},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:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const _h=["debug","log","warn","error","info"],gh=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},mh="console",bh="__posthogHandledLogsRequestError",yh=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[bh]=!0,e},wh=t=>!!t&&"object"==typeof t&&!0===t[bh],$h=Mn("[NetworkMetrics]"),Sh=()=>{var t;return(null==Ut||null===(t=Ut.performance)||void 0===t?void 0:t.now)?Ut.performance.now():Date.now()},xh=t=>t?`${Math.floor(t/100)}xx`:"missing",Eh=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=So(s))||void 0===e?void 0:e.href)||s}},kh=(t,i,e,s,n)=>{try{var r,o,l;const u=n();if(!u)return;const h=e||void 0,d=Sh()-s,c=So(i.url);if(c&&"http:"!==c.protocol&&"https:"!==c.protocol)return;const v={url:(null==c?void 0:c.href)||i.url,method:i.method},f=ci(u.name)?u.name(v):_i(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=ls({method:v.method,host:null!==(r=null==c?void 0:c.hostname)&&void 0!==r?r:"",path:c?(a=c.pathname,a.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/")):"",status_class:xh(h)},null===(o=u.attributes)||void 0===o?void 0:o.call(u,v,{status:h,durationMs:d}));null===(l=t.metrics)||void 0===l||l.histogram(f,d,{unit:"ms",attributes:p})}catch(t){$h.error("Failed to record network metric",t)}var a},Th=()=>{},Ph=(t,i)=>ci(null==Ut?void 0:Ut.fetch)?yu(Ut,"fetch",e=>function(...s){const n=Sh(),r=e.apply(this,s);if(!i())return r;try{var o,l,a;const[e,u]=s,h=Eh(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=>(kh(t,h,null==e?void 0:e.status,n,i),e),e=>{throw kh(t,h,void 0,n,i),e})}catch(t){return $h.error("Failed to observe fetch",t),r}}):Th,Ch=(t,i)=>{var e;const s=null==Ut||null===(e=Ut.XMLHttpRequest)||void 0===e?void 0:e.prototype;if(!s)return Th;const n=new WeakMap,r=yu(s,"open",t=>function(...i){try{(()=>Kl.has(this))()||n.set(this,Eh(i[0],i[1]))}catch(t){$h.error("Failed to observe XHR open",t)}return t.apply(this,i)}),o=yu(s,"send",e=>function(...s){let r;try{const e=n.get(this);if(e&&i()){const s=Sh();r=()=>{this.removeEventListener("loadend",r),kh(t,e,this.status,s,i)},Vn(this,"loadend",r)}}catch(t){$h.error("Failed to observe XHR send",t)}try{return e.apply(this,s)}catch(t){throw r&&this.removeEventListener("loadend",r),t}});return()=>{r(),o()}},Oh={featureFlags:class{constructor(t){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=Qu,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.sn=()=>{const t=this.ed();this.Yc=0,t&&this.reloadFeatureFlags()},this.nd=()=>{var t,i;const e=this.sd,s=null!==(t=this.rd)&&void 0!==t?t:e;pi(e)||pi(s)||this.Mr.remoteRequestsDisabled||!qt||"hidden"===qt.visibilityState||Date.now()-(null!==(i=this.od)&&void 0!==i?i:0)<s||(this.rd=this.td||!this.Mr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{"visible"===(null==qt?void 0:qt.visibilityState)&&this.ud()},"get"in t?this.yo=t:(this._instance=t,this.hd=new Xu(t.config,t.Xl()),this.yo=this.hd)}updateConfig(t,i){var e;null===(e=this.hd)||void 0===e||e.update(t,i),this.po&&this.dd()}setup(t){return this.xh=t,this.$=t.logger.createLogger("[FeatureFlags]"),Nu(t.kv.initialize(),()=>{this.xh===t&&(this.xh=void 0,this.po=t,this.vd(t))})}vd(t){var i;if(this.po===t)return Ut&&Vn(Ut,"online",this.sn),this.dd(),this.fd=t.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const t=this.Mr.refreshIntervalMs,i=!this.Mr.remoteRequestsDisabled&&qt&&!pi(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.rd=i),i!==this.sd&&(this._d(),pi(i)||(this.sd=i,this.rd=i,this.ld(),(null==qt?void 0:qt.addEventListener)&&(Vn(qt,Mt,this.an),Dn(ih,t=>{Vn(qt,t,this.ad,{capture:!0})}))))}ld(){pi(this.sd)||(pi(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var t;pi(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==qt||null===(t=qt.removeEventListener)||void 0===t||t.call(qt,"visibilitychange",this.an),Dn(ih,t=>{var i;null==qt||null===(i=qt.removeEventListener)||void 0===i||i.call(qt,t,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var t,i;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null===(t=this.fd)||void 0===t||t.dispose(),this.fd=void 0,null===(i=this.gd)||void 0===i||i.call(this),this.gd=void 0,this.Wc=[],null==Ut||Ut.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(t){var i;return this.Cd&&t in this.Cd?this.Cd[t]:null===(i=this.po)||void 0===i?void 0:i.kv.get(t)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var t;return!pi(null===(t=this.po)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.md()}At(t){this.Td(()=>{var i;return null===(i=this.po)||void 0===i?void 0:i.kv.set(t)})}Id(t,i,e){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!t.$enabled_feature_flags)return;const n=this.xd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=i.flags||i.featureFlags,l=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!i.errorsWhileComputingFlags&&!!i.flags,u=a?l:e&&!di(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),h=this.xd("$feature_flag_payloads")||{},d=t.$feature_flag_payloads||{},c=a||e?u:Array.from(new Set([...Object.keys(h),...Object.keys(d)])),v=!a&&!e,f=!!v||u,p=!!v||c,_={[j]:f,[N]:f,[U]:p};t.$feature_flag_details&&(_[B]=f);for(const i of[z,ht,H])pi(t[i])||(_[i]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}Lt(t){this.Td(()=>{var i;return null===(i=this.po)||void 0===i?void 0:i.kv.remove(t)})}Td(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}yd(){const t={};for(const i of[j,U,z,q]){const e=this.xd(i);pi(e)||(t[i]=e)}this.zc=t;const i=ls({},t),e=this.xd(N);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this.Uc=i}pd(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.xd(ht);return"number"!=typeof i||Date.now()-i>t}Md(){return!!this.pd()&&(this.Xc||this.Gc||(this.Xc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Pd(){const t=this.Mr.flagKeys;if(!pi(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Mr,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=>!pi(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this.Rd({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.xd("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.xd("$feature_flag_payloads"))&&void 0!==n?n:{},l=ls(ls({},r),t),a=ls(ls({},o),i),u={};for(const[t,i]of Object.entries(l))u[t]={key:t,enabled:Ks(i),variant:Js(i),reason:void 0,metadata:pi(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.xd(B),i=this.xd(q),e=this.xd(V);if(!e&&!i)return t||{};const s=jn({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r;const n=s[t],l=null==i?void 0:i[t],a=pi(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,u=pi(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],d=ls(ls({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});var o;a!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),h&&(d.metadata=ls(ls({},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]=d}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.Hc=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:Ks(s),variant:Js(s),payload:Gs(i[e])}})}getFlagVariants(){const t=this.xd(N),i=this.xd(q);if(!i)return t||{};const e=jn({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Hc=!0),e}getFlagPayloads(){const t=this.xd(U),i=this.xd(V);if(!i)return t||{};const e=jn({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Hc=!0),e}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(t){return this.Wc.push(t),()=>{this.Wc=this.Wc.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qc=t}resetFlagCallReported(){this.Lt(lt)}Fd(t){this.Sd();const i=this.po;if(!i||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!0);const e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ls(ls(ls({},i.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.xd(G),timezone:zo()};pi(i.deviceId)||(e.$device_id=i.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(e.disable_flags=!0);const s=this.Ed();s.length&&(e.evaluation_contexts=s);const n=this.Pd();pi(n)||(e.flag_keys=n);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Zc;this.Gc=!0;const a=()=>{this.Jc&&(this.Jc=!1,this.Fd())},u=t=>{var i,s;const n=null!==(i=t.json)&&void 0!==i?i:{},o=200!==t.statusCode;if(this.Gc=!1,l!==this.Zc)return void a();if(this.Od(t.statusCode),o||this.Jc||(this.$anon_distinct_id=void 0),e.disable_flags&&!this.Jc)return;this.Kc=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?eh:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[ut]:u}),h?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):e.disable_flags||this.Rd(n,o,{partialResponse:r}),a()},h=t=>{this.Gc=!1,l===this.Zc?(this.At({[ut]:[eh]}),this.$.error("Feature flag request failed",t),this.$d()&&this.bd(!0),a()):a()};try{i.sendRequest(o,{target:"flags",method:"POST",body:e,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(h)}catch(t){h(t)}}ed(){return To(this.Yc,3)}Od(t){this.Yc=Po(t,this.Yc,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i={}){var e;if(i.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+th);if(this.Md())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){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+th);if(this.Md())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.xd("$feature_flag_request_id")||void 0,a=this.xd("$feature_flag_evaluated_at")||void 0;let u,h=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var d;const t=null===(d=this.po)||void 0===d?void 0:d.session.sessionId,i=this.xd(at);t&&t!==i&&(h={},u=t)}if(i.send_event||!("send_event"in i))if(t in h&&h[t].includes(o))u&&this.At({[lt]:h,[at]:u});else{var c,v,f,p,_,g,m,b,y,w,S,x;di(h[t])?h[t].push(o):h[t]=[o],this.At(ls({[lt]:h},u?{[at]:u}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(c=this.xd("$feature_flag_errors"))&&void 0!==c?c:[]];pi(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(_=this.Mr.bootstrap)||void 0===_||null===(_=_.featureFlagPayloads)||void 0===_?void 0:_[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.Kc};pi(null==i||null===(g=i.metadata)||void 0===g?void 0:g.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),pi(null==i||null===(m=i.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=i.metadata.version);const d=null!==(b=null==i||null===(y=i.reason)||void 0===y?void 0:y.description)&&void 0!==b?b:null==i||null===(w=i.reason)||void 0===w?void 0:w.code;var E;d&&(s.$feature_flag_reason=d),(null==i||null===(S=i.metadata)||void 0===S?void 0:S.id)&&(s.$feature_flag_id=i.metadata.id),pi(null==i?void 0:i.original_variant)&&pi(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=pi(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(x=i.metadata)||void 0===x?void 0:x.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(E=i.metadata)||void 0===E?void 0:E.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.Dd(s)}else u&&this.At({[lt]:h,[at]:u});return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:Gs(r)}:void 0}Dd(t){try{var i;null===(i=this.po)||void 0===i||i.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Ld(t,i)}Ld(t,i){var e=this;return Ai(function*(){const s=e.po;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.Ed();r.length&&(n.evaluation_contexts=r);const o=e.Pd();let l;pi(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.Mr.compression,sentAt:"body",timeoutMs:e.Mr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.$.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Kc)return i.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+th),i.defaultValue;const e=this.getFeatureFlag(t,i);return pi(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.Rd(t,i,e)}Rd(t,i,e){if(!this.po)return;this.Vc=!0;const s=((t,i={},e={},s={},n,r=Qu)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).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].enabled).filter(t=>{var i;return!pi(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 ls(ls({},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,d=t.evaluatedAt;if(di(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{[j]:a,[N]:t,[H]:!1}}let c=a,v=u,f=l;if(null==n?void 0:n.partialResponse){const t=Object.keys(c),n=v||{};c=ls(ls({},i),c),v=ls(ls({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=ls(ls({},s),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var i;return!(null===(i=l[t])||void 0===i?void 0:i.failed)}));c=ls(ls({},i),Object.fromEntries(Object.entries(c).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(v||{}).filter(([i])=>t.has(i)));v=ls(ls({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=ls(ls({},s),Object.fromEntries(Object.entries(f||{}).filter(([i])=>t.has(i))))}else c=ls(ls({},i),c),v=ls(ls({},e),v),f=ls(ls({},s),f);return ls(ls({[j]:Object.keys(nh(c)),[N]:c||{},[U]:v||{},[B]:f||{},[H]:!0===t.minimalFlagCalledEvents},h?{[z]:h}:{}),d?{[ht]:d}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.$);if(s)if(!1===(null==e?void 0:e.persist)){const t=!pi(this.po.kv.get(N));this.Cd=s,t||this.At(s)}else this.md(),this.Id(s,t,!!(null==e?void 0:e.partialResponse)),this.At(s);else i&&this.$d();i||(this.Xc=!1),this.bd(i)}override(t,i=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Nd(t)}Nd(t){if(this.po){if(!1===t)return this.Lt([q,V]),this.bd(),void Zu.info("All overrides cleared");if(di(t))return this.At({[q]:sh(t)}),this.bd(),void Zu.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.Hc=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[q]=di(n)?sh(n):n),r&&(s[V]=r),Object.keys(s).length&&this.At(s),!1===n&&!1===r?this.Lt([q,V]):!1===n?this.Lt(q):!1===r&&this.Lt(V),this.bd(),!1===n?Zu.info("Flag overrides cleared"):n&&Zu.info("Flag overrides set",{flags:n}),void(!1===r?Zu.info("Payload overrides cleared"):r&&Zu.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[q]:t}),this.bd(),void Zu.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Vc){const{flags:i,flagVariants:e}=this.qd();try{t(i,e)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const n=(this.xd("$early_access_features")||[]).find(i=>i.flagKey===t),r={[`$feature_enrollment/${t}`]:i},o={$feature_flag:t,$feature_enrollment:i,$set:r};n&&(o.$early_access_feature_name=n.name),e&&(o.$feature_enrollment_stage=e);const l=ls(ls({},this.getFlagVariants()),{},{[t]:i});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[j]:Object.keys(nh(l)),[N]:l,[W]:ls(ls({},this.xd("$stored_person_properties")||{}),r)}),this.bd();try{var a;null===(a=this.po)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const s=this.xd(L);!s||i?this.jd(t,e):t(s)}jd(t,i){var e=this;return Ai(function*(){const s=e.po;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.At({[L]:r})}catch(t){return void e.$.error("Early access feature request failed",t)}try{t(r)}catch(t){e.$.error("Early access feature callback failed",t)}})()}qd(){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),{})}}bd(t){this.yd();const{flags:i,flagVariants:e}=this.qd();this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i=!0){this.Bd(t,i)}Bd(t,i=!0){const e=this.xd("$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.At({[W]:ls(ls(ls({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=ls({},this.xd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.At({[W]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(W),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.xd("$stored_group_properties")||{},s=ls({},e);for(const i of Object.keys(t))s[i]=ls(ls({},e[i]),t[i]);this.At({[G]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.xd("$stored_group_properties")||{};this.At({[G]:ls(ls({},i),{},{[t]:{}})})}else this.Lt(G)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Yc=0}}},Rh={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Hd)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!==(t=null===(i=this.Hd)||void 0===i?void 0:i.status)&&void 0!==t?t:this.zd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.zd=Tu,this.Ud=void 0,this.Wd=!1,this.Ke=(()=>{var t,i;if(!(null==qt?void 0:qt.visibilityState)||"visible"===qt.visibilityState)return!0;const e=null==Ut||null===(t=Ut.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.an=()=>{var t,i;"visible"===(null==qt?void 0:qt.visibilityState)&&(this.Ke=!0,null===(t=this.Hd)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw Cu.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==qt?void 0:qt.addEventListener)&&Vn(qt,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.Wd=!0,null==qt||null===(i=qt.removeEventListener)||void 0===i||i.call(qt,"visibilitychange",this.an),t?this.Vd(!0):this.stopRecording()}get Gd(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),e=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return Ut&&i&&e&&!s}startIfEnabledOrStop(t){var i;if(this.Wd)return;if(this.Gd&&(null===(i=this.Hd)||void 0===i?void 0:i.isStarted))return;const e=!pi(Object.assign)&&!pi(Array.from);this.Gd&&e?(this.Zd(t),Cu.info("starting")):(this.zd=Tu,this.stopRecording())}Zd(t){var i,e;if(this.Gd)if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=Pu),(null==Zt||null===(i=Zt.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=Zt.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Qd(t);else{var s,n;const i=this._instance.sessionManager;null===(s=Zt.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Jd,e=>{if(!this.Wd&&this.Gd&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Cu.error("could not load recorder",e)):void this.Qd(t);this.zd="disabled"})}}stopRecording(){var t,i;null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=void 0,null===(i=this.Hd)||void 0===i||i.stop()}Vd(t=!1){var i,e;null===(i=this.Ud)||void 0===i||i.call(this),this.Ud=void 0,null===(e=this.Hd)||void 0===e||e.discard({discardProducerEvents:t})}Kd(){var t,i;null===(t=this.xa)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.xa)||void 0===i||i.unregister("$replay_sample_rate")}Xd(t,i){if(bi(t))return null;const e=yi(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(Cu.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Yd(t){if(this.xa){var i,e;const s=this.xa,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Xd(null===(i=this.Mr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Xd(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;bi(o)&&this.Kd();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[S]:ls(ls({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:ls({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:pi(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.Ud)||void 0===i||i.call(this),this.Ud=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.Yd(i),void this.Vd()):(this.Yd(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.zd&&(this.zd="missing_config",Cu.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.Hd)||void 0===e?void 0:e.log)?this.Hd.log(t,i):Cu.warn("log called before recorder was ready")}get Jd(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(S);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}tv(){const t=this._instance.get_property(S);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return Cu.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!bi(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Qd(t){var i,e,s;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return Cu.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[$t]:!0});var n;if(this.Hd||(this.Hd=null===(n=Zt.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv()){if("missing_config"===this.zd||"awaiting_config"===this.zd)return;return this.zd="awaiting_config",Cu.info("persisted remote config is stale, requesting fresh config before starting"),void new vl(this._instance).load()}this.zd=Pu,null===(e=(s=this.Hd).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Ke),this.Hd.start(t)}else this.zd=Tu}onRRwebEmit(t){var i,e;null===(i=this.Hd)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this.Hd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this.Hd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this.Hd||null===(e=this.xa)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this.Hd)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Hd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!!(null===(e=this.Hd)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.Hd)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}}},Ih={autocapture:class extends pu{constructor(t){super(new _u(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.nv();return!!(t.path||t.search||this.sv(t))}startIfEnabled(){this.isEnabled&&(An.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,An.info("History API monitoring stopped")}monitorHistoryChanges(){Ut&&Ut.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(t){var i;if(!Ut||(null===(i=Ut.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const e=this;yu(Ut.history,t,i=>function(s,n,r){i.call(this,s,n,r),e.hv(t)})}iv(){const t=null==Ut?void 0:Ut.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}nv(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:vi(t)?t:{}}sv(t=this.nv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}dv(t){const i=this.nv(),e=this.ev;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.sv(i)&&t.hash!==e.hash))}hv(t){try{const i=this.iv();if(!i)return;this.dv(i)&&this._instance.capture(Nt,{navigation_type:t}),this.ev=i}catch(i){An.error(`Error capturing ${t} pageview`,i)}}av(){if(this.rv)return;const t=()=>{this.hv("popstate")};Vn(Ut,"popstate",t),this.rv=()=>{Ut&&Ut.removeEventListener("popstate",t)}}uv(){if(this.ov)return;const t=()=>{this.hv("hashchange")};Vn(Ut,"hashchange",t),this.ov=()=>{Ut&&Ut.removeEventListener("hashchange",t)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var i;this.vv=!1,this.bo=!1,this.fv=null,this.instance=t,this.vv=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[v]),this.rageclicks=new uu(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return vi(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return bi(this.Mr.capture_heatmaps)?bi(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Ou.info("starting..."),this.pv(),this.an()}else{var t;clearInterval(null!==(t=this.fv)&&void 0!==t?t:void 0),this.gv(),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({[v]:e}),this.vv=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}mv(t){Ru(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==qt?void 0:qt.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){Ut&&qt&&(this.yv=this.fa.bind(this),Vn(Ut,Dt,this.yv),this.bv=t=>this.Cr(t||(null==Ut?void 0:Ut.event)),Vn(qt,"click",this.bv,{capture:!0}),this._v=t=>this.wv(t||(null==Ut?void 0:Ut.event)),Vn(qt,"mousemove",this._v,{capture:!0}),this.Sv=new ho(this.instance,ao,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),Vn(qt,Mt,this.xv),this.bo=!0)}gv(){var t;Ut&&qt&&(this.yv&&Ut.removeEventListener(Dt,this.yv),this.bv&&qt.removeEventListener("click",this.bv,{capture:!0}),this._v&&qt.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&qt.removeEventListener(Mt,this.xv),clearTimeout(this.Cv),null===(t=this.Sv)||void 0===t||t.stop(),this.bo=!1)}$v(t,i){const e=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=function(t,i,e){let s=t;for(;s&&xr(s)&&!Er(s,"body");){if(s===e)return!1;let t;try{var n,r,o;t=null===(n=null!==(r=null===(o=s.ownerDocument)||void 0===o?void 0:o.defaultView)&&void 0!==r?r:Ut)||void 0===n?void 0:n.getComputedStyle(s).position}catch(t){return!1}if(ni(i,t))return!0;s=Nr(s)}return!1}(Fr(t),["fixed","sticky"],n);return{x:t.clientX+(r?0:s),y:t.clientY+(r?0:e),target_fixed:r,type:i}}Cr(t,i="click"){var e;if(Sr(t.target)||!Ru(t))return;const s=this.$v(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&qr(Fr(t),this.instance.config.rageclick)&&this.Zs(ls(ls({},s),{},{type:"rageclick"})),this.Zs(s)}wv(t){!Sr(t.target)&&Ru(t)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(t,"mousemove"))},500))}Zs(t){if(!Ut)return;const i=this.Mr.disable_capture_url_hashes?Je(Ut.location.href):Ut.location.href,e=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Co,...e||[]]:[],n=Eo(i,s,Ro);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(t)}fa(){this.Rt&&!fi(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ho,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ls({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>ls(ls({},t),{},{[`$web_vitals_${i.name}_event`]:ls({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},bi(null==t?void 0:t.name)||bi(null==t?void 0:t.value))return void $u.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Ev(e);if(pi(s))return;const n=yi(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.Pv&&t.value>=this.Pv)return void $u.error("Ignoring metric with value >= "+this.Pv,t);this.Rt.navigationKey!==n&&(this.Tv(),this.Iv=setTimeout(this.Tv,this.flushToCaptureTimeoutMs)),pi(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=pi(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=ls(ls(ls({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,vi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of ku){const s="url"===e&&"string"==typeof t.attribution[e]?this.Ev(t.attribution[e]):t.attribution[e];pi(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;pi(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Tv()},this.Rv=()=>{if(this.bo)return;let t,i,e,s,n=!1;const r=Zt.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Av])||("web-vitals"===this.Av&&pi(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!pi(l)){const r=l.withoutAttribution,o=this.attributionMetrics;n=!pi(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,i=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,e=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,s=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&i&&e&&s))return void $u.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=n&&this.attributionMetrics.indexOf("INP")>-1?ls(ls({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Mv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Mv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Mv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&s(this.Mv.bind(this),u),this.bo=!0},this.vv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[g]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=vi(this.Fv)?null===(t=this.Fv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return bi(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||xu:e}get flushToCaptureTimeoutMs(){return(vi(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=vi(this.Fv)?this.Fv.web_vitals_attribution:void 0;return $i(t)?t?xu:[]:di(t)?t:Eu}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=vi(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Pv(){const t=vi(this.Fv)&&yi(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Su;return t>0&&6e4>=t?Su:t}get isEnabled(){const t=null==Vt?void 0:Vt.protocol;if("http:"!==t&&"https:"!==t)return $u.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=vi(this.Fv)?this.Fv.web_vitals:$i(this.Fv)?this.Fv:void 0;return $i(i)?i:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&($u.info("enabled, starting..."),this.No(this.Rv))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=vi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=vi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:e}),this._instance.persistence.register({[w]:s})),this.vv=e,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(t){var i;const e=Zt.__PosthogExtensions__,s=this.Av,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&pi(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?$u.error("failed to load script",i):t()})}Ev(t){const i=t||(null==Ut?void 0:Ut.location.href);if(!i)return void $u.error("Could not determine current URL");const e=this._instance.config.disable_capture_url_hashes?Je(i):i,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Co,...s||[]]:[];return Eo(e,n,Ro)}}},Fh={exceptionObserver:class{constructor(t){var i;this.Rv=()=>{var t;if(!Ut||!this.isEnabled||!(null===(t=Zt.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=Zt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=Zt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Zt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=i(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=e(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=s(this.captureException.bind(this)))}catch(t){gu.error("failed to start",t),this.Nv()}},this._instance=t,this.qv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[f]),this.wt=new ji(ls(ls({},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,$:gu})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return vi(t)?i=ls(ls({},i),t):(pi(t)?this.qv:t)&&(i=ls(ls({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gu.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return gu.error("failed to load script",i);t()})}Nv(){var t,i,e;null===(t=this.Ov)||void 0===t||t.call(this),this.Ov=void 0,null===(i=this.Dv)||void 0===i||i.call(this),this.Dv=void 0,null===(e=this.Lv)||void 0===e||e.call(this),this.Lv=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.qv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[f]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}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.wt.consumeRateLimit(n))return void gu.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.Bv=[],this.Hv=new as([new Cs,new Ls,new Rs,new Os,new Ns,new Ds,new Fs,new js],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=ws.test(s)?s.replace(ws,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Ss(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(Ts(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=Es(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)xs(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++)Ps(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 ls(ls({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",gs,ys)),this._instance=t,this.Bv=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.zv=qs(this.Uv()),this.Wv=new Vs(this.zv)}onConfigChange(){this.zv=qs(this.Uv()),this.Wv.setConfig(this.zv)}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.Bv=r,this._instance.persistence&&this._instance.persistence.register({[p]:this.Bv,[_]:o})}get Vv(){var t;const i=!!this._instance.get_property(_),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Hv.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.zv.enabled)try{if(!_i(t)||0===t.trim().length)return void oh.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)=>zs.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Gv(i));s.length>0&&oh.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Wv.add(ls({[Bs]:t,[Us]:(new Date).toISOString()},e))}catch(t){oh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Zv(i)){if(this.Qv(i))return this.Jv("Exception dropped: matched a suppression rule"),void oh.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(i))return this.Jv("Exception dropped: thrown by a browser extension"),void oh.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Xv(i))return this.Jv("Exception dropped: thrown by an injected browser script"),void oh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yv(i))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void oh.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.zv.enabled&&bi(t.$exception_steps)?this.tf(t):t,s=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return t&&this.Wv.clear(),t}catch(t){return rh(t)||oh.error("Failed to capture exception event. Dropping this exception.",t),void this.Wv.clear()}}catch(t){return void(rh(t)||oh.error("Failed to process exception event. Ignoring this exception.",t))}}tf(t){try{const i=this.Wv.getAttachable();return 0===i.length?t:ls(ls({},t),{},{$exception_steps:i})}catch(i){return oh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Jv(t){this.zv.enabled&&this.Wv.add({[Bs]:t,[Us]:(new Date).toISOString()})}Gv(t){return vi(t)?ls({},t):{}}Uv(){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:{}}Qv(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(_i(i)&&i.length>0&&t.$exception_types.push(i),_i(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.Bv.some(t=>{const e=t.values.map(t=>{const e=ka[t.operator],s=i[t.key];if(!e||!s)return!1;const n=di(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 oh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Kv(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&&uh.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(lh))||t.some(({type:t,value:i})=>"NoResponse"===t||_i(i)&&ah.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(lh))))}Xv(t){return t.some(({value:t})=>_i(t)&&hh.some(i=>t.includes(i)))}Yv(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}Zv(t){return!bi(t)&&di(t)}}},Ah=ls({productTours:class{get xa(){return this._instance.persistence}constructor(t){this.ef=null,this.if=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.xa&&this.xa.register({[b]:!!i.productTours}),!Fu(this._instance))return!this.ef&&bi(null===(e=this.xa)||void 0===e?void 0:e.props.ph_product_tours)||Iu.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.ef)||void 0===s||s.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&Fu(this._instance)&&this.No(()=>this.nf())}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?Iu.error("Could not load product tours script",i):t()})}nf(){var t;!this.ef&&(null===(t=Zt.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.ef=Zt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(di(this.if)&&!i)return void t(this.if,{isLoaded:!0});const e=this.xa;if(e){const s=e.props[tt];if(di(s)&&!i)return this.if=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(!Fu(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||Iu.warn(e):Iu.error(e),void t([],{isLoaded:!1,error:e})}const n=di(i.json.product_tours)?i.json.product_tours:[];this.if=n,e&&e.register({[tt]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){bi(this.ef)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.ef)||void 0===i||i.showTourById(t)}previewTour(t){this.ef?this.ef.previewTour(t):this.No(()=>{var i;this.nf(),null===(i=this.ef)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.ef)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.ef)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.ef)||void 0===t||t.previousStep()}clearCache(){var t;this.if=null,null===(t=this.xa)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.ef)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.ef)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.ef)||void 0===i||i.cancelPendingTour(t)}}},Oh),Mh={siteApps:class{constructor(t){this._instance=t,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(t,i){if(!i)return;const e=this.globalsForEvent(i);this.rf.push(e),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}get siteAppLoaders(){var t;return null===(t=Zt._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.lf.bind(this));this.af=()=>{t(),this.rf=[],this.af=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:d,$set:c}=t;return{event:ls(ls({},un(t,Au)),{},{properties:ls(ls(ls({},t.properties),c?{$set:ls(ls({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),c)}:{}),d?{$set_once:ls(ls({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),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}}uf(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)||(Mu.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)||(Mu.error("prepare_external_dependency_script returned null"),null)}return t}hf(){var t,i,e,s,n,r,o,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const a=null==qt?void 0:qt.defaultView,u=null==a||null===(t=a.Node)||void 0===t?void 0:t.prototype;if(!a||!u)return()=>{};if(this.sf++,this.cf)return this.df();const h=[],d=this,c=new WeakSet,v=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),h.push(()=>{t[i]=s})},f=t=>{if(c.has(t))return t;const i=d.uf(t);return i&&c.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!mi(t));return v(u,"appendChild",t=>function(i){const e=f(i);return e?t.call(this,e):i}),v(u,"insertBefore",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):i}),v(u,"replaceChild",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):e}),[null===(i=a.Element)||void 0===i?void 0:i.prototype,null===(e=a.Document)||void 0===e?void 0:e.prototype,null===(s=a.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{v(t,"append",t=>function(...i){return t.apply(this,p(i))}),v(t,"prepend",t=>function(...i){return t.apply(this,p(i))})}),[null===(n=a.Element)||void 0===n?void 0:n.prototype,null===(r=a.CharacterData)||void 0===r?void 0:r.prototype,null===(o=a.DocumentType)||void 0===o?void 0:o.prototype].forEach(t=>{v(t,"before",t=>function(...i){return t.apply(this,p(i))}),v(t,"after",t=>function(...i){return t.apply(this,p(i))}),v(t,"replaceWith",t=>function(...i){const e=p(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),v(null===(l=a.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(i,e){const s=f(e);return s?t.call(this,i,s):null}),this.cf=()=>{h.forEach(t=>t()),this.cf=void 0},this.df()}df(){let t=!1;return()=>{var i;t||(t=!0,this.sf--,0===this.sf&&(null===(i=this.cf)||void 0===i||i.call(this)))}}vf(t,i=!0){const e=this.hf();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.rf.length&&(Mu.info(`Processing ${this.rf.length} events for site app with id ${t.id}`),this.rf.forEach(t=>this.vf(()=>{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.af)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,Mu.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.vf(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){Mu.error(Du+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){Mu.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}ff(){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)}pf(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.vf(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){Mu.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.ff(),void this._instance.on("eventCaptured",t=>this.pf(t))):void Mu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.af)||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;Zt[`__$$ph_site_app_${t}`]=this._instance,null===(r=Zt.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return Mu.error(Du+t,i)})}else Mu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Dh={tracingHeaders:class{constructor(t){this._instance=t,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const t=this.bf();var i,e;t?(pi(this.gf)&&(this.gf=null===(i=Zt.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),pi(this.mf)&&(this.mf=null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Nv()}}initialize(){this.startIfEnabledOrStop()}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return wu.error("failed to load script",i);t()})}_f(){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}bf(){const t=this._f();return di(t)?(di(this.yf)?this.yf.splice(0,this.yf.length,...t):this.yf=[...t],t.length>0?this.yf:void 0):(di(this.yf)&&this.yf.splice(0),this.yf=t||void 0,this.yf)}Nv(){var t,i;null===(t=this.gf)||void 0===t||t.call(this),null===(i=this.mf)||void 0===i||i.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},Nh=ls({surveys:class extends Bu{constructor(t){var i;super(new Wu(t),(i=t,{get projectToken(){return i.config.token},kv:new Vu(i)})),this._instance=t}Mh(t,i){const e=i.query?Ql(t,i.query):t;return new Promise(t=>{var s;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},Oh),jh={toolbar:class{constructor(t){this.instance=t}wf(t){Zt.ph_toolbar_state=t}kf(){var t;return null!==(t=Zt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,e=void 0){var s,n;if(Wn(this.instance.config))return!1;if(!Ut||!qt)return!1;t=null!==(s=t)&&void 0!==s?s:Ut.location,e=null!==(n=e)&&void 0!==n?n:Ut.history;try{if(!i){try{Ut.localStorage.setItem("test","test"),Ut.localStorage.removeItem("test")}catch(t){return!1}i=null==Ut?void 0:Ut.localStorage}const s=Gu||ko(t.hash,"__posthog")||ko(t.hash,"state");let n;const r=s?Ye(()=>JSON.parse(atob(decodeURIComponent(s))))||Ye(()=>JSON.parse(decodeURIComponent(s))):null;return r&&"ph_authorize"===r.action?(n=r,n.source="url",n&&Object.keys(n).length>0&&(r.desiredHash?t.hash=r.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):(n=JSON.parse(i.getItem(Ku)||"{}"),n.source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}Sf(t){const i=Zt.ph_load_toolbar||Zt.ph_load_editor;!bi(i)&&ci(i)?i(t,this.instance):Ju.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==qt?void 0:qt.getElementById("__POSTHOG_TOOLBAR__"));if(!Ut||i)return!1;const e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=ls(ls({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(Ut.localStorage.setItem(Ku,JSON.stringify(ls(ls({},s),{},{source:void 0}))),2===this.kf())this.Sf(s);else if(0===this.kf()){var n,r;this.wf(1),null===(n=Zt.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"toolbar",t=>{if(t)return Ju.error("[Toolbar] Failed to load",t),void this.wf(0);this.wf(2),this.Sf(s)}),Vn(Ut,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(s)})}return!0}xf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},Lh=ls({experiments:class t{get Mr(){return this._instance.config}constructor(i){this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(i=>{t.Cf("retrieved web experiments from the server"),this.$f=new Map,i.forEach(i=>{if(i.feature_flag_key){var e;this.$f&&(t.Cf("setting flag key ",i.feature_flag_key," to web experiment ",i),null===(e=this.$f)||void 0===e||e.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);_i(s)&&i.variants[s]&&this.Tf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const e in i.variants){const s=i.variants[e];t.If(s,this._instance)&&this.Tf(i.name,e,s.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Cf(dh);else if(!this.Mr.disable_web_experiments){if(bi(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Cf("applying feature flags",i),i.forEach(t=>{var i;if(this.$f&&(null===(i=this.$f)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.$f)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.Tf(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){const i=t.getWindowLocation();if(null==i?void 0:i.search){const e=xo(null==i?void 0:i.search,"__experiment_id"),s=xo(null==i?void 0:i.search,"__experiment_variant");e&&s&&(t.Cf(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.Mf(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Mr.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.Mr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Mf(i,e,s){const n=s.filter(t=>t.id===i);n&&n.length>0&&(t.Cf(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.Tf(n[0].name,e,n[0].variants[e].transforms))}static If(i,e){return!bi(i.conditions)&&t.Ef(i,e)&&t.Pf(i)}static Ef(i,e){var s;if(bi(i.conditions)||bi(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=$r(e,n.href);return!(null===(r=i.conditions)||void 0===r?void 0:r.url)||ch[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==Ut?void 0:Ut.location}static Pf(t){var i;if(bi(t.conditions)||bi(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Fo();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,d=!(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,c=!(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&&c&&v&&d}return!1}static Cf(t,...i){An.info(`[WebExperiments] ${t}`,i)}Tf(i,e,s){this._is_bot()?t.Cf(dh):"control"!==e?s.forEach(s=>{if(s.selector){var n;t.Cf(`applying transform of variant ${e} for experiment ${i} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(t=>{const i=t;s.html&&(i.innerHTML=s.html),s.css&&i.setAttribute("style",s.css)})}}):t.Cf("Control variants leave the page unmodified.")}_is_bot(){return Ht&&this._instance?ya(Ht,this.Mr.custom_blocked_useragents):void 0}}},Oh),Bh={conversations:class{constructor(t){this._instance=t,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Of=t.ok,!t.ok)return;const i=t.config.conversations;bi(i)||($i(i)?this.Rf=i:(this.Rf=i.enabled,this.ne=i),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Af)return;if(this._instance.config.disable_conversations)return;if(Wn(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==Zt?void 0:Zt.__PosthogExtensions__;if(t&&!pi(this.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const i=t.initConversations;if(i)return this.Df(i),void(this.Af=!1);const e=t.loadExternalDependency;if(!e)return void this.Lf(Rt);e(this._instance,"conversations",i=>{i||!t.initConversations?this.Lf("Could not load conversations script",i):this.Df(t.initConversations),this.Af=!1})}catch(t){this.Lf("Error initializing conversations",t),this.Af=!1}}else vh.error("Conversations enabled but missing token in remote config.")}Df(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Ff=!1,vh.info("Conversations loaded successfully")}catch(t){this.Lf("Error completing conversations initialization",t)}else vh.error("Cannot complete initialization: remote config is null")}Lf(t,i){vh.error(t,i),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():vh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rf&&!mi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Wn(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":pi(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?bi(this.ne)||!this.ne.token?"missing_token":(null==Zt?void 0:Zt.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"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 Ai(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(vh.warn(fh),null)})()}getMessages(t,i){var e=this;return Ai(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(vh.warn(fh),null)})()}markAsRead(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(vh.warn(fh),null)})()}getTickets(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(vh.warn(fh),null)})()}requestRestoreLink(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(vh.warn(fh),null)})()}restoreFromToken(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(vh.warn(fh),null)})()}restoreFromUrlToken(){var t=this;return Ai(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(vh.warn(fh),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}dh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}fh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Uh={logs:class{constructor(t){var i;this._instance=t,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=Mn("[logs]"),this.Bf=ls(ls({},this.$),{},{error:(...t)=>{t.some(wh)||this.$.error(...t)}}),this.ia=[],this.Hf=[],this.Yc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var t,i;this.So||(this.Yc=0,null===(t=this.Zf)||void 0===t||t.onReconnect(),null===(i=this.Qf)||void 0===i||i.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.Nf=!0),Ut&&Vn(Ut,"online",this.Gf)}Jf(t,i,e,s){var n;const r=ph(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,e);return[new Pn(this.Kf(t,i),r,this.Bf,()=>this.Xf(),t=>t(),void 0,s),r]}Yf(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var e;return this.Zf&&this.tp===i||(null===(e=this.Zf)||void 0===e||e.reset(),this.tp=i,[this.Zf,this.ep]=this.Jf(()=>this.ia,t=>{this.ia=t})),this.Zf}np(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var e;return this.Qf&&this.sp===i||(null===(e=this.Qf)||void 0===e||e.reset(),this.sp=i,[this.Qf,this.rp]=this.Jf(()=>this.Hf,t=>{this.Hf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},mh)),this.Qf}setup(t){var i;if(this.So)return;this.po=t,(null===(i=this._instance)||void 0===i||null===(i=i.config)||void 0===i||null===(i=i.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();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.So?s.dispose():(this.$o=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s;this.So||(this.So=!0,this.up(),null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==Ut||Ut.removeEventListener("online",this.Gf),null===(i=this.hp)||void 0===i||i.call(this),this.hp=void 0,null===(e=this.Zf)||void 0===e||e.reset(),null===(s=this.Qf)||void 0===s||s.reset())}onRemoteConfig(t){var i,e;if(this.So)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;bi(s)?this.cp():(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$logs_capture_enabled_server_side:!!s}),s?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var t,i,e,s;this.up(),null===(t=this.Zf)||void 0===t||t.clearQueue(),this.ia=[],null===(i=this.Zf)||void 0===i||i.reset(),null===(e=this.Qf)||void 0===e||e.clearQueue(),this.Hf=[],null===(s=this.Qf)||void 0===s||s.reset(),this.Yc=0}captureLog(t){this.So||this.Yf().captureLog(t)}captureConsoleLog(t){this.So||this.np().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.So||this.np().captureLog(t,{context:i,occurredAtMs:e})}lp(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[y])}op(){var t,i,e;return!(null===(t=this._instance)||void 0===t||null===(i=t.Xl)||void 0===i?void 0:i.call(t))||!!(null===(e=Zt._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config)}gh(){var t;this.up(),null===(t=this.Qf)||void 0===t||t.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var t;if(this.Wf||!(null==Zt?void 0:Zt.console))return;const i=ph(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let e=!0;this.Uf.push(()=>{e=!1});for(const t of _h){let s;try{s=gh(Zt.console[t])}catch(t){continue}s&&this.Uf.push(yu(Zt.console,t,n=>{const r=(...s)=>{try{e&&this.dp(t,s,i)}catch(t){}return n.apply(Zt.console,s)};return r.__rrweb_original__=s,r}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(t,i,e){var s;if(this.Wf&&!this.Vf&&0!==i.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(e>this.zf.length){this.Vf=!0;try{this.zf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Xf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const t of this.Uf)t();this.Uf=[]}}fp(){const t=this.zf;return this.up(),t}get logger(){return this.pp||(this.pp={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.pp}flushLogs(t){t?this.gp(t):(this.Zf&&this.Zf.flush().catch(t=>this.mp(t)),this.Qf&&this.Qf.flush().catch(t=>this.mp(t)))}mp(t){wh(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const t=null==Zt?void 0:Zt.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.up();const i=t.loadExternalDependency;if(!i)return this.$.error(Rt),void this.up();this.jf=!0;try{i(this._instance,"logs",i=>{if(this.jf=!1,this.So||!this.Nf)return;const e=t.logs;if(i||!(null==e?void 0:e.initializeLogs))this.$.error("Could not load logs script",i),this.up();else{var s;const t=this.fp();var n,r;this.hp=e.initializeLogs(null!==(s=this.po)&&void 0!==s?s:this._instance),this.qf=!0,t.length>0&&(null===(n=e.replayConsoleBuffer)||void 0===n||n.call(e,null!==(r=this.po)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.jf=!1,t}}Kf(t,i){const s=this._instance;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},getPersistedProperty:i=>i===ti.LogsQueue?t():void 0,setPersistedProperty(t,e){var s;t===ti.LogsQueue&&i(null!==(s=e)&&void 0!==s?s:[])},js:t=>this.js(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}js(t){return new Promise(i=>{if(To(this.Yc,3))return void i({kind:"fatal",error:yh(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:yh(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const i=t.statusCode;if(this.bp(i),i>=200&&300>i)s({kind:"ok"});else if(413===i)s({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)s({kind:"fatal",error:new Error(`logs request failed with status ${i}`)});else{var e;0===i?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:yh(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`logs request failed with status ${i}`)})}}})})}bp(t){(0!==t||this._instance.__loaded)&&(this.Yc=Po(t,this.Yc,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}gp(t){this.ia.length>0&&this._p(t,this.ia,this.ep,e.LIB_NAME,t=>{this.ia=t}),this.Hf.length>0&&this._p(t,this.Hf,this.rp,mh,t=>{this.Hf=t})}_p(t,i,s,n,r){if(0===i.length)return;const o=i.map(t=>t.record);r([]);const l=xn(o,Sn(s,e.LIB_NAME,e.LIB_VERSION),n,e.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:l,compression:"best-available",batchKey:"logs",transport:t})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Xf(){var t;const i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:e,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=t,i.windowId=e,bi(s)||(i.sessionStartTimestamp=s),bi(n)||(i.lastActivityTimestamp=n)}if((null==Zt||null===(t=Zt.location)||void 0===t?void 0:t.href)&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?Je(Zt.location.href):Zt.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(i.activeFeatureFlags=t)}return i}}},zh={metrics:class{constructor(t){this._instance=t,this.$=Mn("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.So)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.wp?this.wp=(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=Ph(t,e),n=Ch(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.wp&&(this.wp(),this.wp=void 0)}Yf(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.Zf&&this.tp===i||(null===(e=this.Zf)||void 0===e||e.reset(),this.tp=i,this.Zf=new In(this.Kf(),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),this.$)),this.Zf}count(t,i=1,e){this.Yf().count(t,i,e)}gauge(t,i,e){this.Yf().gauge(t,i,e)}histogram(t,i,e){this.Yf().histogram(t,i,e)}flush(t){if(!this.Zf)return Promise.resolve();if(t){const i=this.Zf.drainWindow();return i&&this.Ys(i,t),Promise.resolve()}return this.Zf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Zf)||void 0===t||t.reset()}dispose(){var t,i;this.So=!0,null===(t=this.wp)||void 0===t||t.call(this),this.wp=void 0,null===(i=this.Zf)||void 0===i||i.reset()}Kf(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>i.Ys(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}Ys(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(ls(ls({method:"POST",url:this.kp(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{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}`)})}}}))})}kp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};au.__defaultExtensionClasses=ls({},ls(ls(ls(ls(ls(ls(ls(ls(ls(ls(ls(ls(ls({},Oh),Rh),Ih),Fh),Ah),Mh),Nh),Dh),jh),Lh),Bh),Uh),zh));const Hh=Mn("[ExternalScriptsLoader]"),qh=t=>{const i=null==qt?void 0:qt.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]},Vh=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Hh.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const s=qh(i);if(s){if(s.__posthog_loading_callback_fired)return e();const t=s.__posthog_loading_error;return t?e(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,e(t)}))}const n=()=>{if(!qt)return e("document not found");if(qh(i))return Vh(t,i,e);let s=qt.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)qt.head.appendChild(s);else{const t=qt.querySelectorAll("body > script");var n;t.length>0?null===(n=t[0].parentNode)||void 0===n||n.insertBefore(s,t[0]):qt.body.appendChild(s)}};(null==qt?void 0:qt.body)?n():null==qt||qt.addEventListener("DOMContentLoaded",n)},Wh={},Gh=(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)};Zt.__PosthogExtensions__=Zt.__PosthogExtensions__||{},Zt.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Vh(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Wh[n];if("fallback"===s&&r){if(qh(r))return void Vh(t,r,e);delete Wh[n]}return void Vh(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=Gh(t,i);Wh[n]=s;const r=qh(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Vh(t,s,e)}else e(void 0,r)}:e)}Vh(t,Gh(t,i),e)},Zt.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);Vh(t,s,e)};const Kh=function(){e.SDK_DIST_CHANNEL="npm";const t=Va[iu]=new au;return function(){function t(){t.done||(t.done=!0,eu=!1,Nn(Va,function(t){t._dom_loaded()}))}(null==qt?void 0:qt.addEventListener)?"complete"===qt.readyState?t():Vn(qt,"DOMContentLoaded",t,{capture:!1}):Ut&&An.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=il,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=ol,exports.PostHog=au,exports.ProductTourEventName=al,exports.ProductTourEventProperties=ul,exports.SurveyEventName=nl,exports.SurveyEventProperties=rl,exports.SurveyEventType=el,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=sl,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Kh,exports.posthog=Kh,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="0.8.3",i={DEBUG:(!1,!1),LIB_VERSION:(t,"1.431.3"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:t};var e=i;const s="$people_distinct_id",n="distinct_id",r="$device_id",o="$device_model",l="__alias",a="__cmpns",u="$fbc",h="$fbc_persistence",d="__timers",c="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",f="$exception_capture_enabled_server_side",p="$error_tracking_suppression_rules",_="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",m="$dead_clicks_enabled_server_side",b="$product_tours_enabled_server_side",y="$logs_capture_enabled_server_side",w="$web_vitals_allowed_metrics",S="$session_recording_remote_config",x="$session_recording_enabled_server_side",E="$replay_sample_rate",k="$replay_override_sampling",T="$replay_override_linked_flag",P="$replay_override_url_trigger",C="$replay_override_event_trigger",O="$sesid",R="$session_is_sampled",I="$session_past_minimum_duration",F="$session_recording_url_trigger_activated_session",A="$session_recording_event_trigger_activated_session",M="$debug_first_full_snapshot_timestamp",D="$sess_rec_flush_size",N="$enabled_feature_flags",j="$active_feature_flags",L="$early_access_features",B="$feature_flag_details",U="$feature_flag_payloads",z="$feature_flag_request_id",H="$minimal_flag_called_events",q="$override_feature_flags",V="$override_feature_flag_payloads",W="$stored_person_properties",G="$stored_group_properties",K="$groups",J="$surveys",Y="$surveys_loaded_at",X="$surveys_activated",Q="$surveys_activated_session",Z="$surveys_activated_timestamps",tt="ph_product_tours",it="$product_tours_activated",et="$product_tours_activated_session",st="$conversations_widget_session_id",nt="$conversations_ticket_id",rt="$conversations_widget_state",ot="$conversations_user_traits",lt="$flag_call_reported",at="$flag_call_reported_session_id",ut="$feature_flag_errors",ht="$feature_flag_evaluated_at",dt="$user_state",ct="$client_session_props",vt="$capture_rate_limit",ft="$initial_campaign_params",pt="$initial_referrer_info",_t="$initial_person_info",gt="$epp",mt="$posthog_cookieless",bt="$cookieless_mode",yt="$sdk_debug_extensions_init_method",wt="$sdk_debug_extensions_init_time_ms",$t="$sdk_debug_recording_script_not_loaded",St="$sdk_debug_replay_event_trigger_status",xt="$sdk_debug_replay_linked_flag_trigger_status",Et="$sdk_debug_replay_matched_recording_trigger_groups",kt="$sdk_debug_replay_pending_trigger_conditions",Tt="$sdk_debug_replay_remote_trigger_matching_config",Pt="$sdk_debug_replay_trigger_groups_count",Ct="$sdk_debug_replay_url_trigger_status",Ot="$session_recording_start_reason",Rt="PostHog loadExternalDependency extension not found.",It="anonymous",Ft="identified",At="identified_only",Mt="visibilitychange",Dt="beforeunload",Nt="$pageview",jt="$pageleave",Lt="$identify",Bt="$groupidentify",Ut="u">typeof window?window:void 0,zt="u">typeof globalThis?globalThis:Ut,Ht=null==zt?void 0:zt.navigator,qt=null==zt?void 0:zt.document,Vt=null==zt?void 0:zt.location,Wt=null==zt?void 0:zt.fetch,Gt=(null==zt?void 0:zt.XMLHttpRequest)&&"withCredentials"in new zt.XMLHttpRequest?zt.XMLHttpRequest:void 0,Kt=null==zt?void 0:zt.AbortController,Jt=null==zt?void 0:zt.CompressionStream,Yt=null==Ht?void 0:Ht.userAgent;function Xt(){return!(!Ut||!1===Ut.navigator.onLine)}const Qt="undefined"!=typeof globalThis?globalThis:Ut;Qt&&"undefined"==typeof self&&(Qt.self=Qt),Qt&&"undefined"==typeof File&&(Qt.File=function(){});const Zt=null!=Ut?Ut:{};var ti=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),ii=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ei=["$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"],si=["token"];function ni(t,i){return-1!==t.indexOf(i)}const ri=function(t){return t.trim()},oi=function(t){return t.replace(/^\$/,"")};function li(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 ai=Object.prototype,ui=ai.hasOwnProperty,hi=ai.toString,di=Array.isArray||function(t){return"[object Array]"===hi.call(t)},ci=t=>"function"==typeof t,vi=t=>t===Object(t)&&!di(t),fi=t=>{if(vi(t)){for(const i in t)if(ui.call(t,i))return!1;return!0}return!1},pi=t=>void 0===t,_i=t=>"[object String]"==hi.call(t),gi=t=>_i(t)&&0===t.trim().length,mi=t=>null===t,bi=t=>pi(t)||mi(t),yi=t=>"[object Number]"==hi.call(t)&&t==t,wi=t=>yi(t)&&t>0,$i=t=>"[object Boolean]"===hi.call(t),Si=t=>ni(ei,t),xi=t=>ni(si,t);function Ei(t){return null===t||"object"!=typeof t}function ki(t,i){return{}.toString.call(t)===`[object ${i}]`}function Ti(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 Ci(t,Error)}}function Pi(t){return"u">typeof Event&&Ci(t,Event)}function Ci(t,i){try{return t instanceof i}catch(t){return!1}}const Oi=[!0,"true",1,"1","yes"],Ri=t=>ni(Oi,t),Ii=[!1,"false",0,"0","no"];function Fi(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 Ai(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){Fi(r,s,n,o,l,"next",t)}function l(t){Fi(r,s,n,o,l,"throw",t)}o(void 0)})}}const Mi=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Di=function(t,i=[]){if(!t)return!1;const e=t.toLowerCase();return Mi.concat(i).some(t=>{const i=t.toLowerCase();return-1!==e.indexOf(i)})};function Ni(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),yi(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),Ni(null!=n?n:e,i,e,s))}var ji=class{constructor(t){this.C={},this.I=t.I,this.R=Ni(t.bucketSize,0,100,t.$),this.A=Ni(t.refillRate,0,this.R,t.$),this.O=Ni(t.refillInterval,0,864e5,t.$)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.O);e>0&&(t.tokens=Math.min(t.tokens+e*this.A,this.R),t.lastAccess=t.lastAccess+e*this.O)}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.R,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 Li="Mobile",Bi="Android",Ui="Tablet",zi="Android Tablet",Hi="iPad",qi="Apple Watch",Vi="Safari",Wi="BlackBerry",Gi="Samsung Internet",Ki="Chrome",Ji="Chrome iOS",Yi="Internet Explorer",Xi="Internet Explorer Mobile",Qi="Opera",Zi="Microsoft Edge",te="Firefox",ie="Firefox iOS",ee="Nintendo",se="PlayStation",ne="Xbox",re="Android Mobile",oe="Mobile Safari",le="Windows",ae="Windows Phone",ue="Nokia",he="Ouya",de="Generic "+Li.toLowerCase(),ce="Generic "+Ui.toLowerCase(),ve="Konqueror",fe="Oculus Browser",pe="Vivaldi",_e="Yandex",ge="Whale",me="DuckDuckGo",be="Pale Moon",ye="Waterfox",we="Brave",$e="Claude",Se="Codex",xe="ChatGPT",Ee="Google Search App",ke=new RegExp("Version/(\\d+(\\.\\d+)?)"),Te=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Pe=new RegExp(ne,"i"),Ce=new RegExp("PlayStation \\w+","i"),Oe=new RegExp("Nintendo \\w+","i"),Re=new RegExp("BlackBerry|PlayBook|BB10","i"),Ie={"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"},Fe=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?we:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&ni(t,"GSA/")?Ee:ni(t," OPR/")&&ni(t,"Mini")?"Opera Mini":ni(t," OPR/")?Qi:Re.test(t)?Wi:ni(t,"IEMobile")||ni(t,"WPDesktop")?Xi:ni(t,"OculusBrowser")?fe:ni(t,"SamsungBrowser")?Gi:ni(t,"Edge")||ni(t,"Edg/")?Zi:ni(t,"Vivaldi/")?pe:ni(t,"YaBrowser/")?_e:ni(t,"Whale/")?ge:ni(t,"DuckDuckGo/")||ni(t,"Ddg/")?me:ni(t,"Claude/")?$e:ni(t,"Codex/")?Se:ni(t,"ChatGPT/")?xe:ni(t,"FBIOS")?"Facebook Mobile":ni(t,"UCWEB")||ni(t,"UCBrowser")?"UC Browser":ni(t,"CriOS")?Ji:ni(t,"CrMo")||ni(t,Ki)?Ki:ni(t,Bi)&&ni(t,Vi)?re:ni(t,"FxiOS")?ie:ni(t.toLowerCase(),ve.toLowerCase())?ve:ni(t,"Brave/")?we:((t,i)=>i&&ni(i,"Apple")||function(t){return ni(t,Vi)&&!ni(t,Ki)&&!ni(t,Bi)}(t))(t,i)?ni(t,Li)?oe:Vi:ni(t,"PaleMoon/")?be:ni(t,"Waterfox/")?ye:ni(t,te)?te:ni(t,"MSIE")||ni(t,"Trident/")?Yi:ni(t,"Gecko")?te:"")},Ae={[Xi]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ki]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Ji]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Vi]:[ke],[oe]:[ke],[Qi]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ie]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ve]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Wi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ke],[re]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Gi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[fe]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[pe]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[ge]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[$e]:[Te],[Se]:[Te],[xe]:[Te],[me]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Yi]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Me=function(t,i,e,s){const n=Fe(t,i,e,s),r=Ae[n];if(pi(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},De=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[ne,t&&t[1]||""]],[new RegExp(ee,"i"),[ee,""]],[new RegExp(se,"i"),[se,""]],[Re,[Wi,""]],[new RegExp(le,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ae,""];if(new RegExp(Li).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Ie[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[le,t]}return[le,""]}],[/((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=pi(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Bi,[t[2],t[3],t[4]||"0"].join(".")]:[Bi,""]],[/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",""]]],Ne=function(t){for(let i=0;De.length>i;i++){const[e,s]=De[i],n=e.exec(t),r=n&&(ci(s)?s(n,t):s);if(r)return r}return["",""]},je=function(t){return Oe.test(t)?ee:Ce.test(t)?se:Pe.test(t)?ne:new RegExp(he,"i").test(t)?he:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ae:/iPad/.test(t)?Hi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?qi:Re.test(t)?Wi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ue,"i").test(t)?ue:/(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(Li).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)?Bi:zi:new RegExp("(pda|Mobile)","i").test(t)?de:new RegExp(Ui,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ce:""},Le=function(t,i){var e;const s=je(t);return s===Hi||s===zi||"Kobo"===s||"Kindle Fire"===s||s===ce?Ui:s===ee||s===ne||s===se||s===he?"Console":s===qi?"Wearable":s?Li:"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)?Li:Ui:"Desktop";var n,r,o},Be=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ue=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Be],[/\bFBAN\/EMA\b/i,"Facebook Lite",Be],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Be],[/\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"]],ze="[Truncated]",He="[Unserializable]";function qe(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 Ve(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=He}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const We=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ge(t,i){return"string"==typeof(e=t)&&We.test(e)?t:i();var e}function Ke(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 Je(t){return t?t.split("#")[0]:t}function Ye(t){try{return t()}catch(t){return}}function Xe(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function Qe(t,i,e){return Ze.apply(this,arguments)}function Ze(){return(Ze=Ai(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=Xe(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let ts,is,es;function ss(t){const i=globalThis._posthogChunkIds;if(!i)return;const e=Object.keys(i);return es&&e.length===is||(is=e.length,es=e.reduce((e,s)=>{ts||(ts={});const n=ts[s];if(n)e[n[0]]=n[1];else{const n=t(s);for(let t=n.length-1;t>=0;t--){const r=n[t],o=null==r?void 0:r.filename,l=i[s];if(o&&l){e[o]=l,ts[s]=[o,l];break}}}return e},{})),es}function ns(t){return ns="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},ns(t)}function rs(t,i,e){return(i=function(t){var i=function(t){if("object"!=ns(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=ns(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ns(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function os(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 ls(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?os(Object(e),!0).forEach(function(i){rs(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):os(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}var as=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 Ai(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&di(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){let e,s;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),ls(ls({},t),{},{cause:e,stack:s})}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 Ai(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){var e,s,n;const r={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(r.stacktrace={type:"raw",frames:t.stack});const o=[r];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,ls(ls({},i),{},{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:ss(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e=0){const s=(e,s)=>{if(4>=s){const n=this.buildCoercingContext(t,i,s);return this.applyCoercers(e,n)}};return ls(ls({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,e),next:t=>s(t,e+1)})}};const us=/^([a-z][a-z0-9.+-]+):/i,hs=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ds(t){if(!t||"<anonymous>"===t)return!1;const i=us.exec(t);return!i||hs.includes(i[1].toLowerCase())}function cs(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ds(i)};return pi(s)||(r.lineno=s),pi(n)||(r.colno=n),r}const vs=(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]},fs=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ps=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_s=/\((\S*)(?::(\d+))(?::(\d+))\)/,gs=(t,i)=>{const e=fs.exec(t);if(e){const[,t,s,n]=e;return cs(i,t,"?",+s,+n)}const s=ps.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=_s.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=vs(s[1]||"?",s[2]);return cs(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ms=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,bs=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ys=(t,i)=>{const e=ms.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=bs.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]=vs(s,t),cs(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ws=/\(error: (.*)\)/;function $s(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Ss(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(!$s(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 xs(t,i){const e=i.start+i.length,s=ks(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function Es(t,i){let e=i.start;for(;e>0&&$s(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function ks(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&$s(t[s],t[s-i.length]);)s++;return s-e}function Ts(t,i){const e=i[0];let s=t.length-(e?Es(t,e):0);for(const e of i)s-=ks(t,e);return s}function Ps(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 Cs=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=_i(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 ki(t,"DOMException")}isDOMError(t){return ki(t,"DOMError")}},Os=class{match(t){return Ti(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:n}}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){return t.stacktrace||t.stack||void 0}},Rs=class{match(t){return!!ki(t,"ErrorEvent")&&(null!=t.error||this.lr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return ls(ls({},s),{},{stack:null!==(e=this.ur(t))&&void 0!==e?e:s.stack,synthetic:!0})}lr(t){return _i(t.message)&&t.message.length>0}ur(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(_i(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Is=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Fs=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(Is);return s&&(i=s[1],e=s[2]),[i,e]}};const As=["fatal","error","warning","log","info","debug"];function Ms(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return""}var Ds=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(Pi(t))return t.constructor.name;const i="name"in t?t.name:void 0;return _i(i)&&!gi(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: ${Ms(t)}`}isSeverityLevel(t){return _i(t)&&!gi(t)&&As.indexOf(t)>=0}getStack(t){try{return _i(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:_i(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(Ti(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ns=class{match(t){return Pi(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Ms(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},js=class{match(t){return Ei(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}}},Ls=class{match(t){return ki(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Pi(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 Ei(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 Bs="$message",Us="$timestamp",zs=new Set([Bs,Us]),Hs={enabled:!0,max_bytes:32768};function qs(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Hs.enabled,max_bytes:Ws(t.max_bytes,Hs.max_bytes)}:ls({},Hs)}var Vs=class{constructor(t){this.ts=[],this.es=0,this.Mr=qs(t)}setConfig(t){this.Mr=qs(t),this.ns()}add(t){const i=function(t){let i;try{i=li(t)}catch(t){return}try{const t=JSON.parse(i);if(!vi(t))return;const e=t,s=e[Bs],n=e[Us];if(!_i(s)||0===s.trim().length)return;if(!_i(n)&&!yi(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.Mr.max_bytes||(this.ts.push({step:i.step,bytes:e}),this.es+=e,this.ns())}getAttachable(){return this.ts.map(t=>t.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const t=this.ts.shift();t&&(this.es-=t.bytes)}}};function Ws(t,i){if(!yi(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const Gs=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Ks(t){return"string"==typeof t||t}function Js(t){return"string"==typeof t?t:void 0}const Ys=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Xs="NativeGzipValidationError",Qs=t=>t.length>=2&&31===t[0]&&139===t[1],Zs=(t,i)=>t===ii.GZipJS||i===ii.GZipJS||"gzip"===i,tn=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let en;const sn=t=>{throw Ke(Xs,`Native gzip produced invalid output: ${t}`)},nn=(rn=Ai(function*(t,i){18>t.size&&sn("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Qs(e)&&8===e[2]||sn("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,!0)!==(t=>{const i=(()=>{if(en)return en;en=[];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;en[t]=i>>>0}return en})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&sn("invalid-crc");const n=i.length>>>0;s.getUint32(4,!0)!==n&&sn("invalid-size")}),function(t,i){return rn.apply(this,arguments)});var rn;function on(){return on=Ai(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=Ai(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 nn(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}),on.apply(this,arguments)}const ln=3e5;var an=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,ln);if(!i)return this.ss=e,void(this.rs=e+s);this.rs=Math.max(this.rs,Math.min(e+s,this.ss+ln))}remainingMs(){const t=Date.now();if(this.ss-5e3>t)return this.reset(),0;const i=Math.min(ln,Math.max(0,this.rs-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function un(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 hn={}.propertyIsEnumerable;function dn(t,i){try{return fn(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function cn(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:ze};if(e.remainingNodes--,$i(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:qe(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:ze};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?qe(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return cn(n.call(t),i,e,s+1)}catch(t){}return di(t)?{arrayValue:{values:vn(t,i,e,s+1)}}:{kvlistValue:{values:fn(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:qe(String(t))}}function vn(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(bi(r))continue;n.push(cn(r,i,e,s))}catch(t){n.push({stringValue:He})}return t.length>o&&n.push({stringValue:ze}),n}function fn(t,i,e,s){const n=[];for(const r in t)if(hn.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(mi(o)||pi(o))continue;n.push({key:qe(r),value:cn(o,i,e,s)})}catch(t){n.push({key:qe(r),value:{stringValue:He}})}}return n}function pn(t,i,e){return ls(ls(ls(ls({},Ve({},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 _n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function gn(t,i){const e=Ve({},t),s={};for(const t of _n)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...dn(e,i),...dn(s,i)]}const mn={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 bn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},yn=bn.info;function wn(t){try{return qe(String(t))}catch(t){return He}}function $n(t,i,e,s){const n=t.level||"info",{text:r,number:o}=bn[n]||yn,l=function(t=Date.now()){return String(t)+"000000"}(yi(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),bi(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),bi(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=ls({},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=He}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:wn(t.body)},attributes:dn(u,e)};return t.trace_id&&(d.traceId=t.trace_id),t.span_id&&(d.spanId=t.span_id),pi(t.trace_flags)||(d.flags=t.trace_flags),d}function Sn(t,i,e){return pn(t,i,e)}function xn(t,i,e,s){return{resourceLogs:[{resource:{attributes:gn(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var En=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=Xe(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function kn(){return.75+.5*Math.random()}function Tn(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 Pn=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Mr=i,this.$=e,this.cs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new En(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new an,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Ms=i.flushIntervalMs,this.Es=i.maxBatchRecordsPerPost,this.Ps=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ti.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}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.Os(t);if(null===s)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:$n(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.cs(),this.$,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(t){const i=this.Mr.beforeSend;if(!i)return t;const e=di(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.$.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),i=t-this.xs;return this.Ps>i&&i>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return Ai(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return Ai(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(ti.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;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Es),l=e.slice(0,s),a=xn(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(a);if(t._s!==i)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.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.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(ti.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var i=this;return Ai(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(ti.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ti.LogsQueue,n.slice(s)),yield i.vs()})()}qs(){return Sn(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(ti.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ti.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Tn(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ti.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return Ai(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield Qe(e,t):yield e})()}flushWithTimeout(t){var i=this;return Ai(function*(){const e=i.flush();yield Qe(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=kn(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Cn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function On(t){return String(t)+"000000"}function Rn(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 In=class{constructor(t,i,e){this._instance=t,this.Mr=i,this.$=e,this.zs=new Map,this.ps=new En(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new an,this.ks=0,this.Ss=1,this.Gs=0}count(t,i=1,e){this.Zs({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.Zs({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.Zs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this;const i=this.ys,e=function(){var e=Ai(function*(){i&&(yield i.catch(()=>{})),yield t.Qs()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Os(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.$.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.$.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?ls({},i.attributes):void 0,s=Rn(i.type,i.name,i.unit,e)}catch(t){return void this.$.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.zs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.zs.set(s,n)}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.$.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,i.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(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":{t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Cn.length+1).fill(0)});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,Cn)]+=1;break}}}Os(t){const i=this.Mr.beforeSend;if(!i)return t;const e=di(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.$.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Tn(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return Ai(function*(){if(t.ps.clear(),0===t.zs.size)return;const i=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance.Ys(t.Js(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=kn()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),s.kind){case"ok":return;case"retry-later":return t.lo(i),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",s.error)}})()}Js(t){return i=this.ao(t),e=function(t,i,e){return pn(t,i,e)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gn(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}ao(t){const i=On(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Rn(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=ls({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=dn(null!==(s=o.attributes)&&void 0!==s?s:{},this.$),u=On(o.windowStartMs);if("count"===o.type){var n;const t={attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0};l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0};l.gauge.dataPoints.push(t)}else o.hist&&l.histogram.dataPoints.push({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Cn})}return Array.from(e.values())}lo(t){for(const[s,n]of t){const t=this.zs.get(s);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,n.windowStartMs),t.type){case"count":var i,e;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(t.hist){t.hist.count+=n.hist.count,t.hist.sum+=n.hist.sum,t.hist.min=Math.min(t.hist.min,n.hist.min),t.hist.max=Math.max(t.hist.max,n.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=n.hist.bucketCounts[i]}else t.hist=n.hist}else this.Ks()&&this.zs.set(s,n)}}};const Fn=(t,{debugEnabled:e}={})=>{const s={N(s,...n){Ut&&(i.DEBUG||Ut.POSTHOG_DEBUG||e)&&!pi(Ut.console)&&Ut.console&&("__rrweb_original__"in Ut.console[s]?Ut.console[s].__rrweb_original__:Ut.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)=>Fn(`${t} ${i}`,e)};return s},An=Fn("[PostHog.js]"),Mn=An.createLogger;function Dn(t,i){di(t)&&t.forEach(i)}function Nn(t,i){if(!bi(t))if(di(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)ui.call(t,e)&&i(t[e],e)}const jn=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Ln(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 Bn=function(t){return function(...i){try{return t.apply(this,i)}catch(t){An.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),An.critical(t)}}},Un=function(t){const i={};return Nn(t,function(t,e){(_i(t)&&t.length>0||yi(t))&&(i[e]=t)}),i};function zn(t){const i=ls({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const Hn=["herokuapp.com","vercel.app","netlify.app"];function qn(t){const i=null==t?void 0:t.hostname;if(!_i(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of Hn)if(e===t)return!1;return!0}function Vn(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 Wn(t){return"ph_toolbar_internal"===t.name}const Gn=t=>{if(qt){try{const i=t+"=",e=qt.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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return yi(t)&&isFinite(t)&&Math.floor(t)===t});var Kn=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}},Jn=class{generate(){const t=this.generateOrAbort();if(!pi(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(pi(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return yi(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return Kn.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new Xn}};let Yn=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};Ut&&!pi(Ut.crypto)&&crypto.getRandomValues&&(Yn=t=>crypto.getRandomValues(t));var Xn=class{nextUint32(){return this.Rt.length>this.$t||(Yn(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Qn;const Zn=()=>tr().toString(),tr=()=>(Qn||(Qn=new Jn)).generate();let ir="";const er=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let sr=null;const nr={Et(){if(!mi(sr))return sr;if(sr=!1,qt)try{const t=`__ph_cookie_support_${Zn()}`;nr.At(t,"xyz"),sr='"xyz"'===Gn(t),nr.Lt(t)}catch(t){sr=!1}return sr},Pt(t){An.error("cookieStore error: "+t)},Ot:Gn,Dt(t){let i;try{i=JSON.parse(nr.Ot(t))||{}}catch(t){}return i},At(t,i,e,s,n){if(!qt)return!1;try{let r="",o="";const l=function(t,i){if(i){let i=function(t,i=qt){if(ir)return ir;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_"+Zn();for(;!ir&&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",ir=t)}return ir}(t);if(!i){const e=(t=>{const i=t.match(er);return i?i[0]:""})(t);e!==i&&An.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(qt.location.hostname,s);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),r="; expires="+t.toUTCString()}n&&(o="; secure");const a=t+"="+encodeURIComponent(JSON.stringify(i))+r+"; SameSite=Lax; path=/"+l+o;return a.length>3686.4&&An.warn("cookieStore warning: large cookie, len="+a.length),qt.cookie=a,!0}catch(t){return!1}},Lt(t,i){if(null==qt?void 0:qt.cookie)try{nr.At(t,"",-1,i)}catch(t){return}}};let rr=null;const or={Et(){if(!mi(rr))return rr;let t=!0;if(pi(Ut))t=!1;else try{const i="__mplssupport__";or.At(i,"xyz"),'"xyz"'!==or.Ot(i)&&(t=!1),or.Lt(i)}catch(i){t=!1}return t||An.error("localStorage unsupported; falling back to cookie store"),rr=t,t},Pt(t){An.error("localStorage error: "+t)},Ot(t){try{return null==Ut?void 0:Ut.localStorage.getItem(t)}catch(t){or.Pt(t)}return null},Dt(t){try{return JSON.parse(or.Ot(t))||{}}catch(t){}return null},At(t,i){try{return null==Ut||Ut.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){or.Pt(t)}return!1},Lt(t){try{null==Ut||Ut.localStorage.removeItem(t)}catch(t){or.Pt(t)}}},lr=[W,j,N,B,U,z,ht,ut,lt],ar=[r,n,O,R,gt,_t,h,dt],ur=t=>t+"_cpm",hr=["__proto__","constructor","prototype"],dr=t=>{if(!vi(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===hr.indexOf(e)&&(i[e]=t[e])}),i},cr=(t,i=[])=>{const e={};return[...ar,...i].forEach(i=>{const s=t[i];pi(s)||mi(s)||""===s||(e[i]=s)}),e},vr=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)},fr=(t,i)=>({p:i,f:vr(JSON.stringify(t))}),pr=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=nr.Dt(ur(t)),s=(null==e?void 0:e.f)===vr(i)&&di(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},_r=(t,i)=>i+"|"+(nr.Ot(ur(t))||""),gr={},mr={Et:()=>!0,Pt(t){An.error("memoryStorage error: "+t)},Ot:t=>t in gr?gr[t]:null,Dt:t=>t in gr?gr[t]:null,At:(t,i)=>(gr[t]=i,!0),Lt(t){delete gr[t]}};let br=null;const yr={Et(){if(!mi(br))return br;if(br=!0,pi(Ut))br=!1;else try{const t="__support__";yr.At(t,"xyz"),'"xyz"'!==yr.Ot(t)&&(br=!1),yr.Lt(t)}catch(t){br=!1}return br},Pt(t){An.error("sessionStorage error: ",t)},Ot(t){try{return null==Ut?void 0:Ut.sessionStorage.getItem(t)}catch(t){yr.Pt(t)}return null},Dt(t){try{return JSON.parse(yr.Ot(t))||null}catch(t){}return null},At(t,i){try{return null==Ut||Ut.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){yr.Pt(t)}return!1},Lt(t){try{null==Ut||Ut.sessionStorage.removeItem(t)}catch(t){yr.Pt(t)}}};var wr=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){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 Ao(){const t=this.Fo.Ot(this.Oo);return Ri(t)?1:ni(Ii,t)?0:-1}get Fo(){const t=this.Mr.opt_out_capturing_persistence_type,i="localStorage"===t?or:nr,e=i.Et()?i:mr;if(!this.Do||this.Do!==e){this.Do=e;const i="localStorage"===t?nr:or;i.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(Ri(i.Ot(this.Oo))),i.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==Ht?void 0:Ht.doNotTrack,null==Ht?void 0:Ht.msDoNotTrack,Zt.doNotTrack,null==Ht?void 0:Ht.globalPrivacyControl].some(t=>Ri(t))}};function $r(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!ci(s))return i;try{const t=s(i);return _i(t)&&t?t:i}catch(t){return An.error("Error in get_current_url, falling back to window.location.href",t),i}}function Sr(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 xr(t){return!!t&&1===t.nodeType}function Er(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function kr(t){return!!t&&3===t.nodeType}function Tr(t){return!!t&&11===t.nodeType&&xr(t.host)}function Pr(t){return t?ri(t).split(/\s+/):[]}function Cr(t,i){const e=function(t){var i;const e=null==Ut||null===(i=Ut.location)||void 0===i?void 0:i.href;return pi(e)?void 0:$r(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Or(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 Pr(i)}function Rr(t){return bi(t)?null:ri(t).split(/(\s+)/).filter(t=>eo(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ir(t){let i="";return Gr(t)&&!Kr(t)&&t.childNodes&&t.childNodes.length&&Nn(t.childNodes,function(t){var e;kr(t)&&t.textContent&&(i+=null!==(e=Rr(t.textContent))&&void 0!==e?e:"")}),ri(i)}function Fr(t){var i;return pi(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Ar=["a","button","form","input","select","textarea","label"];function Mr(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 Dr(t,i){if(pi(i))return!0;for(const e of t)if(i.some(t=>Mr(e,t)))return!0;return!1}function Nr(t){const i=t.parentNode;return!(!i||!xr(i))&&i}const jr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Lr=["next","previous","prev",">","<"],Br=[...Lr,"+","-","−","–"],Ur=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,zr=[".ph-no-rageclick",".ph-no-capture"],Hr=["","text","search","email","password","url","tel","number"];function qr(t,i){if(!Ut||Vr(t))return!1;let e,s,n;var r,o;if($i(i)?(e=!!i&&zr,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:zr,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||!xr(t))&&(!!Er(t,"textarea")||(Er(t,"input")?ni(Hr,(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}=Wr(t,!1);return!function(t,i){if(!1===t||pi(t))return!1;let e;if(!0===t)e=Lr;else{if(!di(t))return!1;if(t.length>10)return An.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(({safeText:t,ariaLabel:i})=>e.some(e=>Ur(t,e)||Ur(i,e)))}(s,l.map(t=>{var i;return{safeText:Ir(t).toLowerCase(),ariaLabel:(null===(i=t.getAttribute("aria-label"))||void 0===i?void 0:i.toLowerCase().trim())||""}}))&&!Dr(l,e)}const Vr=t=>!t||Er(t,"html")||!xr(t),Wr=(t,i)=>{if(!Ut||Vr(t))return{parentIsUsefulElement:!1,targetElementList:[]};let e=!1;const s=[t];let n=t;for(;n.parentNode&&!Er(n,"body");){if(Tr(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}const t=Nr(n);if(!t)break;if(i||Ar.indexOf(t.tagName.toLowerCase())>-1)e=!0;else try{const i=Ut.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(e=!0)}catch(t){}s.push(t),n=t}return{parentIsUsefulElement:e,targetElementList:s}};function Gr(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!Er(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return!1;i.add(s);const t=Or(s);if(ni(t,"ph-sensitive")||ni(t,"ph-no-capture"))return!1}if(ni(Or(t),"ph-include"))return!0;const s=t.type||"";if(_i(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=t.name||t.id||"";return!_i(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Kr(t){return!!(Er(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Er(t,"select")||Er(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Jr=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}))$"),Yr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Xr=[16,15,14,13],Qr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Zr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),to=/[0-9A-Za-z_]/;function io(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 eo(t,i=!0){if(bi(t))return!1;if(_i(t)){if(t=ri(t),i?Jr.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(Yr.lastIndex=0;i=Yr.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 Xr){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(Jr.test(i)&&io(i))return!0}}}return!1}(t))return!1;if(i?Qr.test(t):function(t){let i;for(Zr.lastIndex=0;i=Zr.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&to.test(t)&&to.test(e)))return!0}return!1}(t))return!1}return!0}function so(t){let i=Ir(t);return i=`${i} ${no(t)}`.trim(),eo(i)?i:""}function no(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Nn(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Ir(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${no(t)}`.trim())}catch(t){An.error("[AutoCapture]",t)}}),i}function ro(t){return t.replace(/"|\\"/g,'\\"')}function oo(t){const i=t.attr__class;if(i)return di(i)?i:Pr(i)}const lo=Mn("[Dead Clicks]"),ao=()=>!0,uo=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(m)),s=t.instance.config.capture_dead_clicks;return $i(s)?s:!!vi(s)||e};var ho=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}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({[m]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?lo.error("failed to load script",i):t()})}qo(){var t;if(qt){if(!this.Lo&&(null===(t=Zt.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=vi(this.instance.config.capture_dead_clicks)?ls({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=Zt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(qt),lo.info("starting...")}}else lo.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,lo.info("stopping..."))}};const co=Mn("[SegmentIntegration]");function vo(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>ci(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Zn();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(dt,Ft)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&ci(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||co.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()||(co.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(co.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!bi(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))ui.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=di(t)?t:[t];let s=ls({},i);for(const t of e)try{if(s=t(s),bi(s))return null}catch(t){return co.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(bi(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,Nt)},identify(t){return s(t,Lt)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{co.error("Failed to register the Segment integration",t),i()})},e)}const fo="posthog-js";function po(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,d;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const c=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=c,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=>ls(ls({},t),{},{stacktrace:t.stacktrace?ls(ls({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>ls(ls({},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===(d=v[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var _;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(_=t.exceptions)||void 0===_||_.sendExceptionEvent(p)),o}}var _o=class{constructor(t,i,e,s,n,r){this.name=fo,this.setupOnce=function(o){o(po(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},go=class{constructor(t){this.jo=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(An.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.jo)}destroy(){var t;null===(t=this.zo)||void 0===t||t.call(this),this.zo=void 0}doPageView(t,i){var e;const s=this.Uo(t,i);return this.Bo={pathname:null!==(e=null==Ut?void 0:Ut.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.Uo(t,null===(i=this.Bo)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Bo)||void 0===t?void 0:t.pageViewId}}Uo(t,i){const e=this.Bo;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(!(pi(t)||pi(i)||pi(e)||pi(r)||pi(o)||pi(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?Ni(i/t,0,1,An):1,a=t>1?Ni(e/t,0,1,An):1,u=r>1?Ni(o/r,0,1,An):1,h=r>1?Ni(l/r,0,1,An):1;s=jn(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 mo=["flags","surveys"],bo={[s]:{exposure:"hidden"},[l]:{exposure:"hidden"},[a]:{exposure:"hidden"},[d]:{exposure:"hidden"},[h]:{exposure:"hidden"},[c]:{exposure:"event"},[v]:{exposure:"hidden"},[y]:{exposure:"hidden"},[f]:{exposure:"event"},[p]:{exposure:"hidden"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},[w]:{exposure:"event"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},[O]:{exposure:"hidden"},[R]:{exposure:"event"},[E]:{exposure:"event",shouldSkipFromEventProperties:t=>mi(t)},[I]:{exposure:"event"},[F]:{exposure:"event"},[A]:{exposure:"event"},[M]:{exposure:"event"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden",storageGroup:"flags"},[L]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"flags"},[U]:{exposure:"hidden",storageGroup:"flags"},[z]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[H]:{exposure:"hidden",storageGroup:"flags"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[J]:{exposure:"hidden",storageGroup:"surveys"},[Y]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[X]:{exposure:"event"},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[st]:{exposure:"event"},[nt]:{exposure:"event"},[rt]:{exposure:"event"},[ot]:{exposure:"event"},[lt]:{exposure:"hidden"},[at]:{exposure:"hidden"},[K]:{exposure:"event"},[ut]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[dt]:{exposure:"hidden"},[ct]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[k]:{exposure:"event"},[T]:{exposure:"event"},[P]:{exposure:"event"},[C]:{exposure:"event"},[yt]:{exposure:"event"},[wt]:{exposure:"event"},[$t]:{exposure:"event"},[St]:{exposure:"event"},[xt]:{exposure:"event"},[Et]:{exposure:"event"},[kt]:{exposure:"event"},[Tt]:{exposure:"event"},[Pt]:{exposure:"event"},[Ct]:{exposure:"event"},[Ot]:{exposure:"event"}},yo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],wo=t=>{const i=bo[t];if(i)return i;for(const[i,e]of yo)if(0===t.indexOf(i))return e},$o=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return Ti(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,zn(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return li(t)}},So=t=>{const i=null==qt?void 0:qt.createElement("a");return pi(i)?null:(i.href=t,i)},xo=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(!di(s)||2>s.length)return"";{let t=s[1];try{t=decodeURIComponent(t)}catch(i){An.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},Eo=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("=");di(s)&&(i.includes(s[0])?u.push(s[0]+"="+e):u.push(a[t]))}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},ko=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},To=(t,i)=>t>=i&&Xt(),Po=(t,i,e,s)=>{if(0===t){if(Xt()){const t=i+1;return t===e&&s(),t}return i}return 0},Co=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Co],Ro="<masked>",Io=["li_fat_id"];function Fo(t,i,e){if(!qt)return{};const s=i?[...Co,...e||[]]:[],n=Ao(Eo(qt.URL,s,Ro),t),r=function(){const t={};return Nn(Io,function(i){const e=Gn(i);t[i]=e||null}),t}();return jn(r,n)}function Ao(t,i){const e=Oo.concat(i||[]),s={};return Nn(e,function(i){const e=xo(t,i);s[i]=e||null}),s}function Mo(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(!mi(i)){s.$search_engine=i;const t=qt?xo(qt.referrer,e):"";t.length&&(s.ph_keyword=t)}return s}function Do(){return navigator.language||navigator.userLanguage}function No(){const t=Do();return"string"==typeof t?t.split("-")[0]:void 0}const jo="$direct";function Lo(){return(null==qt?void 0:qt.referrer)||jo}function Bo(t,i,e=!1){const s=t?[...Co,...i||[]]:[],n=e?Je(null==Vt?void 0:Vt.href):null==Vt?void 0:Vt.href,r=null==n?void 0:n.substring(0,1e3);return{r:Lo().substring(0,1e3),u:r?Eo(r,s,Ro):void 0}}function Uo(t,i=!1){var e;const{r:s,u:n}=t,r=i?Je(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==jo?jo:null===(e=So(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=So(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Ao(r);jn(o,i)}if(s){const t=Mo(s);jn(o,t)}return o}function zo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Ho(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const qo={flags:ht,surveys:Y},Vo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Wo=t=>`${t}_cookie_identity_change_pending`,Go=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},Ko="main",Jo=[N,j,B,U,z,ht,H,W],Yo=t=>-1!==Jo.indexOf(t),Xo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Qo=t=>{if(!t)return{};const i=JSON.parse(t);return vi(i)?i:{}},Zo=(t,i)=>{Nn(t,(e,s)=>{const n=wo(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var tl=class{constructor(t,i,e=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=t,this.nl=e,this.props={},this.sl=void 0,this.rl=(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.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&An.info("Persistence loaded",t.persistence,ls({},this.props)),this.update_config(t,t,i),this.save(),Ut){const t=()=>this.flush();Vn(Ut,"beforeunload",t,{capture:!1}),Vn(Ut,"pagehide",t,{capture:!1}),this.ul=t=>{if(this.Vo&&(!t.storageArea||t.storageArea===(null==Ut?void 0:Ut.localStorage))&&t.key)if(t.key!==this.rl){if(this.Zo){const i=mo.find(i=>t.key===this.hl(i));i&&this.cl(t.key,i)}}else this.cl(t.key,Ko)},Vn(Ut,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.Ko.get(t);if(!Yo(t)||!0===e)return;if(!0===i)return void this.dl(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.dl(t,s)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&Ut&&(Ut.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,i,e=!0){if(this.pi)return!1;let s,n;try{if(n=or.Ot(t),mi(n)){const t=this.vl(i);return t.storageValue=null,i!==Ko&&(t.persisted=!1),!1}s=Qo(n)}catch(t){return!1}const r=i===Ko?s:or.Dt(this.rl);if(r&&this.fl(r))return!1;const o=this.pl(s,i,e);return i===Ko&&this.Zo&&!Xo(this.gl().main,s)||this.ml(s,i,!0,n),o}fl(t){const i=this.props[n],e=t[n];return!pi(i)&&!pi(e)&&i!==e}ml(t,i,e,s){const n=this.vl(i);n.storageValue=s,i!==Ko&&(n.persisted=e);try{n.fingerprint=this.yl(t,i)}catch(t){n.fingerprint=void 0}}pl(t,i,e){let s=!1;return Jo.forEach(e=>{var n;const r=null===(n=wo(e))||void 0===n?void 0:n.storageGroup;if(i===Ko&&this.Zo&&r||i!==Ko&&r!==i)return;const o=e in t,l=this.bl(e,o?t[e]:void 0),a=this.Ko.has(e)?e in this.props:o;a===e in this.props&&Xo(l,this.props[e])||(a?this._l(e,l,!1):this.wl(e,!1),s=!0)}),s&&e&&this.il.forEach(t=>t()),s}kl(){if(!this.Vo)return!1;try{this.tl=!1;const t=or.Ot(this.rl),i=this.vl(Ko);let e,s=!1,n=!1;if(t!==i.storageValue)if(mi(t))i.storageValue=null;else{if(e=Qo(t),this.tl=!this.Yo&&this.fl(e),this.tl)return!1;n=this.pl(e,Ko,!1),!this.Zo||Xo(this.gl().main,e)?this.ml(e,Ko,!0,t):i.storageValue=t,s=!0}return this.Zo&&mo.forEach(t=>{const i=or.Ot(this.hl(t)),r=this.vl(t),o=e||{},l=s&&Jo.some(i=>{var e;return(null===(e=wo(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(mi(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.pl(o,t,!1)||n));const a=Qo(i);n=this.pl(a,t,!1)||n,this.ml(a,t,!0,i)}),n}catch(t){return!1}}dl(t,i){this.Ko.set(t,i);const e=wo(t);(null==e?void 0:e.volatile)||(this.vl((this.Zo?null==e?void 0:e.storageGroup:void 0)||Ko).fingerprint=void 0,this.Sl(t))}xl(){Jo.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{const t=or.Ot(this.rl),i=Qo(t);this.vl(Ko).storageValue=t,Jo.forEach(t=>{var e;const s=this.Zo?null===(e=wo(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?or.Ot(this.hl(s)):null;if(s){const t=this.vl(s);t.storageValue=n,t.persisted=!mi(n)}const r=s&&!mi(n)?Qo(n):i;t in this.props?this.Cl(t,r[t],this.props[t]):t in r&&this.dl(t,!0)})}catch(t){}}bl(t,i){const e=this.Ko.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(di(i)?i:[]),n=new Set(di(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=vi(i)?ls({},i):{},n=vi(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}Cl(t,i,e){if(!Yo(t))return;const s=this.Ko.get(t);if(!0===s)return;let n=i;if(this.Vo)try{var r;const i=this.Zo?null===(r=wo(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.hl(i):this.rl;n=Qo(or.Ot(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!pi(i)&&!di(i)||!pi(n)&&!di(n)||!di(e))return void this.dl(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(!vi(e))return void(Xo(n,e)?this.Ko.delete(t):this.dl(t,!0));{if(!pi(i)&&!vi(i)||pi(i)&&fi(e)&&pi(n))return void this.dl(t,!0);const s=vi(i)?i:{},r=vi(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&Xo(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&Xo(r[t],e[t])&&o.delete(t)})}}o.size?this.dl(t,o):this.Ko.delete(t)}$l(){var t;const i=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return yi(i)&&i>0?i:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const i=cr(t,this.Mr.cookie_persisted_properties||[]),e=fr(i,this.Mr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=nr.Ot(this.rl)||void 0;n&&_r(this.rl,n)===s&&(this.Il=s,this.Ml=n)}catch(t){}else try{const t=nr.Ot(this.rl)||void 0;this.Il=t?_r(this.rl,t):void 0,this.Ml=t}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,i=!1){if(this.pi&&!i||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=nr.Ot(this.rl)||void 0}catch(t){}if(!e||e===this.Ml)return!1;const s=_r(this.rl,e);let r;try{r=dr(JSON.parse(e))}catch(t){return!1}if((nr.Ot(this.rl)||void 0)!==e)return!1;this.Il=s,this.Ml=e;const o=pr(this.rl,e),a=[...ar,...o.properties],u={};if(Object.keys(r).forEach(t=>{const i=r[t];(pi(i)||mi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(u[t]=!0,delete r[t])}),fi(r))return!1;const h="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,d=this.props,c=d[n],v=d[dt],f=jn({},d);[...ar,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!u[t]&&(h||"distinct_id"!==t&&"$user_state"!==t)){const i=f[t];(o.isValid||-1===ar.indexOf(t)||!1!==i&&0!==i)&&delete f[t]}}),this.props=jn(f,r),Jo.forEach(t=>{const i=t in this.props;t in d===i&&Xo(d[t],this.props[t])||(i?this.Cl(t,d[t],this.props[t]):this.dl(t,!0))}),!h||"$user_state"in r||"$user_state"in this.props||this._l(dt,It);const p=this.props[n],_=this.props[dt];return!h||p===c&&_===v||(this.Yo=!0,this.Qo=!0,yr.At(Wo(this.rl),!0),this.wl(W),this.wl(j),this.wl(N),this.wl(B),this.wl(U),this.wl(z),this.wl(ht),this.wl(ut),this.wl(lt),"anonymous"!==_||"identified"!==v&&"anonymous"!==r.$user_state&&(pi(c)||p===c)||(Zo(this.props,r),this.wl(G)),"identified"===_?this.props.$user_id=p:delete this.props.$user_id,this.wl(l)),!0}consumeCookieIdentityChange(){const t=Wo(this.rl),i=this.Qo||!!yr.Ot(t);return this.Qo=!1,i&&yr.Lt(t),i}Pl(t=!1){return!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[Ko],this.Fl(!0))}Ol(t=!0){if(this.Jo)try{t?this.Rl():pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(t){-1===Vo.indexOf(t.persistence.toLowerCase())&&(An.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1)=>{const e=[...ar,...t];return ls(ls({},or),{},{Dt(t){try{let r,o={};try{r=nr.Ot(t)||void 0,o=r?dr(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(or.Ot(t)||"{}");let a;if(i){const i=pr(t,r),u=[...ar,...i.properties],h={};Object.keys(o).forEach(t=>{const i=o[t];mi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});const d="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var s;const t=l[n],r=null!==(s=l.$user_state)&&void 0!==s?s:It;e.forEach(t=>{if(-1!==u.indexOf(t)&&!(t in o)&&(d||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===ar.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!d||"$user_state"in o||"$user_state"in l||(l[dt]=It),!d||("distinct_id"in h?h[n]:l[n])===t&&("$user_state"in h?h[dt]:l[dt])===r||(lr.forEach(t=>delete l[t]),"identified"===h.$user_state&&"distinct_id"in h?l.$user_id=h[n]:delete l.$user_id,"identified"!==h.$user_state&&(delete l[K],delete l[G]),delete l.__alias)}a=jn(l,h)}else a=jn(o,l);return or.At(t,a),a}catch(t){}return null},At(e,s,n,r,o,l){const a=or.At(e,s,void 0,void 0,l);try{const u=cr(s,t);if(Object.keys(u).length){if(i){const i=ur(e),h=fr(u,t);if(nr.At(i,h,n,r,o,l),nr.Ot(i)!==JSON.stringify(h)){nr.Lt(i,r);const t=cr(s);return nr.At(e,t,n,r,o,l),a}}nr.At(e,u,n,r,o,l)}}catch(t){or.Pt(t)}return a},Lt(t,i){try{null==Ut||Ut.localStorage.removeItem(t),nr.Lt(t,i),nr.Lt(ur(t),i)}catch(t){or.Pt(t)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let e,s=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&or.Et()?(e=or,r=!0):"localstorage+cookie"===o&&i.Et()?(e=i,r=!0,s=!0):"sessionstorage"===o&&yr.Et()?e=yr:"memory"===o?e=mr:"cookie"===o&&nr.Et()?(e=nr,s=!0):i.Et()?(e=i,r=!0,s=!0):nr.Et()?(e=nr,s=!0):e=mr,this.Vo=r,this.Go=s,e}hl(t){return`${this.rl}__${t}`}ll(t){return this.Vo&&!!t.split_storage}properties(){const t={};return Nn(this.props,(i,e)=>{const s=wo(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.pi&&!t)return;const i=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),e=i?or.Dt(this.rl):null;let s={};if(i)try{s=dr(nr.Dt(this.rl)),Nn(s,(t,i)=>{(pi(t)||mi(t)||""===t)&&delete s[i]})}catch(t){}const r=this.Fo.Dt(this.rl);if(r&&(this.props=jn({},r)),this.Zo&&this.Dl(),i&&r){var o,l;const t=null==e?void 0:e[n],i=null!==(o=null==e?void 0:e.$user_state)&&void 0!==o?o:It,a=r[n],u=null!==(l=r.$user_state)&&void 0!==l?l:It;if(a!==t||u!==i){this.Qo=!0,yr.At(Wo(this.rl),!0);const e=jn({},this.props);lr.forEach(t=>delete e[t]),"anonymous"!==u||"identified"!==i&&"anonymous"!==s.$user_state&&(pi(t)||a===t)||(Zo(e,s),delete e[G]),this.props=e;const n=new Set;lr.forEach(t=>{var i;const e=null===(i=wo(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{const i={};Nn(this.props,(e,s)=>{var n;(null===(n=wo(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)}),fi(i)?(or.Lt(this.hl(t)),this.Wo[t]={}):or.At(this.hl(t),i)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(i,t)})})}}yr.Ot(Wo(this.rl))&&(this.Qo=!0)}Dl(){for(const t of mo){const i=or.Dt(this.hl(t));if(i&&!fi(i)){const e=this.vl(t);e.persisted=!0,this.Ll(t)||(e.fingerprint=this.yl(i,t)),this.Nl(t,i)||jn(this.props,i)}}}Ll(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=wo(i))||void 0===e?void 0:e.storageGroup)===t})}Nl(t,i){const e=qo[t];if(!e)return!1;const s=i[e],n=this.props[e];return yi(s)&&yi(n)&&n>s}refreshKey(t){var i;if(this.pi)return;if("$fbc_persistence"===t&&this.el)return;const e=this.Zo?null===(i=wo(t))||void 0===i?void 0:i.storageGroup:void 0,s=e?or.Dt(this.hl(e)):this.Fo.Dt(this.rl);if(s&&t in s)this._l(t,s[t],!1);else{if(e){const i=this.Fo.Dt(this.rl);if(i&&t in i)return void this._l(t,i[t],!1)}this.wl(t,!1)}}save(){if(this.pi)return;const t=this.$l();t>0?pi(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}flush(){pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t=!1){if(this.pi||this.Jo&&!t)return;t||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(h));const i=!t&&!this.Xo;i||(this.tl=!1);const e=!!i&&this.kl();if(this.tl)return void(this.Mr.debug&&An.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(e&&this.il.forEach(t=>t()));const s=this.jl(this.Fo,this.rl,this.props,Ko);"written"===s&&this.Tl(this.props),"failed"!==s&&(this.Ko.clear(),this.Yo=!1,this.el=!1),e&&this.il.forEach(t=>t())}ql(){const{main:t,groups:i}=this.gl(),e=this.jl(this.Fo,this.rl,t,Ko);"written"===e&&this.Tl(t),"failed"!==e&&(this.Yo=!1,this.el=!1,Jo.forEach(t=>{var i;(null===(i=wo(t))||void 0===i?void 0:i.storageGroup)||this.Ko.delete(t)}));for(const t of mo){var s;const e=i[t];if(fi(e)&&!(null===(s=this.Wo[t])||void 0===s?void 0:s.persisted)){Jo.forEach(i=>{var e;(null===(e=wo(i))||void 0===e?void 0:e.storageGroup)===t&&this.Ko.delete(i)});continue}const n=this.jl(or,this.hl(t),e,t);"failed"!==n&&Jo.forEach(i=>{const e=wo(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.Ko.delete(i)})}}gl(){const t={},i={flags:{},surveys:{}};return Nn(this.props,(e,s)=>{var n;const r=null===(n=wo(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}yl(t,i){if(i===Ko)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const e={};return Nn(t,(t,i)=>{var s;e[i]=(null===(s=wo(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}jl(t,i,e,s){const n=this.vl(s);if(s!==Ko&&!n.dirty&&!pi(n.fingerprint))return"skipped";let r;try{if(r=this.yl(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(i,e,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,s!==Ko&&(n.persisted=!0),pi(r)||(n.fingerprint=r),this.Vo&&(n.storageValue=or.Ot(i)),"written"):(this.Mr.debug&&An.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.xl(),pi(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!t&&this.nl)for(const t of mo)or.Lt(this.hl(t));t?delete this.Wo[Ko]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(vi(t)){this.syncCookieProperties(),pi(i)&&(i="None"),this.Bl=pi(e)?this.Ul:e;let s=!1;if(Nn(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this._l(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(vi(t)){this.syncCookieProperties(),this.Bl=pi(i)?this.Ul:i;let e=!1;if(Nn(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||vi(i)||di(i))&&(this._l(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.wl(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==qt?void 0:qt.URL;if(t===this.sl)return;const i=Fo(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),e=!fi(Un(i));return e&&this.register(i),this.sl=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==qt?void 0:qt.referrer;return t?Mo(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Lo(),$referring_domain:(null==qt?void 0:qt.referrer)&&(null===(t=So(qt.referrer))||void 0===t?void 0:t.host)||jo},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Bo(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[_t]:this.Go?{r:Go(t.r),u:t.u?Go(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Nn([pt,ft],i=>{const e=this.props[i];e&&Nn(e,function(i,e){t["$initial_"+oi(e)]=i})});const i=this.props[_t];if(i){const e=function(t,i=!1){const e=Uo(t,i),s={};return Nn(e,function(t,i){s[`$initial_${oi(i)}`]=t}),s}(i,this.Mr.disable_capture_url_hashes);jn(t,e)}return t}safe_merge(t){return Nn(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.pi&&!l;l||this.El(i,a),this.Mr=t,!l&&(s||n||o)&&(this.Il=void 0,this.Ml=void 0,this.El(ls(ls({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.ol(t):this.Fo;this.Wl();const h=this.ll(t),d=r||h!==this.Zo,c=!l&&(d||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(a);this.Xo=d;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){const t=this.props;this.clear(),this.Fo=u,this.Zo=h,this.props=t,this.save()}else o&&(this.Fo=u,l||(delete this.Wo[Ko],this.Fl()))}finally{this.Xo=!1,c&&this.Ol()}}Wl(){const t=this.props[_t];if(!this.Go||!vi(t)||"string"!=typeof t.r)return;const i=Go(t.r),e="string"==typeof t.u?Go(t.u):t.u;i===t.r&&e===t.u||this._l(_t,ls(ls({},t),{},{r:i,u:e}))}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this._l(d,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return pi(e)||(delete i[t],this._l(d,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this._l(t,i),this.save()}_l(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.Yo=!0),"$fbc_persistence"!==t||Xo(n,i)||(this.el=!0),this.Cl(t,n,i),(null===(s=wo(t))||void 0===s?void 0:s.volatile)||this.Sl(t))}wl(t,i=!0){delete this.props[t],i&&(Yo(t)&&this.dl(t,!0),"$fbc_persistence"===t&&(this.el=!0),this.Sl(t))}Sl(t){var i;const e=null===(i=wo(t))||void 0===i?void 0:i.storageGroup;e&&(this.vl(e).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}};const il={GZipJS:"gzip-js",Base64:"base64"},el={Activation:"events",Cancellation:"cancelEvents"},sl={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},nl={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},rl={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"},ol={Popover:"popover",Inline:"inline"};function ll(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&ci(e.then)&&e.then(void 0,()=>{})}}}}const al={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"},ul={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"},hl=Mn("[RateLimiter]");var dl=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=>{hl.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void hl.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)}clientRateLimitContext(t=!1){var i,e,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(i=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*r,l.last=o,l.tokens>n&&(l.tokens=n);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=(yi(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vl(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gl(t){const i=this.instance.config.property_denylist;return!di(i)||!i.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==Vt?void 0:Vt.pathname))return`${null!==(t=Vt.origin)&&void 0!==t?t:""}${Vt.pathname}`}Vl(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Zl(),o=this.Gl("$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 cl=Mn("[RemoteConfig]");var vl=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=Zt._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ql(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return cl.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void cl.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return cl.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){cl.error("Error loading remote config",t),this.Kl()}}Kl(t,i){!t&&i&&(0===i.statusCode?i.error||cl.warn("Failed to fetch remote config from PostHog."):cl.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){cl.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){cl.error("Error loading feature flags",t)}}},fl=Uint8Array,pl=Uint16Array,_l=Uint32Array,gl=new fl([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]),ml=new fl([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]),bl=new fl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yl=function(t,i){for(var e=new pl(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new _l(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]},wl=yl(gl,2),$l=wl[1];wl[0][28]=258,$l[258]=28;for(var Sl=yl(ml,0)[1],xl=new pl(32768),El=0;32768>El;++El){var kl=(43690&El)>>>1|(21845&El)<<1;xl[El]=((65280&(kl=(61680&(kl=(52428&kl)>>>2|(13107&kl)<<2))>>>4|(3855&kl)<<4))>>>8|(255&kl)<<8)>>>1}var Tl=function(t,i,e){for(var s=t.length,n=0,r=new pl(i);s>n;++n)++r[t[n]-1];var o,l=new pl(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new pl(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],d=l[t[n]-1]++<<h,c=d|(1<<h)-1;c>=d;++d)o[xl[d]>>>a]=u}else for(o=new pl(s),n=0;s>n;++n)o[n]=xl[l[t[n]-1]++]>>>15-t[n];return o},Pl=new fl(288);for(El=0;144>El;++El)Pl[El]=8;for(El=144;256>El;++El)Pl[El]=9;for(El=256;280>El;++El)Pl[El]=7;for(El=280;288>El;++El)Pl[El]=8;var Cl=new fl(32);for(El=0;32>El;++El)Cl[El]=5;var Ol=Tl(Pl,9,0),Rl=Tl(Cl,5,0),Il=function(t){return(t/8|0)+(7&t&&1)},Fl=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof pl?pl:t instanceof _l?_l:fl)(e-i);return s.set(t.subarray(i,e)),s},Al=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Ml=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},Dl=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 fl(0),0];if(1==n){var o=new fl(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,d=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[d].f>e[u].f?u++:d++],a=e[u!=h&&e[d].f>e[u].f?u++:d++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var c=r[0].s;for(s=1;n>s;++s)r[s].s>c&&(c=r[s].s);var v=new pl(c+1),f=Nl(e[h-1],v,0);if(f>i){s=0;var p=0,_=f-i,g=1<<_;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+=g-(1<<f-v[m]),v[m]=i}for(p>>>=_;p>0;){var b=r[s].s;i>v[b]?p-=1<<i-v[b]++-1:++s}for(;s>=0&&p;--s){var y=r[s].s;v[y]==i&&(--v[y],++p)}f=i}return[new fl(v),f]},Nl=function(t,i,e){return-1==t.s?Math.max(Nl(t.l,i,e+1),Nl(t.r,i,e+1)):i[t.s]=e},jl=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new pl(++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]},Ll=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},Bl=function(t,i,e){var s=e.length,n=Il(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)},Ul=function(t,i,e,s,n,r,o,l,a,u,h){Al(i,h++,e),++n[256];for(var d=Dl(n,15),c=d[0],v=d[1],f=Dl(r,15),p=f[0],_=f[1],g=jl(c),m=g[0],b=g[1],y=jl(p),w=y[0],S=y[1],x=new pl(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=Dl(x,7),T=k[0],P=k[1],C=19;C>4&&!T[bl[C-1]];--C);var O,R,I,F,A=u+5<<3,M=Ll(n,Pl)+Ll(r,Cl)+o,D=Ll(n,c)+Ll(r,p)+o+14+3*C+Ll(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=A&&D>=A)return Bl(i,h,t.subarray(a,a+u));if(Al(i,h,1+(M>D)),h+=2,M>D){O=Tl(c,v,0),R=c,I=Tl(p,_,0),F=p;var N=Tl(T,P,0);for(Al(i,h,b-257),Al(i,h+5,S-1),Al(i,h+10,C-4),h+=14,E=0;C>E;++E)Al(i,h+3*E,T[bl[E]]);h+=3*C;for(var j=[m,w],L=0;2>L;++L){var B=j[L];for(E=0;B.length>E;++E)Al(i,h,N[U=31&B[E]]),h+=T[U],U>15&&(Al(i,h,B[E]>>>5&127),h+=B[E]>>>12)}}else O=Ol,R=Pl,I=Rl,F=Cl;for(E=0;l>E;++E)if(s[E]>255){var U;Ml(i,h,O[257+(U=s[E]>>>18&31)]),h+=R[U+257],U>7&&(Al(i,h,s[E]>>>23&31),h+=gl[U]);var z=31&s[E];Ml(i,h,I[z]),h+=F[z],z>3&&(Ml(i,h,s[E]>>>5&8191),h+=ml[z])}else Ml(i,h,O[s[E]]),h+=R[s[E]];return Ml(i,h,O[256]),h+R[256]},zl=new _l([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hl=new fl(0),ql=function(){for(var t=new _l(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Vl=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Wl(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=ql[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 fl(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 d=h+65535;o>d?u=Bl(a,u,t.subarray(h,d)):(a[h]=r,u=Bl(a,u,t.subarray(h,o)))}else{for(var c=zl[i-1],v=c>>>13,f=8191&c,p=(1<<e)-1,_=new pl(32768),g=new pl(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new _l(25e3),S=new pl(288),x=new pl(32),E=0,k=0,T=(h=0,0),P=0,C=0;o>h;++h){var O=y(h),R=32767&h,I=g[O];if(_[R]=I,g[O]=R,h>=P){var F=o-h;if((E>7e3||T>24576)&&F>423){u=Ul(t,a,0,w,S,x,k,T,C,h-C,u),T=E=k=0,C=h;for(var A=0;286>A;++A)S[A]=0;for(A=0;30>A;++A)x[A]=0}var M=2,D=0,N=f,j=R-I&32767;if(F>2&&O==y(h-j))for(var L=Math.min(v,F)-1,B=Math.min(32767,h),U=Math.min(258,F);B>=j&&--N&&R!=I;){if(t[h+M]==t[h+M-j]){for(var z=0;U>z&&t[h+z]==t[h+z-j];++z);if(z>M){if(M=z,D=j,z>L)break;var H=Math.min(j,z-2),q=0;for(A=0;H>A;++A){var V=h-j+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,I=V)}}}j+=(R=I)-(I=_[R])+32768&32767}if(D){w[T++]=268435456|$l[M]<<18|Sl[D];var G=31&$l[M],K=31&Sl[D];k+=gl[G]+ml[K],++S[257+G],++x[K],P=h+M,++E}else w[T++]=t[h],++S[t[h]]}}u=Ul(t,a,r,w,S,x,k,T,C,h-C,u),r||(u=Bl(a,u,Hl))}return Fl(l,0,s+Il(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)),d=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&&Vl(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),Vl(h,d-8,e.d()),Vl(h,d-4,s),h}const Gl=!!Gt||!!Wt,Kl=new WeakMap,Jl="text/plain";let Yl=!1;const Xl=(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}`:""}`},Ql=(t,i,e=!0)=>{var s;const[n,r]=t.split("?"),o=ls({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],a=function(t,i="&"){let e,s;const n=[];return Nn(t,function(t,i){pi(t)||pi(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)}(o);return a&&l.push(a),l.length>0?`${n}?${l.join("&")}`:n},Zl=t=>{if(t.Yl)return t.Yl;const{data:i,compression:e}=t;if(!i)return;if(e===il.GZipJS){const t=Wl(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new fl(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 fl(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 Fl(e,0,s)}($o(i)),{mtime:0});return{contentType:Jl,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===il.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}($o(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:$o(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=$o(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},ta=t=>{const i=()=>"sendBeacon"===t.transport?{url:Ql(t.url,{compression:il.Base64}),encodedBody:Zl(ls(ls({},t),{},{compression:il.Base64,Yl:void 0}))}:{url:Xl(t.url,"compression"),encodedBody:Zl(ls(ls({},t),{},{compression:void 0,Yl:void 0}))};let e;try{e=Zl(t)}catch(e){if(Zs(t.compression,xo(t.url,"compression")))return An.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&Zs(t.compression,xo(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?Qs(new Uint8Array(s)):ArrayBuffer.isView(s)&&Qs(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Yl=!0,i()):{url:t.url,encodedBody:e};var s},ia=t=>{try{return ta(t)}catch(e){var i;return An.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},ea=function(){var t=Ai(function*(t){const i=yield function(t){return on.apply(this,arguments)}($o(t.data),e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return ls(ls({},t),{},{Yl:{contentType:Jl,body:s,estimatedSize:s.byteLength}})});return function(i){return t.apply(this,arguments)}}(),sa=/Failed to fetch|NetworkError|Load failed/i,na=t=>"TypeError"===(null==t?void 0:t.name)&&sa.test((null==t?void 0:t.message)||""),ra=t=>{const i=ia(t);if(!i)return;const e=new Gt;Kl.set(e,!0);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,!0);const{contentType:r,body:o}=null!=n?n:{};Nn(t.headers,function(t,i){e.setRequestHeader(i,t)}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i;const s={statusCode:e.status,text:e.responseText};if(200===e.status)try{s.json=JSON.parse(e.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,s)}},e.send(o)},oa=t=>{const i=ia(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},l=new Headers;Nn(t.headers,function(t,i){l.append(i,t)}),n&&l.append("Content-Type",n);let a=null,u=!1;if(Kt){const i=new Kt;a={signal:i.signal,timeout:setTimeout(()=>{var e;u=!0,i.abort(Ke("AbortError","PostHog request timed out"+((e=t.timeout)?` after ${e}ms`:"")))},t.timeout)}}const h=i=>{var e;u&&"AbortError"===(null==i?void 0:i.name)||na(i)?An.warn(i):An.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i})};try{Wt(e,ls({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&!t.ta&&52428.8>(o||0),body:r,signal:null==a?void 0:a.signal},t.fetchOptions)).then(i=>i.text().then(e=>{var s;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){An.error(t)}null===(s=t.callback)||void 0===s||s.call(t,n)})).catch(h).finally(()=>a?clearTimeout(a.timeout):null)}catch(t){a&&clearTimeout(a.timeout),h(t)}},la=t=>{try{var i;const{url:e,encodedBody:s}=ta(t),{contentType:n,body:r,estimatedSize:o}=null!=s?s:{};if(!r)return;const l=r instanceof Blob?r:new Blob([r],{type:n});if(Ht.sendBeacon(e,l))return;const a=di(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(di(a)&&a.length>1&&(null!=o?o:0)>16384){const i=Math.ceil(a.length/2),e=i=>di(t.data)?i:ls(ls({},t.data),{},{batch:i});return la(ls(ls({},t),{},{data:e(a.slice(0,i))})),void la(ls(ls({},t),{},{data:e(a.slice(i))}))}An.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${Wt?"fetch":"XHR"}`),Wt?oa(ls(ls({},t),{},{ta:!0})):ra(t)}catch(t){An.warn("Beacon send failed",t)}},aa=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return Ql(e===il.GZipJS?Xl(t,"compression"):t,ls(ls({},n?{[n]:Date.now().toString()}:{}),e===il.GZipJS?{}:{compression:e}))},ua=(()=>{const t=[];return Wt&&t.push({transport:"fetch",method:oa}),Gt&&t.push({transport:"XHR",method:ra}),(null==Ht?void 0:Ht.sendBeacon)&&t.push({transport:"sendBeacon",method:la}),t})();var ha=class{constructor(t,i){this.ea=!0,this.ia=[],this.na=Ni((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,An.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();const t=this.ia.length>0?this.aa():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(ls(ls({},t),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const t=this.aa();for(const i in t)this.ua(t[i])}},this.na))}ua(t){try{this.sa(t)}catch(t){An.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const t={};return Nn(this.ia,i=>{var e;const s=i,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");pi(t[n])&&(t[n]=ls(ls({},s),{},{data:[]})),null===(e=t[n].data)||void 0===e||e.push(s.data)}),this.ia=[],t}};const da=["retriesPerformedSoFar"];var ca=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!pi(Ut)&&"onLine"in Ut.navigator){if(this.da=Ut.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},Vn(Ut,"online",this.va),Vn(Ut,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t){let{retriesPerformedSoFar:i}=t,e=un(t,da);wi(i)&&(e.url=Ql(e.url,{retry_count:i})),this._instance._send_request(ls(ls({},e),{},{callback:t=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(ls({retriesPerformedSoFar:i},e));0===t.statusCode&&An.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null===(s=e.callback)||void 0===s||s.call(e,t)}}))}Ls(t){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const e=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)}(i),s=Date.now()+e;this.ia.push({retryAt:s,requestOptions:t});let n=`Enqueued failed request for retry in ${e}`;navigator.onLine||(n+=" (Browser is offline)"),An.warn(n),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const t=Date.now(),i=[],e=this.ia.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.ia=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,pi(Ut)||(this.va&&(Ut.removeEventListener("online",this.va),this.va=void 0),this.pa&&(Ut.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:t}of this.ia)try{this._instance._send_request(ls(ls({},t),{},{transport:"sendBeacon"}))}catch(t){An.error(t)}this.ia=[]}},va=class{constructor(t){this._instance=t,this.ya=()=>{var t,i,e,s;this.ba||(this.ba={});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.ba.lastScrollY=Math.ceil(r),this.ba.maxScrollY=Math.max(r,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(i=this.ba.maxScrollHeight)&&void 0!==i?i:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,null!==(e=this.ba.maxContentY)&&void 0!==e?e:0),this.ba.maxContentHeight=Math.max(a,null!==(s=this.ba.maxContentHeight)&&void 0!==s?s:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){Vn(Ut,"scroll",this.ya,{capture:!0}),Vn(Ut,"scrollend",this.ya,{capture:!0}),Vn(Ut,"resize",this.ya)}scrollElement(){if(this._a){const i=di(this._a)?this._a:[this._a];for(const e of i){var t;const i=null==Ut||null===(t=Ut.document)||void 0===t?void 0:t.querySelector(e);if(i)return i}return}var i;return null==Ut||null===(i=Ut.document)||void 0===i?void 0:i.documentElement}wa(t){var i,e;const s="y"===t?"scrollTop":"scrollLeft";if(this._a){const t=this.scrollElement();return t&&t[s]||0}return Ut?"y"===t?Ut.scrollY||Ut.pageYOffset||(null===(i=Ut.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:Ut.scrollX||Ut.pageXOffset||(null===(e=Ut.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const fa=t=>Bo(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 pa=class{constructor(t,i,e,s){this.je=t=>{const i=this.ka();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[ct]:e})},this._instance=t,this.Ca=i,this.xa=e,this.Sa=s||fa,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[ct]}getSetOnceProps(){var t;const i=null===(t=this.ka())||void 0===t?void 0:t.props;return i?"r"in i?Uo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){const t={};return Nn(Un(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${oi(e)}`]=i}),t}},_a=class{on(t,i){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(i),()=>{this.$a[t]=this.$a[t].filter(t=>t!==i)}}emit(t,i){for(const e of this.$a[t]||[])e(i);for(const e of this.$a["*"]||[])e(t,i)}constructor(){this.$a={}}};const ga=Mn("[SessionId]"),ma=864e5;var ba=class{on(t,i){return this.Ta.on(t,i)}constructor(t,i,e){var s;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new _a,this.Aa=(t,i)=>!(!wi(t)||!wi(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.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=i||Zn,this.Da=e||Zn;const n=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ni(this.Mr.session_idle_timeout_seconds||1800,60,36e3,ga.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+n+"_window_id",this.qa="ph_"+n+"_primary_window_exists",this.ja()){const t=yr.Dt(this.Na),i=yr.Dt(this.qa);t&&!i?this.Be=t:yr.Lt(this.Na),yr.At(this.qa,!0)}(null===(s=this.Mr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return pi(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(i=>i!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&yr.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&yr.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?yr.Dt(this.Na):null}Ua(t){const i=this.Ia;return!mi(i)&&!mi(t)&&5e3>Math.abs(t-i)}Wa(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.Ua(i)||(this.Ia=i,this.xa.register({[O]:[i,t,e]}))}Va(){var t;const i=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return wi(i)&&i>0}Ga(){this.Va()?this.xa.refreshKey(O):(this.xa.flush(),this.xa.load())}Za(){var t;if(mi(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,i,e]=this.Qa();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[O]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[t]=this.Qa(),i=wi(t)?t:0,e=wi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){const t=this.xa.props[O];return di(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(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 ga.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void ga.error("Invalid sessionID in bootstrap",t)}})(t);return!pi(e)&&(i?this.Fa={sessionId:t,sessionStartTimestamp:e}:this.Wa(t,(new Date).getTime(),e),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&Ut&&(Ut.removeEventListener(Dt,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&yr.Lt(this.qa)},Vn(Ut,Dt,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Mr.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.Ma=s;else if(mi(this.Ma)||this.Ma>s||s-this.Ma>=1e3){var r,o;null===(r=(o=this.xa).syncCookieProperties)||void 0===r||r.call(o),this.Ma=s}let[,l,a]=this.Qa();const u=!pi(n)&&l!==n,h=this.Ja();let d=this.za();const c=this.Fa,v=!!c&&(c.sessionStartTimestamp>s+6e4||s-c.sessionStartTimestamp>ma),f=c?v:wi(a)&&Math.abs(s-a)>ma;let p=!1,_=u;const g=!l||!!c,m=l;let b=!g&&!t&&this.Aa(s,h);if(b&&(b=this.Ka(s),b||ga.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qa()),g||b||f){_=!1;const t=c&&!v;l=t?c.sessionId:this.Oa(),d=this.Da(),ga.info("new session ID assigned",{sessionId:l,windowId:d,bootstrapped:!!t,changeReason:{noSessionId:g,activityTimeout:b,sessionPastMaximumLength:f}}),a=t?c.sessionStartTimestamp:s,this.Fa=void 0,p=!0}else d||(d=this.Da(),p=!0),_=_||l!==m,_&&(ga.info("adopted cross-tab session id",{sessionId:l,windowId:d}),p=!0);const y=wi(h)&&t&&!f?h:s,w=wi(a)?a:(new Date).getTime();this.Ha(d),this.Wa(l,y,w),t||this.La();const S={noSessionId:g,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:_};return p&&this.Ea.forEach(t=>t(l,d,S)),{sessionId:l,windowId:d,sessionStartTimestamp:w,changeReason:p?S:void 0,lastActivityTimestamp:h}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};const ya=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&Di(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>Di(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function wa(){return(wa=Ai(function*(){const t=null==Ht?void 0:Ht.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return _i(e)&&e.length>0?e:void 0}catch(t){return void An.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function $a(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 Sa(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 xa=(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}},Ea=t=>t.toLowerCase(),ka={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=>xa(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!xa(i,t))),icontains:(t,i)=>i.map(Ea).some(i=>t.map(Ea).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Ea).every(i=>t.map(Ea).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 Ta(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=ka[e.operator];return!!n&&n(e.values,[String(s)])})}function Pa(t,i,e){return $o({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Ca="custom",Oa="i.posthog.com",Ra=/^\/static\//,Ia=["/s/","/e/","/i/"];var Fa=class{constructor(t){this.Ya={},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(`.${Oa}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Ya[this.apiHost]||(this.Ya[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":Ca),this.Ya[this.apiHost]}tu(t){if(!Ra.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}eu(t){const i=So(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}iu(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=So(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&Ia.some(t=>0===i.indexOf(t))){const t=this.eu(s);if(t){const i=this.apiHost;let e=this.nu;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.nu=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.nu,e=this.eu(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.iu(t,i,this.uiHost+i);if("flags"===t)return this.iu(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.tu(i);if(e)return this.iu(t,i,`${e}${i}`)}if(this.region===Ca)return this.iu(t,i,this.apiHost+i);const e=Oa+i;switch(t){case"assets":return this.iu(t,i,`https://${this.region}-assets.${e}`);case"api":return this.iu(t,i,`https://${this.region}.${e}`)}}};const Aa=Mn("[Surveys]"),Ma=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){Aa.error("Failed to persist survey seen state",t)}},Da=[sl.Popover,sl.Widget,sl.API],Na={ignoreConditions:!1,ignoreDelay:!1,displayType:ol.Popover},ja=Mn("[PostHog ExternalIntegrations]"),La={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Ba=class{constructor(t){this._instance=t}No(t,i){var e,s;null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return ja.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=Zt.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.No(La[n],()=>{var t;null===(t=Zt.__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=Zt.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=Zt.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},Ua=class{constructor(t,i){this.$=t,this.po=i,this.su=new Map,this.So=!1}add(t){var i=this;return Ai(function*(){if(i.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.su.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);i.su.set(t.name,t);try{const e=t.setup(i.po);e&&(yield e)}catch(e){const s=i.su.get(t.name)===t;s&&i.su.delete(t.name),i.$.error(`Failed to set up browser extension "${t.name}"`,e),s&&i.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(this.So)return;this.So=!0;const t=Array.from(this.su.values()).reverse();this.su.clear();for(const i of t)this.ru(i)}ru(t){try{var i;const e=null===(i=t.dispose)||void 0===i?void 0:i.call(t);e&&ci(e.then)&&e.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,i)})}catch(i){this.$.error(`Failed to dispose browser extension "${t.name}"`,i)}}},za=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);pi(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)}};const Ha="extensionsRemoteConfig";var qa=class{constructor(t){this.instance=t,this.So=!1,this.$=An,this.ou=t.lu,this.kv=new za(t),this.onEvent=t=>ll(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return ll(()=>{});const i=i=>{try{t(i)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},e=this.instance.au.on(Ha,i);return this.ou&&i(this.ou),ll(e)},this.uu=new Ua(An.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}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(r);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;const n=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==n?void 0:n.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==n?void 0:n.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,i,e){var s=this;return Ai(function*(){e?s.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):s.instance.capture(t,i)})()}registerDynamicEventProperties(t){return ll(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(Ha,t))}sendRequest(t){var i=this;return Ai(function*(t,e={}){var s;const n=i.instance.requestRouter.endpointFor(null!==(s=e.target)&&void 0!==s?s:"api",t),r={method:e.method,url:e.query?Ql(n,e.query):n,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?ii.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,i.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};const Va={};let Wa=0;const Ga=()=>{},Ka='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ja="Surveys module not available",Ya="sanitize_properties is deprecated. Use before_send instead",Xa="Invalid value for property_denylist config: ",Qa=/^[A-Za-z0-9_-]{1,400}$/,Za=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,tu=["token","distinct_id",bt],iu="posthog";let eu=!Gl&&-1===(null==Yt?void 0:Yt.indexOf("MSIE"))&&-1===(null==Yt?void 0:Yt.indexOf("Mozilla"));const su=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},nu=t=>{var i;return ls({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:qn(null==qt?void 0:qt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ga,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Vt&&_i(null==Vt?void 0:Vt.search)&&-1!==Vt.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==Ut||null===(i=Ut.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,surveys_request_timeout_ms:1e4,on_request_error(t){An.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:At,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Ga},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Br,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:su(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))},ru=[["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"]],ou=t=>{const i={};for(const[e,s]of ru)pi(t[e])||(i[s]=t[e]);const e=jn({},i,t),s=t.__preview_external_dependency_versioned_paths;return pi(s)||(pi(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),_i(s)&&pi(t.asset_host)&&(e.asset_host=s)),di(t.property_blacklist)&&(pi(t.property_denylist)?e.property_denylist=t.property_blacklist:di(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:An.error(Xa+t.property_denylist)),e};var lu=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){An.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},au=class t{du(t){if(!t)return;const i=this.su.indexOf(t);-1!==i&&this.su.splice(i,1)}vu(t,i){var e;return this.du(t),this.su.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(this.gu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mu)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.gu=!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}`)}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Zn());this.register({distinct_id:i,$device_id:i}),t.set_property(dt,It)}this._u()}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.wu=!1,this.ku=!1,this.webPerformance=new lu,this.Su=!1,this.version=e.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new _a,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=nu(),this.SentryIntegration=_o,this.sentryIntegration=t=>function(t,i){const e=po(t,i);return{name:fo,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new va(this),this.pageViewManager=new go(this),this.rateLimiter=new dl(this),this.requestRouter=new Fa(this),this.consent=new wr(this),this.externalIntegrations=new Ba(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=_i(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=_i(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>An.info(`send "${null==t?void 0:t.event}"`,t))}init(i,e,s){if(s&&s!==iu){var n;const r=null!==(n=Va[s])&&void 0!==n?n:new t;return r._init(i,e,s),Va[s]=r,Va[iu][s]=r,r}return this._init(i,e,s)}_init(t,i={},s){var n,r,l;const a=_i(t)?t.trim():"";if(!a)return An.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=nu(i.defaults),i.debug=this.Pu(i.debug),this.Ru=i,this.Au=[],i.person_profiles?this.Mu=i.person_profiles:i.process_person&&(this.Mu=i.process_person);const h=nu(i.defaults),d=ou(i),c=jn({},h,d,{name:s,token:a});vi(h.rageclick)&&vi(d.rageclick)&&(c.rageclick=jn({},h.rageclick,d.rageclick)),vi(h.session_recording)&&vi(d.session_recording)&&(c.session_recording=jn({},h.session_recording,d.session_recording)),this.set_config(c),this.config.on_xhr_error&&An.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:il.GZipJS;const v=this.bu();if(this.persistence=new tl(this.config,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tl(ls(ls({},this.config),{},{persistence:"sessionStorage"}),v,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!v&&yr.Et()){const t=yr.Dt(this.Cu);di(t)&&t.forEach(t=>{_i(t)&&this.xu.add(t)})}else yr.Lt(this.Cu);const f=ls({},this.persistence.props),p=ls({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new ha(t=>this.Ou(t),this.config.request_queue_config),this.Du=new ca(this),this.__request_queue=[];const _=this.fu();_||(this.sessionManager=new ba(this),this.sessionPropsManager=new pa(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.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(An.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(_)},0)):(An.info("Initializing extensions synchronously"),this.qu(_)),e.DEBUG=e.DEBUG||this.config.debug,e.DEBUG&&An.info("Starting in debug mode",{this:this,config:i,thisC:ls({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=ls(ls({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const g=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mu=!!g&&!gi(g),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(dt);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===s)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===s)An.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(Zn()),s=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(dt,i.bootstrap.isIdentifiedID?Ft:It),this.register({distinct_id:t,$device_id:s})}}if(_)this.register_once({distinct_id:mt,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Zn());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(dt,It)}return Vn(Ut,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Vn(Ut,"pageshow",()=>{var t;this.wu=!1,this.ku||null===(t=this.Du)||void 0===t||t.resume()}),i.segment?vo(this,()=>this.ju()):this.ju(),ci(this.config._onCapture)&&this.config._onCapture!==Ga&&(An.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&An.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return wa.apply(this,arguments)}().then(t=>{t&&this.register({[o]:t})}).catch(Ga),this}Bu(t){const i=t;return _i(i.name)&&ci(i.setup)}Hu(t,i){this.Bu(t)?i.push(()=>{this.zu().add(t).catch(()=>{var i;return null===(i=t.dispose)||void 0===i?void 0:i.call(t)}).catch(i=>{An.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.su.push(t)}Nu(){var i,e,s;const n=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 r,o,l;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new n(this)),ci(this.featureFlags.onReloading)&&ci(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(o=(l=this.featureFlags).initialize)||void 0===o||o.call(l))}qu(i){const e=performance.now(),s=ls(ls({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,d;s.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.su.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.su.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.su.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!i&&this.su.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Hu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Hu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Hu(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.su.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.su.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.su.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.su.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.su.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,uo)),s.toolbar&&this.su.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.su.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this.su.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Wu){const t=this.Wu;this.Wu=void 0,this.su.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Vu(n,e)}Vu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,i)},0);const e=t.shift();if(e)try{e()}catch(t){An.error("Error initializing extension:",t)}}const e=Math.round(performance.now()-i);this.register_for_session({[yt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[wt]:e}),this.config.__preview_deferred_init_extensions&&An.info(`PostHog extensions initialized (${e}ms)`)}Kl(t){var i;if(!qt||!qt.body)return An.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var e;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ni(i.supportedCompression,il.GZipJS)?il.GZipJS:ni(i.supportedCompression,il.Base64)?il.Base64:void 0),(null===(e=i.analytics)||void 0===e?void 0:e.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:At}),null===(i=this.Gu)||void 0===i||i.handleRemoteConfig(t),this.su.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}ju(){try{this.config.loaded(this)}catch(t){An.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==Vt?void 0:Vt.hostname)){const t=Vt.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.fu())&&this.Qu()},1),this.Ju=new vl(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Fu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Dn(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,i,e,s,n,r;this.wu=!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.Ku()&&this.capture(jt),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Fu)||void 0===n||n.unload(),null===(r=this.Du)||void 0===r||r.unload()):this.Ku()&&this.capture(jt,null,{transport:"sendBeacon"})}_send_request(t){var i,e,s;this.__loaded?eu?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=ls(ls({},this.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(pi(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,s;const n=ls({},t);n.timeout=n.timeout||6e4;const r=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===r&&pi(n.compression)&&n.data&&(n.compression=il.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data=(t=>{var i,e;const s=(di(t)?t:[t]).map(t=>ls(ls({},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()}})(n.data):"body"===n.timestampMode&&(n.data=((t,i=(new Date).toISOString())=>di(t)?t.map(t=>ls(ls({},t),{},{sent_at:i})):ls(ls({},t),{},{sent_at:i}))(n.data))),n.url=aa(n.url,n.method,n.compression,n.timestampMode);const o=ua.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),l=null!==(e=null===(s=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(o,t=>t.transport===r))||void 0===s?void 0:s.method)&&void 0!==e?e:o[0].method;if(!l)throw new Error("No available transport method");const a=t=>{try{l(t)}catch(t){var i;na(t)?An.warn(t):An.error(t),null===(i=n.callback)||void 0===i||i.call(n,{statusCode:0,error:t})}};"sendBeacon"!==r&&n.data&&n.compression===il.GZipJS&&Jt&&"undefined"!=typeof Promise&&!Yl?ea(n).then(t=>{a(t)}).catch(i=>{if(tn(i))return Yl=!0,void a(ls(ls({},n),{},{compression:void 0,url:aa(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 tn(t)||i===Xs})(i)&&(Yl=!0),a(n)}):l(n)})(ls(ls({},t),{},{callback:i=>{var e,s,n;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null===(s=(n=this.config).on_request_error)||void 0===s||s.call(n,i),null===(e=t.callback)||void 0===e||e.call(t,i)}}))):t.fireCallbackOnDrop&&(null===(s=t.callback)||void 0===s||s.call(t,{statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){Wa++;try{let i;const e=[],s=[],n=[];Dn(t,t=>{if(t)if(i=t[0],di(i))n.push(t);else if(ci(t))try{t.call(this)}catch(i){An.error("Error executing queued PostHog call",t,i)}else di(t)&&"alias"===i?e.push(t):di(t)&&-1!==i.indexOf("capture")&&ci(this[i])?n.push(t):s.push(t)});const r=function(t,i){Dn(t,function(t){try{if(di(t[0])){let e=i;Nn(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){An.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{Wa--}}push(i){if(Wa>0&&di(i)&&_i(i[0])){const e=t.prototype[i[0]];return void(ci(e)&&e.apply(this,i.slice(1)))}this._execute_array([i])}Xu(){var t;const i=null===(t=this.persistence)||void 0===t?void 0:t.get_property(h);return _i(i)&&Za.test(i)?{value:i,delivered:!1}:vi(i)&&_i(i.value)&&Za.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Yu(t,i,e,s){if(!this.persistence)return;this.persistence.refreshKey(h);const n=this.Xu();if(!s){if(e)return _i(i)&&Za.test(i)?(i!==(null==n?void 0:n.value)&&this.persistence.register({[h]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==n?void 0:n.value)||!n.delivered}):void this.persistence.unregister(h);if(_i(t)&&Qa.test(t)){if((null==n?void 0:n.value.split(".")[3])===t)return{value:n.value,pending:!n.delivered};const i=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[h]:{value:i,delivered:!1}}),{value:i,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(h)}th(t){if(!this.persistence)return;this.persistence.refreshKey(h);const i=this.Xu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[h]:{value:t,delivered:!0}})}capture(t,i,e){var s,n,r,o,l,a;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void An.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(pi(t)||!_i(t))return void An.error("No event name provided to posthog.capture");this.yu();const h=!this.config.opt_out_useragent_filter&&this._is_bot();if(h&&!this.config.__preview_capture_bot_pageviews)return;const d=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==d?void 0:d.isRateLimited)return void An.critical("This capture call is ignored due to client rate limiting.");let c;(null==i?void 0:i.$current_url)&&!_i(null==i?void 0:i.$current_url)&&(An.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.eh)||An.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=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 v=new Date,f=(null==e?void 0:e.timestamp)||v,p=Ge(null==e?void 0:e.uuid,Zn);let _={uuid:p,event:t,properties:this.calculateEventProperties(t,i||{},f,p)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&h&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),d&&(_.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);const g="$feature_flag_called"===t&&!1===_.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!g&&(_.$set=null==e?void 0:e.$set);const m=vi(null==i?void 0:i.$set)?i.$set:void 0,b=!!(null==e?void 0:e.$set)&&"$fbc"in e.$set,y=b||!!m&&"$fbc"in m,w=b?null==e||null===(s=e.$set)||void 0===s?void 0:s[u]:null==m?void 0:m[u],S=di(null==i?void 0:i.$unset)?i.$unset:[],x=(null==e?void 0:e.$unset)||[],E=-1!==S.indexOf("$fbc")||-1!==x.indexOf("$fbc"),k=this.Yu(null==c?void 0:c.fbclid,w,y,E);k&&!0===_.properties.$process_person_profile&&k.pending&&!y&&!g&&(_.$set=ls({[u]:k.value},_.$set));const T=null==e?void 0:e.$unset;T&&(_.$unset=T);const P=g?void 0:this.ih(null==e?void 0:e.$set_once,t!==Bt,t===Lt);if(P&&(_.$set_once=P),(null==e?void 0:e._noTruncate)||(C=this.config.properties_string_max_length,_=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),di(s))r=[],Dn(s,i=>{r.push(t(i))});else{const i={};Nn(Ti(s)?zn(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(_,t=>_i(t)?t.slice(0,C):t)),_.timestamp=f,pi(null==e?void 0:e.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),g&&(_.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return Ys.forEach(s),i.forEach(s),e})(_.properties,tu)),t===nl.DISMISSED||t===nl.SENT){const e=null==i?void 0:i[rl.SURVEY_ID],s=null==i?void 0:i[rl.SURVEY_ITERATION];Ma({id:e,current_iteration:s}),_.$set=ls(ls({},_.$set),{},{[$a({id:e,current_iteration:s},t===nl.SENT?"responded":"dismissed")]:!0})}else t===nl.SHOWN&&(_.$set=ls(ls({},_.$set),{},{[rl.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var C;if(t===al.SHOWN){const t=null==i?void 0:i[ul.TOUR_TYPE];t&&(_.$set=ls(ls({},_.$set),{},{[`${ul.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const O=ls(ls({},_.properties.$set),_.$set);if(fi(O)||this.setPersonPropertiesForFlags(O),!bi(this.config.before_send)){const t=this.Os(_);if(!t)return;_=t,_.uuid=Ge(_.uuid,Zn)}const R=null!==(n=null===(r=_.$set)||void 0===r?void 0:r.$fbc)&&void 0!==n?n:vi(null===(o=_.properties)||void 0===o?void 0:o.$set)?_.properties.$set[u]:void 0,I=(null==k?void 0:k.pending)&&R===k.value?k.value:void 0;this.au.emit("eventCaptured",_);const F=null!==(l=null==e?void 0:e._url)&&void 0!==l?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(F),M=ls(ls(ls({method:"POST",url:F,data:_,compression:"best-available",timestampMode:A?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},A&&(null===(a=_.properties)||void 0===a?void 0:a.$session_id)?{batchGroup:_.properties.$session_id}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),I?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.th(I)}}:{});var D;return!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)||I?(!M.transport&&!M.callback&&fi(null!==(D=this.config.request_headers)&&void 0!==D?D:{})&&this.wu&&(M.transport="sendBeacon"),this.Ou(M)):this.Fu.enqueue(M),_}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.Gu)||void 0===i?void 0:i.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new qa(this)}hu(t){this.$u.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.$u.indexOf(t);-1!==e&&this.$u.splice(e,1)}}nh(t=!0){var i,e,s;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.xu.clear(),this.sh()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.nh();const o=r?void 0:this.persistence.remove_event_timer(t);let l=ls({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.fu()&&(l[bt]=!0),"$snapshot"===t){const t=ls(ls({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=t.distinct_id,(!_i(l.distinct_id)&&!yi(l.distinct_id)||gi(l.distinct_id))&&An.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}const a=function(t,e,s,n=!1){var r,o,l,a;if(!Yt)return{};const u=t?[...Co,...e||[]]:[],[h,d]=Ne(Yt),[c,v]=function(t){for(let i=0;Ue.length>i;i++){const[e,s,n]=Ue[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(Yt),f=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),p={};pi(s)||(p.detectGoogleSearchApp=s);const _={},g=null===(r=navigator)||void 0===r||null===(r=r.userAgentData)||void 0===r?void 0:r.platform,m=null===(o=navigator)||void 0===o?void 0:o.maxTouchPoints,b=null==Ut||null===(l=Ut.screen)||void 0===l?void 0:l.width,y=null==Ut||null===(a=Ut.screen)||void 0===a?void 0:a.height,w=null==Ut?void 0:Ut.devicePixelRatio;pi(g)||(_.userAgentDataPlatform=g),pi(m)||(_.maxTouchPoints=m),pi(b)||(_.screenWidth=b),pi(y)||(_.screenHeight=y),pi(w)||(_.devicePixelRatio=w);const S=jn(Un({$os:h,$os_version:d,$browser:Fe(Yt,navigator.vendor,f,p),$webview_app:c,$webview_app_version:v,$device:je(Yt),$device_type:Le(Yt,_),$timezone:zo(),$timezone_offset:Ho()}),{$current_url:Eo(n?Je(null==Vt?void 0:Vt.href):null==Vt?void 0:Vt.href,u,Ro),$host:null==Vt?void 0:Vt.host,$pathname:null==Vt?void 0:Vt.pathname,$raw_user_agent:Yt.length>1e3?Yt.substring(0,997)+"...":Yt,$browser_version:Me(Yt,navigator.vendor,f,p),$browser_language:Do(),$browser_language_prefix:No(),$screen_height:null==Ut?void 0:Ut.screen.height,$screen_width:null==Ut?void 0:Ut.screen.width,$viewport_height:null==Ut?void 0:Ut.innerHeight,$viewport_width:null==Ut?void 0:Ut.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&&(S.$sdk_dist_channel=i.SDK_DIST_CHANNEL),S}(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(r,s.getTime(),!0);l.$session_id=t,l.$window_id=i}this.sessionPropsManager&&jn(l,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&jn(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null===(u=this.Du)||void 0===u?void 0:u.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}let h;if(this.requestRouter.region===Ca&&(l.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||r?"$pageleave"!==t||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=jn(l,h),"$pageview"===t&&qt&&(l.title=qt.title),!pi(o)){const t=s.getTime()-o;l.$duration=parseFloat((t/1e3).toFixed(3))}Yt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");const d=this.persistence.properties(),c=this.sessionPersistence.properties(),v=l.$groups,f=d.$groups;vi(v)&&!fi(v)&&(l.$groups=ls(ls({},vi(f)?f:{}),v)),Nn(["$referrer","$referring_domain"],t=>{t in d&&delete c[t]});const p={};if(this.$u.length>0)for(const t of this.$u.slice())try{jn(p,t())}catch(t){An.error("Failed to produce browser extension event properties",t)}l=jn({},a,d,c,ls(ls({},p),l)),l.$is_identified=this._isIdentified(),di(this.config.property_denylist)?Nn(this.config.property_denylist,function(t){delete l[t]}):An.error(Xa+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(An.error(Ya),l=_(l,t));const g=this.rh();return l.$process_person_profile=g,g&&!r&&this.oh("_calculate_event_properties"),l}ih(t,i=!0,e=!1){var s;if(!this.persistence||!this.rh())return t;if(this.Su&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=jn({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(An.error(Ya),o=l(o,"$set_once")),i&&(this.Su=!0),fi(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.nh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.sh()}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.xu.delete(t),this.sh()}ah(t,i){this.register({[t]:i})}Lu(){this.xu.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)||!yr.Et())return void yr.Lt(this.Cu);const i=[];this.xu.forEach(t=>i.push(t)),i.length>0?yr.At(this.Cu,i):yr.Lt(this.Cu)}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.au.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:Ja}),()=>{})}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:Ja})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ja})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=Na){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:Ja}}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:Ja})}uh(t){return!t||gi(t)?(An.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(An.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())||(An.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 An.uninitializedWarning("posthog.identify");if(yi(t)&&(t=t.toString(),An.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t))return;if(!this.oh("posthog.identify"))return;this.yu();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.nh(!1),o=this.persistence.Pl();let a=!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(l),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===It,h=t!==s,d=!h&&o;if(h&&o){var u;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(dt,Ft),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(Lt,n,{$set:i||{},$set_once:e||{}}),this.Eu=Pa(t,i,e),null===(u=this.featureFlags)||void 0===u||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(d){this.persistence.set_property(dt,Ft);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:s,$set_once:n}),this.Eu=Pa(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);h||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(lt)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.oh("posthog.setPersonProperties"))return;const e=Pa(this.get_distinct_id(),t,i);this.Eu!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Eu=e):An.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(di(t)?t:[t]).filter(t=>_i(t)&&t.length>0);0!==e.length&&this.oh("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Eu=null)}group(t,i,e){var s;if(!t||!i)return void An.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.nh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ls(ls({},n),{},{[t]:i})}),(r||e)&&this.rh()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Bt,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.oh("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=$i(t)?t:null==t?void 0:t.resetDeviceID,e=$i(t)||null==t?void 0:t.bootstrap;this.hh(i,!1,e)}hh(t,i=!1,e){var s,n,l,a,u,h;if(An.info("reset"),!this.__loaded)return An.uninitializedWarning("posthog.reset");const d=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Ru)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(l=n.updateConfig)||void 0===l||l.call(n,this.config,this.Xl());const c=this.get_property(r),v=this.get_property(o),f=this.get_property(S);null===(a=this.sessionRecording)||void 0===a||a.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),i||!p||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 _=null===(u=this.persistence)||void 0===u||null===(h=u.Pl)||void 0===h?void 0:h.call(u);let g=!1;try{var m,b,y,w,x,E,k,T,P,C,O,R,I;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(b=this.sessionPersistence)||void 0===b||b.clear(),this.xu.clear(),this.sh(),pi(f)||null===(C=this.persistence)||void 0===C||C.register({$session_recording_remote_config:f}),null===(y=this.surveys)||void 0===y||y.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(x=this.conversations)||void 0===x||x.reset(),null===(E=this.logs)||void 0===E||E.reset(),null===(k=this.metrics)||void 0===k||k.reset(),null===(T=this.persistence)||void 0===T||T.set_property("$user_state","anonymous"),null===(P=this.sessionManager)||void 0===P||P.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:mt,$device_id:null},"");else{const i=this.config.get_device_id(Zn());this.register_once({distinct_id:i,$device_id:t?i:c},""),t||pi(v)||this.register({[o]:v})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.fu()&&(null===(I=this.persistence)||void 0===I||I.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(O=this.featureFlags)||void 0===O||O.initialize(),!bi(d)&&!(null===(R=this.sessionManager)||void 0===R?void 0:R.setBootstrapSessionId(d,!0))){const t=ls({},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 F,A;_&&(null===(F=this.persistence)||void 0===F||null===(A=F.Ol)||void 0===A||A.call(F,g))}this.reloadFeatureFlags()}shutdown(t){var i=this;return Ai(function*(){var t,e,s,n,r,o,l,a;if(i.__loaded){i.ku=!0,i.zu().dispose(),null===(t=i.sessionRecording)||void 0===t||t.dispose(),null===(e=i.logs)||void 0===e||e.flushLogs("sendBeacon"),null===(s=i.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=i.metrics)||void 0===n||n.dispose(),null===(r=i.Fu)||void 0===r||r.unload(),null===(o=i.Du)||void 0===o||o.unload();try{var u;null===(u=i.featureFlags)||void 0===u||u.destroy()}catch(t){An.error("Error while destroying feature flags",t)}null===(l=i.persistence)||void 0===l||l.destroy(),null===(a=i.sessionPersistence)||void 0===a||a.destroy()}else An.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null===(e=this.conversations)||void 0===e||e.dh()}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.fh()}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")?(An.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(pi(i)&&(i=this.get_distinct_id()),t!==i?(this.ah(l,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(An.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=ls({},this.config);if(vi(t)){var s,n,r,o,l,a,u,h,d,c,v,f,p,_;jn(this.config,ou(t));const m=this.bu();null===(s=this.persistence)||void 0===s||s.update_config(this.config,i,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tl(ls(ls({},this.config),{},{persistence:"sessionStorage"}),m,!1);const b=this.Pu(this.config.debug);var g;$i(b)&&(this.config.debug=b),$i(this.config.debug)&&(this.config.debug?(e.DEBUG=!0,or.Et()&&or.At("ph_debug",!0),An.info("set_config",{config:t,oldConfig:i,newConfig:ls({},this.config)})):(e.DEBUG=!1,or.Et()&&or.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Xl()),null===(o=this.exceptionObserver)||void 0===o||o.onConfigChange(),null===(l=this.exceptions)||void 0===l||l.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.tracingHeaders)||void 0===h||h.startIfEnabledOrStop(),null===(d=this.autocapture)||void 0===d||d.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.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._u(),null===(_=this.externalIntegrations)||void 0===_||_.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&vo(this,Ga,!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(ls(ls({},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.ph}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:iu;return i!==iu&&(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"))}rh(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&fi(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))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return"never"===this.config.person_profiles?(An.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(gt,!0),!0)}bu(){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)}_u(){var t,i;const e=this.bu();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.gh(),(null===(t=this.persistence)||void 0===t?void 0:t.pi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.pi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),e&&(this.xu.clear(),this.sh()),e}opt_in_capturing(i){var e;if("always"!==this.config.cookieless_mode){if(this.fu()){var s,n,r,o,l,a;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new ba(this),this.pageViewManager=new go(this),this.persistence&&(this.sessionPropsManager=new pa(this,this.sessionManager,this.persistence));const i=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=t.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;i&&(this.sessionRecording=this.vu(this.sessionRecording,new i(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.lu)))}var d,c;this.consent.optInOut(!0),this._u(),this.Zu(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(pi(null==i?void 0:i.captureEventName)||(null==i?void 0:i.captureEventName))&&this.capture(null!==(c=null==i?void 0:i.captureEventName)&&void 0!==c?c:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else An.warn(Ka)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void An.warn(Ka);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var i,e;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:mt,$device_id:null}),this.du(t),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.Qu(),this.Zu())}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"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._u()}_is_bot(){return Ht?ya(Ht,this.config.custom_blocked_useragents):void 0}Qu(){qt&&("visible"===qt.visibilityState?this.Tu||(this.Tu=!0,this.capture(Nt,{title:qt.title},{send_instantly:!0}),this.Iu&&(qt.removeEventListener(Mt,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),Vn(qt,Mt,this.Iu)))}debug(t){!1===t?(null==Ut||Ut.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Ut||Ut.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}))}Xl(){const t=this.Ru||{};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?(An.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&&!bi(t[i]),o=e in t&&!bi(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,An)}Os(t){var i;if(bi(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(xi),s=di(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),bi(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return Si(t.event)?An.warn(`${i}. This can cause unexpected behavior.`):An.info(i),null}n.properties&&!fi(n.properties)||An.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return An.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&bi(n.properties[i]))return An.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 n}getPageViewId(){var t;return null===(t=this.pageViewManager.Bo)||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)})}Pu(t){const i=$i(t)&&!t,e=or.Et()&&"true"===or.Ot("ph_debug");return!i&&(!!e||t)}};au.__defaultExtensionClasses={},au.ph=(()=>{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]]=Bn(t.prototype[i[e]])}(au,["identify"]);var uu=class{constructor(t){this.disabled=!1===t;const i=vi(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 hu="$copy_autocapture",du=Mn("[AutoCapture]");function cu(t,i){return i.length>t?i.slice(0,t)+"...":i}function vu(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!xr(i));return i}function fu(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!xr(t))return{props:{}};const u=[t],h=new Set([t]);let d=t;for(;d.parentNode&&!Er(d,"body")&&1e3>u.length;){if(Tr(d.parentNode)){const t=d.parentNode.host;if(h.has(t))break;h.add(t),u.push(t),d=t;continue}if(!xr(d.parentNode))break;if(h.has(d.parentNode))break;h.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}const c="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>Er(t,"button")||Er(t,"a")):-1;c>0&&(s=s||u.slice(0,c+1).some(t=>!Gr(t)||Kr(t)));const v=[],f={};let p,_=!1,g=!1;if(Nn(u,t=>{const i=Gr(t);if(Er(t,"a")){const e=t.getAttribute("href");_=!!(i&&e&&eo(e))&&(o?Je(e):e)}ni(Or(t),"ph-no-capture")&&(g=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Ar.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?cu(1024,so(t)):cu(1024,Ir(t)));const l=Or(t);l.length>0&&(o.classes=l.filter(function(t){return""!==t})),Nn(t.attributes,function(e){var r;if((!Kr(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&eo(e.value)&&(!_i(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=Pr(t).join(" ")),o["attr__"+e.name]=cu(1024,"href"===e.name&&n?Je(t):t)}});let a=1,u=1,h=t;for(;h=vu(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Nn(function(t){if(!Gr(t))return{};const i={};return Nn(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&&eo(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),g)return{props:{},explicitNoCapture:g};if(c>0&&(t=u[c],v.splice(0,c)),s||(v[0].$el_text=Er(t,"a")||Er(t,"button")?so(t):Ir(t)),_){var m,b;v[0].attr__href=_;const t=null===(m=So(_))||void 0===m?void 0:m.host,i=null==Ut||null===(b=Ut.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(p=_)}return{props:jn((w=i.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(y=v,di(y)?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=ls(ls(ls(ls({},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 Ln(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[ro(t.toString())]=ro(i.toString())),s+=":",s+=Ln(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:oo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ln(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(y)):"")},(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 y,w}var pu=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(t){var i;if(!Gr(t))return!0;const e=null!==(i=this.vo().css_selector_ignorelist)&&void 0!==i?i:jr,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Or(t);if(ni(i,"ph-no-capture")||ni(i,"ph-sensitive")||Kr(t)||e.some(i=>Mr(t,i)))return!0;const r=n.parentNode;n=Tr(r)?r.host:r&&xr(r)?r:null}return!1}fo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.uo();if("pointerdown"===t.type){this.uo();const e=Fr(t);var i;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&xr(e)&&(this.ho={target:e,excluded:this.do(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.po)||void 0===i?void 0:i.distinctId}))}const e=this.ho;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.uo():"pointerup"===t.type&&(e.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(t){var i;const e=this.ho;this.uo();const s=Fr(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.po)||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&&(Er(s,"html")||Er(s,"body"))){var n;if(e.excluded)return null;const t=null!==(n=this.vo().css_selector_ignorelist)&&void 0!==n?n:jr;return[s,null==qt?void 0:qt.documentElement,null==qt?void 0:qt.body].some(i=>{if(!i)return!1;const e=Or(i);return ni(e,"ph-no-capture")||ni(e,"ph-sensitive")||!Gr(i)||Kr(i)||t.some(t=>Mr(i,t))})?null:e.target}}constructor(t){this.yo=t,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new uu(this.Mr.rageclick),this.xo=null}setup(t){this.Co(),this.po=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?i.dispose():(this.$o=i,this.startIfEnabled())}dispose(){var t;this.So||(this.So=!0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var t,i;return this.vo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(i=this.Mr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Mr}Io(){if(!this.isBrowserSupported())return void du.info("Disabling Automatic Event Collection because this browser is not supported");if(!Ut||!qt)return;const t=this.Mo=t=>{t=t||(null==Ut?void 0:Ut.event);try{if("blur"===t.type)return void this.uo();if(0===t.type.indexOf("pointer"))return void this.fo(t);const i="click"===t.type?this.mo(t):void 0;if(mi(i))return;this.Eo(t,"$autocapture",i)}catch(t){du.error("Failed to capture event",t)}};if(Vn(Ut,"blur",t),Vn(qt,"submit",t,{capture:!0}),Vn(qt,"change",t,{capture:!0}),Vn(qt,"click",t,{capture:!0}),Nn(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Vn(qt,i,t,{capture:!0})}),this.vo().capture_copied_text){const t=this.Po=t=>{t=t||(null==Ut?void 0:Ut.event);try{this.Eo(t,hu)}catch(t){du.error("Failed to capture clipboard event",t)}};Vn(qt,"copy",t,{capture:!0}),Vn(qt,"cut",t,{capture:!0}),Vn(qt,"paste",t,{capture:!0})}}To(){this.uo(),this.Mo&&(null==Ut||Ut.removeEventListener("blur",this.Mo),Nn(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==qt||qt.removeEventListener(t,this.Mo,!0)}),null==qt||qt.removeEventListener("submit",this.Mo,!0),null==qt||qt.removeEventListener("change",this.Mo,!0),null==qt||qt.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==qt||qt.removeEventListener("copy",this.Po,!0),null==qt||qt.removeEventListener("cut",this.Po,!0),null==qt||qt.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(t){if(this.So)return;if(this.wo=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.ko=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;$i(e)&&(null===(s=this.po)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this._o=e),this.startIfEnabled()}setElementSelectors(t){this.xo=t}getElementSelectors(t,i){var e;const s=[];return null===(e=this.xo)||void 0===e||e.forEach(e=>{const n=null==qt?void 0:qt.querySelectorAll(e);null==n||n.forEach(n=>{t!==n&&i!==n||ni(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.So)return!1;const e=null===(t=this.po)||void 0===t?void 0:t.kv.get(c),s=this._o,n=this.vo();if(!n.remoteRequestsDisabled&&!this.wo)return!1;const r=n.remoteRequestsDisabled&&!this.wo;if(mi(s)&&!$i(e)&&!r)return!1;const o=null!==(i=this._o)&&void 0!==i?i:!!e;return!!n.enabled&&!o}Eo(t,i="$autocapture",e){if(!this.isEnabled)return void this.uo();let s=e||Fr(t);kr(s)&&(s=s.parentNode||null);const n=this.Co();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()))&&qr(s,n.rageclick)&&this.Eo(t,"$rageclick",e);const o=i===hu,l=o?ls(ls({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;if(!Ut||Vr(t))return!1;if((null==e?void 0:e.url_allowlist)&&!Cr(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&Cr(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:l,targetElementList:a}=Wr(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(pi(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(a,e))return!1;if(!Dr(a,null==e?void 0:e.css_selector_allowlist))return!1;if(Dr(a,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:jr))return!1;try{const e=Ut.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const u=t.tagName.toLowerCase();switch(u){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 l?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Ar.indexOf(u)>-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}=fu(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===hu){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null==Ut||null===(u=Ut.getSelection())||void 0===u?void 0:u.toString(),i=Rr(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}return null===(a=this.po)||void 0===a||a.capture(i,e).catch(t=>du.error("Failed to capture event",t)),!0}}isBrowserSupported(){return ci(null==qt?void 0:qt.querySelectorAll)}},_u=class{constructor(t){this._instance=t}refresh(t){const i=this._instance.config,e=vi(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Xl(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}};const gu=Mn("[ExceptionAutocapture]"),mu=()=>{},bu=t=>{var i;if(ci(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function yu(t,i,e){try{if(!(i in t))return mu;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return ci(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=bu(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=bu(e)}}}catch(t){return mu}}const wu=Mn("[TracingHeaders]"),$u=Mn("[Web Vitals]"),Su=9e5,xu=["CLS","FCP","INP","LCP"],Eu=["INP","LCP"],ku=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Tu="disabled",Pu="lazy_loading",Cu=Mn("[SessionRecording]"),Ou=Mn("[Heatmaps]");function Ru(t){return vi(t)&&"clientX"in t&&"clientY"in t&&yi(t.clientX)&&yi(t.clientY)}const Iu=Mn("[Product Tours]"),Fu=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(b))},Au=["$set_once","$set"],Mu=Mn("[SiteApps]"),Du="Error while initializing PostHog app with config id ",Nu=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),ju="SDK is not enabled or survey functionality is not yet loaded",Lu="Disabled. Not loading surveys.";var Bu=class{constructor(t,i){this.yo=t,this.mh=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=t=>{if(this.So)return;if(this.Mr.disableSurveys)return;if(!t.ok)return Aa.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(bi(i))return Aa.warn("Flags not loaded yet. Not loading surveys.");this.Sh=$i(i)?i:i.length>0,Aa.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(t){if(!this.So)return this.xh=t,Nu(t.kv.initialize(),()=>{if(this.xh!==t||this.So)return;this.xh=void 0,this.po=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.So?i.dispose():(this.$o=i,this.loadIfEnabled())})}dispose(){var t,i,e,s;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null===(t=this.$o)||void 0===t||t.dispose(),this.$o=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.bh=[],this._h=null,this.kh.forEach(t=>clearTimeout(t)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null===(t=this._surveyEventReceiver)||void 0===t||t.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let t=0;t<localStorage.length;t++){const e=localStorage.key(t);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&i.push(e)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.So||!this.po)return;const t=this.Mr;if(this._surveyManager)return;if(this.yh)return void Aa.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Aa.info(Lu);if(t.cookielessMode&&this.yo.isOptedOut())return void Aa.info("Not loading surveys in cookieless mode without consent.");const i=this.yo.getExtensions();if(!i)return void Aa.error("PostHog Extensions not found.");if(pi(this.Sh)&&!t.advancedEnableSurveys)return;const e=this.Sh||t.advancedEnableSurveys;this.yh=!0;try{const t=i.generateSurveys;if(t)return this.Ch(t,e),void(this.yh=!1);const s=i.loadExternalDependency;if(!s)return this.$h(Rt),void(this.yh=!1);s(t=>{try{if(this.So)return;const i=this.yo.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.$h("Could not load surveys script",t):this.Ch(i.generateSurveys,e)}finally{this.yh=!1}})}catch(t){throw this.yh=!1,this.$h("Error initializing surveys",t),t}}Ch(t,i){this.So||(this._surveyManager=t(i),this._surveyEventReceiver=this.yo.createEventReceiver(),Aa.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(t,i){Aa.error(t,i),this.Th({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.bh.push(t),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(i=>i!==t)}}getSurveys(t,i=!1){var e;const s=null!==(e=this.po)&&void 0!==e?e:this.mh;if(!s||this.So)return;if(this.Mr.disableSurveys)return Aa.info(Lu),t([]);const n=s.kv.get(J);if(n&&!i)return t(n,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:i,context:e})=>{this.So||t(i,e)}).catch(t=>Aa.error("Error in survey callback",t));const r=this.Mh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Eh(s,t)}catch(t){return Aa.error("Error processing surveys response",t),this.Eh(s,{statusCode:0,error:t})}},t=>this.Eh(s,{statusCode:0,error:t}));this._h=r;const o=()=>{this._h===r&&(this._h=null)};r.then(i=>{o(),this.So||t(i.surveys,i.context)},o).catch(t=>Aa.error("Error in survey callback",t))}Mh(t,i){const e=this.po;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(ju)}))}Eh(t,i){if(this.So)return{surveys:[],context:{isLoaded:!1,error:ju}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?Aa.error(t):i.error||Aa.warn(t),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.wh=null;const s=i.json.surveys||[],n=s.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Sa(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)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),t.kv.set({[J]:s,[Y]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var t,i;const e=null===(t=null!==(i=this.po)&&void 0!==i?i:this.mh)||void 0===t?void 0:t.kv.get(Y);return yi(e)&&Date.now()-e>3e5}Rh(){return yi(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ma(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Th(t){for(const i of this.bh)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Aa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i=!1){if(!bi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Aa.warn("init was not called")}Ah(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}Fh(t){if(bi(this._surveyManager))return{eligible:!1,reason:ju};const i="string"==typeof t?this.Ah(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Oh(t){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(bi(this._surveyManager))return{eligible:!1,reason:ju};const i="string"==typeof t?this.Ah(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(bi(this._surveyManager))return Aa.warn("init was not called"),{visible:!1,disabledReason:ju};const i=this.Oh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return bi(this._surveyManager)?(Aa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ju})):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.Oh(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s;if(!this.yo.isCapturing())return;if(bi(this._surveyManager))return void Aa.warn("init was not called");const n="string"==typeof t?this.Ah(t):t;if(!(null==n?void 0:n.id))return void Aa.warn("Survey not found");if(!Da.includes(n.type))return void Aa.warn(`Surveys of type ${n.type} cannot be rendered in the app`);const r=null==qt?void 0:qt.querySelector(i);if(r){if(null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Aa.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s;this.kh.delete(t),!this.So&&this.yo.isCapturing()&&(Aa.info(`Rendering survey ${n.id} with delay of ${null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(n,r,e),Aa.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this.kh.add(t)}this._surveyManager.renderSurvey(n,r,e)}else Aa.warn("Survey element not found")}displaySurvey(t,i){var e;if(!this.yo.isCapturing())return;if(bi(this._surveyManager))return void Aa.warn("init was not called");const s=this.Ah(t);if(!s)return void Aa.warn("Survey not found");let n=s;if((null===(e=s.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds)&&i.ignoreDelay&&(n=ls(ls({},s),{},{appearance:ls(ls({},s.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==ol.Popover&&i.initialResponses&&Aa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.Fh(s);if(!t.eligible)return void Aa.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==ol.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}cancelPendingSurvey(t){bi(this._surveyManager)?Aa.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)}};function Uu(t,i,e){if(bi(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 zu=class{constructor(t){this._instance=t,this.Dh=new Set,this.Lh=new Set,this.Nh=new _a,this.qh=(t,i)=>this.jh(t,i)&&this.Bh(t,i)&&this.Hh(t,i)&&this.zh(t,i),this.jh=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;pi(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.Uh=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null===(t=this.Uh)||void 0===t||t.call(this),this.Uh=void 0,this.Nh=new _a}register(t){var i,e;if(!pi(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.Dh.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.Lh.add((null==t?void 0:t.event)||"")})}),null===(e=this._instance)||void 0===e?void 0:e.autocapture)){const t=new Set;this.Dh.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._instance.autocapture.setElementSelectors(t)}}replace(t){this.Dh.clear(),this.Lh.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Lh.has(t)||this.Lh.has(i.event))&&this.Dh.forEach(t=>{this.Wh(i,t)&&this.Nh.emit("actionCaptured",t.name)})}Vh(t){this.onAction("actionCaptured",i=>t(i))}Wh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.qh(t,e))return!0;return!1}onAction(t,i){return this.Nh.on(t,i)}Bh(t,i){if(null==i?void 0:i.url){var e;const s=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!s||"string"!=typeof s)return!1;if(!Uu(s,i.url,i.url_matching||"contains"))return!1}return!0}Hh(t,i){return!!this.Gh(t,i)&&!!this.Zh(t,i)&&!!this.Qh(t,i)}Gh(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.Jh(t);if(s.length>0)return s.some(t=>Uu(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&&Uu(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Zh(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.Jh(t);if(s.length>0)return s.some(t=>Uu(t.text,i.text,i.text_matching||"exact")||Uu(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(;!bi(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=>Uu(t,o,l)));var r,o,l}Qh(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}return!1}Jh(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}zh(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||Ta(i.properties.reduce((t,i)=>{const e=di(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)}},Hu=class{constructor(t){var i,e;this.Kh=[],this._instance=t,this.Xh=new Map,this.Yh=new Map,this.tc=new Map,this.ec=null===(i=this._instance)||void 0===i||null===(e=i.onSessionId)||void 0===e?void 0:e.call(i,t=>this.nc(t))}sc(t){return!1}rc(){return null}oc(t){}lc(){}ac(t,i){return!!t&&Ta(t.propertyFilters,null==i?void 0:i.properties)}uc(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}hc(t,i,e){const s=(e===el.Activation?this.Xh:this.Yh).get(t);let n=[];return this.cc(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.ac(r,i)})}register(t){this.dc(t,!1)}replace(t){this.dc(t,!0)}dc(t,i){var e;pi(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this.vc(t,i),this.fc(t,i))}fc(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.tc.clear(),0===e.length)return void(i&&(null===(s=this.gc)||void 0===s||s.replace([])));this.gc||(this.gc=new zu(this._instance),this.gc.init(),this.gc.Vh(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.tc.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.tc.set(i.name,s)}})}),i?this.gc.replace(n):this.gc.register(n)}mc(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)})}vc(t,i){var e,s;const n=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}),r=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}),o=this.uc(t,el.Activation),l=this.uc(t,el.Cancellation);i?(this.Xh=o,this.Yh=l):(this.mc(this.Xh,o),this.mc(this.Yh,l)),(0!==n.length||0!==r.length)&&(null!==(e=this.Uh)&&void 0!==e||(this.Uh=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.yc(),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 i=this.bc(t,r);if("consume"===i)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this._c([r]);if("persist"===i)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.wc(r),void this.kc([r])}if(this.Yh.has(t)){const e=this.hc(t,i,el.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this._c(e.map(t=>t.id)),e.forEach(t=>this.Sc(t.id)))}if(!this.Xh.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.Xh.get(t)});const o=this.hc(t,i,el.Activation);this.xc(o.map(t=>t.id))}onAction(t){this.tc.has(t)&&this.xc(this.tc.get(t)||[])}xc(t){var i,e;if(0===t.length)return;const s=!!(null===(i=this._instance)||void 0===i||null===(e=i.get_session_id)||void 0===e?void 0:e.call(i)),n=[];for(const i of t)s&&this.sc(i)?this.wc(i)&&this.Cc(i):n.push(i);n.length>0&&(this.Kh=[...new Set([...this.Kh,...n])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(t){this.Kh=this.Kh.filter(i=>i!==t);const i=this.$c();return!i.includes(t)&&(this.Tc([...i,t]),this.Ic(),!0)}_c(t){const i=new Set(t);this.Kh=this.Kh.filter(t=>!i.has(t));const e=this.Mc(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.Tc(s),0===s.length&&this.Ec()),this.kc(t)}Pc(){var t;const i=this.rc();if(!i)return{};const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Cc(t){if(!this.rc())return;const i=this.Pc();this.oc(ls(ls({},i),{},{[t]:Date.now()}))}kc(t){if(!this.rc())return;const i=this.Pc(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(fi(e)?this.lc():this.oc(e))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(t){if(!this.$c().includes(t))return;const i=this.Pc()[t];return yi(i)?i:void 0}Mc(){var t;const i=this.Ac();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[i])||[]}$c(){var t,i,e;const s=this.Mc();if(0===s.length)return[];const n=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Fc()],r=null===(i=this._instance)||void 0===i||null===(e=i.get_session_id)||void 0===e?void 0:e.call(i);return r&&n===r?s:[]}Ic(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);e&&this.Oc(e)}Ec(){this.Dc()}nc(t){var i;const e=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.props[this.Fc()];if(e&&e!==t){const t=this.Mc(),i=this.Pc();t.length>0&&(this.Tc([]),t.filter(t=>yi(i[t])).forEach(t=>this.Sc(t))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(t=>!this.Lc(t))}dispose(){var t,i,e;null===(t=this.ec)||void 0===t||t.call(this),this.ec=void 0,null===(i=this.Uh)||void 0===i||i.call(this),this.Uh=void 0,null===(e=this.gc)||void 0===e||e.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}getEventToItemsMap(){return this.Xh}Nc(){return this.gc}},qu=class extends Hu{constructor(t){super(t)}Ac(){return X}Fc(){return Q}rc(){return Z}oc(t){var i;null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$surveys_activated_timestamps:t})}lc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}sc(t){var i;let e;this.cc(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return yi(s)&&s>0}qc(){return nl.SHOWN}cc(t){var i;null===(i=this._instance)||void 0===i||i.getSurveys(t)}Sc(t){var i;null===(i=this._instance)||void 0===i||i.cancelPendingSurvey(t)}yc(){return Aa}Tc(t){var i;null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$surveys_activated:t})}Oc(t){var i;null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$surveys_activated_session:t})}Dc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Lc(){return!1}bc(t,i){let e;return this.cc(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return Sa(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(e)?t===nl.SHOWN?"consume":"ignore":t===nl.SHOWN?"persist":t===nl.DISMISSED||t===nl.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Vu=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const i={};for(const e of t){const t=this._instance.get_property(e);pi(t)||(i[e]=t)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},Wu=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==Zt?void 0:Zt.__PosthogExtensions__;if(!t)return;const{generateSurveys:i,loadExternalDependency:e}=t;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}createEventReceiver(){return new qu(this._instance)}};const Gu=(null==Ut?void 0:Ut.location)?ko(Ut.location.hash,"__posthog")||ko(location.hash,"state"):null,Ku="_postHogToolbarParams",Ju=Mn("[Toolbar]"),Yu=Mn("[FeatureFlags]");var Xu=class{constructor(t,i=!1){this.jc=!1,this.update(t,i)}update(t,i){this.Bc=((t,i)=>{var e,s,n,r,o,l,a;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:pi(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:di(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.jc||(Yu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),pi(t.flag_keys)||di(t.flag_keys)||Yu.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const Qu=Mn("[FeatureFlags]"),Zu=Mn("[FeatureFlags]",{debugEnabled:!0}),th="\" failed. Feature flags didn't load in time.",ih=["click","keydown","wheel","touchstart","pointerdown"],eh="connection_error",sh=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},nh=t=>{const i={};for(const[e,s]of Ln(t||{}))s&&(i[e]=s);return i},rh=t=>Ti(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),oh=Mn("[Error tracking]"),lh="webkit-masked-url:",ah=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],uh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",lh],hh=["__firefox__","__gCrWeb"],dh="Refusing to render web experiment since the viewer is a likely bot",ch={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>xa(i,t),not_regex:(t,i)=>!xa(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},vh=Mn("[Conversations]"),fh="Conversations not available yet.";function ph(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,d=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=pi(d)?Math.max(h,2048):Math.max(h,d),v=ls(ls({},function(){let t="",i="";try{const e=null==Ht?void 0:Ht.userAgent;e&&([t,i]=Ne(e))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(mn,t)?mn[t]:t}(t);return ls(ls({},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:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const _h=["debug","log","warn","error","info"],gh=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},mh="console",bh="__posthogHandledLogsRequestError",yh=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[bh]=!0,e},wh=t=>!!t&&"object"==typeof t&&!0===t[bh],$h=Mn("[NetworkMetrics]"),Sh=()=>{var t;return(null==Ut||null===(t=Ut.performance)||void 0===t?void 0:t.now)?Ut.performance.now():Date.now()},xh=t=>t?`${Math.floor(t/100)}xx`:"missing",Eh=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=So(s))||void 0===e?void 0:e.href)||s}},kh=(t,i,e,s,n)=>{try{var r,o,l;const u=n();if(!u)return;const h=e||void 0,d=Sh()-s,c=So(i.url);if(c&&"http:"!==c.protocol&&"https:"!==c.protocol)return;const v={url:(null==c?void 0:c.href)||i.url,method:i.method},f=ci(u.name)?u.name(v):_i(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=ls({method:v.method,host:null!==(r=null==c?void 0:c.hostname)&&void 0!==r?r:"",path:c?(a=c.pathname,a.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/")):"",status_class:xh(h)},null===(o=u.attributes)||void 0===o?void 0:o.call(u,v,{status:h,durationMs:d}));null===(l=t.metrics)||void 0===l||l.histogram(f,d,{unit:"ms",attributes:p})}catch(t){$h.error("Failed to record network metric",t)}var a},Th=()=>{},Ph=(t,i)=>ci(null==Ut?void 0:Ut.fetch)?yu(Ut,"fetch",e=>function(...s){const n=Sh(),r=e.apply(this,s);if(!i())return r;try{var o,l,a;const[e,u]=s,h=Eh(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=>(kh(t,h,null==e?void 0:e.status,n,i),e),e=>{throw kh(t,h,void 0,n,i),e})}catch(t){return $h.error("Failed to observe fetch",t),r}}):Th,Ch=(t,i)=>{var e;const s=null==Ut||null===(e=Ut.XMLHttpRequest)||void 0===e?void 0:e.prototype;if(!s)return Th;const n=new WeakMap,r=yu(s,"open",t=>function(...i){try{(()=>Kl.has(this))()||n.set(this,Eh(i[0],i[1]))}catch(t){$h.error("Failed to observe XHR open",t)}return t.apply(this,i)}),o=yu(s,"send",e=>function(...s){let r;try{const e=n.get(this);if(e&&i()){const s=Sh();r=()=>{this.removeEventListener("loadend",r),kh(t,e,this.status,s,i)},Vn(this,"loadend",r)}}catch(t){$h.error("Failed to observe XHR send",t)}try{return e.apply(this,s)}catch(t){throw r&&this.removeEventListener("loadend",r),t}});return()=>{r(),o()}},Oh={featureFlags:class{constructor(t){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=Qu,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.sn=()=>{const t=this.ed();this.Yc=0,t&&this.reloadFeatureFlags()},this.nd=()=>{var t,i;const e=this.sd,s=null!==(t=this.rd)&&void 0!==t?t:e;pi(e)||pi(s)||this.Mr.remoteRequestsDisabled||!qt||"hidden"===qt.visibilityState||Date.now()-(null!==(i=this.od)&&void 0!==i?i:0)<s||(this.rd=this.td||!this.Mr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{"visible"===(null==qt?void 0:qt.visibilityState)&&this.ud()},"get"in t?this.yo=t:(this._instance=t,this.hd=new Xu(t.config,t.Xl()),this.yo=this.hd)}updateConfig(t,i){var e;null===(e=this.hd)||void 0===e||e.update(t,i),this.po&&this.dd()}setup(t){return this.xh=t,this.$=t.logger.createLogger("[FeatureFlags]"),Nu(t.kv.initialize(),()=>{this.xh===t&&(this.xh=void 0,this.po=t,this.vd(t))})}vd(t){var i;if(this.po===t)return Ut&&Vn(Ut,"online",this.sn),this.dd(),this.fd=t.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const t=this.Mr.refreshIntervalMs,i=!this.Mr.remoteRequestsDisabled&&qt&&!pi(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.rd=i),i!==this.sd&&(this._d(),pi(i)||(this.sd=i,this.rd=i,this.ld(),(null==qt?void 0:qt.addEventListener)&&(Vn(qt,Mt,this.an),Dn(ih,t=>{Vn(qt,t,this.ad,{capture:!0})}))))}ld(){pi(this.sd)||(pi(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var t;pi(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==qt||null===(t=qt.removeEventListener)||void 0===t||t.call(qt,"visibilitychange",this.an),Dn(ih,t=>{var i;null==qt||null===(i=qt.removeEventListener)||void 0===i||i.call(qt,t,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var t,i;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null===(t=this.fd)||void 0===t||t.dispose(),this.fd=void 0,null===(i=this.gd)||void 0===i||i.call(this),this.gd=void 0,this.Wc=[],null==Ut||Ut.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(t){var i;return this.Cd&&t in this.Cd?this.Cd[t]:null===(i=this.po)||void 0===i?void 0:i.kv.get(t)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var t;return!pi(null===(t=this.po)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.md()}At(t){this.Td(()=>{var i;return null===(i=this.po)||void 0===i?void 0:i.kv.set(t)})}Id(t,i,e){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!t.$enabled_feature_flags)return;const n=this.xd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=i.flags||i.featureFlags,l=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!i.errorsWhileComputingFlags&&!!i.flags,u=a?l:e&&!di(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),h=this.xd("$feature_flag_payloads")||{},d=t.$feature_flag_payloads||{},c=a||e?u:Array.from(new Set([...Object.keys(h),...Object.keys(d)])),v=!a&&!e,f=!!v||u,p=!!v||c,_={[j]:f,[N]:f,[U]:p};t.$feature_flag_details&&(_[B]=f);for(const i of[z,ht,H])pi(t[i])||(_[i]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}Lt(t){this.Td(()=>{var i;return null===(i=this.po)||void 0===i?void 0:i.kv.remove(t)})}Td(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}yd(){const t={};for(const i of[j,U,z,q]){const e=this.xd(i);pi(e)||(t[i]=e)}this.zc=t;const i=ls({},t),e=this.xd(N);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this.Uc=i}pd(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.xd(ht);return"number"!=typeof i||Date.now()-i>t}Md(){return!!this.pd()&&(this.Xc||this.Gc||(this.Xc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Pd(){const t=this.Mr.flagKeys;if(!pi(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Mr,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=>!pi(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this.Rd({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.xd("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.xd("$feature_flag_payloads"))&&void 0!==n?n:{},l=ls(ls({},r),t),a=ls(ls({},o),i),u={};for(const[t,i]of Object.entries(l))u[t]={key:t,enabled:Ks(i),variant:Js(i),reason:void 0,metadata:pi(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.xd(B),i=this.xd(q),e=this.xd(V);if(!e&&!i)return t||{};const s=jn({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r;const n=s[t],l=null==i?void 0:i[t],a=pi(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,u=pi(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],d=ls(ls({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});var o;a!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),h&&(d.metadata=ls(ls({},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]=d}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.Hc=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:Ks(s),variant:Js(s),payload:Gs(i[e])}})}getFlagVariants(){const t=this.xd(N),i=this.xd(q);if(!i)return t||{};const e=jn({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Hc=!0),e}getFlagPayloads(){const t=this.xd(U),i=this.xd(V);if(!i)return t||{};const e=jn({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Hc=!0),e}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(t){return this.Wc.push(t),()=>{this.Wc=this.Wc.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qc=t}resetFlagCallReported(){this.Lt(lt)}Fd(t){this.Sd();const i=this.po;if(!i||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!0);const e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ls(ls(ls({},i.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.xd(G),timezone:zo()};pi(i.deviceId)||(e.$device_id=i.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(e.disable_flags=!0);const s=this.Ed();s.length&&(e.evaluation_contexts=s);const n=this.Pd();pi(n)||(e.flag_keys=n);const r=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),l=this.Zc;this.Gc=!0;const a=()=>{this.Jc&&(this.Jc=!1,this.Fd())},u=t=>{var i,s;const n=null!==(i=t.json)&&void 0!==i?i:{},o=200!==t.statusCode;if(this.Gc=!1,l!==this.Zc)return void a();if(this.Od(t.statusCode),o||this.Jc||(this.$anon_distinct_id=void 0),e.disable_flags&&!this.Jc)return;this.Kc=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?eh:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[ut]:u}),h?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):e.disable_flags||this.Rd(n,o,{partialResponse:r}),a()},h=t=>{this.Gc=!1,l===this.Zc?(this.At({[ut]:[eh]}),this.$.error("Feature flag request failed",t),this.$d()&&this.bd(!0),a()):a()};try{i.sendRequest(o,{target:"flags",method:"POST",body:e,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(h)}catch(t){h(t)}}ed(){return To(this.Yc,3)}Od(t){this.Yc=Po(t,this.Yc,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i={}){var e;if(i.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+th);if(this.Md())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){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+th);if(this.Md())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.xd("$feature_flag_request_id")||void 0,a=this.xd("$feature_flag_evaluated_at")||void 0;let u,h=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var d;const t=null===(d=this.po)||void 0===d?void 0:d.session.sessionId,i=this.xd(at);t&&t!==i&&(h={},u=t)}if(i.send_event||!("send_event"in i))if(t in h&&h[t].includes(o))u&&this.At({[lt]:h,[at]:u});else{var c,v,f,p,_,g,m,b,y,w,S,x;di(h[t])?h[t].push(o):h[t]=[o],this.At(ls({[lt]:h},u?{[at]:u}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(c=this.xd("$feature_flag_errors"))&&void 0!==c?c:[]];pi(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(_=this.Mr.bootstrap)||void 0===_||null===(_=_.featureFlagPayloads)||void 0===_?void 0:_[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.Kc};pi(null==i||null===(g=i.metadata)||void 0===g?void 0:g.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),pi(null==i||null===(m=i.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=i.metadata.version);const d=null!==(b=null==i||null===(y=i.reason)||void 0===y?void 0:y.description)&&void 0!==b?b:null==i||null===(w=i.reason)||void 0===w?void 0:w.code;var E;d&&(s.$feature_flag_reason=d),(null==i||null===(S=i.metadata)||void 0===S?void 0:S.id)&&(s.$feature_flag_id=i.metadata.id),pi(null==i?void 0:i.original_variant)&&pi(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=pi(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(x=i.metadata)||void 0===x?void 0:x.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(E=i.metadata)||void 0===E?void 0:E.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.Dd(s)}else u&&this.At({[lt]:h,[at]:u});return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:Gs(r)}:void 0}Dd(t){try{var i;null===(i=this.po)||void 0===i||i.capture("$feature_flag_called",t).catch(t=>{this.$.error("Failed to capture feature flag call",t)})}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Ld(t,i)}Ld(t,i){var e=this;return Ai(function*(){const s=e.po;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.Ed();r.length&&(n.evaluation_contexts=r);const o=e.Pd();let l;pi(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.Mr.compression,sentAt:"body",timeoutMs:e.Mr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.$.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Kc)return i.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+th),i.defaultValue;const e=this.getFeatureFlag(t,i);return pi(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.Rd(t,i,e)}Rd(t,i,e){if(!this.po)return;this.Vc=!0;const s=((t,i={},e={},s={},n,r=Qu)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).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].enabled).filter(t=>{var i;return!pi(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 ls(ls({},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,d=t.evaluatedAt;if(di(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{[j]:a,[N]:t,[H]:!1}}let c=a,v=u,f=l;if(null==n?void 0:n.partialResponse){const t=Object.keys(c),n=v||{};c=ls(ls({},i),c),v=ls(ls({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=ls(ls({},s),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var i;return!(null===(i=l[t])||void 0===i?void 0:i.failed)}));c=ls(ls({},i),Object.fromEntries(Object.entries(c).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(v||{}).filter(([i])=>t.has(i)));v=ls(ls({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=ls(ls({},s),Object.fromEntries(Object.entries(f||{}).filter(([i])=>t.has(i))))}else c=ls(ls({},i),c),v=ls(ls({},e),v),f=ls(ls({},s),f);return ls(ls({[j]:Object.keys(nh(c)),[N]:c||{},[U]:v||{},[B]:f||{},[H]:!0===t.minimalFlagCalledEvents},h?{[z]:h}:{}),d?{[ht]:d}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.$);if(s)if(!1===(null==e?void 0:e.persist)){const t=!pi(this.po.kv.get(N));this.Cd=s,t||this.At(s)}else this.md(),this.Id(s,t,!!(null==e?void 0:e.partialResponse)),this.At(s);else i&&this.$d();i||(this.Xc=!1),this.bd(i)}override(t,i=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Nd(t)}Nd(t){if(this.po){if(!1===t)return this.Lt([q,V]),this.bd(),void Zu.info("All overrides cleared");if(di(t))return this.At({[q]:sh(t)}),this.bd(),void Zu.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.Hc=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[q]=di(n)?sh(n):n),r&&(s[V]=r),Object.keys(s).length&&this.At(s),!1===n&&!1===r?this.Lt([q,V]):!1===n?this.Lt(q):!1===r&&this.Lt(V),this.bd(),!1===n?Zu.info("Flag overrides cleared"):n&&Zu.info("Flag overrides set",{flags:n}),void(!1===r?Zu.info("Payload overrides cleared"):r&&Zu.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[q]:t}),this.bd(),void Zu.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Vc){const{flags:i,flagVariants:e}=this.qd();try{t(i,e)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const n=(this.xd("$early_access_features")||[]).find(i=>i.flagKey===t),r={[`$feature_enrollment/${t}`]:i},o={$feature_flag:t,$feature_enrollment:i,$set:r};n&&(o.$early_access_feature_name=n.name),e&&(o.$feature_enrollment_stage=e);const l=ls(ls({},this.getFlagVariants()),{},{[t]:i});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[j]:Object.keys(nh(l)),[N]:l,[W]:ls(ls({},this.xd("$stored_person_properties")||{}),r)}),this.bd();try{var a;null===(a=this.po)||void 0===a||a.capture("$feature_enrollment_update",o).catch(t=>{this.$.error("Failed to capture early access feature enrollment",t)})}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const s=this.xd(L);!s||i?this.jd(t,e):t(s)}jd(t,i){var e=this;return Ai(function*(){const s=e.po;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.At({[L]:r})}catch(t){return void e.$.error("Early access feature request failed",t)}try{t(r)}catch(t){e.$.error("Early access feature callback failed",t)}})()}qd(){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),{})}}bd(t){this.yd();const{flags:i,flagVariants:e}=this.qd();this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i=!0){this.Bd(t,i)}Bd(t,i=!0){const e=this.xd("$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.At({[W]:ls(ls(ls({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=ls({},this.xd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.At({[W]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(W),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.xd("$stored_group_properties")||{},s=ls({},e);for(const i of Object.keys(t))s[i]=ls(ls({},e[i]),t[i]);this.At({[G]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.xd("$stored_group_properties")||{};this.At({[G]:ls(ls({},i),{},{[t]:{}})})}else this.Lt(G)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Yc=0}}},Rh={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Hd)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!==(t=null===(i=this.Hd)||void 0===i?void 0:i.status)&&void 0!==t?t:this.zd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.zd=Tu,this.Ud=void 0,this.Wd=!1,this.Ke=(()=>{var t,i;if(!(null==qt?void 0:qt.visibilityState)||"visible"===qt.visibilityState)return!0;const e=null==Ut||null===(t=Ut.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.an=()=>{var t,i;"visible"===(null==qt?void 0:qt.visibilityState)&&(this.Ke=!0,null===(t=this.Hd)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw Cu.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==qt?void 0:qt.addEventListener)&&Vn(qt,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.Wd=!0,null==qt||null===(i=qt.removeEventListener)||void 0===i||i.call(qt,"visibilitychange",this.an),t?this.Vd(!0):this.stopRecording()}get Gd(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),e=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return Ut&&i&&e&&!s}startIfEnabledOrStop(t){var i;if(this.Wd)return;if(this.Gd&&(null===(i=this.Hd)||void 0===i?void 0:i.isStarted))return;const e=!pi(Object.assign)&&!pi(Array.from);this.Gd&&e?(this.Zd(t),Cu.info("starting")):(this.zd=Tu,this.stopRecording())}Zd(t){var i,e;if(this.Gd)if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=Pu),(null==Zt||null===(i=Zt.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=Zt.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Qd(t);else{var s,n;const i=this._instance.sessionManager;null===(s=Zt.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Jd,e=>{if(!this.Wd&&this.Gd&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Cu.error("could not load recorder",e)):void this.Qd(t);this.zd="disabled"})}}stopRecording(){var t,i;null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=void 0,null===(i=this.Hd)||void 0===i||i.stop()}Vd(t=!1){var i,e;null===(i=this.Ud)||void 0===i||i.call(this),this.Ud=void 0,null===(e=this.Hd)||void 0===e||e.discard({discardProducerEvents:t})}Kd(){var t,i;null===(t=this.xa)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.xa)||void 0===i||i.unregister("$replay_sample_rate")}Xd(t,i){if(bi(t))return null;const e=yi(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(Cu.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Yd(t){if(this.xa){var i,e;const s=this.xa,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Xd(null===(i=this.Mr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Xd(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;bi(o)&&this.Kd();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[S]:ls(ls({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:ls({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:pi(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.Ud)||void 0===i||i.call(this),this.Ud=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.Yd(i),void this.Vd()):(this.Yd(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.zd&&(this.zd="missing_config",Cu.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.Hd)||void 0===e?void 0:e.log)?this.Hd.log(t,i):Cu.warn("log called before recorder was ready")}get Jd(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(S);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}tv(){const t=this._instance.get_property(S);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return Cu.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!bi(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Qd(t){var i,e,s;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return Cu.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[$t]:!0});var n;if(this.Hd||(this.Hd=null===(n=Zt.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv()){if("missing_config"===this.zd||"awaiting_config"===this.zd)return;return this.zd="awaiting_config",Cu.info("persisted remote config is stale, requesting fresh config before starting"),void new vl(this._instance).load()}this.zd=Pu,null===(e=(s=this.Hd).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Ke),this.Hd.start(t)}else this.zd=Tu}onRRwebEmit(t){var i,e;null===(i=this.Hd)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this.Hd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this.Hd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this.Hd||null===(e=this.xa)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this.Hd)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Hd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!!(null===(e=this.Hd)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.Hd)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}}},Ih={autocapture:class extends pu{constructor(t){super(new _u(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.nv();return!!(t.path||t.search||this.sv(t))}startIfEnabled(){this.isEnabled&&(An.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,An.info("History API monitoring stopped")}monitorHistoryChanges(){Ut&&Ut.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(t){var i;if(!Ut||(null===(i=Ut.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const e=this;yu(Ut.history,t,i=>function(s,n,r){i.call(this,s,n,r),e.hv(t)})}iv(){const t=null==Ut?void 0:Ut.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}nv(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:vi(t)?t:{}}sv(t=this.nv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}dv(t){const i=this.nv(),e=this.ev;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.sv(i)&&t.hash!==e.hash))}hv(t){try{const i=this.iv();if(!i)return;this.dv(i)&&this._instance.capture(Nt,{navigation_type:t}),this.ev=i}catch(i){An.error(`Error capturing ${t} pageview`,i)}}av(){if(this.rv)return;const t=()=>{this.hv("popstate")};Vn(Ut,"popstate",t),this.rv=()=>{Ut&&Ut.removeEventListener("popstate",t)}}uv(){if(this.ov)return;const t=()=>{this.hv("hashchange")};Vn(Ut,"hashchange",t),this.ov=()=>{Ut&&Ut.removeEventListener("hashchange",t)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var i;this.vv=!1,this.bo=!1,this.fv=null,this.instance=t,this.vv=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[v]),this.rageclicks=new uu(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return vi(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return bi(this.Mr.capture_heatmaps)?bi(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Ou.info("starting..."),this.pv(),this.an()}else{var t;clearInterval(null!==(t=this.fv)&&void 0!==t?t:void 0),this.gv(),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({[v]:e}),this.vv=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}mv(t){Ru(t.originalEvent)&&this.Cr(t.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==qt?void 0:qt.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){Ut&&qt&&(this.yv=this.fa.bind(this),Vn(Ut,Dt,this.yv),this.bv=t=>this.Cr(t||(null==Ut?void 0:Ut.event)),Vn(qt,"click",this.bv,{capture:!0}),this._v=t=>this.wv(t||(null==Ut?void 0:Ut.event)),Vn(qt,"mousemove",this._v,{capture:!0}),this.Sv=new ho(this.instance,ao,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),Vn(qt,Mt,this.xv),this.bo=!0)}gv(){var t;Ut&&qt&&(this.yv&&Ut.removeEventListener(Dt,this.yv),this.bv&&qt.removeEventListener("click",this.bv,{capture:!0}),this._v&&qt.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&qt.removeEventListener(Mt,this.xv),clearTimeout(this.Cv),null===(t=this.Sv)||void 0===t||t.stop(),this.bo=!1)}$v(t,i){const e=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=function(t,i,e){let s=t;for(;s&&xr(s)&&!Er(s,"body");){if(s===e)return!1;let t;try{var n,r,o;t=null===(n=null!==(r=null===(o=s.ownerDocument)||void 0===o?void 0:o.defaultView)&&void 0!==r?r:Ut)||void 0===n?void 0:n.getComputedStyle(s).position}catch(t){return!1}if(ni(i,t))return!0;s=Nr(s)}return!1}(Fr(t),["fixed","sticky"],n);return{x:t.clientX+(r?0:s),y:t.clientY+(r?0:e),target_fixed:r,type:i}}Cr(t,i="click"){var e;if(Sr(t.target)||!Ru(t))return;const s=this.$v(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&qr(Fr(t),this.instance.config.rageclick)&&this.Zs(ls(ls({},s),{},{type:"rageclick"})),this.Zs(s)}wv(t){!Sr(t.target)&&Ru(t)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(t,"mousemove"))},500))}Zs(t){if(!Ut)return;const i=this.Mr.disable_capture_url_hashes?Je(Ut.location.href):Ut.location.href,e=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Co,...e||[]]:[],n=Eo(i,s,Ro);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(t)}fa(){this.Rt&&!fi(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ho,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ls({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>ls(ls({},t),{},{[`$web_vitals_${i.name}_event`]:ls({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},bi(null==t?void 0:t.name)||bi(null==t?void 0:t.value))return void $u.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Ev(e);if(pi(s))return;const n=yi(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.Pv&&t.value>=this.Pv)return void $u.error("Ignoring metric with value >= "+this.Pv,t);this.Rt.navigationKey!==n&&(this.Tv(),this.Iv=setTimeout(this.Tv,this.flushToCaptureTimeoutMs)),pi(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=pi(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=ls(ls(ls({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,vi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of ku){const s="url"===e&&"string"==typeof t.attribution[e]?this.Ev(t.attribution[e]):t.attribution[e];pi(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;pi(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Tv()},this.Rv=()=>{if(this.bo)return;let t,i,e,s,n=!1;const r=Zt.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.Av])||("web-vitals"===this.Av&&pi(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!pi(l)){const r=l.withoutAttribution,o=this.attributionMetrics;n=!pi(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,i=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,e=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,s=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&i&&e&&s))return void $u.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=n&&this.attributionMetrics.indexOf("INP")>-1?ls(ls({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Mv.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Mv.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Mv.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&s(this.Mv.bind(this),u),this.bo=!0},this.vv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[g]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=vi(this.Fv)?null===(t=this.Fv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return bi(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||xu:e}get flushToCaptureTimeoutMs(){return(vi(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=vi(this.Fv)?this.Fv.web_vitals_attribution:void 0;return $i(t)?t?xu:[]:di(t)?t:Eu}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=vi(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Pv(){const t=vi(this.Fv)&&yi(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Su;return t>0&&6e4>=t?Su:t}get isEnabled(){const t=null==Vt?void 0:Vt.protocol;if("http:"!==t&&"https:"!==t)return $u.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=vi(this.Fv)?this.Fv.web_vitals:$i(this.Fv)?this.Fv:void 0;return $i(i)?i:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&($u.info("enabled, starting..."),this.No(this.Rv))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=vi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=vi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:e}),this._instance.persistence.register({[w]:s})),this.vv=e,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(t){var i;const e=Zt.__PosthogExtensions__,s=this.Av,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&pi(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?$u.error("failed to load script",i):t()})}Ev(t){const i=t||(null==Ut?void 0:Ut.location.href);if(!i)return void $u.error("Could not determine current URL");const e=this._instance.config.disable_capture_url_hashes?Je(i):i,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Co,...s||[]]:[];return Eo(e,n,Ro)}}},Fh={exceptionObserver:class{constructor(t){var i;this.Rv=()=>{var t;if(!Ut||!this.isEnabled||!(null===(t=Zt.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=Zt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=Zt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=Zt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=i(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=e(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=s(this.captureException.bind(this)))}catch(t){gu.error("failed to start",t),this.Nv()}},this._instance=t,this.qv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[f]),this.wt=new ji(ls(ls({},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,$:gu})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return vi(t)?i=ls(ls({},i),t):(pi(t)?this.qv:t)&&(i=ls(ls({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gu.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return gu.error("failed to load script",i);t()})}Nv(){var t,i,e;null===(t=this.Ov)||void 0===t||t.call(this),this.Ov=void 0,null===(i=this.Dv)||void 0===i||i.call(this),this.Dv=void 0,null===(e=this.Lv)||void 0===e||e.call(this),this.Lv=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.qv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[f]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}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.wt.consumeRateLimit(n))return void gu.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.Bv=[],this.Hv=new as([new Cs,new Ls,new Rs,new Os,new Ns,new Ds,new Fs,new js],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=ws.test(s)?s.replace(ws,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Ss(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(Ts(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=Es(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)xs(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++)Ps(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 ls(ls({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",gs,ys)),this._instance=t,this.Bv=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.zv=qs(this.Uv()),this.Wv=new Vs(this.zv)}onConfigChange(){this.zv=qs(this.Uv()),this.Wv.setConfig(this.zv)}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.Bv=r,this._instance.persistence&&this._instance.persistence.register({[p]:this.Bv,[_]:o})}get Vv(){var t;const i=!!this._instance.get_property(_),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Hv.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.zv.enabled)try{if(!_i(t)||0===t.trim().length)return void oh.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)=>zs.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Gv(i));s.length>0&&oh.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Wv.add(ls({[Bs]:t,[Us]:(new Date).toISOString()},e))}catch(t){oh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Zv(i)){if(this.Qv(i))return this.Jv("Exception dropped: matched a suppression rule"),void oh.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(i))return this.Jv("Exception dropped: thrown by a browser extension"),void oh.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Xv(i))return this.Jv("Exception dropped: thrown by an injected browser script"),void oh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yv(i))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void oh.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.zv.enabled&&bi(t.$exception_steps)?this.tf(t):t,s=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return t&&this.Wv.clear(),t}catch(t){return rh(t)||oh.error("Failed to capture exception event. Dropping this exception.",t),void this.Wv.clear()}}catch(t){return void(rh(t)||oh.error("Failed to process exception event. Ignoring this exception.",t))}}tf(t){try{const i=this.Wv.getAttachable();return 0===i.length?t:ls(ls({},t),{},{$exception_steps:i})}catch(i){return oh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Jv(t){this.zv.enabled&&this.Wv.add({[Bs]:t,[Us]:(new Date).toISOString()})}Gv(t){return vi(t)?ls({},t):{}}Uv(){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:{}}Qv(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(_i(i)&&i.length>0&&t.$exception_types.push(i),_i(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.Bv.some(t=>{const e=t.values.map(t=>{const e=ka[t.operator],s=i[t.key];if(!e||!s)return!1;const n=di(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 oh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Kv(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&&uh.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(lh))||t.some(({type:t,value:i})=>"NoResponse"===t||_i(i)&&ah.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(lh))))}Xv(t){return t.some(({value:t})=>_i(t)&&hh.some(i=>t.includes(i)))}Yv(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}Zv(t){return!bi(t)&&di(t)}}},Ah=ls({productTours:class{get xa(){return this._instance.persistence}constructor(t){this.ef=null,this.if=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.xa&&this.xa.register({[b]:!!i.productTours}),!Fu(this._instance))return!this.ef&&bi(null===(e=this.xa)||void 0===e?void 0:e.props.ph_product_tours)||Iu.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.ef)||void 0===s||s.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&Fu(this._instance)&&this.No(()=>this.nf())}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?Iu.error("Could not load product tours script",i):t()})}nf(){var t;!this.ef&&(null===(t=Zt.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.ef=Zt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(di(this.if)&&!i)return void t(this.if,{isLoaded:!0});const e=this.xa;if(e){const s=e.props[tt];if(di(s)&&!i)return this.if=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(!Fu(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||Iu.warn(e):Iu.error(e),void t([],{isLoaded:!1,error:e})}const n=di(i.json.product_tours)?i.json.product_tours:[];this.if=n,e&&e.register({[tt]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){bi(this.ef)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.ef)||void 0===i||i.showTourById(t)}previewTour(t){this.ef?this.ef.previewTour(t):this.No(()=>{var i;this.nf(),null===(i=this.ef)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.ef)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.ef)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.ef)||void 0===t||t.previousStep()}clearCache(){var t;this.if=null,null===(t=this.xa)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.ef)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.ef)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.ef)||void 0===i||i.cancelPendingTour(t)}}},Oh),Mh={siteApps:class{constructor(t){this._instance=t,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(t,i){if(!i)return;const e=this.globalsForEvent(i);this.rf.push(e),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}get siteAppLoaders(){var t;return null===(t=Zt._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.lf.bind(this));this.af=()=>{t(),this.rf=[],this.af=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:d,$set:c}=t;return{event:ls(ls({},un(t,Au)),{},{properties:ls(ls(ls({},t.properties),c?{$set:ls(ls({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),c)}:{}),d?{$set_once:ls(ls({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),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}}uf(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)||(Mu.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)||(Mu.error("prepare_external_dependency_script returned null"),null)}return t}hf(){var t,i,e,s,n,r,o,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const a=null==qt?void 0:qt.defaultView,u=null==a||null===(t=a.Node)||void 0===t?void 0:t.prototype;if(!a||!u)return()=>{};if(this.sf++,this.cf)return this.df();const h=[],d=this,c=new WeakSet,v=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),h.push(()=>{t[i]=s})},f=t=>{if(c.has(t))return t;const i=d.uf(t);return i&&c.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!mi(t));return v(u,"appendChild",t=>function(i){const e=f(i);return e?t.call(this,e):i}),v(u,"insertBefore",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):i}),v(u,"replaceChild",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):e}),[null===(i=a.Element)||void 0===i?void 0:i.prototype,null===(e=a.Document)||void 0===e?void 0:e.prototype,null===(s=a.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{v(t,"append",t=>function(...i){return t.apply(this,p(i))}),v(t,"prepend",t=>function(...i){return t.apply(this,p(i))})}),[null===(n=a.Element)||void 0===n?void 0:n.prototype,null===(r=a.CharacterData)||void 0===r?void 0:r.prototype,null===(o=a.DocumentType)||void 0===o?void 0:o.prototype].forEach(t=>{v(t,"before",t=>function(...i){return t.apply(this,p(i))}),v(t,"after",t=>function(...i){return t.apply(this,p(i))}),v(t,"replaceWith",t=>function(...i){const e=p(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),v(null===(l=a.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(i,e){const s=f(e);return s?t.call(this,i,s):null}),this.cf=()=>{h.forEach(t=>t()),this.cf=void 0},this.df()}df(){let t=!1;return()=>{var i;t||(t=!0,this.sf--,0===this.sf&&(null===(i=this.cf)||void 0===i||i.call(this)))}}vf(t,i=!0){const e=this.hf();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.rf.length&&(Mu.info(`Processing ${this.rf.length} events for site app with id ${t.id}`),this.rf.forEach(t=>this.vf(()=>{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.af)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,Mu.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.vf(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){Mu.error(Du+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){Mu.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}ff(){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)}pf(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.vf(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){Mu.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.ff(),void this._instance.on("eventCaptured",t=>this.pf(t))):void Mu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.af)||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;Zt[`__$$ph_site_app_${t}`]=this._instance,null===(r=Zt.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return Mu.error(Du+t,i)})}else Mu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Dh={tracingHeaders:class{constructor(t){this._instance=t,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const t=this.bf();var i,e;t?(pi(this.gf)&&(this.gf=null===(i=Zt.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),pi(this.mf)&&(this.mf=null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Nv()}}initialize(){this.startIfEnabledOrStop()}No(t){var i,e,s;(null===(i=Zt.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=Zt.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return wu.error("failed to load script",i);t()})}_f(){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}bf(){const t=this._f();return di(t)?(di(this.yf)?this.yf.splice(0,this.yf.length,...t):this.yf=[...t],t.length>0?this.yf:void 0):(di(this.yf)&&this.yf.splice(0),this.yf=t||void 0,this.yf)}Nv(){var t,i;null===(t=this.gf)||void 0===t||t.call(this),null===(i=this.mf)||void 0===i||i.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},Nh=ls({surveys:class extends Bu{constructor(t){var i;super(new Wu(t),(i=t,{get projectToken(){return i.config.token},kv:new Vu(i)})),this._instance=t}Mh(t,i){const e=i.query?Ql(t,i.query):t;return new Promise(t=>{var s;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},Oh),jh={toolbar:class{constructor(t){this.instance=t}wf(t){Zt.ph_toolbar_state=t}kf(){var t;return null!==(t=Zt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,e=void 0){var s,n;if(Wn(this.instance.config))return!1;if(!Ut||!qt)return!1;t=null!==(s=t)&&void 0!==s?s:Ut.location,e=null!==(n=e)&&void 0!==n?n:Ut.history;try{if(!i){try{Ut.localStorage.setItem("test","test"),Ut.localStorage.removeItem("test")}catch(t){return!1}i=null==Ut?void 0:Ut.localStorage}const s=Gu||ko(t.hash,"__posthog")||ko(t.hash,"state");let n;const r=s?Ye(()=>JSON.parse(atob(decodeURIComponent(s))))||Ye(()=>JSON.parse(decodeURIComponent(s))):null;return r&&"ph_authorize"===r.action?(n=r,n.source="url",n&&Object.keys(n).length>0&&(r.desiredHash?t.hash=r.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):(n=JSON.parse(i.getItem(Ku)||"{}"),n.source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}Sf(t){const i=Zt.ph_load_toolbar||Zt.ph_load_editor;!bi(i)&&ci(i)?i(t,this.instance):Ju.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==qt?void 0:qt.getElementById("__POSTHOG_TOOLBAR__"));if(!Ut||i)return!1;const e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=ls(ls({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(Ut.localStorage.setItem(Ku,JSON.stringify(ls(ls({},s),{},{source:void 0}))),2===this.kf())this.Sf(s);else if(0===this.kf()){var n,r;this.wf(1),null===(n=Zt.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"toolbar",t=>{if(t)return Ju.error("[Toolbar] Failed to load",t),void this.wf(0);this.wf(2),this.Sf(s)}),Vn(Ut,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(s)})}return!0}xf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},Lh=ls({experiments:class t{get Mr(){return this._instance.config}constructor(i){this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(i=>{t.Cf("retrieved web experiments from the server"),this.$f=new Map,i.forEach(i=>{if(i.feature_flag_key){var e;this.$f&&(t.Cf("setting flag key ",i.feature_flag_key," to web experiment ",i),null===(e=this.$f)||void 0===e||e.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);_i(s)&&i.variants[s]&&this.Tf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const e in i.variants){const s=i.variants[e];t.If(s,this._instance)&&this.Tf(i.name,e,s.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Cf(dh);else if(!this.Mr.disable_web_experiments){if(bi(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Cf("applying feature flags",i),i.forEach(t=>{var i;if(this.$f&&(null===(i=this.$f)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.$f)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.Tf(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){const i=t.getWindowLocation();if(null==i?void 0:i.search){const e=xo(null==i?void 0:i.search,"__experiment_id"),s=xo(null==i?void 0:i.search,"__experiment_variant");e&&s&&(t.Cf(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.Mf(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Mr.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.Mr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Mf(i,e,s){const n=s.filter(t=>t.id===i);n&&n.length>0&&(t.Cf(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.Tf(n[0].name,e,n[0].variants[e].transforms))}static If(i,e){return!bi(i.conditions)&&t.Ef(i,e)&&t.Pf(i)}static Ef(i,e){var s;if(bi(i.conditions)||bi(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=$r(e,n.href);return!(null===(r=i.conditions)||void 0===r?void 0:r.url)||ch[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==Ut?void 0:Ut.location}static Pf(t){var i;if(bi(t.conditions)||bi(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Fo();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,d=!(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,c=!(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&&c&&v&&d}return!1}static Cf(t,...i){An.info(`[WebExperiments] ${t}`,i)}Tf(i,e,s){this._is_bot()?t.Cf(dh):"control"!==e?s.forEach(s=>{if(s.selector){var n;t.Cf(`applying transform of variant ${e} for experiment ${i} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(t=>{const i=t;s.html&&(i.innerHTML=s.html),s.css&&i.setAttribute("style",s.css)})}}):t.Cf("Control variants leave the page unmodified.")}_is_bot(){return Ht&&this._instance?ya(Ht,this.Mr.custom_blocked_useragents):void 0}}},Oh),Bh={conversations:class{constructor(t){this._instance=t,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Of=t.ok,!t.ok)return;const i=t.config.conversations;bi(i)||($i(i)?this.Rf=i:(this.Rf=i.enabled,this.ne=i),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Af)return;if(this._instance.config.disable_conversations)return;if(Wn(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==Zt?void 0:Zt.__PosthogExtensions__;if(t&&!pi(this.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const i=t.initConversations;if(i)return this.Df(i),void(this.Af=!1);const e=t.loadExternalDependency;if(!e)return void this.Lf(Rt);e(this._instance,"conversations",i=>{i||!t.initConversations?this.Lf("Could not load conversations script",i):this.Df(t.initConversations),this.Af=!1})}catch(t){this.Lf("Error initializing conversations",t),this.Af=!1}}else vh.error("Conversations enabled but missing token in remote config.")}Df(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Ff=!1,vh.info("Conversations loaded successfully")}catch(t){this.Lf("Error completing conversations initialization",t)}else vh.error("Cannot complete initialization: remote config is null")}Lf(t,i){vh.error(t,i),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():vh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rf&&!mi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Wn(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":pi(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?bi(this.ne)||!this.ne.token?"missing_token":(null==Zt?void 0:Zt.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"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 Ai(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(vh.warn(fh),null)})()}getMessages(t,i){var e=this;return Ai(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(vh.warn(fh),null)})()}markAsRead(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(vh.warn(fh),null)})()}getTickets(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(vh.warn(fh),null)})()}requestRestoreLink(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(vh.warn(fh),null)})()}restoreFromToken(t){var i=this;return Ai(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(vh.warn(fh),null)})()}restoreFromUrlToken(){var t=this;return Ai(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(vh.warn(fh),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}dh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}fh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Uh={logs:class{constructor(t){var i;this._instance=t,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=Mn("[logs]"),this.Bf=ls(ls({},this.$),{},{error:(...t)=>{t.some(wh)||this.$.error(...t)}}),this.ia=[],this.Hf=[],this.Yc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var t,i;this.So||(this.Yc=0,null===(t=this.Zf)||void 0===t||t.onReconnect(),null===(i=this.Qf)||void 0===i||i.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.Nf=!0),Ut&&Vn(Ut,"online",this.Gf)}Jf(t,i,e,s){var n;const r=ph(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,e);return[new Pn(this.Kf(t,i),r,this.Bf,()=>this.Xf(),t=>t(),void 0,s),r]}Yf(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var e;return this.Zf&&this.tp===i||(null===(e=this.Zf)||void 0===e||e.reset(),this.tp=i,[this.Zf,this.ep]=this.Jf(()=>this.ia,t=>{this.ia=t})),this.Zf}np(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var e;return this.Qf&&this.sp===i||(null===(e=this.Qf)||void 0===e||e.reset(),this.sp=i,[this.Qf,this.rp]=this.Jf(()=>this.Hf,t=>{this.Hf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},mh)),this.Qf}setup(t){var i;if(this.So)return;this.po=t,(null===(i=this._instance)||void 0===i||null===(i=i.config)||void 0===i||null===(i=i.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();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.So?s.dispose():(this.$o=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s;this.So||(this.So=!0,this.up(),null===(t=this.$o)||void 0===t||t.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==Ut||Ut.removeEventListener("online",this.Gf),null===(i=this.hp)||void 0===i||i.call(this),this.hp=void 0,null===(e=this.Zf)||void 0===e||e.reset(),null===(s=this.Qf)||void 0===s||s.reset())}onRemoteConfig(t){var i,e;if(this.So)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;bi(s)?this.cp():(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$logs_capture_enabled_server_side:!!s}),s?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var t,i,e,s;this.up(),null===(t=this.Zf)||void 0===t||t.clearQueue(),this.ia=[],null===(i=this.Zf)||void 0===i||i.reset(),null===(e=this.Qf)||void 0===e||e.clearQueue(),this.Hf=[],null===(s=this.Qf)||void 0===s||s.reset(),this.Yc=0}captureLog(t){this.So||this.Yf().captureLog(t)}captureConsoleLog(t){this.So||this.np().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.So||this.np().captureLog(t,{context:i,occurredAtMs:e})}lp(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[y])}op(){var t,i,e;return!(null===(t=this._instance)||void 0===t||null===(i=t.Xl)||void 0===i?void 0:i.call(t))||!!(null===(e=Zt._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config)}gh(){var t;this.up(),null===(t=this.Qf)||void 0===t||t.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var t;if(this.Wf||!(null==Zt?void 0:Zt.console))return;const i=ph(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let e=!0;this.Uf.push(()=>{e=!1});for(const t of _h){let s;try{s=gh(Zt.console[t])}catch(t){continue}s&&this.Uf.push(yu(Zt.console,t,n=>{const r=(...s)=>{try{e&&this.dp(t,s,i)}catch(t){}return n.apply(Zt.console,s)};return r.__rrweb_original__=s,r}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(t,i,e){var s;if(this.Wf&&!this.Vf&&0!==i.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(e>this.zf.length){this.Vf=!0;try{this.zf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Xf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const t of this.Uf)t();this.Uf=[]}}fp(){const t=this.zf;return this.up(),t}get logger(){return this.pp||(this.pp={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.pp}flushLogs(t){t?this.gp(t):(this.Zf&&this.Zf.flush().catch(t=>this.mp(t)),this.Qf&&this.Qf.flush().catch(t=>this.mp(t)))}mp(t){wh(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const t=null==Zt?void 0:Zt.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.up();const i=t.loadExternalDependency;if(!i)return this.$.error(Rt),void this.up();this.jf=!0;try{i(this._instance,"logs",i=>{if(this.jf=!1,this.So||!this.Nf)return;const e=t.logs;if(i||!(null==e?void 0:e.initializeLogs))this.$.error("Could not load logs script",i),this.up();else{var s;const t=this.fp();var n,r;this.hp=e.initializeLogs(null!==(s=this.po)&&void 0!==s?s:this._instance),this.qf=!0,t.length>0&&(null===(n=e.replayConsoleBuffer)||void 0===n||n.call(e,null!==(r=this.po)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.jf=!1,t}}Kf(t,i){const s=this._instance;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},getPersistedProperty:i=>i===ti.LogsQueue?t():void 0,setPersistedProperty(t,e){var s;t===ti.LogsQueue&&i(null!==(s=e)&&void 0!==s?s:[])},js:t=>this.js(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}js(t){return new Promise(i=>{if(To(this.Yc,3))return void i({kind:"fatal",error:yh(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:yh(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const i=t.statusCode;if(this.bp(i),i>=200&&300>i)s({kind:"ok"});else if(413===i)s({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)s({kind:"fatal",error:new Error(`logs request failed with status ${i}`)});else{var e;0===i?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:yh(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`logs request failed with status ${i}`)})}}})})}bp(t){(0!==t||this._instance.__loaded)&&(this.Yc=Po(t,this.Yc,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}gp(t){this.ia.length>0&&this._p(t,this.ia,this.ep,e.LIB_NAME,t=>{this.ia=t}),this.Hf.length>0&&this._p(t,this.Hf,this.rp,mh,t=>{this.Hf=t})}_p(t,i,s,n,r){if(0===i.length)return;const o=i.map(t=>t.record);r([]);const l=xn(o,Sn(s,e.LIB_NAME,e.LIB_VERSION),n,e.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:l,compression:"best-available",batchKey:"logs",transport:t})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Xf(){var t;const i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:e,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=t,i.windowId=e,bi(s)||(i.sessionStartTimestamp=s),bi(n)||(i.lastActivityTimestamp=n)}if((null==Zt||null===(t=Zt.location)||void 0===t?void 0:t.href)&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?Je(Zt.location.href):Zt.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(i.activeFeatureFlags=t)}return i}}},zh={metrics:class{constructor(t){this._instance=t,this.$=Mn("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.So)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.wp?this.wp=(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=Ph(t,e),n=Ch(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.wp&&(this.wp(),this.wp=void 0)}Yf(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.Zf&&this.tp===i||(null===(e=this.Zf)||void 0===e||e.reset(),this.tp=i,this.Zf=new In(this.Kf(),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),this.$)),this.Zf}count(t,i=1,e){this.Yf().count(t,i,e)}gauge(t,i,e){this.Yf().gauge(t,i,e)}histogram(t,i,e){this.Yf().histogram(t,i,e)}flush(t){if(!this.Zf)return Promise.resolve();if(t){const i=this.Zf.drainWindow();return i&&this.Ys(i,t),Promise.resolve()}return this.Zf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Zf)||void 0===t||t.reset()}dispose(){var t,i;this.So=!0,null===(t=this.wp)||void 0===t||t.call(this),this.wp=void 0,null===(i=this.Zf)||void 0===i||i.reset()}Kf(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>i.Ys(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}Ys(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(ls(ls({method:"POST",url:this.kp(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{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}`)})}}}))})}kp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};au.__defaultExtensionClasses=ls({},ls(ls(ls(ls(ls(ls(ls(ls(ls(ls(ls(ls(ls({},Oh),Rh),Ih),Fh),Ah),Mh),Nh),Dh),jh),Lh),Bh),Uh),zh));const Hh=Mn("[ExternalScriptsLoader]"),qh=t=>{const i=null==qt?void 0:qt.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]},Vh=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Hh.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const s=qh(i);if(s){if(s.__posthog_loading_callback_fired)return e();const t=s.__posthog_loading_error;return t?e(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,e(t)}))}const n=()=>{if(!qt)return e("document not found");if(qh(i))return Vh(t,i,e);let s=qt.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)qt.head.appendChild(s);else{const t=qt.querySelectorAll("body > script");var n;t.length>0?null===(n=t[0].parentNode)||void 0===n||n.insertBefore(s,t[0]):qt.body.appendChild(s)}};(null==qt?void 0:qt.body)?n():null==qt||qt.addEventListener("DOMContentLoaded",n)},Wh={},Gh=(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)};Zt.__PosthogExtensions__=Zt.__PosthogExtensions__||{},Zt.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Vh(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Wh[n];if("fallback"===s&&r){if(qh(r))return void Vh(t,r,e);delete Wh[n]}return void Vh(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=Gh(t,i);Wh[n]=s;const r=qh(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Vh(t,s,e)}else e(void 0,r)}:e)}Vh(t,Gh(t,i),e)},Zt.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);Vh(t,s,e)};const Kh=function(){e.SDK_DIST_CHANNEL="npm";const t=Va[iu]=new au;return function(){function t(){t.done||(t.done=!0,eu=!1,Nn(Va,function(t){t._dom_loaded()}))}(null==qt?void 0:qt.addEventListener)?"complete"===qt.readyState?t():Vn(qt,"DOMContentLoaded",t,{capture:!1}):Ut&&An.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=il,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=ol,exports.PostHog=au,exports.ProductTourEventName=al,exports.ProductTourEventProperties=ul,exports.SurveyEventName=nl,exports.SurveyEventProperties=rl,exports.SurveyEventType=el,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=sl,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Kh,exports.posthog=Kh,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
2
2
|
//# sourceMappingURL=main.js.map
|