posthog-js 1.433.5 → 1.433.6

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.
@@ -1,2 +1,2 @@
1
- !function(){const e="u">typeof window?window:void 0,t="u">typeof globalThis?globalThis:e,i=null==t?void 0:t.navigator,s=null==t?void 0:t.document,n=null==t?void 0:t.location,r=null==t?void 0:t.fetch,o=(null==t?void 0:t.XMLHttpRequest)&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,c=null==i?void 0:i.userAgent;function u(){return!(!e||!1===e.navigator.onLine)}const d="undefined"!=typeof globalThis?globalThis:e;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});const h=null!=e?e:{},p="$people_distinct_id",_="distinct_id",g="$device_id",f="$device_model",v="__alias",m="__cmpns",y="$fbc",b="$fbc_persistence",S="$fbp",w="$fbp_persistence",k="__timers",C="$autocapture_disabled_server_side",x="$heatmaps_enabled_server_side",I="$exception_capture_enabled_server_side",E="$error_tracking_suppression_rules",T="$error_tracking_capture_extension_exceptions",M="$web_vitals_enabled_server_side",P="$dead_clicks_enabled_server_side",F="$product_tours_enabled_server_side",R="$logs_capture_enabled_server_side",L="$web_vitals_allowed_metrics",A="$session_recording_remote_config",O="$session_recording_enabled_server_side",D="$replay_sample_rate",N="$replay_override_sampling",B="$replay_override_linked_flag",q="$replay_override_url_trigger",H="$replay_override_event_trigger",W="$sesid",z="$session_is_sampled",U="$session_past_minimum_duration",j="$session_recording_url_trigger_activated_session",V="$session_recording_event_trigger_activated_session",G="$posthog_sr_group_event_trigger_",Q="$posthog_sr_group_url_trigger_",K="$posthog_sr_group_sampling_",Z="$debug_first_full_snapshot_timestamp",J="$sess_rec_flush_size",X="$enabled_feature_flags",Y="$active_feature_flags",ee="$early_access_features",te="$feature_flag_details",ie="$feature_flag_payloads",se="$feature_flag_request_id",ne="$minimal_flag_called_events",re="$override_feature_flags",oe="$override_feature_flag_payloads",ae="$stored_person_properties",le="$stored_group_properties",ce="$groups",ue="$surveys",de="$surveys_loaded_at",he="$surveys_activated",pe="$surveys_activated_session",_e="$surveys_activated_timestamps",ge="ph_product_tours",fe="$product_tours_activated",ve="$product_tours_activated_session",me="$conversations_widget_session_id",ye="$conversations_ticket_id",be="$conversations_widget_state",Se="$conversations_user_traits",we="$flag_call_reported",ke="$flag_call_reported_session_id",Ce="$feature_flag_errors",xe="$feature_flag_evaluated_at",Ie="$user_state",Ee="$client_session_props",Te="$capture_rate_limit",Me="$initial_campaign_params",Pe="$initial_referrer_info",Fe="$initial_person_info",Re="$epp",Le="$posthog_cookieless",Ae="$cookieless_mode",Oe="$sdk_debug_extensions_init_method",$e="$sdk_debug_extensions_init_time_ms",De="$sdk_debug_recording_script_not_loaded",Ne="$sdk_debug_replay_event_trigger_status",Be="$sdk_debug_replay_linked_flag_trigger_status",qe="$sdk_debug_replay_matched_recording_trigger_groups",He="$sdk_debug_replay_pending_trigger_conditions",We="$sdk_debug_replay_remote_trigger_matching_config",ze="$sdk_debug_replay_trigger_groups_count",Ue="$sdk_debug_replay_url_trigger_status",je="$sdk_debug_rrweb_attached",Ve="$sdk_debug_rrweb_start_attempted",Ge="$session_recording_start_reason",Qe="PostHog loadExternalDependency extension not found.",Ke="anonymous",Ze="identified",Je="identified_only",Xe="visibilitychange",Ye="beforeunload",et="$pageview",tt="$pageleave",it="$identify",st="$groupidentify";function nt(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,n)}function rt(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(e){nt(r,s,n,o,a,"next",e)}function a(e){nt(r,s,n,o,a,"throw",e)}o(void 0)})}}function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function at(e,t,i){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=ot(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function lt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function ct(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(i),!0).forEach(function(t){at(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):lt(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var ut=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),dt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const ht="min_length",pt="max_length",_t=["$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"],gt=["token"];function ft(e,t){return-1!==e.indexOf(t)}const vt=function(e){return e.trim()},mt=function(e){return e.replace(/^\$/,"")};function yt(e){var t;const i=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const bt=Object.prototype,St=bt.hasOwnProperty,wt=bt.toString,kt=Array.isArray||function(e){return"[object Array]"===wt.call(e)},Ct=e=>"function"==typeof e,xt=e=>e===Object(e)&&!kt(e),It=e=>{if(xt(e)){for(const t in e)if(St.call(e,t))return!1;return!0}return!1},Et=e=>void 0===e,Tt=e=>"[object String]"==wt.call(e),Mt=e=>Tt(e)&&0===e.trim().length,Pt=e=>null===e,Ft=e=>Et(e)||Pt(e),Rt=e=>"[object Number]"==wt.call(e)&&e==e,Lt=e=>Rt(e)&&e>0,At=e=>"[object Boolean]"===wt.call(e),Ot=e=>e instanceof FormData,$t=e=>ft(_t,e),Dt=e=>ft(gt,e);function Nt(e){return null===e||"object"!=typeof e}function Bt(e,t){return{}.toString.call(e)===`[object ${t}]`}function qt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Wt(e,Error)}}function Ht(e){return"u">typeof Event&&Wt(e,Event)}function Wt(e,t){try{return e instanceof t}catch(e){return!1}}const zt=[!0,"true",1,"1","yes"],Ut=e=>ft(zt,e),jt=[!1,"false",0,"0","no"],Vt=["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"],Gt=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return Vt.concat(t).some(e=>{const t=e.toLowerCase();return-1!==i.indexOf(t)})};function Qt(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),Rt(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),Qt(null!=n?n:i,t,i,s))}var Kt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Qt(e.bucketSize,0,100,e._logger),this._refillRate=Qt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Qt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){const i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let n=this._buckets[s];return n?this._applyRefill(n,i):(n={tokens:this._bucketSize,lastAccess:i},this._buckets[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(t=this._onBucketRateLimited)||void 0===t||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}};const Zt="Mobile",Jt="Android",Xt="Tablet",Yt="Android Tablet",ei="iPad",ti="Apple Watch",ii="Safari",si="BlackBerry",ni="Samsung Internet",ri="Chrome",oi="Chrome iOS",ai="Internet Explorer",li="Internet Explorer Mobile",ci="Opera",ui="Microsoft Edge",di="Firefox",hi="Firefox iOS",pi="Nintendo",_i="PlayStation",gi="Xbox",fi="Android Mobile",vi="Mobile Safari",mi="Windows",yi="Windows Phone",bi="Nokia",Si="Ouya",wi="Generic "+Zt.toLowerCase(),ki="Generic "+Xt.toLowerCase(),Ci="Konqueror",xi="Oculus Browser",Ii="Vivaldi",Ei="Yandex",Ti="Whale",Mi="DuckDuckGo",Pi="Pale Moon",Fi="Waterfox",Ri="Brave",Li="Claude",Ai="Codex",Oi="ChatGPT",$i="Google Search App",Di=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ni=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Bi=new RegExp(gi,"i"),qi=new RegExp("PlayStation \\w+","i"),Hi=new RegExp("Nintendo \\w+","i"),Wi=new RegExp("BlackBerry|PlayBook|BB10","i"),zi={"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"},Ui=function(e,t,i,s){t=t||"";const n=function(e){return(null==e?void 0:e.brave)?Ri:null}(i);return n||((null==s?void 0:s.detectGoogleSearchApp)&&ft(e,"GSA/")?$i:ft(e," OPR/")&&ft(e,"Mini")?"Opera Mini":ft(e," OPR/")?ci:Wi.test(e)?si:ft(e,"IEMobile")||ft(e,"WPDesktop")?li:ft(e,"OculusBrowser")?xi:ft(e,"SamsungBrowser")?ni:ft(e,"Edge")||ft(e,"Edg/")?ui:ft(e,"Vivaldi/")?Ii:ft(e,"YaBrowser/")?Ei:ft(e,"Whale/")?Ti:ft(e,"DuckDuckGo/")||ft(e,"Ddg/")?Mi:ft(e,"Claude/")?Li:ft(e,"Codex/")?Ai:ft(e,"ChatGPT/")?Oi:ft(e,"FBIOS")?"Facebook Mobile":ft(e,"UCWEB")||ft(e,"UCBrowser")?"UC Browser":ft(e,"CriOS")?oi:ft(e,"CrMo")||ft(e,ri)?ri:ft(e,Jt)&&ft(e,ii)?fi:ft(e,"FxiOS")?hi:ft(e.toLowerCase(),Ci.toLowerCase())?Ci:ft(e,"Brave/")?Ri:((e,t)=>t&&ft(t,"Apple")||function(e){return ft(e,ii)&&!ft(e,ri)&&!ft(e,Jt)}(e))(e,t)?ft(e,Zt)?vi:ii:ft(e,"PaleMoon/")?Pi:ft(e,"Waterfox/")?Fi:ft(e,di)?di:ft(e,"MSIE")||ft(e,"Trident/")?ai:ft(e,"Gecko")?di:"")},ji={[li]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ii]:[Di],[vi]:[Di],[ci]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Di],[fi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ni]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Li]:[Ni],[Ai]:[Ni],[Oi]:[Ni],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Fi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Vi=function(e,t,i,s){const n=Ui(e,t,i,s),r=ji[n];if(Et(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},Gi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[gi,e&&e[1]||""]],[new RegExp(pi,"i"),[pi,""]],[new RegExp(_i,"i"),[_i,""]],[Wi,[si,""]],[new RegExp(mi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[yi,""];if(new RegExp(Zt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=zi[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[mi,e]}return[mi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Jt,[e[2],e[3],e[4]||"0"].join(".")]:[Jt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Qi=function(e){for(let t=0;Gi.length>t;t++){const[i,s]=Gi[t],n=i.exec(e),r=n&&(Ct(s)?s(n,e):s);if(r)return r}return["",""]},Ki=function(e){return Hi.test(e)?pi:qi.test(e)?_i:Bi.test(e)?gi:new RegExp(Si,"i").test(e)?Si:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?yi:/iPad/.test(e)?ei:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ti:Wi.test(e)?si:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(bi,"i").test(e)?bi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Jt:Yt:new RegExp("(pda|Mobile)","i").test(e)?wi:new RegExp(Xt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?ki:""},Zi=function(e,t){var i;const s=Ki(e);return s===ei||s===Yt||"Kobo"===s||"Kindle Fire"===s||s===ki?Xt:s===pi||s===gi||s===_i||s===Si?"Console":s===ti?"Wearable":s?Zt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(n=null==t?void 0:t.screenWidth)&&void 0!==n?n:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?Zt:Xt:"Desktop";var n,r,o},Ji=/\bFBAV\/(\d+(?:\.\d+)*)/i,Xi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ji],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ji],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ji],[/\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"]],Yi="[Truncated]",es="[Unserializable]";function ts(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const s=e.charCodeAt(i+1);56320>s||s>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function is(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(const s of i){let i;try{i=t[s]}catch(e){i=es}Object.defineProperty(e,s,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}Date,Date;const ss=3e5;var ns=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,ss);if(!t)return this._installedAt=i,void(this._until=i+s);this._until=Math.max(this._until,Math.min(i+s,this._installedAt+ss))}remainingMs(){const e=Date.now();if(this._installedAt-5e3>e)return this.reset(),0;const t=Math.min(ss,Math.max(0,this._until-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this._until=0,this._installedAt=0}constructor(){this._until=0,this._installedAt=0}};const rs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function os(e,t){return"string"==typeof(i=e)&&rs.test(i)?e:t();var i}function as(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function ls(e){return e?e.split("#")[0]:e}function cs(e){try{return e()}catch(e){return}}function us(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function ds(e,t,i){return hs.apply(this,arguments)}function hs(){return(hs=rt(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,n)=>{s=us(()=>{try{null==i||i(),e()}catch(e){n(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let ps,_s,gs;function fs(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return gs&&i.length===_s||(_s=i.length,gs=i.reduce((i,s)=>{ps||(ps={});const n=ps[s];if(n)i[n[0]]=n[1];else{const n=e(s);for(let e=n.length-1;e>=0;e--){const r=n[e],o=null==r?void 0:r.filename,a=t[s];if(o&&a){i[o]=a,ps[s]=[o,a];break}}}return i},{})),gs}var vs=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return rt(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&kt(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,n;if(null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch(e){}return ct(ct({},e),{},{cause:s,stack:n,errors:null===(i=e.errors)||void 0===i?void 0:i.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return rt(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){const i=[],s=(e,n,r)=>{var o;const a=i.length,l=void 0===n?ct(ct({type:"string"==typeof t.type&&t.type.length>0?t.type:"generic"},"boolean"==typeof t.handled?{handled:t.handled}:void 0===t.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof t.synthetic?t.synthetic:e.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:e.synthetic,exception_id:a,parent_id:n},c={type:e.type,value:e.value,mechanism:l};e.stack&&(c.stacktrace={type:"raw",frames:e.stack}),i.push(c),e.cause&&s(e.cause,a,"cause");for(const t of null!==(o=e.errors)&&void 0!==o?o:[])s(t,a,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:fs(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}getAggregateErrors(e){try{if(qt(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;const s=null===(t=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===t?void 0:t.value;if("function"==typeof s&&"AggregateError"===s.name){const t=e.errors;return kt(t)?t:void 0}i=Object.getPrototypeOf(i)}}}catch(e){}}buildCoercingContext(e,t,i=0){let s=0,n=0,r=!1;const o=new Set,a=[],l={},c=(e,t,i=0)=>{const c=u(t,i),d=c.apply;if(c.apply=t=>{a.push(e);try{return d(t)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(e))return this.coerceFallback(c);const h="object"==typeof e&&null!==e||"function"==typeof e;if(0===i&&s>=50||h&&o.has(e))return;h&&o.add(e),0===i&&s++;const p=this.getAggregateErrors(e);let _,g;r||(r=!!p);try{if(_=this.applyCoercers(e,c),!_)throw l}catch(e){if(e===l)return void(0===i&&s--);if(!r)throw e;_=this.coerceFallback(c)}if(!p||s>=50)return _;try{g=p.length}catch(e){return _}if(!Number.isInteger(g)||0>g||g>4294967295)return _;const f=[];for(let e=0;50>s&&1e3>n&&g>e;e++){let i;n++;try{i=c.next(p[e])}catch(e){s++,i=this.coerceFallback(u(t+1))}i&&f.push(i)}return ct(ct({},_),{},{errors:f})},u=(i,s=0)=>ct(ct({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:0==i?e:{},apply(e){const t=c(e,i,s+1);if(!t)throw l;return t},next:e=>c(e,i+1)}),d=u(i);return ct(ct({},d),{},{apply:e=>{var t;return null!==(t=c(e,i))&&void 0!==t?t:this.coerceFallback(d)}})}};const ms=/^([a-z][a-z0-9.+-]+):/i,ys=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function bs(e){if(!e||"<anonymous>"===e)return!1;const t=ms.exec(e);return!t||ys.includes(t[1].toLowerCase())}function Ss(e,t,i,s,n){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:bs(t)};return Et(s)||(r.lineno=s),Et(n)||(r.colno=n),r}const ws=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},ks=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Cs=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xs=/\((\S*)(?::(\d+))(?::(\d+))\)/,Is=(e,t)=>{const i=ks.exec(e);if(i){const[,e,s,n]=i;return Ss(t,e,"?",+s,+n)}const s=Cs.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){const e=xs.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}const[e,i]=ws(s[1]||"?",s[2]);return Ss(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Es=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ts=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ms=(e,t)=>{const i=Es.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=Ts.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=ws(s,e),Ss(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ps=/\(error: (.*)\)/;function Fs(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Rs(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!Fs(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}function Ls(e,t){const i=t.start+t.length,s=Os(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function As(e,t){let i=t.start;for(;i>0&&Fs(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Os(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&Fs(e[s],e[s-t.length]);)s++;return s-i}function $s(e,t){const i=t[0];let s=e.length-(i?As(e,i):0);for(const i of t)s-=Os(e,i);return s}function Ds(e,t,i){for(let s=0;e.length>s;s++){const n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Ns=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=Tt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Bt(e,"DOMException")}isDOMError(e){return Bt(e,"DOMError")}},Bs=class{match(e){return qt(e)}coerce(e,t){var i;const s=this.getStack(e),n=void 0===s?null===(i=t.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:n,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if("string"==typeof t&&t.length>0)return t;const i=e.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(e){return}}},qs=class{match(e){return!!Bt(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const s=t.apply(e.message);return ct(ct({},s),{},{stack:null!==(i=this._buildLocationStack(e))&&void 0!==i?i:s.stack,synthetic:!0})}_hasUsableMessage(e){return Tt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;const s=e,n=null!==(t=s.lineno)&&void 0!==t?t:0,r=null!==(i=s.colno)&&void 0!==i?i:0;if(Tt(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Hs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Ws=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[s,n]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(Hs);return s&&(t=s[1],i=s[2]),[t,i]}};const zs=["fatal","error","warning","log","info","debug"];function Us(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const s=i.slice(0,e).join(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var js=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;const n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(s=t.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Ht(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Tt(t)&&!Mt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${Us(e)}`}isSeverityLevel(e){return Tt(e)&&!Mt(e)&&zs.indexOf(e)>=0}getStack(e){try{return Tt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Tt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(qt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Vs=class{match(e){return Ht(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Us(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Gs=class{match(e){return Nt(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Qs=class{match(e){return Bt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ht(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return Nt(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};const Ks="$message",Zs="$timestamp",Js=new Set([Ks,Zs]),Xs={enabled:!0,max_bytes:32768};function Ys(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Xs.enabled,max_bytes:tn(e.max_bytes,Xs.max_bytes)}:ct({},Xs)}var en=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=Ys(e)}setConfig(e){this._config=Ys(e),this._trimToMaxBytes()}add(e){const t=function(e){let t;try{t=yt(e)}catch(e){return}try{const e=JSON.parse(t);if(!xt(e))return;const i=e,s=i[Ks],n=i[Zs];if(!Tt(s)||0===s.trim().length)return;if(!Tt(n)&&!Rt(n))return;return{step:i,json:t}}catch(e){return}}(e);if(!t)return;const i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){const e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function tn(e,t){if(!Rt(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const sn=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function nn(e){return"string"==typeof e||e}function rn(e){return"string"==typeof e?e:void 0}const on=["$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"],an="NativeGzipValidationError",ln=e=>e.length>=2&&31===e[0]&&139===e[1],cn=(e,t)=>e===dt.GZipJS||t===dt.GZipJS||"gzip"===t,un=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),dn=e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return un(e)||t===an};let hn;const pn=e=>{throw as(an,`Native gzip produced invalid output: ${e}`)},_n=(gn=rt(function*(e,t){18>e.size&&pn("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ln(i)&&8===i[2]||pn("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{const t=(()=>{if(hn)return hn;hn=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;hn[e]=t>>>0}return hn})();let i=4294967295;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&pn("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&pn("invalid-size")}),function(e,t){return gn.apply(this,arguments)});var gn;function fn(e){return vn.apply(this,arguments)}function vn(){return vn=rt(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),n=i.writable.getWriter(),r=n.write(t).then(()=>n.close()).catch((s=rt(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield _n(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var s}),vn.apply(this,arguments)}function mn(e,t){if(null==e)return{};var i,s,n=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}const yn={}.propertyIsEnumerable;function bn(e,t){try{return kn(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function Sn(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Yi};if(i.remainingNodes--,At(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){const i=e.toString(),s=BigInt("9223372036854775808");return e>=s||-s>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(e,t);if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:ts(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Yi};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?ts(i):String(i)}}i.ancestors.add(e);try{try{const n=e.toJSON;if("function"==typeof n)return Sn(n.call(e),t,i,s+1)}catch(e){}return kt(e)?{arrayValue:{values:wn(e,t,i,s+1)}}:{kvlistValue:{values:kn(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:ts(String(e))}}function wn(e,t,i,s){const n=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(Ft(r))continue;n.push(Sn(r,t,i,s))}catch(e){n.push({stringValue:es})}return e.length>o&&n.push({stringValue:Yi}),n}function kn(e,t,i,s){const n=[];for(const r in e)if(yn.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(Pt(o)||Et(o))continue;n.push({key:ts(r),value:Sn(o,t,i,s)})}catch(e){n.push({key:ts(r),value:{stringValue:es}})}}return n}function Cn(e,t,i){return ct(ct(ct(ct({},is({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}const xn=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function In(e,t){const i=is({},e),s={};for(const e of xn)({}).hasOwnProperty.call(i,e)&&(s[e]=i[e],delete i[e]);return[...bn(i,t),...bn(s,t)]}const En={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 Tn={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}},Mn=Tn.info;function Pn(e){try{return ts(String(e))}catch(e){return es}}function Fn(e,t,i,s){const n=e.level||"info",{text:r,number:o}=Tn[n]||Mn,a=function(e=Date.now()){return String(e)+"000000"}(Rt(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Ft(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ft(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=ct({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const t of e){let e;try{e=u[t]}catch(t){e=es}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Pn(e.body)},attributes:bn(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),Et(e.trace_flags)||(d.flags=e.trace_flags),d}function Rn(e,t,i){return Cn(e,t,i)}function Ln(e,t,i,s){return{resourceLogs:[{resource:{attributes:In(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var An=class{constructor(e){this._onFire=e,this._firesAt=0}get pending(){return!!this._timer}arm(e){this.clear(),this._firesAt=Date.now()+e,this._timer=us(()=>{this._timer=void 0,this._onFire()},e)}armNoEarlierThan(e){this._timer&&Date.now()+e<=this._firesAt||this.arm(e)}clear(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};function On(){return.75+.5*Math.random()}function $n(e,t,i,s){const n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,e)))*i)}var Dn=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=s,this._onReady=n,this._waitForStoragePersist=r,this._scopeName=o,this._flushTimer=new An(()=>this._flushInBackground()),this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._retryAfter=new ns,this._consecutiveFlushFailures=0,this._flushJitter=1,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(ut.LogsQueue,[])}reset(){this._flushTimer.clear(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.reset(),this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.isOpen()?this._hasQueuedRecords()&&this._armFlushTimer():this._flushInBackground()}captureLog(e,t){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const s=this._runBeforeSend(e);if(null===s)return;if(!s.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;const n={record:Fn(s,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(n))}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Log was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return s}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;const e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn(`captureLog dropping logs: exceeded ${this._maxLogsPerInterval} logs per ${this._rateCapWindowMs}ms`),this._droppedWarned=!0),!1)}flush(){var e=this;return rt(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return rt(function*(){var t;e._flushTimer.clear();let i=null!==(t=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const s=i.length;let n=0;for(;i.length>0&&s>n;){var r,o;const t=e._queueGeneration;e._evictedSinceAdvance=0;const s=Math.min(i.length,e._maxBatchRecordsPerPost),a=i.slice(0,s),l=Ln(a.map(e=>e.record),e._buildResourceAttributes(),null!==(r=e._scopeName)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(l);if(e._queueGeneration!==t)return;if("too-large"===c.kind&&a.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(a.length/2)),e._logger.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${e._maxBatchRecordsPerPost}`);else{if(e._retryAfter.record(c),e._flushTimer.pending&&e._flushTimer.arm(Math.max(e._flushIntervalMs,e._retryAfter.remainingMs())),"retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e._logger.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(a.length),i=null!==(o=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==o?o:[],n+=a.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return rt(function*(){var i;const s=Math.max(0,e-t._evictedSinceAdvance),n=null!==(i=t._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(ut.LogsQueue,n.slice(s)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return Rn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(ut.LogsQueue,i),this._maxBufferSize>i.length||this._retryAfter.isOpen()?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(Math.max(this._flushIntervalMs,this._retryAfter.remainingMs()))}_nextFlushDelay(){return Math.max($n(this._flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_hasQueuedRecords(){const e=this._instance.getPersistedProperty(ut.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return rt(function*(){t._flushTimer.clear();const i=t.flush().catch(()=>{});void 0!==e?yield ds(i,e):yield i})()}flushWithTimeout(e){var t=this;return rt(function*(){const i=t.flush();yield ds(i,e,()=>{i.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0,this._flushJitter=1},e=>{this._consecutiveFlushFailures++,this._flushJitter=On(),this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._flushTimer.armNoEarlierThan(this._nextFlushDelay())})}};const Nn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Bn(e){return String(e)+"000000"}function qn(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${n}`}var Hn=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushTimer=new An(()=>this.flush().catch(e=>{this._logger.error("Metrics flush failed:",e)})),this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._retryAfter=new ns,this._consecutiveFlushFailures=0,this._flushJitter=1,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this._flushPromise,i=function(){var i=rt(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;const e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._retryAfter.reset(),this._consecutiveFlushFailures=0,this._flushJitter=1,this._flushTimer.clear(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this._runBeforeSend(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this._logger.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?ct({},t.attributes):void 0,s=qn(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let n=this._series.get(s);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(s,n)}const r=this._typeByName.get(t.name);void 0===r?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(n,t.value),this._armFlushTimer()}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn(`Metric series cap reached (${this._config.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}_fold(e,t){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Nn.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,Nn)]+=1;break}}}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Metric was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return s}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(this._nextFlushDelay())}_nextFlushDelay(){return Math.max($n(this._config.flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_doFlush(){var e=this;return rt(function*(){if(e._flushTimer.clear(),0===e._series.size)return;const t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;const i=e._generation,s=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(e._retryAfter.record(s),"retry-later"===s.kind?(e._consecutiveFlushFailures++,e._flushJitter=On()):(e._consecutiveFlushFailures=0,e._flushJitter=1),e._flushTimer.pending&&e._flushTimer.arm(e._nextFlushDelay()),s.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._flushTimer.armNoEarlierThan(e._nextFlushDelay());case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",s.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return Cn(e,t,i)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:In(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}_buildMetrics(e){const t=Bn(Date.now()),i=new Map;for(const o of e.values()){var s;const e=qn(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=ct({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=bn(null!==(s=o.attributes)&&void 0!==s?s:{},this._logger),c=Bn(o.windowStartMs);if("count"===o.type){var n;const e={attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(n=o.total)&&void 0!==n?n:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e={attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Nn})}return Array.from(i.values())}_mergeWindowBack(e){for(const[s,n]of e){const e=this._series.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case"count":var t,i;e.total=(null!==(t=e.total)&&void 0!==t?t:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(e.hist){e.hist.count+=n.hist.count,e.hist.sum+=n.hist.sum,e.hist.min=Math.min(e.hist.min,n.hist.min),e.hist.max=Math.max(e.hist.max,n.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=n.hist.bucketCounts[t]}else e.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function Wn(e,t){if(!e)return;const i=e.find(e=>e.type===t);return null==i?void 0:i.value}const zn="0.8.3",Un={DEBUG:!1,LIB_VERSION:zn,LIB_NAME:"browser-common",JS_SDK_VERSION:zn},jn=(t,{debugEnabled:i}={})=>{const s={_log(s,...n){e&&(Un.DEBUG||e.POSTHOG_DEBUG||i)&&!Et(e.console)&&e.console&&("__rrweb_original__"in e.console[s]?e.console[s].__rrweb_original__:e.console[s])(t,...n)},debug(...e){s._log("debug",...e)},info(...e){s._log("log",...e)},warn(...e){s._log("warn",...e)},error(...e){s._log("error",...e)},critical(...e){console.error(t,...e)},uninitializedWarning(e){s.error(`You must initialize PostHog before calling ${e}`)},createLogger:(e,i)=>jn(`${t} ${e}`,i)};return s},Vn=jn("[PostHog.js]"),Gn=Vn.createLogger;function Qn(e,t){kt(e)&&e.forEach(t)}function Kn(e,t){if(!Ft(e))if(kt(e))e.forEach(t);else if(Ot(e))e.forEach((e,i)=>t(e,i));else for(const i in e)St.call(e,i)&&t(e[i],i)}const Zn=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function Jn(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}const Xn=function(e){return function(...t){try{return e.apply(this,t)}catch(e){Vn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vn.critical(e)}}},Yn=function(e){const t={};return Kn(e,function(e,i){(Tt(e)&&e.length>0||Rt(e))&&(t[i]=e)}),t};function er(e){const t=ct({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const tr=["herokuapp.com","vercel.app","netlify.app"];function ir(e){const t=null==e?void 0:e.hostname;if(!Tt(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of tr)if(i===e)return!1;return!0}function sr(e,t,i,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:n,passive:r})}function nr(e){return"ph_toolbar_internal"===e.name}const rr=["localhost","127.0.0.1"],or=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var s;return qt(t)?(null!==(s=i)&&void 0!==s||(i=new WeakMap),i.has(t)||i.set(t,er(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return yt(e)}},ar=e=>{const t=null==s?void 0:s.createElement("a");return Et(t)?null:(t.href=e,t)},lr=function(e,t="&"){let i,s;const n=[];return Kn(e,function(e,t){Et(e)||Et(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),n[n.length]=s+"="+i)}),n.join(t)},cr=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let e=0;i.length>e;e++){const n=i[e].split("=");if(n[0]===t){s=n;break}}if(!kt(s)||2>s.length)return"";{let e=s[1];try{e=decodeURIComponent(e)}catch(t){Vn.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},ur=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const s=l[e].split("=");kt(s)&&(t.includes(s[0])?c.push(s[0]+"="+i):c.push(l[e]))}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=n&&(u+="#"+n),u},dr=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},hr=(e,t)=>e>=t&&u(),pr=(e,t,i,s)=>{if(0===e){if(u()){const e=t+1;return e===i&&s(),e}return t}return 0};function _r(e,t){var i;const s=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!Ct(s))return t;try{const e=s(t);return Tt(e)&&e?e:t}catch(e){return Vn.error("Error in get_current_url, falling back to window.location.href",e),t}}function gr(t){var i;const s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return Et(s)?void 0:_r(t,s)}function fr(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function vr(e){return!!e&&1===e.nodeType}function mr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function yr(e){return!!e&&3===e.nodeType}function br(e){return!!e&&11===e.nodeType&&vr(e.host)}function Sr(e){return e?vt(e).split(/\s+/):[]}function wr(e,t){const i=gr(t);return!!(i&&e&&e.some(e=>i.match(e)))}function kr(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Sr(t)}function Cr(e){return Ft(e)?null:vt(e).split(/(\s+)/).filter(e=>Jr(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xr(e){let t="";return Wr(e)&&!zr(e)&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,function(e){var i;yr(e)&&e.textContent&&(t+=null!==(i=Cr(e.textContent))&&void 0!==i?i:"")}),vt(t)}function Ir(e){var t;return Et(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const Er=["a","button","form","input","select","textarea","label"];function Tr(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function Mr(e,t){if(Et(t))return!0;for(const i of e)if(t.some(e=>Tr(i,e)))return!0;return!1}function Pr(e){const t=e.parentNode;return!(!t||!vr(t))&&t}const Fr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Rr=["next","previous","prev",">","<"],Lr=[...Rr,"+","-","−","–"],Ar=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Or=[".ph-no-deadclick",".ph-no-capture"],$r=[".ph-no-rageclick",".ph-no-capture"],Dr=["","text","search","email","password","url","tel","number"];function Nr(e){return!(!e||!vr(e))&&(!!mr(e,"textarea")||(mr(e,"input")?ft(Dr,(e.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(e)))}function Br(t,i){if(!e||qr(t))return!1;let s,n,r;var o,a;if(At(i)?(s=!!i&&$r,n=void 0,r=!1):(s=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:$r,n=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===s)return!1;if(r&&Nr(t))return!1;const{targetElementList:l}=Hr(t,!1);return!function(e,t){if(!1===e||Et(e))return!1;let i;if(!0===e)i=Rr;else{if(!kt(e))return!1;if(e.length>10)return Vn.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>i.some(i=>Ar(e,i)||Ar(t,i)))}(n,l.map(e=>{var t;return{safeText:xr(e).toLowerCase(),ariaLabel:(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().trim())||""}}))&&!Mr(l,s)}const qr=e=>!e||mr(e,"html")||!vr(e),Hr=(t,i)=>{if(!e||qr(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!mr(r,"body");){if(br(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=Pr(r);if(!t)break;if(i||Er.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(e){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Wr(e){const t=new Set;let i=0;for(let s=e;s.parentNode&&!mr(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);const e=kr(s);if(ft(e,"ph-sensitive")||ft(e,"ph-no-capture"))return!1}if(ft(kr(e),"ph-include"))return!0;const s=e.type||"";if(Tt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!Tt(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 zr(e){return!!(mr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||mr(e,"select")||mr(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const Ur=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}))$"),jr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Vr=[16,15,14,13],Gr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Kr=/[0-9A-Za-z_]/;function Zr(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function Jr(e,t=!0){if(Ft(e))return!1;if(Tt(e)){if(e=vt(e),t?Ur.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(jr.lastIndex=0;t=jr.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of Vr){const s=e+t;if(i.length>=s){const t=i.slice(e,s);if(Ur.test(t)&&Zr(t))return!0}}}return!1}(e))return!1;if(t?Gr.test(e):function(e){let t;for(Qr.lastIndex=0;t=Qr.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&Kr.test(e)&&Kr.test(i)))return!0}return!1}(e))return!1}return!0}function Xr(e){let t=xr(e);return t=`${t} ${Yr(e)}`.trim(),Jr(t)?t:""}function Yr(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=xr(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Yr(e)}`.trim())}catch(e){Vn.error("[AutoCapture]",e)}}),t}function eo(e){return e.replace(/"|\\"/g,'\\"')}function to(e){const t=e.attr__class;if(t)return kt(t)?t:Sr(t)}const io=1e6;function so(e){var t;return Math.min(io,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:io)}const no={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:io,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},ro=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],oo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ao=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],lo=e=>{Ft(e)||Kn(Object.keys(e),t=>{(e=>{const t=e.toLowerCase();return ro.includes(t)||ao.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},co=["/s/","/e/","/i/"];function uo(e,t,i,s){if(Ft(e))return e;let n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Tt(n)&&(n=parseInt(n)),n>i?`[SessionRecording] ${s} body too large to record (${n} bytes)`:e}function ho(e,t){if(Ft(e))return e;let i=e;return Jr(i,!1)||(i="[SessionRecording] "+t+" body redacted"),Kn(oo,e=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(e))&&(i="[SessionRecording] "+t+" body redacted as might contain: "+e)}),i}const po=new WeakSet,_o="disabled",go="sampled",fo="active",vo="buffering",mo="paused",yo="lazy_loading",bo="rrweb_error",So="trigger_activated",wo="trigger_pending",ko="trigger_disabled";function Co(e,t,i,s,n,r){return 0===t?ko:(null==e?void 0:e.get_property(i?s+i:n))===r?So:wo}function xo(e,t,i){return t.some(t=>{var s;return"regex"===t.matching&&(null!==(s=null==i?void 0:i.get(t.url))&&void 0!==s?s:new RegExp(t.url)).test(e)})}function Io(e){return e.includes("trigger_activated")?So:e.includes("trigger_pending")?wo:ko}function Eo(e){const t=new Set(e);switch(t.delete(ko),t.size){case 0:return ko;case 1:return Array.from(t)[0];default:return wo}}var To=class{constructor(e){this._matchers=e}triggerStatus(e){return Io(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Io(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Mo=class{constructor(e){this._matchers=e}triggerStatus(e){return Eo(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Eo(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Po=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return So}stop(){}};const Fo=e=>"sessionRecording"in e;var Ro=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,i;this._urlTriggers=(Fo(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(Fo(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(const e of this._urlTriggers)if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Vn.error("Invalid URL trigger regex pattern:",e.url,t)}for(const e of this._urlBlocklist)if("regex"===e.matching&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){Vn.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return Co(this._instance,this._urlTriggers.length,this._groupId,Q,j,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ue]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){const e=gr(this._instance);if(!e)return!1;try{return xo(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){const i=gr(this._instance);if(!i)return;if(i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;const s=this.urlBlocked,n=xo(i,this._urlBlocklist,this._compiledBlocklistRegexes);s&&n||(n&&!s?e():!n&&s&&t())}checkUrlTriggerConditions(e,t,i,s){const n=gr(this._instance);if(!n)return;if(n===this._lastCheckedUrl)return;this._lastCheckedUrl=n;const r=this.urlBlocked,o=xo(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();const a=this._urlTriggerStatus(s)===So,l=xo(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",n)}stop(){this._lastCheckedUrl=""}},Lo=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){const e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Be]:e}),e}triggerStatusNoSideEffects(){let e=wo;return Ft(this.linkedFlag)&&(e=ko),this.linkedFlagSeen&&(e=So),e}onConfig(e,t){var i;if(this.linkedFlag=(Fo(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Ft(this.linkedFlag)&&!this.linkedFlagSeen){const e=Tt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Tt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((s,n)=>{let r=!1;if(xt(n)&&e in n){const t=n[e];r=At(t)?!0===t:i?t===i:!!t}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&t(e,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},Ao=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(Fo(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return Co(this._instance,this._eventTriggers.length,this._groupId,G,V,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ne]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(0===this._eventTriggers.length)return;const s=this._eventTriggerStatus(i)===So,n=this._eventTriggers.includes(e);!s&&n&&t("event",e)}stop(){}},Oo=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new Ro(e,t.id),this._eventTriggerMatching=new Ao(e,t.id),this._linkedFlagMatching=new Lo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){const e=(t.conditions.events||[]).map(e=>e.name),s={urlTriggers:t.conditions.urls||[],eventTriggers:e,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,i);const n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new To(n):new Mo(n)}else this._combinedMatching=new Po}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return"trigger_pending"!==this.triggerStatusNoSideEffects(e)?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===wo).map(({label:e})=>e)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,s)}activateTrigger(e,t){var i;const s="url"===e?Q+this.group.id:G+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[s]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function $o(e){if(e.rrwebError)return bo;if(!e.receivedFlags)return vo;if(!e.isRecordingEnabled)return _o;if(e.urlTriggerMatching.urlBlocked)return mo;const t=!0===e.isSampled,i=new To([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?go:"trigger_activated"===i?fo:"trigger_pending"===i?vo:!1===e.isSampled?_o:fo}function Do(e){if(e.rrwebError)return bo;if(!e.receivedFlags)return vo;if(!e.isRecordingEnabled)return _o;if(e.urlTriggerMatching.urlBlocked)return mo;const t=new Mo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==ko,s=At(e.isSampled);return i&&"trigger_pending"===t?vo:i&&"trigger_disabled"===t||s&&!e.isSampled?_o:!0===e.isSampled?go:fo}function No(){const e=[];return function(t,i){if(xt(i)||kt(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}function Bo(e){try{const t=JSON.stringify(e,No());return t?new Blob([t]).size:0}catch(e){return-1}}function qo(e){if(Pt(e))return 4;if(Et(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":{if(kt(e)){let t=2;for(let i=0;e.length>i;i++){i>0&&(t+=1);const s=e[i];t+=Et(s)||Pt(s)?4:qo(s)}return t}const t=e;let i=2,s=!0;for(const e in t){if(!{}.hasOwnProperty.call(t,e))continue;const n=t[e];Et(n)||(s||(i+=1),s=!1,i+=e.length+3+qo(n))}return i}default:return 0}}function Ho(e,t=6606028.8){if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.sizes.slice(0,t),s=e.sizes.slice(t);return[Ho({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,t),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Ho({size:s.reduce((e,t)=>e+t,0),data:e.data.slice(t),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Wo=Uint8Array,zo=Uint16Array,Uo=Uint32Array,jo=new Wo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vo=new Wo([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]),Go=new Wo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=function(e,t){for(var i=new zo(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new Uo(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},Ko=Qo(jo,2),Zo=Ko[1];Ko[0][28]=258,Zo[258]=28;for(var Jo=Qo(Vo,0)[1],Xo=new zo(32768),Yo=0;32768>Yo;++Yo){var ea=(43690&Yo)>>>1|(21845&Yo)<<1;Xo[Yo]=((65280&(ea=(61680&(ea=(52428&ea)>>>2|(13107&ea)<<2))>>>4|(3855&ea)<<4))>>>8|(255&ea)<<8)>>>1}var ta=function(e,t,i){for(var s=e.length,n=0,r=new zo(t);s>n;++n)++r[e[n]-1];var o,a=new zo(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new zo(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[Xo[d]>>>l]=c}else for(o=new zo(s),n=0;s>n;++n)o[n]=Xo[a[e[n]-1]++]>>>15-e[n];return o},ia=new Wo(288);for(Yo=0;144>Yo;++Yo)ia[Yo]=8;for(Yo=144;256>Yo;++Yo)ia[Yo]=9;for(Yo=256;280>Yo;++Yo)ia[Yo]=7;for(Yo=280;288>Yo;++Yo)ia[Yo]=8;var sa=new Wo(32);for(Yo=0;32>Yo;++Yo)sa[Yo]=5;var na=ta(ia,9,0),ra=ta(sa,5,0),oa=function(e){return(e/8|0)+(7&e&&1)},aa=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof zo?zo:e instanceof Uo?Uo:Wo)(i-t);return s.set(e.subarray(t,i)),s},la=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},ca=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},ua=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Wo(0),0];if(1==n){var o=new Wo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new zo(h+1),_=da(i[u-1],p,0);if(_>t){s=0;var g=0,f=_-t,v=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;g+=v-(1<<_-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=r[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=r[s].s;p[b]==t&&(--p[b],++g)}_=t}return[new Wo(p),_]},da=function(e,t,i){return-1==e.s?Math.max(da(e.l,t,i+1),da(e.r,t,i+1)):t[e.s]=i},ha=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new zo(++t),s=0,n=e[0],r=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++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=e[a]}return[i.subarray(0,s),t]},pa=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},_a=function(e,t,i){var s=i.length,n=oa(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},ga=function(e,t,i,s,n,r,o,a,l,c,u){la(t,u++,i),++n[256];for(var d=ua(n,15),h=d[0],p=d[1],_=ua(r,15),g=_[0],f=_[1],v=ha(h),m=v[0],y=v[1],b=ha(g),S=b[0],w=b[1],k=new zo(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var x=ua(k,7),I=x[0],E=x[1],T=19;T>4&&!I[Go[T-1]];--T);var M,P,F,R,L=c+5<<3,A=pa(n,ia)+pa(r,sa)+o,O=pa(n,h)+pa(r,g)+o+14+3*T+pa(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return _a(t,u,e.subarray(l,l+c));if(la(t,u,1+(A>O)),u+=2,A>O){M=ta(h,p,0),P=h,F=ta(g,f,0),R=g;var D=ta(I,E,0);for(la(t,u,y-257),la(t,u+5,w-1),la(t,u+10,T-4),u+=14,C=0;T>C;++C)la(t,u+3*C,I[Go[C]]);u+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)la(t,u,D[H=31&q[C]]),u+=I[H],H>15&&(la(t,u,q[C]>>>5&127),u+=q[C]>>>12)}}else M=na,P=ia,F=ra,R=sa;for(C=0;a>C;++C)if(s[C]>255){var H;ca(t,u,M[257+(H=s[C]>>>18&31)]),u+=P[H+257],H>7&&(la(t,u,s[C]>>>23&31),u+=jo[H]);var W=31&s[C];ca(t,u,F[W]),u+=R[W],W>3&&(ca(t,u,s[C]>>>5&8191),u+=Vo[W])}else ca(t,u,M[s[C]]),u+=P[s[C]];return ca(t,u,M[256]),u+P[256]},fa=new Uo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),va=new Wo(0),ma=function(){for(var e=new Uo(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),ya=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function ba(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=ma[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var n,r,o,a,l,c=(n=e,r=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,i,s,n,r){var o=e.length,a=new Wo(s+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(s,a.length-n),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=_a(l,c,e.subarray(u,d)):(l[u]=r,c=_a(l,c,e.subarray(u,o)))}else{for(var h=fa[t-1],p=h>>>13,_=8191&h,g=(1<<i)-1,f=new zo(32768),v=new zo(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Uo(25e3),w=new zo(288),k=new zo(32),C=0,x=0,I=(u=0,0),E=0,T=0;o>u;++u){var M=b(u),P=32767&u,F=v[M];if(f[P]=F,v[M]=P,u>=E){var R=o-u;if((C>7e3||I>24576)&&R>423){c=ga(e,l,0,S,w,k,x,I,T,u-T,c),I=C=x=0,T=u;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=P-F&32767;if(R>2&&M==b(u-N))for(var B=Math.min(p,R)-1,q=Math.min(32767,u),H=Math.min(258,R);q>=N&&--D&&P!=F;){if(e[u+A]==e[u+A-N]){for(var W=0;H>W&&e[u+W]==e[u+W-N];++W);if(W>A){if(A=W,O=N,W>B)break;var z=Math.min(N,W-2),U=0;for(L=0;z>L;++L){var j=u-N+L+32768&32767,V=j-f[j]+32768&32767;V>U&&(U=V,F=j)}}}N+=(P=F)-(F=f[P])+32768&32767}if(O){S[I++]=268435456|Zo[A]<<18|Jo[O];var G=31&Zo[A],Q=31&Jo[O];x+=jo[G]+Vo[Q],++w[257+G],++k[Q],E=u+A,++C}else S[I++]=e[u],++w[e[u]]}}c=ga(e,l,r,S,w,k,x,I,T,u-T,c),r||(c=_a(l,c,va))}return aa(a,0,s+oa(c)+n)}(n,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+r.mem,o,a,!l)),u=c.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&ya(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(c,t),ya(c,u-8,i.d()),ya(c,u-4,s),c}function Sa(e,t){var i=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new Wo(e.length+(e.length>>>1)),n=0,r=function(e){s[n++]=e},o=0;i>o;++o){if(n+5>s.length){var a=new Wo(n+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return aa(s,0,n)}function wa(e,t){var i="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var s=0;e.length>s;){var n=e[s++];128>n||t?i+=String.fromCharCode(n):224>n?i+=String.fromCharCode((31&n)<<6|63&e[s++]):240>n?i+=String.fromCharCode((15&n)<<12|(63&e[s++])<<6|63&e[s++]):(n=((15&n)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}return i}var ka=class{constructor(e,t={}){var i,s,n,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{const e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,i;this._loggedTracker[e]=!0;const s=this._getNode(e);null===(t=(i=this._options).onBlockedNode)||void 0===t||t.call(i,e,s)}},this._getNodeOrRelevantParent=e=>{const t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,i,s,n,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(s=null===(n=e.attributes)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this._numberOfChanges(t);if(t.attributes){const e=t.attributes.length;t.attributes=t.attributes.filter(e=>{const[t]=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t)&&e});const i=e-t.attributes.length;var s,n;i>0&&(null===(s=(n=this._options).onDroppedAttributeMutations)||void 0===s||s.call(n,i))}const r=this._numberOfChanges(t);if(0===r&&i!==r)return;if(this._byteBudgetDisabled)return e;this._refillByteBudget();const o=qo(e);var a,l;return o>this._byteTokens?(null===(a=(l=this._options).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._scheduleResync()):(this._byteTokens-=o,e)},this._scheduleResync=()=>{if(this._resyncTimer)return;const e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null===(e=(t=this._options).requestFullSnapshot)||void 0===e||e.call(t)},e)},this._rateLimiter=new Kt({bucketSize:null!==(i=this._options.bucketSize)&&void 0!==i?i:100,refillRate:null!==(s=this._options.refillRate)&&void 0!==s?s:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Vn}),this._bytesBucketSize=null!==(n=this._options.bytesBucketSize)&&void 0!==n?n:0,this._bytesRefillRate=null!==(r=this._options.bytesRefillRate)&&void 0!==r?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;const o=this._options.resyncIntervalMs;this._resyncIntervalMs=Rt(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}};const Ca=e=>{if(s){try{const t=e+"=",i=s.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Rt(e)&&isFinite(e)&&Math.floor(e)===e});var xa=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,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 e(r)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},Ia=class{generate(){const e=this.generateOrAbort();if(!Et(e))return e;{this._timestamp=0;const e=this.generateOrAbort();if(Et(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return Rt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return xa.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new Ta}};let Ea=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!Et(e.crypto)&&crypto.getRandomValues&&(Ea=e=>crypto.getRandomValues(e));var Ta=class{nextUint32(){return this._buffer.length>this._cursor||(Ea(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}};let Ma;const Pa=()=>Fa().toString(),Fa=()=>(Ma||(Ma=new Ia)).generate();let Ra="";const La=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Aa=null;const Oa={_is_supported(){if(!Pt(Aa))return Aa;if(Aa=!1,s)try{const e=`__ph_cookie_support_${Pa()}`;Oa._set(e,"xyz"),Aa='"xyz"'===Ca(e),Oa._remove(e)}catch(e){Aa=!1}return Aa},_error(e){Vn.error("cookieStore error: "+e)},_get:Ca,_parse(e){let t;try{t=JSON.parse(Oa._get(e))||{}}catch(e){}return t},_set(e,t,i,n,r){if(!s)return!1;try{let o="",a="";const l=function(e,t){if(t){let t=function(e,t=s){if(Ra)return Ra;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let n=Math.min(i.length,8);const r="dmn_chk_"+Pa();for(;!Ra&&n--;){const e=i.slice(n).join("."),s=r+"=1;domain=."+e+";path=/";t.cookie=s+";max-age=3",t.cookie.includes(r)&&(t.cookie=s+";max-age=0",Ra=e)}return Ra}(e);if(!t){const i=(e=>{const t=e.match(La);return t?t[0]:""})(e);i!==t&&Vn.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(s.location.hostname,n);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),o="; expires="+e.toUTCString()}r&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Vn.warn("cookieStore warning: large cookie, len="+c.length),s.cookie=c,!0}catch(e){return!1}},_remove(e,t){if(null==s?void 0:s.cookie)try{Oa._set(e,"",-1,t)}catch(e){return}}};let $a=null;const Da={_is_supported(){if(!Pt($a))return $a;let t=!0;if(Et(e))t=!1;else try{const e="__mplssupport__";Da._set(e,"xyz"),'"xyz"'!==Da._get(e)&&(t=!1),Da._remove(e)}catch(e){t=!1}return t||Vn.error("localStorage unsupported; falling back to cookie store"),$a=t,t},_error(e){Vn.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Da._error(e)}return null},_parse(e){try{return JSON.parse(Da._get(e))||{}}catch(e){}return null},_set(t,i){try{return null==e||e.localStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Da._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Da._error(e)}}},Na=[ae,Y,X,te,ie,se,xe,Ce,we],Ba=[g,_,W,z,Re,Fe,b,Ie],qa=e=>e+"_cpm",Ha=["__proto__","constructor","prototype"],Wa=e=>{if(!xt(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===Ha.indexOf(i)&&(t[i]=e[i])}),t},za=(e,t=[])=>{const i={};return[...Ba,...t].forEach(t=>{const s=e[t];Et(s)||Pt(s)||""===s||(i[t]=s)}),i},Ua=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},ja=(e,t)=>({p:t,f:Ua(JSON.stringify(e))}),Va=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=Oa._parse(qa(e)),s=(null==i?void 0:i.f)===Ua(t)&&kt(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Ga=(e,t)=>t+"|"+(Oa._get(qa(e))||""),Qa={},Ka={_is_supported:()=>!0,_error(e){Vn.error("memoryStorage error: "+e)},_get:e=>e in Qa?Qa[e]:null,_parse:e=>e in Qa?Qa[e]:null,_set:(e,t)=>(Qa[e]=t,!0),_remove(e){delete Qa[e]}};let Za=null;const Ja={_is_supported(){if(!Pt(Za))return Za;if(Za=!0,Et(e))Za=!1;else try{const e="__support__";Ja._set(e,"xyz"),'"xyz"'!==Ja._get(e)&&(Za=!1),Ja._remove(e)}catch(e){Za=!1}return Za},_error(e){Vn.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Ja._error(e)}return null},_parse(e){try{return JSON.parse(Ja._get(e))||null}catch(e){}return null},_set(t,i){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Ja._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Ja._error(e)}}};Un.DEBUG=!1,Un.LIB_VERSION="1.433.5",Un.LIB_NAME="web";var Xa=Un,Ya=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(J,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){const t=this._getProperty(J);return xt(i=t)&&Tt(i.sessionId)&&Rt(i.size)&&t.sessionId===e?t.size:0;var i}};function el(e,t){return function(e){let t=0;for(let i=0;e.length>i;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(e)%100<Qt(100*t,0,100,Vn)}function tl(e){return`$survey_response_${e}`}function il(e,t){if(!t)return null;const i=e[tl(t)];return kt(i)?[...i]:i}function sl(e={},t,i){const s={};return t.questions.forEach(t=>{if(Et(t.originalQuestionIndex))return;const i=0===(n=t.originalQuestionIndex)?"$survey_response":`$survey_response_${n}`;var n;const r=il(e,t.id);Et(r)||(s[i]=r)}),ct(ct({$survey_questions:t.questions.map(t=>{var s,n;return{id:t.id,question:null!==(s=null==i?void 0:i[null!==(n=t.id)&&void 0!==n?n:""])&&void 0!==s?s:t.question,response:il(e,t.id)}})},e),s)}function nl(e={}){return Object.values(e).some(e=>!Ft(e))}function rl(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function ol(e){return"string"==typeof e&&e.trim()?e.trim():null}function al(e){return e.toLowerCase()}function ll(e,t,i){if(!e||!t)return null;const s=al(t),n=Object.keys(e).find(e=>al(e)===s);if(n)return null==i||i.debug(`Found exact translation match: ${n}`),n;if(s.includes("-")){const n=s.split("-")[0],r=Object.keys(e).find(e=>al(e)===n);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${t})`),r}return null}const cl=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function ul(e,t,i){var s;const n=ll(e.translations,t,i),r=ct({},e);let o=!1;if(n){var a;const t=null===(a=e.translations)||void 0===a?void 0:a[n];if(t)if(null==i||i.info(`Applying survey-level translation for language: ${n}`),Et(t.name)||(r.name=t.name,o=!0),r.appearance){const e=ct({},r.appearance);for(const i of cl){const s=t[i];Et(s)||(e[i]=s,o=!0)}r.appearance=e}else(function(e){return cl.some(t=>!Et(e[t]))})(t)&&(o=!0)}const l=e.questions.map(e=>function(e,t,i){var s;const n=ll(e.translations,t,i);if(!n)return{question:e,matchedKey:null,hasChanges:!1};const r=null===(s=e.translations)||void 0===s?void 0:s[n];if(!r)return{question:e,matchedKey:null,hasChanges:!1};const o=ct({},e);let a=!1;return Et(r.question)||(o.question=r.question,a=!0),Et(r.description)||(o.description=r.description,a=!0),Et(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Et(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Et(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Et(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(e){return kt(e.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:e,matchedKey:a?n:null,hasChanges:a}}(e,t,i)),c=l.map(e=>e.question),u=l.some(e=>e.hasChanges);let d=null;return n||(d=(null===(s=l.find(e=>e.matchedKey))||void 0===s?void 0:s.matchedKey)||null),u&&(r.questions=c,o=!0,null==i||i.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?n||d:null}}function dl(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}function hl(e){var t;return dl(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}const pl=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},_l=e=>e.toLowerCase(),gl={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>pl(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!pl(t,e))),icontains:(e,t)=>t.map(_l).some(t=>e.map(_l).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(_l).every(t=>e.map(_l).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function fl(e,t){return!e||Object.entries(e).every(([e,i])=>{const s=null==t?void 0:t[e];if(null==s)return!1;const n=gl[i.operator];return!!n&&n(i.values,[String(s)])})}function vl(e,t,i){return or({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const ml=new Set(["is_not","not_icontains","not_regex"]);function yl(e,t,i){return!e||0===e.length||e.every(e=>{const s="person"===e.type?i:t,n=null==s?void 0:s[e.key],r=e.operator||"exact";if(Et(n)||Pt(n))return ml.has(r);const o=gl[r];return!!o&&!Et(e.value)&&!Pt(e.value)&&o(kt(e.value)?e.value.map(String):[String(e.value)],kt(n)?n.map(String):[String(n)])})}const bl=Gn("[SessionRecording]");function Sl(e,t){return t?e:"!"+e}function wl(e,t){return e===t||e!=="!"+t&&null}var kl=class{constructor(e,t,i,s,n,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=s,this._reportStarted=n,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=Do}onRemoteConfig(e){this._sampleRate=Rt(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new To([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=$o):(this._triggerStatusMatcher=new Mo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Do),this._instance.register_for_session({[We]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){const t=this._instance.get_property("$session_recording_remote_config"),i=null==t?void 0:t.minimumDurationMilliseconds;return Rt(i)?i:null}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,s,e)}setupEventTriggerListeners(e,t,i){if(0!==this._eventTriggerMatching._eventTriggers.length&&Ft(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,i,t)}catch(e){bl.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;const i=this._sampleRate;var s,n;if(!Rt(i))return null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_is_sampled"),void(null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"));const r=this._instance.get_property(z),o=this._instance.get_property(D),a=wl(r,e),l=Rt(o)&&o!==i,c=Et(o)&&r===e,u=l||c||!At(a),d=u?el(e,i):a;u&&(d?this._reportStarted("sampled"):bl.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:Sl(e,d),$replay_sample_rate:Pt(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!Rt(this._sampleRate))return;const t=this._instance.get_property(z);At(wl(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,s,n;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_event_trigger_activated_session"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_past_minimum_duration")}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null===(t=this._triggerStatusMatcher)||void 0===t?void 0:t.triggerStatus(e))===wo}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===wo).map(({label:e})=>e)}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},Cl=class{constructor(e,t,i,s,n){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=s,this._onTriggerActivated=n,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[We]:"v2_trigger_groups",[ze]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):bl.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return bo;if(!e.receivedFlags)return vo;if(!e.isRecordingEnabled)return _o;if(e.urlTriggerMatching.urlBlocked)return mo;const t=e.triggerGroupMatchers,i=e.triggerGroupSamplingResults;if(0===t.length)return _o;let s=!1,n=!1;for(const r of t){const t=r.triggerStatus(e.sessionId);if("trigger_activated"===t){const e=r.group.id,t=i.get(e);Et(t)?Vn.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:e}):!0===t&&(n=!0)}else"trigger_pending"===t&&(s=!0)}return n?go:s?vo:_o}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){let t=null;for(const i of this._triggerGroupMatchers)if("trigger_activated"===i.triggerStatus(e)){const e=i.group.minDurationMs;Rt(e)&&(Pt(t)||t>e)&&(t=e)}return t}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(const s of this._triggerGroupMatchers)s.checkUrlTriggerConditions(t,i,t=>{this._checkGroupLevelProperties(s,void 0)&&(s.activateTrigger(t,e),this.updateActiveTriggers(e),this._onTriggerActivated(t))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(e=>{var i;if(this._hasCompletedInitialFlush)return bl.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(const i of this._triggerGroupMatchers)i.checkEventTriggerConditions(e.event,s=>{if(!this._checkGroupLevelProperties(i,e.properties))return;const n=(i.group.conditions.events||[]).filter(t=>t.name===e.event),r=this._instance.get_property(ae);n.some(t=>!t.properties||0===t.properties.length||yl(t.properties,e.properties,r))&&(i.activateTrigger(s,t),this.updateActiveTriggers(t),this._onTriggerActivated(s))},t)}catch(e){bl.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(const i of this._triggerGroupMatchers){var t;const s=i.group,n=s.id,r=s.sampleRate,o=K+n,a=this._instance.get_property(o);let l=null,c=!1,u=!1,d=!1;if(xt(a)){const t=a.sessionId,i=a.sampleRate,s=a.sampled;c="string"==typeof t&&t!==e,u=Rt(i)&&i!==r,l=t===e&&Rt(i)&&i===r&&At(s)?s:null}else l=a===e||null,c="string"==typeof a&&a!==e,d=a===e;const h=c||u||d||!At(l),p=h?el(e+n,r):l;h&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:s.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(n,p),null===(t=this._instance.persistence)||void 0===t||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const e of this._triggerGroupMatchers){var s,n,r;const t=e.group.id;null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_event_trigger_"+t),null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_url_trigger_"+t),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+t)}}updateActiveTriggers(e){const t=[];for(const i of this._triggerGroupMatchers){const s=i.group,n=s.id,r="trigger_activated"===i.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);r&&t.push({id:n,name:s.name,matched:!0,sampled:o})}this._instance.register_for_session({[qe]:t})}hasPendingTriggers(e){for(const t of this._triggerGroupMatchers)if("trigger_pending"===t.triggerStatus(e))return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>"trigger_pending"!==t.triggerStatusNoSideEffects(e)?[]:t.getPendingTriggerConditions(e).map(e=>`trigger group "${t.group.name}": ${e}`))}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){const i=e.group.conditions.properties;return!i||0===i.length||yl(i,t,this._instance.get_property(ae))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(const t of e){const e=new Oo(this._instance,t,(e,i)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:i,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(e)}}};const xl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Il=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...xl],El="<masked>",Tl=["li_fat_id"];function Ml(e,t,i){if(!s)return{};const n=t?[...xl,...i||[]]:[],r=Pl(ur(s.URL,n,El),e),o=function(){const e={};return Kn(Tl,function(t){const i=Ca(t);e[t]=i||null}),e}();return Zn(o,r)}function Pl(e,t){const i=Il.concat(t||[]),s={};return Kn(i,function(t){const i=cr(e,t);s[t]=i||null}),s}function Fl(e){const t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",n={};if(!Pt(t)){n.$search_engine=t;const e=s?cr(s.referrer,i):"";e.length&&(n.ph_keyword=e)}return n}function Rl(){return navigator.language||navigator.userLanguage}function Ll(){const e=Rl();return"string"==typeof e?e.split("-")[0]:void 0}const Al="$direct";function Ol(){return(null==s?void 0:s.referrer)||Al}function $l(e,t,i=!1){const s=e?[...xl,...t||[]]:[],r=i?ls(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return{r:Ol().substring(0,1e3),u:o?ur(o,s,El):void 0}}function Dl(e,t=!1){var i;const{r:s,u:n}=e,r=t?ls(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Al?Al:null===(i=ar(s))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=ar(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=Pl(r);Zn(o,t)}if(s){const e=Fl(s);Zn(o,e)}return o}function Nl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Bl(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const ql=1e5,Hl=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Wl=[],zl=()=>!1,Ul="@type @id actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),jl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Vl="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),Gl="Accommodation AdministrativeArea Country Place State".split(" "),Ql={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:jl,publisher:Vl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Wl},Offer:{seller:Vl},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Vl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Vl,areaServed:Gl,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Wl}},Kl=[["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),Ql.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Ql.Event],[Vl,Ql.Organization],[Gl,Ql.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Ql.Product]];function Zl(e,t){return St.call(e,t)?e[t]:void 0}function Jl(e){const t=typeof e;return Pt(e)||"string"===t||"number"===t||"boolean"===t}function Xl(e,t){return t&&function(e){return Tt(e)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(e.trim())}(e)?t(e.trim())||void 0:e}function Yl(e,t){return kt(e)&&e.every(Jl)?e.map(e=>Xl(e,t)).filter(e=>!Et(e)):Jl(e)?Xl(e,t):void 0}function ec(e,t){if("string"!=typeof e)return;const i=e.trim(),s=i.indexOf("#"),n=0>s?i:i.slice(s+1);if(!(!n||0>s&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return t(n)?n:void 0}catch(e){return}}function tc(e){if(St.call(Ql,e))return Ql[e];for(const[t,i]of Kl)if(t.includes(e))return i}function ic(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function sc(e,t,i,s){if(kt(e)){const n=e.map(e=>sc(e,t,i,s)).filter(e=>!Et(e));return n.length?n:void 0}return nc(e,t,i,s)||void 0}function nc(e,t,i,s){if(!xt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(i))return null;const n=Zl(e,"@type"),r=function(e){const t=new Set,i="string"==typeof e?[e]:kt(e)?e:[],s=[];for(const e of i){if("string"!=typeof e)continue;const i=e.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Hl.test(i)&&!t.has(i)&&(t.add(i),s.push(i),20===s.length))break}return s}(n),o=r.filter(e=>!!tc(e)&&(!s||!s.length||s.includes(e))),a={};for(const s of Ul){const o="@type"===s?r.length?"string"==typeof n?r[0]:r:void 0:"@id"===s?ec(Zl(e,s),t):Yl(Zl(e,s),i.maskUrl);Et(o)||ic(a,s,o)}for(const s of o){const n=tc(s);for(const s of Object.keys(n)){const r=Zl(e,s),o=n[s];if(!0===o){const e=Yl(r,i.maskUrl);Et(e)||ic(a,s,e)}else{const e=sc(r,t,i,o);Et(e)||ic(a,s,e)}}}const l=sc(Zl(e,"@graph"),t,i);return Et(l)||ic(a,"@graph",l),Object.keys(a).length?a:null}function rc(e,t,i){if(!xt(e))return null;const s=Zl(e,"@context");if("string"!=typeof s||!/^https?:\/\/schema\.org\/?$/.test(s))return null;const n=nc(e,t,i);return n?ct({"@context":"https://schema.org"},n):null}function oc(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.trim().toLowerCase())}function ac(e,t,i){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some(e=>(t.lastIndex=0,t.test(e))))return!0;try{return!!i&&e.matches(i)}catch(e){return!1}}function lc(e,t,i){for(let s=e;s;){if(ac(s,t,i))return!0;const e=s.parentNode;s=s.parentElement||(e&&e.nodeType===e.DOCUMENT_FRAGMENT_NODE?e.host:null)}return!1}function cc(e){return oc(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(oc)}function uc(e){return Et(e)?void 0:Math.round(e)}function dc(e){return xt(e)?e.network_timing:e}const hc=Gn("[SessionRecording]"),pc=[1,2,3,4,5,6,7,12],_c=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function gc(){var e;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.rrweb}function fc(){var e;return null===(e=gc())||void 0===e?void 0:e.record}function vc(e){try{return JSON.stringify(e)}catch(t){if(t instanceof RangeError)throw t;return JSON.stringify(e,No())}}function mc(e){return wa(ba(Sa(vc(e))),!0)}function yc(e){return bc.apply(this,arguments)}function bc(){return(bc=rt(function*(e){const t=yield fn(vc(e),Xa.DEBUG,{rethrow:!0});return wa(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}let Sc,wc;const kc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let Cc=!1;function xc(e){var t;return kt(e)&&0===e.length?(Sc=null!==(t=Sc)&&void 0!==t?t:mc([]),Sc):mc(e)}function Ic(e){return Ec.apply(this,arguments)}function Ec(){return(Ec=rt(function*(e){var t;return kt(e)&&0===e.length?Sc||(wc=null!==(t=wc)&&void 0!==t?t:yc([]).then(e=>(Sc=e,e)).catch(e=>{throw Sc=void 0,wc=void 0,e}),wc):yc(e)})).apply(this,arguments)}function Tc(e){return kc&&!Cc&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function Mc(e){return{event:e,size:qo(e)}}function Pc(e,t){return ct(ct({},e),{},{data:t,cv:"2024-10"})}function Fc(e,t){return ct(ct({},e),{},{cv:"2024-10",data:ct(ct({},e.data),t)})}function Rc(e){try{if(2===e.type)return Mc(Pc(e,mc(e.data)));if(3===e.type&&0===e.data.source)return Mc(Fc(e,{texts:xc(e.data.texts),attributes:xc(e.data.attributes),removes:xc(e.data.removes),adds:xc(e.data.adds)}));if(3===e.type&&8===e.data.source)return Mc(Fc(e,{adds:e.data.adds?mc(e.data.adds):void 0,removes:e.data.removes?mc(e.data.removes):void 0}))}catch(e){hc.warn("could not compress event - will use uncompressed event",e)}return{event:e,size:Bo(e)}}function Lc(){return Lc=rt(function*(e){try{if(2===e.type)return Mc(Pc(e,yield yc(e.data)));if(3===e.type&&0===e.data.source){const[t,i,s,n]=yield Promise.all([Ic(e.data.texts),Ic(e.data.attributes),Ic(e.data.removes),Ic(e.data.adds)]);return Mc(Fc(e,{texts:t,attributes:i,removes:s,adds:n}))}if(3===e.type&&8===e.data.source){const[t,i]=yield Promise.all([e.data.adds?yc(e.data.adds):void 0,e.data.removes?yc(e.data.removes):void 0]);return Mc(Fc(e,{adds:t,removes:i}))}}catch(t){return dn(t)&&(Cc=!0),hc.warn("could not compress event asynchronously - trying synchronous compression",t),Rc(e)}return{event:e,size:Bo(e)}}),Lc.apply(this,arguments)}function Ac(e,t){return 5===e.type&&e.data.tag===t}function Oc(e){return Ac(e,"sessionIdle")}function $c(e){return Ac(e,"$session_ending")}function Dc(e){return Ac(e,"$session_starting")}var Nc=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return wl(this._instance.get_property(z),this.sessionId)}get _sampleRate(){var e;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.sampleRate;return Rt(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,i)=>{var s,n,r,o;if(!i)return;if(e===this._sessionId&&t===this._windowId)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this._sessionId,c=this._windowId;var u;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null===(u=this._flushedSizeTracker)||void 0===u?void 0:u.currentTrackedSize(l)}),null===(s=this._instance.persistence)||void 0===s||s.unregister("$debug_first_full_snapshot_timestamp"),this._maxDepthExceeded=!1,null===(n=gc())||void 0===n||null===(r=n.resetMaxDepthState)||void 0===r||r.call(n),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){const t=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(t)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp}),null===(o=this._strategy)||void 0===o||o.makeSamplingDecisions(e)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[U])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;const i=null===(e=this._buffer.data[0])||void 0===e?void 0:e.timestamp,s=null===(t=this._buffer.data[this._buffer.data.length-1])||void 0===t?void 0:t.timestamp;return Rt(i)&&Rt(s)?s-i:null},this._isBelowMinimumDuration=()=>{var e,t;const i=this._minimumDuration;if(!Rt(i))return!1;if(null===(e=null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.strictMinimumDuration)||void 0===e||!e){const e=this._sessionDuration;return Rt(e)&&e>=0&&i>e}if(this._hasPassedMinimumDuration())return!1;const s=this._getBufferDuration();return!!Pt(s)||i>s||(null===(n=this._instance.persistence)||void 0===n||n.register({$session_past_minimum_duration:this._sessionId}),!1);var n},this._onBeforeUnload=()=>{"buffering"!==this.status?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&!this._heldBufferOverflowed&&this._setFlushHold(void 0),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{(null==s?void 0:s.visibilityState)&&("visible"===s.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+s.visibilityState,{}))},this._documentWasEverVisible=null==t||t;const{sessionId:i,windowId:n,sessionStartTimestamp:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=n,this._sessionStartTimestamp=r,this._linkedFlagMatching=new Lo(this._instance),this._urlTriggerMatching=new Ro(this._instance),this._eventTriggerMatching=new Ao(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||hc.warn(`session_idle_threshold_ms (${this._sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this._sessionManager.sessionTimeoutMs}). Session will never be detected as idle`),this._flushedSizeTracker=new Ya(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,s,n,r,o,a,l;const c=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking,u={maskAllInputs:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.blockSelector,maskAllElementAttributes:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.maskAllElementAttributes},d=null!==(r=null==u?void 0:u.maskAllInputs)&&void 0!==r?r:null==c?void 0:c.maskAllInputs,h=null!==(o=null==u?void 0:u.maskTextSelector)&&void 0!==o?o:null==c?void 0:c.maskTextSelector,p=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==c?void 0:c.blockSelector,_=null!==(l=null==u?void 0:u.maskAllElementAttributes)&&void 0!==l?l:null==c?void 0:c.maskAllElementAttributes;return Et(d)&&Et(h)&&Et(p)&&Et(_)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking;if(Ft(t))return;const i=this._instance.config.session_recording,s=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{const s=null==i?void 0:i[e],n=t[e];return!Et(s)&&s!==n});0!==s.length&&(this._hasWarnedClientMaskingOverride=!0,hc.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+s.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:t}))}get _canvasResolutionScale(){var e;return Qt(null===(e=this._instance.config.session_recording.canvasCapture)||void 0===e?void 0:e.resolutionScale,.1,1,Gn("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,s,n,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(e=this._remoteConfig)||void 0===e?void 0:e.canvasRecording,c=null!==(t=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==t&&t,u=null!==(s=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==s?s:4;let d=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof d){const e=parseFloat(d);d=isNaN(e)?.4:e}return{enabled:c,fps:Qt(u,0,12,Gn("canvas recording fps"),4),quality:Qt(d,0,1,Gn("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;const t=!!(null===(e=this._remoteConfig)||void 0===e?void 0:e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get _networkPayloadCapture(){var e,t,i;const s=null===(e=this._remoteConfig)||void 0===e?void 0:e.networkPayloadCapture,n={recordHeaders:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==n?void 0:n.recordHeaders)||(null==s?void 0:s.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==s?void 0:s.recordBody),a=dc(this._instance.config.capture_performance),l=dc(null==s?void 0:s.capturePerformance),c=!!(At(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;const i=[],s=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordConsolePlugin;s&&this._isConsoleLogCaptureEnabled&&i.push(s());const r=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Ct(r))if(!rr.includes(n.hostname)||this._forceAllowLocalhostNetworkCapture){const e=Ct(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((e,t,i)=>{const s={payloadSizeLimitBytes:no.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...no.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...no.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,a=(e=>{const t=so(e);return e=>((null==e?void 0:e.requestBody)&&(e.requestBody=uo(e.requestBody,e.requestHeaders,t,"Request")),(null==e?void 0:e.responseBody)&&(e.responseBody=uo(e.responseBody,e.responseHeaders,t,"Response")),e)})(s),l=t=>{return a(((e,t,i)=>{var s;if(null==i?void 0:i(e.name))return;const n=ar(e.name);let r=0===t.indexOf("http")?null===(s=ar(t))||void 0===s?void 0:s.pathname:t;"/"===r&&(r="");const o=null==n?void 0:n.pathname.replace(r||"","");return n&&o&&co.some(e=>0===o.indexOf(e))?void 0:e})((lo((s=t).requestHeaders),lo(s.responseHeaders),s),e.api_host,i));var s},c=Ct(e.session_recording.maskNetworkRequestFn);return c&&Ct(e.session_recording.maskCapturedNetworkRequestFn)&&Vn.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});return!i&&t.isInitial?i:ct(ct({},t),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=Ct(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,s;const n=l(t);if(!n)return;const r=n.isInitial?{name:"",entryType:n.entryType,startTime:n.startTime,duration:n.duration,endTime:n.endTime,timeOrigin:n.timeOrigin,timestamp:n.timestamp,isInitial:!0}:void 0,o=null===(i=(s=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(s,n);return Ft(o)&&r?(po.add(r),r):null!=o?o:void 0}:e=>function(e){if(!Et(e))return e.requestBody=ho(e.requestBody,"Request"),e.responseBody=ho(e.responseBody,"Response"),e}(l(e)),ct(ct(ct({},no),s),{},{recordHeaders:n,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,e)))}else hc.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?ls(e):e}_maskReplayUrl(e,t=!1){const i=t?ls(e):this._stripUrlHash(e),s=this._instance.config.mask_personal_data_properties?[...xl,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(ur(i,s,El))}_maskUrl(e){const t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;const s=t.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:null==s?void 0:s.url}if(t.maskNetworkRequestFn){const i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):hc.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(_c(()=>fc().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{const t=fc();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return null===(t=this._jsonLdCapture)||void 0===t?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;const t=new URL(e.location.href),i=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==i&&(this._lastHref=i,this._tryAddCustomEvent("$url_changed",{href:i}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){const e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(_c(()=>fc().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if((null===(e=this._strategy)||void 0===e?void 0:e.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var s;const e=null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.trigger_pending_buffer_interval_millis;return Rt(e)&&Number.isFinite(e)&&e>=1e3&&36e5>=e?e:6e4}return null!==(t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0===this._isIdle)return;const e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null===(e=this._jsonLdCapture)||void 0===e||e.scan(),clearInterval(this._fullSnapshotTimer),hc.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null===(e=this._jsonLdCapture)||void 0===e||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),hc.info("recording resumed"))}_activateTrigger(e,t){var i;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&(null===(i=this._strategy)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var s,n;const i="url"===e?j:V;null===(s=this._instance.persistence)||void 0===s||s.register({[i]:this.sessionId}),null===(n=this._strategy)||void 0===n||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){const e=this._instance.get_property(A);if(!e)return;let t;try{t=xt(e)?e:JSON.parse(e)}catch(e){return void hc.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;const s=null!==(i=t.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-s>36e5)return void hc.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e})}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(t){var i,n;const r=this._remoteConfig;if(!r)return void hc.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const e=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(e?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=e,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=o,this._windowId=a,this._sessionStartTimestamp=l,this._restorePendingBuffer(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this._endpoint=null==r?void 0:r.endpoint),this._strategy=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new Cl(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new kl(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(r),null===(n=this._removeEventTriggerCaptureHook)||void 0===n||n.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(N,()=>{this.overrideSampling()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(N)}),this._checkOverride(B,()=>{this.overrideLinkedFlag()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(B)}),this._checkOverride(H,()=>{this.overrideTrigger("event")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(H)}),this._checkOverride(q,()=>{this.overrideTrigger("url")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(q)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(sr(e,"beforeunload",this._onBeforeUnload),sr(e,"pagehide",this._onPageHide),sr(e,"offline",this._onOffline),sr(e,"online",this._onOnline),sr(s,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Ct(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Ct(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,i)=>{var s;null===(s=this._forceIdleSessionIdListener)||void 0===s||s.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,i)})}):Ct(this._sessionManager.on)||hc.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Ft(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){const t=(null==e?void 0:e.properties.$current_url)?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){hc.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(t||"recording_initialized"))}_teardown(){var t,i,n,r,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(r=this._onSessionIdleResetForcedListener)||void 0===r||r.call(this),this._onSessionIdleResetForcedListener=void 0,null===(o=this._forceIdleSessionIdListener)||void 0===o||o.call(this),this._forceIdleSessionIdListener=void 0,null===(a=this._strategy)||void 0===a||a.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null===(e=this._mutationThrottler)||void 0===e||e.stop(),this._queuedRRWebEvents=[],null===(t=this._jsonLdCapture)||void 0===t||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;null===(i=this._stopRrweb)||void 0===i||i.call(this)}catch(e){hc.warn("could not stop rrweb",e)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;const e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),hc.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),hc.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),hc.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t,i;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,null===(t=gc())||void 0===t||null===(i=t.resetSnapshotCostState)||void 0===i||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!Et(e),this._flushHoldReason=e,Et(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;const i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,hc.info(`holding buffer: ${e}. nothing is uploaded until the user interacts with the page`))}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),hc.info("discarded")}_captureProcessedEvent(e,t,i,s,n){if(-1===i)return this._unstringifiableEventsDropped+=1,void hc.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:t,$session_id:s,$window_id:n};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,s),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,hc.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;const i=null===(e=gc())||void 0===e||null===(t=e.getLastSnapshotCost)||void 0===t?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=i.durationMs||(this._slowestFullSnapshot=i),500>i.durationMs||hc.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(Et(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,hc.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t,i=e.event;if(e.compressionEnabled)try{({event:i,size:t}=Rc(e.event))}catch(e){hc.warn("could not process queued compression event - will use uncompressed event",e)}Et(t)&&(t=Bo(e.event));try{this._captureQueuedCompressionEvent(e,i,t)}catch(e){hc.warn("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{try{this._processQueuedCompressionEventSync(e)}catch(e){hc.warn("could not drain queued compression event",e)}})}_enqueueCompression(e,t,i,s){var n=this;const r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:s,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;const o=(a=rt(function*(){try{if(r.processed)return;let i,s;try{const n=t?Tc(e)?yield function(e){return Lc.apply(this,arguments)}(e):Rc(e):{event:e,size:Bo(e)};i=n.event,s=n.size}catch(t){hc.warn("could not process queued compression event - will use uncompressed event",t),i=e,s=Bo(e)}n._captureQueuedCompressionEvent(r,i,s)}finally{n._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(t){var i,s,n,r,o,a,l,c,u,d,h,p,_;if(!this._instance.sessionManager)return;if(this._processQueuedEvents(),!t||!xt(t))return;if(4===t.type){const e=this._maskReplayUrl(t.data.href);if(this._lastHref=e,!e)return;t.data.href=e}else this._pageViewFallBack();if(null===(i=this._strategy)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(e,t)=>this._activateTrigger(e,t)),this._urlTriggerMatching.urlBlocked&&!function(e){return 5===e.type&&"recording paused"===e.data.tag}(t))return;2===t.type&&((null===(d=gc())||void 0===d||null===(h=d.wasMaxDepthReached)||void 0===h?void 0:h.call(d))&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null===(p=this._mutationThrottler)||void 0===p||p.reset(),null===(_=this._instance.persistence)||void 0===_||_.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const g=2===t.type&&(null===(s=this._strategy)||void 0===s?void 0:s.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();const f=this._mutationThrottler?this._mutationThrottler.throttleMutations(t):t;if(!f)return void(!0===this._isIdle&&this._eventsDroppedWhileIdle++);const v=function(e){const t=e;if(t&&xt(t)&&6===t.type&&xt(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));const i=[];for(let e=0;t.data.payload.payload.length>e;e++)i.push(t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?t.data.payload.payload[e].slice(0,2e3)+"...[truncated]":t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(f),m=function(e){return $c(e)?e.data.payload:null}(v),y=function(e){return Dc(e)?e.data.payload:null}(v),b=function(e){return Oc(e)?e.data.payload:null}(v);m||y?(null==m?void 0:m.lastActivityTimestamp)&&(v.timestamp=m.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this._updateWindowAndSessionIds(v),2===t.type&&(this._fullSnapshotTimestamps.push([this._sessionId,t.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));const S=null!==(n=null!==(r=null!==(o=null==m?void 0:m.currentSessionId)&&void 0!==o?o:null==y?void 0:y.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==n?n:this._sessionId,w=null!==(a=null!==(l=null!==(c=null==m?void 0:m.currentWindowId)&&void 0!==c?c:null==y?void 0:y.nextWindowId)&&void 0!==l?l:null==b?void 0:b.windowId)&&void 0!==a?a:this._windowId;if(!0===this._isIdle&&!function(e){return Oc(e)||$c(e)||Dc(e)}(v))return void(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source}(v)&&this._eventsDroppedWhileIdle++);2===v.type&&(this._eventsDroppedWhileIdle=0),b&&(v.timestamp=b.lastActivityTimestamp+b.threshold);const k=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):k||this._scheduleJsonLdScan();const C=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===v.type&&"$json_ld"===v.data.tag){let t;try{t=e?this._maskReplayUrl(e.location.href):void 0}catch(e){}v.data.href=t}if(this._queuedCompressionEvents>0||C&&Tc(v))return void this._enqueueCompression(v,C,S,w);const{event:x,size:I}=C?Rc(v):{event:v,size:Bo(v)};this._captureProcessedEvent(v,x,I,S,w)}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):_o}log(e,t="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t;const i=null==e||null===(t=e.location)||void 0===t?void 0:t.href;if(!i)return;const s=this._maskReplayUrl(i);if(!s)return;return new URL(s).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every(e=>5===(null==e?void 0:e.type)&&!$c(e)&&!Dc(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[He]:[]}),void(this._lastLoggedBufferingReason=void 0);const t=this._describePendingTriggerConditions();if(0===t.length)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[He]:[]}),void(this._lastLoggedBufferingReason=void 0);const i=t.join(", "),s=`${this.sessionId}:${i}`;s!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=s,this._instance.register_for_session({[He]:t}),hc.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null===(e=this._instance.persistence)||void 0===e?void 0:e._disabled)&&Ja._is_supported()}_parkBufferForNextPage(){0!==this._buffer.data.length&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Ja._set(this._pendingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(this._pendingBufferRestored||!this._canParkPendingBuffer())return;this._pendingBufferRestored=!0;const e=Ja._parse(this._pendingBufferStorageKey);Ja._remove(this._pendingBufferStorageKey),xt(e)&&kt(e.data)&&0!==e.data.length&&kt(e.sizes)&&e.sizes.length===e.data.length&&Rt(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);const i=this._buffer;null===(t=this._strategy)||void 0===t||t.ensureSamplingDecision(this.sessionId);const s=this._isBelowMinimumDuration(),n=this.status;if(this._maybeLogBufferingReason(n),"buffering"===n||"paused"===n||"disabled"===n||s)return!e||"active"!==n&&"sampled"!==n||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;const e=this._currentMaskedHostname();Ho(i).forEach(t=>{try{var i;null===(i=this._flushedSizeTracker)||void 0===i||i.trackSize(t.sessionId,t.size),this._captureSnapshot(ct({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Xa.LIB_NAME,$lib_version:Xa.LIB_VERSION,$snapshot_host:e},this._unstringifiableEventsDropped>0?{$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped}:{}))}catch(e){hc.warn("could not capture snapshot chunk - skipping it",e)}}),Et(this._lastParkedBufferSize)||(Ja._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null===(r=this._strategy)||void 0===r||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this._buffer)||void 0===t?void 0:t.data.length)||0),s=e.$session_id,n=this._buffer.sessionId!==s;if(n||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){const t=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==t)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=s,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>943718.4)?this._heldBufferOverflowed||(this._heldBufferOverflowed=!0,this._buffer=this._clearBuffer()):(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t;const i=null===(e=this._buffer)||void 0===e?void 0:e.data[(null===(t=this._buffer)||void 0===t?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();let e=-1;for(let t=this._buffer.data.length-1;t>=0;t--)if(4===this._buffer.data[t].type){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((e,t)=>e+t,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Ge]:e}),hc.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",ct({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==pc.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());const{windowId:i,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp);let n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){const t="unknown"===this._isIdle;this._isIdle=!1,t||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}const r=this._sessionId!==s,o=this._windowId!==i;if(this._windowId=i,this._sessionId=s,r||o){const e=r&&!1!==this._isIdle;e&&(this._isIdle="unknown"),this._restartForSessionIdChange(e)}else if(t&&this._releaseHoldAndFlush(),n){var a;const e=["sampled","active"].includes(this.status)||(null===(a=this._strategy)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&e&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null===(e=this._strategy)||void 0===e||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,i,s,n,r,o,a,l,c,u,d,h,p;const _=null===(e=gc())||void 0===e||null===(t=e.getDeferredStylesheetStats)||void 0===t?void 0:t.call(e);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this._flushedSizeTracker)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:uc(null===(s=this._slowestFullSnapshot)||void 0===s?void 0:s.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:uc(null===(n=this._slowestFullSnapshot)||void 0===n?void 0:n.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this._slowestFullSnapshot)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this._slowestFullSnapshot)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this._slowestFullSnapshot)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==_?void 0:_.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==_?void 0:_.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==_?void 0:_.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:uc(null==_?void 0:_.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:uc(null==_?void 0:_.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:uc(null===(l=gc())||void 0===l||null===(c=l.getMutationCost)||void 0===c||null===(c=c.call(l))||void 0===c?void 0:c.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(u=gc())||void 0===u||null===(d=u.getDiscardedDurationSamples)||void 0===d?void 0:d.call(u),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped,$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped,$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped,$sdk_debug_replay_rrweb_error:this._rrwebError,$sdk_debug_replay_observer_init_failures:null===(h=gc())||void 0===h||null===(p=h.getObserverInitFailures)||void 0===p?void 0:p.call(h),[je]:!!this._stopRrweb,[Ve]:this._rrwebStartAttempted}}_startRecorder(){var t;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},n=this._instance.config.session_recording;for(const[e,t]of Object.entries(n||{}))if(e in i)if("maskInputOptions"===e)i.maskInputOptions=ct({password:!0},t);else if("sampling"===e){const e=null!=t?t:{},s={};Et(e.mousemove)||(s.mousemove=e.mousemove),Et(e.mouseInteraction)||(s.mouseInteraction=e.mouseInteraction),i.sampling=s}else i[e]=t;var r,o,a,l;!0===(null==n?void 0:n.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ct(ct({},i.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling=ct(ct({},i.sampling),{},{canvas:this._canvasRecording.fps}),i.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},i.canvasResolutionScale=this._canvasResolutionScale,i.canvasMasking={configured:()=>{var e;return Ct(null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn)},regionsFn:e=>{var t;const i=null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn;if(Ct(i))try{var s;return null!==(s=i(e))&&void 0!==s?s:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,hc.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(i.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this._masking.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this._masking.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this._masking.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,hc.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();const c=fc();if(!c)return void hc.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new ka(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;hc.info(i,{node:t}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});const u=this._gatherRRWebPlugins();if(this._stopRrweb=c(ct({emit:e=>{this.onRRwebEmit(e)},plugins:u,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,hc.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},i)),!this._stopRrweb)return this._rrwebError=!0,void hc.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==n?void 0:n.captureJsonLd)&&s&&(null==e?void 0:e.MutationObserver)&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,i){const s=new WeakMap,n=i.getCaptureState||(()=>!0);let r=ql;const o=function(e,t){const i=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?zl:i=>{const s=e.getElementById(i);return!!s&&"SCRIPT"!==s.nodeName&&(!t.isRecordedElement||t.isRecordedElement(s))&&!lc(s,t.blockClass,t.blockSelector)}}(e,i),a=t=>{try{const a=n();if(!r||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return lc(e,t.blockClass,t.blockSelector)||lc(e,t.maskTextClass,t.maskTextSelector)}(t,i))return;const l=function(e,t=zl,i){if(!e||e.length>ql)return null;try{const s=JSON.parse(e),n={maskUrl:i,remainingNodes:2048,exceeded:!1},r=kt(s)?s.map(e=>rc(e,t,n)):rc(s,t,n);if(n.exceeded||Pt(r)||kt(r)&&(!r.length||r.some(Pt)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(e){return null}}(t.text,o,i.maskUrl);if(!l)return void s.delete(t);const[c,u]=l;if(Pt(a))return void s.set(t,u);if(s.get(t)!==u){if(u.length>r)return void(r=0);i.emit(c)&&(s.set(t,u),r-=u.length)}}catch(e){return}};try{const i=new t(e=>{try{if(!r||!1===n())return;const t=e=>{for(const t of cc(e))a(t)};for(const i of e)if("childList"===i.type)oc(i.target)&&a(i.target),i.addedNodes.forEach(t);else if("characterData"===i.type){const e=i.target.parentNode;e&&oc(e)&&a(e)}else"attributes"===i.type&&oc(i.target)&&a(i.target)}catch(e){return}});return i.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t=!1){r&&!1!==n()&&cc(e.documentElement).forEach(e=>{t&&s.delete(e),a(e)})},stop(){return i.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(s,e.MutationObserver,{maskUrl:e=>this._maskReplayUrl(e),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:e=>c.mirror.getId(e)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=At(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:u.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}};const Bc=["type"];var qc=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}({}),Hc=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}({}),Wc=function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e}({}),zc=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),Uc=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),jc=function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e}({}),Vc=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}({});function Gc(e,t){return-1!==e.indexOf(t)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Qc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Kc={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Zc={};function Jc(e){if(Zc[e])return Zc[e];const t=function(e){var t,i;const s=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(i=t.__symbol__)||void 0===i?void 0:i.call(t,e);return s&&globalThis[s]?globalThis[s]:void 0}(e)||globalThis[e],i=t.prototype,s=e in Qc?Qc[e]:void 0,n=Boolean(s&&s.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(i,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),r=e in Kc?Kc[e]:void 0,o=Boolean(r&&r.every(e=>{var t;return"function"==typeof i[e]&&(null===(t=i[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(n&&o)return Zc[e]=t.prototype,t.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const s=a.contentWindow;if(!s)return t.prototype;const n=s[e].prototype;return n?(function(e){return Gc(e,"AppleWebKit")&&!Gc(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Zc[e]=n):i}catch(e){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Xc=Object.create(null);function Yc(e,t,i){var s;const n=Xc[e],r=n[i];if(r)return r.call(t);const o=Jc(e),a=null===(s=Object.getOwnPropertyDescriptor(o,i))||void 0===s?void 0:s.get;return a?(n[i]=a,a.call(t)):t[i]}Xc.Node=Object.create(null),Xc.ShadowRoot=Object.create(null),Xc.MutationObserver=Object.create(null),Xc.Element=Object.create(null);var eu,tu={};function iu(e,t,i){const s=`${e}.${String(i)}`;if(tu[s])return tu[s].bind(t);const n=Jc(e)[i];return"function"!=typeof n?t[i]:(tu[s]=n,n.bind(t))}function su(){return Jc("MutationObserver").constructor}function nu(e,t,i){try{if(!(t in e))return()=>{};const s=e[t],n={next:s},r=i(function(...e){return n.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let s=e[t],o=i(s);for(;o;){if(o.next===r)return void(o.next=n.next);s=o.next,o=i(s)}}}catch(e){return()=>{}}}var ru={childNodes:e=>Yc("Node",e,"childNodes"),parentNode:e=>Yc("Node",e,"parentNode"),parentElement:e=>Yc("Node",e,"parentElement"),textContent:e=>Yc("Node",e,"textContent"),isConnected(e){if(void 0===eu){var t;const e=null===(t=Object.getOwnPropertyDescriptor(Jc("Node"),"isConnected"))||void 0===t?void 0:t.get;eu=(null==e?void 0:e.toString().includes("[native code]"))?e:null}return null==eu?void 0:eu.call(e)},contains:(e,t)=>iu("Node",e,"contains")(t),getRootNode:e=>iu("Node",e,"getRootNode")(),host:e=>e&&"host"in e?Yc("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?Yc("Element",e,"shadowRoot"):null,querySelector:(e,t)=>iu("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>iu("Element",e,"querySelectorAll")(t),mutationObserver:su,patch:nu};function ou(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var au=0;function lu(){au+=1}function cu(){return au}function uu(e,t){return(t!==au||e>6e4)&&!0}var du=0,hu=0,pu=0,_u={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gu=null,fu=null,vu=[],mu=0,yu=0,bu={slowestBatchMs:0},Su={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function wu(e){(du+=1)>1||(_u={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},vu=[],mu=0,fu=(e=>e&&e>0?e:null)(e),hu=ou(),pu=au)}function ku(){return 0===du?gu||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(du-=1)>0?_u:(_u.durationMs=ou()-hu,_u.deferredStylesheetCount=mu,Su.deferredCount+=mu,fu=null,uu(_u.durationMs,pu)?_u:gu=_u)}function Cu(e,t,i){let s=e.length;if(i>=32)return s;for(let n=0;e.length>n;n++){const r=e[n];try{const e=r.cssRules;if(e&&e.length)s+=Cu(e,t,i+1);else if(t&&r.styleSheet){const e=r.styleSheet;if(!t.has(e)){t.add(e);const n=e.rules||e.cssRules;n&&(s+=Cu(n,t,i+1))}}}catch(e){}}return s}function xu(e){if(0===du)return;const t=Cu(e,null,0);_u.cssRuleCount+=t,yu>0&&(_u.nonDeferrableCssRuleCount+=t)}function Iu(e){yu+=1;try{return e()}finally{yu-=1}}function Eu(e){du>0&&(_u.stylesheetMs+=e)}function Tu(e){if(0===du||null===fu)return!1;const t=_u.cssRuleCount-_u.nonDeferrableCssRuleCount;return t>=fu||t+function(e){try{const t=e&&(e.rules||e.cssRules);if(!t)return 0;const i=new WeakSet;return i.add(e),Cu(t,i,0)}catch(e){return 0}}(e)>fu}function Mu(){const e=vu;return vu=[],e}function Pu(){Su.failedCount+=1}function Fu(e){e>0&&(Su.abandonedCount+=e)}function Ru(e){return Ru="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ru(e)}function Lu(e,t,i){return(t=function(e){var t=function(e){if("object"!=Ru(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=Ru(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ru(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Au(e){return e.nodeType===e.ELEMENT_NODE}function Ou(e){const t=e&&"host"in e&&"mode"in e&&ru.host(e)||null;return Boolean(t&&"shadowRoot"in t&&ru.shadowRoot(t)===e)}function $u(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Du(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Nu(e){const{cssText:t}=e;if(3>t.split('"').length)return t;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var Bu=0;function qu(e){const t=0===Bu,i=t?ou():0;Bu+=1;try{const t=e.rules||e.cssRules;if(!t)return null;xu(t);let i=e.href;return!i&&e.ownerNode&&(i=e.ownerNode.baseURI),Du(Array.from(t,e=>Hu(e,i)).join(""))}catch(e){return null}finally{Bu-=1,t&&Eu(ou()-i)}}function Hu(e,t){if(zu(e)){let t;try{t=qu(e.styleSheet)||Nu(e)}catch(i){t=e.cssText}try{var i;if(t&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return rd(t,e.styleSheet.href)}catch(e){}return t}{let i=e.cssText;return Uu(e)&&e.selectorText.includes(":")&&(i=Wu(i)),t?rd(i,t):i}}function Wu(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function zu(e){return"styleSheet"in e}function Uu(e){return"selectorText"in e}var ju=/^-?[A-Za-z_][\w-]*$/,Vu=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Gu(e){const t=[];let i=!1,s=null;const n=new Map;function r(e){const n=t.pop();if("group"===n.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void r(null)}const i=t[t.length-1];return i.parts.push(e),void(i.index+=1)}if(!n.importRule)return i=!0,void(s=e);o(t[t.length-1],n.importRule,e)}function o(e,t,i){try{let n;try{n=i||Nu(t)}catch(e){n=t.cssText}try{var s;n&&(null===(s=t.styleSheet)||void 0===s?void 0:s.href)&&(n=rd(n,t.styleSheet.href))}catch(e){}n&&e.parts.push(n),e.index+=1}catch(e){r(null)}}function a(e){const i=e.rules[e.index];if("sheet"===e.kind&&zu(i)){const s=n.get(i);return null===s?(e.parts.push(i.cssText),void(e.index+=1)):s?void t.push({kind:"sheet",sheet:s.sheet,rules:s.rules,sheetHref:s.sheetHref,index:0,parts:[],importRule:i}):void o(e,i,null)}if(function(e,i){try{const s=function(e){const t=e;if(!t.cssRules||0===t.cssRules.length)return null;if(t.media&&"string"==typeof t.media.mediaText)return`@media ${t.media.mediaText} {`;if(Uu(e)){if("number"==typeof t.type&&1!==t.type)return null;const i=t.style?t.style.cssText:"";return`${e.selectorText} {${i?" "+i:""}`}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!ju.test(t.containerName)?null:`@container ${t.containerName?`${t.containerName} `:""}${t.containerQuery} {`;if("string"==typeof t.conditionText){let s="";try{var i;s=(null===(i=e.constructor)||void 0===i?void 0:i.name)||""}catch(e){return null}return""===s||"Object"===s||"CSSSupportsRule"===s?`@supports ${t.conditionText} {`:null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?ju.test(t.name)?`@keyframes ${t.name} {`:null:""===t.name?"@layer {":Vu.test(t.name)?`@layer ${t.name} {`:null:null}(e);if(null===s)return!1;const n=i.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:n,index:0,parts:[],prelude:n?rd(s,n):s,fixColons:"sheet"===i.kind&&Uu(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(i,e))return;let s=i.cssText;"sheet"===e.kind&&Uu(i)&&i.selectorText.includes(":")&&(s=Wu(s)),e.parts.push(e.sheetHref?rd(s,e.sheetHref):s),e.index+=1}return function(e){try{const i=e.rules||e.cssRules;if(!i)return!1;xu(i);let s=e.href;!s&&e.ownerNode&&(s=e.ownerNode.baseURI);const r=Array.from(i);return t.push({kind:"sheet",sheet:e,rules:r,sheetHref:s,index:0,parts:[],importRule:null}),function(e,t){const i=[{sheet:t,rules:e,index:0}];for(;i.length>0;){const e=i[i.length-1];if(e.index>=e.rules.length){i.pop();continue}const t=e.rules[e.index];if(e.index+=1,!zu(t)||n.has(t))continue;let s=null;try{s=t.styleSheet}catch(e){n.set(t,null);continue}if(s&&!i.some(e=>e.sheet===s))try{const e=s.rules||s.cssRules;if(!e)continue;xu(e);let r=s.href;!r&&s.ownerNode&&(r=s.ownerNode.baseURI);const o=Array.from(e);n.set(t,{sheet:s,rules:o,sheetHref:r}),i.push({sheet:s,rules:o,index:0})}catch(e){}}}(r,e),!0}catch(e){return!1}}(e)||(i=!0),{advance(e){if(i)return!0;const n=ou();let o=e>0?e:1;try{for(;!i&&o>0;){const e=t[t.length-1];if(e.index>=e.rules.length){let t=null;try{if("group"===e.kind){const i=e.prelude+e.parts.join("")+"}";t=e.fixColons?Wu(i):i}else t=Du(e.parts.join(""))}catch(e){}r(t);continue}o-=1;try{a(e)}catch(e){r(null)}}}catch(e){i=!0,s=null}finally{Eu(ou()-n)}return i},text:()=>i?s:null,remainingRules(){if(i)return 0;let e=0;for(const i of t)e+=i.rules.length-i.index;return e}}}var Qu=class{constructor(){Lu(this,"idNodeMap",new Map),Lu(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&null!==(t=null===(i=this.getMeta(e))||void 0===i?void 0:i.id)&&void 0!==t?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),Au(e)){const t=ru.shadowRoot(e);t&&this.removeNodeFromMap(t),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Ku({element:e,maskInputOptions:t,tagName:i,type:s,value:n,maskInputFn:r}){let o=n||"";const a=s&&Zu(s);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function Zu(e){return e.toLowerCase()}var Ju=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function Xu({element:e,name:t,value:i,maskAllElementAttributes:s,maskAttributeFn:n,isGenerated:r=!1}){return i?s?r&&Ju.has(Zu(t))?i:"*".repeat(i.length):n?n(t,i,e):i:i}var Yu="__rrweb_original__";function ed(e){try{const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Zu(t):null}catch(e){return null}}var td=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,id=/^(?:[a-z+]+:)?\/\//i,sd=/^www\..*/i,nd=/^(data:)([^,]*),(.*)/i;function rd(e,t){return(e||"").replace(td,(e,i,s,n,r,o)=>{const a=s||r||o,l=i||n||"";if(!a)return e;if(id.test(a)||sd.test(a))return`url(${l}${a}${l})`;if(nd.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}var od,ad,ld=new Map,cd=1,ud=new RegExp("[^a-z0-9-_:]");function dd(){return cd++}var hd=/^[^ \t\n\r\u000c]+/,pd=/^[, \t\n\r\u000c]+/,_d=new WeakMap;function gd(e,t){return t&&""!==t.trim()?fd(e,t):t}function fd(e,t){let i=_d.get(e);if(i||(i=e.createElement("a"),_d.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function vd(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":e}(e,t.maxBase64ImageLength):e}function md(e,t,i,s,n,r){if(!s)return s;if("src"===i||"href"===i&&("use"!==t||"#"!==s[0])){if("link"===t&&n){var o;const e=null===(o=n.sheet)||void 0===o?void 0:o.href;if(e)return e}const i=gd(e,s);if(i.startsWith("data:")){if("img"===t&&n){let e=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(e=function(e,t,i,s){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;const n=ld.get(t);if(n&&n.type===i&&n.quality===s)return n.result;try{const n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;const r=n.getContext("2d");if(!r)return t;r.drawImage(e,0,0);const o=n.toDataURL(i||"image/webp",null!=s?s:.4),a=t.length>o.length?o:t;if(ld.size>=10){const e=ld.keys().next().value;void 0!==e&&ld.delete(e)}return ld.set(t,{type:i,quality:s,result:a}),a}catch(e){return t}}(n,i,r.type,r.quality)),vd(e,r)}if("image"===t)return vd(i,r)}return i}if("xlink:href"===i&&"#"!==s[0]){const i=gd(e,s);return"image"===t&&i.startsWith("data:")?vd(i,r):i}return"background"!==i||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===i?function(e,t){if(""===t.trim())return t;let i=0;function s(e){let s;const n=e.exec(t.substring(i));return n?(s=n[0],i+=s.length,s):""}const n=[];for(;s(pd),t.length>i;){let r=s(hd);if(","===r.slice(-1))r=gd(e,r.substring(0,r.length-1)),n.push(r);else{let s="";r=gd(e,r);let o=!1;for(;;){const e=t.charAt(i);if(""===e){n.push((r+s).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){i+=1,n.push((r+s).trim());break}"("===e&&(o=!0)}s+=e,i+=1}}}return n.join(", ")}(e,s):"style"===i?rd(s,fd(e)):"object"===t&&"data"===i?gd(e,s):s:gd(e,s)}function yd(e,t,i){return("video"===e||"audio"===e)&&"autoplay"===Zu(t)}function bd(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&bd(ru.parentNode(e),t,i);for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!i&&bd(ru.parentNode(e),t,i)}function Sd(e,t,i,s){let n;if(Au(e)){if(n=e,!ru.childNodes(n).length)return!1}else{if(null===ru.parentElement(e))return!1;n=ru.parentElement(e)}try{if("string"==typeof t){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(bd(n,t,s))return!0;if(i)if(s){if(n.closest(i))return!0}else if(n.matches(i))return!0}catch(e){}return!1}function wd(e,t,i){const s=e.removeEventListener;"function"==typeof s&&s.call(e,t,i)}var kd=new Map;function Cd(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function xd(e){return null==e?"":e.toLowerCase()}var Id=!1,Ed=!1;function Td(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p=!1,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f={},inlineImages:v=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:E=!1,depth:T=0,maxDepth:M=50}=t;let{needsMask:P}=t,{preserveWhiteSpace:F=!0}=t;if(T>=M)return Ed=!0,Id||(Id=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=Sd(e,o,a,void 0===P)),du>0&&(_u.nodeCount+=1);const R=function(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,maskAllElementAttributes:d=!1,maskAttributeFn:h,dataURLOptions:p={},inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const i=t.getId(e);return 1===i?void 0:i}(i,s);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Vc.Document,childNodes:[],compatMode:e.compatMode}:{type:Vc.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Vc.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:i,blockClass:s,blockSelector:n,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,canvasMaskingConfigured:p,keepIframeSrcFn:_,newlyAddedElement:g=!1,rootId:f}=t,v=function(e,t,i){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(i)return e.matches(i)}catch(e){}return!1}(e,s,n),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Zu(e.tagName);return ud.test(t)?"div":t}(e),y=new Set;let b={};const S=e.attributes.length;for(let t=0;S>t;t++){const s=e.attributes[t];yd(m,s.name)||(b[s.name]=md(i,m,Zu(s.name),s.value,e,u))}if("link"===m&&r&&!v){let t=e.sheet;if(!t){const s=function(e){return e.href}(e);s&&(t=Cd(i,s),!t&&s.includes(".css"))&&(t=Cd(i,window.location.origin+"/"+s.replace(window.location.href,"")))}let s=null;t&&(Tu(t)?du>0&&(vu.push(e),mu+=1):s=qu(t)),s&&(delete b.rel,delete b.href,b._cssText=s)}if("style"===m&&e.sheet&&!(e.innerText||ru.textContent(e)||"").trim().length){const t=Iu(()=>qu(e.sheet));t&&(b._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,i=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&t?b.value=Ku({element:e,type:ed(e),tagName:m,value:t,maskInputOptions:o,maskInputFn:a}):i&&(b.checked=i)}if("option"===m&&(e.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===m&&e.open){try{b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}y.add("rr_open_mode")}if("canvas"===m&&h&&!(null==p?void 0:p()))if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;e.width>i;i+=50)for(let s=0;e.height>s;s+=50){const n=t.getImageData;if(new Uint32Array((Yu in n?n[Yu]:n).call(t,i,s,Math.min(50,e.width-i),Math.min(50,e.height-s)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),s=i.createElement("canvas");s.width=e.width,s.height=e.height,t!==s.toDataURL(u.type,u.quality)&&(b.rr_dataURL=t)}let w,k=!1;if("img"===m&&d){od||(od=i.createElement("canvas"),ad=od.getContext("2d"));const t=e,s=t.currentSrc||t.getAttribute("src")||"<unknown-src>",n=t.crossOrigin,r=(t,i)=>k?Xu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c}):i,o=()=>{wd(t,"load",o);try{od.width=t.naturalWidth,od.height=t.naturalHeight,ad.drawImage(t,0,0);const e=od.toDataURL(u.type,u.quality);b.rr_dataURL=r("rr_dataURL",e)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${s}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(n?b.crossOrigin=r("crossOrigin",n):t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=b;t.rr_mediaState=e.paused?"paused":"played",y.add("rr_mediaState"),t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(g||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),v){var C,x,I;const{width:t,height:s,left:n,top:r}=e.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(e);b={class:b.class,rr_width:`${t}px`,rr_height:`${s}px`,rr_left:`${Math.floor(n+((null===(x=i.defaultView)||void 0===x?void 0:x.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(I=i.defaultView)||void 0===I?void 0:I.scrollY)||0))}px`},y.add("rr_width"),y.add("rr_height"),y.add("rr_left"),y.add("rr_top"),o&&(b.rr_position=o.position||"static",y.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,y.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,y.add("rr_display")))}if("iframe"!==m||_(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src),l||c)for(const[t,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[t]=Xu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c,isGenerated:y.has(t)}));k=!0;try{customElements.get(m)&&(w=!0)}catch(e){}return{type:Vc.Element,tagName:m,attributes:b,childNodes:[],isSVG:(E=e,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:v,rootId:f,isCustom:w};var E}(e,{doc:i,blockClass:n,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,maskAllElementAttributes:d,maskAttributeFn:h,dataURLOptions:p,inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:i,maskTextFn:s,rootId:n}=t,r=ru.parentNode(e),o=r&&r.tagName;let a=ru.textContent(e);const l="STYLE"===o||void 0,c="SCRIPT"===o||void 0;if(l&&a){try{var u;if(e.nextSibling||e.previousSibling);else if(Tu(r.sheet));else if(null===(u=r.sheet)||void 0===u?void 0:u.cssRules){const e=qu(r.sheet);e&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(e)&&(a=e)}}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}a=rd(a,fd(t.doc))}return c&&(a="SCRIPT_PLACEHOLDER"),!l&&!c&&a&&i&&(a=s?s(a,ru.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Vc.Text,textContent:a||"",isStyle:l,rootId:n}}(e,{doc:i,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:Vc.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Vc.Comment,textContent:ru.textContent(e)||"",rootId:y};default:return!1}}(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:I,newlyAddedElement:E});if(!R)return console.warn(e,"not serialized"),null;let L;L=s.hasNode(e)?s.getId(e):function(e,t){if(t.comment&&e.type===Vc.Comment)return!0;if(e.type===Vc.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e){var t;let i;try{i=new URL(e,window.location.href)}catch(e){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==s?void 0:s[1])&&void 0!==t?t:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(xd(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===xd(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(xd(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&xd(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(xd(e.attributes.property).match(/^(og|twitter|fb):/)||xd(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===xd(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(xd(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(xd(e.attributes.name))||xd(e.attributes.property).match(/^article:/)||xd(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(xd(e.attributes.name)))return!0}}return!1}(R,g)||!F&&R.type===Vc.Text&&!R.isStyle&&!R.textContent.replace(/^\s+|\s+$/gm,"").length?-2:dd();const A=Object.assign(R,{id:L});if(s.add(e,A),-2===L)return null;b&&b(e);let O=!l;if(A.type===Vc.Element){O=O&&!A.needBlock,delete A.needBlock;const t=ru.shadowRoot(e);t&&$u(t)&&(A.isShadowHost=!0)}if((A.type===Vc.Document||A.type===Vc.Element)&&O){g.headWhitespace&&A.type===Vc.Element&&"head"===A.tagName&&(F=!1);const t={doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:F,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:I,depth:T+1,maxDepth:M};if(A.type===Vc.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else for(const i of Array.from(ru.childNodes(e))){const e=Td(i,t);e&&A.childNodes.push(e)}let E=null;if(Au(e)&&(E=ru.shadowRoot(e)))for(const e of Array.from(ru.childNodes(E))){const i=Td(e,t);i&&($u(E)&&(i.isShadow=!0),A.childNodes.push(i))}}const D=ru.parentNode(e);if(D&&Ou(D)&&$u(D)&&(A.isShadow=!0),A.type===Vc.Element&&"iframe"===A.tagName){const t=function(e,t,i){const s=()=>{},n=e.contentWindow;if(!n)return s;let r;try{r=n.document.readyState}catch(e){return s}const o=()=>t();if("complete"!==r){let s=!1,n=null;const r=()=>{s||(s=!0,null!==n&&(clearTimeout(n),n=null),wd(e,"load",a),e.addEventListener("load",o),t())},a=()=>r();return n=setTimeout(r,i),e.addEventListener("load",a),()=>{null!==n&&(clearTimeout(n),n=null),s?wd(e,"load",o):(s=!0,wd(e,"load",a))}}const a="about:blank";let l;try{l=n.location.href}catch(e){return s}if(l!==a||e.src===a||""===e.src){const i=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(i),wd(e,"load",o)}}return e.addEventListener("load",o),()=>{wd(e,"load",o)}}(e,()=>{const t=e.contentDocument;if(t&&S){const i=Td(t,{doc:t,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:F,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:I,depth:T+1,maxDepth:M});i&&S(e,i)}},w);null==k||k(e,t)}return A.type===Vc.Element&&"link"===A.tagName&&"stylesheet"===A.attributes.rel&&function(t,l,k){if(kd.has(t))return;let E;try{E=t.sheet}catch(e){return}if(E)return;const R=new AbortController;let L=!1;const A=()=>{if(!L){L=!0;try{(()=>{if(C){const t=Td(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:F,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:I,depth:T,maxDepth:M});t&&C(e,t)}})()}finally{kd.delete(t),R.abort()}}},O=setTimeout(A,k);R.signal.addEventListener("abort",()=>clearTimeout(O),{once:!0}),t.addEventListener("load",A,{signal:R.signal,once:!0}),kd.set(t,R)}(e,0,x),A}function Md(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}var Pd=class e{constructor(...e){Lu(this,"parentElement",null),Lu(this,"parentNode",null),Lu(this,"ownerDocument",void 0),Lu(this,"firstChild",null),Lu(this,"lastChild",null),Lu(this,"previousSibling",null),Lu(this,"nextSibling",null),Lu(this,"ELEMENT_NODE",1),Lu(this,"TEXT_NODE",3),Lu(this,"nodeType",void 0),Lu(this,"nodeName",void 0),Lu(this,"RRNodeType",void 0)}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Fd(e,t,i=document){const s={capture:!0,passive:!0};return i.addEventListener(e,t,s),()=>Rd(i,e,t,s)}function Rd(e,t,i,s){Ld(()=>{const n=e.removeEventListener;"function"==typeof n&&(void 0!==s?n.call(e,t,i,s):n.call(e,t,i))})}function Ld(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function Ad(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var Od="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",$d={map:{},getId(){return console.warn(Od),-1},getNode(){return console.warn(Od),null},removeNodeFromMap(){console.warn(Od)},has(){return console.warn(Od),!1},reset(){console.warn(Od)}};function Dd(e,t,i={}){let s=null,n=0;return function(...r){const o=Date.now();n||!1!==i.leading||(n=o);const a=t-(o-n),l=this;0>=a||a>t?(s&&(clearTimeout(s),s=null),n=o,e.apply(l,r)):s||!1===i.trailing||(s=setTimeout(()=>{n=!1===i.leading?0:Date.now(),s=null,e.apply(l,r)},a))}}function Nd(e,t,i,s,n=window){const r=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,s?i:{set(e){if(setTimeout(()=>{try{i.set.call(this,e)}catch(e){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(e){return}r.set.call(this,e)}}}),()=>Nd(e,t,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&($d=new Proxy($d,{get(e,t,i){return"map"===t&&console.warn(Od),Reflect.get(e,t,i)}}));var Bd=Date.now;function qd(e){var t,i,s,n;const r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(t=ru.parentElement(r.body))||void 0===t?void 0:t.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(s=ru.parentElement(r.body))||void 0===s?void 0:s.scrollTop)||(null==r||null===(n=r.body)||void 0===n?void 0:n.scrollTop)||0}}function Hd(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Wd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function zd(e){return e?e.nodeType===e.ELEMENT_NODE?e:ru.parentElement(e):null}function Ud(e,t,i,s){if(!e)return!1;const n=zd(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(s&&null!==n.closest("."+t))return!0}else if(bd(n,t,s))return!0}catch(e){}if(i){if(n.matches(i))return!0;if(s&&null!==n.closest(i))return!0}return!1}function jd(e,t,i){return!("TITLE"!==e.tagName||!i.headTitleMutations)||-2===t.getId(e)}function Vd(e,t){if(Ou(e))return!1;const i=t.getId(e);if(!t.has(i))return!0;const s=ru.parentNode(e);return(!s||s.nodeType!==e.DOCUMENT_NODE)&&(!s||Vd(s,t))}function Gd(e){return Boolean(e.changedTouches)}function Qd(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Kd(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Zd(e){return!!e&&(e instanceof Pd&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(ru.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Bd=()=>(new Date).getTime());var Jd=class{constructor(){Lu(this,"id",1),Lu(this,"styleIDMap",new WeakMap),Lu(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return i=void 0===t?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Xd(e){var t;let i=null;return"getRootNode"in e&&(null===(t=ru.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ru.host(ru.getRootNode(e))&&(i=ru.host(ru.getRootNode(e))),i}function Yd(e){const t=e.ownerDocument;if(!t)return!1;if(ru.contains(t,e))return!0;const i=ru.isConnected(e);return"boolean"==typeof i?i:function(e){const t=e.ownerDocument;if(!t)return!1;const i=function(e){let t,i=e;for(;t=Xd(i);)i=t;return i}(e);return ru.contains(t,i)}(e)}function eh(e){return"__ln"in e}var th,ih=class{constructor(){Lu(this,"length",0),Lu(this,"head",null),Lu(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;e>i;i++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&eh(e.previousSibling)){const i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&eh(e.nextSibling)&&e.nextSibling.__ln.previous){const i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},sh=(e,t)=>`${e}@${t}`,nh=class{constructor(){Lu(this,"frozen",!1),Lu(this,"locked",!1),Lu(this,"texts",[]),Lu(this,"attributes",[]),Lu(this,"attributeMap",new WeakMap),Lu(this,"generatedAttributes",new WeakMap),Lu(this,"removes",[]),Lu(this,"mapRemoves",new Set),Lu(this,"movedMap",{}),Lu(this,"addedSet",new Set),Lu(this,"movedSet",new Set),Lu(this,"droppedSet",new Set),Lu(this,"removesSubTreeCache",new Set),Lu(this,"mutationCb",void 0),Lu(this,"blockClass",void 0),Lu(this,"blockSelector",void 0),Lu(this,"maskTextClass",void 0),Lu(this,"maskTextSelector",void 0),Lu(this,"inlineStylesheet",void 0),Lu(this,"maskInputOptions",void 0),Lu(this,"maskTextFn",void 0),Lu(this,"maskInputFn",void 0),Lu(this,"maskAllElementAttributes",void 0),Lu(this,"maskAttributeFn",void 0),Lu(this,"keepIframeSrcFn",void 0),Lu(this,"recordCanvas",void 0),Lu(this,"canvasMaskingConfigured",void 0),Lu(this,"inlineImages",void 0),Lu(this,"slimDOMOptions",void 0),Lu(this,"dataURLOptions",void 0),Lu(this,"doc",void 0),Lu(this,"mirror",void 0),Lu(this,"iframeManager",void 0),Lu(this,"stylesheetManager",void 0),Lu(this,"shadowDomManager",void 0),Lu(this,"canvasManager",void 0),Lu(this,"processedNodeManager",void 0),Lu(this,"unattachedDoc",void 0),Lu(this,"canvasManagerReleased",!1),Lu(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Lu(this,"emit",()=>{if(this.frozen||this.locked)return;const e=ou(),t=cu();try{this.processBufferedMutations()}finally{i=ou()-e,s=t,du>0||uu(i,null!=s?s:au)||i>bu.slowestBatchMs&&(bu.slowestBatchMs=i)}var i,s}),Lu(this,"processBufferedMutations",()=>{const e=[],t=new Set,i=new ih,s=e=>{let t=e,i=-2;for(;-2===i;)t=t&&t.nextSibling,i=t&&this.mirror.getId(t);return i};let n;const r=r=>{var o;const a=ru.parentNode(r);if(!a||!Yd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=Ou(a)?this.mirror.getId(Xd(r)):this.mirror.getId(a),c=s(r);if(-1===l||-1===c)return i.addNode(r);null!==(o=n)&&void 0!==o||(n={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{Qd(e,this.mirror)&&this.iframeManager.addIframe(e),Kd(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Zd(e)&&!Ud(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(ru.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});const u=Td(r,n);u&&(e.push({parentId:l,nextId:c,node:u}),t.add(u.id))};for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e);for(const e of this.movedSet)oh(this.removesSubTreeCache,e)&&!this.movedSet.has(ru.parentNode(e))||r(e);for(const e of this.addedSet)ah(this.droppedSet,e)||oh(this.removesSubTreeCache,e)?ah(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let o=null;for(;i.length;){let e=null;if(o){const t=this.mirror.getId(ru.parentNode(o.value)),i=s(o.value);-1!==t&&-1!==i&&(e=o)}if(!e){let t=i.tail;for(;t;){const i=t;if(t=t.previous,i){const t=this.mirror.getId(ru.parentNode(i.value));if(-1===s(i.value))continue;if(-1!==t){e=i;break}{const t=ru.parentNode(i.value);if(t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const s=ru.host(t);if(-1!==this.mirror.getId(s)){e=i;break}}}}}}if(!e){for(;i.head;)i.removeNode(i.head.value);break}o=e.previous,i.removeNode(e.value),r(e.value)}const a={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const t=e.node,i=ru.parentNode(t);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const{attributes:t}=e;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){const i=JSON.stringify(e.styleDiff),s=JSON.stringify(e._unchangedStyles);t.style.length>i.length&&(i+s).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[s,n]of Object.entries(t))if("string"==typeof n||null===n){var i;t[s]=Xu({element:e.node,name:s,value:n,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(e.node))||void 0===i?void 0:i.has(s)})}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),Lu(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),Lu(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const i=Array.from(ru.childNodes(e),e=>ru.textContent(e)||"").join("");t.attributes.value=Ku({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:ed(e),value:i,maskInputFn:this.maskInputFn})}),Lu(this,"processMutation",e=>{if(!jd(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=ru.textContent(e.target);Ud(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Sd(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,zd(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{var t;const s=e.target,n=Zu(s.tagName),r=e.attributeName,o=null!==(t=e.attributeNamespace)&&void 0!==t?t:null;let a=function(e,t,i){if(!i)return t;const s=e.getAttributeNodeNS(i,t);if(s)return s.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${t}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${t}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===t?t:`xmlns:${t}`;const n=e.lookupPrefix(i);return n?`${n}:${t}`:t}(s,r,o),l=o?s.getAttributeNS(o,r):e.target.getAttribute(r);if("value"===a){const e=s,t=ed(e);l=Ku({element:e,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:t,value:l,maskInputFn:this.maskInputFn})}if(Ud(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;let c=this.attributeMap.get(e.target);const u="iframe"===n&&"src"===a;if(u&&!this.keepIframeSrcFn(l)&&s.contentDocument)return;if("type"===a&&"input"===n&&"password"===(e.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!yd(n,a)){var i;c||(c={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(c),this.attributeMap.set(e.target,c));const t=md(this.doc,n,Zu(a),l,s,this.dataURLOptions);if(u&&!this.keepIframeSrcFn(l)&&(a="rr_src"),c.attributes[a]=t,null===(i=this.generatedAttributes.get(e.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const t=this.unattachedDoc.createElement("span"),i=s.style;e.oldValue&&(t.style.cssText=e.oldValue);for(const e of Array.from(i)){const s=i.getPropertyValue(e),n=i.getPropertyPriority(e);s!==t.style.getPropertyValue(e)||n!==t.style.getPropertyPriority(e)?c.styleDiff[e]=""===n?s:[s,n]:c._unchangedStyles[e]=[s,n]}for(const e of Array.from(t.style))""===i.getPropertyValue(e)&&(c.styleDiff[e]=!1)}else if("open"===a&&"dialog"===n){c.attributes.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal";let t=this.generatedAttributes.get(e.target);t||(t=new Set,this.generatedAttributes.set(e.target,t)),t.add("rr_open_mode")}}break}case"childList":if(Ud(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const i=this.mirror.getId(t),s=Ou(e.target)?this.mirror.getId(ru.host(e.target)):this.mirror.getId(e.target);Ud(e.target,this.blockClass,this.blockSelector,!1)||jd(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(rh(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===i||Vd(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[sh(i,s)]?rh(this.movedSet,t):(this.removes.push({parentId:s,id:i,isShadow:!(!Ou(e.target)||!$u(e.target))||void 0}),function(e,t){const i=[e];for(;i.length;){const e=i.pop();t.has(e)||(t.add(e),ru.childNodes(e).forEach(e=>i.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),Lu(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(jd(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&-1!==i&&(this.movedMap[sh(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Ud(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;const t=ru.childNodes(e);for(let e=0,i=t.length;i>e;e++){const i=t[e];i&&this.genAdds(i)}if(Zd(e)){const t=ru.childNodes(ru.shadowRoot(e));for(let i=0,s=t.length;s>i;i++){const s=t[i];s&&(this.processedNodeManager.add(s,this),this.genAdds(s,e))}}}}}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){const t=this.blockClass,i=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(i&&(i.lastIndex=0),Ud(e,i||t,this.blockSelector,!0))return!0;const s="getRootNode"in e?ru.getRootNode(e):null;e=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?ru.host(s):null}return!1}};function rh(e,t){const i=[t];for(;i.length;){const t=i.pop();if(e.delete(t),t.nodeType===t.TEXT_NODE)continue;const s=ru.childNodes(t);for(let e=0,t=s.length;t>e;e++){const t=s[e];t&&i.push(t)}}}function oh(e,t,i){return 0!==e.size&&function(e,t){const i=ru.parentNode(t);return!!i&&e.has(i)}(e,t)}function ah(e,t){if(0===e.size)return!1;let i=ru.parentNode(t);for(;i;){if(e.has(i))return!0;i=ru.parentNode(i)}return!1}function lh(e){th=e}function ch(){th=void 0}var uh=(e,t="rrweb")=>th?(...i)=>{try{return e(...i)}catch(e){if(th&&!0===th(e,t))return;throw e}}:e,dh=[];function hh(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function ph(e,t){const i=new nh;let s;i.init(e);try{s=new(su())(uh(i.processMutations.bind(i)));const n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),s.observe(t,n),dh.push(i),{observer:s,buffer:i}}catch(e){try{null==s||s.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function _h({scrollCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){const o=new Map,a=r=>{const a=hh(r);if(!a||Ud(a,s,n,!0))return;const l=i.getId(a);let c,u;if(a===t&&t.defaultView){const e=qd(t.defaultView);c=e.left,u=e.top}else c=a.scrollLeft,u=a.scrollTop;const d=`${c},${u}`;o.get(l)!==d&&(o.set(l,d),e({id:l,x:c,y:u}))},l=[Fd("scroll",uh(Dd(uh(e=>a(e)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(Fd("scrollend",uh(a),t)),()=>l.forEach(e=>e())}function gh(e,t){for(let i=dh.length-1;i>=0;i--){const s=dh[i];if(!s)continue;let n=s.bufferBelongsToIframe(e);!n&&t&&t.has(s.bufferDoc())&&(n=!0),n&&(s.reset(),dh.splice(i,1))}}var fh=["INPUT","TEXTAREA","SELECT"],vh=new WeakMap;function mh(e){return function e(t,i){if(kh("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||kh("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||kh("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||kh("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const s=Array.from(t.parentRule.cssRules).indexOf(t);return i.unshift(s),e(t.parentRule,i)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);i.unshift(e)}return i}(e,[])}function yh(e,t,i){let s,n;return e?(e.ownerNode?s=t.getId(e.ownerNode):n=i.getId(e),{styleId:n,id:s}):{}}function bh({mirror:e,stylesheetManager:t},i){var s,n;let r=null;r=e.getId("#document"===i.nodeName?i:ru.host(i));const o="#document"===i.nodeName?null===(s=i.defaultView)||void 0===s?void 0:s.Document:null===(n=i.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n?void 0:n.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){let i;try{var s;i=null===(s=a.set)||void 0===s?void 0:s.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(e){}return i}}),uh(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Sh=new Set;function wh(e,t={}){const i=e.doc.defaultView;if(!i)return()=>{};let s,n;!function(e,t){const{mutationCb:i,mousemoveCb:s,mouseInteractionCb:n,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:_}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),s(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),_(...e)}}(e,t);const r=[],o=uh(()=>{try{if(n)try{n.destroy(),n.reset()}finally{const e=dh.indexOf(n);-1!==e&&dh.splice(e,1)}e.shadowDomManager.resetForDoc(e.doc),null==s||s.disconnect()}finally{Ad(r)}}),a=(e,t)=>{const i=uh(()=>{try{return t()}catch(t){throw Sh.add(e),t}})();"function"==typeof i&&r.push(i)};try{if(e.recordDOM&&a("mutation",()=>{const t=ph(e,e.doc);s=t.observer,n=t.buffer}),a("move",()=>function({mousemoveCb:e,sampling:t,doc:i,mirror:s}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Dd(uh(t=>{const i=Date.now()-o;e(a.map(e=>(e.timeOffset-=i,e)),t),a=[],o=null}),r),c=uh(Dd(uh(e=>{const t=hh(e),{clientX:i,clientY:n}=Gd(e)?e.changedTouches[0]:e;o||(o=Bd()),a.push({x:i,y:n,id:s.getId(t),timeOffset:Bd()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?Hc.Drag:e instanceof MouseEvent?Hc.MouseMove:Hc.TouchMove)}),n,{trailing:!1})),u=[Fd("mousemove",c,i),Fd("touchmove",c,i),Fd("drag",c,i)];return uh(()=>{u.forEach(e=>e())})}(e)),a("mouseInteraction",()=>function({mouseInteractionCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];let l=null;return Object.keys(Wc).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(r=>{let o=Zu(r);const c=(t=>r=>{const o=hh(r);if(Ud(o,s,n,!0))return;let a=null,c=t;if("pointerType"in r){switch(r.pointerType){case"mouse":a=zc.Mouse;break;case"touch":a=zc.Touch;break;case"pen":a=zc.Pen}a===zc.Touch&&(Wc[t]===Wc.MouseDown?c="TouchStart":Wc[t]===Wc.MouseUp&&(c="TouchEnd"))}else Gd(r)&&(a=zc.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===zc.Touch||c.startsWith("Mouse")&&a===zc.Mouse)&&(a=null)):Wc[t]===Wc.Click&&(a=l,l=null);const u=Gd(r)?r.changedTouches[0]:r;if(!u)return;const d=i.getId(o),{clientX:h,clientY:p}=u;uh(e)(ct({type:Wc[c],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Wc[r]){case Wc.MouseDown:case Wc.MouseUp:o=o.replace("mouse","pointer");break;case Wc.TouchStart:case Wc.TouchEnd:return}a.push(Fd(o,c,t))}),uh(()=>{a.forEach(e=>e())})}(e)),a("scroll",()=>_h(e)),a("viewportResize",()=>function({viewportResizeCb:e},{win:t}){let i=-1,s=-1;return Fd("resize",uh(Dd(uh(()=>{const t=Hd(),n=Wd();i===t&&s===n||(e({width:Number(n),height:Number(t)}),i=t,s=n)}),200)),t)}(e,{win:i})),a("input",()=>function({inputCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(e){let i=hh(e);const c=e.isTrusted,d=t.defaultView;if(i&&d&&!(i instanceof d.HTMLElement))return;const p=i&&i.tagName;if(i&&"OPTION"===p&&(i=ru.parentElement(i)),!i||!p||0>fh.indexOf(p)||Ud(i,s,n,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let _=i.value,g=!1;const f=ed(i)||"";"radio"===f||"checkbox"===f?g=i.checked:(a[p.toLowerCase()]||a[f])&&(_=Ku({element:i,maskInputOptions:a,tagName:p,type:f,value:_,maskInputFn:l})),h(i,u?{text:_,isChecked:g,userTriggered:c}:{text:_,isChecked:g});const v=i.name;"radio"===f&&v&&g&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==i){const t=e.value;h(e,u?{text:t,isChecked:!g,userTriggered:!1}:{text:t,isChecked:!g})}})}function h(t,s){const n=vh.get(t);if(!n||n.text!==s.text||n.isChecked!==s.isChecked){vh.set(t,s);const n=i.getId(t);uh(e)(ct(ct({},s),{},{id:n}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Fd(e,uh(d),t)),_=t.defaultView;if(!_)return()=>{p.forEach(e=>e())};const g=_.Object.getOwnPropertyDescriptor(_.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[_.HTMLInputElement.prototype,"value"],[_.HTMLInputElement.prototype,"checked"],[_.HTMLSelectElement.prototype,"value"],[_.HTMLTextAreaElement.prototype,"value"],[_.HTMLSelectElement.prototype,"selectedIndex"],[_.HTMLOptionElement.prototype,"selected"]].map(e=>Nd(e[0],e[1],{set(){uh(d)({target:this,isTrusted:!1})}},!1,_))),uh(()=>{Ad(p)})}(e)),a("mediaInteraction",()=>function({mediaInteractionCb:e,blockClass:t,blockSelector:i,mirror:s,sampling:n,doc:r}){const o=uh(r=>Dd(uh(n=>{const o=hh(n);if(!o||Ud(o,t,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=o;e({type:r,id:s.getId(o),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}),n.media||500)),a=[Fd("play",o(jc.Play),r),Fd("pause",o(jc.Pause),r),Fd("seeked",o(jc.Seeked),r),Fd("volumechange",o(jc.VolumeChange),r),Fd("ratechange",o(jc.RateChange),r)];return uh(()=>{a.forEach(e=>e())})}(e)),e.recordDOM){const t=function(e){const t=new Map,i=new Set;let s=!0;const n=e=>{if(s)try{e()}catch(e){}},r=e=>{var i;const s=t.get(e);if(s){for(;null===(i=s[0])||void 0===i?void 0:i.ready;){const e=s.shift();(null==e?void 0:e.emit)&&n(e.emit)}0===s.length&&t.delete(e)}};return{queueMutation(e,i){if(!e)return void n(i);const s=t.get(e);s?(s.push({emit:i,ready:!0}),r(e)):n(i)},queuePendingMutation(o,a,l){if(!s)return()=>{};let c=t.get(o);c||(c=[],t.set(o,c));const u={emit:a,ready:!1};c.push(u);let d,h=!1,p=!1;const _=()=>{h||p||(h=!0,void 0!==d&&i.delete(d),u.ready=!0,u.emit=void 0,r(o))};try{d=e.setTimeout(_,5e3),h||p?e.clearTimeout(d):i.add(d)}catch(e){_()}return t=>{!p&&s&&(p=!0,void 0!==d&&(e.clearTimeout(d),i.delete(d)),h?t&&n(l):(u.ready=!0,t||(u.emit=void 0),r(o)))}},reset(){s=!1,i.forEach(t=>e.clearTimeout(t)),i.clear(),t.clear()}}}(i);r.push(t.reset),a("styleSheet",()=>function({styleSheetRuleCb:e,mirror:t,stylesheetManager:i},{win:s,mutationQueue:n}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const r=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:uh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=yh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,adds:[{rule:a,index:l}]})),l},"host")}),s.CSSStyleSheet.prototype.addRule=function(e,t,i=this.cssRules.length){return s.CSSStyleSheet.prototype.insertRule.apply(this,[`${e} { ${t} }`,i])};const o=s.CSSStyleSheet.prototype.deleteRule;let a,l;s.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:uh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=yh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,removes:[{index:a}]})),l},"host")}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:uh((s,r,o)=>{const[a]=o,l=s.apply(r,o);try{const s=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof s)return l;i.onCssomSheetMutation(r);const{id:o,styleId:c}=yh(r,t,i.styleMirror);if(!(o&&-1!==o||c&&-1!==c))return l;const u=n.queuePendingMutation(r,()=>e({id:o,styleId:c,replace:a}),()=>{const t=qu(r);null!==t&&e({id:o,styleId:c,replace:t})});try{s.call(l,()=>u(!0),()=>u(!1))}catch(e){u(!1)}}catch(e){}return l},"host")})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:uh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=yh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,replaceSync:a})),l},"host")}));const c={};Ch("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(Ch("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),Ch("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),Ch("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));const u={};return Object.entries(c).forEach(([s,r])=>{u[s]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(u[s].insertRule,{apply:uh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=yh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...mh(r),l];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,adds:[{rule:a,index:t}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(u[s].deleteRule,{apply:uh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=yh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...mh(r),a];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,removes:[{index:t}]}))}return l},"host")})}),uh(()=>{s.CSSStyleSheet.prototype.insertRule=r,s.CSSStyleSheet.prototype.deleteRule=o,a&&(s.CSSStyleSheet.prototype.replace=a),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:i,mutationQueue:t})),a("adoptedStyleSheet",()=>bh(e,e.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:i,stylesheetManager:s},{win:n,mutationQueue:r}){const o=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:uh((n,o,a)=>{var l;const[c,u,d]=a,h=n.apply(o,a);if(i.has(c))return h;const p=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(p);const{id:_,styleId:g}=yh(p,t,s.styleMirror);if(_&&-1!==_||g&&-1!==g){const t=mh(o.parentRule);r.queueMutation(p,()=>e({id:_,styleId:g,set:{property:c,value:u,priority:d},index:t}))}return h},"host")});const a=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:uh((n,o,a)=>{var l;const[c]=a,u=n.apply(o,a);if(i.has(c))return u;const d=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(d);const{id:h,styleId:p}=yh(d,t,s.styleMirror);if(h&&-1!==h||p&&-1!==p){const t=mh(o.parentRule);r.queueMutation(d,()=>e({id:h,styleId:p,remove:{property:c},index:t}))}return u},"host")}),uh(()=>{n.CSSStyleDeclaration.prototype.setProperty=o,n.CSSStyleDeclaration.prototype.removeProperty=a})}(e,{win:i,mutationQueue:t})),e.collectFonts&&a("font",()=>function({fontCb:e,doc:t}){const i=t.defaultView;if(!i)return()=>{};const s=[],n=new WeakMap,r=i.FontFace;i.FontFace=function(e,t,i){const s=new r(e,t,i);return n.set(s,{family:e,buffer:"string"!=typeof t,descriptors:i,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),s};const o=nu(t.fonts,"add",function(t){return function(i){return setTimeout(uh(()=>{const t=n.get(i);t&&(e(t),n.delete(i))}),0),t.apply(this,[i])}});return s.push(()=>{i.FontFace=r}),s.push(o),uh(()=>{s.forEach(e=>e())})}(e))}a("selection",()=>function(e){const{doc:t,mirror:i,blockClass:s,blockSelector:n,selectionCb:r}=e;let o=!0;const a=uh(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;l>t;t++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:c}=e.getRangeAt(t);Ud(r,s,n,!0)||Ud(l,s,n,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:c})}r({ranges:a})});return a(),Fd("selectionchange",a)}(e)),a("customElement",()=>function({doc:e,customElementCb:t}){const i=e.defaultView;return i&&i.customElements?nu(i.customElements,"define",function(e){return function(i,s,n){try{t({define:{name:i}})}catch(e){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,s,n])}}):()=>{}}(e));for(const t of e.plugins)a(`plugin:${t.name}`,()=>t.observer(t.callback,i,t.options))}catch(e){try{o()}catch(e){}throw e}return o}function kh(e){return void 0!==window[e]}function Ch(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var xh=class{constructor(e){Lu(this,"generateIdFn",void 0),Lu(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Lu(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,s){if(0>t)return t;const n=i||this.getRemoteIdToLocalIdMap(e),r=s||this.getLocalIdToRemoteIdMap(e);let o=n.get(t);return void 0===o&&(o=this.generateIdFn(),n.set(t,o),r.set(o,t)),o}getIds(e,t){const i=this.getRemoteIdToLocalIdMap(e),s=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,i,s))}getRemoteId(e,t,i){var s;return"number"!=typeof t||0>t?t:null!==(s=(i||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==s?s:-1}getRemoteIds(e,t){const i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},Ih=class{constructor(e){Lu(this,"iframes",new WeakMap),Lu(this,"crossOriginIframeMap",new WeakMap),Lu(this,"crossOriginIframeMirror",new xh(dd)),Lu(this,"crossOriginIframeStyleMirror",void 0),Lu(this,"crossOriginIframeRootIdMap",new WeakMap),Lu(this,"mirror",void 0),Lu(this,"mutationCb",void 0),Lu(this,"wrappedEmit",void 0),Lu(this,"loadListener",void 0),Lu(this,"pageHideListener",void 0),Lu(this,"stylesheetManager",void 0),Lu(this,"recordCrossOriginIframes",void 0),Lu(this,"messageHandler",void 0),Lu(this,"nestedIframeListeners",new Map),Lu(this,"attachedWindows",new WeakMap),Lu(this,"attachedDocuments",new WeakMap),Lu(this,"attachedIframes",new Map),Lu(this,"loadListenerDisposers",new WeakMap),Lu(this,"iframeElementsById",new Map),Lu(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new xh(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);const s=this.mirror.getId(e);-1!==s&&this.iframeElementsById.set(s,e)}getIframeElementById(e){var t,i,s;return null!==(t=null!==(i=null===(s=this.attachedIframes.get(e))||void 0===s?void 0:s.element)&&void 0!==i?i:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){const t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>Ld(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){const t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:e,handler:t})=>{Rd(e,"pagehide",t)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){const i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;const s=this.trackIframeContent(e,t);if(e.contentDocument){let t=this.attachedDocuments.get(e);t||(t=new Set,this.attachedDocuments.set(e,t)),t.add(e.contentDocument)}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){const t=this.handleMessage.bind(this);Ld(()=>{n.addEventListener("message",t),this.nestedIframeListeners.set(n,t);let i=this.attachedWindows.get(e);i||(i=new Set,this.attachedWindows.set(e,i)),i.add(n)})}Ld(()=>{const t=e.contentWindow;if(!t)return;let i=this.pageHideHandlers.get(e);if(i)for(const e of i)if(e.win===t)return;const s=()=>{var t;null===(t=this.pageHideListener)||void 0===t||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};t.addEventListener("pagehide",s),i||(i=new Set,this.pageHideHandlers.set(e,i)),i.add({win:t,handler:s})}),null===(i=this.loadListener)||void 0===i||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,t.data.event);s&&this.wrappedEmit(s,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case qc.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:qc.IncrementalSnapshot,data:{source:Hc.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case qc.Meta:case qc.Load:case qc.DomContentLoaded:return!1;case qc.Plugin:return t;case qc.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case qc.IncrementalSnapshot:switch(t.data.source){case Hc.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(t.node,i)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Hc.Drag:case Hc.TouchMove:case Hc.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Hc.ViewportResize:return!1;case Hc.MediaInteraction:case Hc.MouseInteraction:case Hc.Scroll:case Hc.CanvasMutation:case Hc.Input:return this.replaceIds(t.data,e,["id"]),t;case Hc.StyleSheetRule:case Hc.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Hc.Font:return t;case Hc.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Hc.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(i=t.data.styles)||void 0===i||i.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,i,s){for(const n of s)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(i,t[n]):e.getId(i,t[n]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Vc.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){const t=this.attachedIframes.get(e),i=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){const e=i.contentWindow,t=this.attachedWindows.get(i);t&&(t.forEach(e=>{const t=this.nestedIframeListeners.get(e);t&&(Rd(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(i)),e&&this.nestedIframeListeners.has(e)&&(Rd(e,"message",this.nestedIframeListeners.get(e)),this.nestedIframeListeners.delete(e)),e&&this.crossOriginIframeMap.delete(e),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const s=this.attachedDocuments.get(i);s&&(s.forEach(e=>{Ld(()=>this.mirror.removeNodeFromMap(e))}),Ld(()=>gh(i,s)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(e=>this.removeIframeById(e))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&Rd(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{Rd(t,"message",e)}),this.nestedIframeListeners.clear();const e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),e.forEach(e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Eh=class{constructor(e){Lu(this,"shadowDoms",new WeakSet),Lu(this,"mutationCb",void 0),Lu(this,"scrollCb",void 0),Lu(this,"bypassOptions",void 0),Lu(this,"mirror",void 0),Lu(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var i,s;if(!$u(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=null!==(i=null===(s=ru.host(e))||void 0===s?void 0:s.ownerDocument)&&void 0!==i?i:t,{observer:r,buffer:o}=ph(ct(ct({},this.bypassOptions),{},{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push({doc:n,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const e=dh.indexOf(o);-1!==e&&dh.splice(e,1)}}),this.restoreHandlers.push({doc:n,handler:_h(ct(ct({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(ru.host(e))),this.restoreHandlers.push({doc:n,handler:bh({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const i=this;this.restoreHandlers.push({doc:t,handler:nu(e.prototype,"attachShadow",function(e){return function(s){const n=e.call(this,s),r=ru.shadowRoot(this);return r&&Yd(this)&&i.addShadowRoot(r,t),n}})})}reset(){this.restoreHandlers.forEach(({handler:e})=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){const t=[];for(const i of this.restoreHandlers)if(i.doc===e)try{i.handler()}catch(e){}else t.push(i);this.restoreHandlers=t}},Th="skip-frame";function Mh(e){if("object"!=typeof e||null===e)return!1;const{x:t,y:i,width:s,height:n}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(n)&&s>=0&&n>=0}for(var Ph="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Rh=0;64>Rh;Rh++)Fh[Ph.charCodeAt(Rh)]=Rh;var Lh=function(e){var t,i=new Uint8Array(e),s=i.length,n="";for(t=0;s>t;t+=3)n+=Ph[i[t]>>2],n+=Ph[(3&i[t])<<4|i[t+1]>>4],n+=Ph[(15&i[t+1])<<2|i[t+2]>>6],n+=Ph[63&i[t+2]];return s%3==2?n=n.substring(0,n.length-1)+"=":s%3==1&&(n=n.substring(0,n.length-2)+"=="),n},Ah=new Map,Oh=(e,t,i)=>{if(!e||!Nh(e,t)&&"object"!=typeof e)return;const s=function(e,t){let i=Ah.get(e);return i||(i=new Map,Ah.set(e,i)),i.has(t)||i.set(t,[]),i.get(t)}(i,e.constructor.name);let n=s.indexOf(e);return-1===n&&(n=s.length,s.push(e)),n};function $h(e,t,i,s){if(e instanceof Array)return e.map(e=>$h(e,t,i,s));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:Lh(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[$h(e.buffer,t,i,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:i}=e;return{rr_type:t,src:i}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(s.type,s.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[$h(e.data,t,i,s),e.width,e.height]}:Nh(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Oh(e,t,i)}:e}var Dh=(e,t,i,s)=>e.map(e=>$h(e,t,i,s)),Nh=(e,t)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(i.find(i=>e instanceof t[i]))},Bh=["webgl","webgl2"];function qh(e){return"nodeType"in e}function Hh(e,t,i,s){const n=[];try{if(s){const s=function(e,t,i){const s=e.GPUCanvasContext;if((null==s?void 0:s.prototype)&&"function"==typeof s.prototype.configure)return nu(s.prototype,"configure",function(s){return function(n){const r=function(e){const{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!r||qh(r)&&Ud(r,t,i,!0))return s.call(this,n);qh(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(e){const t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return s.call(this,null!==o&&n?ct(ct({},n),{},{usage:"number"==typeof n.usage?n.usage|o:o}):n)}})}(e,t,i);s&&n.push(s)}const r=nu(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...r){const o=function(e){return"experimental-webgl"===e?"webgl":e}(n);if(!Ud(this,t,i,!0)&&("__context"in this||(this.__context=o),s&&Bh.includes(o)))if(r[0]&&"object"==typeof r[0]){const e=r[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[n,...r])}});n.push(r)}catch(e){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function Wh(e,t,i,s,n,r,o){const a=[],l=Object.getOwnPropertyNames(e);for(const c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const l=nu(e,c,function(e){return function(...a){const l=e.apply(this,a);if(Oh(l,r,this),this.canvas&&"tagName"in this.canvas&&!Ud(this.canvas,s,n,!0)){const e=Dh(a,r,this,o);i(this.canvas,{type:t,property:c,args:e})}return l}});a.push(l)}catch(r){const o=Nd(e,c,{set(e){this.canvas&&"tagName"in this.canvas&&!Ud(this.canvas,s,n,!0)&&i(this.canvas,{type:t,property:c,args:[e],setter:!0})}});a.push(o)}return a}var zh='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',Uh="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",zh],{type:"text/javascript;charset=utf-8"});function jh(e){let t;try{if(t=Uh&&(self.URL||self.webkitURL).createObjectURL(Uh),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(zh),{name:null==e?void 0:e.name})}}var Vh,Gh,Qh,Kh=class{onFullSnapshot(){var e;null===(e=this.resetFrameDedup)||void 0===e||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){Lu(this,"pendingCanvasMutations",new Map),Lu(this,"rafStamps",{latestId:0,invokeId:null}),Lu(this,"mirror",void 0),Lu(this,"mutationCb",void 0),Lu(this,"resetObservers",void 0),Lu(this,"frozen",!1),Lu(this,"locked",!1),Lu(this,"rafIdTimestamp",null),Lu(this,"rafIdFlush",null),Lu(this,"refCount",0),Lu(this,"torndown",!1),Lu(this,"resetFrameDedup",null),Lu(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:i,blockClass:s,blockSelector:n,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(i,s,n,o),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,s,n,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,s,n){var r=this;if(!("OffscreenCanvas"in t))return;const o="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,a=Hh(t,i,s,!0),l=new Map;let c;try{c=new jh}catch(e){return}let u=!1;c.onerror=()=>{var e;u=!0,cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=e=>{const{id:t}=e.data;if(l.set(t,!1),!("base64"in e.data))return;const{base64:i,type:s,displayWidth:n,displayHeight:r}=e.data;this.mutationCb({id:t,type:Uc["2D"],commands:[{property:"clearRect",args:[0,0,n,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:s}]},0,0,n,r]}],displayWidth:n,displayHeight:r})};const d=1e3/e;let h,p=0;const _=e=>{var a;u||(p&&d>e-p||(p=e,(()=>{const e=[],n=t=>{try{t.querySelectorAll("canvas").forEach(t=>{Ud(t,i,s,!0)||e.push(t)}),t.querySelectorAll("*").forEach(e=>{e.shadowRoot&&n(e.shadowRoot)})}catch(e){}};return n(t.document),e})().forEach((a=rt(function*(e){const t=r.mirror.getId(e);if(!l.get(t)&&0!==e.width&&0!==e.height){l.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var i,s;const n=e.getContext(e.__context);if(null==n||null===(i=n.isContextLost)||void 0===i?void 0:i.call(n))return void l.set(t,!1);!1===(null==n||null===(s=n.getContextAttributes())||void 0===s?void 0:s.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,a=e.clientHeight||e.height,u=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),h=function(e,t,i,s,n,r){if(!e||"function"!=typeof e.regionsFn)return;let o;try{o=e.regionsFn(t)}catch(e){return Th}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Mh))return Th;const a=i/n,l=s/r;return o.filter(e=>e.width>0&&e.height>0).map(e=>{const t=Math.floor(e.x*a),i=Math.floor(e.y*l);return{x:t,y:i,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-i}})}(n.canvasMasking,e,u,d,r,a);if("skip-frame"===h)return void l.set(t,!1);const p=yield createImageBitmap(e,1>o?{resizeWidth:u,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:u,resizeHeight:d});c.postMessage({id:t,bitmap:p,width:u,height:d,displayWidth:r,displayHeight:a,dataURLOptions:n.dataURLOptions,maskRegions:h},[p])}catch(e){l.set(t,!1)}}}),function(e){return a.apply(this,arguments)}))),h=requestAnimationFrame(_))};h=requestAnimationFrame(_),this.resetObservers=()=>{var e;a(),cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=Hh(e,t,i,!1),r=function(e,t,i,s,n){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=nu(t.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Ud(this.canvas,i,s,!0)||setTimeout(()=>{const i=Dh(o,t,this,n);e(this.canvas,{type:Uc["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(n){const o=Nd(t.CanvasRenderingContext2D.prototype,a,{set(t){Ud(this.canvas,i,s,!0)||e(this.canvas,{type:Uc["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s),o=function(e,t,i,s,n){const r=[];return void 0!==t.WebGLRenderingContext&&r.push(...Wh(t.WebGLRenderingContext.prototype,Uc.WebGL,e,i,s,t,n)),void 0!==t.WebGL2RenderingContext&&r.push(...Wh(t.WebGL2RenderingContext.prototype,Uc.WebGL2,e,i,s,t,n)),()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s);this.resetObservers=()=>{n(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===t)return;const s=i.map(e=>mn(e,Bc)),{type:n}=i[0];this.mutationCb({id:t,type:n,commands:s}),this.pendingCanvasMutations.delete(e)}},Zh=class{constructor(e){var t;Lu(this,"trackedLinkElements",new WeakSet),Lu(this,"pendingDeferredSheets",new Set),Lu(this,"mutationCb",void 0),Lu(this,"adoptedStyleSheetCb",void 0),Lu(this,"maskAllElementAttributes",void 0),Lu(this,"maskAttributeFn",void 0),Lu(this,"styleMirror",new Jd),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(-1===t||!e.isConnected)return null;let i=null,s=null;try{s=e.sheet,s&&(i=Gu(s))}catch(e){}if(!i||!s)return Pu(),null;const n=i;let r=!1;const o={sheet:s,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=ou(),c=cu();let u=!0;try{if(r)return a=!0,Pu(),!0;if(!n.advance(i))return u=!1,!1;a=!0;const o=n.text();if(!e.isConnected)return!0;let l=null;try{l=e.sheet}catch(e){}return l!==s?(Pu(),!0):o?(this.emitCssTextMutation(e,t,o),!0):(Pu(),!0)}finally{u&&this.pendingDeferredSheets.delete(o),uu(d=ou()-l,null!=(h=c)?h:au)||(Su.totalMs+=d,d>Su.slowestSliceMs&&(Su.slowestSliceMs=d))}var d,h},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(const t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var i;null===(i=this.beginDeferredLinkInlining(e,t))||void 0===i||i.advance(1/0)}emitCssTextMutation(e,t,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:Xu({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const i={id:t,styleIds:[]},s=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{const i=this.styleMirror.add(t);e=i;const n=ou();try{Iu(()=>{try{const e=t.rules||t.cssRules;e&&xu(e)}catch(e){}s.push({styleId:i,rules:Array.from(t.rules||CSSRule,(e,i)=>({rule:Hu(e,t.href),index:i}))})})}finally{Eu(ou()-n)}}i.styleIds.push(e)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),kd.forEach(e=>e.abort()),kd.clear()}trackStylesheetInLinkElement(e){}},Jh=class{constructor(){Lu(this,"nodeMap",new WeakMap),Lu(this,"active",!1)}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Xh=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Yh;const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null===(Yh=e.contentWindow)||void 0===Yh?void 0:Yh.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ep=new Qu,tp=new Set([Hc.Mutation,Hc.MediaInteraction,Hc.StyleSheetRule,Hc.CanvasMutation,Hc.Font,Hc.Log,Hc.StyleDeclaration,Hc.AdoptedStyleSheet]);function ip(e){const t=window;if("function"==typeof t.requestIdleCallback){const i=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,i)}}}const i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function sp(e={}){let t;const{emit:i,checkoutEveryNms:s,checkoutEveryNth:n,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,inlineStylesheetBudgetRules:h,maskAllInputs:p,maskInputOptions:_,slimDOMOptions:g,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m=!1,maskAttributeFn:y,hooks:b,packFn:S,sampling:w={},dataURLOptions:k={},canvasResolutionScale:C,canvasMasking:x,mousemoveWait:I,recordDOM:E=!0,recordCanvas:T=!1,recordCrossOriginIframes:M=!1,recordAfter:P=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:F=!1,collectFonts:R=!1,inlineImages:L=!1,plugins:A,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:D=new Set([]),attributeFilter:N,errorHandler:B}=e;lh(B);const q=ct({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},k),H=!M||window.parent===window;let W=!1;if(!H)try{window.parent.document&&(W=!1)}catch(e){W=!0}if(H&&!i)throw new Error("emit function is required");if(!H&&!W)return()=>{};void 0!==I&&void 0===w.mousemove&&(w.mousemove=I),ep.reset();const z=!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==_?_:{password:!0},U=Md(void 0!==g&&g);let j;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Q,K;const Z=e=>{for(const t of A||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!W&&(e=S(e)),e};Vh=(e,t)=>{var r;const o=e;if(o.timestamp=Bd(),!(null===(r=dh[0])||void 0===r?void 0:r.isFrozen())||o.type===qc.FullSnapshot||o.type===qc.IncrementalSnapshot&&tp.has(o.data.source)||dh.forEach(e=>e.unfreeze()),H)null==i||i(Z(o),t);else if(W){const e={type:"rrweb",event:Z(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(e,"*")}if(o.type===qc.FullSnapshot)j=o,V=0;else if(o.type===qc.IncrementalSnapshot){if(o.data.source===Hc.Mutation&&o.data.isAttachIframe)return;V++,(n&&V>=n||s&&o.timestamp-j.timestamp>s)&&Gh(!0)}};const J=e=>{if(e.removes&&e.removes.length>0){const t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,i=new Set;if(e.adds.length>0)for(const t of e.adds){const e=ep.getNode(t.node.id);e&&"IFRAME"===e.nodeName&&i.add(e)}e.removes.forEach(({id:e})=>{if(t&&t.has(e))return;const s=te.getIframeElementById(e);s&&i.has(s)?te.forgetIframeId(e):(null==Q||Q(e),te.removeIframeById(e))}),null==K||K(),te.cleanupDetachedIframes()}Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Mutation},e)})},X=e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Scroll},e)}),Y=e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.CanvasMutation},e)}),ee=new Zh({mutationCb:J,adoptedStyleSheetCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.AdoptedStyleSheet},e)}),maskAllElementAttributes:m,maskAttributeFn:y}),te=new Ih({mirror:ep,mutationCb:J,stylesheetManager:ee,recordCrossOriginIframes:M,wrappedEmit:Vh});for(const e of A||[])e.getMirror&&e.getMirror({nodeMirror:ep,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const ie=new Jh,se=null==x?void 0:x.configured;Qh=new Kh({recordCanvas:T,mutationCb:Y,win:window,blockClass:r,blockSelector:o,mirror:ep,sampling:w.canvas,dataURLOptions:q,resolutionScale:C,canvasMasking:x});const ne=new Eh({mutationCb:J,scrollCb:X,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:z,dataURLOptions:q,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,recordCanvas:T,canvasMaskingConfigured:se,inlineImages:L,sampling:w,slimDOMOptions:U,iframeManager:te,stylesheetManager:ee,canvasManager:Qh,keepIframeSrcFn:O,processedNodeManager:ie,attributeFilter:N},mirror:ep});Gh=(e=!1)=>{if(E){wu(h);try{Vh({type:qc.Meta,data:{href:window.location.href,width:Wd(),height:Hd()}},e),null==t||t.cancel(),t=void 0,ee.reset(),ne.init(),dh.forEach(e=>e.lock());let i=null,s=[];try{i=function(e,t){const{mirror:i=new Qu,blockClass:s="rr-block",blockSelector:n=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,canvasMaskingConfigured:u,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_=!1,maskAttributeFn:g,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x=()=>!1,maxDepth:I,inlineStylesheetBudgetRules:E}=t||{},T=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,M=Md(f);wu(E);try{return Td(e,{doc:e,mirror:i,blockClass:s,blockSelector:n,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:T,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_,maskAttributeFn:g,slimDOMOptions:M,dataURLOptions:v,inlineImages:l,recordCanvas:c,canvasMaskingConfigured:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x,newlyAddedElement:!1,maxDepth:I})}finally{ku()}}(document,{mirror:ep,blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:z,inlineStylesheetBudgetRules:h,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,slimDOM:U,dataURLOptions:q,recordCanvas:T,canvasMaskingConfigured:se,inlineImages:L,onSerialize(e){Qd(e,ep)&&te.addIframe(e),Kd(e,ep)&&ee.trackLinkElement(e),Zd(e)&&ne.addShadowRoot(ru.shadowRoot(e),document)},onIframeLoad(e,t){te.attachIframe(e,t),ne.observeAttachShadow(e)},onIframeListenerRegistered(e,t){te.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){ee.attachLinkElement(e,t)},keepIframeSrcFn:O})}finally{s=Mu()}if(!i)return console.warn("Failed to snapshot the document");if(Vh({type:qc.FullSnapshot,data:{node:i,initialOffset:qd(window)}},e),dh.forEach(e=>e.unlock()),Qh.onFullSnapshot(),s.length){const e=function(e,t,i){let s=!1,n=null,r=0,o=null;const a=()=>null!==o||e.length>r,l=()=>{const i=e[r];e[r]=null,r+=1,i&&Ld(()=>{o=t.beginDeferredLinkInlining(i,ep.getId(i))})},c=()=>{if(!o)return;const e=o;let t=!0;Ld(()=>{t=e.advance(200)}),t&&(o=null)},u=()=>{o||l(),c()},d=e=>{if(n=null,s)return;let t=0;do{try{u()}catch(e){null==o||o.discard(),o=null,Fu(1)}t+=1}while(!s&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));s||(a()?n=ip(d):i())};return n=ip(d),{cancel(){s=!0,null==o||o.discard(),o=null,null==n||n.cancel(),n=null},flush(){if(s)return;s=!0,null==n||n.cancel(),n=null;let t=0,u=0;for(;a()&&50>t;){o||l();const e=o;if(e)if(Math.floor(e.remainingRules()/200)+1>50-t)e.discard(),o=null,u+=1;else{try{c()}catch(e){null==o||o.discard(),o=null,u+=1}t+=1}}if(a()||u>0){let t=u+(null!==o?1:0);for(let i=r;e.length>i;i++)null!==e[i]&&(t+=1);Fu(t),null==o||o.discard(),o=null}i()}}}(s,ee,()=>{t===e&&(t=void 0)});t=e}M&&te.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,ep.getId(document))}finally{ku()}}};try{const e=[];e.push(Fd("pagehide",()=>{try{null==t||t.flush()}catch(e){}t=void 0},window));for(const t of["visibilitychange","freeze","resume"])e.push(Fd(t,lu,document));Q=t=>{const i=G.get(t);i&&(i.forEach(t=>{Ld(t);const i=e.indexOf(t);-1!==i&&e.splice(i,1)}),G.delete(t))},K=()=>{for(const[e]of G){const t=ep.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==Q||Q(e)}catch(t){null==Q||Q(e)}else null==Q||Q(e)}};const i=e=>{var t;return uh(wh)({mutationCb:J,mousemoveCb:(e,t)=>Vh({type:qc.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.MouseInteraction},e)}),scrollCb:X,viewportResizeCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.ViewportResize},e)}),inputCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Input},e)}),mediaInteractionCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.MediaInteraction},e)}),styleSheetRuleCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.StyleSheetRule},e)}),styleDeclarationCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.StyleDeclaration},e)}),canvasMutationCb:Y,fontCb:e=>Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Font},e)}),selectionCb(e){Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Selection},e)})},customElementCb(e){Vh({type:qc.IncrementalSnapshot,data:ct({source:Hc.CustomElement},e)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:u,maskInputOptions:z,inlineStylesheet:d,sampling:w,recordDOM:E,recordCanvas:T,canvasMaskingConfigured:se,inlineImages:L,userTriggeredOnInput:F,collectFonts:R,doc:e,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m,maskAttributeFn:y,keepIframeSrcFn:O,blockSelector:o,slimDOMOptions:U,dataURLOptions:q,mirror:ep,iframeManager:te,stylesheetManager:ee,shadowDomManager:ne,processedNodeManager:ie,canvasManager:Qh,ignoreCSSAttributes:D,attributeFilter:N,plugins:(null==A||null===(t=A.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({name:e.name,observer:e.observer,options:e.options,callback:t=>Vh({type:qc.Plugin,data:{plugin:e.name,payload:t}})})))||[]},b)};te.addLoadListener(t=>{try{const s=ep.getId(t),n=i(t.contentDocument);if("function"==typeof n&&(e.push(n),-1!==s)){let e=G.get(s);e||(e=new Set,G.set(s,e)),e.add(n)}}catch(e){console.warn(e)}}),te.addPageHideListener(e=>{const t=ep.getId(e);null==Q||Q(t),gh(e)});let s=-1;const n=e=>Vh({type:qc.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),h=()=>{var e,t,i,r;const o=document,a=null!==(e=null!==(t=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==t?t:o.msFullscreenElement)&&void 0!==e?e:null,l=a?ep.getId(a):-1;l!==s&&(-1!==s&&n({id:s,enter:!1}),s=l,-1!==l&&n({id:l,enter:!0}))},p=()=>{Gh();const t=i(document);"function"==typeof t&&e.push(t),e.push(Fd("fullscreenchange",h)),e.push(Fd("webkitfullscreenchange",h)),e.push(Fd("mozfullscreenchange",h)),e.push(Fd("MSFullscreenChange",h)),Xh=!0};return["interactive","complete"].includes(document.readyState)?p():(e.push(Fd("DOMContentLoaded",()=>{Vh({type:qc.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&p()})),e.push(Fd("load",()=>{Vh({type:qc.Load,data:{}}),"load"===P&&p()},window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Ad(e),ie.destroy(),te.removeLoadListener(),te.destroy(),G.clear(),ne.reset(),ep.reset(),Xh=!1,ch()}}catch(e){console.warn(e)}}sp.addCustomEvent=(e,t)=>{if(!Xh)throw new Error("please add custom event after start recording");Vh({type:qc.Custom,data:{tag:e,payload:t}})},sp.freezePage=()=>{dh.forEach(e=>e.freeze())},sp.takeFullSnapshot=e=>{if(!Xh)throw new Error("please take full snapshot after start recording");Gh(e)},sp.mirror=ep,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var np=Object.create(null);function rp(e){return rp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rp(e)}function op(e,t,i){return(t=function(e){var t=function(e){if("object"!=rp(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=rp(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rp(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}np.Node=Object.create(null),np.ShadowRoot=Object.create(null),np.MutationObserver=Object.create(null),np.Element=Object.create(null);var ap=class{constructor(e){op(this,"fileName",void 0),op(this,"functionName",void 0),op(this,"lineNumber",void 0),op(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},lp=/(^|@)\S+:\d+/,cp=/^\s*at .*(\S+:\d+|\(native\))/m,up=/^(eval@)?(\[native code])?$/,dp={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(cp)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(cp)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=i?t.replace(i[0],""):t;const s=t.split(/\s+/).slice(1),n=this.extractLocation(i?i[1]:s.pop());return new ap({functionName:s.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0],lineNumber:n[1],columnNumber:n[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(up)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new ap({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(t),s=i&&i[1]?i[1]:void 0,n=this.extractLocation(e.replace(t,""));return new ap({functionName:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),s=[];for(let e=2,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new ap({fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera10(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),s=[];for(let e=0,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new ap({functionName:n[3]||void 0,fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(lp)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),i=this.extractLocation(t.pop());return new ap({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function hp(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();const s=e.parentElement,n=[];if(s.children&&s.children.length>0)for(let e=0;s.children.length>e;e++){const t=s.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===i&&n.push(t)}n.length>1&&(i+=`:eq(${n.indexOf(e)})`),t=i+(t?">"+t:""),e=s}return t}function pp(e){return Array.isArray(e)}function _p(e){return"object"==typeof e&&null!==e&&!pp(e)}function gp(e,t){if(0===t)return!0;const i=Object.keys(e);for(const s of i)if(_p(e[s])&&gp(e[s],t-1))return!0;return!1}function fp(e,t){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);const s=[],n=[];return JSON.stringify(e,function(e,t){if(s.length>0){const i=s.indexOf(this);~i?s.splice(i+1):s.push(this),~i?n.splice(i,1/0,e):n.push(e),~s.indexOf(t)&&(t=s[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(t)).join(".")+"]")}else s.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(_p(r=t)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||_p(r)&&gp(r,i.depthOfLimit))return function(e){let t=e.toString();return i.stringLengthLimit&&t.length>i.stringLengthLimit&&(t=`${t.slice(0,i.stringLengthLimit)}...`),t}(t);var r;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const i in t){const s=t[i];e[i]=pp(s)?hp(s.length?s[0]:null):s}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var vp={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function mp(e,t,i){const s=i?Object.assign({},vp,i):vp,n=s.logger;if(!n)return()=>{};let r;r="string"==typeof n?t[n]:n;let o=0,a=!1,l=!0;const c=[];if(s.level.includes("error")){const i=t=>{const i=t.message;e({level:"error",trace:dp.parse(t.error).map(e=>e.toString()),payload:[fp(i,s.stringifyOptions)]})};t.addEventListener("error",i),c.push(()=>{t.removeEventListener("error",i)});const n=t=>{let i,n;t.reason instanceof Error?(i=t.reason,n=[fp(`Uncaught (in promise) ${i.name}: ${i.message}`,s.stringifyOptions)]):(i=new Error,n=[fp("Uncaught (in promise)",s.stringifyOptions),fp(t.reason,s.stringifyOptions)]),e({level:"error",trace:dp.parse(i).map(e=>e.toString()),payload:n})};t.addEventListener("unhandledrejection",n),c.push(()=>{t.removeEventListener("unhandledrejection",n)})}for(const e of s.level)c.push(u(r,e));return()=>{l=!1,c.forEach(e=>e())};function u(t,i){return t[i]?function(n,r){try{if(!(r in n))return()=>{};const c=n[r],u={next:c},d=(n=>(...r)=>{if(n.apply(t,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const t=dp.parse(new Error).map(e=>e.toString()).splice(1),n=("assert"===i?r.slice(1):r).map(e=>fp(e,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:i,trace:t,payload:n}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[fp("The number of log records reached the threshold.")]})}catch(e){n.apply(t,["rrweb logger error:",e,...r])}finally{a=!1}}})(function(...e){return u.next.apply(this,e)});return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:c},__rrweb_layer__:{enumerable:!1,value:u}})),n[r]=d,()=>{if(n[r]===d)return void(n[r]=u.next);const e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let t=n[r],i=e(t);for(;i;){if(i.next===d)return void(i.next=u.next);t=i.next,i=e(t)}}}catch(e){return()=>{}}}(t,i):()=>{}}}var yp=e=>({name:"rrweb/console@1",observer:mp,options:e});const bp=()=>{},Sp=e=>{var t;if(Ct(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function wp(e,t,i){try{if(!(t in e))return bp;const s={next:e[t]},n=i(function(...e){return s.next.apply(this,e)});return Ct(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let i=e[t],r=Sp(i);for(;r;){if(r.next===n)return void(r.next=s.next);i=r.next,r=Sp(i)}}}catch(e){return bp}}function kp(e,t){var i;const s=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),n={hostname:s,isHostDenied:!1};if(!(null===(i=t.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==s?void 0:s.trim().length))return n;for(const e of t.payloadHostDenyList)if(s.endsWith(e))return{hostname:s,isHostDenied:!0};return n}const Cp=Gn("[Recorder]"),xp=e=>"navigation"===e.entryType,Ip=e=>"resource"===e.entryType;function Ep(e,t){return!!t&&(At(t)||t[e])}function Tp(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}const Mp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Pp({type:e,recordBody:t,headers:i,url:s}){function n(e){const t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),s=t&&i[t];return e.some(e=>null==s?void 0:s.toLowerCase().includes(e))}if(!t)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Tp(t)&&e(t.url)}catch(e){return!1}}(s))return!1;if(n(Mp))return!1;if(At(t))return!0;if(kt(t))return n(t);const r=t[e];return At(r)?r:n(r)}function Fp(e,t,i,s,n){return Rp.apply(this,arguments)}function Rp(){return Rp=rt(function*(e,t,i,s,n,r=0){if(r>10)return Cp.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null;const o=function(e,t){for(let i=e.length-1;i>=0;i-=1)if(t(e[i]))return e[i]}(e.performance.getEntriesByName(i),e=>Ip(e)&&e.initiatorType===t&&(Et(s)||e.startTime>=s)&&(Et(n)||n>=e.startTime));return o||(yield new Promise(e=>setTimeout(e,50*r)),Fp(e,t,i,s,n,r+1))}),Rp.apply(this,arguments)}function Lp({body:e,options:t,url:i}){if(Ft(e))return null;const{hostname:s,isHostDenied:n}=kp(i,t);if(n)return s+" is in deny list";if(Tt(e))return e;if((e=>"u">typeof Document&&e instanceof Document)(e))return e.textContent;if(Ot(e))return lr(e);if(xt(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}const Ap=e=>!Pt(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Op({entry:e,method:t,status:i,networkRequest:s,isInitial:n,start:r,end:o,url:a,initiatorType:l}){r=e?e.startTime:r,o=e?e.responseEnd:o;const c=Math.floor(Date.now()-performance.now()),u=Math.floor(c+(r||0)),d=[ct(ct({},e?e.toJSON():{name:a}),{},{startTime:Et(r)?void 0:Math.round(r),endTime:Et(o)?void 0:Math.round(o),timeOrigin:c,timestamp:u,method:t,initiatorType:l||(e?e.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:n})];if(Ap(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:u,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const $p=["video/","audio/"];function Dp(e){return xt(e)&&Ct(e.getReader)&&Ct(e.tee)}const Np="[SessionReplay] Timeout while trying to read body",Bp="[SessionReplay] Failed to read body";function qp(e){return`${Bp}: ${e}`}function Hp(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function Wp(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{const i=setTimeout(()=>t(Np),500);try{e.clone().text().then(e=>t(e),e=>t(qp(e))).finally(()=>clearTimeout(i))}catch(e){clearTimeout(i),t(Bp)}})}(e);const i=so(t);return function(e,t){try{var i,s;const n=null===(i=e.headers)||void 0===i||null===(s=i.get)||void 0===s?void 0:s.call(i,"content-length");if(!n)return!1;const r=parseInt(n,10);return Number.isFinite(r)&&r>t}catch(e){return!1}}(e,i)?Promise.resolve(Hp(i)):function(e,t){return new Promise(i=>{let s,n=!1;function r(){try{null==s||s.cancel().catch(()=>{})}catch(e){}}function o(e){n||(n=!0,clearTimeout(a),r(),i(e))}const a=setTimeout(()=>o(Np),500);let l;try{l=e.clone()}catch(e){return void o(Bp)}const c=l.body;if(!Dp(c)||"undefined"==typeof TextDecoder){try{l.text().then(e=>o(e),e=>o(qp(e)))}catch(e){o(Bp)}return}try{s=c.getReader()}catch(e){return void o(Bp)}const u=[];let d=0;!function e(){s.read().then(({done:i,value:s})=>{if(n)r();else if(i)o((new TextDecoder).decode(function(e,t){const i=new Uint8Array(t);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i}(u,d)));else{if(s){if(d+s.byteLength>t)return void o(Hp(t));d+=s.byteLength,u.push(s)}e()}},e=>o(qp(e)))}()})}(e,i)}function zp(){return zp=rt(function*({r:e,options:t,url:i}){const{hostname:s,isHostDenied:n}=kp(i,t);return n?Promise.resolve(s+" is in deny list"):Wp(e,t)}),zp.apply(this,arguments)}function Up(){return Up=rt(function*({r:e,options:t,url:i}){const s=function({r:e,options:t,url:i}){var s;if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const n=null===(s=e.headers.get("Content-Type"))||void 0===s?void 0:s.toLowerCase(),r=$p.some(e=>null==n?void 0:n.startsWith(e));if(n&&r)return`Content-Type ${n} is not supported`;const{hostname:o,isHostDenied:a}=kp(i,t);return a?o+" is in deny list":null}({r:e,options:t,url:i});return Pt(s)?Wp(e,t):Promise.resolve(s)}),Up.apply(this,arguments)}let jp=null;function Vp(e,t,i){if(!("performance"in t))return()=>{};if(jp)return Cp.warn("Network observer already initialised, doing nothing"),()=>{};const s=i?Object.assign({},no,i):no;let n=!0;const r=t=>{if(!n)return;const i=[];let r=!1;t.requests.forEach(e=>{const t="serverTiming"===e.entryType;if(t&&r)return;const n=s.maskRequestFn(e);t||(r=!n||(e=>!!e&&po.has(e))(n)),n&&i.push(n)}),i.length>0&&e(ct(ct({},t),{},{requests:i}))},o=function(e,t,i){i.recordInitialRequests&&e({requests:t.performance.getEntries().filter(e=>xp(e)||Ip(e)&&i.initiatorTypes.includes(e.initiatorType)).flatMap(e=>Op({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const s=new t.PerformanceObserver(t=>{e({requests:t.getEntries().filter(e=>xp(e)||Ip(e)&&i.initiatorTypes.includes(e.initiatorType)&&(e=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>Op({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),n=PerformanceObserver.supportedEntryTypes.filter(e=>i.performanceEntryTypeToObserve.includes(e));return s.observe({entryTypes:n}),()=>{s.disconnect()}}(r,t,s);let a=()=>{},l=()=>{};return(s.recordHeaders||s.recordBody)&&(a=function(e,t,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const s=Ep("request",i.recordHeaders),n=Ep("response",i.recordHeaders),r=wp(t.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,c,u){const d=this;try{const r=new Request(a),l={};let c,u;const h={},p=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(h[e]=t,p(e,t)),s&&(l.requestHeaders=h);const _=d.send.bind(d);d.send=e=>(Pp({type:"request",headers:h,url:a,recordBody:i.recordBody})&&(l.requestBody=Lp({body:e,options:i,url:a})),c=t.performance.now(),_(e));const g=()=>{d.removeEventListener("readystatechange",f),d.removeEventListener("error",g),d.removeEventListener("abort",g),d.removeEventListener("timeout",g)},f=()=>{if(d.readyState!==d.DONE)return;g(),u=t.performance.now();const s={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),n=t.join(": ");i&&(s[i]=n)}),n&&(l.responseHeaders=s),Pp({type:"response",headers:s,url:a,recordBody:i.recordBody})&&(l.responseBody=Lp({body:d.response,options:i,url:a})),Fp(t,"xmlhttprequest",r.url,c,u).then(t=>{e({requests:Op({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:l,start:c,end:u,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};d.addEventListener("readystatechange",f),d.addEventListener("error",g),d.addEventListener("abort",g),d.addEventListener("timeout",g)}catch(e){Cp.error("Failed to instrument XHR for network capture",e)}r.call(d,o,a.toString(),l,c,u)});return()=>{r()}}(r,t,s),l=function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const s=Ep("request",i.recordHeaders),n=Ep("response",i.recordHeaders),r=wp(t,"fetch",r=>function(){var o=rt(function*(o,a){let l,c;try{l=new Request(o,a)}catch(e){return Cp.error("Failed to instrument fetch for network capture",e),r(o,a)}const u={};let d,h;try{try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),s&&(u.requestHeaders=e),!Dp(null==a?void 0:a.body)&&Pp({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(u.requestBody=yield function(e){return zp.apply(this,arguments)}({r:l,options:i,url:o}))}catch(e){Cp.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),c=Tp(o)?yield r(l):yield r(o,a),h=t.performance.now();try{const e={};c.headers.forEach((t,i)=>{e[i]=t}),n&&(u.responseHeaders=e),Pp({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield function(e){return Up.apply(this,arguments)}({r:c,options:i,url:o}))}catch(e){Cp.error("Failed to record fetch response for network capture",e)}return c}finally{Fp(t,"fetch",l.url,d,h).then(t=>{e({requests:Op({entry:t,method:l.method,status:null==c?void 0:c.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{r()}}(r,t,s)),jp=()=>{n=!1,o(),a(),l(),jp=null},jp}const Gp=e=>({name:"rrweb/network@1",observer:Vp,options:e});var Qp,Kp,Zp,Jp,Xp,Yp,e_,t_,i_,s_,n_,r_,o_,a_,l_;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:yp,getRecordNetworkPlugin:Gp},h.__PosthogExtensions__.rrweb={record:sp,version:"v2",wasMaxDepthReached:()=>Ed,resetMaxDepthState(){Ed=!1,Id=!1},getLastSnapshotCost:()=>gu,getMutationCost:()=>ct({},bu),getObserverInitFailures:()=>Sh.size?Array.from(Sh):void 0,resetSnapshotCostState(){du=0,hu=0,pu=0,au=0,_u={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gu=null,fu=null,vu=[],mu=0,yu=0,bu={slowestBatchMs:0},Su={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:sp,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:yp},h.getRecordNetworkPlugin=Gp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new Nc(e,t);var c_,u_,d_,h_,p_={},__=[],g_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f_=Array.isArray;function v_(e,t){for(var i in t)e[i]=t[i];return e}function m_(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function y_(e,t,i){var s,n,r,o={};for(r in t)"key"==r?s=t[r]:"ref"==r?n=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?Qp.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return b_(e,o,s,n,null)}function b_(e,t,i,s,n){var r={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++Zp:n,__i:-1,__u:0};return null==n&&null!=Kp.vnode&&Kp.vnode(r),r}function S_(e){return e.children}function w_(e,t){this.props=e,this.context=t}function k_(e,t){if(null==t)return e.__?k_(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?k_(e):null}function C_(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,s=[],n=[],r=v_({},t);r.__v=t.__v+1,Kp.vnode&&Kp.vnode(r),A_(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,s,null==i?k_(t):i,!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,$_(s,r,n),t.__e=t.__=null,r.__e!=i&&x_(r)}}function x_(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),x_(e)}function I_(e){(!e.__d&&(e.__d=!0)&&Jp.push(e)&&!E_.__r++||Xp!=Kp.debounceRendering)&&((Xp=Kp.debounceRendering)||Yp)(E_)}function E_(){try{for(var e,t=1;Jp.length;)Jp.length>t&&Jp.sort(e_),e=Jp.shift(),t=Jp.length,C_(e)}finally{Jp.length=E_.__r=0}}function T_(e,t,i,s,n,r,o,a,l,c,u){var d,h,p,_,g,f,v,m=s&&s.__k||__,y=t.length;for(l=function(e,t,i,s,n){var r,o,a,l,c,u=i.length,d=u,h=0;for(e.__k=new Array(n),r=0;n>r;r++)null!=(o=t[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[r]=b_(null,o,null,null,null):f_(o)?o=e.__k[r]=b_(S_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[r]=b_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[r]=o,l=r+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(c=o.__i=P_(o,i,l,d))&&(d--,(a=i[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(n>u?h--:u>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):e.__k[r]=null;if(d)for(r=0;u>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==s&&(s=k_(a)),B_(a,a));return s}(i,t,m,l,y),d=0;y>d;d++)null!=(p=i.__k[d])&&(h=-1!=p.__i&&m[p.__i]||p_,p.__i=d,f=A_(e,p,h,n,r,o,a,l,c,u),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&N_(h.ref,null,p),u.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(v=!!(4&p.__u))||h.__k===p.__k?(l=M_(p,l,e,v),v&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==f?l=f:_&&(l=_.nextSibling),p.__u&=-7);return i.__e=g,l}function M_(e,t,i,s){var n,r;if("function"==typeof e.type){for(n=e.__k,r=0;n&&n.length>r;r++)n[r]&&(n[r].__=e,t=M_(n[r],t,i,s));return t}e.__e!=t&&(s&&(t&&e.type&&!t.parentNode&&(t=k_(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function P_(e,t,i,s){var n,r,o,a=e.key,l=e.type,c=t[i],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return i;if(s>(u?1:0))for(n=i-1,r=i+1;n>=0||t.length>r;)if(null!=(c=t[o=0>n?r++:n--])&&!(2&c.__u)&&a==c.key&&l==c.type)return o;return-1}function F_(e,t,i){"-"==t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||g_.test(t)?i:i+"px"}function R_(e,t,i,s,n){var r,o;e:if("style"==t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||F_(e.style,t,"");if(i)for(t in i)s&&i[t]==s[t]||F_(e.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(n_,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=i,i?s?i[s_]=s[s_]:(i[s_]=r_,e.addEventListener(t,r?a_:o_,r)):e.removeEventListener(t,r?a_:o_,r);else{if("http://www.w3.org/2000/svg"==n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==i?"":i))}}function L_(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[i_])t[i_]=r_++;else if(i[s_]>t[i_])return;return i(Kp.event?Kp.event(t):t)}}}function A_(e,t,i,s,n,r,o,a,l,c){var u,d,h,p,_,g,f,v,m,y,$,b,S,w,k,C,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=Kp.__b)&&u(t);e:if("function"==typeof x){d=o.length;try{if(m=t.props,y=x.prototype&&x.prototype.render,$=(u=x.contextType)&&s[u.__c],b=u?$?$.props.value:u.__:s,i.__c?v=(h=t.__c=i.__c).__=h.__E:(y?t.__c=h=new x(m,b):(t.__c=h=new w_(m,b),h.constructor=x,h.render=q_),$&&$.sub(h),h.state||(h.state={}),h.__n=s,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=x.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=v_({},h.__s)),v_(h.__s,x.getDerivedStateFromProps(m,h.__s))),_=h.props,g=h.state,h.__v=t,p)y&&null==x.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==x.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==i.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=i.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(e){e&&(e.__=t)}),__.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(_,g,f)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=Kp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),__.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(s=v_(v_({},s),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(f=h.getSnapshotBeforeUpdate(_,g)),k=null!=u&&u.type===S_&&null==u.key?D_(u.props.children):u,a=T_(e,f_(k)?k:[k],t,i,s,n,r,o,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),t.__e=a}else{if(null!=r)for(C=r.length;C--;)m_(r[C]);O_(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),e.then||O_(t);Kp.__e(e,t,i)}}else null==r&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=function(e,t,i,s,n,r,o,a,l){var c,u,d,h,p,_,g,f=i.props||p_,v=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;r.length>c;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null==m)return document.createTextNode(v);e=document.createElementNS(n,m,v.is&&v),a&&(Kp.__m&&Kp.__m(t,r),a=!1),r=null}if(null==m)f===v||a&&e.data==v||(e.data=v);else{if(r="textarea"==m&&null!=v.defaultValue?null:r&&Qp.call(e.childNodes),!a&&null!=r)for(f={},c=0;e.attributes.length>c;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"dangerouslySetInnerHTML"==c?d=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||R_(e,c,null,p,n);for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?_=p:"checked"==c?g=p:a&&"function"!=typeof p||f[c]===p||R_(e,c,p,f[c],n);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),T_("template"==t.type?e.content:e,f_(h)?h:[h],t,i,s,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,r,o,r?r[0]:i.__k&&k_(i,0),a,l),null!=r)for(c=r.length;c--;)m_(r[c]);a&&"textarea"!=m||(c="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==m&&!_||"option"==m&&_!=f[c])&&R_(e,c,_,f[c],n),c="checked",null!=g&&g!=e[c]&&R_(e,c,g,f[c],n))}return e}(i.__e,t,i,s,n,r,o,l,c);return(u=Kp.diffed)&&u(t),128&t.__u?void 0:a}function O_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(O_))}function $_(e,t,i){for(var s=0;i.length>s;s++)N_(i[s],i[++s],i[++s]);Kp.__c&&Kp.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Kp.__e(e,t.__v)}})}function D_(e){return"object"!=typeof e||null==e||e.__b>0?e:f_(e)?e.map(D_):void 0!==e.constructor?null:v_({},e)}function N_(e,t,i){try{if("function"==typeof e){var s="function"==typeof e.__u;s&&e.__u(),s&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Kp.__e(e,i)}}function B_(e,t,i){var s,n;if(Kp.unmount&&Kp.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||N_(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){Kp.__e(e,t)}s.base=s.__P=s.__n=null}if(s=e.__k)for(n=0;s.length>n;n++)s[n]&&B_(s[n],t,i||"function"!=typeof e.type);i||m_(e.__e),e.__c=e.__=e.__e=void 0}function q_(e,t,i){return this.constructor(e,i)}function H_(e,t,i){var s,n,r,o;t==document&&(t=document.documentElement),Kp.__&&Kp.__(e,t),n=(s="function"==typeof i)?null:i&&i.__k||t.__k,r=[],o=[],A_(t,e=(!s&&i||t).__k=y_(S_,null,[e]),n||p_,p_,t.namespaceURI,!s&&i?[i]:n?null:t.firstChild?Qp.call(t.childNodes):null,r,!s&&i?i:n?n.__e:t.firstChild,s,o),$_(r,e,o),e.props.children=null}Qp=__.slice,Kp={__e(e,t,i,s){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,s||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},Zp=0,w_.prototype.setState=function(e,t){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=v_({},this.state);"function"==typeof e&&(e=e(v_({},i),this.props)),e&&v_(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),I_(this))},w_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),I_(this))},w_.prototype.render=S_,Jp=[],Yp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e_=function(e,t){return e.__v.__b-t.__v.__b},E_.__r=0,t_=Math.random().toString(8),i_="__d"+t_,s_="__a"+t_,n_=/(PointerCapture)$|Capture$/i,r_=0,o_=L_(!1),a_=L_(!0),l_=0;var W_=0,z_=[],U_=Kp,j_=U_.__b,V_=U_.__r,G_=U_.diffed,Q_=U_.__c,K_=U_.unmount,Z_=U_.__;function J_(e,t){U_.__h&&U_.__h(u_,e,W_||t),W_=0;var i=u_.__H||(u_.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function X_(e){return W_=1,function(e,t){var i=J_(c_++,2);if(i.t=e,!i.__c&&(i.__=[cg(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],s=i.t(t,e);t!==s&&(i.__N=[s,i.__[1]],i.__c.setState({}))}],i.__c=u_,!u_.__f)){var s=function(e,t,s){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==e;if(i.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),n){var a=n.call(this,e,t,s);return r?a||o:a}return!r||o};u_.__f=!0;var n=u_.shouldComponentUpdate,r=u_.componentWillUpdate;u_.componentWillUpdate=function(e,t,i){if(this.__e){var o=n;n=void 0,s(e,t,i),n=o}r&&r.call(this,e,t,i)},u_.shouldComponentUpdate=s}return i.__N||i.__}(cg,e)}function Y_(e,t){var i=J_(c_++,3);!U_.__s&&lg(i.__H,t)&&(i.__=e,i.u=t,u_.__H.__h.push(i))}function eg(e){return W_=5,tg(function(){return{current:e}},[])}function tg(e,t){var i=J_(c_++,7);return lg(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function ig(e){var t=u_.context[e.__c],i=J_(c_++,9);return i.c=e,t?(null==i.__&&(i.__=!0,t.sub(u_)),t.props.value):e.__}function sg(){for(var e;e=z_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(og),t.__h.some(ag),t.__h=[]}catch(i){t.__h=[],U_.__e(i,e.__v)}}}U_.__b=function(e){u_=null,j_&&j_(e)},U_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Z_&&Z_(e,t)},U_.__r=function(e){V_&&V_(e),c_=0;var t=(u_=e.__c).__H;t&&(d_===u_?(t.__h=[],u_.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&sg(),c_=0)),d_=u_},U_.diffed=function(e){G_&&G_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==z_.push(t)&&h_===U_.requestAnimationFrame||((h_=U_.requestAnimationFrame)||rg)(sg)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),d_=u_=null},U_.__c=function(e,t){t.some(function(e){try{e.__h.some(og),e.__h=e.__h.filter(function(e){return!e.__||ag(e)})}catch(i){t.some(function(e){e.__h&&(e.__h=[])}),t=[],U_.__e(i,e.__v)}}),Q_&&Q_(e,t)},U_.unmount=function(e){K_&&K_(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(e){try{og(e)}catch(e){t=e}}),i.__H=void 0,t&&U_.__e(t,i.__v))};var ng="function"==typeof requestAnimationFrame;function rg(e){var t,i=function(){clearTimeout(s),ng&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(i,35);ng&&(t=requestAnimationFrame(i))}function og(e){var t=u_,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),u_=t}function ag(e){var t=u_;e.__c=e.__(),u_=t}function lg(e,t){return!e||e.length!==t.length||t.some(function(t,i){return t!==e[i]})}function cg(e,t){return"function"==typeof t?t(e):t}const ug="gzip-js",dg="base64",hg="events",pg="cancelEvents",_g="tab",gg="left",fg="center",vg="right",mg="next_to_trigger",yg="popover",bg="widget",Sg="external_survey",wg="open",kg="multiple_choice",Cg="single_choice",xg="rating",Ig="end",Eg="always",Tg="survey shown",Mg="survey dismissed",Pg="survey sent",Fg="$survey_id",Rg="$survey_name",Lg="$survey_iteration",Ag="$survey_iteration_start_date",Og="$survey_partially_completed",$g="$survey_submission_id",Dg="$survey_completed",Ng="$survey_last_seen_date",Bg="$survey_language",qg="popover";function Hg(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&Ct(i.then)&&i.then(void 0,()=>{})}}}}const Wg=Gn("[Surveys]"),zg="PostHog is not capturing, so a survey response cannot be recorded";function Ug(e){return Ct(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing()}function jg(e){return!(!e.start_date||e.end_date)}function Vg(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const Gg=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,Qg=e=>Gg("seenSurvey_",e),Kg=e=>{try{const t=Qg(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){Wg.error("Failed to persist survey seen state",e)}},Zg=[yg,bg,"api"],Jg={ignoreConditions:!1,ignoreDelay:!1,displayType:qg},Xg="logs",Yg=Gn("[Stylesheet Loader]"),ef=e,tf=s,sf="#020617",nf={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:vg,widgetType:_g,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:sf,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},rf=[fg,gg,vg];function of(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function af(e=nf.backgroundColor){let t;"#"===e[0]&&(t=of(e)),e.startsWith("rgb")&&(t=e);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=of(i)),!t)return sf;const s=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(s){const e=parseInt(s[1]),t=parseInt(s[2]),i=parseInt(s[3]);return Math.sqrt(e*e*.299+t*t*.587+i*i*.114)>127.5?sf:"white"}return sf}const lf=(e,t,i)=>{const s=Ef(e),n=tf.querySelector(`.${s}`);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};const r=tf.createElement("div");((e,t,i)=>{const s=ct(ct({},nf),i),n=e.style,r=!rf.includes(s.position)||t===bg&&(null==i?void 0:i.widgetType)===_g;n.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?`${e}, ${t}`:`-apple-system, ${t}`}(s.fontFamily)),n.setProperty("--ph-survey-box-padding",s.boxPadding),n.setProperty("--ph-survey-max-width",s.maxWidth),n.setProperty("--ph-survey-z-index",s.zIndex),n.setProperty("--ph-survey-border-color",s.borderColor),r?(n.setProperty("--ph-survey-border-radius",s.borderRadius),n.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(n.setProperty("--ph-survey-border-bottom","none"),n.setProperty("--ph-survey-border-radius",`${s.borderRadius} ${s.borderRadius} 0 0`)),n.setProperty("--ph-survey-background-color",s.backgroundColor),n.setProperty("--ph-survey-box-shadow",s.boxShadow),n.setProperty("--ph-survey-disabled-button-opacity",s.disabledButtonOpacity),n.setProperty("--ph-survey-submit-button-color",s.submitButtonColor),n.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||af(s.submitButtonColor)),n.setProperty("--ph-survey-rating-bg-color",s.ratingButtonColor),n.setProperty("--ph-survey-rating-active-bg-color",s.ratingButtonActiveColor),n.setProperty("--ph-survey-rating-active-text-color",af(s.ratingButtonActiveColor)),n.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||af(s.backgroundColor)),n.setProperty("--ph-survey-text-subtle-color",s.textSubtleColor),n.setProperty("--ph-widget-color",s.widgetColor),n.setProperty("--ph-widget-text-color",af(s.widgetColor)),n.setProperty("--ph-widget-z-index",s.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||s.inputBackground;o||"white"!==s.backgroundColor||(a="#f8f8f8"),n.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||af(a);n.setProperty("--ph-survey-input-text-color",l),n.setProperty("--ph-survey-rating-text-color",l),n.setProperty("--ph-survey-scrollbar-thumb-color",s.scrollbarThumbColor),n.setProperty("--ph-survey-scrollbar-track-color",s.scrollbarTrackColor),n.setProperty("--ph-survey-outline-color",s.outlineColor)})(r,e.type,e.appearance),r.className=s;const o=r.attachShadow({mode:"open"}),a=function(e){const t=((e,t,i)=>{let s=e.createElement("style");s.innerText=t;const n=(e=>{var t;return Ct(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(i);return n&&(s=n(s)),s||(Yg.error("prepare_external_dependency_stylesheet returned null"),null)})(tf,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(a){const e=o.querySelector("style");e&&o.removeChild(e),o.appendChild(a)}return(i||tf.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},cf=({responses:e,survey:t,surveySubmissionId:i,posthog:s,isSurveyCompleted:n,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;s?Ug(s)&&(Kg(t),s.capture(Pg,ct(ct(ct(ct({[Rg]:t.name,[Fg]:t.id,[Lg]:t.current_iteration,[Ag]:t.current_iteration_start_date,[$g]:i,[Dg]:n},o&&{[Bg]:o}),{},{sessionRecordingUrl:null===(l=s.get_session_replay_url)||void 0===l?void 0:l.call(s)},sl(e,t,a)),r),{},{$set:{[rl(t,"responded")]:!0}})),n&&(ef.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),If(t),s.reloadFeatureFlags())):Wg.error("[survey sent] event not captured, PostHog instance not found.")},uf=(e,t,i)=>{var s;return ct(ct({[Rg]:e.name,[Fg]:e.id,[Lg]:e.current_iteration,[Ag]:e.current_iteration_start_date,[Og]:nl(null==t?void 0:t.responses)},(null==t?void 0:t.surveyLanguage)&&{[Bg]:t.surveyLanguage}),{},{sessionRecordingUrl:null===(s=i.get_session_replay_url)||void 0===s?void 0:s.call(i),[$g]:null==t?void 0:t.surveySubmissionId},sl(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots))},df=(e,t,i,s)=>{if(!t)return void Wg.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const n=Cf(e),r=n?n.surveyLanguage:s;t.capture(Mg,ct(ct(ct({},uf(e,n,t)),r&&{[Bg]:r}),{},{$set:{[rl(e,"dismissed")]:!0}})),If(e),Kg(e),ef.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},hf=(e,t)=>{if(!t)return void Wg.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(e=>Gg("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(i))return}catch(e){return}const s=Cf(e);if(s){try{localStorage.setItem(i,"true")}catch(e){}t.capture("survey abandoned",uf(e,s,t),{transport:"sendBeacon"})}},pf=e=>e.map(e=>({sort:Math.floor(10*Math.random()),value:e})).sort((e,t)=>e.sort-t.sort).map(e=>e.value),_f=(e,t)=>e.length===t.length&&e.every((e,i)=>e===t[i])?t.reverse():t,gf=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},ff=(e,t)=>{return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(i=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const i=new Map(e.questions.map(e=>[e.id,e])),s=[];for(const e of t){const t=i.get(e);if(!t)return null;s.push(t)}return s})(e,t.questionOrder))&&void 0!==i?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?_f(e.questions,pf(e.questions)):e.questions;var i},vf=e=>hl(e)||xf(e),mf=function(e){function t(e){var i,s;return this.getChildContext||(i=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&i.forEach(function(e){e.__e=!0,I_(e)})},this.sub=function(e){i.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i&&i.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+l_++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),yf=()=>ig(mf),bf=({component:e,children:t,renderAsHtml:i,style:s})=>function(e,t,i){var s,n,r,o,a=v_({},e.props);for(r in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==r?s=t[r]:"ref"==r?n=t[r]:a[r]=void 0===t[r]&&null!=o?o[r]:t[r];return arguments.length>2&&(a.children=arguments.length>3?Qp.call(arguments,2):i),b_(e.type,a,s||e.key,n||e.ref,null)}(e,i?{dangerouslySetInnerHTML:{__html:t},style:s}:{children:t,style:s});function Sf(e,t){var i,s;if(!(null===(i=e.conditions)||void 0===i?void 0:i.url))return!0;const n=gr(t);if(!n)return!1;const r=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType);return gl[o](r,[n])}const wf=e=>Gg("inProgressSurvey_",e),kf=(e,t)=>{try{localStorage.setItem(wf(e),JSON.stringify(t))}catch(e){Wg.error("Error setting in-progress survey state in localStorage",e)}},Cf=e=>{try{const t=localStorage.getItem(wf(e));if(t)return JSON.parse(t)}catch(e){Wg.error("Error getting in-progress survey state from localStorage",e)}return null},xf=e=>{const t=Cf(e);return!Ft(null==t?void 0:t.surveySubmissionId)},If=e=>{try{localStorage.removeItem(wf(e))}catch(e){Wg.error("Error clearing in-progress survey state from localStorage",e)}};function Ef(e,t=!1){const i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function Tf(e,t=vg,i){if(e===Sg)return{};switch(t){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case gg:return{left:"30px"};case fg:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===bg&&i===_g?"60px":"30px"}}}var Mf=0;function Pf(e,t,i,s,n,r){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Mf,__i:-1,__u:0,__source:n,__self:r};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return Kp.vnode&&Kp.vnode(c),c}const Ff=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Pf("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Rf=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Pf("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Lf=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Pf("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Af=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Pf("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),Of=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Pf("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),$f=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Pf("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),Df=Pf("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Pf("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Nf=({fill:e="currentColor"}={})=>Pf("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Pf("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Pf("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),Bf=Pf("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Pf("g",{"clip-path":"url(#clip0_2415_6911)",children:[Pf("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Pf("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Pf("g",{mask:"url(#mask0_2415_6911)",children:[Pf("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),Pf("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),Pf("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),Pf("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),Pf("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),Pf("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),Pf("defs",{children:Pf("clipPath",{id:"clip0_2415_6911",children:Pf("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function qf({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return Pf("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Bf]})}function Hf({text:t,submitDisabled:i,appearance:s,onSubmit:n,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:c}){const{isPreviewMode:u}=ig(mf),d=!!l&&!!c,h=!a&&Pf("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==e||e.open(r)),u?null==o||o():n()},children:t});return Pf("div",{className:"bottom-section",children:[d?Pf("div",{className:"form-buttons form-buttons-with-back",children:[Pf("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:s.backButtonText||"Back"}),h]}):h,!s.whiteLabel&&Pf(qf,{urlParams:{utm_source:"survey-footer"}})]})}function Wf({question:e,forceDisableHtml:t,htmlFor:i}){return Pf("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[Pf(e.type===wg?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&bf({component:y_("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function zf({onClick:e}){const{isPreviewMode:t}=ig(mf);return Pf("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:Nf({fill:"black"})})}const Uf=e;function jf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onClose:r}){const{isPopup:o}=ig(mf);return Y_(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),r())};return sr(Uf,"keydown",e),()=>{Uf.removeEventListener("keydown",e)}},[r]),Pf("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Pf(zf,{onClick:()=>r()}),Pf("h3",{className:"thank-you-message-header",children:e}),t&&bf({component:y_("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!s&&"text"!==i}),o&&Pf(Hf,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>r()})]})}function Vf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=ig(mf);return Pf("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Pf(zf,{onClick:()=>l()}),e&&Pf("h3",{className:"intro-screen-header",children:e}),t&&bf({component:y_("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!s&&"text"!==i}),Pf(Hf,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const Gf=e=>kt(e)&&e.every(e=>Tt(e));function Qf({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=yf(),u=eg(null),[d,h]=X_(()=>Tt(o)?o:""),p=null==i?void 0:i.disableAutofocus;Y_(()=>{p||setTimeout(()=>{var e;c||null===(e=u.current)||void 0===e||e.focus()},100)},[c,p]);const _=`surveyQuestion${r}`,g=tg(()=>function(e,t,i){const s=e.trim();if(!i&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case ht:var n;if(void 0!==e.value&&e.value>s.length)return null!==(n=e.errorMessage)&&void 0!==n?n:`Please enter at least ${e.value} characters`;break;case pt:var r;if(void 0!==e.value&&s.length>e.value)return null!==(r=e.errorMessage)&&void 0!==r?r:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),f=Wn(e.validation,ht),v=Wn(e.validation,pt),m=tg(()=>function(e,t){const i=1===e?void 0:e;return i&&t?`Enter ${i}-${t} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(f,v),[f,v]),y=()=>{g||s(d.trim())},b=()=>{g||n(d.trim())};return Pf(S_,{children:[Pf("div",{className:"question-container",children:[Pf(Wf,{question:e,forceDisableHtml:t,htmlFor:_}),Pf("textarea",{ref:u,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:f,maxLength:v,onInput(e){h(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||g||(e.preventDefault(),c?b():y())},value:d}),m&&Pf("div",{className:"validation-hint",children:m})]}),Pf(Hf,{text:e.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:a,onBack:l})]})}function Kf({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,canGoBack:r,onBack:o}){return Pf(S_,{children:[Pf("div",{className:"question-container",children:Pf(Wf,{question:e,forceDisableHtml:t})}),Pf(Hf,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>s("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:r,onBack:o})]})}function Zf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;const u=e.scale,d=10===e.scale?0:1,[h,p]=X_(()=>Rt(o)?o:kt(o)&&o.length>0&&Rt(parseInt(o[0]))?parseInt(o[0]):Tt(o)&&Rt(parseInt(o))?parseInt(o):null),_="emoji"===e.display&&2===e.scale,{isPreviewMode:g}=yf(),f=e=>g?r(e):n(e);return Pf(S_,{children:[Pf("div",{className:"question-container",children:[Pf(Wf,{question:e,forceDisableHtml:t}),Pf("div",{className:"rating-section",children:[Pf("div",{className:"rating-options",children:["emoji"===e.display&&Pf("div",{className:"rating-options-emoji"+(_?" rating-options-emoji-2":""),children:null===(c=iv[e.scale])||void 0===c?void 0:c.map((t,s)=>Pf("button",{"aria-label":`Rate ${s+1}`,className:`ratings-emoji question-${i}-rating-${s} ${s+1===h?"rating-active":""}`,value:s+1,type:"button",onClick(){const t=s+1;p(t),e.skipSubmitButton&&f(t)},children:t},s))}),"number"===e.display&&Pf("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${u-d+1}, minmax(0, 1fr))`},children:sv(e.scale).map((t,n)=>Pf(Jf,{displayQuestionIndex:i,active:h===t,appearance:s,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&f(t)}},n))})]}),!_&&Pf("div",{className:"rating-text",children:[Pf("div",{children:e.lowerBoundLabel}),Pf("div",{children:e.upperBoundLabel})]})]})]}),Pf(Hf,{text:e.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:Pt(h)&&!e.optional,appearance:s,onSubmit:()=>n(h),onPreviewSubmit:()=>r(h),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function Jf({num:e,active:t,displayQuestionIndex:i,setActiveNumber:s}){return Pf("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){s(e)},children:e})}function Xf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const c=eg(null),u=tg(()=>(e=>{if(!e.shuffleOptions)return e.choices;const t=e.choices;let i="";e.hasOpenChoice&&(i=t.pop());const s=_f(t,pf(t));return e.hasOpenChoice&&(e.choices.push(i),s.push(i)),s})(e),[e]),[d,h]=X_(()=>((e,t)=>Tt(e)||Gf(e)?e:t===Cg?null:[])(o,e.type)),[p,_]=X_(()=>((e,t)=>{if(Tt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(Gf(e)){const i=e.find(e=>!t.includes(e));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,u)),{isPreviewMode:g}=yf(),f=e.type===Cg,v=e.type===kg,m=e.skipSubmitButton&&f&&!e.hasOpenChoice,y=(e,t)=>{if(t){const e=!p.isSelected;return _(t=>ct(ct({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),f&&h(""),void(e&&setTimeout(()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()},75))}if(f)return h(e),_(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),void(m&&(n(e),g&&r(e)));v&&kt(d)&&(d.includes(e)?h(d.filter(t=>t!==e)):h([...d,e]))},b=e=>{e.stopPropagation();const t=e.currentTarget.value;_(e=>ct(ct({},e),{},{inputValue:t})),f&&h(t)},S=e=>{e.stopPropagation(),"Enter"!==e.key||w()||(e.preventDefault(),k()),"Escape"===e.key&&(e.preventDefault(),_(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),f&&h(null))},w=()=>!(e.optional||!Pt(d)&&(!kt(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),k=()=>{p.isSelected&&v?kt(d)&&(g?r([...d,p.inputValue]):n([...d,p.inputValue])):g?r(d):n(d)};return Pf(S_,{children:[Pf("div",{className:"question-container",children:[Pf(Wf,{question:e,forceDisableHtml:t}),Pf("fieldset",{className:"multiple-choice-options limit-height",children:[Pf("legend",{className:"sr-only",children:v?" Select all that apply":" Select one"}),u.map((t,s)=>{const n=!!e.hasOpenChoice&&s===e.choices.length-1,r=`surveyQuestion${i}Choice${s}`,o=`${r}Open`,a=n?p.isSelected:f?d===t:kt(d)&&d.includes(t);return Pf("label",{className:n?"choice-option-open":"",children:[Pf("div",{className:"response-choice",children:[Pf("input",{type:f?"radio":"checkbox",name:r,checked:a,onChange:()=>y(t,n),id:r,"aria-controls":o}),Pf("span",{children:n?`${t}:`:t})]}),n&&Pf("input",{type:"text",ref:c,id:o,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:b,onClick(e){p.isSelected||y(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},s)})]})]}),Pf(Hf,{text:e.buttonText||"Submit",submitDisabled:w(),appearance:s,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}const Yf=[1,2,3,4,5],ev=[1,2,3,4,5,6,7],tv=[0,1,2,3,4,5,6,7,8,9,10],iv={2:[$f,Df],3:[Lf,Rf,Ff],5:[Af,Lf,Rf,Ff,Of]};function sv(e){switch(e){case 5:default:return Yf;case 7:return ev;case 10:return tv}}const nv=Gn("[Surveys]");function rv(e,t,i){var s;const n=e.questions[t],r=t+1;if(!(null===(s=n.branching)||void 0===s?void 0:s.type))return t===e.questions.length-1?Ig:r;if(n.branching.type===Ig)return Ig;if("specific_question"===n.branching.type){if(Number.isInteger(n.branching.index))return n.branching.index}else if("response_based"===n.branching.type){if(n.type===Cg){var o;let e=n.choices.indexOf(`${i}`);if(-1===e&&n.hasOpenChoice&&(e=n.choices.length-1),null===(o=n.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===Ig?Ig:r}}else if(n.type===xg){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,n.scale);if(null===(a=n.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===Ig?Ig:r}}return r}return nv.warn("Falling back to next question index due to unexpected branching type"),r}const ov=Gn("[SurveyTranslations]");function av(e,t){const i=function(e){return function({overrideLanguage:e,storedPersonProperties:t,locale:i},s){const n=ol(e);if(n)return null==s||s.info(`Using override display language: ${n}`),n;const r=function(e){return e&&"object"==typeof e&&"language"in e?ol(e.language):null}(t);if(r)return null==s||s.info(`Using person property language: ${r}`),r;const o=ol(i);return o?(null==s||s.info(`Using detected locale: ${o}`),o):(null==s||s.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Ct(e.get_property)?e.get_property(ae):void 0,locale:Rl()},ov)}(t);if(!i)return ov.info("No user language detected"),{survey:e,language:null};const s=ul(e,i,ov);return{survey:s.survey,language:s.matchedKey}}const lv=e,cv=s,uv="ph:show_survey_widget",dv="PHWidgetSurveyClickListener";function hv(e,t){try{const i=e.getBoundingClientRect(),s=lv.innerHeight,n=lv.innerWidth;let r=i.left+i.width/2-t/2;r+t>n-20&&(r=n-t-20),20>r&&(r=20);const o=s-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?s-i.top+12+"px":"auto",zIndex:nf.zIndex}}catch(e){return Wg.warn("Failed to calculate trigger position:",e),null}}var pv=class{constructor(e){this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this._loggedFeatureFlagsDisabledWarning=!1,this.handlePageUnload=()=>{const e=this._posthog.get_property(ue);if(e)for(const t of e)xf(t)&&hf(t,this._posthog)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:i=!1}={})=>{var s,n,r,o,a,l;if(!Ug(this._posthog))return;const{survey:c,language:u}=this._translateSurveyForRendering(e);this._currentLanguage=u,this._surveyPopupProps=null,this._displayOptions=t;const d=this._applyDisplayOverrides(c,t);this._clearSurveyTimeout(d.id);const{properties:h,initialResponses:p}=null!=t?t:{},_=!(!p||0>=Object.keys(p).length)&&this._handleInitialResponses(d,p,h,u);if(_&&!(null===(s=d.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this._addSurveyToFocus(d);let g={};if((null===(n=d.appearance)||void 0===n?void 0:n.position)===mg&&(null===(r=d.appearance)||void 0===r?void 0:r.widgetSelector)){const e=cv.querySelector(d.appearance.widgetSelector);var f;e&&(g=hv(e,parseInt((null===(f=d.appearance)||void 0===f?void 0:f.maxWidth)||nf.maxWidth))||{})}const v=(null===(o=d.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:m}=lf(d,this._posthog);this._renderedTargets.set(m,m.host);const y={posthog:this._posthog,survey:d,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:h,style:g,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:u};if(this._surveyPopupProps=y,0>=v)return this._surveyIsRendered=!0,H_(Pf(mv,ct({},y)),m);const b=()=>{this._surveyIsRendered=!0;const{survey:i,language:s}=this._translateSurveyForRendering(e);this._currentLanguage=s;const n=this._applyDisplayOverrides(i,t),r=ct(ct({},y),{},{survey:n,surveyLanguage:s});this._surveyPopupProps=r,H_(Pf(mv,ct(ct({},r),{},{survey:ct(ct({},n),{},{appearance:ct(ct({},n.appearance),{},{surveyPopupDelaySeconds:0})})})),m)},S=()=>{if(!Ug(this._posthog)||!this._shouldDisplaySurvey(d))return Wg.info(`Survey ${d.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(d);b()},w=i?null===(a=this._posthog.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(l=a.getActivationTimestamp)||void 0===l?void 0:l.call(a,d.id):void 0,k=Rt(w)?Math.max(0,Date.now()-w):0,C=Math.max(0,1e3*v-k);if(0>=C)return S();const x=lv.setTimeout(()=>{this._surveyTimeouts.delete(d.id),S()},C);this._surveyTimeouts.set(d.id,x)},this._handleWidget=e=>{var t;const{survey:i,language:s}=this._translateSurveyForRendering(e),{shadow:n,isNewlyCreated:r}=lf(i,this._posthog);this._renderedTargets.set(n,n.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===_g&&this._renderedTabWidgets.set(e.id,e),r&&H_(Pf(bv,{posthog:this._posthog,survey:i,surveyLanguage:s},e.id),n)},this._detachWidgetSelectorListener=e=>{const t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(dv),this._widgetSelectorListeners.delete(e),Wg.info(`Removed click listener for survey ${e}`))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._removeTabWidget=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._renderedTabWidgets.delete(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;const i=cv.querySelector(Ef(e,!0));return!!(null==i||null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{const i=cv.querySelector(t),s=this._widgetSelectorListeners.get(e.id);if(i){if(this._handleWidget(e),s){if(i===s.element)return;Wg.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(e.id)}if(!i.hasAttribute(dv)){const t=t=>{var i,s;t.stopPropagation();const n=(null===(i=e.appearance)||void 0===i?void 0:i.position)===mg?hv(t.currentTarget,parseInt((null===(s=e.appearance)||void 0===s?void 0:s.maxWidth)||nf.maxWidth)):{};lv.dispatchEvent(new CustomEvent(uv,{detail:{surveyId:e.id,position:n}}))};sr(i,"click",t),i.setAttribute(dv,"true"),this._widgetSelectorListeners.set(e.id,{element:i,listener:t,survey:e}),Wg.info(`Attached click listener for feedback button survey ${e.id}`)}}else s&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{if(!Ug(this._posthog))return;const{survey:t,language:i}=this._translateSurveyForRendering(e),{shadow:s}=lf(t,this._posthog);this._renderedTargets.set(s,s.host),H_(Pf(mv,{posthog:this._posthog,survey:t,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,i)=>{var s;if(!Ug(this._posthog))return;const{survey:n,language:r}=this._translateSurveyForRendering(e);let o=!1;(null===(s=this._posthog.config)||void 0===s||null===(s=s.surveys)||void 0===s?void 0:s.prefillFromUrl)&&(o=this._handleUrlPrefill(n,r,i)),H_(Pf(mv,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(t=>{e(t.filter(e=>this._shouldDisplaySurvey(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{const t=Ug(this._posthog),i=e.filter(e=>t&&(e.type===yg||e.type===bg)),s=new Set(i.map(e=>e.id));for(const e of Array.from(this._surveyTimeouts.keys()))s.has(e)||this.cancelSurvey(e);const n=this._sortSurveysByAppearanceDelay(i),r=new Set,o=new Set;n.forEach(e=>{if(e.type===bg){var t,i,s,n;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===_g)return o.add(e.id),void this._handleWidget(e);"selector"===(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)&&(null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector)&&(r.add(e.id),this._manageWidgetSelectorListener(e,null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector))}Pt(this._surveyInFocus)&&e.type===yg&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:e})=>{r.has(e.id)||this._removeWidgetSelectorListener(e)}),this._renderedTabWidgets.forEach((e,t)=>{o.has(t)||this._removeTabWidget(e)})},e)},this._addSurveyToFocus=e=>{Pt(this._surveyInFocus)||Wg.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${e.id}.`),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&Wg.error(`Survey ${e.id} is not in focus. Cannot remove survey ${e.id}.`),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),sr(lv,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){if(Pt(this._surveyInFocus))return;const e=this._posthog.get_property(ue),t=null==e?void 0:e.find(e=>e.id===this._surveyInFocus);if(!t)return;const{survey:i,language:s}=this._translateSurveyForRendering(t);if(s===this._currentLanguage)return;if(this._currentLanguage=s,!this._surveyIsRendered)return;const n=this._applyDisplayOverrides(i,this._displayOptions),{shadow:r}=lf(n,this._posthog);H_(Pf(mv,ct(ct({},this._surveyPopupProps),{},{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),r)}get _featureFlags(){var e,t,i;return null!==(e=null===(t=(i=this._posthog).getExtension)||void 0===t?void 0:t.call(i,"featureFlags"))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?ct(ct({},e),{},{appearance:ct(ct(ct({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){const t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(Wg.info(`Cancelled pending survey ${e}`),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null===(e=this._automaticDisplayDispose)||void 0===e||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(lv.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach((e,t)=>this._clearSurveyTimeout(t)),this._widgetSelectorListeners.forEach((e,t)=>this._detachWidgetSelectorListener(t)),this._renderedTargets.forEach((e,t)=>{H_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var i,s;const n=xf(e),r=xf(t);if(n&&!r)return-1;if(!n&&r)return 1;const o=e.schedule===Eg,a=t.schedule===Eg;return o&&!a?1:!o&&a?-1:((null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(s=t.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return av(e,this._posthog)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;const{params:s}=function(e){const t={};let i=!1;const s=e.replace(/^\?/,"");if(!s)return{params:t,autoSubmit:i};const n=s.split("&");for(const e of n){const[s,n]=e.split("=");if(!s||Et(n))continue;const r=decodeURIComponent(s),o=decodeURIComponent(n);if("auto_submit"===r&&"true"===o){i=!0;continue}const a=r.match(/^q(\d+)$/);if(a){const e=parseInt(a[1],10);t[e]||(t[e]=[]),t[e].push(o)}}return{params:t,autoSubmit:i}}(lv.location.search);if(0===Object.keys(s).length)return!1;Wg.info("[Survey Prefill] Detected URL prefill parameters");const n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,i,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,s){const{responses:n,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&cf({responses:o?n:a,survey:e,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:s})}_handleInitialResponses(e,t,i,s){const n={};for(const[e,i]of Object.entries(t))n[parseInt(e)]=kt(i)?i.map(String):[String(i)];Wg.info("[Survey] Processing initial responses");const r=this._processPrefillData(e,n,s);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,s),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{const s=function(e,t){const i={};return e.questions.forEach((e,s)=>{if(!t[s]||!e.id)return;const n=t[s],r=tl(e.id);try{switch(e.type){case Cg:{if(!e.choices||0===e.choices.length)return void Vn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=parseInt(n[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void Vn.warn(`[Survey Prefill] Invalid choice index for q${s}: ${n[0]}`);i[r]=e.choices[t];break}case kg:{if(!e.choices||0===e.choices.length)return void Vn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=n.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void Vn.warn(`[Survey Prefill] No valid choices for q${s}`);const o=[...new Set(t.map(t=>e.choices[t]))];t.length>o.length&&Vn.warn(`[Survey Prefill] Removed duplicate choices for q${s}`),i[r]=o;break}case xg:{const t=parseInt(n[0],10),o=e.scale||10;if(isNaN(t)||0>t||t>o)return void Vn.warn(`[Survey Prefill] Invalid rating for q${s}: ${n[0]} (scale: 0-${o})`);i[r]=t;break}default:Vn.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){Vn.error(`[Survey Prefill] Error converting q${s}:`,e)}}),i}(e,t);if(0===Object.keys(s).length)return Wg.warn("[Survey Prefill] No valid responses after conversion"),null;const n=Pa(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(e,t,i){let s=0;const n={},r=[],o=e.questions.length+1;let a=0;for(;e.questions.length>s&&o>a&&(a++,t.includes(s));){const t=e.questions[s];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=tl(t.id);Et(i[e])||(n[e]=i[e])}r.push(s);const o=rv(e,s,t.id?i[tl(t.id)]:null);if(o===Ig)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:r};s=o}return{startQuestionIndex:s,skippedResponses:n,skippedIndices:r}}(e,Object.keys(t).map(e=>parseInt(e,10)),s),l=r>=e.questions.length;return kf(e,{surveySubmissionId:n,responses:s,lastQuestionIndex:r,questionOrder:gf(e.questions),visitedIndices:a,surveyLanguage:i}),Wg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:s,submissionId:n,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(e){return Wg.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t=void 0){if(!e)return!0;const i=this._featureFlags,s=!!(null==i?void 0:i.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let n=!0;t&&(n=(null==i?void 0:i.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const r=s&&n;return r||this._warnIfFeatureFlagsDisabled(e),r}_warnIfFeatureFlagsDisabled(e){var t;!this._loggedFeatureFlagsDisabledWarning&&(null===(t=this._posthog.config)||void 0===t?void 0:t.advanced_disable_feature_flags)&&(this._loggedFeatureFlagsDisabledWarning=!0,Wg.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}_isSurveyConditionMatched(t){return!t.conditions||Sf(t,this._posthog)&&function(t){var s,n;return function(t,s){var n,r,o;if(!t||0===t.length)return!0;if(!c)return!1;const a=Zi(c,{userAgentDataPlatform:null==i||null===(n=i.userAgentData)||void 0===n?void 0:n.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==e||null===(r=e.screen)||void 0===r?void 0:r.width,screenHeight:null==e||null===(o=e.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return gl[null!=s?s:"icontains"](t,[a])}(null===(s=t.conditions)||void 0===s?void 0:s.deviceTypes,null===(n=t.conditions)||void 0===n?void 0:n.deviceTypesMatchType)}(t)&&function(e){var t;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null==tf?void 0:tf.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return vf(e)?{satisfied:!0}:e.internal_targeting_flag_key&&function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)&&!(null===(t=this._featureFlags)||void 0===t?void 0:t.hasLoadedFlags)?(this._warnIfFeatureFlagsDisabled(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;const s={eligible:!0,reason:void 0};if(!jg(e))return s.eligible=!1,s.reason=`Survey is not running. It was completed on ${e.end_date}`,s;if(!Zg.includes(e.type))return s.eligible=!1,s.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,s;const n=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return s.eligible=!1,s.reason=n?`Survey linked feature flag is not enabled for variant ${n}`:"Survey linked feature flag is not enabled",s;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return s.eligible=!1,s.reason="Survey targeting feature flag is not enabled",s;const r=this._internalFlagCheckSatisfied(e);var o;return r.satisfied?function(e,t){if(!e||!t)return!0;const i="string"==typeof t?new Date(t):t,s=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(s/864e5)>e}(null===(i=e.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Da._get("lastSeenSurveyDate"))?(e=>!!Da._get(Qg(e))&&!vf(e))(e)?(s.eligible=!1,s.reason="Survey has already been seen and it can't be activated again",s):s:(s.eligible=!1,s.reason="Survey wait period has not passed",s):(s.eligible=!1,s.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",s)}checkSurveyCaptureEligibility(){return Ug(this._posthog)?{eligible:!0}:{eligible:!1,reason:zg}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!dl(e)&&!Vg(e))return!0;const i=null===(t=this._posthog.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==i?void 0:i.includes(e.id))}_checkFlags(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this._isSurveyFeatureFlagEnabled(t))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{const t=cv.querySelector(Ef(e,!0));(null==t?void 0:t.shadowRoot)&&(H_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){Wg.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function _v(e,t){if(!cv||!lv)return;const i=new pv(e);if(e.config.disable_surveys_automatic_display)return Wg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return Wg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let s;i.callSurveysAndEvaluateDisplayLogic(!0);const n=()=>{Et(s)&&(s=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Et(s)||(clearInterval(s),s=void 0)};n();const o=()=>{cv.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return sr(cv,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),cv.removeEventListener("visibilitychange",o)}),i}function gv({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:s=!1,posthog:n}){Y_(()=>{var r;if(s||!(null===(r=e.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var s;const r=e.type===bg,o=Sf(e,n),a=(null===(s=e.appearance)||void 0===s?void 0:s.widgetType)===_g&&r;if(!o)return Wg.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);a&&(Wg.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};sr(lv,"popstate",o),sr(lv,"hashchange",o);const a=lv.history.pushState,l=lv.history.replaceState;return lv.history.pushState=function(...e){a.apply(this,e),o()},lv.history.replaceState=function(...e){l.apply(this,e),o()},()=>{lv.removeEventListener("popstate",o),lv.removeEventListener("hashchange",o),lv.history.pushState=a,lv.history.replaceState=l}},[s,e,t,i,n])}const fv=200;function vv(e="right"){switch(e){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function mv({survey:e,forceDisableHtml:t,posthog:i,style:s={},previewPageIndex:n,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:u=()=>{},properties:d,isSurveyCompleted:h,skipShownEvent:p,surveyLanguage:_}){var g,f,v,m,y,b,S,w,k,C,x,I;const E=eg(null),T=Number.isInteger(n),{isPopupVisible:M,isSurveySent:P,hidePopupWithAnimation:F}=function(e,t,i,s,n,r,o,a,l){const[c,u]=X_(s||0===i||e.type===Sg),[d,h]=X_(!1),p=eg(!1),_=()=>{const t=()=>{r&&n(e),u(!1)};if(p.current)return;const i=null==o?void 0:o.current;i?(p.current=!0,i.style.transition=`opacity ${fv}ms ease-out`,i.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},g=t=>{t.detail.surveyId===e.id&&_()};return Y_(()=>{if(!t)return void Wg.error("usePopupVisibility hook called without a PostHog instance.");if(s)return;let n;const r=t=>{var i,s;if(t.detail.surveyId===e.id){if(!(null===(i=e.appearance)||void 0===i?void 0:i.displayThankYouMessage))return _();h(!0),(null===(s=e.appearance)||void 0===s?void 0:s.autoDisappear)&&(n&&clearTimeout(n),n=setTimeout(_,5e3))}},o=()=>{if(Sf(e,t)){var i;u(!0),lv.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(Tg,ct(ct({[Rg]:e.name,[Fg]:e.id,[Lg]:e.current_iteration,[Ag]:e.current_iteration_start_date},l&&{[Bg]:l}),{},{sessionRecordingUrl:null===(i=t.get_session_replay_url)||void 0===i?void 0:i.call(t)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};sr(lv,"PHSurveyClosed",g),sr(lv,"PHSurveySent",r);const c=i>0?setTimeout(o,i):void 0;return Et(c)&&o(),()=>{Et(c)||clearTimeout(c),Et(n)||clearTimeout(n),lv.removeEventListener("PHSurveyClosed",g),lv.removeEventListener("PHSurveySent",r)}},[]),gv({survey:e,removeSurveyFromFocus:n,setSurveyVisible:u,isPreviewMode:s,posthog:t}),{isPopupVisible:c,isSurveySent:d,setIsPopupVisible:u,hidePopupWithAnimation:_}}(e,i,(null===(g=e.appearance)||void 0===g?void 0:g.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,T,r,o,E,p,_),R=P||n===e.questions.length||!0===h,[L,A]=X_(!1),O=tg(()=>!!Cf(e),[e]),D=!(!(null===(f=e.appearance)||void 0===f?void 0:f.introScreenHeader)&&!(null===(v=e.appearance)||void 0===v?void 0:v.introScreenDescription)),N=T?-1===n:!!(null===(m=e.appearance)||void 0===m?void 0:m.displayIntroScreen)&&D&&!L&&!O,B=tg(()=>{const t=Cf(e),s=(null==t?void 0:t.surveySubmissionId)||Pa();return{isPreviewMode:T,previewPageIndex:n,onPopupSurveyDismissed(){_?df(e,i,T,_):df(e,i,T),c()},isPopup:o||!1,surveySubmissionId:s,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:d,surveyLanguage:_}},[T,n,o,i,e,c,a,l,d,_]);return M?Pf(mf.Provider,{value:B,children:Pf("div",{className:"ph-survey",style:ct(ct({},Tf(e.type,null===(y=e.appearance)||void 0===y?void 0:y.position,null===(b=e.appearance)||void 0===b?void 0:b.widgetType)),s),ref:E,children:R?Pf(jf,{header:(null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageHeader)||"Thank you!",description:(null===(w=e.appearance)||void 0===w?void 0:w.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||nf,onClose(){F(),u()}}):N?Pf(Vf,{header:(null===(C=e.appearance)||void 0===C?void 0:C.introScreenHeader)||"",description:(null===(x=e.appearance)||void 0===x?void 0:x.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(I=e.appearance)||void 0===I?void 0:I.introScreenDescriptionContentType,appearance:e.appearance||nf,onStart:()=>A(!0)}):Pf(yv,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function yv({survey:e,forceDisableHtml:t,posthog:i}){var s,n;const r=tg(()=>{const t=Cf(e);if(!t)return null;const i=Rt(t.lastQuestionIndex);return!i||i&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(If(e),null)},[e]),[o,a]=X_(()=>((null==r?void 0:r.responses)&&Wg.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,c]=X_(!1),{previewPageIndex:u,onPopupSurveyDismissed:d,isPopup:h,onPreviewSubmit:p,onPreviewBack:_,surveySubmissionId:g,isPreviewMode:f,properties:v,surveyLanguage:m}=ig(mf),[y,b]=X_(()=>{const t=null==r?void 0:r.lastQuestionIndex,i=Rt(t)&&t>=0&&e.questions.length>t?t:0;return Rt(u)&&u>=0?u:i}),[S,w]=X_(()=>{var t;return(null!==(t=null==r?void 0:r.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[k,C]=X_(()=>{var t;const i=Cf(e);return null!==(t=null==i?void 0:i.questionSnapshots)&&void 0!==t?t:{}}),x=tg(()=>gf(ff(e,r)),[e.id,r]),I=tg(()=>{if(!x||new Set(x).size!==x.length)return ff(e,r);const t=new Map(e.questions.map(e=>[e.id,e])),i=x.map(e=>t.get(e)).filter(e=>!!e);return i.length===x.length?i:e.questions},[x,e.questions,e,r]);Y_(()=>{!f||Et(u)||0>u||b(u)},[u,f]);const E=!!(null===(s=e.appearance)||void 0===s?void 0:s.allowGoBack)&&(f?(null!=u?u:0)>0:S.length>0),T=I.at(y);return T?Pf("form",{className:"survey-form",name:"surveyForm",children:[h&&!0!==(null===(n=e.appearance)||void 0===n?void 0:n.hideCancelButton)&&Pf(zf,{onClick(){d()}}),Pf("div",{className:"survey-box","data-question-index":y,children:[l&&Pf("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Sv({question:T,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||nf,onSubmit:t=>(({res:t,displayQuestionIndex:s,questionId:n})=>{if(!i)return void Wg.error("onNextButtonClick called without a PostHog instance.");if(!Ug(i))return void c(!0);if(c(!1),!n)return void Wg.error("onNextButtonClick called without a questionId.");const r=tl(n),l=ct(ct({},o),{},{[r]:t});a(l);const u=I[s],d=(null==u?void 0:u.id)?ct(ct({},k),{},{[u.id]:u.question}):k;C(d);const h=rv(e,s,t),p=h===Ig,_=[...S,s];if(p||(w(_),b(h),kf(e,{surveySubmissionId:g,responses:l,lastQuestionIndex:h,questionOrder:gf(I),visitedIndices:_,surveyLanguage:m,questionSnapshots:d})),e.enable_partial_responses||p){const t=new Set(_.map(e=>{var t;return null===(t=I[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>tl(e))),s=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));cf({responses:s,survey:e,surveySubmissionId:g,isSurveyCompleted:p,posthog:i,properties:v,surveyLanguage:m,questionSnapshots:d})}})({res:t,displayQuestionIndex:y,questionId:T.id}),onPreviewSubmit:p,initialValue:T.id?o[tl(T.id)]:void 0,canGoBack:E,onBack(){if(f)return void _();if(0===S.length)return;const t=S[S.length-1],i=S.slice(0,-1);w(i),b(t),kf(e,{surveySubmissionId:g,responses:o,lastQuestionIndex:t,questionOrder:gf(I),visitedIndices:i,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function bv({survey:e,forceDisableHtml:t,posthog:i,readOnly:s,surveyLanguage:n}){var r,o,a,l,c,u,d;const[h,p]=X_(!0),[_,g]=X_(!1),[f,v]=X_({}),m=eg(void 0),y=()=>{(_||!i||s||Ug(i))&&g(!_)};if(Y_(()=>{var t;if(!i)return void Wg.error("FeedbackWidget called without a PostHog instance.");if(s)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&v({top:"50%",bottom:"auto"});const n=t=>{var i;const s=t;(null===(i=s.detail)||void 0===i?void 0:i.surveyId)===e.id&&(Wg.info(`Received show event for feedback button survey ${e.id}`),v(s.detail.position||{}),y())};return sr(lv,uv,n),()=>{Et(m.current)||(clearTimeout(m.current),m.current=void 0),lv.removeEventListener(uv,n)}},[i,s,e.id,null===(r=e.appearance)||void 0===r?void 0:r.widgetType,null===(o=e.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=e.appearance)||void 0===a?void 0:a.borderColor]),gv({survey:e,setSurveyVisible:p,posthog:i}),!h)return null;const b=()=>{e.schedule!==Eg&&p(!1),Et(m.current)||clearTimeout(m.current),m.current=setTimeout(()=>{m.current=void 0,g(!1)},200)};return Pf(S_,{children:["tab"===(null===(l=e.appearance)||void 0===l?void 0:l.widgetType)&&Pf("button",{className:"ph-survey-widget-tab "+("top"===(null===(c=e.appearance)||void 0===c?void 0:c.tabPosition)?"widget-tab-top":""),onClick:y,disabled:s,style:vv(null===(u=e.appearance)||void 0===u?void 0:u.tabPosition),children:(null===(d=e.appearance)||void 0===d?void 0:d.widgetLabel)||""}),_&&Pf(mv,{posthog:i,survey:e,forceDisableHtml:t,style:f,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:n})]})}const Sv=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const c={forceDisableHtml:t,appearance:s,onPreviewSubmit(e){r(e)},onSubmit(e){n(e)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case wg:return y_(Qf,ct(ct({},c),{},{question:e,key:e.id}));case"link":return y_(Kf,ct(ct({},c),{},{question:e,key:e.id}));case xg:return y_(Zf,ct(ct({},c),{},{question:e,key:e.id}));case Cg:case kg:return y_(Xf,ct(ct({},c),{},{question:e,key:e.id}));default:return Wg.error(`Unsupported question type: ${e.type}`),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=_v,h.extendPostHogWithSurveys=_v;const wv=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},kv=1e4,Cv=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),xv=(e,t,i)=>{const s=JSON.stringify(e);if(i.remaining>=s.length)return Cv(t,s,i);if(i.truncated=!0,2>i.remaining)return!1;let n=0,r=Math.min(e.length,i.remaining-2);for(;r>n;){const t=Math.ceil((n+r)/2);JSON.stringify(e.slice(0,t)).length>i.remaining?r=t-1:n=t}return Cv(t,JSON.stringify(e.slice(0,n)),i)},Iv=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Ev=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},Tv=(e,t,i)=>{if(!i.truncated)if(xt(e)){if(i.seen.has(e))return void Ev(t||"circular","[Circular]",i);i.seen.add(e);try{for(const s in e)try{if(!{}.hasOwnProperty.call(e,s))continue;if(Tv(e[s],t?`${t}.${s}`:s,i),i.truncated)return}catch(e){continue}}catch(e){}}else Ev(t,e,i)},Mv=(e,t,i,s,n=!1,r)=>{if(!Iv(e))return!n||Cv(t,"null",i);if(Pt(e)||(e=>{try{return Rt(e)||At(e)}catch(e){return!1}})(e))return Cv(t,JSON.stringify(e),i);if("string"==typeof e)return xv(e,t,i);if(!xt(e)&&!kt(e))return Cv(t,JSON.stringify(e),i);if(s.has(e))return xv("[Circular]",t,i);s.add(e);try{const r=e.toJSON;if(Ct(r))return Mv(r.call(e),t,i,s,n)}catch(e){}try{const s={}.toString.call(e);if("[object String]"===s)return xv(String(e.valueOf()),t,i);if("[object Number]"===s||"[object Boolean]"===s)return Cv(t,JSON.stringify(e.valueOf()),i)}catch(e){}if(e instanceof Error){const o={};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t])}catch(e){}try{o.name=e.name}catch(e){}try{o.message=e.message}catch(e){}try{o.stack=e.stack}catch(e){}return Mv(o,t,i,s,n,r)}if(kt(e)){if(!Cv(t,"[",i))return!1;for(let n=0;e.length>n;n++){if(n>0&&!Cv(t,",",i))return!1;let r;try{r=e[n]}catch(e){r=void 0}if(!Mv(r,t,i,s,!0))return!1}return Cv(t,"]",i)}if(!Cv(t,"{",i))return!1;let o=!0;try{for(const n in e){if(!{}.hasOwnProperty.call(e,n))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=e[n]}catch(e){continue}if(r)try{Tv(a,n,r)}catch(e){}if(!Iv(a))continue;const l=`${o?"":","}${JSON.stringify(n)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const c=t.length,u=i.remaining,d=i.truncated;if(!Cv(t,l,i))return!1;const h=t.length,p=Mv(a,t,i,s,!1),_=i.truncated;if(t.length!==h){if(o=!1,!p)return!1}else if(t.length=c,i.remaining=u,i.truncated=p?d:_,!p)return!1}}catch(e){}return Cv(t,"}",i)},Pv=(e,t)=>{const i=[],s={remaining:t,truncated:!1},n=xt(e[0])?{result:{},keysRemaining:50,sizeRemaining:kv,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let t=0;e.length>t&&(0>=t||Cv(i," ",s))&&Mv(e[t],i,s,new WeakSet,!1,0===t?n:void 0);t++);return{body:i.join("")+(s.truncated?"...":""),truncated:s.truncated,attributes:(null==n?void 0:n.result)||{}}},Fv={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Rv=e=>"canCapture"in e,Lv=e=>Rv(e)?e.canCapture?e.getExtension(Xg):void 0:e.is_capturing()?e.logs:void 0,Av=(e,t,i)=>{if(Rv(e))return void t.captureConsoleLog(i);const s=(e=>{const t=/^1\.(\d+)\.(\d+)$/.exec(e);if(!t)return;const i=Number(t[1]),s=Number(t[2]);return 392>i||i>419?void 0:410===i?s>4?s>10?void 0:"de":"le":418===i?s>3?s>10?s>14?s>17?void 0:"vi":"ci":"ui":"he":419===i?s>2?void 0:"vi":410>i?"le":"he"})(e.version),n=s?t[s]:void 0;Ct(n)&&n.call(t,i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs(e){let t=e;const i=[],s={host:h.location.host};let n=!1;for(const e of Object.keys(Fv)){const r=i=>(...r)=>{let o=!1;try{const i=t;if(r.length>0&&!n&&i){const t=Lv(i);if(t){n=!0,o=!0;const{body:a,truncated:l,attributes:c}=Pv(r,kv),u=ct(ct({},s),l?{body_truncated:"true"}:{}),d={level:Fv[e],body:a,attributes:ct(ct({"log.source":`console.${e}`},u),c)};Av(i,t,d)}}}catch(e){}finally{o&&(n=!1),i.apply(h.console,r)}},o=h.console[e];i.push(wp(h.console,e,e=>{const t=r(e);return t.__rrweb_original__=wv(o),t}))}return()=>{t=void 0,i.forEach(e=>e())}},replayConsoleBuffer(e,t){const i=Lv(e);if(i)for(const e of t)try{var s;const{body:t,truncated:n,attributes:r}=Pv(e.args,kv);null===(s=i.captureBufferedConsoleLog)||void 0===s||s.call(i,{level:Fv[e.level],body:t,attributes:ct(ct({"log.source":`console.${e.level}`,host:h.location.host},n?{body_truncated:"true"}:{}),r)},e.context,e.occurredAtMs)}catch(e){}}};const Ov=e=>qt(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),$v=Gn("[Error tracking]"),Dv="webkit-masked-url:",Nv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Bv=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Dv],qv=["__firefox__","__gCrWeb"];function Hv(){return new vs([new Ns,new Qs,new qs,new Bs,new Vs,new js,new Ws,new Gs],function(e,...t){return(i,s=0)=>{const n=[],r=i.split("\n"),o=Math.min(r.length,s+1e3),a=[];for(let i=s;o>i;i++){const s=r[i];if(s.length>1024)continue;const o=Ps.test(s)?s.replace(Ps,"$1"):s;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){n.push(t);const e=Rs(n);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if($s(n,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=As(n,c);n.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)Ls(n,e);return a.some(e=>0===e.start&&n.length===e.length)&&function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Ds(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(n),function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return ct(ct({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})}(n)}}("web:javascript",Is,Ms))}const Wv=Gn("[ExceptionAutocapture]"),zv=Hv(),Uv=(e,t)=>{try{return e()}catch(e){return t}},jv=(e,t)=>Uv(()=>e(t()),void 0),Vv=e=>Uv(()=>Ct(e)&&Ct(e.call),!1),Gv=(e,t)=>Uv(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),Qv=(e,t,i)=>{Uv(()=>{var i;null===(i=e[t])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Uv(()=>{e[t]=i},void 0)},Kv=t=>{const i=e;i||Wv.info("window not available, cannot wrap onerror");const s=Uv(()=>i.onerror,void 0);return i.onerror=function(...e){var i;return jv(t,()=>zv.buildFromUnknown((([e,t,i,s,n])=>{if(null!=n)return n;if(Tt(e)&&Tt(t)&&t.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:e,filename:t,lineno:i,colno:s})}catch(t){return e}return e})(e),{mechanism:{handled:!1}})),!!Vv(s)&&null!==(i=s(...e))&&void 0!==i&&i},Gv(i,"onerror"),()=>Qv(i,"onerror",s)},Zv=(t,i=!1)=>{const s=e;s||Wv.info("window not available, cannot wrap onUnhandledRejection");const n=Uv(()=>s.onunhandledrejection,void 0);return s.onunhandledrejection=function(e){var s;return jv(t,()=>zv.buildFromUnknown(e,{mechanism:{handled:!1}})),Vv(n)?null!==(s=n(e))&&void 0!==s&&s:i},Gv(s,"onunhandledrejection"),()=>Qv(s,"onunhandledrejection",n)},Jv={wrapOnError:Kv,wrapUnhandledRejection:Zv,wrapConsoleError(e){const t=console;t||Wv.info("console not available, cannot wrap console.error");const i=Uv(()=>t.error,void 0);return t.error=function(...t){Uv(()=>t.length>1&&Tt(t[0])&&(/^\[PostHog\.js\](?: |$)/.test(t[0])||"rrweb logger error:"===t[0]),!1)||jv(e,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(e=>e instanceof Error);return zv.buildFromUnknown(i||e,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Vv(i)&&i(...t)},Gv(t,"error"),()=>Qv(t,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=Jv,h.posthogErrorWrappingFunctions=Jv;const Xv=(e,t)=>{if(!Ct(null==e?void 0:e.capture))return;const i=null==t?void 0:t.autocaptureExceptions,s=!Pt(i)&&"object"==typeof i&&kt(i.errors_to_ignore)?i.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){Wv.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],n=t=>{try{var i;null===(i=e.capture)||void 0===i||i.call(e,"$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){Wv.error("Failed to capture exception for a legacy client",e)}};Kv(e=>{s.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||n(e)}),Zv(n,!0)};h.extendPostHogWithExceptionAutoCapture=Xv,h.extendPostHogWithExceptionAutocapture=Xv;const Yv="X-POSTHOG-SESSION-ID",em="X-POSTHOG-WINDOW-ID",tm="X-POSTHOG-DISTINCT-ID",im=[Yv,em,tm],sm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],nm=(e,t)=>({}.hasOwnProperty.call(e,t)),rm=e=>"object"==typeof e&&!Pt(e)||Ct(e),om=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),am=t=>{try{var i;return om(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null===(i=e.location)||void 0===i?void 0:i.href).toString()}catch(e){return}},lm=(e,t,i,s,n)=>{let r;try{r=new URL(s).hostname}catch(e){return!1}if(!e)return!1;if(kt(e)&&!e.includes(r))return!1;let o=!1;if(i){const{sessionId:e,windowId:t}=i.checkAndGetSessionAndWindowId(!0);n.set(Yv,e),n.set(em,t),o=!0}const a=(e=>Ct(e)?e():e)(t);return a&&"$posthog_cookieless"!==a&&(n.set(tm,a),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const cm={_patchFetch:(t,i,s)=>wp(e,"fetch",e=>function(n,r){const o=arguments.length>1?[n,r]:[n];let a=o;try{const e=am(n);if(e)if(om(n)){const e=new Request(n,r);lm(t,i,s,e.url,e.headers),a=[e]}else{const o=new Headers(rm(r)?r.headers:void 0);if(lm(t,i,s,e,o)){const e=((e,t)=>{if(Et(e)||Pt(e))return{headers:t};if(!rm(e))return;const i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const e=Object.create(i);return Object.defineProperty(e,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),e}return new Proxy({headers:t},{get:(e,t)=>nm(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>nm(e,t)||t in i,ownKeys(e){const t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach(e=>t.add(e)),sm.forEach(e=>{e in i&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){const s=Reflect.getOwnPropertyDescriptor(e,t);if(s)return s;if("string"==typeof t&&sm.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};const n=Reflect.getOwnPropertyDescriptor(i,t);return n?ct(ct({},n),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);e&&(a=[n,e])}}}catch(e){a=o}return e.apply(this,a)}),_patchXHR:(t,i,s)=>wp(e.XMLHttpRequest.prototype,"open",e=>function(n,r,o=!0,a,l){const c=this,u=new Headers,d=am(r);d&&lm(t,i,s,d,u);const h=e.call(c,n,r,o,a,l);return im.forEach(e=>{const t=u.get(e);if(t)try{c.setRequestHeader(e,t)}catch(e){}}),h})};h.__PosthogExtensions__.tracingHeadersPatchFns=cm,h.postHogTracingHeadersPatchFns=cm,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){const t=this.length;let i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){const s=this[i];if(e.call(t,s,i,this))return s}},writable:!0,enumerable:!1,configurable:!0});var um=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;const i=this.i[0],s=this.i.at(-1);this.o&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const dm=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},hm=e=>{if("loading"===document.readyState)return"loading";const t=dm();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},pm=e=>{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},_m=e=>{let t="";try{for(;9!==(null==e?void 0:e.nodeType);){var i;const s=e,n=s.id?"#"+s.id:[pm(s),...Array.from(null!==(i=s.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch(e){}return t},gm=new WeakMap;function fm(e,t){let i=gm.get(t);return i||(i=new WeakMap,gm.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}let vm=-1;const mm=()=>vm,ym=e=>{addEventListener("pageshow",t=>{t.persisted&&(vm=t.timeStamp,e(t))},!0)},bm=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Sm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},wm=()=>{var e,t;return null!==(e=null===(t=dm())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let km=-1;const Cm=new Set,xm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Im=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Cm)e();isFinite(km)||(km="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Im,!0))}},Em=(e=!1)=>{if(e&&(km=1/0),0>km){var t;const e=wm(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;km=null!=i?i:xm(),addEventListener("visibilitychange",Im,!0),addEventListener("prerenderingchange",Im,!0),ym(()=>{setTimeout(()=>{km=xm()})})}return{get firstHiddenTime(){return km},onHidden(e){Cm.add(e)}}},Tm=(e,t=-1,i,s=0,n,r,o)=>{const a=dm(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>mm()?a&&(document.prerendering||wm()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Mm=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},Pm=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Fm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Rm=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Lm=class{constructor(){this.u=void 0}};const Am=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Om=[1800,3e3],$m=(e,t={})=>{const i=Pm(t);Am(()=>{const s=fm(t,Lm),n=Em();let r,o=Tm("FCP");const a=Mm(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-wm(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=bm(e,o,Om,t.reportAllChanges),ym(i=>{o=Tm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,mm()),r=bm(e,o,Om,t.reportAllChanges),Sm(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Mm(["soft-navigation"],i=>{i.forEach(i=>{s.u&&i.navigationId&&Fm(s.u,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Tm("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=bm(e,o,Om,t.reportAllChanges),r(!0)})},t)})},Dm=[.1,.25],Nm=e=>e.find(e=>{var t;return 1===(null===(t=e.node)||void 0===t?void 0:t.nodeType)})||e[0],Bm=(e,t={})=>{const i=fm(t=Object.assign({},t),um),s=new WeakMap;i.t=e=>{var i;if(null==e||null===(i=e.sources)||void 0===i?void 0:i.length){const i=Nm(e.sources),o=null==i?void 0:i.node;if(o){var n,r;const e=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,o))&&void 0!==n?n:_m(o);s.set(i,e)}}},((e,t={})=>{const i=Em();$m(Rm(()=>{let s,n=Tm("CLS",0);const r=fm(t,um),o=(i,o,a,l,c)=>{n=Tm("CLS",0,i,o,a,l,c),r.o=0,s=bm(e,n,Dm,t.reportAllChanges)},a=(e=!1)=>{r.o>n.value&&(n.value=r.o,n.entries=r.i),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.l(t):l(t);a()},u=["layout-shift"];Pm(t)&&u.push("soft-navigation");const d=Mm(u,c);d&&(s=bm(e,n,Dm,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),ym(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,mm()),Sm(s)}),setTimeout(s))}))})(t=>{e((e=>{let t={};if(e.entries.length){var i;const n=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null==n||null===(i=n.sources)||void 0===i?void 0:i.length){const e=Nm(n.sources);e&&(t={largestShiftTarget:s.get(e),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:e,largestShiftEntry:n,loadState:hm(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},qm=(e,t={})=>{const i=fm(t=Object.assign({},t),Lm);Pm(t)&&(i.u=new Map),$m(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:hm(mm())};if("soft-navigation"!==e.navigationType){if(e.entries.length){const i=dm(),s=e.entries.at(-1);if(i){const n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:hm(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}else{var s;const n=null===(s=i.u)||void 0===s?void 0:s.get(e.navigationId);n&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:n})}return Object.assign(e,{attribution:t})})(t))},t)};let Hm=0,Wm=1/0,zm=0;const Um=e=>{for(const t of e)t.interactionId&&(Wm=Math.min(Wm,t.interactionId),zm=Math.max(zm,t.interactionId),Hm=zm?(zm-Wm)/7+1:0)};let jm;const Vm=()=>{var e;return jm?Hm:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var Gm=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Vm()-this.h}D(){this.h=Vm(),this.v.length=0,this.p.clear()}S(e){const t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if(null===(t=this.m)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.p.get(e.interactionId);if(s||10>this.v.length||e.duration>i.k){var n;if(s?e.duration>s.k?(s.entries=[e],s.k=e.duration):e.duration===s.k&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],k:e.duration},this.p.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.p.delete(t.id)}null===(n=this.M)||void 0===n||n.call(this,s)}}};const Qm=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Rm(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},Km=[200,500],Zm=(e,t={})=>{const i=fm(t=Object.assign({},t),Gm);let s=[],n=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const c=()=>{l||(Qm(u),l=!0)},u=()=>{const e=new Set(i.v.map(e=>o.get(e.entries[0]))),t=n.length-10;n=n.filter((i,s)=>s>=t||e.has(i));const a=new Set;for(const e of n){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}s=s.filter(e=>e.startTime>r||a.has(e)),l=!1};i.m=e=>{const i=e.startTime+e.duration;let s;r=Math.max(r,e.processingEnd);for(let r=n.length-1;r>=0;r--){const o=n[r];if(8>=Math.abs(i-o.renderTime)){s=o,s.startTime=Math.min(e.startTime,s.startTime),s.processingStart=Math.min(e.processingStart,s.processingStart),s.processingEnd=Math.max(e.processingEnd,s.processingEnd),t.includeProcessedEventEntries&&s.entries.push(e);break}}s||(s={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]},n.push(s)),e.interactionId&&o.set(e,s),c()},i.M=e=>{if(!a.get(e)){var i;const o=null===(i=e.entries.find(e=>e.target))||void 0===i?void 0:i.target;if(o){var s,n;const i=null!==(s=null===(n=t.generateTarget)||void 0===n?void 0:n.call(t,o))&&void 0!==s?s:_m(o);a.set(e,i)}else{var r;const t=null===(r=e.entries.find(e=>e.targetSelector))||void 0===r?void 0:r.targetSelector;t&&a.set(e,t)}}};const d=(e,t)=>{const i=[];for(const n of s)if(n.startTime+n.duration>=e){if(n.startTime>t)break;i.push(n)}return i};Mm(["long-animation-frame"],e=>{s=s.concat(e),c()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Em();Am(()=>{var s;"interactionCount"in performance||jm||(jm=Mm(["event"],Um,{durationThreshold:0}));let n,r=Tm("INP");const o=fm(t,Gm),a=(i,s,a,l,c)=>{o.D(),r=Tm("INP",-1,i,s,a,l,c),n=bm(e,r,Km,t.reportAllChanges)},l=()=>{const e=o.S(r.navigationType);e&&e.k!==r.value&&(r.value=e.k,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Qm(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.l(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];Pm(t)&&d.push("soft-navigation");const h=Mm(d,u,ct(ct({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=bm(e,r,Km,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),ym(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,mm())}))})})(t=>{e((e=>{if(0===e.entries.length){const t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:hm(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}const t=e.entries[0],s=o.get(t),n=Math.max(s.processingStart,t.startTime),r=Math.max(t.startTime+t.duration,n),l=Math.min(s.processingEnd,r),c=s.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,l),h=i.p.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:n-t.startTime,processingDuration:l-n,presentationDelay:r-l,loadState:hm(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;const i=e.interactionTime,s=e.nextPaintTime;if(!(null===(t=e.longAnimationFrameEntries)||void 0===t?void 0:t.length)||!i||!s)return;const n=e.inputDelay,r=e.processingDuration;let o,a,l=0,c=0,u=0,d=0;for(const t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(const e of t.scripts){const t=e.startTime+e.duration;if(i>t)continue;const s=t-Math.max(i,e.startTime),u=e.duration?s/e.duration*e.forcedStyleAndLayoutDuration:0;l+=s-u,c+=u,s>d&&(a=i+n>e.startTime?"input-delay":i+n+r>e.startTime?"processing-duration":"presentation-delay",o=e,d=s)}}const h=e.longAnimationFrameEntries.at(-1),p=h?h.startTime+h.duration:0;p>=i+n+r&&(u=s-p),o&&a&&(e.longestScript={entry:o,subpart:a,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=u,e.totalUnattributedDuration=s-i-l-c-u})(p),Object.assign(e,{attribution:p})})(t))},t)};var Jm=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null===(t=this.m)||void 0===t||t.call(this,e)}};const $=[2500,4e3];let Xm=50;const Ym=[];Mm(["resource"],e=>{for(const t of e)Ym.push(t),Ym.length>Xm&&Ym.shift()});const ey=(e,t={})=>{null!=(t=Object.assign({},t)).resourceBufferSize&&(Xm=t.resourceBufferSize);const i=fm(t,Jm),s=new WeakMap;Pm(t)&&(i.u=new Map),i.m=e=>{const i=e.element;if(i){var n,r;const o=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,i))&&void 0!==n?n:_m(i);s.set(e,o)}else e.id&&s.set(e,`#${e.id}`)},((e,t={})=>{let i=!1;const s=Pm(t);Am(()=>{let n,r=Em(),o=Tm("LCP");const a=fm(t,Jm),l=(s,a,l,c,u)=>{o=Tm("LCP",-1,s,a,l,c,u),n=bm(e,o,$,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=Em(!0))},c=e=>{var t;a.u&&e.navigationId&&Fm(a.u,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-wm(),0),a.l(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.l(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=Mm(d,u);if(h){n=bm(e,o,$,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;Qm(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});ym(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,mm()),n=bm(e,o,$,t.reportAllChanges),Sm(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n,r,o;const a=e.entries.at(-1),l=a.url&&(Ym.findLast(e=>e.name===a.url)||performance.getEntriesByType("resource").findLast(e=>e.name===a.url));let c;t.target=s.get(a),t.lcpEntry=a,a.url&&(t.url=a.url),l&&(t.lcpResourceEntry=l);let u=0,d=0;if("soft-navigation"!==e.navigationType?(c=dm(),u=null!==(n=null==c?void 0:c.activationStart)&&void 0!==n?n:0,d=null!==(r=null==c?void 0:c.responseStart)&&void 0!==r?r:0):(u=e.navigationStartTime||0,c=null===(o=i.u)||void 0===o?void 0:o.get(e.navigationId)),c){const i=Math.max(0,d-u),s=Math.max(i,l?(l.requestStart||l.startTime)-u:0),n=Math.min(e.value,Math.max(s,l?l.responseEnd-u:0));t=ct(ct({},t),{},{timeToFirstByte:i,resourceLoadDelay:s-i,resourceLoadDuration:n-s,elementRenderDelay:e.value-n,navigationEntry:c})}}return Object.assign(e,{attribution:t})})(t))},t)};let ty=-1;const iy=()=>ty,sy=e=>{addEventListener("pageshow",t=>{t.persisted&&(ty=t.timeStamp,e(t))},!0)},ny=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},ry=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},oy=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ay=()=>{var e,t;return null!==(e=null===(t=oy())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let ly=-1;const cy=new Set,uy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,dy=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of cy)e();isFinite(ly)||(ly="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",dy,!0))}},hy=(e=!1)=>{if(e&&(ly=1/0),0>ly){var t;const e=ay(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;ly=null!=i?i:uy(),addEventListener("visibilitychange",dy,!0),addEventListener("prerenderingchange",dy,!0),sy(()=>{setTimeout(()=>{ly=uy()})})}return{get firstHiddenTime(){return ly},onHidden(e){cy.add(e)}}},py=(e,t=-1,i,s=0,n,r,o)=>{const a=oy(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>iy()?a&&(document.prerendering||ay()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},_y=new WeakMap;function gy(e,t){let i=_y.get(t);return i||(i=new WeakMap,_y.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var fy=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;const i=this.o[0],s=this.o.at(-1);this.i&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const vy=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},my=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},yy=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},by=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Sy=class{constructor(){this.l=void 0}};const wy=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ky=[1800,3e3],Cy=(e,t={})=>{const i=my(t);wy(()=>{const s=gy(t,Sy),n=hy();let r,o=py("FCP");const a=vy(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-ay(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=ny(e,o,ky,t.reportAllChanges),sy(i=>{o=py("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,iy()),r=ny(e,o,ky,t.reportAllChanges),ry(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&vy(["soft-navigation"],i=>{i.forEach(i=>{s.l&&i.navigationId&&yy(s.l,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=py("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=ny(e,o,ky,t.reportAllChanges),r(!0)})},t)})},xy=[.1,.25],Iy=(e,t={})=>{const i=hy();Cy(by(()=>{let s,n=py("CLS",0);const r=gy(t,fy),o=(i,o,a,l,c)=>{n=py("CLS",0,i,o,a,l,c),r.i=0,s=ny(e,n,xy,t.reportAllChanges)},a=(e=!1)=>{r.i>n.value&&(n.value=r.i,n.entries=r.o),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.h(t):l(t);a()},u=["layout-shift"];my(t)&&u.push("soft-navigation");const d=vy(u,c);d&&(s=ny(e,n,xy,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),sy(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,iy()),ry(s)}),setTimeout(s))}))};let Ey=0,Ty=1/0,My=0;const Py=e=>{for(const t of e)t.interactionId&&(Ty=Math.min(Ty,t.interactionId),My=Math.max(My,t.interactionId),Ey=My?(My-Ty)/7+1:0)};let Fy;const Ry=()=>{var e;return Fy?Ey:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var Ly=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Ry()-this.u}M(){this.u=Ry(),this.v.length=0,this.m.clear()}L(e){const t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if(null===(t=this.p)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.m.get(e.interactionId);if(s||10>this.v.length||e.duration>i.P){var n;if(s?e.duration>s.P?(s.entries=[e],s.P=e.duration):e.duration===s.P&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],P:e.duration},this.m.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}null===(n=this.T)||void 0===n||n.call(this,s)}}};const Ay=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=by(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},Oy=[200,500],$y=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=hy();wy(()=>{var s;"interactionCount"in performance||Fy||(Fy=vy(["event"],Py,{durationThreshold:0}));let n,r=py("INP");const o=gy(t,Ly),a=(i,s,a,l,c)=>{o.M(),r=py("INP",-1,i,s,a,l,c),n=ny(e,r,Oy,t.reportAllChanges)},l=()=>{const e=o.L(r.navigationType);e&&e.P!==r.value&&(r.value=e.P,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Ay(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];my(t)&&d.push("soft-navigation");const h=vy(d,u,ct(ct({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=ny(e,r,Oy,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),sy(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,iy())}))})};var Dy=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null===(t=this.p)||void 0===t||t.call(this,e)}};const Ny=[2500,4e3],By=(e,t={})=>{let i=!1;const s=my(t);wy(()=>{let n,r=hy(),o=py("LCP");const a=gy(t,Dy),l=(s,a,l,c,u)=>{o=py("LCP",-1,s,a,l,c,u),n=ny(e,o,Ny,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=hy(!0))},c=e=>{var t;a.l&&e.navigationId&&yy(a.l,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-ay(),0),a.h(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.h(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=vy(d,u);if(h){n=ny(e,o,Ny,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;Ay(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});sy(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,iy()),n=ny(e,o,Ny,t.reportAllChanges),ry(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})},qy={onLCP:ey,onCLS:Bm,onFCP:qm,onINP:Zm,withoutAttribution:{onLCP:By,onCLS:Iy,onFCP:Cy,onINP:$y}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=qy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=qy,h.postHogWebVitalsCallbacks=qy;const Hy={onLCP:By,onCLS:Iy,onFCP:Cy,onINP:$y};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Hy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Hy,h.postHogWebVitalsCallbacks=Hy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Hy;const Wy={onLCP:ey,onCLS:Bm,onFCP:qm,onINP:Zm,withoutAttribution:{onLCP:By,onCLS:Iy,onFCP:Cy,onINP:$y}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Wy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Wy,h.postHogWebVitalsCallbacks=Wy;const zy={onLCP:By,onCLS:Iy,onFCP:Cy,onINP:$y};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=zy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=zy,h.postHogWebVitalsCallbacks=zy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>zy;var Uy=class{constructor(e){this.disabled=!1===e;const t=xt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const jy="$copy_autocapture",Vy=Gn("[AutoCapture]");function Gy(e,t){return t.length>e?t.slice(0,e)+"...":t}function Qy(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!vr(t));return t}function Ky(t,{e:i,maskAllElementAttributes:s,maskAllText:n,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,c;if(!vr(t))return{props:{}};const u=[t],d=new Set([t]);let h=t;for(;h.parentNode&&!mr(h,"body")&&1e3>u.length;){if(br(h.parentNode)){const e=h.parentNode.host;if(d.has(e))break;d.add(e),u.push(e),h=e;continue}if(!vr(h.parentNode))break;if(d.has(h.parentNode))break;d.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(e=>mr(e,"button")||mr(e,"a")):-1;p>0&&(n=n||u.slice(0,p+1).some(e=>!Wr(e)||zr(e)));const _=[],g={};let f,v=!1,m=!1;if(Kn(u,e=>{const t=Wr(e);if(mr(e,"a")&&!s&&!(null==r?void 0:r.includes("href"))){const i=e.getAttribute("href");v=!!(t&&i&&Jr(i))&&(a?ls(i):i)}ft(kr(e),"ph-no-capture")&&(m=!0),_.push(function(e,t,i,s,n=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};Er.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Gy(1024,Xr(e)):Gy(1024,xr(e)));const a=kr(e);t||(null==s?void 0:s.includes("class"))||0>=a.length||(o.classes=a.filter(function(e){return""!==e})),Kn(e.attributes,function(i){var r;if((!zr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&Jr(i.value)&&(!Tt(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=Sr(e).join(" ")),o["attr__"+i.name]=Gy(1024,"href"===i.name&&n?ls(e):e)}});let l=1,c=1,u=e;for(;u=Qy(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(e,s,n,r,a)),Kn(function(e){if(!Wr(e))return{};const t={};return Kn(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&Jr(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(g,t)||(g[t]=e)})}),m)return{props:{},explicitNoCapture:m};if(p>0&&(t=u[p],_.splice(0,p)),n||(_[0].$el_text=mr(t,"a")||mr(t,"button")?Xr(t):xr(t)),v){var y,b;_[0].attr__href=v;const t=null===(y=ar(v))||void 0===y?void 0:y.host,i=null==e||null===(b=e.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(f=v)}return{props:Zn((w=i.type,{$event_type:w,$ce_version:1}),o?{}:{$elements:_},{$elements_chain:(S=_,kt(S)?function(e){return e.map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)s+=`.${t.replace(/"/g,"")}`}const n=ct(ct(ct(ct({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return Jn(n).sort(([e],[t])=>function(e,t){return t>e?-1:e>t?1:0}(e,t)).forEach(([e,t])=>r[eo(e.toString())]=eo(t.toString())),s+=":",s+=Jn(r).map(([e,t])=>`${e}="${t}"`).join(""),s}).join(";")}(function(e){return e.map(e=>{var t,i;const s={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:to(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Jn(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),s})}(S)):"")},(null===(l=_[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(c=_[0])||void 0===c?void 0:c.$el_text}:{},f&&"click"===i.type?{$external_click_url:f}:{},g),target:t};var S,w}var Zy=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!Wr(e))return!0;const i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:Fr,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const e=n,t=kr(e);if(ft(t,"ph-no-capture")||ft(t,"ph-sensitive")||zr(e)||i.some(t=>Tr(e,t)))return!0;const r=n.parentNode;n=br(r)?r.host:r&&vr(r)?r:null}return!1}_trackPointer(e){if(!this.isEnabled||"pointercancel"===e.type)return void this._clearPointer();if("pointerdown"===e.type){this._clearPointer();const i=Ir(e);var t;return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&vr(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this._client)||void 0===t?void 0:t.distinctId}))}const i=this._pointerDown;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():"pointerup"===e.type&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;const i=this._pointerDown;this._clearPointer();const n=Ir(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this._client)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&n&&(mr(n,"html")||mr(n,"body"))){var r;if(i.excluded)return null;const e=null!==(r=this._refreshConfig().css_selector_ignorelist)&&void 0!==r?r:Fr;return[n,null==s?void 0:s.documentElement,null==s?void 0:s.body].some(t=>{if(!t)return!1;const i=kr(t);return ft(i,"ph-no-capture")||ft(i,"ph-sensitive")||!Wr(t)||zr(t)||e.some(e=>Tr(t,e))})?null:i.target}}constructor(e){this._configSource=e,this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new Uy(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null===(e=this._config.url_allowlist)||void 0===e?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null===(t=this._config.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){if(!this.isBrowserSupported())return void Vy.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!s)return;const t=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{if("blur"===t.type)return void this._clearPointer();if(0===t.type.indexOf("pointer"))return void this._trackPointer(t);const e="click"===t.type?this._recoverClickTarget(t):void 0;if(Pt(e))return;this._captureEvent(t,"$autocapture",e)}catch(e){Vy.error("Failed to capture event",e)}};if(sr(e,"blur",t),sr(s,"submit",t,{capture:!0}),sr(s,"change",t,{capture:!0}),sr(s,"click",t,{capture:!0}),Kn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{sr(s,e,t,{capture:!0})}),this._refreshConfig().capture_copied_text){const t=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,jy)}catch(e){Vy.error("Failed to capture clipboard event",e)}};sr(s,"copy",t,{capture:!0}),sr(s,"cut",t,{capture:!0}),sr(s,"paste",t,{capture:!0})}}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(null==e||e.removeEventListener("blur",this._domEventHandler),Kn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==s||s.removeEventListener(e,this._domEventHandler,!0)}),null==s||s.removeEventListener("submit",this._domEventHandler,!0),null==s||s.removeEventListener("change",this._domEventHandler,!0),null==s||s.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==s||s.removeEventListener("copy",this._copiedTextHandler,!0),null==s||s.removeEventListener("cut",this._copiedTextHandler,!0),null==s||s.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._disposed)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;At(i)&&(null===(s=this._client)||void 0===s||s.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e,t){var i;const n=[];return null===(i=this._elementSelectors)||void 0===i||i.forEach(i=>{const r=null==s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{e!==s&&t!==s||ft(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this._disposed)return!1;const i=null===(e=this._client)||void 0===e?void 0:e.kv.get(C),s=this._isDisabledServerSide,n=this._refreshConfig();if(!n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;const r=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(Pt(s)&&!At(i)&&!r)return!1;const o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!n.enabled&&!o}_captureEvent(t,i="$autocapture",s){if(!this.isEnabled)return void this._clearPointer();let n=s||Ir(t);yr(n)&&(n=n.parentNode||null);const r=this._compileUrlPatterns();var o;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Br(n,r.rageclick)&&this._captureEvent(t,"$rageclick",s);const a=i===jy,l=a?ct(ct({},r),{},{dom_event_allowlist:void 0}):r;if(n&&function(t,i,s,n,r,o){var a;if(!e||qr(t))return!1;if((null==s?void 0:s.url_allowlist)&&!wr(s.url_allowlist,o))return!1;if((null==s?void 0:s.url_ignorelist)&&wr(s.url_ignorelist,o))return!1;if(null==s?void 0:s.dom_event_allowlist){const e=s.dom_event_allowlist;if(e&&!e.some(e=>i.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=Hr(t,n);if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(Et(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,s))return!1;if(!Mr(c,null==s?void 0:s.css_selector_allowlist))return!1;if(Mr(c,null!==(a=null==s?void 0:s.css_selector_ignorelist)&&void 0!==a?a:Fr))return!1;try{const s=e.getComputedStyle(t);if(s&&"pointer"===s.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(e){}const u=t.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return l?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Er.indexOf(u)>-1||"true"===t.getAttribute("contenteditable"))}}(n,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:s,explicitNoCapture:o,target:a}=Ky(n,{e:t,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(n,a);if(l&&l.length>0&&(s.$element_selectors=l),i===jy){const i=t.type||"clipboard";if("paste"!==i){var u,d;const t=null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString(),i=Cr(t);if(!i)return!1;s.$selected_content=i,s.$clipboard_text_length=null!==(d=null==t?void 0:t.length)&&void 0!==d?d:0}s.$copy_type=i}return null===(c=this._client)||void 0===c||c.capture(i,s).catch(e=>Vy.error("Failed to capture event",e)),!0}}isBrowserSupported(){return Ct(null==s?void 0:s.querySelectorAll)}};const Jy={};function Xy(e,t){const i=Ir(e);return i?ct({node:i,originalEvent:e,timestamp:Date.now()},t):null}function Yy(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function eb(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}const tb="canvas,video,audio,embed,object";function ib(e,t){return Rt(e)&&e>=t}function sb(e,t=1e3){return e>=0&&t>e?e:void 0}function nb(e,t,i=1e3){return Rt(t)?sb(e-t,i):void 0}var rb=class{_asRequiredConfig(e){var t,i,s,n,r,o,a,l;const c=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==e?void 0:e.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(s=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==s?s:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:c.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._hadSelection=!1,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=e=>{if(this._clearMouseSelection(),0===e.button){const t={path:e.composedPath(),trusted:e.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==s?void 0:s.getSelection();t.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._selectionTouchesGesture(i,t),this._mouseSelection=t}},this._onMouseOut=e=>{Pt(e.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=e=>{const t=this._mouseSelection,i=e;if(!t||0!==i.button||e.isTrusted!==t.trusted)return;const s=e.composedPath();for(const e of t.path)if(vr(e)&&-1!==s.indexOf(e)){t.clickTarget=e;break}t.clickDetail=i.detail,this._mouseSelectionTimer=h.setTimeout(this._clearMouseSelection,0)},this._onClick=e=>{const t=e,i=Xy(t,{type:"click"}),s=this._mouseSelection;i&&s&&0===t.button&&t.detail>0&&t.detail===s.clickDetail&&e.isTrusted===s.trusted&&i.node===s.clickTarget&&(i.selectionChangedDuringGesture=s.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),Pt(i)||this._ignore(i)||this._queueCandidate(i),this._scheduleCheck()},this._onScroll=()=>{const e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{Et(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=e=>{var t,i;const n=null==s?void 0:s.getSelection(),r=this._hadSelection;this._hadSelection="Range"===(null==n?void 0:n.type);const o=null==n?void 0:n.focusNode,a=o&&(vr(o)?o:o.parentElement),l=null==s?void 0:s.activeElement;let c=l;for(;null==c||null===(t=c.shadowRoot)||void 0===t?void 0:t.activeElement;)c=c.shadowRoot.activeElement;const u=Nr(Ir(e))||Nr(null!=a?a:null)||Nr(null!==(i=c)&&void 0!==i?i:null),d="Caret"===(null==n?void 0:n.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this._hadSelection||u||d))return;const h=Date.now();this._lastSelectionChanged=h;const p=this._mouseSelection;if(p&&(r||this._hadSelection||u)){const t=Ir(e);let i;if(Nr(t))i=t;else if("Caret"===(null==n?void 0:n.type)){var _;Nr(null!==(_=c)&&void 0!==_?_:null)||d?i=c:u&&(i=a)}const s=i?this._selectionIsInGesture(i,p):n&&(o||n.anchorNode)?this._selectionTouchesGesture(n,p):r&&!this._hadSelection&&p.selectionInitiallyRelated;p.selectionChanged=p.selectionChanged||s}this._clicks.forEach(e=>{const t=h-e.timestamp;0>t||!Et(e.selectionChangedDelayMs)&&t>=e.selectionChangedDelayMs||(e.selectionChangedDelayMs=t)})},this._onVisibilityChange=()=>{"hidden"===(null==s?void 0:s.visibilityState)&&this._clearMouseSelection();const e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{const e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{const t=e.touches,i=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t;const i=this._touchStart;if(this._touchStart=void 0,Et(i)||this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)return;const n=e,r=null===(t=n.changedTouches)||void 0===t?void 0:t[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,c=this._config.swipe_threshold_px;if(c*c>l)return;if([this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>Rt(e)&&e>=i.timestamp))return;var u,d;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==s||null===(d=s.elementsFromPoint)||void 0===d?void 0:d.call(s,i.x,i.y))&&void 0!==u?u:[]).some(e=>{var t;return null===(t=e.matches)||void 0===t?void 0:t.call(e,tb)}))return;const h=Xy(n,{type:"swipe",swipeDirection:Yy(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Pt(h)||this._ignore(h)||this._queueCandidate(h),this._scheduleCheck()},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(t){if(!this._mutationObserver){const i=function(t){return function(t,i){const s=Jy[t];if(s)return s;let n=i[t];if((e=>Ct(e)&&-1!==e.toString().indexOf("[native code]"))(n)&&!(null==e?void 0:e.Zone))return Jy[t]=n.bind(i);const r=i.document;if(r&&Ct(r.createElement)){let e,s=!1;try{e=r.createElement("iframe"),e.hidden=!0,r.head.appendChild(e);const l=e.contentWindow;var o,a;l&&l[t]&&(n=l[t],"MutationObserver"===t&&function(e){return ft(e,"AppleWebKit")&&!ft(e,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(e.classList.add("rr-block","ph-no-capture"),s=!0))}catch(e){Vn.warn(`Could not create sandbox iframe for ${t} check, bailing to assignableWindow.${t}: `,e)}finally{!s&&(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)}}return n&&Ct(n)?Jy[t]=n.bind(i):n}("MutationObserver",t)}(h);this._mutationObserver=new i(e=>{this._onMutation(e)}),this._mutationObserver.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,h.removeEventListener("click",this._onClick,{capture:!0}),h.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),h.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),h.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),h.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),h.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),h.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),h.removeEventListener("scroll",this._onScroll,{capture:!0}),null==s||s.removeEventListener("selectionchange",this._onSelectionChange),h.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),h.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),h.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),h.removeEventListener("blur",this._onFocusChange),h.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){sr(h,"click",this._onClick,{capture:!0}),sr(h,"mousedown",this._onMouseDown,{capture:!0}),sr(h,"mouseup",this._onMouseUp,{capture:!0}),sr(h,"mouseout",this._onMouseOut,{capture:!0}),sr(h,"dragstart",this._clearMouseSelection,{capture:!0}),sr(h,"pointercancel",this._clearMouseSelection,{capture:!0}),sr(h,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=nb(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=nb(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=nb(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Et(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){sr(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection="Range"===(null==s||null===(e=s.getSelection())||void 0===e?void 0:e.type),sr(s,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){const i=t.path[0];for(;e;){if(-1!==t.path.indexOf(e)||vr(i)&&i.contains(e))return!0;e=e.getRootNode().host}return!1}_selectionTouchesGesture(e,t){const i=t.path[0],s=e.rangeCount>0?e.getRangeAt(0):void 0;if(s&&vr(i)&&s.startContainer.getRootNode()===i.getRootNode()){var n;if(!s.collapsed)return s.intersectsNode(i);const e=vr(s.startContainer)&&null!==(n=s.startContainer.childNodes[s.startOffset])&&void 0!==n?n:s.startContainer;return this._selectionIsInGesture(e,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){sr(s,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){sr(h,"blur",this._onFocusChange),sr(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>{const s=sb(t-i.timestamp);Rt(s)&&(Et(i[e])||i[e]>s)&&(i[e]=s)})}_startSwipeObserver(){sr(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),sr(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),sr(h,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){const e=Et(this._surfacesCheckedAt)||Rt(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Et(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!(null==s?void 0:s.querySelector(tb))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){return!(!fr(t.node)&&!this._clicks.some(e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!mr(t.node,"html")&&vr(t.node)&&function(t,i){var s;if(!e||qr(t))return!1;const n=At(i)?Or:null!==(s=null==i?void 0:i.css_selector_ignorelist)&&void 0!==s?s:Or,{targetElementList:r}=Hr(t,!1);return!Mr(r,n)}(t.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(t){return!(this._config.capture_clicks_with_modifier_keys||(i=t.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this._ignoreCommon(t)||function(t){if(!e||qr(t))return!1;const{targetElementList:i}=Hr(t,!1);return i.some(e=>mr(e,"a"))}(t.node);var i}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const i of e){var t;i.mutationDelayMs=null!==(t=i.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const e=ib(i.scrollDelayMs,this._config.scroll_threshold_ms),s=ib(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=ib(i.mutationDelayMs,this._config.mutation_threshold_ms),r=ib(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),o=Rt(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,a=Rt(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Rt(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,c=Rt(i.visibilityChangedDelayMs),u=Rt(i.focusChangedDelayMs);if(!(o||a||l||c||u))if(e||n||r||s){const t=eb(i);if("$dead_swipe"===t){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${t}_last_mutation_timestamp`]:this._lastMutation,[`${t}_event_timestamp`]:i.timestamp,[`${t}_scroll_timeout`]:e,[`${t}_mutation_timeout`]:n,[`${t}_absolute_timeout`]:r,[`${t}_selection_changed_timeout`]:s,[`${t}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){const i=eb(e);this.instance.capture(i,ct(ct(ct({},t),Ky(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new rb(e,t);var ob=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){const e=this._storage._get(this._storageKey);return Ut(e)?1:ft(jt,e)?0:-1}get _storage(){const e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Da:Oa,i=t._is_supported()?t:Ka;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;const t="localStorage"===e?Oa:Da;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ut(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(e=>Ut(e))}};const ab=Gn("[Dead Clicks]"),lb=()=>!0,cb=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(P)),s=e.instance.config.capture_dead_clicks;return At(s)?s:!!xt(s)||i};var ub=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[P]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?ab.error("failed to load script",t):e()})}_start(){var e;if(s){if(!this._lazyLoadedDeadClicksAutocapture&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=xt(this.instance.config.capture_dead_clicks)?ct({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(s),ab.info("starting...")}}else ab.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,ab.info("stopping..."))}};const db=Gn("[SegmentIntegration]");function hb(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:r}=(e=>Ct(e.register))(o=s)?{analytics:o}:o;var o;!function(e,t,i,s){const n=t=>{const n=()=>t.anonymousId()||Pa();e.config.get_device_id=n,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:n()}),e.persistence.set_property(Ie,Ze)),i(s?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&Ct(r.then)?r.then(n):n(r)}(e,n,i=>{n.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||db.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=!!t&&s.event.anonymousId===t&&!s.event.userId;r||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(db.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(db.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));let o=e.calculateEventProperties(n,s.event.properties);if(!Ft(i)){const e=s.event.properties||{},t={};for(const i of Object.keys(o))St.call(e,i)||(t[i]=o[i]);const n=((e,t)=>{const i=kt(e)?e:[e];let s=ct({},t);for(const e of i)try{if(s=e(s),Ft(s))return null}catch(e){return db.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(Ft(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(e){return s(e,e.event.event)},page(e){return s(e,et)},identify(e){return s(e,it)},screen(e){return s(e,"$screen")}}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{db.error("Failed to register the Segment integration",e),t()})},i)}const pb="posthog-js";function _b(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==n&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],_=p.map(e=>ct(ct({},e),{},{stacktrace:e.stacktrace?ct(ct({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>ct(ct({},e),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var f;return t&&i&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(f=e.exceptions)||void 0===f||f.sendExceptionEvent(g)),o}}var gb=class{constructor(e,t,i,s,n,r){this.name=pb,this.setupOnce=function(o){o(_b(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},fb=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Vn.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null===(e=this._unsubscribeSessionId)||void 0===e||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,i){var s;const n=this._previousPageViewProperties(t,i);return this._currentPageview={pathname:null!==(s=null==e?void 0:e.location.pathname)&&void 0!==s?s:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){const i=this._currentPageview;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=n;if(!(Et(e)||Et(t)||Et(i)||Et(r)||Et(o)||Et(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const n=e>1?Qt(t/e,0,1,Vn):1,l=e>1?Qt(i/e,0,1,Vn):1,c=r>1?Qt(o/r,0,1,Vn):1,u=r>1?Qt(a/r,0,1,Vn):1;s=Zn(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};const vb=["flags","surveys"],mb={[p]:{exposure:"hidden"},[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[k]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"hidden"},[R]:{exposure:"hidden"},[I]:{exposure:"event"},[E]:{exposure:"hidden"},[T]:{exposure:"event"},[M]:{exposure:"event"},[P]:{exposure:"event"},[F]:{exposure:"hidden"},[L]:{exposure:"event"},[A]:{exposure:"hidden"},[O]:{exposure:"hidden"},[W]:{exposure:"hidden"},[z]:{exposure:"event"},[D]:{exposure:"event",shouldSkipFromEventProperties:e=>Pt(e)},[U]:{exposure:"event"},[j]:{exposure:"event"},[V]:{exposure:"event"},[Z]:{exposure:"event"},[J]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden",storageGroup:"flags"},[ee]:{exposure:"hidden"},[te]:{exposure:"hidden",storageGroup:"flags"},[ie]:{exposure:"hidden",storageGroup:"flags"},[se]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ne]:{exposure:"hidden",storageGroup:"flags"},[re]:{exposure:"hidden"},[oe]:{exposure:"hidden"},[ae]:{exposure:"hidden"},[le]:{exposure:"hidden"},[ue]:{exposure:"hidden",storageGroup:"surveys"},[de]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[he]:{exposure:"event"},[pe]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[ge]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[ve]:{exposure:"hidden"},[me]:{exposure:"event"},[ye]:{exposure:"event"},[be]:{exposure:"event"},[Se]:{exposure:"event"},[we]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[ce]:{exposure:"event"},[Ce]:{exposure:"hidden"},[xe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[N]:{exposure:"event"},[B]:{exposure:"event"},[q]:{exposure:"event"},[H]:{exposure:"event"},[Oe]:{exposure:"event"},[$e]:{exposure:"event"},[De]:{exposure:"event"},[Ne]:{exposure:"event"},[Be]:{exposure:"event"},[qe]:{exposure:"event"},[He]:{exposure:"event"},[We]:{exposure:"event"},[ze]:{exposure:"event"},[Ue]:{exposure:"event"},[Ge]:{exposure:"event"}},yb=[[G,{exposure:"hidden"}],[Q,{exposure:"hidden"}],[K,{exposure:"hidden"}]],bb=e=>{const t=mb[e];if(t)return t;for(const[t,i]of yb)if(0===e.indexOf(t))return i},Sb={flags:xe,surveys:de},wb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],kb=e=>`${e}_cookie_identity_change_pending`,Cb=e=>{let t="",i=0;for(const s of e){const e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},xb="main",Ib=[X,Y,te,ie,se,xe,ne,ae],Eb=e=>-1!==Ib.indexOf(e),Tb=[b,w],Mb=e=>-1!==Tb.indexOf(e),Pb=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Fb=e=>{if(!e)return{};const t=JSON.parse(e);return xt(t)?t:{}},Rb=(e,t)=>{Kn(e,(i,s)=>{const n=bb(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};var Lb=class{constructor(t,i,s=!0){if(this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=t,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{let t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(t),this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&Vn.info("Persistence loaded",t.persistence,ct({},this.props)),this.update_config(t,t,i),this.save(),e){const t=()=>this.flush();sr(e,"beforeunload",t,{capture:!1}),sr(e,"pagehide",t,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){const e=vb.find(e=>t.key===this._groupEntryName(e));e&&this._syncCrossTabFeatureFlagProperties(t.key,e)}}else this._syncCrossTabFeatureFlagProperties(t.key,xb)},sr(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!Eb(e)||!0===i)return;if(!0===t)return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this._setCrossTabFeatureFlagChangesPending(e,s)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let s,n;try{if(n=Da._get(e),Pt(n)){const e=this._slotWriteState(t);return e.storageValue=null,t!==xb&&(e.persisted=!1),!1}s=Fb(n)}catch(e){return!1}const r=t===xb?s:Da._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;const o=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===xb&&this._splitStorage&&!Pb(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,n),o}_hasCrossTabFeatureFlagIdentityMismatch(e){const t=this.props[_],i=e[_];return!Et(t)&&!Et(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){const n=this._slotWriteState(t);n.storageValue=s,t!==xb&&(n.persisted=i);try{n.fingerprint=this._entryFingerprint(e,t)}catch(e){n.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let s=!1;return Ib.forEach(i=>{var n;const r=null===(n=bb(i))||void 0===n?void 0:n.storageGroup;if(t===xb&&this._splitStorage&&r||t!==xb&&r!==t)return;const o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&Pb(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),s=!0)}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),s}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;const e=Da._get(this._name),t=this._slotWriteState(xb);let i,s=!1,n=!1;if(e!==t.storageValue)if(Pt(e))t.storageValue=null;else{if(i=Fb(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;n=this._mergeCrossTabFeatureFlagProperties(i,xb,!1),!this._splitStorage||Pb(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,xb,!0,e):t.storageValue=e,s=!0}return this._splitStorage&&vb.forEach(e=>{const t=Da._get(this._groupEntryName(e)),r=this._slotWriteState(e),o=i||{},a=s&&Ib.some(t=>{var i;return(null===(i=bb(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(Pt(t))return r.storageValue=null,r.persisted=!1,void(a&&(n=this._mergeCrossTabFeatureFlagProperties(o,e,!1)||n));const l=Fb(t);n=this._mergeCrossTabFeatureFlagProperties(l,e,!1)||n,this._rememberCrossTabStorageFingerprint(l,e,!0,t)}),n}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);const i=bb(e);(null==i?void 0:i.volatile)||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||xb).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Ib.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{const e=Da._get(this._name),t=Fb(e);this._slotWriteState(xb).storageValue=e,Ib.forEach(e=>{var i;const s=this._splitStorage?null===(i=bb(e))||void 0===i?void 0:i.storageGroup:void 0,n=s?Da._get(this._groupEntryName(s)):null;if(s){const e=this._slotWriteState(s);e.storageValue=n,e.persisted=!Pt(n)}const r=s&&!Pt(n)?Fb(n):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,r[e],this.props[e]):e in r&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const s=new Set(kt(t)?t:[]),n=new Set(kt(this.props[e])?this.props[e]:[]);return i.forEach(e=>n.has(e)?s.add(e):s.delete(e)),Array.from(s)}const s=xt(t)?ct({},t):{},n=xt(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in n?s[e]=n[e]:delete s[e]}),s}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!Eb(e))return;const s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0===s)return;let n=t;if(this._splitStorageEligible)try{var r;const t=this._splitStorage?null===(r=bb(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this._groupEntryName(t):this._name;n=Fb(Da._get(i))[e]}catch(e){}const o=new Set(s||[]);if("$active_feature_flags"===e){if(!Et(t)&&!kt(t)||!Et(n)&&!kt(n)||!kt(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(t||[]),r=new Set(n||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!xt(i))return void(Pb(n,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!Et(t)&&!xt(t)||Et(t)&&It(i)&&Et(n))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=xt(t)?t:{},r=xt(n)?n:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&Pb(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&Pb(r[e],i[e])&&o.delete(e)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Rt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{const t=za(e,this._config.cookie_persisted_properties||[]),i=ja(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=Oa._get(this._name)||void 0;n&&Ga(this._name,n)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=n)}catch(e){}else try{const e=Oa._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=e?Ga(this._name,e):void 0,this._lastSeenMainCookieValue=e}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=Oa._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;const s=Ga(this._name,i);let n;try{n=Wa(JSON.parse(i))}catch(e){return!1}if((Oa._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=i;const r=Va(this._name,i),o=[...Ba,...r.properties],a={};if(Object.keys(n).forEach(e=>{const t=n[e];(Et(t)||Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete n[e])}),It(n))return!1;const l="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,c=this.props,u=c[_],d=c[Ie],h=Zn({},c);[...Ba,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in n)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===Ba.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Zn(h,n),Ib.forEach(e=>{const t=e in this.props;e in c===t&&Pb(c[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,c[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._setProp(Ie,Ke);const p=this.props[_],g=this.props[Ie];return!l||p===u&&g===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Ja._set(kb(this._name),!0),this._deleteProp(ae),this._deleteProp(Y),this._deleteProp(X),this._deleteProp(te),this._deleteProp(ie),this._deleteProp(se),this._deleteProp(xe),this._deleteProp(Ce),this._deleteProp(we),"anonymous"!==g||"identified"!==d&&"anonymous"!==n.$user_state&&(Et(u)||p===u)||(Rb(this.props,n),this._deleteProp(le)),"identified"===g?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(v)),!0}consumeCookieIdentityChange(){const e=kb(this._name),t=this._cookieIdentityChangePending||!!Ja._get(e);return this._cookieIdentityChangePending=!1,t&&Ja._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[xb],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===wb.indexOf(t.persistence.toLowerCase())&&(Vn.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1)=>{const s=[...Ba,...t];return ct(ct({},Da),{},{_parse(e){try{let n,r={};try{n=Oa._get(e)||void 0,r=n?Wa(JSON.parse(n)):{}}catch(e){}const o=JSON.parse(Da._get(e)||"{}");let a;if(i){const i=Va(e,n),l=[...Ba,...i.properties],c={};Object.keys(r).forEach(e=>{const t=r[e];Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var t;const e=o[_],n=null!==(t=o.$user_state)&&void 0!==t?t:Ke;s.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const t=o[e];(i.isValid||-1===Ba.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!u||"$user_state"in r||"$user_state"in o||(o[Ie]=Ke),!u||("distinct_id"in c?c[_]:o[_])===e&&("$user_state"in c?c[Ie]:o[Ie])===n||(Na.forEach(e=>delete o[e]),"identified"===c.$user_state&&"distinct_id"in c?o.$user_id=c[_]:delete o.$user_id,"identified"!==c.$user_state&&(delete o[ce],delete o[le]),delete o.__alias)}a=Zn(o,c)}else a=Zn(r,o);return Da._set(e,a),a}catch(e){}return null},_set(e,s,n,r,o,a){const l=Da._set(e,s,void 0,void 0,a);try{const c=za(s,t);if(Object.keys(c).length){if(i){const i=qa(e),u=ja(c,t);if(Oa._set(i,u,n,r,o,a),Oa._get(i)!==JSON.stringify(u)){Oa._remove(i,r);const t=za(s);return Oa._set(e,t,n,r,o,a),l}}Oa._set(e,c,n,r,o,a)}}catch(e){Da._error(e)}return l},_remove(t,i){try{null==e||e.localStorage.removeItem(t),Oa._remove(t,i),Oa._remove(qa(t),i)}catch(e){Da._error(e)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let s,n=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&Da._is_supported()?(s=Da,r=!0):"localstorage+cookie"===o&&i._is_supported()?(s=i,r=!0,n=!0):"sessionstorage"===o&&Ja._is_supported()?s=Ja:"memory"===o?s=Ka:"cookie"===o&&Oa._is_supported()?(s=Oa,n=!0):i._is_supported()?(s=i,r=!0,n=!0):Oa._is_supported()?(s=Oa,n=!0):s=Ka,this._splitStorageEligible=r,this._storesIdentityInCookie=n,s}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){const e={};return Kn(this.props,(t,i)=>{const s=bb(i);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;const t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?Da._parse(this._name):null;let s={};if(t)try{s=Wa(Oa._parse(this._name)),Kn(s,(e,t)=>{(Et(e)||Pt(e)||""===e)&&delete s[t]})}catch(e){}const n=this._storage._parse(this._name);if(n&&(this.props=Zn({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var r,o;const e=null==i?void 0:i[_],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Ke,a=n[_],l=null!==(o=n.$user_state)&&void 0!==o?o:Ke;if(a!==e||l!==t){this._cookieIdentityChangePending=!0,Ja._set(kb(this._name),!0);const i=Zn({},this.props);Na.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(Et(e)||a===e)||(Rb(i,s),delete i[le]),this.props=i;const n=new Set;Na.forEach(e=>{var t;const i=null===(t=bb(e))||void 0===t?void 0:t.storageGroup;i&&n.add(i)}),n.forEach(e=>{const t={};Kn(this.props,(i,s)=>{var n;(null===(n=bb(s))||void 0===n?void 0:n.storageGroup)===e&&(t[s]=i)}),It(t)?(Da._remove(this._groupEntryName(e)),this._slotState[e]={}):Da._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Ja._get(kb(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(const e of vb){const t=Da._parse(this._groupEntryName(e));if(t&&!It(t)){const i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Zn(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=bb(t))||void 0===i?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){const i=Sb[e];if(!i)return!1;const s=t[i],n=this.props[i];return Rt(s)&&Rt(n)&&n>s}refreshKey(e){var t;if(this._disabled)return;if(this._metaIdentifierChangePending.has(e))return;const i=this._splitStorage?null===(t=bb(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?Da._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){const t=this._storage._parse(this._name);if(t&&e in t)return void this._setProp(e,t[e],!1)}this._deleteProp(e,!1)}}save(){if(this._disabled)return;const e=this._saveDebounceMs();e>0?Et(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||Tb.forEach(e=>this.refreshKey(e)));const t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);const i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&Vn.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));const s=this._writeEntry(this._storage,this._name,this.props,xb);"written"===s&&this._rememberCurrentCookieProperties(this.props),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}_writeNowSplit(){const{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,xb);"written"===i&&this._rememberCurrentCookieProperties(e),"failed"!==i&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),Ib.forEach(e=>{var t;(null===(t=bb(e))||void 0===t?void 0:t.storageGroup)||this._pendingCrossTabFeatureFlagChanges.delete(e)}));for(const e of vb){var s;const i=t[e];if(It(i)&&!(null===(s=this._slotState[e])||void 0===s?void 0:s.persisted)){Ib.forEach(t=>{var i;(null===(i=bb(t))||void 0===i?void 0:i.storageGroup)===e&&this._pendingCrossTabFeatureFlagChanges.delete(t)});continue}const n=this._writeEntry(Da,this._groupEntryName(e),i,e);"failed"!==n&&Ib.forEach(t=>{const i=bb(t);(null==i?void 0:i.storageGroup)!==e||"written"!==n&&i.volatile||this._pendingCrossTabFeatureFlagChanges.delete(t)})}}_partitionProps(){const e={},t={flags:{},surveys:{}};return Kn(this.props,(i,s)=>{var n;const r=null===(n=bb(s))||void 0===n?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===xb)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;const i={};return Kn(e,(e,t)=>{var s;i[t]=(null===(s=bb(t))||void 0===s?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){const n=this._slotWriteState(s);if(s!==xb&&!n.dirty&&!Et(n.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==xb&&(n.persisted=!0),Et(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=Da._get(t)),"written"):(this._config.debug&&Vn.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(const e of vb)Da._remove(this._groupEntryName(e));e?delete this._slotState[xb]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(xt(e)){this.syncCookieProperties(),Et(t)&&(t="None"),this._expire_days=Et(i)?this._default_expiry:i;let s=!1;if(Kn(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(xt(e)){this.syncCookieProperties(),this._expire_days=Et(t)?this._default_expiry:t;let i=!1;if(Kn(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||xt(t)||kt(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this._deleteProp(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==s?void 0:s.URL;if(e===this._campaign_params_url)return;const t=Ml(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!It(Yn(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register(function(){const e=null==s?void 0:s.referrer;return e?Fl(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:Ol(),$referring_domain:(null==s?void 0:s.referrer)&&(null===(e=ar(s.referrer))||void 0===e?void 0:e.host)||Al},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=$l(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Fe]:this._storesIdentityInCookie?{r:Cb(e.r),u:e.u?Cb(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Kn([Pe,Me],t=>{const i=this.props[t];i&&Kn(i,function(t,i){e["$initial_"+mt(i)]=t})});const t=this.props[Fe];if(t){const i=function(e,t=!1){const i=Dl(e,t),s={};return Kn(i,function(e,t){s[`$initial_${mt(t)}`]=e}),s}(t,this._config.disable_capture_url_hashes);Zn(e,i)}return e}safe_merge(e){return Kn(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(s||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(ct(ct({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();const u=this._resolveSplitStorage(e),d=r||u!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this._storage=c,this._splitStorage=u,this.props=e,this.save()}else o&&(this._storage=c,a||(delete this._slotState[xb],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){const e=this.props[Fe];if(!this._storesIdentityInCookie||!xt(e)||"string"!=typeof e.r)return;const t=Cb(e.r),i="string"==typeof e.u?Cb(e.u):e.u;t===e.r&&i===e.u||this._setProp(Fe,ct(ct({},e),{},{r:t,u:i}))}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this._setProp(k,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return Et(i)||(delete t[e],this._setProp(k,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var s;const n=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||n===t||(this._localIdentityChangePending=!0),Mb(e)&&!Pb(n,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,n,t),(null===(s=bb(e))||void 0===s?void 0:s.volatile)||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&(Eb(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),Mb(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t;const i=null===(t=bb(e))||void 0===t?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};const Ab=Gn("[RateLimiter]");var Ob=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Ab.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ab.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(Rt(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this._captureWarning(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){const t=this.instance.config.property_denylist;return!kt(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&(null==n?void 0:n.pathname))return`${null!==(e=n.origin)&&void 0!==e?e:""}${n.pathname}`}_captureWarning(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} 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: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const $b=Gn("[RemoteConfig]");var Db=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}_loadRemoteConfigJs(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return $b.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void $b.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return $b.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){$b.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||$b.warn("Failed to fetch remote config from PostHog."):$b.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){$b.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){$b.error("Error loading feature flags",e)}}};const Nb=!!o||!!r,Bb=new WeakMap,qb="text/plain";let Hb=0,Wb=!1;const zb=(e,t)=>{const[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},Ub=(e,t,i=!0)=>{var s;const[n,r]=e.split("?"),o=ct({},t),a=null!==(s=null==r?void 0:r.split("&").map(e=>{var t;const[s,n]=e.split("="),r=i&&null!==(t=o[s])&&void 0!==t?t:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],l=lr(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},jb=e=>{if(e._encodedBody)return e._encodedBody;const{data:t,compression:i}=e;if(!t)return;if(i===ug){const e=ba(Sa(or(t)),{mtime:0});return{contentType:qb,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===dg){const e=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(or(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:or(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const s=or(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},Vb=e=>{const t=()=>"sendBeacon"===e.transport?{url:Ub(e.url,{compression:dg}),encodedBody:jb(ct(ct({},e),{},{compression:dg,_encodedBody:void 0}))}:{url:zb(e.url,"compression"),encodedBody:jb(ct(ct({},e),{},{compression:void 0,_encodedBody:void 0}))};let i;try{i=jb(e)}catch(i){if(cn(e.compression,cr(e.url,"compression")))return Vn.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&cn(e.compression,cr(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?ln(new Uint8Array(s)):ArrayBuffer.isView(s)&&ln(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Wb=!0,t()):{url:e.url,encodedBody:i};var s},Gb=e=>{try{return Vb(e)}catch(i){var t;return Vn.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},Qb=function(){var e=rt(function*(e){const t=yield fn(or(e.data),Xa.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return ct(ct({},e),{},{_encodedBody:{contentType:qb,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Kb=/Failed to fetch|NetworkError|Load failed/i,Zb=e=>"TypeError"===(null==e?void 0:e.name)&&Kb.test((null==e?void 0:e.message)||""),Jb=e=>{try{const t=function(e,t=Date.now()){if("string"!=typeof e||!e)return;const i=e.trim(),s=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(s)){const e=1e3*Math.min(Number(s),300);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const n=/^\w{3} \w{3} /.test(s)?s+" GMT":s,r=Date.parse(n)-t;return Number.isFinite(r)&&r>0?Math.min(r,ss):void 0}(e());return Et(t)?void 0:Math.min(t,3e4)}catch(e){return}},Xb=e=>{const t=Gb(e);if(!t)return;const i=new o;Bb.set(i,!0);const{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);const{contentType:r,body:a}=null!=n?n:{};Kn(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,s,Jb(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},Yb=e=>{const t=Gb(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:n,body:o,estimatedSize:l}=null!=s?s:{},c=new Headers;Kn(e.headers,function(e,t){c.append(t,e)}),n&&c.append("Content-Type",n);let u=null,d=!1;if(a){const t=new a;u={signal:t.signal,timeout:setTimeout(()=>{d=!0;try{t.abort(as("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))}catch(e){p(e)}var i},e.timeout)}}let h=!1;const p=t=>{var i;h||(h=!0,d&&"AbortError"===(null==t?void 0:t.name)||Zb(t)?Vn.warn(t):Vn.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t}))};let _=0;const g=()=>{Hb-=_,_=0,u&&clearTimeout(u.timeout)};try{const t=ct({method:(null==e?void 0:e.method)||"GET",headers:c,referrerPolicy:"strict-origin",body:o,signal:null==u?void 0:u.signal},e.fetchOptions),s=null!=l?l:Et(o)?0:void 0;t.keepalive="POST"===t.method&&!e._keepaliveDisabled&&!1!==t.keepalive&&t.body===o&&!Et(s)&&s>=0&&52428.8>Hb+s,t.keepalive&&(_=s,Hb+=_),r(i,t).then(t=>t.text().then(i=>{var s;if(h)return;const n={statusCode:t.status,text:i};if(200===t.status)try{n.json=JSON.parse(i)}catch(e){Vn.error(e)}h=!0,g(),null===(s=e.callback)||void 0===s||s.call(e,n,Jb(()=>t.headers.get("Retry-After")))})).catch(e=>{g(),p(e)}).finally(g)}catch(e){g(),p(e)}},eS=e=>{try{var t;const{url:s,encodedBody:n}=Vb(e),{contentType:o,body:a,estimatedSize:l}=null!=n?n:{};if(!a)return;const c=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(s,c))return;const u=kt(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(kt(u)&&u.length>1&&(null!=l?l:0)>16384){const t=Math.ceil(u.length/2),i=t=>kt(e.data)?t:ct(ct({},e.data),{},{batch:t});return eS(ct(ct({},e),{},{data:i(u.slice(0,t))})),void eS(ct(ct({},e),{},{data:i(u.slice(t))}))}Vn.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Yb(ct(ct({},e),{},{_keepaliveDisabled:!0})):Xb(e)}catch(e){Vn.warn("Beacon send failed",e)}},tS=(e,t,i,s)=>{const n="query"===s?"POST"===t?"sent_at":"_":void 0;return Ub(i===ug?zb(e,"compression"):e,ct(ct({},n?{[n]:Date.now().toString()}:{}),i===ug?{}:{compression:i}))},iS=(()=>{const e=[];return r&&e.push({transport:"fetch",method:Yb}),o&&e.push({transport:"XHR",method:Xb}),(null==i?void 0:i.sendBeacon)&&e.push({transport:"sendBeacon",method:eS}),e})();let sS=!Nb&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla"));function nS(e,t,i){var s,n,r;i&&(t=ct(ct({},t),{},{callback:e=>i(e)})),e.__loaded?sS?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(n=t.callback)||void 0===n||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=ct(ct({},e.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(s=e.compression)&&void 0!==s?s:t.compressionFallback:t.compression,(Et(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((e,t)=>{var i,s,n;const r=ct(ct({},e),{},{callback:null!=t?t:t=>{var i;return null===(i=e.callback)||void 0===i?void 0:i.call(e,t)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Et(r.compression)&&r.data&&(r.compression=dg),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(e=>{var t,i;const s=(kt(e)?e:[e]).map(e=>ct(ct({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(t=null==n||null===(i=n.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((e,t=(new Date).toISOString())=>kt(e)?e.map(e=>ct(ct({},e),{},{sent_at:t})):ct(ct({},e),{},{sent_at:t}))(r.data))),r.url=tS(r.url,r.method,r.compression,r.timestampMode);const a=iS.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),c=null!==(s=null===(n=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(a,e=>e.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:a[0].method;if(!c)throw new Error("No available transport method");const u=e=>{try{c(e)}catch(e){var t;Zb(e)?Vn.warn(e):Vn.error(e),null===(t=r.callback)||void 0===t||t.call(r,{statusCode:0,error:e})}};"sendBeacon"!==o&&r.data&&r.compression===ug&&l&&"undefined"!=typeof Promise&&!Wb?Qb(r).then(e=>{u(e)}).catch(t=>{if(un(t))return Wb=!0,void u(ct(ct({},r),{},{compression:void 0,url:tS(e.url,e.method,void 0,e.timestampMode)}));dn(t)&&(Wb=!0),u(r)}):c(r)})(t,(s,n)=>{var r,o,a;e.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=e.config).on_request_error)||void 0===r||r.call(o,s),i?i(s,n):null===(a=t.callback)||void 0===a||a.call(t,s)})):t.fireCallbackOnDrop&&(null===(r=t.callback)||void 0===r||r.call(t,{statusCode:0}))}var rS=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Qt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Vn.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();const e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(e,"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){const e=this._formatQueue();for(const t in e)this._sendRequestSafely(e[t])}},this._flushTimeoutMs))}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(e){Vn.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){const e={};return Kn(this._queue,t=>{var i;const s=t,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");Et(e[n])&&(e[n]=ct(ct({},s),{},{data:[]})),null===(i=e[n].data)||void 0===i||i.push(s.data)}),this._queue=[],e}};const oS=["retriesPerformedSoFar"];var aS=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!Et(e)&&"onLine"in e.navigator){if(this._areWeOnline=e.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},sr(e,"online",this._onlineListener),sr(e,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=mn(e,oS);Lt(i)&&(s.url=Ub(s.url,{retry_count:i})),nS(this._instance,t?ct(ct({},s),{},{transport:t}):s,(e,t)=>{var n;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=i?i:0))return void this._enqueue(ct({retriesPerformedSoFar:i},s),t);0===e.statusCode&&Vn.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===(n=s.callback)||void 0===n||n.call(s,e)})}_enqueue(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const s=Math.max(function(e){const t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),n=(Math.random()-.5)*(s-i);return Math.ceil(s+n)}(i),null!=t?t:0),n=Date.now()+s;this._queue.push({retryAt:n,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Vn.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){const e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Et(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(const{requestOptions:e}of this._queue)try{this._instance._send_request(ct(ct({},e),{},{transport:"sendBeacon"}))}catch(e){Vn.error(e)}this._queue=[]}},lS=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=r+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(r),this._context.maxScrollY=Math.max(r,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){const e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){sr(e,"scroll",this._updateScrollData,{capture:!0}),sr(e,"scrollend",this._updateScrollData,{capture:!0}),sr(e,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){const i=kt(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(const s of i){var t;const i=null==e||null===(t=e.document)||void 0===t?void 0:t.querySelector(s);if(i)return i}return}var i;return null==e||null===(i=e.document)||void 0===i?void 0:i.documentElement}_scrollPosition(t){var i,s;const n="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){const e=this.scrollElement();return e&&e[n]||0}return e?"y"===t?e.scrollY||e.pageYOffset||(null===(i=e.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:e.scrollX||e.pageXOffset||(null===(s=e.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}};const cS=e=>$l(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);var uS=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{const t=this._getStored();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Ee]:i})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||cS,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Ee]}getSetOnceProps(){var e;const t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?Dl(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return Kn(Yn(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${mt(i)}`]=t}),e}},dS=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(const i of this._events[e]||[])i(t);for(const i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}};const hS=Gn("[SessionId]"),pS=864e5;var _S=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new dS,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Lt(e)||!Lt(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Pa,this._windowIdGenerator=i||Pa;const n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Qt(this._config.session_idle_timeout_seconds||1800,60,36e3,hS.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){const e=Ja._parse(this._window_id_storage_key),t=Ja._parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Ja._remove(this._window_id_storage_key),Ja._set(this._primary_window_exists_storage_key,!0)}(null===(s=this._config.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Et(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Ja._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ja._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ja._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){const t=this._lastPersistedActivityTimestamp;return!Pt(t)&&!Pt(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){const s=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!s||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[W]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Lt(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(W):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(Pt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();const[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[W]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}_freshestActivityTimestamp(){const[e]=this._getSessionId(),t=Lt(e)?e:0,i=Lt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){const e=this._persistence.props[W];return kt(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void hS.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void hS.error("Invalid sessionID in bootstrap",e)}})(e);return!Et(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(Ye,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Ja._remove(this._primary_window_exists_storage_key)},sr(e,Ye,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||(new Date).getTime(),n=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(Pt(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var r,o;null===(r=(o=this._persistence).syncCookieProperties)||void 0===r||r.call(o),this._lastCookieSyncTimestamp=s}let[,a,l]=this._getSessionId();const c=!Et(n)&&a!==n,u=this._freshestActivityTimestamp();let d=this._getWindowId();const h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>pS),_=h?p:Lt(l)&&Math.abs(s-l)>pS;let g=!1,f=c;const v=!a||!!h,m=a;let y=!v&&!e&&this._sessionHasBeenIdleTooLong(s,u);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(s),y||hS.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId()),v||y||_){f=!1;const e=h&&!p;a=e?h.sessionId:this._sessionIdGenerator(),d=this._windowIdGenerator(),hS.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_}}),l=e?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,g=!0}else d||(d=this._windowIdGenerator(),g=!0),f=f||a!==m,f&&(hS.info("adopted cross-tab session id",{sessionId:a,windowId:d}),g=!0);const b=Lt(u)&&e&&!_?u:s,S=Lt(l)?l:(new Date).getTime();this._setWindowId(d),this._setSessionId(a,b,S),e||this._resetIdleTimer();const w={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_,crossTabAdoption:f};return g&&this._sessionIdChangedHandlers.forEach(e=>e(a,d,w)),{sessionId:a,windowId:d,sessionStartTimestamp:S,changeReason:g?w:void 0,lastActivityTimestamp:u}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){const e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};const gS=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&Gt(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>Gt(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function fS(){return fS=rt(function*(){const e=null==i?void 0:i.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return Tt(i)&&i.length>0?i:void 0}catch(e){return void Vn.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),fS.apply(this,arguments)}const vS="custom",mS="i.posthog.com",yS=/^\/static\//,bS=["/s/","/e/","/i/"];var SS=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${mS}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":vS),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!yS.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){const t=ar(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;let s=i;const n=this.instance.config.rewriteRequestPath;if(n){var r;const e=(null===(r=ar(i))||void 0===r?void 0:r.href)||i;s=n(new URL(e)).toString()}if(n&&"api"===e&&bS.some(e=>0===t.indexOf(e))){const e=this._urlKey(s);if(e){const t=this.apiHost;let i=this._ingestionEndpoints;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===n||(i={apiHost:t,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){const t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){const i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,`${i}${t}`)}if(this.region===vS)return this._prepareEndpoint(e,t,this.apiHost+t);const i=mS+t;switch(e){case"assets":return this._prepareEndpoint(e,t,`https://${this.region}-assets.${i}`);case"api":return this._prepareEndpoint(e,t,`https://${this.region}.${i}`)}}};const wS=Gn("[PostHog ExternalIntegrations]"),kS={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var CS=class{constructor(e){this._instance=e}_loadScript(e,t){var i,s;null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,e,e=>{if(e)return wS.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[n,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,s;r&&!(null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[n])&&this._loadScript(kS[n],()=>{var e;null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[n])||void 0===e||e.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&(null===(s=h.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},xS=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return rt(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t._extensions.set(e.name,e);try{const i=e.setup(t._client);i&&(yield i)}catch(i){const s=t._extensions.get(e.name)===e;s&&t._extensions.delete(e.name),t._logger.error(`Failed to set up browser extension "${e.name}"`,i),s&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(this._disposed)return;this._disposed=!0;const e=Array.from(this._extensions.values()).reverse();this._extensions.clear();for(const t of e)this._disposeExtension(t)}_disposeExtension(e){try{var t;const i=null===(t=e.dispose)||void 0===t?void 0:t.call(e);i&&Ct(i.then)&&i.then(void 0,t=>{this._logger.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this._logger.error(`Failed to dispose browser extension "${e.name}"`,t)}}},IS=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const s of e){const e=null==t?void 0:t.get_property(s);Et(e)||(i[s]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}};const ES="extensionsRemoteConfig";var TS=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=Vn,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new IS(e),this.onEvent=e=>Hg(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this._disposed)return Hg(()=>{});const t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(ES,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Hg(i)},this._runtime=new xS(Vn.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property(g);return"string"==typeof e?e:void 0}get library(){return{name:Xa.LIB_NAME,version:Xa.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const n=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,i){var s=this;return rt(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return Hg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(ES,e))}sendRequest(e){var t=this;return rt(function*(e,i={}){var s;const n=t.instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),r={method:i.method,url:i.query?Ub(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?dt.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(r),{statusCode:202}):new Promise(e=>{r.callback=e,t.instance._send_request(r)})}).apply(this,arguments)}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}};const MS={};let PS=0;const FS=()=>{},RS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',LS="Surveys module not available",AS="sanitize_properties is deprecated. Use before_send instead",OS="Invalid value for property_denylist config: ",$S=/^[A-Za-z0-9_-]{1,400}$/,DS=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,NS=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,BS=["token","distinct_id",Ae],qS="posthog",HS=e=>{const t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},WS=t=>{var i;return ct({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ir(null==s?void 0:s.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:FS,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:n&&Tt(null==n?void 0:n.search)&&-1!==n.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==e||null===(i=e.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(e){Vn.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Je,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:FS},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Lr,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:HS(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(t))},zS=[["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"]],US=e=>{const t={};for(const[i,s]of zS)Et(e[i])||(t[s]=e[i]);const i=Zn({},t,e),s=e.__preview_external_dependency_versioned_paths;return Et(s)||(Et(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),Tt(s)&&Et(e.asset_host)&&(i.asset_host=s)),kt(e.property_blacklist)&&(Et(e.property_denylist)?i.property_denylist=e.property_blacklist:kt(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Vn.error(OS+e.property_denylist)),i};var jS=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Vn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},VS=class t{_removeExtension(e){if(!e)return;const t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}_replaceExtension(e,t){var i;return this._removeExtension(e),this._extensions.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this._inCookielessMode())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this._hasStableInitialDistinctId)return;let t,i,s;e?(t=`persistence is set to '${this.config.persistence}'`,i="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."):(t="persistence is disabled (disable_persistence is true)",i="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._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}_healCookielessSentinelDistinctId(){if(this._inCookielessMode()||"$posthog_cookieless"!==this.get_distinct_id())return;const e=this.persistence;if(!e)return;this._is_persistence_disabled()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(Pa());this.register({distinct_id:t,$device_id:t}),e.set_property(Ie,Ke)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new jS,this._personProcessingSetOncePropertiesSent=!1,this.version=Xa.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new dS,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=WS(),this.SentryIntegration=gb,this.sentryIntegration=e=>function(e,t){const i=_b(e,t);return{name:pb,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new lS(this),this.pageViewManager=new fb(this),this.rateLimiter=new Ob(this),this.requestRouter=new SS(this),this.consent=new ob(this),this.externalIntegrations=new CS(this);const i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const s=Tt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{const s=Tt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Vn.info(`send "${null==e?void 0:e.event}"`,e))}init(e,i,s){if(s&&s!==qS){var n;const r=null!==(n=MS[s])&&void 0!==n?n:new t;return r._init(e,i,s),MS[s]=r,MS[qS][s]=r,r}return this._init(e,i,s)}_init(t,i={},s){var n,r,o;const a=Tt(t)?t.trim():"";if(!a)return Vn.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==(null===(l=this.config)||void 0===l?void 0:l.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=WS(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);const c=WS(i.defaults),u=US(i),d=Zn({},c,u,{name:s,token:a});xt(c.rageclick)&&xt(u.rageclick)&&(d.rageclick=Zn({},c.rageclick,u.rageclick)),xt(c.session_recording)&&xt(u.session_recording)&&(d.session_recording=Zn({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Vn.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ug;const h=this._is_persistence_disabled();if(this.persistence=new Lb(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Lb(ct(ct({},this.config),{},{persistence:"sessionStorage"}),h,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Ja._is_supported()){const e=Ja._parse(this._sessionRegisteredPropertiesStorageKey);kt(e)&&e.forEach(e=>{Tt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Ja._remove(this._sessionRegisteredPropertiesStorageKey);const p=ct({},this.persistence.props),_=ct({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new rS((e,t)=>this._send_retriable_request(e,t),this.config.request_queue_config),this._retryQueue=new aS(this),this.__request_queue=[];const g=this._inCookielessMode();g||(this.sessionManager=new _S(this),this.sessionPropsManager=new uS(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Vn.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(g)},0)):(Vn.info("Initializing extensions synchronously"),this._initExtensions(g)),Xa.DEBUG=Xa.DEBUG||this.config.debug,Xa.DEBUG&&Vn.info("Starting in debug mode",{this:this,config:i,thisC:ct({},this.config),p:p,s:_}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=ct(ct({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!v&&!Mt(v),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const e=i.bootstrap.distinctID,t=this.get_distinct_id(),s=this.persistence.get_property(Ie);if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===s)this.identify(e);else if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===s)Vn.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 t=this.config.get_device_id(Pa()),s=i.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(Ie,i.bootstrap.isIdentifiedID?Ze:Ke),this.register({distinct_id:e,$device_id:s})}}if(g)this.register_once({distinct_id:Le,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(Pa());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(Ie,Ke)}return sr(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sr(e,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null===(e=this._retryQueue)||void 0===e||e.resume()}),i.segment?hb(this,()=>this._loaded()):this._loaded(),Ct(this.config._onCapture)&&this.config._onCapture!==FS&&(Vn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Vn.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 fS.apply(this,arguments)}().then(e=>{e&&this.register({[f]:e})}).catch(FS),this}_isSharedExtension(e){const t=e;return Tt(t.name)&&Ct(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}).catch(t=>{Vn.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var e,i,s;const n=null!==(e=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==e?e:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this._featureFlagsReloadingUnsubscribe)||void 0===r||r.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new n(this)),Ct(this.featureFlags.onReloading)&&Ct(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}_initExtensions(e){const i=performance.now(),s=ct(ct({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d;s.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this._extensions.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this._extensions.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this._extensions.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this._enrollExtension(this.autocapture=new s.autocapture(this),n),s.surveys&&this._enrollExtension(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this._enrollExtension(this.logs=null!==(a=this.logs)&&void 0!==a?a:new s.logs(this),n),s.metrics&&this._extensions.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new s.metrics(this)),s.conversations&&this._extensions.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new s.conversations(this)),s.productTours&&this._extensions.push(this.productTours=new s.productTours(this)),s.heatmaps&&this._extensions.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this._extensions.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,cb)),s.toolbar&&this._extensions.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new s.toolbar(this)),s.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this._extensions.forEach(e=>{e.initialize&&n.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),n.push(()=>{if(this._pendingRemoteConfig){const e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this._processInitTaskQueue(n,i)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);const i=e.shift();if(i)try{i()}catch(e){Vn.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[Oe]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[$e]:i}),this.config.__preview_deferred_init_extensions&&Vn.info(`PostHog extensions initialized (${i}ms)`)}_onRemoteConfig(e){var t;if(!s||!s.body)return Vn.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var i;const t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=ft(t.supportedCompression,ug)?ug:ft(t.supportedCompression,dg)?dg:void 0),(null===(i=t.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Je}),null===(t=this._browserClientAdapter)||void 0===t||t.handleRemoteConfig(e),this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}_loaded(){try{this.config.loaded(this)}catch(e){Vn.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const e=n.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Db(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&Qn(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,n,r;this._isPageUnloading=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(tt),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this._requestQueue)||void 0===n||n.unload(),null===(r=this._retryQueue)||void 0===r||r.unload()):this._shouldCapturePageleave()&&this.capture(tt,null,{transport:"sendBeacon"})}_send_request(e){nS(this,e)}_send_retriable_request(e,t){this._retryQueue?this._retryQueue.retriableRequest(e,t):this._send_request(t?ct(ct({},e),{},{transport:t}):e)}_execute_array(e){PS++;try{let t;const i=[],s=[],n=[];Qn(e,e=>{if(e)if(t=e[0],kt(t))n.push(e);else if(Ct(e))try{e.call(this)}catch(t){Vn.error("Error executing queued PostHog call",e,t)}else kt(e)&&"alias"===t?i.push(e):kt(e)&&-1!==t.indexOf("capture")&&Ct(this[t])?n.push(e):s.push(e)});const r=function(e,t){Qn(e,function(e){try{if(kt(e[0])){let i=t;Kn(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Vn.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(s,this),r(n,this)}finally{PS--}}push(e){if(PS>0&&kt(e)&&Tt(e[0])){const i=t.prototype[e[0]];return void(Ct(i)&&i.apply(this,e.slice(1)))}this._execute_array([e])}get _facebookClickIdChannel(){return{property:y,persistenceKey:b,cookieName:"_fbc",pattern:DS,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[b]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(b)}}}get _facebookBrowserIdChannel(){return{property:S,persistenceKey:w,cookieName:"_fbp",pattern:NS,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[w]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(w)}}}_getPersistedMetaIdentifier(e){var t;const i=null===(t=this.persistence)||void 0===t?void 0:t.get_property(e.persistenceKey);return Tt(i)&&e.pattern.test(i)?{value:i,delivered:!1}:xt(i)&&Tt(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_storeMetaIdentifier(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}_readMetaCookie(e){if(!this.config.save_campaign_params||this._inCookielessMode())return;const t=Ca(e.cookieName);return Tt(t)&&e.pattern.test(t)?t:void 0}_updateFacebookClickId(e,t,i,s){if(!this.persistence)return;const n=this._facebookClickIdChannel;this.persistence.refreshKey(n.persistenceKey);const r=this._getPersistedMetaIdentifier(n);if(s)return void n.unregister();if(i)return Tt(t)&&DS.test(t)?this._storeMetaIdentifier(n,t,r):void n.unregister();const o=Tt(e)&&$S.test(e)?e:void 0,a=this._readMetaCookie(n);return a&&((e,t,i)=>{const s=e.split(".");if(t)return s[3]===t;if(!i)return!0;const n=i.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(a,o,r)?this._storeMetaIdentifier(n,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this._storeMetaIdentifier(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}_updateFacebookBrowserId(e,t,i){if(!this.persistence)return;const s=this._facebookBrowserIdChannel;this.persistence.refreshKey(s.persistenceKey);const n=this._getPersistedMetaIdentifier(s);if(i)return void s.unregister();if(t)return Tt(e)&&NS.test(e)?this._storeMetaIdentifier(s,e,n):void s.unregister();const r=this._readMetaCookie(s);return r?this._storeMetaIdentifier(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}_markMetaIdentifierDelivered(e,t){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const i=this._getPersistedMetaIdentifier(e);(null==i?void 0:i.value)!==t||i.delivered||e.register(t,!0)}capture(e,t,i){var s,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void Vn.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Et(e)||!Tt(e))return void Vn.error("No event name provided to posthog.capture");this._healCookielessSentinelDistinctId();const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;const o=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Vn.critical("This capture call is ignored due to client rate limiting.");let a;(null==t?void 0:t.$current_url)&&!Tt(null==t?void 0:t.$current_url)&&(Vn.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i._originatedFromCaptureException)||Vn.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&&(a=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 l=new Date,c=(null==i?void 0:i.timestamp)||l,u=os(null==i?void 0:i.uuid,Pa);let d={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},c,u)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&r&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const h="$feature_flag_called"===e&&!1===d.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!h&&(d.$set=null==i?void 0:i.$set);const p=xt(null==t?void 0:t.$set)?t.$set:void 0,_=kt(null==t?void 0:t.$unset)?t.$unset:[],g=(null==i?void 0:i.$unset)||[],f=e=>{var t;const s=!!(null==i?void 0:i.$set)&&e in i.$set;return{hasProvided:s||!!p&&e in p,provided:s?null==i||null===(t=i.$set)||void 0===t?void 0:t[e]:null==p?void 0:p[e],unset:-1!==_.indexOf(e)||-1!==g.indexOf(e)}},v=f(y),m=f(S),b=[{channel:this._facebookClickIdChannel,hasProvided:v.hasProvided,update:this._updateFacebookClickId(null==a?void 0:a.fbclid,v.provided,v.hasProvided,v.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:m.hasProvided,update:this._updateFacebookBrowserId(m.provided,m.hasProvided,m.unset)}];for(const{channel:e,hasProvided:t,update:i}of b)i&&!0===d.properties.$process_person_profile&&i.pending&&!t&&!h&&(d.$set=ct({[e.property]:i.value},d.$set));const w=null==i?void 0:i.$unset;w&&(d.$unset=w);const k=h?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==st,e===it);if(k&&(d.$set_once=k),(null==i?void 0:i._noTruncate)||(C=this.config.properties_string_max_length,d=function(e,t){const i=new Set;return function e(s,n){if(s!==Object(s))return t?t(s):s;if(i.has(s))return;let r;if(i.add(s),kt(s))r=[],Qn(s,t=>{r.push(e(t))});else{const t={};Kn(qt(s)?er(s):s,(s,n)=>{i.has(s)||(t[n]=e(s,n))}),r=t}return r}(e)}(d,e=>Tt(e)?e.slice(0,C):e)),d.timestamp=c,Et(null==i?void 0:i.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),h&&(d.properties=((e,t=[])=>{const i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return on.forEach(s),t.forEach(s),i})(d.properties,BS)),e===Mg||e===Pg){const i=null==t?void 0:t[Fg],s=null==t?void 0:t[Lg];Kg({id:i,current_iteration:s}),d.$set=ct(ct({},d.$set),{},{[rl({id:i,current_iteration:s},e===Pg?"responded":"dismissed")]:!0})}else e===Tg&&(d.$set=ct(ct({},d.$set),{},{[Ng]:(new Date).toISOString()}));var C;if("product tour shown"===e){const e=null==t?void 0:t.$product_tour_type;e&&(d.$set=ct(ct({},d.$set),{},{[`$product_tour_last_seen_date/${e}`]:(new Date).toISOString()}))}const x=ct(ct({},d.properties.$set),d.$set);if(It(x)||this.setPersonPropertiesForFlags(x),!Ft(this.config.before_send)){const e=this._runBeforeSend(d);if(!e)return;d=e,d.uuid=os(d.uuid,Pa)}const I=b.filter(({channel:e,update:t})=>{var i,s,n;const r=null!==(i=null===(s=d.$set)||void 0===s?void 0:s[e.property])&&void 0!==i?i:xt(null===(n=d.properties)||void 0===n?void 0:n.$set)?d.properties.$set[e.property]:void 0;return(null==t?void 0:t.pending)&&r===t.value});this._internalEventEmitter.emit("eventCaptured",d);const E=null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(E),M=ct(ct(ct({method:"POST",url:E,data:d,compression:"best-available",timestampMode:T?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},T&&(null===(n=d.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),I.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(const{channel:e,update:t}of I)this._markMetaIdentifierDelivered(e,t.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||I.length){var P;let e;!M.transport&&!M.callback&&It(null!==(P=this.config.request_headers)&&void 0!==P?P:{})&&this._isPageUnloading&&(e="sendBeacon"),this._send_retriable_request(M,e)}else this._requestQueue.enqueue(M);return d}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this._browserClientAdapter)||void 0===t?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new TS(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}_processCookieIdentityChange(e=!0){var t,i,s;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();const l=a?void 0:this.persistence.remove_event_timer(t);let u=ct({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this._inCookielessMode()&&(u[Ae]=!0),"$snapshot"===t){const e=ct(ct({},this.persistence.properties()),this.sessionPersistence.properties());return u.distinct_id=e.distinct_id,(!Tt(u.distinct_id)&&!Rt(u.distinct_id)||Mt(u.distinct_id))&&Vn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}const d=function(t,i,s,r=!1){var o,a,l,u;if(!c)return{};const d=t?[...xl,...i||[]]:[],[h,p]=Qi(c),[_,g]=function(e){for(let t=0;Xi.length>t;t++){const[i,s,n]=Xi[t],r=e.match(i);if(r){const t=n&&e.match(n)||r;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(c),f=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};Et(s)||(v.detectGoogleSearchApp=s);const m={},y=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,S=null==e||null===(l=e.screen)||void 0===l?void 0:l.width,w=null==e||null===(u=e.screen)||void 0===u?void 0:u.height,k=null==e?void 0:e.devicePixelRatio;Et(y)||(m.userAgentDataPlatform=y),Et(b)||(m.maxTouchPoints=b),Et(S)||(m.screenWidth=S),Et(w)||(m.screenHeight=w),Et(k)||(m.devicePixelRatio=k);const C=Zn(Yn({$os:h,$os_version:p,$browser:Ui(c,navigator.vendor,f,v),$webview_app:_,$webview_app_version:g,$device:Ki(c),$device_type:Zi(c,m),$timezone:Nl(),$timezone_offset:Bl()}),{$current_url:ur(r?ls(null==n?void 0:n.href):null==n?void 0:n.href,d,El),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:Vi(c,navigator.vendor,f,v),$browser_language:Rl(),$browser_language_prefix:Ll(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Un.LIB_NAME,$lib_version:Un.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Un.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=Un.SDK_DIST_CHANNEL),C}(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:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);u.$session_id=e,u.$window_id=t}this.sessionPropsManager&&Zn(u,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Zn(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null===(h=this._retryQueue)||void 0===h?void 0:h.length}catch(e){u.$sdk_debug_error_capturing_properties=String(e)}let p;if(this.requestRouter.region===vS&&(u.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),u=Zn(u,p),"$pageview"===t&&s&&(u.title=s.title),!Et(l)){const e=r.getTime()-l;u.$duration=parseFloat((e/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");const _=this.persistence.properties(),g=this.sessionPersistence.properties(),f=u.$groups,v=_.$groups;xt(f)&&!It(f)&&(u.$groups=ct(ct({},xt(v)?v:{}),f)),Kn(["$referrer","$referring_domain"],e=>{e in _&&delete g[e]});const m={};if(this._extensionEventPropertyProducers.length>0)for(const e of this._extensionEventPropertyProducers.slice())try{Zn(m,e())}catch(e){Vn.error("Failed to produce browser extension event properties",e)}u=Zn({},d,_,g,ct(ct({},m),u)),u.$is_identified=this._isIdentified(),kt(this.config.property_denylist)?Kn(this.config.property_denylist,function(e){delete u[e]}):Vn.error(OS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&(Vn.error(AS),u=y(u,t));const b=this._hasPersonProcessing();return u.$process_person_profile=b,b&&!a&&this._requirePersonProcessing("_calculate_event_properties"),u}_calculate_set_once_properties(e,t=!0,i=!1){var s;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Zn({},n,r||{},e||{});const a=this.config.sanitize_properties;return a&&(Vn.error(AS),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),It(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var s;null===(s=this.persistence)||void 0===s||s.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this._processCookieIdentityChange(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(!this._sessionRegisteredPropertiesStorageKey)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e._disabled)||!Ja._is_supported())return void Ja._remove(this._sessionRegisteredPropertiesStorageKey);const t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Ja._set(this._sessionRegisteredPropertiesStorageKey,t):Ja._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:LS}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:LS})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:LS})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=Jg){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:LS}}canRenderSurveyAsync(e,t=!1){var i,s;return null!==(i=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:LS})}_validateIdentifyId(e){return!e||Mt(e)?(Vn.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Vn.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Vn.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Vn.uninitializedWarning("posthog.identify");if(Rt(e)&&(e=e.toString(),Vn.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._validateIdentifyId(e))return;if(!this._requirePersonProcessing("posthog.identify"))return;this._healCookielessSentinelDistinctId();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression();let a=!1;try{const s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(v),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Ke,c=e!==s,u=!c&&o;if(c&&o){var l;const n=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(Ie,Ze),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",n,{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=vl(e,t,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(u){this.persistence.set_property(Ie,Ze);const s=t||{},n=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:s,$set_once:n})&&(this._cachedPersonProperties=vl(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);c||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(we)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this._requirePersonProcessing("posthog.setPersonProperties"))return;const i=vl(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this._cachedPersonProperties=i)):Vn.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(kt(e)?e:[e]).filter(e=>Tt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,i){var s;if(!e||!t)return void Vn.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this._processCookieIdentityChange();const n=this.getGroups(),r=n[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ct(ct({},n),{},{[e]:t})}),(r||i)&&this._hasPersonProcessing()){const s={$group_type:e,$group_key:t};i&&(s.$group_set=i),this.capture(st,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=At(e)?e:null==e?void 0:e.resetDeviceID,i=At(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t=!1,i){var s,n,r,o,a,l;if(Vn.info("reset"),!this.__loaded)return Vn.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(s=this._originalUserConfig)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this._shouldDisableFlags());const u=this.get_property(g),d=this.get_property(f),h=this.get_property(A);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),t||!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===(a=this.persistence)||void 0===a||null===(l=a._beginCookieSyncSuppression)||void 0===l?void 0:l.call(a);let v=!1;try{var m,y,b,S,w,k,C,x,I,E,T,M,P;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Et(h)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:h}),null===(b=this.surveys)||void 0===b||b.reset(),null===(S=this.featureFlags)||void 0===S||S.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(C=this.metrics)||void 0===C||C.reset(),null===(x=this.persistence)||void 0===x||x.set_property("$user_state","anonymous"),null===(I=this.sessionManager)||void 0===I||I.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Le,$device_id:null},"");else{const t=this.config.get_device_id(Pa());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||Et(d)||this.register({[f]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this._inCookielessMode()&&(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(T=this.featureFlags)||void 0===T||T.initialize(),!Ft(c)&&!(null===(M=this.sessionManager)||void 0===M?void 0:M.setBootstrapSessionId(c,!0))){const e=ct({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var F,R;_&&(null===(F=this.persistence)||void 0===F||null===(R=F._endCookieSyncSuppression)||void 0===R||R.call(F,v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return rt(function*(){var e,i,s,n,r,o,a,l;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null===(e=t.sessionRecording)||void 0===e||e.dispose(),null===(i=t.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(s=t.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=t.metrics)||void 0===n||n.dispose(),null===(r=t._requestQueue)||void 0===r||r.unload(),null===(o=t._retryQueue)||void 0===o||o.unload();try{var c;null===(c=t.featureFlags)||void 0===c||c.destroy()}catch(e){Vn.error("Error while destroying feature flags",e)}null===(a=t.persistence)||void 0===a||a.destroy(),null===(l=t.sessionPersistence)||void 0===l||l.destroy()}else Vn.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var n;const t=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(Vn.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(v,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Vn.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=ct({},this.config);if(xt(e)){var i,s,n,r,o,a,l,c,u,d,h,p,_,g;Zn(this.config,US(e));const v=this._is_persistence_disabled();null===(i=this.persistence)||void 0===i||i.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Lb(ct(ct({},this.config),{},{persistence:"sessionStorage"}),v,!1);const m=this._checkLocalStorageForDebug(this.config.debug);var f;At(m)&&(this.config.debug=m),At(this.config.debug)&&(this.config.debug?(Xa.DEBUG=!0,Da._is_supported()&&Da._set("ph_debug",!0),Vn.info("set_config",{config:e,oldConfig:t,newConfig:ct({},this.config)})):(Xa.DEBUG=!1,Da._is_supported()&&Da._remove("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this._shouldDisableFlags()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(c=this.tracingHeaders)||void 0===c||c.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(f=this.historyAutocapture)||void 0===f||f.startIfEnabledOrStop()),null===(h=this.exceptionObserver)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.deadClicksAutocapture)||void 0===p||p.startIfEnabledOrStop(),null===(_=this.surveys)||void 0===_||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),null===(g=this.externalIntegrations)||void 0===g||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&hb(this,FS,!1)}}_overrideSDKInfo(e,t){Xa.LIB_NAME=e,Xa.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var s,n,r,o,a;Object.values(i).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ct(ct({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var e,i;return null!==(e=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==e?e:t._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:qS;return t!==qS&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&It(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Vn.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Re,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t;const i=this._is_persistence_disabled();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s._onOptOut(),(null===(e=this.persistence)||void 0===e?void 0:e._disabled)!==i&&(null===(n=this.persistence)||void 0===n||n.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t._disabled)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),i}opt_in_capturing(e){var i;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var s,n,r,o,a,l;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new _S(this),this.pageViewManager=new fb(this),this.persistence&&(this.sessionPropsManager=new uS(this,this.sessionManager,this.persistence));const e=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=t.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;e&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new e(this)),this._lastRemoteConfig&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this._lastRemoteConfig)))}var d,h;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(Et(null==e?void 0:e.captureEventName)||(null==e?void 0:e.captureEventName))&&this.capture(null!==(h=null==e?void 0:e.captureEventName)&&void 0!==h?h:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Vn.warn(RS)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Vn.warn(RS);const e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var t,i;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Le,$device_id:null}),this._removeExtension(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return 1===e?"granted":0===e?"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._sync_opt_out_with_persistence()}_is_bot(){return i?gS(i,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){s&&("visible"===s.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(et,{title:s.title},{send_instantly:!0}),this._visibilityStateListener&&(s.removeEventListener(Xe,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),sr(s,Xe,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.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}))}_shouldDisableFlags(){const e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Vn.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(e,t,i,s,n){const r=t in e&&!Ft(e[t]),o=i in e&&!Ft(e[i]);return r?e[t]:!!o&&(n&&n.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Vn)}_runBeforeSend(e){var t;if(Ft(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Dt),s=kt(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=e;for(const t of s)try{if(n=t(n),Ft(n)){const t=`Event '${e.event}' was rejected in beforeSend function`;return $t(e.event)?Vn.warn(`${t}. This can cause unexpected behavior.`):Vn.info(t),null}n.properties&&!It(n.properties)||Vn.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return Vn.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(n.properties&&Ft(n.properties[t]))return Vn.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){const t=At(e)&&!e,i=Da._is_supported()&&"true"===Da._get("ph_debug");return!t&&(!!i||e)}};VS.__defaultExtensionClasses={},VS._noopLogger=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Xn(e.prototype[t[i]])}(VS,["identify"]);var GS=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=xt(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}};const QS=Gn("[ExceptionAutocapture]"),KS=Gn("[TracingHeaders]"),ZS=Gn("[Web Vitals]"),JS=9e5,XS=["CLS","FCP","INP","LCP"],YS=["INP","LCP"],ew=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],tw=Gn("[SessionRecording]"),iw=Gn("[Heatmaps]");function sw(e){return xt(e)&&"clientX"in e&&"clientY"in e&&Rt(e.clientX)&&Rt(e.clientY)}const nw=Gn("[Product Tours]"),rw=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(F))},ow=["$set_once","$set"],aw=Gn("[SiteApps]"),lw="Error while initializing PostHog app with config id ",cw=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),uw="SDK is not enabled or survey functionality is not yet loaded",dw="Disabled. Not loading surveys.";var hw=class{constructor(e,t){this._configSource=e,this._initialClientState=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(this._disposed)return;if(this._config.disableSurveys)return;if(!e.ok)return Wg.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(Ft(t))return Wg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=At(t)?t:t.length>0,Wg.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()}}setup(e){if(!this._disposed)return this._initializingClient=e,cw(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(s=i.dispose)||void 0===s||s.call(i),this._surveyManager=null,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach(e=>clearTimeout(e)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this._disposed||!this._client)return;const e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void Wg.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void Wg.info(dw);if(e.cookielessMode&&this._configSource.isOptedOut())return void Wg.info("Not loading surveys in cookieless mode without consent.");const t=this._configSource.getExtensions();if(!t)return void Wg.error("PostHog Extensions not found.");if(Et(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;const i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{const e=t.generateSurveys;if(e)return this._completeSurveyInitialization(e,i),void(this._isInitializingSurveys=!1);const s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(Qe),void(this._isInitializingSurveys=!1);s(e=>{try{if(this._disposed)return;const t=this._configSource.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),Wg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){Wg.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;const s=null!==(i=this._client)&&void 0!==i?i:this._initialClientState;if(!s||this._disposed)return;if(this._config.disableSurveys)return Wg.info(dw),e([]);const n=s.kv.get(ue);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:t,context:i})=>{this._disposed||e(t,i)}).catch(e=>Wg.error("Error in survey callback",e));const r=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(s,e)}catch(e){return Wg.error("Error processing surveys response",e),this._handleSurveyResponse(s,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(s,{statusCode:0,error:e}));this._getSurveysInFlightPromise=r;const o=()=>{this._getSurveysInFlightPromise===r&&(this._getSurveysInFlightPromise=null)};r.then(t=>{o(),this._disposed||e(t.surveys,t.context)},o).catch(e=>Wg.error("Error in survey callback",e))}_sendSurveysRequest(e,t){const i=this._client;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(uw)}))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:uw}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Wg.error(e):t.error||Wg.warn(e),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this._lastSurveyRefreshFailedAt=null;const s=t.json.surveys||[],n=s.filter(e=>jg(e)&&(dl(e)||Vg(e)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),e.kv.set({[ue]:s,[de]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t;const i=null===(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)||void 0===e?void 0:e.kv.get(de);return Rt(i)&&Date.now()-i>3e5}_isSurveyRefreshBackingOff(){return Rt(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};Kg(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(const t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Wg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!Ft(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Wg.warn("init was not called")}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}_checkSurveyEligibility(e){if(Ft(this._surveyManager))return{eligible:!1,reason:uw};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(!this._configSource.isCapturing())return{eligible:!1,reason:zg};if(Ft(this._surveyManager))return{eligible:!1,reason:uw};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ft(this._surveyManager))return Wg.warn("init was not called"),{visible:!1,disabledReason:uw};const t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ft(this._surveyManager)?(Wg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:uw})):new Promise(i=>{this.getSurveys(t=>{var s;const n=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(n){const e=this._checkSurveyRenderability(n);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var n;if(!this._configSource.isCapturing())return;if(Ft(this._surveyManager))return void Wg.warn("init was not called");const r="string"==typeof e?this._getSurveyById(e):e;if(!(null==r?void 0:r.id))return void Wg.warn("Survey not found");if(!Zg.includes(r.type))return void Wg.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==s?void 0:s.querySelector(t);if(o){if(null===(n=r.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds){Wg.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,s;this._renderTimeouts.delete(e),!this._disposed&&this._configSource.isCapturing()&&(Wg.info(`Rendering survey ${r.id} with delay of ${null===(t=r.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(r,o,i),Wg.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(e)}this._surveyManager.renderSurvey(r,o,i)}else Wg.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this._configSource.isCapturing())return;if(Ft(this._surveyManager))return void Wg.warn("init was not called");const s=this._getSurveyById(e);if(!s)return void Wg.warn("Survey not found");let n=s;if((null===(i=s.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(n=ct(ct({},s),{},{appearance:ct(ct({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==qg&&t.initialResponses&&Wg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this._checkSurveyEligibility(s);if(!e.eligible)return void Wg.warn("Survey is not eligible to be displayed: ",e.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Ft(this._surveyManager)?Wg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}};function pw(e,t,i){if(Ft(e))return!1;switch(i){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var _w=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new dS,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;Et(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null===(e=this._captureHookUnsubscribe)||void 0===e||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new dS}register(e){var t,i;if(!Et(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const e=new Set;this._actionRegistry.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null==t?void 0:t.url){var i;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!pw(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(!(null==t?void 0:t.href))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>pw(e.href,t.href,t.href_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&pw(function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(n),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!(null==t?void 0:t.text))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>pw(e.text,t.text,t.text_matching||"exact")||pw(e.$el_text,t.text,t.text_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&(r=function(e){const t=[],i=/(?::|")text="(.*?)"/g;let s;for(;!Ft(s=i.exec(e));)t.includes(s[1])||t.push(s[1]);return t}(n),o=t.text,a=t.text_matching||"exact",r.some(e=>pw(e,o,a)));var r,o,a}_checkStepSelector(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;const n=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==n?void 0:n.includes(t.selector))return!0;const r=(null==e||null===(s=e.properties)||void 0===s?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||fl(t.properties.reduce((e,t)=>{const i=kt(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},gw=class{constructor(e){var t,i;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null===(t=this._instance)||void 0===t||null===(i=t.onSessionId)||void 0===i?void 0:i.call(t,e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&fl(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){const i=new Map;return e.forEach(e=>{var s;null===(s=e.conditions)||void 0===s||null===(s=s[t])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(t=>{if(null==t?void 0:t.name){const s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}_getMatchingItems(e,t,i){const s=(i===hg?this._eventToItems:this._cancelEventToItems).get(e);let n=[];return this._getItems(e=>{n=e.filter(e=>null==s?void 0:s.includes(e.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[i])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(t=>t.name===e);return this._doesEventMatchFilter(r,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var i;Et(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var s;if(t&&this._actionToItems.clear(),0===i.length)return void(t&&(null===(s=this._actionMatcher)||void 0===s||s.replace([])));this._actionMatcher||(this._actionMatcher=new _w(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));const n=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(n.push(t),t.name){var i;const s=null!==(i=this._actionToItems.get(t.name))&&void 0!==i?i:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}})}),t?this._actionMatcher.replace(n):this._actionMatcher.register(n)}_mergeItemMaps(e,t){t.forEach((t,i)=>{var s;const n=null!==(s=e.get(i))&&void 0!==s?s:[];t.forEach(e=>{n.includes(e)||n.push(e)}),e.set(i,n)})}_setupEventBasedItems(e,t){var i,s;const n=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this._buildEventToItemMap(e,hg),a=this._buildEventToItemMap(e,pg);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==n.length||0!==r.length)&&(null!==(i=this._captureHookUnsubscribe)&&void 0!==i||(this._captureHookUnsubscribe=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;const n=this._getLogger(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(s=t.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const t=this._activationOutcome(e,r);if("consume"===t)return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if("persist"===t)return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){const i=this._getMatchingItems(e,t,pg);i.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._deactivateItems(i.map(e=>e.id)),i.forEach(e=>this._cancelPendingItem(e.id)))}if(!this._eventToItems.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});const o=this._getMatchingItems(e,t,hg);this._activateItems(o.map(e=>e.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t,i;if(0===e.length)return;const s=!!(null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t)),n=[];for(const t of e)s&&this._shouldPersistArmedActivation(t)?this._persistActivation(t)&&this._recordActivationTimestamp(t):n.push(t);n.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...n])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);const t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){const t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));const i=this._getRawPersistedActivatedIds(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this._setActivatedItems(s),0===s.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e;const t=this._getActivationTimestampsKey();if(!t)return{};const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t];return i&&"object"==typeof i?i:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps();this._writeActivationTimestamps(ct(ct({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps(),i={};let s=!1;for(const[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(It(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;const t=this._getRawActivationTimestamps()[e];return Rt(t)?t:void 0}_getRawPersistedActivatedIds(){var e;const t=this._getActivatedKey();return(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,i;const s=this._getRawPersistedActivatedIds();if(0===s.length)return[];const n=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this._getActivatedSessionKey()],r=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);return r&&n===r?s:[]}_stampActivationSession(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(t=e.get_session_id)||void 0===t?void 0:t.call(e);i&&this._setActivatedSession(i)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this._getActivatedSessionKey()];if(i&&i!==e){const e=this._getRawPersistedActivatedIds(),t=this._getRawActivationTimestamps();e.length>0&&(this._setActivatedItems([]),e.filter(e=>Rt(t[e])).forEach(e=>this._cancelPendingItem(e))),this._clearActivationSession(),this._clearAllActivationTimestamps()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,i;null===(e=this._sessionIdUnsubscribe)||void 0===e||e.call(this),this._sessionIdUnsubscribe=void 0,null===(t=this._captureHookUnsubscribe)||void 0===t||t.call(this),this._captureHookUnsubscribe=void 0,null===(i=this._actionMatcher)||void 0===i||i.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},fw=class extends gw{constructor(e){super(e)}_getActivatedKey(){return he}_getActivatedSessionKey(){return pe}_getActivationTimestampsKey(){return _e}_writeActivationTimestamps(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_timestamps:e})}_clearActivationTimestampsStore(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_timestamps")}_shouldPersistArmedActivation(e){var t;let i;this._getItems(t=>{i=t.find(t=>t.id===e)});const s=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return Rt(s)&&s>0}_getShownEventName(){return Tg}_getItems(e){var t;null===(t=this._instance)||void 0===t||t.getSurveys(e)}_cancelPendingItem(e){var t;null===(t=this._instance)||void 0===t||t.cancelPendingSurvey(e)}_getLogger(){return Wg}_setActivatedItems(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated:e})}_setActivatedSession(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_session:e})}_clearActivatedSession(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_session")}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){let i;return this._getItems(e=>{i=e.find(e=>e.id===t)}),!i||hl(i)?e===Tg?"consume":"ignore":e===Tg?"persist":e===Mg||e===Pg?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},vw=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);const t={};for(const i of e){const e=this._instance.get_property(i);Et(e)||(t[i]=e)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}},mw=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(){return new fw(this._instance)}};const yw=(null==e?void 0:e.location)?dr(e.location.hash,"__posthog")||dr(location.hash,"state"):null,bw="_postHogToolbarParams",Sw=Gn("[Toolbar]"),ww=Gn("[FeatureFlags]");var kw=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var i,s,n,r,o,a,l;return{bootstrap:{featureFlags:null!==(i=null===(s=e.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=e.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Et(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(l=e.evaluation_contexts)&&void 0!==l?l:e.evaluation_environments)&&void 0!==a?a:[],flagKeys:kt(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(ww.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Et(e.flag_keys)||kt(e.flag_keys)||ww.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}};const Cw=Gn("[FeatureFlags]"),xw=Gn("[FeatureFlags]",{debugEnabled:!0}),Iw="\" failed. Feature flags didn't load in time.",Ew=["click","keydown","wheel","touchstart","pointerdown"],Tw="connection_error",Mw=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},Pw=e=>{const t={};for(const[i,s]of Jn(e||{}))s&&(t[i]=s);return t},Fw="Refusing to render web experiment since the viewer is a likely bot",Rw={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>pl(t,e),not_regex:(e,t)=>!pl(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Lw=Gn("[Conversations]"),Aw="Conversations not available yet.";function Ow(e,t){var s,n,r,o,a,l,c;const u=null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:3e3,d=null!==(n=null==e?void 0:e.maxBufferSize)&&void 0!==n?n:100,h=(null==t?void 0:t.consoleCapture)?void 0:null!==(r=null==e?void 0:e.maxLogsPerInterval)&&void 0!==r?r:1e3,p=Et(h)?Math.max(d,2048):Math.max(d,h),_=ct(ct({},function(){let e="",t="";try{const s=null==i?void 0:i.userAgent;s&&([e,t]=Qi(s))}catch(e){}return function(e,t){const i=function(e){if(e)return{}.hasOwnProperty.call(En,e)?En[e]:e}(e);return ct(ct({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==_?void 0:_["service.name"])&&void 0!==a?a:null==e?void 0:e.serviceName)&&void 0!==o?o:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(l=null==_?void 0:_["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(c=null==_?void 0:_["deployment.environment"])&&void 0!==c?c:null==e?void 0:e.environment,resourceAttributes:_,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const $w=["debug","log","warn","error","info"],Dw="console",Nw="__posthogHandledLogsRequestError",Bw=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[Nw]=!0,i},qw=e=>!!e&&"object"==typeof e&&!0===e[Nw],Hw=Gn("[NetworkMetrics]"),Ww=()=>{var t;return(null==e||null===(t=e.performance)||void 0===t?void 0:t.now)?e.performance.now():Date.now()},zw=e=>e?`${Math.floor(e/100)}xx`:"missing",Uw=(e,t)=>{var i;const s=String(t);return{method:String(e).toUpperCase(),url:(null===(i=ar(s))||void 0===i?void 0:i.href)||s}},jw=(e,t,i,s,n)=>{try{var r,o,a;const c=n();if(!c)return;const u=i||void 0,d=Ww()-s,h=ar(t.url);if(h&&"http:"!==h.protocol&&"https:"!==h.protocol)return;const p={url:(null==h?void 0:h.href)||t.url,method:t.method},_=Ct(c.name)?c.name(p):Tt(c.name)?c.name:"http.client.request.duration";if(!_)return;const g=ct({method:p.method,host:null!==(r=null==h?void 0:h.hostname)&&void 0!==r?r:"",path:h?(l=h.pathname,l.split("/").map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?":id":e).join("/")):"",status_class:zw(u)},null===(o=c.attributes)||void 0===o?void 0:o.call(c,p,{status:u,durationMs:d}));null===(a=e.metrics)||void 0===a||a.histogram(_,d,{unit:"ms",attributes:g})}catch(e){Hw.error("Failed to record network metric",e)}var l},Vw=()=>{},Gw=(t,i)=>Ct(null==e?void 0:e.fetch)?wp(e,"fetch",e=>function(...s){const n=Ww(),r=e.apply(this,s);if(!i())return r;try{var o,a,l;const[e,c]=s,u=Uw(null!==(o=null!==(a=null==c?void 0:c.method)&&void 0!==a?a:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(l=null==e?void 0:e.url)&&void 0!==l?l:e);return r.then(e=>(jw(t,u,null==e?void 0:e.status,n,i),e),e=>{throw jw(t,u,void 0,n,i),e})}catch(e){return Hw.error("Failed to observe fetch",e),r}}):Vw,Qw=(t,i)=>{var s;const n=null==e||null===(s=e.XMLHttpRequest)||void 0===s?void 0:s.prototype;if(!n)return Vw;const r=new WeakMap,o=wp(n,"open",e=>function(...t){try{(()=>Bb.has(this))()||r.set(this,Uw(t[0],t[1]))}catch(e){Hw.error("Failed to observe XHR open",e)}return e.apply(this,t)}),a=wp(n,"send",e=>function(...s){let n;try{const e=r.get(this);if(e&&i()){const s=Ww();n=()=>{this.removeEventListener("loadend",n),jw(t,e,this.status,s,i)},sr(this,"loadend",n)}}catch(e){Hw.error("Failed to observe XHR send",e)}try{return e.apply(this,s)}catch(e){throw n&&this.removeEventListener("loadend",n),e}});return()=>{o(),a()}},Kw={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=Cw,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._hadUserInteraction=!1,this._onOnline=()=>{const e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t;const i=this._refreshIntervalMs,n=null!==(e=this._dueRefreshIntervalMs)&&void 0!==e?e:i;Et(i)||Et(n)||this._config.remoteRequestsDisabled||!s||"hidden"===s.visibilityState||Date.now()-(null!==(t=this._lastRefreshAt)&&void 0!==t?t:0)<n||(this._dueRefreshIntervalMs=this._hadUserInteraction||!this._config.idleRefreshBackoff?i:Math.min(2*n,36e5),this._hadUserInteraction=!1,this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onUserInteraction=()=>{this._hadUserInteraction&&this._dueRefreshIntervalMs===this._refreshIntervalMs||this._resumeConfiguredInterval()},this._onVisibilityChange=()=>{"visible"===(null==s?void 0:s.visibilityState)&&this._resumeConfiguredInterval()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new kw(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var i;null===(i=this._mutableConfigSource)||void 0===i||i.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),cw(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(t){var i;if(this._client===t)return e&&sr(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_resumeConfiguredInterval(){this._hadUserInteraction=!0,this._dueRefreshIntervalMs=this._refreshIntervalMs,this._refreshIfDue()}_syncAutomaticRefresh(){const e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&s&&!Et(e)&&e>0?e:void 0;this._config.idleRefreshBackoff||(this._dueRefreshIntervalMs=t),t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Et(t)||(this._refreshIntervalMs=t,this._dueRefreshIntervalMs=t,this._scheduleNextRefresh(),(null==s?void 0:s.addEventListener)&&(sr(s,Xe,this._onVisibilityChange),Qn(Ew,e=>{sr(s,e,this._onUserInteraction,{capture:!0})}))))}_scheduleNextRefresh(){Et(this._refreshIntervalMs)||(Et(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e;Et(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==s||null===(e=s.removeEventListener)||void 0===e||e.call(s,"visibilitychange",this._onVisibilityChange),Qn(Ew,e=>{var t;null==s||null===(t=s.removeEventListener)||void 0===t||t.call(s,e,this._onUserInteraction,{capture:!0})})),this._refreshIntervalMs=void 0,this._dueRefreshIntervalMs=void 0,this._hadUserInteraction=!1,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t,i;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null===(t=this._dynamicProperties)||void 0===t||t.dispose(),this._dynamicProperties=void 0,null===(i=this._crossTabPersistenceUnsubscribe)||void 0===i||i.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null==e||e.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:null===(t=this._client)||void 0===t?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!Et(null===(e=this._client)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!e.$enabled_feature_flags)return;const n=this._prop("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?a:i&&!kt(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),u=this._prop("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||i?c:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),p=!l&&!i,_=!!p||c,g=!!p||h,f={[Y]:_,[X]:_,[ie]:g};e.$feature_flag_details&&(f[te]=_);for(const t of[se,xe,ne])Et(e[t])||(f[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(f)}_remove(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){const e={};for(const t of[Y,ie,se,re]){const i=this._prop(t);Et(i)||(e[t]=i)}this._baseEventProperties=e;const t=ct({},e),i=this._prop(X);if(i)for(const[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this._eventPropertiesWithFlagValues=t}_isCacheStale(){const e=this._config.cacheTtlMs;if(!e||0>=e)return!1;const t=this._prop(xe);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){const e=this._config.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_getValidFlagKeys(){const e=this._config.flagKeys;if(!Et(e))return e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t;const i=this._config,s=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var n,r;const e=null!==(n=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},t=Object.keys(s).filter(e=>!Et(s[e])).reduce((e,t)=>(e[t]=s[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this._receivedFeatureFlags({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;const r=(null==i?void 0:i.merge)&&null!==(s=this._prop("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==i?void 0:i.merge)&&null!==(n=this._prop("$feature_flag_payloads"))&&void 0!==n?n:{},a=ct(ct({},r),e),l=ct(ct({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:nn(t),variant:rn(t),reason:void 0,metadata:Et(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._prop(te),t=this._prop(re),i=this._prop(oe);if(!i&&!t)return e||{};const s=Zn({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of n){var r;const n=s[e],a=null==t?void 0:t[e],l=Et(a)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!a,c=Et(a)?null==n?void 0:n.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=ct(ct({},n),{},{enabled:l,variant:l?null!=c?c:null==n?void 0:n.variant:void 0});var o;l!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),c!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),u&&(d.metadata=ct(ct({},null==n?void 0:n.metadata),{},{payload:u,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[e]=d}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this._override_warning=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:nn(s),variant:rn(s),payload:sn(t[i])}})}getFlagVariants(){const e=this._prop(X),t=this._prop(re);if(!t)return e||{};const i=Zn({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){const e=this._prop(ie),t=this._prop(oe);if(!t)return e||{};const i=Zn({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEach(e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(we)}_callFlagsEndpoint(e){this._clearDebouncer();const t=this._client;if(!t||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return;if(this._requestInFlight)return void(this._additionalReloadRequested=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ct(ct(ct({},t.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(le),timezone:Nl()};Et(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this._config.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this._getValidEvaluationEnvironments();s.length&&(i.evaluation_contexts=s);const n=this._getValidFlagKeys();Et(n)||(i.flag_keys=n);const r=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;const l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},c=e=>{var t,s;const n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this._requestInFlight=!1,a!==this._requestGeneration)return void l();if(this._trackStatusZeroReachability(e.statusCode),o||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),i.disable_flags&&!this._additionalReloadRequested)return;this._flagsLoadedFromRemote=!o;const c=[];e.error?c.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?Tw:"unknown_error"):200!==e.statusCode&&c.push(`api_error_${e.statusCode}`),n.errorsWhileComputingFlags&&c.push("errors_while_computing_flags");const u=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));u&&c.push("quota_limited"),this._set({[Ce]:c}),u?this._logger.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."):i.disable_flags||this._receivedFeatureFlags(n,o,{partialResponse:r}),l()},u=e=>{this._requestInFlight=!1,a===this._requestGeneration?(this._set({[Ce]:[Tw]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(c).catch(u)}catch(e){u(e)}}_hasStatusZeroCircuitBreakerTripped(){return hr(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=pr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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(e,t={}){var i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+Iw);if(this._checkAndTriggerStaleRefresh())return;const s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+Iw);if(this._checkAndTriggerStaleRefresh())return;const i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0;let c,u=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var d;const e=null===(d=this._client)||void 0===d?void 0:d.session.sessionId,t=this._prop(ke);e&&e!==t&&(u={},c=e)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))c&&this._set({[we]:u,[ke]:c});else{var h,p,_,g,f,v,m,y,b,S,w,k;kt(u[e])?u[e].push(o):u[e]=[o],this._set(ct({[we]:u},c?{[ke]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(h=this._prop("$feature_flag_errors"))&&void 0!==h?h:[]];Et(n)&&i.push("flag_missing");const s={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(p=null===(_=this._config.bootstrap)||void 0===_||null===(_=_.featureFlags)||void 0===_?void 0:_[e])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(g=null===(f=this._config.bootstrap)||void 0===f||null===(f=f.featureFlagPayloads)||void 0===f?void 0:f[e])&&void 0!==g?g:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Et(null==t||null===(v=t.metadata)||void 0===v?void 0:v.has_experiment)||(s.$feature_flag_has_experiment=t.metadata.has_experiment),Et(null==t||null===(m=t.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=t.metadata.version);const d=null!==(y=null==t||null===(b=t.reason)||void 0===b?void 0:b.description)&&void 0!==y?y:null==t||null===(S=t.reason)||void 0===S?void 0:S.code;var C;d&&(s.$feature_flag_reason=d),(null==t||null===(w=t.metadata)||void 0===w?void 0:w.id)&&(s.$feature_flag_id=t.metadata.id),Et(null==t?void 0:t.original_variant)&&Et(null==t?void 0:t.original_enabled)||(s.$feature_flag_original_response=Et(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(k=t.metadata)||void 0===k?void 0:k.original_payload)&&(s.$feature_flag_original_payload=null==t||null===(C=t.metadata)||void 0===C?void 0:C.original_payload),i.length&&(s.$feature_flag_error=i.join(",")),this._captureFeatureFlagCalled(s)}else c&&this._set({[we]:u,[ke]:c});return s?{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:sn(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;null===(t=this._client)||void 0===t||t.capture("$feature_flag_called",e).catch(e=>{this._logger.error("Failed to capture feature flag call",e)})}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var i=this;return rt(function*(){const s=i._client;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i._getValidEvaluationEnvironments();r.length&&(n.evaluation_contexts=r);const o=i._getValidFlagKeys();let a;Et(o)||(n.flag_keys=o);try{var l;const t=null===(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i._logger.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i._logger.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+Iw),t.defaultValue;const i=this.getFeatureFlag(e,t);return Et(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;const s=((e,t={},i={},s={},n,r=Cw)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!Et(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return ct(ct({},e),{},{featureFlags:t,featureFlagPayloads:s})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(kt(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[Y]:l,[X]:e,[ne]:!1}}let h=l,p=c,_=a;if(null==n?void 0:n.partialResponse){const e=Object.keys(h),n=p||{};h=ct(ct({},t),h),p=ct(ct({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=ct(ct({},s),_)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=ct(ct({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const n=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=ct(ct({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=ct(ct({},s),Object.fromEntries(Object.entries(_||{}).filter(([t])=>e.has(t))))}else h=ct(ct({},t),h),p=ct(ct({},i),p),_=ct(ct({},s),_);return ct(ct({[Y]:Object.keys(Pw(h)),[X]:h||{},[ie]:p||{},[te]:_||{},[ne]:!0===e.minimalFlagCalledEvents},u?{[se]:u}:{}),d?{[xe]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(s)if(!1===(null==i?void 0:i.persist)){const e=!Et(this._client.kv.get(X));this._bootstrapState=s,e||this._set(s)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(s,e,!!(null==i?void 0:i.partialResponse)),this._set(s);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,t=!1){this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([re,oe]),this._fireFeatureFlagsCallbacks(),void xw.info("All overrides cleared");if(kt(e))return this._set({[re]:Mw(e)}),this._fireFeatureFlagsCallbacks(),void xw.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const s={},n=i.flags,r=i.payloads;return n&&(s[re]=kt(n)?Mw(n):n),r&&(s[oe]=r),Object.keys(s).length&&this._set(s),!1===n&&!1===r?this._remove([re,oe]):!1===n?this._remove(re):!1===r&&this._remove(oe),this._fireFeatureFlagsCallbacks(),!1===n?xw.info("Flag overrides cleared"):n&&xw.info("Flag overrides set",{flags:n}),void(!1===r?xw.info("Payload overrides cleared"):r&&xw.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this._set({[re]:e}),this._fireFeatureFlagsCallbacks(),void xw.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const n=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);const a=ct(ct({},this.getFlagVariants()),{},{[e]:t});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[Y]:Object.keys(Pw(a)),[X]:a,[ae]:ct(ct({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;null===(l=this._client)||void 0===l||l.capture("$feature_enrollment_update",o).catch(e=>{this._logger.error("Failed to capture early access feature enrollment",e)})}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){const s=this._prop(ee);!s||t?this._getEarlyAccessFeatures(e,i):e(s)}_getEarlyAccessFeatures(e,t){var i=this;return rt(function*(){const s=i._client;if(!s)return;const n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i._set({[ee]:r})}catch(e){return void i._logger.error("Early access feature request failed",e)}try{e(r)}catch(e){i._logger.error("Early access feature callback failed",e)}})()}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){const i=this._prop("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),n=null==e?void 0:e.$set_once,r={};if(n)for(const e in n)({}).hasOwnProperty.call(n,e)&&(e in i||(r[e]=n[e]));this._set({[ae]:ct(ct(ct({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=ct({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this._set({[ae]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(ae),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this._prop("$stored_group_properties")||{},s=ct({},i);for(const t of Object.keys(e))s[t]=ct(ct({},i[t]),e[t]);this._set({[le]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._prop("$stored_group_properties")||{};this._set({[le]:ct(ct({},t),{},{[e]:{}})})}else this._remove(le)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},Zw={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this._recordingStatus||"missing_config"===this._recordingStatus?this._recordingStatus:null!==(e=null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=_o,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!(null==s?void 0:s.visibilityState)||"visible"===s.visibilityState)return!0;const n=null==e||null===(t=e.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==n?void 0:n.length)||n.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e,t;"visible"===(null==s?void 0:s.visibilityState)&&(this._documentWasEverVisible=!0,null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw tw.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._config.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==s?void 0:s.addEventListener)&&sr(s,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,null==s||null===(t=s.removeEventListener)||void 0===t||t.call(s,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),s=!this._config.disable_session_recording,n=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&i&&s&&!n}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed)return;if(this._isRecordingEnabled&&(null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.isStarted))return;const i=!Et(Object.assign)&&!Et(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),tw.info("starting")):(this._recordingStatus=_o,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=yo),(null==h||null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var s,n;const t=this._instance.sessionManager;null===(s=h.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this._scriptName,i=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),tw.error("could not load recorder",i)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;null===(e=this._persistFlagsOnSessionListener)||void 0===e||e.call(this),this._persistFlagsOnSessionListener=void 0,null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.stop()}_discardRecording(e=!1){var t,i;null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=void 0,null===(i=this._lazyLoadedSessionRecording)||void 0===i||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null===(e=this._persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._persistence)||void 0===t||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Ft(e))return null;const i=Rt(e)?e:parseFloat(e);return"number"!=typeof(s=i)||!Number.isFinite(s)||0>s||s>1?(tw.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}_persistRemoteConfig(e){if(this._persistence){var t,i;const s=this._persistence,n=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null===(t=this._config.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=n?n:r;Ft(o)&&this._resetSampling();const a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[A]:ct(ct({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ct({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Et(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};n(),null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(n)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):("awaiting_config"===this._recordingStatus&&(this._recordingStatus="missing_config",tw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.log)?this._lazyLoadedSessionRecording.log(e,t):tw.warn("log called before recorder was ready")}get _scriptName(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(A);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){const e=this._instance.get_property(A);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return tw.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Ft(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,s;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return tw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[De]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null===(n=h.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if("missing_config"===this._recordingStatus||"awaiting_config"===this._recordingStatus)return;return this._recordingStatus="awaiting_config",tw.info("persisted remote config is stale, requesting fresh config before starting"),void new Db(this._instance).load()}this._recordingStatus=yo,null===(i=(s=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||void 0===i||i.call(s,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=_o}onRRwebEmit(e){var t,i;null===(t=this._lazyLoadedSessionRecording)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null===(i=this._persistence)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},Jw={autocapture:class extends Zy{constructor(e){super(new GS(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Vn.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,Vn.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var i;if(!e||(null===(i=e.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const s=this;wp(e.history,t,e=>function(i,n,r){e.call(this,i,n,r),s._capturePageview(t)})}_getCurrentLocation(){const t=null==e?void 0:e.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:xt(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){const t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e){try{const t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(et,{navigation_type:e}),this._lastLocation=t}catch(t){Vn.error(`Error capturing ${e} pageview`,t)}}_setupPopstateListener(){if(this._popstateListener)return;const t=()=>{this._capturePageview("popstate")};sr(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}_setupHashchangeListener(){if(this._hashchangeListener)return;const t=()=>{this._capturePageview("hashchange")};sr(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!!(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[x]),this.rageclicks=new Uy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return xt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ft(this._config.capture_heatmaps)?Ft(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;iw.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[x]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){const e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){sw(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(s)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&s&&(this._flushHandler=this._flush.bind(this),sr(e,Ye,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),sr(s,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),sr(s,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new ub(this.instance,lb,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),sr(s,Xe,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&s&&(this._flushHandler&&e.removeEventListener(Ye,this._flushHandler),this._onClickHandler&&s.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&s.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&s.removeEventListener(Xe,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null===(t=this._deadClicksCapture)||void 0===t||t.stop(),this._initialized=!1)}_getProperties(t,i){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,s){let n=t;for(;n&&vr(n)&&!mr(n,"body");){if(n===s)return!1;let t;try{var r,o,a;t=null===(r=null!==(o=null===(a=n.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:e)||void 0===r?void 0:r.getComputedStyle(n).position}catch(e){return!1}if(ft(i,t))return!0;n=Pr(n)}return!1}(Ir(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:s),target_fixed:o,type:i}}_onClick(e,t="click"){var i;if(fr(e.target)||!sw(e))return;const s=this._getProperties(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&Br(Ir(e),this.instance.config.rageclick)&&this._capture(ct(ct({},s),{},{type:"rageclick"})),this._capture(s)}_onMouseMove(e){!fr(e.target)&&sw(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(t){if(!e)return;const i=this._config.disable_capture_url_hashes?ls(e.location.href):e.location.href,s=this._config.custom_personal_data_properties,n=this._config.mask_personal_data_properties?[...xl,...s||[]]:[],r=ur(i,n,El);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(t)}_flush(){this._buffer&&!It(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ub,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",ct({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>ct(ct({},e),{},{[`$web_vitals_${t.name}_event`]:ct({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ft(null==e?void 0:e.name)||Ft(null==e?void 0:e.value))return void ZS.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this._maskedURL(i);if(Et(s))return;const n=Rt(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void ZS.error("Ignoring metric with value >= "+this._maxAllowedValue,e);this._buffer.navigationKey!==n&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Et(this._buffer.navigationKey)&&(this._buffer.navigationKey=n,this._buffer.url=s),this._buffer.firstMetricTimestamp=Et(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=ct(ct(ct({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,xt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of ew){const s="url"===i&&"string"==typeof e.attribution[i]?this._maskedURL(e.attribution[i]):e.attribution[i];Et(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;Et(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let e,t,i,s,n=!1;const r=h.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Et(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Et(a)){const r=a.withoutAttribution,o=this.attributionMetrics;n=!Et(r),e=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(e&&t&&i&&s))return void ZS.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},c=n&&this.attributionMetrics.indexOf("INP")>-1?ct(ct({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this),c),this._initialized=!0},this._enabledServerSide=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[M]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=xt(this._perfConfig)?null===(e=this._perfConfig)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Ft(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||XS:i}get flushToCaptureTimeoutMs(){return(xt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=xt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return At(e)?e?XS:[]:kt(e)?e:YS}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=xt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){const e=xt(this._perfConfig)&&Rt(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:JS;return e>0&&6e4>=e?JS:e}get isEnabled(){const e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return ZS.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=xt(this._perfConfig)?this._perfConfig.web_vitals:At(this._perfConfig)?this._perfConfig:void 0;return At(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(ZS.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=xt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=xt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[M]:i}),this._instance.persistence.register({[L]:s})),this._enabledServerSide=i,this.startIfEnabled()}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t;const i=h.__PosthogExtensions__,s=this._callbackFlavor,n=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&Et(n)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,s,t=>{t?ZS.error("failed to load script",t):e()})}_maskedURL(t){const i=t||(null==e?void 0:e.location.href);if(!i)return void ZS.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?ls(i):i,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...xl,...n||[]]:[];return ur(s,r,El)}}},Xw={exceptionObserver:class{constructor(t){var i;this._startCapturing=()=>{var t;if(!e||!this.isEnabled||!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=i(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=s(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=n(this.captureException.bind(this)))}catch(e){QS.error("failed to start",e),this._stopCapturing()}},this._instance=t,this._remoteEnabled=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[I]),this._rateLimiter=new Kt(ct(ct({},function(e={}){var t,i,s,n;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(s=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:QS})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xt(e)?t=ct(ct({},t),e):(Et(e)?this._remoteEnabled:e)&&(t=ct(ct({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(QS.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return QS.error("failed to load script",t);e()})}_stopCapturing(){var e,t,i;null===(e=this._unwrapOnError)||void 0===e||e.call(this),this._unwrapOnError=void 0,null===(t=this._unwrapUnhandledRejection)||void 0===t||t.call(this),this._unwrapUnhandledRejection=void 0,null===(i=this._unwrapConsoleError)||void 0===i||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[I]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,s;const n=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(n))return void QS.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=Hv(),this._instance=e,this._suppressionRules=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=Ys(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new en(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Ys(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const n=e.config;if(!("errorTracking"in n))return;const r=null!==(t=null===(i=n.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[E]:this._suppressionRules,[T]:o})}get _captureExtensionExceptions(){var e;const t=!!this._instance.get_property(T),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Tt(e)||0===e.trim().length)return void $v.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>Js.has(s)?(t.push(s),i):(i[s]=e[s],i),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t));s.length>0&&$v.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(ct({[Ks]:e,[Zs]:(new Date).toISOString()},i))}catch(e){$v.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void $v.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void $v.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void $v.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void $v.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this._exceptionStepsConfig.enabled&&Ft(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,s=function(){const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();s&&(i.$release_id=s);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return e&&this._exceptionStepsBuffer.clear(),e}catch(e){return Ov(e)||$v.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(Ov(e)||$v.error("Failed to process exception event. Ignoring this exception.",e))}}_addBufferedExceptionSteps(e){try{const t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:ct(ct({},e),{},{$exception_steps:t})}catch(t){return $v.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Ks]:e,[Zs]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return xt(e)?ct({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(Tt(t)&&t.length>0&&e.$exception_types.push(t),Tt(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{const i=e.values.map(e=>{const i=gl[e.operator],s=t[e.key];if(!i||!s)return!1;const n=kt(e.value)?e.value:[e.value];return n.length>0&&i(n,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return $v.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&Bv.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(Dv))||e.some(({type:e,value:t})=>"NoResponse"===e||Tt(t)&&Nv.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(Dv))))}_isInjectedBrowserScriptException(e){return e.some(({value:e})=>Tt(e)&&qv.some(t=>e.includes(t)))}_isPostHogException(e){if(e.length>0){var t,i,s,n;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],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}_isExceptionList(e){return!Ft(e)&&kt(e)}}},Yw=ct({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,s;if(this._persistence&&this._persistence.register({[F]:!!t.productTours}),!rw(this._instance))return!this._productTourManager&&Ft(null===(i=this._persistence)||void 0===i?void 0:i.props.ph_product_tours)||nw.info("product tours disabled; stopping and clearing cached tours"),null===(s=this._productTourManager)||void 0===s||s.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&rw(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"product-tours",t=>{t?nw.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this._productTourManager=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(kt(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});const i=this._persistence;if(i){const s=i.props[ge];if(kt(s)&&!t)return this._cachedTours=s,void e(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:t=>{if(!rw(this._instance))return void e([],{isLoaded:!0});const s=t.statusCode;if(200!==s||!t.json){const i=`Product Tours API could not be loaded, status: ${s}`;return 0===s?t.error||nw.warn(i):nw.error(i),void e([],{isLoaded:!1,error:i})}const n=kt(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[ge]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){Ft(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null===(t=this._productTourManager)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this._productTourManager)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this._productTourManager)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this._productTourManager)||void 0===e||e.previousStep()}clearCache(){var e;this._cachedTours=null,null===(e=this._persistence)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this._productTourManager)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.cancelPendingTour(e)}}},Kw),ek={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(!t)return;const i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:ct(ct({},mn(e,ow)),{},{properties:ct(ct(ct({},e.properties),h?{$set:ct(ct({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:ct(ct({},null!==(s=null===(n=e.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(e)||(aw.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(e)||(aw.error("prepare_external_dependency_script returned null"),null)}return e}_patchSiteAppElementInsertionMethods(){var e,t,i,n,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=null==s?void 0:s.defaultView,u=null==c||null===(e=c.Node)||void 0===e?void 0:e.prototype;if(!c||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();const d=[],h=this,p=new WeakSet,_=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const s=e[t];e[t]=i(s),d.push(()=>{e[t]=s})},g=e=>{if(p.has(e))return e;const t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!Pt(e));return _(u,"appendChild",e=>function(t){const i=g(t);return i?e.call(this,i):t}),_(u,"insertBefore",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):t}),_(u,"replaceChild",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):i}),[null===(t=c.Element)||void 0===t?void 0:t.prototype,null===(i=c.Document)||void 0===i?void 0:i.prototype,null===(n=c.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(e=>{_(e,"append",e=>function(...t){return e.apply(this,f(t))}),_(e,"prepend",e=>function(...t){return e.apply(this,f(t))})}),[null===(r=c.Element)||void 0===r?void 0:r.prototype,null===(o=c.CharacterData)||void 0===o?void 0:o.prototype,null===(a=c.DocumentType)||void 0===a?void 0:a.prototype].forEach(e=>{_(e,"before",e=>function(...t){return e.apply(this,f(t))}),_(e,"after",e=>function(...t){return e.apply(this,f(t))}),_(e,"replaceWith",e=>function(...t){const i=f(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),_(null===(l=c.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){const s=g(i);return s?e.call(this,t,s):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null===(t=this._restoreSiteAppElementPatches)||void 0===t||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){const i=this._patchSiteAppElementInsertionMethods();try{const s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(aw.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this._stopBuffering)||void 0===i||i.call(this))};let s=!1;const n=n=>{t.errored=!n,t.loaded=!0,aw.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:i}=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),n(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){aw.error(lw+e.id,t),n(!1)}if(s&&t.loaded)try{i()}catch(i){aw.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}_setupSiteApps(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){aw.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void aw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this._stopBuffering)||void 0===i||i.call(this),!e.ok)return;const n=e.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:e,url:t}of n.siteApps){var r,o;h[`__$$ph_site_app_${e}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return aw.error(lw+e,t)})}else aw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},tk={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{const e=this._syncHostnamesForPatch();var t,i;e?(Et(this._restoreXHRPatch)&&(this._restoreXHRPatch=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Et(this._restoreFetchPatch)&&(this._restoreFetchPatch=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"tracing-headers",t=>{if(t)return KS.error("failed to load script",t);e()})}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){const e=this._getConfiguredHostnames();return kt(e)?(kt(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(kt(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},ik=ct({surveys:class extends hw{constructor(e){var t;super(new mw(e),(t=e,{get projectToken(){return t.config.token},kv:new vw(t)})),this._instance=e}_sendSurveysRequest(e,t){const i=t.query?Ub(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},Kw),sk={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){h.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,n=void 0){var r,o;if(nr(this.instance.config))return!1;if(!e||!s)return!1;t=null!==(r=t)&&void 0!==r?r:e.location,n=null!==(o=n)&&void 0!==o?o:e.history;try{if(!i){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}i=null==e?void 0:e.localStorage}const s=yw||dr(t.hash,"__posthog")||dr(t.hash,"state");let r;const o=s?cs(()=>JSON.parse(atob(decodeURIComponent(s))))||cs(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(bw)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){const t=h.ph_load_toolbar||h.ph_load_editor;!Ft(t)&&Ct(t)?t(e,this.instance):Sw.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==s?void 0:s.getElementById("__POSTHOG_TOOLBAR__"));if(!e||i)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ct(ct({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(e.localStorage.setItem(bw,JSON.stringify(ct(ct({},r),{},{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var o,a;this._setToolbarState(1),null===(o=h.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",e=>{if(e)return Sw.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)}),sr(e,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(r)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},nk=ct({experiments:class t{get _config(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(e=!1)=>{this.getWebExperiments(e=>{t._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;this._flagToExperiments&&(t._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=this._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e));const s=this._instance.getFeatureFlag(e.feature_flag_key);Tt(s)&&e.variants[s]&&this._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(const i in e.variants){const s=e.variants[i];t._matchesTestVariant(s,this._instance)&&this._applyTransforms(e.name,i,s.transforms)}})},e)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t._logInfo(Fw);else if(!this._config.disable_web_experiments){if(Ft(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t._logInfo("applying feature flags",e),e.forEach(e=>{var t;if(this._flagToExperiments&&(null===(t=this._flagToExperiments)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this._applyTransforms(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){const e=t.getWindowLocation();if(null==e?void 0:e.search){const i=cr(null==e?void 0:e.search,"__experiment_id"),s=cr(null==e?void 0:e.search,"__experiment_variant");i&&s&&(t._logInfo(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);const s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this._config.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,i,s){const n=s.filter(t=>t.id===e);n&&n.length>0&&(t._logInfo(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this._applyTransforms(n[0].name,i,n[0].variants[i].transforms))}static _matchesTestVariant(e,i){return!Ft(e.conditions)&&t._matchUrlConditions(e,i)&&t._matchUTMConditions(e)}static _matchUrlConditions(e,i){var s;if(Ft(e.conditions)||Ft(null===(s=e.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,a;const t=_r(i,n.href);return!(null===(r=e.conditions)||void 0===r?void 0:r.url)||Rw[null!==(o=null===(a=e.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](e.conditions.url,t)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(Ft(e.conditions)||Ft(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=Ml();if(i.utm_source){var s,n,r,o,a,l,c,u;const t=!(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static _logInfo(e,...t){Vn.info(`[WebExperiments] ${e}`,t)}_applyTransforms(e,i,s){this._is_bot()?t._logInfo(Fw):"control"!==i?s.forEach(s=>{if(s.selector){var n;t._logInfo(`applying transform of variant ${i} for experiment ${e} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(e=>{const t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):t._logInfo("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?gS(i,this._config.custom_blocked_useragents):void 0}}},Kw),rk={conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations)return;if(this._remoteConfigSuccessful=e.ok,!e.ok)return;const t=e.config.conversations;Ft(t)||(At(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this._isInitializing)return;if(this._instance.config.disable_conversations)return;if(nr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==h?void 0:h.__PosthogExtensions__;if(e&&!Et(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{const t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);const i=e.loadExternalDependency;if(!i)return void this._handleLoadError(Qe);i(this._instance,"conversations",t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else Lw.error("Conversations enabled but missing token in remote config.")}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,Lw.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Lw.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Lw.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():Lw.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Pt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":nr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Et(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Ft(this._remoteConfig)||!this._remoteConfig.token?"missing_token":(null==h?void 0:h.__PosthogExtensions__)?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return rt(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Lw.warn(Aw),null)})()}getMessages(e,t){var i=this;return rt(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Lw.warn(Aw),null)})()}markAsRead(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Lw.warn(Aw),null)})()}getTickets(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Lw.warn(Aw),null)})()}requestRestoreLink(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Lw.warn(Aw),null)})()}restoreFromToken(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Lw.warn(Aw),null)})()}restoreFromUrlToken(){var e=this;return rt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Lw.warn(Aw),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}_onIdentityCleared(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},ok={logs:class{constructor(t){var i;this._instance=t,this.name=Xg,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Gn("[logs]"),this._coreLogger=ct(ct({},this._logger),{},{error:(...e)=>{e.some(qw)||this._logger.error(...e)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null===(e=this._core)||void 0===e||e.onReconnect(),null===(t=this._consoleCore)||void 0===t||t.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this._isLogsEnabled=!0),e&&sr(e,"online",this._onReconnect)}_buildCore(e,t,i,s){var n;const r=Ow(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,i);return[new Dn(this._createHost(e,t),r,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,s),r]}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,e=>{this._queue=e})),this._core}_getConsoleCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._consoleCore&&this._consoleResolvedFrom===t||(null===(i=this._consoleCore)||void 0===i||i.reset(),this._consoleResolvedFrom=t,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Dw)),this._consoleCore}setup(e){var t;if(this._disposed)return;this._client=e,(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();let i=!1;const s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?s.dispose():(this._remoteConfigSubscription=s,i||this.loadIfEnabled())}dispose(){var t,i,s,n;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null===(t=this._remoteConfigSubscription)||void 0===t||t.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==e||e.removeEventListener("online",this._onReconnect),null===(i=this._consoleLogsDispose)||void 0===i||i.call(this),this._consoleLogsDispose=void 0,null===(s=this._core)||void 0===s||s.reset(),null===(n=this._consoleCore)||void 0===n||n.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;const s=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;Ft(s)?this._stopRecorderStartedByPersistedHint():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!s}),s?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,s;this._stopConsoleRecorder(),null===(e=this._core)||void 0===e||e.clearQueue(),this._queue=[],null===(t=this._core)||void 0===t||t.reset(),null===(i=this._consoleCore)||void 0===i||i.clearQueue(),this._consoleQueue=[],null===(s=this._consoleCore)||void 0===s||s.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_persistedCaptureHint(){var e;return!!(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e[R])}_remoteConfigWillArrive(){var e,t,i;return!(null===(e=this._instance)||void 0===e||null===(t=e._shouldDisableFlags)||void 0===t?void 0:t.call(e))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null===(e=this._consoleCore)||void 0===e||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!(null==h?void 0:h.console))return;const t=Ow(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs).maxBufferSize;let i=!0;this._consoleRecorderUnpatchers.push(()=>{i=!1});for(const e of $w){let s;try{s=wv(h.console[e])}catch(e){continue}s&&this._consoleRecorderUnpatchers.push(wp(h.console,e,n=>{const r=(...s)=>{try{i&&this._recordConsoleEntry(e,s,t)}catch(e){}return n.apply(h.console,s)};return r.__rrweb_original__=s,r}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var s;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(i>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(const e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){const e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(e=>this._logFlushError(e)),this._consoleCore&&this._consoleCore.flush().catch(e=>this._logFlushError(e)))}_logFlushError(e){qw(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();const t=e.loadExternalDependency;if(!t)return this._logger.error(Qe),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",t=>{if(this._isLoading=!1,this._disposed||!this._isLogsEnabled)return;const i=e.logs;if(t||!(null==i?void 0:i.initializeLogs))this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var s;const e=this._takeConsoleBuffer();var n,r;this._consoleLogsDispose=i.initializeLogs(null!==(s=this._client)&&void 0!==s?s:this._instance),this._isLoaded=!0,e.length>0&&(null===(n=i.replayConsoleBuffer)||void 0===n||n.call(i,null!==(r=this._client)&&void 0!==r?r:this._instance,e))}})}catch(e){throw this._isLoading=!1,e}}_createHost(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===ut.LogsQueue?e():void 0,setPersistedProperty(e,i){var s;e===ut.LogsQueue&&t(null!==(s=i)&&void 0!==s?s:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Xa.LIB_NAME,getLibraryVersion:()=>Xa.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(hr(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:Bw(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=e=>{i||(i=!0,clearTimeout(n),t(e))},n=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Bw(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{const t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`logs request failed with status ${t}`)});else{var i;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Bw(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`logs request failed with status ${t}`)})}}})})}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=pr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,Xa.LIB_NAME,e=>{this._queue=e}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Dw,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,i,s,n){if(0===t.length)return;const r=t.map(e=>e.record);n([]);const o=Ln(r,Rn(i,Xa.LIB_NAME,Xa.LIB_VERSION),s,Xa.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,Ft(s)||(t.sessionStartTimestamp=s),Ft(n)||(t.lastActivityTimestamp=n)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ls(h.location.href):h.location.href),this._instance.featureFlags){const e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},ak={metrics:class{constructor(e){this._instance=e,this._logger=Gn("[metrics]"),this._disposed=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this._disposed)return;const t=!!(null===(e=this._instance.config.metrics)||void 0===e?void 0:e.network);t&&!this._stopNetworkMetrics?this._stopNetworkMetrics=(e=>{let t=!0;const i=()=>t?(e=>{var t;const i=null===(t=e.config.metrics)||void 0===t?void 0:t.network;return!0===i?{}:i||void 0})(e):void 0,s=Gw(e,i),n=Qw(e,i);return()=>{t=!1,s(),n()}})(this._instance):!t&&this._stopNetworkMetrics&&(this._stopNetworkMetrics(),this._stopNetworkMetrics=void 0)}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,this._core=new Hn(this._createHost(),function(e){var t,i,s,n,r;const o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){const t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(e=>this._logger.error("PostHog metrics flush failed:",e))}reset(){var e;null===(e=this._core)||void 0===e||e.reset()}dispose(){var e,t;this._disposed=!0,null===(e=this._stopNetworkMetrics)||void 0===e||e.call(this),this._stopNetworkMetrics=void 0,null===(t=this._core)||void 0===t||t.reset()}_createHost(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Xa.LIB_NAME,getLibraryVersion:()=>Xa.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(i=>{let s=!1;const n=e=>{s||(s=!0,clearTimeout(r),i(e))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ct(ct({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;n({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};VS.__defaultExtensionClasses=ct({},ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct({},Kw),Zw),Jw),Xw),Yw),ek),ik),tk),sk),nk),rk),ok),ak)),function(){Xa.SDK_DIST_CHANNEL="cdn";const t=h.posthog;if(t&&!kt(t._i))return;const i=MS[qS]=new VS;if(t){const e=[];Kn(t._i,function(s){if(s&&kt(s)){const n=i.init(s[0],s[1],s[2]),r=t[s[2]]||t;n.__loaded&&-1===e.indexOf(r)&&(e.push(r),n._execute_array.call(n.people,r.people),n._execute_array(r))}})}i.__SV=1,h.posthog=i,function(){function t(){t.done||(t.done=!0,sS=!1,Kn(MS,function(e){e._dom_loaded()}))}(null==s?void 0:s.addEventListener)?"complete"===s.readyState?t():sr(s,"DOMContentLoaded",t,{capture:!1}):e&&Vn.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
1
+ !function(){const e="u">typeof window?window:void 0,t="u">typeof globalThis?globalThis:e,i=null==t?void 0:t.navigator,s=null==t?void 0:t.document,n=null==t?void 0:t.location,r=null==t?void 0:t.fetch,o=(null==t?void 0:t.XMLHttpRequest)&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,c=null==i?void 0:i.userAgent;function u(){return!(!e||!1===e.navigator.onLine)}const d="undefined"!=typeof globalThis?globalThis:e;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});const h=null!=e?e:{},p="$people_distinct_id",_="distinct_id",g="$device_id",f="$device_model",v="__alias",m="__cmpns",y="$fbc",b="$fbc_persistence",S="$fbp",w="$fbp_persistence",k="__timers",C="$autocapture_disabled_server_side",x="$heatmaps_enabled_server_side",I="$exception_capture_enabled_server_side",E="$error_tracking_suppression_rules",T="$error_tracking_capture_extension_exceptions",M="$web_vitals_enabled_server_side",P="$dead_clicks_enabled_server_side",F="$product_tours_enabled_server_side",R="$logs_capture_enabled_server_side",L="$web_vitals_allowed_metrics",A="$session_recording_remote_config",O="$session_recording_enabled_server_side",D="$replay_sample_rate",N="$replay_override_sampling",B="$replay_override_linked_flag",q="$replay_override_url_trigger",H="$replay_override_event_trigger",W="$sesid",z="$session_is_sampled",U="$session_past_minimum_duration",j="$session_recording_url_trigger_activated_session",V="$session_recording_event_trigger_activated_session",G="$posthog_sr_group_event_trigger_",Q="$posthog_sr_group_url_trigger_",K="$posthog_sr_group_sampling_",Z="$debug_first_full_snapshot_timestamp",J="$sess_rec_flush_size",X="$enabled_feature_flags",Y="$active_feature_flags",ee="$early_access_features",te="$feature_flag_details",ie="$feature_flag_payloads",se="$feature_flag_request_id",ne="$minimal_flag_called_events",re="$override_feature_flags",oe="$override_feature_flag_payloads",ae="$stored_person_properties",le="$stored_group_properties",ce="$groups",ue="$surveys",de="$surveys_loaded_at",he="$surveys_activated",pe="$surveys_activated_session",_e="$surveys_activated_timestamps",ge="ph_product_tours",fe="$product_tours_activated",ve="$product_tours_activated_session",me="$conversations_widget_session_id",ye="$conversations_ticket_id",be="$conversations_widget_state",Se="$conversations_user_traits",we="$flag_call_reported",ke="$flag_call_reported_session_id",Ce="$feature_flag_errors",xe="$feature_flag_evaluated_at",Ie="$user_state",Ee="$client_session_props",Te="$capture_rate_limit",Me="$initial_campaign_params",Pe="$initial_referrer_info",Fe="$initial_person_info",Re="$epp",Le="$posthog_cookieless",Ae="$cookieless_mode",Oe="$sdk_debug_extensions_init_method",$e="$sdk_debug_extensions_init_time_ms",De="$sdk_debug_recording_script_not_loaded",Ne="$sdk_debug_replay_event_trigger_status",Be="$sdk_debug_replay_linked_flag_trigger_status",qe="$sdk_debug_replay_matched_recording_trigger_groups",He="$sdk_debug_replay_pending_trigger_conditions",We="$sdk_debug_replay_remote_trigger_matching_config",ze="$sdk_debug_replay_trigger_groups_count",Ue="$sdk_debug_replay_url_trigger_status",je="$sdk_debug_rrweb_attached",Ve="$sdk_debug_rrweb_start_attempted",Ge="$session_recording_start_reason",Qe="PostHog loadExternalDependency extension not found.",Ke="anonymous",Ze="identified",Je="identified_only",Xe="visibilitychange",Ye="beforeunload",et="$pageview",tt="$pageleave",it="$identify",st="$groupidentify";function nt(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,n)}function rt(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(e){nt(r,s,n,o,a,"next",e)}function a(e){nt(r,s,n,o,a,"throw",e)}o(void 0)})}}function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function at(e,t,i){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=ot(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function lt(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function ct(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(i),!0).forEach(function(t){at(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):lt(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var ut=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),dt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const ht="min_length",pt="max_length",_t=["$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"],gt=["token"];function ft(e,t){return-1!==e.indexOf(t)}const vt=function(e){return e.trim()},mt=function(e){return e.replace(/^\$/,"")};function yt(e){var t;const i=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const bt=Object.prototype,St=bt.hasOwnProperty,wt=bt.toString,kt=Array.isArray||function(e){return"[object Array]"===wt.call(e)},Ct=e=>"function"==typeof e,xt=e=>e===Object(e)&&!kt(e),It=e=>{if(xt(e)){for(const t in e)if(St.call(e,t))return!1;return!0}return!1},Et=e=>void 0===e,Tt=e=>"[object String]"==wt.call(e),Mt=e=>Tt(e)&&0===e.trim().length,Pt=e=>null===e,Ft=e=>Et(e)||Pt(e),Rt=e=>"[object Number]"==wt.call(e)&&e==e,Lt=e=>Rt(e)&&e>0,At=e=>"[object Boolean]"===wt.call(e),Ot=e=>e instanceof FormData,$t=e=>ft(_t,e),Dt=e=>ft(gt,e);function Nt(e){return null===e||"object"!=typeof e}function Bt(e,t){return{}.toString.call(e)===`[object ${t}]`}function qt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Wt(e,Error)}}function Ht(e){return"u">typeof Event&&Wt(e,Event)}function Wt(e,t){try{return e instanceof t}catch(e){return!1}}const zt=[!0,"true",1,"1","yes"],Ut=e=>ft(zt,e),jt=[!1,"false",0,"0","no"],Vt=["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"],Gt=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return Vt.concat(t).some(e=>{const t=e.toLowerCase();return-1!==i.indexOf(t)})};function Qt(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),Rt(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),Qt(null!=n?n:i,t,i,s))}var Kt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Qt(e.bucketSize,0,100,e._logger),this._refillRate=Qt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Qt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){const i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let n=this._buckets[s];return n?this._applyRefill(n,i):(n={tokens:this._bucketSize,lastAccess:i},this._buckets[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(t=this._onBucketRateLimited)||void 0===t||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}};const Zt="Mobile",Jt="Android",Xt="Tablet",Yt="Android Tablet",ei="iPad",ti="Apple Watch",ii="Safari",si="BlackBerry",ni="Samsung Internet",ri="Chrome",oi="Chrome iOS",ai="Internet Explorer",li="Internet Explorer Mobile",ci="Opera",ui="Microsoft Edge",di="Firefox",hi="Firefox iOS",pi="Nintendo",_i="PlayStation",gi="Xbox",fi="Android Mobile",vi="Mobile Safari",mi="Windows",yi="Windows Phone",bi="Nokia",Si="Ouya",wi="Generic "+Zt.toLowerCase(),ki="Generic "+Xt.toLowerCase(),Ci="Konqueror",xi="Oculus Browser",Ii="Vivaldi",Ei="Yandex",Ti="Whale",Mi="DuckDuckGo",Pi="Pale Moon",Fi="Waterfox",Ri="Brave",Li="Claude",Ai="Codex",Oi="ChatGPT",$i="Google Search App",Di=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ni=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Bi=new RegExp(gi,"i"),qi=new RegExp("PlayStation \\w+","i"),Hi=new RegExp("Nintendo \\w+","i"),Wi=new RegExp("BlackBerry|PlayBook|BB10","i"),zi={"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"},Ui=function(e,t,i,s){t=t||"";const n=function(e){return(null==e?void 0:e.brave)?Ri:null}(i);return n||((null==s?void 0:s.detectGoogleSearchApp)&&ft(e,"GSA/")?$i:ft(e," OPR/")&&ft(e,"Mini")?"Opera Mini":ft(e," OPR/")?ci:Wi.test(e)?si:ft(e,"IEMobile")||ft(e,"WPDesktop")?li:ft(e,"OculusBrowser")?xi:ft(e,"SamsungBrowser")?ni:ft(e,"Edge")||ft(e,"Edg/")?ui:ft(e,"Vivaldi/")?Ii:ft(e,"YaBrowser/")?Ei:ft(e,"Whale/")?Ti:ft(e,"DuckDuckGo/")||ft(e,"Ddg/")?Mi:ft(e,"Claude/")?Li:ft(e,"Codex/")?Ai:ft(e,"ChatGPT/")?Oi:ft(e,"FBIOS")?"Facebook Mobile":ft(e,"UCWEB")||ft(e,"UCBrowser")?"UC Browser":ft(e,"CriOS")?oi:ft(e,"CrMo")||ft(e,ri)?ri:ft(e,Jt)&&ft(e,ii)?fi:ft(e,"FxiOS")?hi:ft(e.toLowerCase(),Ci.toLowerCase())?Ci:ft(e,"Brave/")?Ri:((e,t)=>t&&ft(t,"Apple")||function(e){return ft(e,ii)&&!ft(e,ri)&&!ft(e,Jt)}(e))(e,t)?ft(e,Zt)?vi:ii:ft(e,"PaleMoon/")?Pi:ft(e,"Waterfox/")?Fi:ft(e,di)?di:ft(e,"MSIE")||ft(e,"Trident/")?ai:ft(e,"Gecko")?di:"")},ji={[li]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ii]:[Di],[vi]:[Di],[ci]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Di],[fi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ni]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Li]:[Ni],[Ai]:[Ni],[Oi]:[Ni],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Fi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Vi=function(e,t,i,s){const n=Ui(e,t,i,s),r=ji[n];if(Et(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},Gi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[gi,e&&e[1]||""]],[new RegExp(pi,"i"),[pi,""]],[new RegExp(_i,"i"),[_i,""]],[Wi,[si,""]],[new RegExp(mi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[yi,""];if(new RegExp(Zt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=zi[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[mi,e]}return[mi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Jt,[e[2],e[3],e[4]||"0"].join(".")]:[Jt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Qi=function(e){for(let t=0;Gi.length>t;t++){const[i,s]=Gi[t],n=i.exec(e),r=n&&(Ct(s)?s(n,e):s);if(r)return r}return["",""]},Ki=function(e){return Hi.test(e)?pi:qi.test(e)?_i:Bi.test(e)?gi:new RegExp(Si,"i").test(e)?Si:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?yi:/iPad/.test(e)?ei:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ti:Wi.test(e)?si:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(bi,"i").test(e)?bi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Jt:Yt:new RegExp("(pda|Mobile)","i").test(e)?wi:new RegExp(Xt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?ki:""},Zi=function(e,t){var i;const s=Ki(e);return s===ei||s===Yt||"Kobo"===s||"Kindle Fire"===s||s===ki?Xt:s===pi||s===gi||s===_i||s===Si?"Console":s===ti?"Wearable":s?Zt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(n=null==t?void 0:t.screenWidth)&&void 0!==n?n:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?Zt:Xt:"Desktop";var n,r,o},Ji=/\bFBAV\/(\d+(?:\.\d+)*)/i,Xi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ji],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ji],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ji],[/\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"]],Yi="[Truncated]",es="[Unserializable]";function ts(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const s=e.charCodeAt(i+1);56320>s||s>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function is(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(const s of i){let i;try{i=t[s]}catch(e){i=es}Object.defineProperty(e,s,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}Date,Date;const ss=3e5;var ns=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,ss);if(!t)return this._installedAt=i,void(this._until=i+s);this._until=Math.max(this._until,Math.min(i+s,this._installedAt+ss))}remainingMs(){const e=Date.now();if(this._installedAt-5e3>e)return this.reset(),0;const t=Math.min(ss,Math.max(0,this._until-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this._until=0,this._installedAt=0}constructor(){this._until=0,this._installedAt=0}};const rs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function os(e,t){return"string"==typeof(i=e)&&rs.test(i)?e:t();var i}function as(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function ls(e){return e?e.split("#")[0]:e}function cs(e){try{return e()}catch(e){return}}function us(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function ds(e,t,i){return hs.apply(this,arguments)}function hs(){return(hs=rt(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,n)=>{s=us(()=>{try{null==i||i(),e()}catch(e){n(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let ps,_s,gs;function fs(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return gs&&i.length===_s||(_s=i.length,gs=i.reduce((i,s)=>{ps||(ps={});const n=ps[s];if(n)i[n[0]]=n[1];else{const n=e(s);for(let e=n.length-1;e>=0;e--){const r=n[e],o=null==r?void 0:r.filename,a=t[s];if(o&&a){i[o]=a,ps[s]=[o,a];break}}}return i},{})),gs}var vs=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return rt(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&kt(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,n;if(null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch(e){}return ct(ct({},e),{},{cause:s,stack:n,errors:null===(i=e.errors)||void 0===i?void 0:i.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return rt(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){const i=[],s=(e,n,r)=>{var o;const a=i.length,l=void 0===n?ct(ct({type:"string"==typeof t.type&&t.type.length>0?t.type:"generic"},"boolean"==typeof t.handled?{handled:t.handled}:void 0===t.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof t.synthetic?t.synthetic:e.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:e.synthetic,exception_id:a,parent_id:n},c={type:e.type,value:e.value,mechanism:l};e.stack&&(c.stacktrace={type:"raw",frames:e.stack}),i.push(c),e.cause&&s(e.cause,a,"cause");for(const t of null!==(o=e.errors)&&void 0!==o?o:[])s(t,a,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:fs(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}getAggregateErrors(e){try{if(qt(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;const s=null===(t=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===t?void 0:t.value;if("function"==typeof s&&"AggregateError"===s.name){const t=e.errors;return kt(t)?t:void 0}i=Object.getPrototypeOf(i)}}}catch(e){}}buildCoercingContext(e,t,i=0){let s=0,n=0,r=!1;const o=new Set,a=[],l={},c=(e,t,i=0)=>{const c=u(t,i),d=c.apply;if(c.apply=t=>{a.push(e);try{return d(t)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(e))return this.coerceFallback(c);const h="object"==typeof e&&null!==e||"function"==typeof e;if(0===i&&s>=50||h&&o.has(e))return;h&&o.add(e),0===i&&s++;const p=this.getAggregateErrors(e);let _,g;r||(r=!!p);try{if(_=this.applyCoercers(e,c),!_)throw l}catch(e){if(e===l)return void(0===i&&s--);if(!r)throw e;_=this.coerceFallback(c)}if(!p||s>=50)return _;try{g=p.length}catch(e){return _}if(!Number.isInteger(g)||0>g||g>4294967295)return _;const f=[];for(let e=0;50>s&&1e3>n&&g>e;e++){let i;n++;try{i=c.next(p[e])}catch(e){s++,i=this.coerceFallback(u(t+1))}i&&f.push(i)}return ct(ct({},_),{},{errors:f})},u=(i,s=0)=>ct(ct({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:0==i?e:{},apply(e){const t=c(e,i,s+1);if(!t)throw l;return t},next:e=>c(e,i+1)}),d=u(i);return ct(ct({},d),{},{apply:e=>{var t;return null!==(t=c(e,i))&&void 0!==t?t:this.coerceFallback(d)}})}};const ms=/^([a-z][a-z0-9.+-]+):/i,ys=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function bs(e){if(!e||"<anonymous>"===e)return!1;const t=ms.exec(e);return!t||ys.includes(t[1].toLowerCase())}function Ss(e,t,i,s,n){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:bs(t)};return Et(s)||(r.lineno=s),Et(n)||(r.colno=n),r}const ws=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},ks=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Cs=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xs=/\((\S*)(?::(\d+))(?::(\d+))\)/,Is=(e,t)=>{const i=ks.exec(e);if(i){const[,e,s,n]=i;return Ss(t,e,"?",+s,+n)}const s=Cs.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){const e=xs.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}const[e,i]=ws(s[1]||"?",s[2]);return Ss(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Es=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ts=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ms=(e,t)=>{const i=Es.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=Ts.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=ws(s,e),Ss(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ps=/\(error: (.*)\)/;function Fs(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Rs(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!Fs(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}function Ls(e,t){const i=t.start+t.length,s=Os(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function As(e,t){let i=t.start;for(;i>0&&Fs(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Os(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&Fs(e[s],e[s-t.length]);)s++;return s-i}function $s(e,t){const i=t[0];let s=e.length-(i?As(e,i):0);for(const i of t)s-=Os(e,i);return s}function Ds(e,t,i){for(let s=0;e.length>s;s++){const n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Ns=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=Tt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Bt(e,"DOMException")}isDOMError(e){return Bt(e,"DOMError")}},Bs=class{match(e){return qt(e)}coerce(e,t){var i;const s=this.getStack(e),n=void 0===s?null===(i=t.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:n,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if("string"==typeof t&&t.length>0)return t;const i=e.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(e){return}}},qs=class{match(e){return!!Bt(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const s=t.apply(e.message);return ct(ct({},s),{},{stack:null!==(i=this._buildLocationStack(e))&&void 0!==i?i:s.stack,synthetic:!0})}_hasUsableMessage(e){return Tt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;const s=e,n=null!==(t=s.lineno)&&void 0!==t?t:0,r=null!==(i=s.colno)&&void 0!==i?i:0;if(Tt(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Hs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Ws=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[s,n]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(Hs);return s&&(t=s[1],i=s[2]),[t,i]}};const zs=["fatal","error","warning","log","info","debug"];function Us(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const s=i.slice(0,e).join(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var js=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;const n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(s=t.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Ht(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Tt(t)&&!Mt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${Us(e)}`}isSeverityLevel(e){return Tt(e)&&!Mt(e)&&zs.indexOf(e)>=0}getStack(e){try{return Tt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Tt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(qt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Vs=class{match(e){return Ht(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Us(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Gs=class{match(e){return Nt(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Qs=class{match(e){return Bt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ht(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return Nt(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};const Ks="$message",Zs="$timestamp",Js=new Set([Ks,Zs]),Xs={enabled:!0,max_bytes:32768};function Ys(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Xs.enabled,max_bytes:tn(e.max_bytes,Xs.max_bytes)}:ct({},Xs)}var en=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=Ys(e)}setConfig(e){this._config=Ys(e),this._trimToMaxBytes()}add(e){const t=function(e){let t;try{t=yt(e)}catch(e){return}try{const e=JSON.parse(t);if(!xt(e))return;const i=e,s=i[Ks],n=i[Zs];if(!Tt(s)||0===s.trim().length)return;if(!Tt(n)&&!Rt(n))return;return{step:i,json:t}}catch(e){return}}(e);if(!t)return;const i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,this._trimToMaxBytes())}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){const e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function tn(e,t){if(!Rt(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const sn=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function nn(e){return"string"==typeof e||e}function rn(e){return"string"==typeof e?e:void 0}const on=["$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"],an="NativeGzipValidationError",ln=e=>e.length>=2&&31===e[0]&&139===e[1],cn=(e,t)=>e===dt.GZipJS||t===dt.GZipJS||"gzip"===t,un=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),dn=e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return un(e)||t===an};let hn;const pn=e=>{throw as(an,`Native gzip produced invalid output: ${e}`)},_n=(gn=rt(function*(e,t){18>e.size&&pn("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ln(i)&&8===i[2]||pn("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{const t=(()=>{if(hn)return hn;hn=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;hn[e]=t>>>0}return hn})();let i=4294967295;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&pn("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&pn("invalid-size")}),function(e,t){return gn.apply(this,arguments)});var gn;function fn(e){return vn.apply(this,arguments)}function vn(){return vn=rt(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),n=i.writable.getWriter(),r=n.write(t).then(()=>n.close()).catch((s=rt(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield _n(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var s}),vn.apply(this,arguments)}function mn(e,t){if(null==e)return{};var i,s,n=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}const yn={}.propertyIsEnumerable;function bn(e,t){try{return kn(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function Sn(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Yi};if(i.remainingNodes--,At(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){const i=e.toString(),s=BigInt("9223372036854775808");return e>=s||-s>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(e,t);if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:ts(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Yi};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?ts(i):String(i)}}i.ancestors.add(e);try{try{const n=e.toJSON;if("function"==typeof n)return Sn(n.call(e),t,i,s+1)}catch(e){}return kt(e)?{arrayValue:{values:wn(e,t,i,s+1)}}:{kvlistValue:{values:kn(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:ts(String(e))}}function wn(e,t,i,s){const n=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(Ft(r))continue;n.push(Sn(r,t,i,s))}catch(e){n.push({stringValue:es})}return e.length>o&&n.push({stringValue:Yi}),n}function kn(e,t,i,s){const n=[];for(const r in e)if(yn.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(Pt(o)||Et(o))continue;n.push({key:ts(r),value:Sn(o,t,i,s)})}catch(e){n.push({key:ts(r),value:{stringValue:es}})}}return n}function Cn(e,t,i){return ct(ct(ct(ct({},is({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}const xn=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function In(e,t){const i=is({},e),s={};for(const e of xn)({}).hasOwnProperty.call(i,e)&&(s[e]=i[e],delete i[e]);return[...bn(i,t),...bn(s,t)]}const En={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 Tn={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}},Mn=Tn.info;function Pn(e){try{return ts(String(e))}catch(e){return es}}function Fn(e,t,i,s){const n=e.level||"info",{text:r,number:o}=Tn[n]||Mn,a=function(e=Date.now()){return String(e)+"000000"}(Rt(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Ft(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Ft(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=ct({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const t of e){let e;try{e=u[t]}catch(t){e=es}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Pn(e.body)},attributes:bn(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),Et(e.trace_flags)||(d.flags=e.trace_flags),d}function Rn(e,t,i){return Cn(e,t,i)}function Ln(e,t,i,s){return{resourceLogs:[{resource:{attributes:In(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var An=class{constructor(e){this._onFire=e,this._firesAt=0}get pending(){return!!this._timer}arm(e){this.clear(),this._firesAt=Date.now()+e,this._timer=us(()=>{this._timer=void 0,this._onFire()},e)}armNoEarlierThan(e){this._timer&&Date.now()+e<=this._firesAt||this.arm(e)}clear(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}};function On(){return.75+.5*Math.random()}function $n(e,t,i,s){const n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,e)))*i)}var Dn=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=s,this._onReady=n,this._waitForStoragePersist=r,this._scopeName=o,this._flushTimer=new An(()=>this._flushInBackground()),this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._retryAfter=new ns,this._consecutiveFlushFailures=0,this._flushJitter=1,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(ut.LogsQueue,[])}reset(){this._flushTimer.clear(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.reset(),this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushJitter=1,this._retryAfter.isOpen()?this._hasQueuedRecords()&&this._armFlushTimer():this._flushInBackground()}captureLog(e,t){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const s=this._runBeforeSend(e);if(null===s)return;if(!s.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;const n={record:Fn(s,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(n))}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Log was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return s}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;const e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn(`captureLog dropping logs: exceeded ${this._maxLogsPerInterval} logs per ${this._rateCapWindowMs}ms`),this._droppedWarned=!0),!1)}flush(){var e=this;return rt(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return rt(function*(){var t;e._flushTimer.clear();let i=null!==(t=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const s=i.length;let n=0;for(;i.length>0&&s>n;){var r,o;const t=e._queueGeneration;e._evictedSinceAdvance=0;const s=Math.min(i.length,e._maxBatchRecordsPerPost),a=i.slice(0,s),l=Ln(a.map(e=>e.record),e._buildResourceAttributes(),null!==(r=e._scopeName)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(l);if(e._queueGeneration!==t)return;if("too-large"===c.kind&&a.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(a.length/2)),e._logger.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${e._maxBatchRecordsPerPost}`);else{if(e._retryAfter.record(c),e._flushTimer.pending&&e._flushTimer.arm(Math.max(e._flushIntervalMs,e._retryAfter.remainingMs())),"retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e._logger.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(a.length),i=null!==(o=e._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==o?o:[],n+=a.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return rt(function*(){var i;const s=Math.max(0,e-t._evictedSinceAdvance),n=null!==(i=t._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(ut.LogsQueue,n.slice(s)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return Rn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(ut.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(ut.LogsQueue,i),this._maxBufferSize>i.length||this._retryAfter.isOpen()?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(Math.max(this._flushIntervalMs,this._retryAfter.remainingMs()))}_nextFlushDelay(){return Math.max($n(this._flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_hasQueuedRecords(){const e=this._instance.getPersistedProperty(ut.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return rt(function*(){t._flushTimer.clear();const i=t.flush().catch(()=>{});void 0!==e?yield ds(i,e):yield i})()}flushWithTimeout(e){var t=this;return rt(function*(){const i=t.flush();yield ds(i,e,()=>{i.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0,this._flushJitter=1},e=>{this._consecutiveFlushFailures++,this._flushJitter=On(),this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._flushTimer.armNoEarlierThan(this._nextFlushDelay())})}};const Nn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Bn(e){return String(e)+"000000"}function qn(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${n}`}var Hn=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushTimer=new An(()=>this.flush().catch(e=>{this._logger.error("Metrics flush failed:",e)})),this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._retryAfter=new ns,this._consecutiveFlushFailures=0,this._flushJitter=1,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this._flushPromise,i=function(){var i=rt(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;const e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._retryAfter.reset(),this._consecutiveFlushFailures=0,this._flushJitter=1,this._flushTimer.clear(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this._runBeforeSend(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this._logger.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?ct({},t.attributes):void 0,s=qn(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let n=this._series.get(s);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(s,n)}const r=this._typeByName.get(t.name);void 0===r?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(n,t.value),this._armFlushTimer()}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn(`Metric series cap reached (${this._config.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}_fold(e,t){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Nn.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,Nn)]+=1;break}}}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=kt(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Metric was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return s}_armFlushTimer(){this._flushTimer.pending||this._flushTimer.arm(this._nextFlushDelay())}_nextFlushDelay(){return Math.max($n(this._config.flushIntervalMs,this._consecutiveFlushFailures,this._flushJitter,3e4),this._retryAfter.remainingMs())}_doFlush(){var e=this;return rt(function*(){if(e._flushTimer.clear(),0===e._series.size)return;const t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;const i=e._generation,s=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(e._retryAfter.record(s),"retry-later"===s.kind?(e._consecutiveFlushFailures++,e._flushJitter=On()):(e._consecutiveFlushFailures=0,e._flushJitter=1),e._flushTimer.pending&&e._flushTimer.arm(e._nextFlushDelay()),s.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._flushTimer.armNoEarlierThan(e._nextFlushDelay());case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",s.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return Cn(e,t,i)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:In(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}_buildMetrics(e){const t=Bn(Date.now()),i=new Map;for(const o of e.values()){var s;const e=qn(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=ct({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=bn(null!==(s=o.attributes)&&void 0!==s?s:{},this._logger),c=Bn(o.windowStartMs);if("count"===o.type){var n;const e={attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(n=o.total)&&void 0!==n?n:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e={attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Nn})}return Array.from(i.values())}_mergeWindowBack(e){for(const[s,n]of e){const e=this._series.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case"count":var t,i;e.total=(null!==(t=e.total)&&void 0!==t?t:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(e.hist){e.hist.count+=n.hist.count,e.hist.sum+=n.hist.sum,e.hist.min=Math.min(e.hist.min,n.hist.min),e.hist.max=Math.max(e.hist.max,n.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=n.hist.bucketCounts[t]}else e.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function Wn(e,t){if(!e)return;const i=e.find(e=>e.type===t);return null==i?void 0:i.value}const zn="0.8.3",Un={DEBUG:!1,LIB_VERSION:zn,LIB_NAME:"browser-common",JS_SDK_VERSION:zn},jn=(t,{debugEnabled:i}={})=>{const s={_log(s,...n){e&&(Un.DEBUG||e.POSTHOG_DEBUG||i)&&!Et(e.console)&&e.console&&("__rrweb_original__"in e.console[s]?e.console[s].__rrweb_original__:e.console[s])(t,...n)},debug(...e){s._log("debug",...e)},info(...e){s._log("log",...e)},warn(...e){s._log("warn",...e)},error(...e){s._log("error",...e)},critical(...e){console.error(t,...e)},uninitializedWarning(e){s.error(`You must initialize PostHog before calling ${e}`)},createLogger:(e,i)=>jn(`${t} ${e}`,i)};return s},Vn=jn("[PostHog.js]"),Gn=Vn.createLogger;function Qn(e,t){kt(e)&&e.forEach(t)}function Kn(e,t){if(!Ft(e))if(kt(e))e.forEach(t);else if(Ot(e))e.forEach((e,i)=>t(e,i));else for(const i in e)St.call(e,i)&&t(e[i],i)}const Zn=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function Jn(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}const Xn=function(e){return function(...t){try{return e.apply(this,t)}catch(e){Vn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vn.critical(e)}}},Yn=function(e){const t={};return Kn(e,function(e,i){(Tt(e)&&e.length>0||Rt(e))&&(t[i]=e)}),t};function er(e){const t=ct({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const tr=["herokuapp.com","vercel.app","netlify.app"];function ir(e){const t=null==e?void 0:e.hostname;if(!Tt(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of tr)if(i===e)return!1;return!0}function sr(e,t,i,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:n,passive:r})}function nr(e){return"ph_toolbar_internal"===e.name}const rr=["localhost","127.0.0.1"],or=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var s;return qt(t)?(null!==(s=i)&&void 0!==s||(i=new WeakMap),i.has(t)||i.set(t,er(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return yt(e)}},ar=e=>{const t=null==s?void 0:s.createElement("a");return Et(t)?null:(t.href=e,t)},lr=function(e,t="&"){let i,s;const n=[];return Kn(e,function(e,t){Et(e)||Et(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),n[n.length]=s+"="+i)}),n.join(t)},cr=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let e=0;i.length>e;e++){const n=i[e].split("=");if(n[0]===t){s=n;break}}if(!kt(s)||2>s.length)return"";{let e=s[1];try{e=decodeURIComponent(e)}catch(t){Vn.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},ur=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const s=l[e].split("=");kt(s)&&(t.includes(s[0])?c.push(s[0]+"="+i):c.push(l[e]))}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=n&&(u+="#"+n),u},dr=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},hr=(e,t)=>e>=t&&u(),pr=(e,t,i,s)=>{if(0===e){if(u()){const e=t+1;return e===i&&s(),e}return t}return 0};function _r(e,t){var i;const s=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!Ct(s))return t;try{const e=s(t);return Tt(e)&&e?e:t}catch(e){return Vn.error("Error in get_current_url, falling back to window.location.href",e),t}}function gr(t){var i;const s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return Et(s)?void 0:_r(t,s)}function fr(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function vr(e){return!!e&&1===e.nodeType}function mr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function yr(e){return!!e&&3===e.nodeType}function br(e){return!!e&&11===e.nodeType&&vr(e.host)}function Sr(e){return e?vt(e).split(/\s+/):[]}function wr(e,t){const i=gr(t);return!!(i&&e&&e.some(e=>i.match(e)))}function kr(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Sr(t)}function Cr(e){return Ft(e)?null:vt(e).split(/(\s+)/).filter(e=>Jr(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xr(e){let t="";return Wr(e)&&!zr(e)&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,function(e){var i;yr(e)&&e.textContent&&(t+=null!==(i=Cr(e.textContent))&&void 0!==i?i:"")}),vt(t)}function Ir(e){var t;return Et(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const Er=["a","button","form","input","select","textarea","label"];function Tr(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function Mr(e,t){if(Et(t))return!0;for(const i of e)if(t.some(e=>Tr(i,e)))return!0;return!1}function Pr(e){const t=e.parentNode;return!(!t||!vr(t))&&t}const Fr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Rr=["next","previous","prev",">","<"],Lr=[...Rr,"+","-","−","–"],Ar=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Or=[".ph-no-deadclick",".ph-no-capture"],$r=[".ph-no-rageclick",".ph-no-capture"],Dr=["","text","search","email","password","url","tel","number"];function Nr(e){return!(!e||!vr(e))&&(!!mr(e,"textarea")||(mr(e,"input")?ft(Dr,(e.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(e)))}function Br(t,i){if(!e||qr(t))return!1;let s,n,r;var o,a;if(At(i)?(s=!!i&&$r,n=void 0,r=!1):(s=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:$r,n=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===s)return!1;if(r&&Nr(t))return!1;const{targetElementList:l}=Hr(t,!1);return!function(e,t){if(!1===e||Et(e))return!1;let i;if(!0===e)i=Rr;else{if(!kt(e))return!1;if(e.length>10)return Vn.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>i.some(i=>Ar(e,i)||Ar(t,i)))}(n,l.map(e=>{var t;return{safeText:xr(e).toLowerCase(),ariaLabel:(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().trim())||""}}))&&!Mr(l,s)}const qr=e=>!e||mr(e,"html")||!vr(e),Hr=(t,i)=>{if(!e||qr(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!mr(r,"body");){if(br(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=Pr(r);if(!t)break;if(i||Er.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(e){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Wr(e){const t=new Set;let i=0;for(let s=e;s.parentNode&&!mr(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);const e=kr(s);if(ft(e,"ph-sensitive")||ft(e,"ph-no-capture"))return!1}if(ft(kr(e),"ph-include"))return!0;const s=e.type||"";if(Tt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!Tt(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 zr(e){return!!(mr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||mr(e,"select")||mr(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const Ur=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}))$"),jr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Vr=[16,15,14,13],Gr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Kr=/[0-9A-Za-z_]/;function Zr(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function Jr(e,t=!0){if(Ft(e))return!1;if(Tt(e)){if(e=vt(e),t?Ur.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(jr.lastIndex=0;t=jr.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of Vr){const s=e+t;if(i.length>=s){const t=i.slice(e,s);if(Ur.test(t)&&Zr(t))return!0}}}return!1}(e))return!1;if(t?Gr.test(e):function(e){let t;for(Qr.lastIndex=0;t=Qr.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&Kr.test(e)&&Kr.test(i)))return!0}return!1}(e))return!1}return!0}function Xr(e){let t=xr(e);return t=`${t} ${Yr(e)}`.trim(),Jr(t)?t:""}function Yr(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Kn(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=xr(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${Yr(e)}`.trim())}catch(e){Vn.error("[AutoCapture]",e)}}),t}function eo(e){return e.replace(/"|\\"/g,'\\"')}function to(e){const t=e.attr__class;if(t)return kt(t)?t:Sr(t)}const io=1e6;function so(e){var t;return Math.min(io,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:io)}const no={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:io,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},ro=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],oo=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ao=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],lo=e=>{Ft(e)||Kn(Object.keys(e),t=>{(e=>{const t=e.toLowerCase();return ro.includes(t)||ao.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},co=["/s/","/e/","/i/"];function uo(e,t,i,s){if(Ft(e))return e;let n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Tt(n)&&(n=parseInt(n)),n>i?`[SessionRecording] ${s} body too large to record (${n} bytes)`:e}function ho(e,t){if(Ft(e))return e;let i=e;return Jr(i,!1)||(i="[SessionRecording] "+t+" body redacted"),Kn(oo,e=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(e))&&(i="[SessionRecording] "+t+" body redacted as might contain: "+e)}),i}const po=new WeakSet,_o="disabled",go="sampled",fo="active",vo="buffering",mo="paused",yo="lazy_loading",bo="rrweb_error",So="trigger_activated",wo="trigger_pending",ko="trigger_disabled";function Co(e,t,i,s,n,r){return 0===t?ko:(null==e?void 0:e.get_property(i?s+i:n))===r?So:wo}function xo(e,t,i){return t.some(t=>{var s;return"regex"===t.matching&&(null!==(s=null==i?void 0:i.get(t.url))&&void 0!==s?s:new RegExp(t.url)).test(e)})}function Io(e){return e.includes("trigger_activated")?So:e.includes("trigger_pending")?wo:ko}function Eo(e){const t=new Set(e);switch(t.delete(ko),t.size){case 0:return ko;case 1:return Array.from(t)[0];default:return wo}}var To=class{constructor(e){this._matchers=e}triggerStatus(e){return Io(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Io(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Mo=class{constructor(e){this._matchers=e}triggerStatus(e){return Eo(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return Eo(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},Po=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return So}stop(){}};const Fo=e=>"sessionRecording"in e;var Ro=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,i;this._urlTriggers=(Fo(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(Fo(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(const e of this._urlTriggers)if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Vn.error("Invalid URL trigger regex pattern:",e.url,t)}for(const e of this._urlBlocklist)if("regex"===e.matching&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){Vn.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return Co(this._instance,this._urlTriggers.length,this._groupId,Q,j,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ue]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){const e=gr(this._instance);if(!e)return!1;try{return xo(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){const i=gr(this._instance);if(!i)return;if(i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;const s=this.urlBlocked,n=xo(i,this._urlBlocklist,this._compiledBlocklistRegexes);s&&n||(n&&!s?e():!n&&s&&t())}checkUrlTriggerConditions(e,t,i,s){const n=gr(this._instance);if(!n)return;if(n===this._lastCheckedUrl)return;this._lastCheckedUrl=n;const r=this.urlBlocked,o=xo(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();const a=this._urlTriggerStatus(s)===So,l=xo(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",n)}stop(){this._lastCheckedUrl=""}},Lo=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){const e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Be]:e}),e}triggerStatusNoSideEffects(){let e=wo;return Ft(this.linkedFlag)&&(e=ko),this.linkedFlagSeen&&(e=So),e}onConfig(e,t){var i;if(this.linkedFlag=(Fo(e)?xt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Ft(this.linkedFlag)&&!this.linkedFlagSeen){const e=Tt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Tt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((s,n)=>{let r=!1;if(xt(n)&&e in n){const t=n[e];r=At(t)?!0===t:i?t===i:!!t}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&t(e,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},Ao=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(Fo(e)?xt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return Co(this._instance,this._eventTriggers.length,this._groupId,G,V,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ne]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(0===this._eventTriggers.length)return;const s=this._eventTriggerStatus(i)===So,n=this._eventTriggers.includes(e);!s&&n&&t("event",e)}stop(){}},Oo=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new Ro(e,t.id),this._eventTriggerMatching=new Ao(e,t.id),this._linkedFlagMatching=new Lo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){const e=(t.conditions.events||[]).map(e=>e.name),s={urlTriggers:t.conditions.urls||[],eventTriggers:e,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,i);const n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new To(n):new Mo(n)}else this._combinedMatching=new Po}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return"trigger_pending"!==this.triggerStatusNoSideEffects(e)?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===wo).map(({label:e})=>e)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,s)}activateTrigger(e,t){var i;const s="url"===e?Q+this.group.id:G+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[s]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function $o(e){if(e.rrwebError)return bo;if(!e.receivedFlags)return vo;if(!e.isRecordingEnabled)return _o;if(e.urlTriggerMatching.urlBlocked)return mo;const t=!0===e.isSampled,i=new To([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?go:"trigger_activated"===i?fo:"trigger_pending"===i?vo:!1===e.isSampled?_o:fo}function Do(e){if(e.rrwebError)return bo;if(!e.receivedFlags)return vo;if(!e.isRecordingEnabled)return _o;if(e.urlTriggerMatching.urlBlocked)return mo;const t=new Mo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==ko,s=At(e.isSampled);return i&&"trigger_pending"===t?vo:i&&"trigger_disabled"===t||s&&!e.isSampled?_o:!0===e.isSampled?go:fo}function No(){const e=[];return function(t,i){if(xt(i)||kt(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}function Bo(e){try{const t=JSON.stringify(e,No());return t?new Blob([t]).size:0}catch(e){return-1}}function qo(e){if(Pt(e))return 4;if(Et(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":{if(kt(e)){let t=2;for(let i=0;e.length>i;i++){i>0&&(t+=1);const s=e[i];t+=Et(s)||Pt(s)?4:qo(s)}return t}const t=e;let i=2,s=!0;for(const e in t){if(!{}.hasOwnProperty.call(t,e))continue;const n=t[e];Et(n)||(s||(i+=1),s=!1,i+=e.length+3+qo(n))}return i}default:return 0}}function Ho(e,t=6606028.8){if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.sizes.slice(0,t),s=e.sizes.slice(t);return[Ho({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,t),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Ho({size:s.reduce((e,t)=>e+t,0),data:e.data.slice(t),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Wo=Uint8Array,zo=Uint16Array,Uo=Uint32Array,jo=new Wo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vo=new Wo([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]),Go=new Wo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=function(e,t){for(var i=new zo(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new Uo(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},Ko=Qo(jo,2),Zo=Ko[1];Ko[0][28]=258,Zo[258]=28;for(var Jo=Qo(Vo,0)[1],Xo=new zo(32768),Yo=0;32768>Yo;++Yo){var ea=(43690&Yo)>>>1|(21845&Yo)<<1;Xo[Yo]=((65280&(ea=(61680&(ea=(52428&ea)>>>2|(13107&ea)<<2))>>>4|(3855&ea)<<4))>>>8|(255&ea)<<8)>>>1}var ta=function(e,t,i){for(var s=e.length,n=0,r=new zo(t);s>n;++n)++r[e[n]-1];var o,a=new zo(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new zo(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[Xo[d]>>>l]=c}else for(o=new zo(s),n=0;s>n;++n)o[n]=Xo[a[e[n]-1]++]>>>15-e[n];return o},ia=new Wo(288);for(Yo=0;144>Yo;++Yo)ia[Yo]=8;for(Yo=144;256>Yo;++Yo)ia[Yo]=9;for(Yo=256;280>Yo;++Yo)ia[Yo]=7;for(Yo=280;288>Yo;++Yo)ia[Yo]=8;var sa=new Wo(32);for(Yo=0;32>Yo;++Yo)sa[Yo]=5;var na=ta(ia,9,0),ra=ta(sa,5,0),oa=function(e){return(e/8|0)+(7&e&&1)},aa=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof zo?zo:e instanceof Uo?Uo:Wo)(i-t);return s.set(e.subarray(t,i)),s},la=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},ca=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},ua=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Wo(0),0];if(1==n){var o=new Wo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new zo(h+1),_=da(i[u-1],p,0);if(_>t){s=0;var g=0,f=_-t,v=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;g+=v-(1<<_-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=r[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=r[s].s;p[b]==t&&(--p[b],++g)}_=t}return[new Wo(p),_]},da=function(e,t,i){return-1==e.s?Math.max(da(e.l,t,i+1),da(e.r,t,i+1)):t[e.s]=i},ha=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new zo(++t),s=0,n=e[0],r=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++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=e[a]}return[i.subarray(0,s),t]},pa=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},_a=function(e,t,i){var s=i.length,n=oa(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},ga=function(e,t,i,s,n,r,o,a,l,c,u){la(t,u++,i),++n[256];for(var d=ua(n,15),h=d[0],p=d[1],_=ua(r,15),g=_[0],f=_[1],v=ha(h),m=v[0],y=v[1],b=ha(g),S=b[0],w=b[1],k=new zo(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var x=ua(k,7),I=x[0],E=x[1],T=19;T>4&&!I[Go[T-1]];--T);var M,P,F,R,L=c+5<<3,A=pa(n,ia)+pa(r,sa)+o,O=pa(n,h)+pa(r,g)+o+14+3*T+pa(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return _a(t,u,e.subarray(l,l+c));if(la(t,u,1+(A>O)),u+=2,A>O){M=ta(h,p,0),P=h,F=ta(g,f,0),R=g;var D=ta(I,E,0);for(la(t,u,y-257),la(t,u+5,w-1),la(t,u+10,T-4),u+=14,C=0;T>C;++C)la(t,u+3*C,I[Go[C]]);u+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)la(t,u,D[H=31&q[C]]),u+=I[H],H>15&&(la(t,u,q[C]>>>5&127),u+=q[C]>>>12)}}else M=na,P=ia,F=ra,R=sa;for(C=0;a>C;++C)if(s[C]>255){var H;ca(t,u,M[257+(H=s[C]>>>18&31)]),u+=P[H+257],H>7&&(la(t,u,s[C]>>>23&31),u+=jo[H]);var W=31&s[C];ca(t,u,F[W]),u+=R[W],W>3&&(ca(t,u,s[C]>>>5&8191),u+=Vo[W])}else ca(t,u,M[s[C]]),u+=P[s[C]];return ca(t,u,M[256]),u+P[256]},fa=new Uo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),va=new Wo(0),ma=function(){for(var e=new Uo(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),ya=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function ba(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=ma[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var n,r,o,a,l,c=(n=e,r=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,i,s,n,r){var o=e.length,a=new Wo(s+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(s,a.length-n),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=_a(l,c,e.subarray(u,d)):(l[u]=r,c=_a(l,c,e.subarray(u,o)))}else{for(var h=fa[t-1],p=h>>>13,_=8191&h,g=(1<<i)-1,f=new zo(32768),v=new zo(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Uo(25e3),w=new zo(288),k=new zo(32),C=0,x=0,I=(u=0,0),E=0,T=0;o>u;++u){var M=b(u),P=32767&u,F=v[M];if(f[P]=F,v[M]=P,u>=E){var R=o-u;if((C>7e3||I>24576)&&R>423){c=ga(e,l,0,S,w,k,x,I,T,u-T,c),I=C=x=0,T=u;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=P-F&32767;if(R>2&&M==b(u-N))for(var B=Math.min(p,R)-1,q=Math.min(32767,u),H=Math.min(258,R);q>=N&&--D&&P!=F;){if(e[u+A]==e[u+A-N]){for(var W=0;H>W&&e[u+W]==e[u+W-N];++W);if(W>A){if(A=W,O=N,W>B)break;var z=Math.min(N,W-2),U=0;for(L=0;z>L;++L){var j=u-N+L+32768&32767,V=j-f[j]+32768&32767;V>U&&(U=V,F=j)}}}N+=(P=F)-(F=f[P])+32768&32767}if(O){S[I++]=268435456|Zo[A]<<18|Jo[O];var G=31&Zo[A],Q=31&Jo[O];x+=jo[G]+Vo[Q],++w[257+G],++k[Q],E=u+A,++C}else S[I++]=e[u],++w[e[u]]}}c=ga(e,l,r,S,w,k,x,I,T,u-T,c),r||(c=_a(l,c,va))}return aa(a,0,s+oa(c)+n)}(n,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+r.mem,o,a,!l)),u=c.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&ya(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(c,t),ya(c,u-8,i.d()),ya(c,u-4,s),c}function Sa(e,t){var i=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new Wo(e.length+(e.length>>>1)),n=0,r=function(e){s[n++]=e},o=0;i>o;++o){if(n+5>s.length){var a=new Wo(n+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return aa(s,0,n)}function wa(e,t){var i="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var s=0;e.length>s;){var n=e[s++];128>n||t?i+=String.fromCharCode(n):224>n?i+=String.fromCharCode((31&n)<<6|63&e[s++]):240>n?i+=String.fromCharCode((15&n)<<12|(63&e[s++])<<6|63&e[s++]):(n=((15&n)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}return i}var ka=class{constructor(e,t={}){var i,s,n,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{const e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,i;this._loggedTracker[e]=!0;const s=this._getNode(e);null===(t=(i=this._options).onBlockedNode)||void 0===t||t.call(i,e,s)}},this._getNodeOrRelevantParent=e=>{const t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,i,s,n,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(s=null===(n=e.attributes)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this._numberOfChanges(t);if(t.attributes){const e=t.attributes.length;t.attributes=t.attributes.filter(e=>{const[t]=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t)&&e});const i=e-t.attributes.length;var s,n;i>0&&(null===(s=(n=this._options).onDroppedAttributeMutations)||void 0===s||s.call(n,i))}const r=this._numberOfChanges(t);if(0===r&&i!==r)return;if(this._byteBudgetDisabled)return e;this._refillByteBudget();const o=qo(e);var a,l;return o>this._byteTokens?(null===(a=(l=this._options).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._scheduleResync()):(this._byteTokens-=o,e)},this._scheduleResync=()=>{if(this._resyncTimer)return;const e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null===(e=(t=this._options).requestFullSnapshot)||void 0===e||e.call(t)},e)},this._rateLimiter=new Kt({bucketSize:null!==(i=this._options.bucketSize)&&void 0!==i?i:100,refillRate:null!==(s=this._options.refillRate)&&void 0!==s?s:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Vn}),this._bytesBucketSize=null!==(n=this._options.bytesBucketSize)&&void 0!==n?n:0,this._bytesRefillRate=null!==(r=this._options.bytesRefillRate)&&void 0!==r?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;const o=this._options.resyncIntervalMs;this._resyncIntervalMs=Rt(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}};const Ca=e=>{if(s){try{const t=e+"=",i=s.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Rt(e)&&isFinite(e)&&Math.floor(e)===e});var xa=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,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 e(r)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},Ia=class{generate(){const e=this.generateOrAbort();if(!Et(e))return e;{this._timestamp=0;const e=this.generateOrAbort();if(Et(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return Rt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return xa.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new Ta}};let Ea=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!Et(e.crypto)&&crypto.getRandomValues&&(Ea=e=>crypto.getRandomValues(e));var Ta=class{nextUint32(){return this._buffer.length>this._cursor||(Ea(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}};let Ma;const Pa=()=>Fa().toString(),Fa=()=>(Ma||(Ma=new Ia)).generate();let Ra="";const La=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Aa=null;const Oa={_is_supported(){if(!Pt(Aa))return Aa;if(Aa=!1,s)try{const e=`__ph_cookie_support_${Pa()}`;Oa._set(e,"xyz"),Aa='"xyz"'===Ca(e),Oa._remove(e)}catch(e){Aa=!1}return Aa},_error(e){Vn.error("cookieStore error: "+e)},_get:Ca,_parse(e){let t;try{t=JSON.parse(Oa._get(e))||{}}catch(e){}return t},_set(e,t,i,n,r){if(!s)return!1;try{let o="",a="";const l=function(e,t){if(t){let t=function(e,t=s){if(Ra)return Ra;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let n=Math.min(i.length,8);const r="dmn_chk_"+Pa();for(;!Ra&&n--;){const e=i.slice(n).join("."),s=r+"=1;domain=."+e+";path=/";t.cookie=s+";max-age=3",t.cookie.includes(r)&&(t.cookie=s+";max-age=0",Ra=e)}return Ra}(e);if(!t){const i=(e=>{const t=e.match(La);return t?t[0]:""})(e);i!==t&&Vn.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(s.location.hostname,n);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),o="; expires="+e.toUTCString()}r&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Vn.warn("cookieStore warning: large cookie, len="+c.length),s.cookie=c,!0}catch(e){return!1}},_remove(e,t){if(null==s?void 0:s.cookie)try{Oa._set(e,"",-1,t)}catch(e){return}}};let $a=null;const Da={_is_supported(){if(!Pt($a))return $a;let t=!0;if(Et(e))t=!1;else try{const e="__mplssupport__";Da._set(e,"xyz"),'"xyz"'!==Da._get(e)&&(t=!1),Da._remove(e)}catch(e){t=!1}return t||Vn.error("localStorage unsupported; falling back to cookie store"),$a=t,t},_error(e){Vn.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Da._error(e)}return null},_parse(e){try{return JSON.parse(Da._get(e))||{}}catch(e){}return null},_set(t,i){try{return null==e||e.localStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Da._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Da._error(e)}}},Na=[ae,Y,X,te,ie,se,xe,Ce,we],Ba=[g,_,W,z,Re,Fe,b,Ie],qa=e=>e+"_cpm",Ha=["__proto__","constructor","prototype"],Wa=e=>{if(!xt(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===Ha.indexOf(i)&&(t[i]=e[i])}),t},za=(e,t=[])=>{const i={};return[...Ba,...t].forEach(t=>{const s=e[t];Et(s)||Pt(s)||""===s||(i[t]=s)}),i},Ua=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},ja=(e,t)=>({p:t,f:Ua(JSON.stringify(e))}),Va=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=Oa._parse(qa(e)),s=(null==i?void 0:i.f)===Ua(t)&&kt(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Ga=(e,t)=>t+"|"+(Oa._get(qa(e))||""),Qa={},Ka={_is_supported:()=>!0,_error(e){Vn.error("memoryStorage error: "+e)},_get:e=>e in Qa?Qa[e]:null,_parse:e=>e in Qa?Qa[e]:null,_set:(e,t)=>(Qa[e]=t,!0),_remove(e){delete Qa[e]}};let Za=null;const Ja={_is_supported(){if(!Pt(Za))return Za;if(Za=!0,Et(e))Za=!1;else try{const e="__support__";Ja._set(e,"xyz"),'"xyz"'!==Ja._get(e)&&(Za=!1),Ja._remove(e)}catch(e){Za=!1}return Za},_error(e){Vn.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Ja._error(e)}return null},_parse(e){try{return JSON.parse(Ja._get(e))||null}catch(e){}return null},_set(t,i){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Ja._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Ja._error(e)}}};Un.DEBUG=!1,Un.LIB_VERSION="1.433.6",Un.LIB_NAME="web";var Xa=Un,Ya=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(J,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){const t=this._getProperty(J);return xt(i=t)&&Tt(i.sessionId)&&Rt(i.size)&&t.sessionId===e?t.size:0;var i}};function el(e,t){return function(e){let t=0;for(let i=0;e.length>i;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(e)%100<Qt(100*t,0,100,Vn)}function tl(e){return`$survey_response_${e}`}function il(e,t){if(!t)return null;const i=e[tl(t)];return kt(i)?[...i]:i}function sl(e={},t,i){const s={};return t.questions.forEach(t=>{if(Et(t.originalQuestionIndex))return;const i=0===(n=t.originalQuestionIndex)?"$survey_response":`$survey_response_${n}`;var n;const r=il(e,t.id);Et(r)||(s[i]=r)}),ct(ct({$survey_questions:t.questions.map(t=>{var s,n;return{id:t.id,question:null!==(s=null==i?void 0:i[null!==(n=t.id)&&void 0!==n?n:""])&&void 0!==s?s:t.question,response:il(e,t.id)}})},e),s)}function nl(e={}){return Object.values(e).some(e=>!Ft(e))}function rl(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function ol(e){return"string"==typeof e&&e.trim()?e.trim():null}function al(e){return e.toLowerCase()}function ll(e,t,i){if(!e||!t)return null;const s=al(t),n=Object.keys(e).find(e=>al(e)===s);if(n)return null==i||i.debug(`Found exact translation match: ${n}`),n;if(s.includes("-")){const n=s.split("-")[0],r=Object.keys(e).find(e=>al(e)===n);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${t})`),r}return null}const cl=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function ul(e,t,i){var s;const n=ll(e.translations,t,i),r=ct({},e);let o=!1;if(n){var a;const t=null===(a=e.translations)||void 0===a?void 0:a[n];if(t)if(null==i||i.info(`Applying survey-level translation for language: ${n}`),Et(t.name)||(r.name=t.name,o=!0),r.appearance){const e=ct({},r.appearance);for(const i of cl){const s=t[i];Et(s)||(e[i]=s,o=!0)}r.appearance=e}else(function(e){return cl.some(t=>!Et(e[t]))})(t)&&(o=!0)}const l=e.questions.map(e=>function(e,t,i){var s;const n=ll(e.translations,t,i);if(!n)return{question:e,matchedKey:null,hasChanges:!1};const r=null===(s=e.translations)||void 0===s?void 0:s[n];if(!r)return{question:e,matchedKey:null,hasChanges:!1};const o=ct({},e);let a=!1;return Et(r.question)||(o.question=r.question,a=!0),Et(r.description)||(o.description=r.description,a=!0),Et(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Et(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Et(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Et(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(e){return kt(e.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:e,matchedKey:a?n:null,hasChanges:a}}(e,t,i)),c=l.map(e=>e.question),u=l.some(e=>e.hasChanges);let d=null;return n||(d=(null===(s=l.find(e=>e.matchedKey))||void 0===s?void 0:s.matchedKey)||null),u&&(r.questions=c,o=!0,null==i||i.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?n||d:null}}function dl(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}function hl(e){var t;return dl(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}const pl=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},_l=e=>e.toLowerCase(),gl={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>pl(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!pl(t,e))),icontains:(e,t)=>t.map(_l).some(t=>e.map(_l).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(_l).every(t=>e.map(_l).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function fl(e,t){return!e||Object.entries(e).every(([e,i])=>{const s=null==t?void 0:t[e];if(null==s)return!1;const n=gl[i.operator];return!!n&&n(i.values,[String(s)])})}function vl(e,t,i){return or({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const ml=new Set(["is_not","not_icontains","not_regex"]);function yl(e,t,i){return!e||0===e.length||e.every(e=>{const s="person"===e.type?i:t,n=null==s?void 0:s[e.key],r=e.operator||"exact";if(Et(n)||Pt(n))return ml.has(r);const o=gl[r];return!!o&&!Et(e.value)&&!Pt(e.value)&&o(kt(e.value)?e.value.map(String):[String(e.value)],kt(n)?n.map(String):[String(n)])})}const bl=Gn("[SessionRecording]");function Sl(e,t){return t?e:"!"+e}function wl(e,t){return e===t||e!=="!"+t&&null}var kl=class{constructor(e,t,i,s,n,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=s,this._reportStarted=n,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=Do}onRemoteConfig(e){this._sampleRate=Rt(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new To([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=$o):(this._triggerStatusMatcher=new Mo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Do),this._instance.register_for_session({[We]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){const t=this._instance.get_property("$session_recording_remote_config"),i=null==t?void 0:t.minimumDurationMilliseconds;return Rt(i)?i:null}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,s,e)}setupEventTriggerListeners(e,t,i){if(0!==this._eventTriggerMatching._eventTriggers.length&&Ft(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,i,t)}catch(e){bl.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;const i=this._sampleRate;var s,n;if(!Rt(i))return null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_is_sampled"),void(null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"));const r=this._instance.get_property(z),o=this._instance.get_property(D),a=wl(r,e),l=Rt(o)&&o!==i,c=Et(o)&&r===e,u=l||c||!At(a),d=u?el(e,i):a;u&&(d?this._reportStarted("sampled"):bl.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:Sl(e,d),$replay_sample_rate:Pt(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!Rt(this._sampleRate))return;const t=this._instance.get_property(z);At(wl(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,s,n;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_event_trigger_activated_session"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_past_minimum_duration")}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null===(t=this._triggerStatusMatcher)||void 0===t?void 0:t.triggerStatus(e))===wo}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(({status:e})=>e===wo).map(({label:e})=>e)}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},Cl=class{constructor(e,t,i,s,n){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=s,this._onTriggerActivated=n,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[We]:"v2_trigger_groups",[ze]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):bl.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return bo;if(!e.receivedFlags)return vo;if(!e.isRecordingEnabled)return _o;if(e.urlTriggerMatching.urlBlocked)return mo;const t=e.triggerGroupMatchers,i=e.triggerGroupSamplingResults;if(0===t.length)return _o;let s=!1,n=!1;for(const r of t){const t=r.triggerStatus(e.sessionId);if("trigger_activated"===t){const e=r.group.id,t=i.get(e);Et(t)?Vn.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:e}):!0===t&&(n=!0)}else"trigger_pending"===t&&(s=!0)}return n?go:s?vo:_o}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){let t=null;for(const i of this._triggerGroupMatchers)if("trigger_activated"===i.triggerStatus(e)){const e=i.group.minDurationMs;Rt(e)&&(Pt(t)||t>e)&&(t=e)}return t}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(const s of this._triggerGroupMatchers)s.checkUrlTriggerConditions(t,i,t=>{this._checkGroupLevelProperties(s,void 0)&&(s.activateTrigger(t,e),this.updateActiveTriggers(e),this._onTriggerActivated(t))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(e=>{var i;if(this._hasCompletedInitialFlush)return bl.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(const i of this._triggerGroupMatchers)i.checkEventTriggerConditions(e.event,s=>{if(!this._checkGroupLevelProperties(i,e.properties))return;const n=(i.group.conditions.events||[]).filter(t=>t.name===e.event),r=this._instance.get_property(ae);n.some(t=>!t.properties||0===t.properties.length||yl(t.properties,e.properties,r))&&(i.activateTrigger(s,t),this.updateActiveTriggers(t),this._onTriggerActivated(s))},t)}catch(e){bl.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(const i of this._triggerGroupMatchers){var t;const s=i.group,n=s.id,r=s.sampleRate,o=K+n,a=this._instance.get_property(o);let l=null,c=!1,u=!1,d=!1;if(xt(a)){const t=a.sessionId,i=a.sampleRate,s=a.sampled;c="string"==typeof t&&t!==e,u=Rt(i)&&i!==r,l=t===e&&Rt(i)&&i===r&&At(s)?s:null}else l=a===e||null,c="string"==typeof a&&a!==e,d=a===e;const h=c||u||d||!At(l),p=h?el(e+n,r):l;h&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:s.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(n,p),null===(t=this._instance.persistence)||void 0===t||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const e of this._triggerGroupMatchers){var s,n,r;const t=e.group.id;null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_event_trigger_"+t),null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_url_trigger_"+t),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+t)}}updateActiveTriggers(e){const t=[];for(const i of this._triggerGroupMatchers){const s=i.group,n=s.id,r="trigger_activated"===i.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);r&&t.push({id:n,name:s.name,matched:!0,sampled:o})}this._instance.register_for_session({[qe]:t})}hasPendingTriggers(e){for(const t of this._triggerGroupMatchers)if("trigger_pending"===t.triggerStatus(e))return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>"trigger_pending"!==t.triggerStatusNoSideEffects(e)?[]:t.getPendingTriggerConditions(e).map(e=>`trigger group "${t.group.name}": ${e}`))}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){const i=e.group.conditions.properties;return!i||0===i.length||yl(i,t,this._instance.get_property(ae))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(const t of e){const e=new Oo(this._instance,t,(e,i)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:i,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(e)}}};const xl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Il=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...xl],El="<masked>",Tl=["li_fat_id"];function Ml(e,t,i){if(!s)return{};const n=t?[...xl,...i||[]]:[],r=Pl(ur(s.URL,n,El),e),o=function(){const e={};return Kn(Tl,function(t){const i=Ca(t);e[t]=i||null}),e}();return Zn(o,r)}function Pl(e,t){const i=Il.concat(t||[]),s={};return Kn(i,function(t){const i=cr(e,t);s[t]=i||null}),s}function Fl(e){const t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",n={};if(!Pt(t)){n.$search_engine=t;const e=s?cr(s.referrer,i):"";e.length&&(n.ph_keyword=e)}return n}function Rl(){return navigator.language||navigator.userLanguage}function Ll(){const e=Rl();return"string"==typeof e?e.split("-")[0]:void 0}const Al="$direct";function Ol(){return(null==s?void 0:s.referrer)||Al}function $l(e,t,i=!1){const s=e?[...xl,...t||[]]:[],r=i?ls(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return{r:Ol().substring(0,1e3),u:o?ur(o,s,El):void 0}}function Dl(e,t=!1){var i;const{r:s,u:n}=e,r=t?ls(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Al?Al:null===(i=ar(s))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=ar(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=Pl(r);Zn(o,t)}if(s){const e=Fl(s);Zn(o,e)}return o}function Nl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Bl(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const ql=1e5,Hl=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Wl=[],zl=()=>!1,Ul="@type @id actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),jl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Vl="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),Gl="Accommodation AdministrativeArea Country Place State".split(" "),Ql={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:jl,publisher:Vl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Wl},Offer:{seller:Vl},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Vl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Vl,areaServed:Gl,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Wl}},Kl=[["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),Ql.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Ql.Event],[Vl,Ql.Organization],[Gl,Ql.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Ql.Product]];function Zl(e,t){return St.call(e,t)?e[t]:void 0}function Jl(e){const t=typeof e;return Pt(e)||"string"===t||"number"===t||"boolean"===t}function Xl(e,t){return t&&function(e){return Tt(e)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(e.trim())}(e)?t(e.trim())||void 0:e}function Yl(e,t){return kt(e)&&e.every(Jl)?e.map(e=>Xl(e,t)).filter(e=>!Et(e)):Jl(e)?Xl(e,t):void 0}function ec(e,t){if("string"!=typeof e)return;const i=e.trim(),s=i.indexOf("#"),n=0>s?i:i.slice(s+1);if(!(!n||0>s&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return t(n)?n:void 0}catch(e){return}}function tc(e){if(St.call(Ql,e))return Ql[e];for(const[t,i]of Kl)if(t.includes(e))return i}function ic(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function sc(e,t,i,s){if(kt(e)){const n=e.map(e=>sc(e,t,i,s)).filter(e=>!Et(e));return n.length?n:void 0}return nc(e,t,i,s)||void 0}function nc(e,t,i,s){if(!xt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(i))return null;const n=Zl(e,"@type"),r=function(e){const t=new Set,i="string"==typeof e?[e]:kt(e)?e:[],s=[];for(const e of i){if("string"!=typeof e)continue;const i=e.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Hl.test(i)&&!t.has(i)&&(t.add(i),s.push(i),20===s.length))break}return s}(n),o=r.filter(e=>!!tc(e)&&(!s||!s.length||s.includes(e))),a={};for(const s of Ul){const o="@type"===s?r.length?"string"==typeof n?r[0]:r:void 0:"@id"===s?ec(Zl(e,s),t):Yl(Zl(e,s),i.maskUrl);Et(o)||ic(a,s,o)}for(const s of o){const n=tc(s);for(const s of Object.keys(n)){const r=Zl(e,s),o=n[s];if(!0===o){const e=Yl(r,i.maskUrl);Et(e)||ic(a,s,e)}else{const e=sc(r,t,i,o);Et(e)||ic(a,s,e)}}}const l=sc(Zl(e,"@graph"),t,i);return Et(l)||ic(a,"@graph",l),Object.keys(a).length?a:null}function rc(e,t,i){if(!xt(e))return null;const s=Zl(e,"@context");if("string"!=typeof s||!/^https?:\/\/schema\.org\/?$/.test(s))return null;const n=nc(e,t,i);return n?ct({"@context":"https://schema.org"},n):null}function oc(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.trim().toLowerCase())}function ac(e,t,i){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some(e=>(t.lastIndex=0,t.test(e))))return!0;try{return!!i&&e.matches(i)}catch(e){return!1}}function lc(e,t,i){for(let s=e;s;){if(ac(s,t,i))return!0;const e=s.parentNode;s=s.parentElement||(e&&e.nodeType===e.DOCUMENT_FRAGMENT_NODE?e.host:null)}return!1}function cc(e){return oc(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(oc)}function uc(e){return Et(e)?void 0:Math.round(e)}function dc(e){return xt(e)?e.network_timing:e}const hc=Gn("[SessionRecording]"),pc=[1,2,3,4,5,6,7,12],_c=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function gc(){var e;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.rrweb}function fc(){var e;return null===(e=gc())||void 0===e?void 0:e.record}function vc(e){try{return JSON.stringify(e)}catch(t){if(t instanceof RangeError)throw t;return JSON.stringify(e,No())}}function mc(e){return wa(ba(Sa(vc(e))),!0)}function yc(e){return bc.apply(this,arguments)}function bc(){return(bc=rt(function*(e){const t=yield fn(vc(e),Xa.DEBUG,{rethrow:!0});return wa(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}let Sc,wc;const kc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let Cc=!1;function xc(e){var t;return kt(e)&&0===e.length?(Sc=null!==(t=Sc)&&void 0!==t?t:mc([]),Sc):mc(e)}function Ic(e){return Ec.apply(this,arguments)}function Ec(){return(Ec=rt(function*(e){var t;return kt(e)&&0===e.length?Sc||(wc=null!==(t=wc)&&void 0!==t?t:yc([]).then(e=>(Sc=e,e)).catch(e=>{throw Sc=void 0,wc=void 0,e}),wc):yc(e)})).apply(this,arguments)}function Tc(e){return kc&&!Cc&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function Mc(e){return{event:e,size:qo(e)}}function Pc(e,t){return ct(ct({},e),{},{data:t,cv:"2024-10"})}function Fc(e,t){return ct(ct({},e),{},{cv:"2024-10",data:ct(ct({},e.data),t)})}function Rc(e){try{if(2===e.type)return Mc(Pc(e,mc(e.data)));if(3===e.type&&0===e.data.source)return Mc(Fc(e,{texts:xc(e.data.texts),attributes:xc(e.data.attributes),removes:xc(e.data.removes),adds:xc(e.data.adds)}));if(3===e.type&&8===e.data.source)return Mc(Fc(e,{adds:e.data.adds?mc(e.data.adds):void 0,removes:e.data.removes?mc(e.data.removes):void 0}))}catch(e){hc.warn("could not compress event - will use uncompressed event",e)}return{event:e,size:Bo(e)}}function Lc(){return Lc=rt(function*(e){try{if(2===e.type)return Mc(Pc(e,yield yc(e.data)));if(3===e.type&&0===e.data.source){const[t,i,s,n]=yield Promise.all([Ic(e.data.texts),Ic(e.data.attributes),Ic(e.data.removes),Ic(e.data.adds)]);return Mc(Fc(e,{texts:t,attributes:i,removes:s,adds:n}))}if(3===e.type&&8===e.data.source){const[t,i]=yield Promise.all([e.data.adds?yc(e.data.adds):void 0,e.data.removes?yc(e.data.removes):void 0]);return Mc(Fc(e,{adds:t,removes:i}))}}catch(t){return dn(t)&&(Cc=!0),hc.warn("could not compress event asynchronously - trying synchronous compression",t),Rc(e)}return{event:e,size:Bo(e)}}),Lc.apply(this,arguments)}function Ac(e,t){return 5===e.type&&e.data.tag===t}function Oc(e){return Ac(e,"sessionIdle")}function $c(e){return Ac(e,"$session_ending")}function Dc(e){return Ac(e,"$session_starting")}var Nc=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return wl(this._instance.get_property(z),this.sessionId)}get _sampleRate(){var e;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.sampleRate;return Rt(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,i)=>{var s,n,r,o;if(!i)return;if(e===this._sessionId&&t===this._windowId)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this._sessionId,c=this._windowId;var u;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null===(u=this._flushedSizeTracker)||void 0===u?void 0:u.currentTrackedSize(l)}),null===(s=this._instance.persistence)||void 0===s||s.unregister("$debug_first_full_snapshot_timestamp"),this._maxDepthExceeded=!1,null===(n=gc())||void 0===n||null===(r=n.resetMaxDepthState)||void 0===r||r.call(n),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){const t=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(t)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp}),null===(o=this._strategy)||void 0===o||o.makeSamplingDecisions(e)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[U])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;const i=null===(e=this._buffer.data[0])||void 0===e?void 0:e.timestamp,s=null===(t=this._buffer.data[this._buffer.data.length-1])||void 0===t?void 0:t.timestamp;return Rt(i)&&Rt(s)?s-i:null},this._isBelowMinimumDuration=()=>{var e,t;const i=this._minimumDuration;if(!Rt(i))return!1;if(null===(e=null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.strictMinimumDuration)||void 0===e||!e){const e=this._sessionDuration;return Rt(e)&&e>=0&&i>e}if(this._hasPassedMinimumDuration())return!1;const s=this._getBufferDuration();return!!Pt(s)||i>s||(null===(n=this._instance.persistence)||void 0===n||n.register({$session_past_minimum_duration:this._sessionId}),!1);var n},this._onBeforeUnload=()=>{"buffering"!==this.status?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&!this._heldBufferOverflowed&&this._setFlushHold(void 0),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{(null==s?void 0:s.visibilityState)&&("visible"===s.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+s.visibilityState,{}))},this._documentWasEverVisible=null==t||t;const{sessionId:i,windowId:n,sessionStartTimestamp:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=n,this._sessionStartTimestamp=r,this._linkedFlagMatching=new Lo(this._instance),this._urlTriggerMatching=new Ro(this._instance),this._eventTriggerMatching=new Ao(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||hc.warn(`session_idle_threshold_ms (${this._sessionIdleThresholdMilliseconds}) is greater than the session timeout (${this._sessionManager.sessionTimeoutMs}). Session will never be detected as idle`),this._flushedSizeTracker=new Ya(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,s,n,r,o,a,l;const c=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking,u={maskAllInputs:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.blockSelector,maskAllElementAttributes:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.maskAllElementAttributes},d=null!==(r=null==u?void 0:u.maskAllInputs)&&void 0!==r?r:null==c?void 0:c.maskAllInputs,h=null!==(o=null==u?void 0:u.maskTextSelector)&&void 0!==o?o:null==c?void 0:c.maskTextSelector,p=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==c?void 0:c.blockSelector,_=null!==(l=null==u?void 0:u.maskAllElementAttributes)&&void 0!==l?l:null==c?void 0:c.maskAllElementAttributes;return Et(d)&&Et(h)&&Et(p)&&Et(_)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking;if(Ft(t))return;const i=this._instance.config.session_recording,s=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{const s=null==i?void 0:i[e],n=t[e];return!Et(s)&&s!==n});0!==s.length&&(this._hasWarnedClientMaskingOverride=!0,hc.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+s.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:t}))}get _canvasResolutionScale(){var e;return Qt(null===(e=this._instance.config.session_recording.canvasCapture)||void 0===e?void 0:e.resolutionScale,.1,1,Gn("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,s,n,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(e=this._remoteConfig)||void 0===e?void 0:e.canvasRecording,c=null!==(t=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==t&&t,u=null!==(s=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==s?s:4;let d=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof d){const e=parseFloat(d);d=isNaN(e)?.4:e}return{enabled:c,fps:Qt(u,0,12,Gn("canvas recording fps"),4),quality:Qt(d,0,1,Gn("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;const t=!!(null===(e=this._remoteConfig)||void 0===e?void 0:e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get _networkPayloadCapture(){var e,t,i;const s=null===(e=this._remoteConfig)||void 0===e?void 0:e.networkPayloadCapture,n={recordHeaders:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==n?void 0:n.recordHeaders)||(null==s?void 0:s.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==s?void 0:s.recordBody),a=dc(this._instance.config.capture_performance),l=dc(null==s?void 0:s.capturePerformance),c=!!(At(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;const i=[],s=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordConsolePlugin;s&&this._isConsoleLogCaptureEnabled&&i.push(s());const r=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Ct(r))if(!rr.includes(n.hostname)||this._forceAllowLocalhostNetworkCapture){const e=Ct(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((e,t,i)=>{const s={payloadSizeLimitBytes:no.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...no.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...no.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,a=(e=>{const t=so(e);return e=>((null==e?void 0:e.requestBody)&&(e.requestBody=uo(e.requestBody,e.requestHeaders,t,"Request")),(null==e?void 0:e.responseBody)&&(e.responseBody=uo(e.responseBody,e.responseHeaders,t,"Response")),e)})(s),l=t=>{return a(((e,t,i)=>{var s;if(null==i?void 0:i(e.name))return;const n=ar(e.name);let r=0===t.indexOf("http")?null===(s=ar(t))||void 0===s?void 0:s.pathname:t;"/"===r&&(r="");const o=null==n?void 0:n.pathname.replace(r||"","");return n&&o&&co.some(e=>0===o.indexOf(e))?void 0:e})((lo((s=t).requestHeaders),lo(s.responseHeaders),s),e.api_host,i));var s},c=Ct(e.session_recording.maskNetworkRequestFn);return c&&Ct(e.session_recording.maskCapturedNetworkRequestFn)&&Vn.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});return!i&&t.isInitial?i:ct(ct({},t),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=Ct(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,s;const n=l(t);if(!n)return;const r=n.isInitial?{name:"",entryType:n.entryType,startTime:n.startTime,duration:n.duration,endTime:n.endTime,timeOrigin:n.timeOrigin,timestamp:n.timestamp,isInitial:!0}:void 0,o=null===(i=(s=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(s,n);return Ft(o)&&r?(po.add(r),r):null!=o?o:void 0}:e=>function(e){if(!Et(e))return e.requestBody=ho(e.requestBody,"Request"),e.responseBody=ho(e.responseBody,"Response"),e}(l(e)),ct(ct(ct({},no),s),{},{recordHeaders:n,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,e)))}else hc.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?ls(e):e}_maskReplayUrl(e,t=!1){const i=t?ls(e):this._stripUrlHash(e),s=this._instance.config.mask_personal_data_properties?[...xl,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(ur(i,s,El))}_maskUrl(e){const t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;const s=t.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:null==s?void 0:s.url}if(t.maskNetworkRequestFn){const i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):hc.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(_c(()=>fc().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{const t=fc();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return null===(t=this._jsonLdCapture)||void 0===t?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;const t=new URL(e.location.href),i=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==i&&(this._lastHref=i,this._tryAddCustomEvent("$url_changed",{href:i}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){const e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(_c(()=>fc().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if((null===(e=this._strategy)||void 0===e?void 0:e.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var s;const e=null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.trigger_pending_buffer_interval_millis;return Rt(e)&&Number.isFinite(e)&&e>=1e3&&36e5>=e?e:6e4}return null!==(t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0===this._isIdle)return;const e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null===(e=this._jsonLdCapture)||void 0===e||e.scan(),clearInterval(this._fullSnapshotTimer),hc.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null===(e=this._jsonLdCapture)||void 0===e||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),hc.info("recording resumed"))}_activateTrigger(e,t){var i;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&(null===(i=this._strategy)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var s,n;const i="url"===e?j:V;null===(s=this._instance.persistence)||void 0===s||s.register({[i]:this.sessionId}),null===(n=this._strategy)||void 0===n||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){const e=this._instance.get_property(A);if(!e)return;let t;try{t=xt(e)?e:JSON.parse(e)}catch(e){return void hc.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;const s=null!==(i=t.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-s>36e5)return void hc.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e})}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(t){var i,n;const r=this._remoteConfig;if(!r)return void hc.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const e=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(e?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=e,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=o,this._windowId=a,this._sessionStartTimestamp=l,this._restorePendingBuffer(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this._endpoint=null==r?void 0:r.endpoint),this._strategy=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new Cl(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new kl(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(r),null===(n=this._removeEventTriggerCaptureHook)||void 0===n||n.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(N,()=>{this.overrideSampling()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(N)}),this._checkOverride(B,()=>{this.overrideLinkedFlag()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(B)}),this._checkOverride(H,()=>{this.overrideTrigger("event")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(H)}),this._checkOverride(q,()=>{this.overrideTrigger("url")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(q)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(sr(e,"beforeunload",this._onBeforeUnload),sr(e,"pagehide",this._onPageHide),sr(e,"offline",this._onOffline),sr(e,"online",this._onOnline),sr(s,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Ct(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Ct(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,i)=>{var s;null===(s=this._forceIdleSessionIdListener)||void 0===s||s.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,i)})}):Ct(this._sessionManager.on)||hc.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Ft(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){const t=(null==e?void 0:e.properties.$current_url)?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){hc.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(t||"recording_initialized"))}_teardown(){var t,i,n,r,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(r=this._onSessionIdleResetForcedListener)||void 0===r||r.call(this),this._onSessionIdleResetForcedListener=void 0,null===(o=this._forceIdleSessionIdListener)||void 0===o||o.call(this),this._forceIdleSessionIdListener=void 0,null===(a=this._strategy)||void 0===a||a.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null===(e=this._mutationThrottler)||void 0===e||e.stop(),this._queuedRRWebEvents=[],null===(t=this._jsonLdCapture)||void 0===t||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;null===(i=this._stopRrweb)||void 0===i||i.call(this)}catch(e){hc.warn("could not stop rrweb",e)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;const e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),hc.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),hc.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),hc.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t,i;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._unstringifiableEventsDropped=0,null===(t=gc())||void 0===t||null===(i=t.resetSnapshotCostState)||void 0===i||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!Et(e),this._flushHoldReason=e,Et(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;const i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,hc.info(`holding buffer: ${e}. nothing is uploaded until the user interacts with the page`))}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),hc.info("discarded")}_captureProcessedEvent(e,t,i,s,n){if(-1===i)return this._unstringifiableEventsDropped+=1,void hc.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:t,$session_id:s,$window_id:n};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,s),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,hc.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;const i=null===(e=gc())||void 0===e||null===(t=e.getLastSnapshotCost)||void 0===t?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=i.durationMs||(this._slowestFullSnapshot=i),500>i.durationMs||hc.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(Et(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,hc.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t,i=e.event;if(e.compressionEnabled)try{({event:i,size:t}=Rc(e.event))}catch(e){hc.warn("could not process queued compression event - will use uncompressed event",e)}Et(t)&&(t=Bo(e.event));try{this._captureQueuedCompressionEvent(e,i,t)}catch(e){hc.warn("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{try{this._processQueuedCompressionEventSync(e)}catch(e){hc.warn("could not drain queued compression event",e)}})}_enqueueCompression(e,t,i,s){var n=this;const r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:s,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;const o=(a=rt(function*(){try{if(r.processed)return;let i,s;try{const n=t?Tc(e)?yield function(e){return Lc.apply(this,arguments)}(e):Rc(e):{event:e,size:Bo(e)};i=n.event,s=n.size}catch(t){hc.warn("could not process queued compression event - will use uncompressed event",t),i=e,s=Bo(e)}n._captureQueuedCompressionEvent(r,i,s)}finally{n._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(t){var i,s,n,r,o,a,l,c,u,d,h,p,_;if(!this._instance.sessionManager)return;if(this._processQueuedEvents(),!t||!xt(t))return;if(4===t.type){const e=this._maskReplayUrl(t.data.href);if(this._lastHref=e,!e)return;t.data.href=e}else this._pageViewFallBack();if(null===(i=this._strategy)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(e,t)=>this._activateTrigger(e,t)),this._urlTriggerMatching.urlBlocked&&!function(e){return 5===e.type&&"recording paused"===e.data.tag}(t))return;2===t.type&&((null===(d=gc())||void 0===d||null===(h=d.wasMaxDepthReached)||void 0===h?void 0:h.call(d))&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null===(p=this._mutationThrottler)||void 0===p||p.reset(),null===(_=this._instance.persistence)||void 0===_||_.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const g=2===t.type&&(null===(s=this._strategy)||void 0===s?void 0:s.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();const f=this._mutationThrottler?this._mutationThrottler.throttleMutations(t):t;if(!f)return void(!0===this._isIdle&&this._eventsDroppedWhileIdle++);const v=function(e){const t=e;if(t&&xt(t)&&6===t.type&&xt(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));const i=[];for(let e=0;t.data.payload.payload.length>e;e++)i.push(t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?t.data.payload.payload[e].slice(0,2e3)+"...[truncated]":t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(f),m=function(e){return $c(e)?e.data.payload:null}(v),y=function(e){return Dc(e)?e.data.payload:null}(v),b=function(e){return Oc(e)?e.data.payload:null}(v);m||y?(null==m?void 0:m.lastActivityTimestamp)&&(v.timestamp=m.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this._updateWindowAndSessionIds(v),2===t.type&&(this._fullSnapshotTimestamps.push([this._sessionId,t.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));const S=null!==(n=null!==(r=null!==(o=null==m?void 0:m.currentSessionId)&&void 0!==o?o:null==y?void 0:y.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==n?n:this._sessionId,w=null!==(a=null!==(l=null!==(c=null==m?void 0:m.currentWindowId)&&void 0!==c?c:null==y?void 0:y.nextWindowId)&&void 0!==l?l:null==b?void 0:b.windowId)&&void 0!==a?a:this._windowId;if(!0===this._isIdle&&!function(e){return Oc(e)||$c(e)||Dc(e)}(v))return void(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source}(v)&&this._eventsDroppedWhileIdle++);2===v.type&&(this._eventsDroppedWhileIdle=0),b&&(v.timestamp=b.lastActivityTimestamp+b.threshold);const k=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):k||this._scheduleJsonLdScan();const C=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===v.type&&"$json_ld"===v.data.tag){let t;try{t=e?this._maskReplayUrl(e.location.href):void 0}catch(e){}v.data.href=t}if(this._queuedCompressionEvents>0||C&&Tc(v))return void this._enqueueCompression(v,C,S,w);const{event:x,size:I}=C?Rc(v):{event:v,size:Bo(v)};this._captureProcessedEvent(v,x,I,S,w)}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):_o}log(e,t="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t;const i=null==e||null===(t=e.location)||void 0===t?void 0:t.href;if(!i)return;const s=this._maskReplayUrl(i);if(!s)return;return new URL(s).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every(e=>5===(null==e?void 0:e.type)&&!$c(e)&&!Dc(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[He]:[]}),void(this._lastLoggedBufferingReason=void 0);const t=this._describePendingTriggerConditions();if(0===t.length)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[He]:[]}),void(this._lastLoggedBufferingReason=void 0);const i=t.join(", "),s=`${this.sessionId}:${i}`;s!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=s,this._instance.register_for_session({[He]:t}),hc.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null===(e=this._instance.persistence)||void 0===e?void 0:e._disabled)&&Ja._is_supported()}_parkBufferForNextPage(){0!==this._buffer.data.length&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Ja._set(this._pendingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(this._pendingBufferRestored||!this._canParkPendingBuffer())return;this._pendingBufferRestored=!0;const e=Ja._parse(this._pendingBufferStorageKey);Ja._remove(this._pendingBufferStorageKey),xt(e)&&kt(e.data)&&0!==e.data.length&&kt(e.sizes)&&e.sizes.length===e.data.length&&Rt(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);const i=this._buffer;null===(t=this._strategy)||void 0===t||t.ensureSamplingDecision(this.sessionId);const s=this._isBelowMinimumDuration(),n=this.status;if(this._maybeLogBufferingReason(n),"buffering"===n||"paused"===n||"disabled"===n||s)return!e||"active"!==n&&"sampled"!==n||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;const e=this._currentMaskedHostname();Ho(i).forEach(t=>{try{var i;null===(i=this._flushedSizeTracker)||void 0===i||i.trackSize(t.sessionId,t.size),this._captureSnapshot(ct({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Xa.LIB_NAME,$lib_version:Xa.LIB_VERSION,$snapshot_host:e},this._unstringifiableEventsDropped>0?{$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped}:{}))}catch(e){hc.warn("could not capture snapshot chunk - skipping it",e)}}),Et(this._lastParkedBufferSize)||(Ja._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null===(r=this._strategy)||void 0===r||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this._buffer)||void 0===t?void 0:t.data.length)||0),s=e.$session_id,n=this._buffer.sessionId!==s;if(n||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){const t=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==t)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=s,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>943718.4)?this._heldBufferOverflowed||(this._heldBufferOverflowed=!0,this._buffer=this._clearBuffer()):(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t;const i=null===(e=this._buffer)||void 0===e?void 0:e.data[(null===(t=this._buffer)||void 0===t?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();let e=-1;for(let t=this._buffer.data.length-1;t>=0;t--)if(4===this._buffer.data[t].type){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((e,t)=>e+t,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Ge]:e}),hc.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",ct({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==pc.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());const{windowId:i,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp);let n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){const t="unknown"===this._isIdle;this._isIdle=!1,t||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}const r=this._sessionId!==s,o=this._windowId!==i;if(this._windowId=i,this._sessionId=s,r||o){const e=r&&!1!==this._isIdle;e&&(this._isIdle="unknown"),this._restartForSessionIdChange(e)}else if(t&&this._releaseHoldAndFlush(),n){var a;const e=["sampled","active"].includes(this.status)||(null===(a=this._strategy)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&e&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null===(e=this._strategy)||void 0===e||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,i,s,n,r,o,a,l,c,u,d,h,p;const _=null===(e=gc())||void 0===e||null===(t=e.getDeferredStylesheetStats)||void 0===t?void 0:t.call(e);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this._flushedSizeTracker)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:uc(null===(s=this._slowestFullSnapshot)||void 0===s?void 0:s.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:uc(null===(n=this._slowestFullSnapshot)||void 0===n?void 0:n.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this._slowestFullSnapshot)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this._slowestFullSnapshot)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this._slowestFullSnapshot)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==_?void 0:_.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==_?void 0:_.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==_?void 0:_.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:uc(null==_?void 0:_.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:uc(null==_?void 0:_.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:uc(null===(l=gc())||void 0===l||null===(c=l.getMutationCost)||void 0===c||null===(c=c.call(l))||void 0===c?void 0:c.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(u=gc())||void 0===u||null===(d=u.getDiscardedDurationSamples)||void 0===d?void 0:d.call(u),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped,$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped,$sdk_debug_replay_unstringifiable_events_dropped:this._unstringifiableEventsDropped,$sdk_debug_replay_rrweb_error:this._rrwebError,$sdk_debug_replay_observer_init_failures:null===(h=gc())||void 0===h||null===(p=h.getObserverInitFailures)||void 0===p?void 0:p.call(h),[je]:!!this._stopRrweb,[Ve]:this._rrwebStartAttempted}}_startRecorder(){var t;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},n=this._instance.config.session_recording;for(const[e,t]of Object.entries(n||{}))if(e in i)if("maskInputOptions"===e)i.maskInputOptions=ct({password:!0},t);else if("sampling"===e){const e=null!=t?t:{},s={};Et(e.mousemove)||(s.mousemove=e.mousemove),Et(e.mouseInteraction)||(s.mouseInteraction=e.mouseInteraction),i.sampling=s}else i[e]=t;var r,o,a,l;!0===(null==n?void 0:n.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ct(ct({},i.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling=ct(ct({},i.sampling),{},{canvas:this._canvasRecording.fps}),i.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},i.canvasResolutionScale=this._canvasResolutionScale,i.canvasMasking={configured:()=>{var e;return Ct(null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn)},regionsFn:e=>{var t;const i=null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn;if(Ct(i))try{var s;return null!==(s=i(e))&&void 0!==s?s:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,hc.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(i.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this._masking.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this._masking.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this._masking.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,hc.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();const c=fc();if(!c)return void hc.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new ka(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;hc.info(i,{node:t}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});const u=this._gatherRRWebPlugins();if(this._stopRrweb=c(ct({emit:e=>{this.onRRwebEmit(e)},plugins:u,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,hc.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},i)),!this._stopRrweb)return this._rrwebError=!0,void hc.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==n?void 0:n.captureJsonLd)&&s&&(null==e?void 0:e.MutationObserver)&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,i){const s=new WeakMap,n=i.getCaptureState||(()=>!0);let r=ql;const o=function(e,t){const i=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?zl:i=>{const s=e.getElementById(i);return!!s&&"SCRIPT"!==s.nodeName&&(!t.isRecordedElement||t.isRecordedElement(s))&&!lc(s,t.blockClass,t.blockSelector)}}(e,i),a=t=>{try{const a=n();if(!r||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return lc(e,t.blockClass,t.blockSelector)||lc(e,t.maskTextClass,t.maskTextSelector)}(t,i))return;const l=function(e,t=zl,i){if(!e||e.length>ql)return null;try{const s=JSON.parse(e),n={maskUrl:i,remainingNodes:2048,exceeded:!1},r=kt(s)?s.map(e=>rc(e,t,n)):rc(s,t,n);if(n.exceeded||Pt(r)||kt(r)&&(!r.length||r.some(Pt)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(e){return null}}(t.text,o,i.maskUrl);if(!l)return void s.delete(t);const[c,u]=l;if(Pt(a))return void s.set(t,u);if(s.get(t)!==u){if(u.length>r)return void(r=0);i.emit(c)&&(s.set(t,u),r-=u.length)}}catch(e){return}};try{const i=new t(e=>{try{if(!r||!1===n())return;const t=e=>{for(const t of cc(e))a(t)};for(const i of e)if("childList"===i.type)oc(i.target)&&a(i.target),i.addedNodes.forEach(t);else if("characterData"===i.type){const e=i.target.parentNode;e&&oc(e)&&a(e)}else"attributes"===i.type&&oc(i.target)&&a(i.target)}catch(e){return}});return i.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t=!1){r&&!1!==n()&&cc(e.documentElement).forEach(e=>{t&&s.delete(e),a(e)})},stop(){return i.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(s,e.MutationObserver,{maskUrl:e=>this._maskReplayUrl(e),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:e=>c.mirror.getId(e)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=At(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:u.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}};const Bc=["type"];var qc=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}({}),Hc=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}({}),Wc=function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e}({}),zc=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),Uc=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),jc=function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e}({}),Vc=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}({});function Gc(e,t){return-1!==e.indexOf(t)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Qc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Kc={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Zc={};function Jc(e){if(Zc[e])return Zc[e];const t=function(e){var t,i;const s=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(i=t.__symbol__)||void 0===i?void 0:i.call(t,e);return s&&globalThis[s]?globalThis[s]:void 0}(e)||globalThis[e],i=t.prototype,s=e in Qc?Qc[e]:void 0,n=Boolean(s&&s.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(i,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),r=e in Kc?Kc[e]:void 0,o=Boolean(r&&r.every(e=>{var t;return"function"==typeof i[e]&&(null===(t=i[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(n&&o)return Zc[e]=t.prototype,t.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const s=a.contentWindow;if(!s)return t.prototype;const n=s[e].prototype;return n?(function(e){return Gc(e,"AppleWebKit")&&!Gc(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Zc[e]=n):i}catch(e){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Xc=Object.create(null);function Yc(e,t,i){var s;const n=Xc[e],r=n[i];if(r)return r.call(t);const o=Jc(e),a=null===(s=Object.getOwnPropertyDescriptor(o,i))||void 0===s?void 0:s.get;return a?(n[i]=a,a.call(t)):t[i]}Xc.Node=Object.create(null),Xc.ShadowRoot=Object.create(null),Xc.MutationObserver=Object.create(null),Xc.Element=Object.create(null);var eu,tu={};function iu(e,t,i){const s=`${e}.${String(i)}`;if(tu[s])return tu[s].bind(t);const n=Jc(e)[i];return"function"!=typeof n?t[i]:(tu[s]=n,n.bind(t))}function su(){return Jc("MutationObserver").constructor}function nu(e,t,i){try{if(!(t in e))return()=>{};const s=e[t],n={next:s},r=i(function(...e){return n.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let s=e[t],o=i(s);for(;o;){if(o.next===r)return void(o.next=n.next);s=o.next,o=i(s)}}}catch(e){return()=>{}}}var ru={childNodes:e=>Yc("Node",e,"childNodes"),parentNode:e=>Yc("Node",e,"parentNode"),parentElement:e=>Yc("Node",e,"parentElement"),textContent:e=>Yc("Node",e,"textContent"),isConnected(e){if(void 0===eu){var t;const e=null===(t=Object.getOwnPropertyDescriptor(Jc("Node"),"isConnected"))||void 0===t?void 0:t.get;eu=(null==e?void 0:e.toString().includes("[native code]"))?e:null}return null==eu?void 0:eu.call(e)},contains:(e,t)=>iu("Node",e,"contains")(t),getRootNode:e=>iu("Node",e,"getRootNode")(),host:e=>e&&"host"in e?Yc("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?Yc("Element",e,"shadowRoot"):null,querySelector:(e,t)=>iu("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>iu("Element",e,"querySelectorAll")(t),mutationObserver:su,patch:nu};function ou(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var au=0;function lu(){au+=1}function cu(){return au}function uu(e,t){return(t!==au||e>6e4)&&!0}var du=0,hu=0,pu=0,_u={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gu=null,fu=null,vu=[],mu=0,yu=0,bu={slowestBatchMs:0},Su={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function wu(e){(du+=1)>1||(_u={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},vu=[],mu=0,fu=(e=>e&&e>0?e:null)(e),hu=ou(),pu=au)}function ku(){return 0===du?gu||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(du-=1)>0?_u:(_u.durationMs=ou()-hu,_u.deferredStylesheetCount=mu,Su.deferredCount+=mu,fu=null,uu(_u.durationMs,pu)?_u:gu=_u)}function Cu(e,t,i){let s=e.length;if(i>=32)return s;for(let n=0;e.length>n;n++){const r=e[n];try{const e=r.cssRules;if(e&&e.length)s+=Cu(e,t,i+1);else if(t&&r.styleSheet){const e=r.styleSheet;if(!t.has(e)){t.add(e);const n=e.rules||e.cssRules;n&&(s+=Cu(n,t,i+1))}}}catch(e){}}return s}function xu(e){if(0===du)return;const t=Cu(e,null,0);_u.cssRuleCount+=t,yu>0&&(_u.nonDeferrableCssRuleCount+=t)}function Iu(e){yu+=1;try{return e()}finally{yu-=1}}function Eu(e){du>0&&(_u.stylesheetMs+=e)}function Tu(e){if(0===du||null===fu)return!1;const t=_u.cssRuleCount-_u.nonDeferrableCssRuleCount;return t>=fu||t+function(e){try{const t=e&&(e.rules||e.cssRules);if(!t)return 0;const i=new WeakSet;return i.add(e),Cu(t,i,0)}catch(e){return 0}}(e)>fu}function Mu(){const e=vu;return vu=[],e}function Pu(){Su.failedCount+=1}function Fu(e){e>0&&(Su.abandonedCount+=e)}function Ru(e){return Ru="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ru(e)}function Lu(e,t,i){return(t=function(e){var t=function(e){if("object"!=Ru(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=Ru(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ru(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Au(e){return e.nodeType===e.ELEMENT_NODE}function Ou(e){const t=e&&"host"in e&&"mode"in e&&ru.host(e)||null;return Boolean(t&&"shadowRoot"in t&&ru.shadowRoot(t)===e)}function $u(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Du(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Nu(e){const{cssText:t}=e;if(3>t.split('"').length)return t;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var Bu=0;function qu(e){const t=0===Bu,i=t?ou():0;Bu+=1;try{const t=e.rules||e.cssRules;if(!t)return null;xu(t);let i=e.href;return!i&&e.ownerNode&&(i=e.ownerNode.baseURI),Du(Array.from(t,e=>Hu(e,i)).join(""))}catch(e){return null}finally{Bu-=1,t&&Eu(ou()-i)}}function Hu(e,t){if(zu(e)){let t;try{t=qu(e.styleSheet)||Nu(e)}catch(i){t=e.cssText}try{var i;if(t&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return rd(t,e.styleSheet.href)}catch(e){}return t}{let i=e.cssText;return Uu(e)&&e.selectorText.includes(":")&&(i=Wu(i)),t?rd(i,t):i}}function Wu(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function zu(e){return"styleSheet"in e}function Uu(e){return"selectorText"in e}var ju=/^-?[A-Za-z_][\w-]*$/,Vu=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Gu(e){const t=[];let i=!1,s=null;const n=new Map;function r(e){const n=t.pop();if("group"===n.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void r(null)}const i=t[t.length-1];return i.parts.push(e),void(i.index+=1)}if(!n.importRule)return i=!0,void(s=e);o(t[t.length-1],n.importRule,e)}function o(e,t,i){try{let n;try{n=i||Nu(t)}catch(e){n=t.cssText}try{var s;n&&(null===(s=t.styleSheet)||void 0===s?void 0:s.href)&&(n=rd(n,t.styleSheet.href))}catch(e){}n&&e.parts.push(n),e.index+=1}catch(e){r(null)}}function a(e){const i=e.rules[e.index];if("sheet"===e.kind&&zu(i)){const s=n.get(i);return null===s?(e.parts.push(i.cssText),void(e.index+=1)):s?void t.push({kind:"sheet",sheet:s.sheet,rules:s.rules,sheetHref:s.sheetHref,index:0,parts:[],importRule:i}):void o(e,i,null)}if(function(e,i){try{const s=function(e){const t=e;if(!t.cssRules||0===t.cssRules.length)return null;if(t.media&&"string"==typeof t.media.mediaText)return`@media ${t.media.mediaText} {`;if(Uu(e)){if("number"==typeof t.type&&1!==t.type)return null;const i=t.style?t.style.cssText:"";return`${e.selectorText} {${i?" "+i:""}`}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!ju.test(t.containerName)?null:`@container ${t.containerName?`${t.containerName} `:""}${t.containerQuery} {`;if("string"==typeof t.conditionText){let s="";try{var i;s=(null===(i=e.constructor)||void 0===i?void 0:i.name)||""}catch(e){return null}return""===s||"Object"===s||"CSSSupportsRule"===s?`@supports ${t.conditionText} {`:null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?ju.test(t.name)?`@keyframes ${t.name} {`:null:""===t.name?"@layer {":Vu.test(t.name)?`@layer ${t.name} {`:null:null}(e);if(null===s)return!1;const n=i.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:n,index:0,parts:[],prelude:n?rd(s,n):s,fixColons:"sheet"===i.kind&&Uu(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(i,e))return;let s=i.cssText;"sheet"===e.kind&&Uu(i)&&i.selectorText.includes(":")&&(s=Wu(s)),e.parts.push(e.sheetHref?rd(s,e.sheetHref):s),e.index+=1}return function(e){try{const i=e.rules||e.cssRules;if(!i)return!1;xu(i);let s=e.href;!s&&e.ownerNode&&(s=e.ownerNode.baseURI);const r=Array.from(i);return t.push({kind:"sheet",sheet:e,rules:r,sheetHref:s,index:0,parts:[],importRule:null}),function(e,t){const i=[{sheet:t,rules:e,index:0}];for(;i.length>0;){const e=i[i.length-1];if(e.index>=e.rules.length){i.pop();continue}const t=e.rules[e.index];if(e.index+=1,!zu(t)||n.has(t))continue;let s=null;try{s=t.styleSheet}catch(e){n.set(t,null);continue}if(s&&!i.some(e=>e.sheet===s))try{const e=s.rules||s.cssRules;if(!e)continue;xu(e);let r=s.href;!r&&s.ownerNode&&(r=s.ownerNode.baseURI);const o=Array.from(e);n.set(t,{sheet:s,rules:o,sheetHref:r}),i.push({sheet:s,rules:o,index:0})}catch(e){}}}(r,e),!0}catch(e){return!1}}(e)||(i=!0),{advance(e){if(i)return!0;const n=ou();let o=e>0?e:1;try{for(;!i&&o>0;){const e=t[t.length-1];if(e.index>=e.rules.length){let t=null;try{if("group"===e.kind){const i=e.prelude+e.parts.join("")+"}";t=e.fixColons?Wu(i):i}else t=Du(e.parts.join(""))}catch(e){}r(t);continue}o-=1;try{a(e)}catch(e){r(null)}}}catch(e){i=!0,s=null}finally{Eu(ou()-n)}return i},text:()=>i?s:null,remainingRules(){if(i)return 0;let e=0;for(const i of t)e+=i.rules.length-i.index;return e}}}var Qu=class{constructor(){Lu(this,"idNodeMap",new Map),Lu(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&null!==(t=null===(i=this.getMeta(e))||void 0===i?void 0:i.id)&&void 0!==t?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),Au(e)){const t=ru.shadowRoot(e);t&&this.removeNodeFromMap(t),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Ku({element:e,maskInputOptions:t,tagName:i,type:s,value:n,maskInputFn:r}){let o=n||"";const a=s&&Zu(s);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function Zu(e){return e.toLowerCase()}var Ju=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function Xu({element:e,name:t,value:i,maskAllElementAttributes:s,maskAttributeFn:n,isGenerated:r=!1}){return i?s?r&&Ju.has(Zu(t))?i:"*".repeat(i.length):n?n(t,i,e):i:i}var Yu="__rrweb_original__";function ed(e){try{const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Zu(t):null}catch(e){return null}}var td=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,id=/^(?:[a-z+]+:)?\/\//i,sd=/^www\..*/i,nd=/^(data:)([^,]*),(.*)/i;function rd(e,t){return(e||"").replace(td,(e,i,s,n,r,o)=>{const a=s||r||o,l=i||n||"";if(!a)return e;if(id.test(a)||sd.test(a))return`url(${l}${a}${l})`;if(nd.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}var od,ad,ld=new Map,cd=1,ud=new RegExp("[^a-z0-9-_:]");function dd(){return cd++}var hd=/^[^ \t\n\r\u000c]+/,pd=/^[, \t\n\r\u000c]+/,_d=new WeakMap;function gd(e,t){return t&&""!==t.trim()?fd(e,t):t}function fd(e,t){let i=_d.get(e);if(i||(i=e.createElement("a"),_d.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function vd(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":e}(e,t.maxBase64ImageLength):e}function md(e,t,i,s,n,r){if(!s)return s;if("src"===i||"href"===i&&("use"!==t||"#"!==s[0])){if("link"===t&&n){var o;const e=null===(o=n.sheet)||void 0===o?void 0:o.href;if(e)return e}const i=gd(e,s);if(i.startsWith("data:")){if("img"===t&&n){let e=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(e=function(e,t,i,s){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;const n=ld.get(t);if(n&&n.type===i&&n.quality===s)return n.result;try{const n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;const r=n.getContext("2d");if(!r)return t;r.drawImage(e,0,0);const o=n.toDataURL(i||"image/webp",null!=s?s:.4),a=t.length>o.length?o:t;if(ld.size>=10){const e=ld.keys().next().value;void 0!==e&&ld.delete(e)}return ld.set(t,{type:i,quality:s,result:a}),a}catch(e){return t}}(n,i,r.type,r.quality)),vd(e,r)}if("image"===t)return vd(i,r)}return i}if("xlink:href"===i&&"#"!==s[0]){const i=gd(e,s);return"image"===t&&i.startsWith("data:")?vd(i,r):i}return"background"!==i||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===i?function(e,t){if(""===t.trim())return t;let i=0;function s(e){let s;const n=e.exec(t.substring(i));return n?(s=n[0],i+=s.length,s):""}const n=[];for(;s(pd),t.length>i;){let r=s(hd);if(","===r.slice(-1))r=gd(e,r.substring(0,r.length-1)),n.push(r);else{let s="";r=gd(e,r);let o=!1;for(;;){const e=t.charAt(i);if(""===e){n.push((r+s).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){i+=1,n.push((r+s).trim());break}"("===e&&(o=!0)}s+=e,i+=1}}}return n.join(", ")}(e,s):"style"===i?rd(s,fd(e)):"object"===t&&"data"===i?gd(e,s):s:gd(e,s)}function yd(e,t,i){return("video"===e||"audio"===e)&&"autoplay"===Zu(t)}function bd(e){return"string"==typeof e&&Zu(e).split(/\s+/).includes("stylesheet")}function Sd(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&Sd(ru.parentNode(e),t,i);for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!i&&Sd(ru.parentNode(e),t,i)}function wd(e,t,i,s){let n;if(Au(e)){if(n=e,!ru.childNodes(n).length)return!1}else{if(null===ru.parentElement(e))return!1;n=ru.parentElement(e)}try{if("string"==typeof t){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(Sd(n,t,s))return!0;if(i)if(s){if(n.closest(i))return!0}else if(n.matches(i))return!0}catch(e){}return!1}function kd(e,t,i){const s=e.removeEventListener;"function"==typeof s&&s.call(e,t,i)}var Cd=new Map;function xd(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function Id(e){return null==e?"":e.toLowerCase()}var Ed=!1,Td=!1;function Md(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p=!1,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f={},inlineImages:v=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:I=()=>!1,newlyAddedElement:E=!1,depth:T=0,maxDepth:M=50}=t;let{needsMask:P}=t,{preserveWhiteSpace:F=!0}=t;if(T>=M)return Td=!0,Ed||(Ed=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${M}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=wd(e,o,a,void 0===P)),du>0&&(_u.nodeCount+=1);const R=function(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,maskAllElementAttributes:d=!1,maskAttributeFn:h,dataURLOptions:p={},inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const i=t.getId(e);return 1===i?void 0:i}(i,s);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Vc.Document,childNodes:[],compatMode:e.compatMode}:{type:Vc.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Vc.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:i,blockClass:s,blockSelector:n,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,canvasMaskingConfigured:p,keepIframeSrcFn:_,newlyAddedElement:g=!1,rootId:f}=t,v=function(e,t,i){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(i)return e.matches(i)}catch(e){}return!1}(e,s,n),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Zu(e.tagName);return ud.test(t)?"div":t}(e),y=new Set;let b={};const S=e.attributes.length;for(let t=0;S>t;t++){const s=e.attributes[t];yd(m,s.name)||(b[s.name]=md(i,m,Zu(s.name),s.value,e,u))}if("link"===m&&r&&!v&&bd(b.rel)){let t=e.sheet;if(!t){const s=function(e){return e.href}(e);s&&(t=xd(i,s),!t&&s.includes(".css"))&&(t=xd(i,window.location.origin+"/"+s.replace(window.location.href,"")))}let s=null;t&&(Tu(t)?du>0&&(vu.push(e),mu+=1):s=qu(t)),s&&(delete b.rel,delete b.href,b._cssText=s)}if("style"===m&&e.sheet&&!(e.innerText||ru.textContent(e)||"").trim().length){const t=Iu(()=>qu(e.sheet));t&&(b._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,i=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&t?b.value=Ku({element:e,type:ed(e),tagName:m,value:t,maskInputOptions:o,maskInputFn:a}):i&&(b.checked=i)}if("option"===m&&(e.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===m&&e.open){try{b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}y.add("rr_open_mode")}if("canvas"===m&&h&&!(null==p?void 0:p()))if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;e.width>i;i+=50)for(let s=0;e.height>s;s+=50){const n=t.getImageData;if(new Uint32Array((Yu in n?n[Yu]:n).call(t,i,s,Math.min(50,e.width-i),Math.min(50,e.height-s)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),s=i.createElement("canvas");s.width=e.width,s.height=e.height,t!==s.toDataURL(u.type,u.quality)&&(b.rr_dataURL=t)}let w,k=!1;if("img"===m&&d){od||(od=i.createElement("canvas"),ad=od.getContext("2d"));const t=e,s=t.currentSrc||t.getAttribute("src")||"<unknown-src>",n=t.crossOrigin,r=(t,i)=>k?Xu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c}):i,o=()=>{kd(t,"load",o);try{od.width=t.naturalWidth,od.height=t.naturalHeight,ad.drawImage(t,0,0);const e=od.toDataURL(u.type,u.quality);b.rr_dataURL=r("rr_dataURL",e)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${s}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(n?b.crossOrigin=r("crossOrigin",n):t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=b;t.rr_mediaState=e.paused?"paused":"played",y.add("rr_mediaState"),t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(g||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),v){var C,x,I;const{width:t,height:s,left:n,top:r}=e.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(e);b={class:b.class,rr_width:`${t}px`,rr_height:`${s}px`,rr_left:`${Math.floor(n+((null===(x=i.defaultView)||void 0===x?void 0:x.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(I=i.defaultView)||void 0===I?void 0:I.scrollY)||0))}px`},y.add("rr_width"),y.add("rr_height"),y.add("rr_left"),y.add("rr_top"),o&&(b.rr_position=o.position||"static",y.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,y.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,y.add("rr_display")))}if("iframe"!==m||_(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src),l||c)for(const[t,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[t]=Xu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c,isGenerated:y.has(t)}));k=!0;try{customElements.get(m)&&(w=!0)}catch(e){}return{type:Vc.Element,tagName:m,attributes:b,childNodes:[],isSVG:(E=e,Boolean("svg"===E.tagName||E.ownerSVGElement)||void 0),needBlock:v,rootId:f,isCustom:w};var E}(e,{doc:i,blockClass:n,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,maskAllElementAttributes:d,maskAttributeFn:h,dataURLOptions:p,inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:i,maskTextFn:s,rootId:n}=t,r=ru.parentNode(e),o=r&&r.tagName;let a=ru.textContent(e);const l="STYLE"===o||void 0,c="SCRIPT"===o||void 0;if(l&&a){try{var u;if(e.nextSibling||e.previousSibling);else if(Tu(r.sheet));else if(null===(u=r.sheet)||void 0===u?void 0:u.cssRules){const e=qu(r.sheet);e&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(e)&&(a=e)}}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}a=rd(a,fd(t.doc))}return c&&(a="SCRIPT_PLACEHOLDER"),!l&&!c&&a&&i&&(a=s?s(a,ru.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Vc.Text,textContent:a||"",isStyle:l,rootId:n}}(e,{doc:i,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:Vc.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Vc.Comment,textContent:ru.textContent(e)||"",rootId:y};default:return!1}}(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:I,newlyAddedElement:E});if(!R)return console.warn(e,"not serialized"),null;let L;L=s.hasNode(e)?s.getId(e):function(e,t){if(t.comment&&e.type===Vc.Comment)return!0;if(e.type===Vc.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e){var t;let i;try{i=new URL(e,window.location.href)}catch(e){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==s?void 0:s[1])&&void 0!==t?t:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Id(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Id(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Id(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Id(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Id(e.attributes.property).match(/^(og|twitter|fb):/)||Id(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Id(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Id(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Id(e.attributes.name))||Id(e.attributes.property).match(/^article:/)||Id(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Id(e.attributes.name)))return!0}}return!1}(R,g)||!F&&R.type===Vc.Text&&!R.isStyle&&!R.textContent.replace(/^\s+|\s+$/gm,"").length?-2:dd();const A=Object.assign(R,{id:L});if(s.add(e,A),-2===L)return null;b&&b(e);let O=!l;if(A.type===Vc.Element){O=O&&!A.needBlock,delete A.needBlock;const t=ru.shadowRoot(e);t&&$u(t)&&(A.isShadowHost=!0)}if((A.type===Vc.Document||A.type===Vc.Element)&&O){g.headWhitespace&&A.type===Vc.Element&&"head"===A.tagName&&(F=!1);const t={doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:F,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:I,depth:T+1,maxDepth:M};if(A.type===Vc.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else for(const i of Array.from(ru.childNodes(e))){const e=Md(i,t);e&&A.childNodes.push(e)}let E=null;if(Au(e)&&(E=ru.shadowRoot(e)))for(const e of Array.from(ru.childNodes(E))){const i=Md(e,t);i&&($u(E)&&(i.isShadow=!0),A.childNodes.push(i))}}const D=ru.parentNode(e);if(D&&Ou(D)&&$u(D)&&(A.isShadow=!0),A.type===Vc.Element&&"iframe"===A.tagName){const t=function(e,t,i){const s=()=>{},n=e.contentWindow;if(!n)return s;let r;try{r=n.document.readyState}catch(e){return s}const o=()=>t();if("complete"!==r){let s=!1,n=null;const r=()=>{s||(s=!0,null!==n&&(clearTimeout(n),n=null),kd(e,"load",a),e.addEventListener("load",o),t())},a=()=>r();return n=setTimeout(r,i),e.addEventListener("load",a),()=>{null!==n&&(clearTimeout(n),n=null),s?kd(e,"load",o):(s=!0,kd(e,"load",a))}}const a="about:blank";let l;try{l=n.location.href}catch(e){return s}if(l!==a||e.src===a||""===e.src){const i=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(i),kd(e,"load",o)}}return e.addEventListener("load",o),()=>{kd(e,"load",o)}}(e,()=>{const t=e.contentDocument;if(t&&S){const i=Md(t,{doc:t,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:F,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:I,depth:T+1,maxDepth:M});i&&S(e,i)}},w);null==k||k(e,t)}return A.type===Vc.Element&&"link"===A.tagName&&bd(A.attributes.rel)&&function(t,l,k){if(Cd.has(t))return;let E;try{E=t.sheet}catch(e){return}if(E)return;const R=new AbortController;let L=!1;const A=()=>{if(!L){L=!0;try{(()=>{if(C){const t=Md(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:F,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:C,stylesheetLoadTimeout:x,keepIframeSrcFn:I,depth:T,maxDepth:M});t&&C(e,t)}})()}finally{Cd.delete(t),R.abort()}}},O=setTimeout(A,k);R.signal.addEventListener("abort",()=>clearTimeout(O),{once:!0}),t.addEventListener("load",A,{signal:R.signal,once:!0}),Cd.set(t,R)}(e,0,x),A}function Pd(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}var Fd=class e{constructor(...e){Lu(this,"parentElement",null),Lu(this,"parentNode",null),Lu(this,"ownerDocument",void 0),Lu(this,"firstChild",null),Lu(this,"lastChild",null),Lu(this,"previousSibling",null),Lu(this,"nextSibling",null),Lu(this,"ELEMENT_NODE",1),Lu(this,"TEXT_NODE",3),Lu(this,"nodeType",void 0),Lu(this,"nodeName",void 0),Lu(this,"RRNodeType",void 0)}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Rd(e,t,i=document){const s={capture:!0,passive:!0};return i.addEventListener(e,t,s),()=>Ld(i,e,t,s)}function Ld(e,t,i,s){Ad(()=>{const n=e.removeEventListener;"function"==typeof n&&(void 0!==s?n.call(e,t,i,s):n.call(e,t,i))})}function Ad(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function Od(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var $d="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",Dd={map:{},getId(){return console.warn($d),-1},getNode(){return console.warn($d),null},removeNodeFromMap(){console.warn($d)},has(){return console.warn($d),!1},reset(){console.warn($d)}};function Nd(e,t,i={}){let s=null,n=0;return function(...r){const o=Date.now();n||!1!==i.leading||(n=o);const a=t-(o-n),l=this;0>=a||a>t?(s&&(clearTimeout(s),s=null),n=o,e.apply(l,r)):s||!1===i.trailing||(s=setTimeout(()=>{n=!1===i.leading?0:Date.now(),s=null,e.apply(l,r)},a))}}function Bd(e,t,i,s,n=window){const r=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,s?i:{set(e){if(setTimeout(()=>{try{i.set.call(this,e)}catch(e){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(e){return}r.set.call(this,e)}}}),()=>Bd(e,t,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Dd=new Proxy(Dd,{get(e,t,i){return"map"===t&&console.warn($d),Reflect.get(e,t,i)}}));var qd=Date.now;function Hd(e){var t,i,s,n;const r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(t=ru.parentElement(r.body))||void 0===t?void 0:t.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(s=ru.parentElement(r.body))||void 0===s?void 0:s.scrollTop)||(null==r||null===(n=r.body)||void 0===n?void 0:n.scrollTop)||0}}function Wd(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function zd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ud(e){return e?e.nodeType===e.ELEMENT_NODE?e:ru.parentElement(e):null}function jd(e,t,i,s){if(!e)return!1;const n=Ud(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(s&&null!==n.closest("."+t))return!0}else if(Sd(n,t,s))return!0}catch(e){}if(i){if(n.matches(i))return!0;if(s&&null!==n.closest(i))return!0}return!1}function Vd(e,t,i){return!("TITLE"!==e.tagName||!i.headTitleMutations)||-2===t.getId(e)}function Gd(e,t){if(Ou(e))return!1;const i=t.getId(e);if(!t.has(i))return!0;const s=ru.parentNode(e);return(!s||s.nodeType!==e.DOCUMENT_NODE)&&(!s||Gd(s,t))}function Qd(e){return Boolean(e.changedTouches)}function Kd(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Zd(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Jd(e){return!!e&&(e instanceof Fd&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(ru.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(qd=()=>(new Date).getTime());var Xd=class{constructor(){Lu(this,"id",1),Lu(this,"styleIDMap",new WeakMap),Lu(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let i;return i=void 0===t?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Yd(e){var t;let i=null;return"getRootNode"in e&&(null===(t=ru.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ru.host(ru.getRootNode(e))&&(i=ru.host(ru.getRootNode(e))),i}function eh(e){const t=e.ownerDocument;if(!t)return!1;if(ru.contains(t,e))return!0;const i=ru.isConnected(e);return"boolean"==typeof i?i:function(e){const t=e.ownerDocument;if(!t)return!1;const i=function(e){let t,i=e;for(;t=Yd(i);)i=t;return i}(e);return ru.contains(t,i)}(e)}function th(e){return"__ln"in e}var ih,sh=class{constructor(){Lu(this,"length",0),Lu(this,"head",null),Lu(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;e>i;i++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&th(e.previousSibling)){const i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&th(e.nextSibling)&&e.nextSibling.__ln.previous){const i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},nh=(e,t)=>`${e}@${t}`,rh=class{constructor(){Lu(this,"frozen",!1),Lu(this,"locked",!1),Lu(this,"texts",[]),Lu(this,"attributes",[]),Lu(this,"attributeMap",new WeakMap),Lu(this,"generatedAttributes",new WeakMap),Lu(this,"removes",[]),Lu(this,"mapRemoves",new Set),Lu(this,"movedMap",{}),Lu(this,"addedSet",new Set),Lu(this,"movedSet",new Set),Lu(this,"droppedSet",new Set),Lu(this,"removesSubTreeCache",new Set),Lu(this,"mutationCb",void 0),Lu(this,"blockClass",void 0),Lu(this,"blockSelector",void 0),Lu(this,"maskTextClass",void 0),Lu(this,"maskTextSelector",void 0),Lu(this,"inlineStylesheet",void 0),Lu(this,"maskInputOptions",void 0),Lu(this,"maskTextFn",void 0),Lu(this,"maskInputFn",void 0),Lu(this,"maskAllElementAttributes",void 0),Lu(this,"maskAttributeFn",void 0),Lu(this,"keepIframeSrcFn",void 0),Lu(this,"recordCanvas",void 0),Lu(this,"canvasMaskingConfigured",void 0),Lu(this,"inlineImages",void 0),Lu(this,"slimDOMOptions",void 0),Lu(this,"dataURLOptions",void 0),Lu(this,"doc",void 0),Lu(this,"mirror",void 0),Lu(this,"iframeManager",void 0),Lu(this,"stylesheetManager",void 0),Lu(this,"shadowDomManager",void 0),Lu(this,"canvasManager",void 0),Lu(this,"processedNodeManager",void 0),Lu(this,"unattachedDoc",void 0),Lu(this,"canvasManagerReleased",!1),Lu(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Lu(this,"emit",()=>{if(this.frozen||this.locked)return;const e=ou(),t=cu();try{this.processBufferedMutations()}finally{i=ou()-e,s=t,du>0||uu(i,null!=s?s:au)||i>bu.slowestBatchMs&&(bu.slowestBatchMs=i)}var i,s}),Lu(this,"processBufferedMutations",()=>{const e=[],t=new Set,i=new sh,s=e=>{let t=e,i=-2;for(;-2===i;)t=t&&t.nextSibling,i=t&&this.mirror.getId(t);return i};let n;const r=r=>{var o;const a=ru.parentNode(r);if(!a||!eh(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=Ou(a)?this.mirror.getId(Yd(r)):this.mirror.getId(a),c=s(r);if(-1===l||-1===c)return i.addNode(r);null!==(o=n)&&void 0!==o||(n={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{Kd(e,this.mirror)&&this.iframeManager.addIframe(e),Zd(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Jd(e)&&!jd(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(ru.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});const u=Md(r,n);u&&(e.push({parentId:l,nextId:c,node:u}),t.add(u.id))};for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e);for(const e of this.movedSet)ah(this.removesSubTreeCache,e)&&!this.movedSet.has(ru.parentNode(e))||r(e);for(const e of this.addedSet)lh(this.droppedSet,e)||ah(this.removesSubTreeCache,e)?lh(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let o=null;for(;i.length;){let e=null;if(o){const t=this.mirror.getId(ru.parentNode(o.value)),i=s(o.value);-1!==t&&-1!==i&&(e=o)}if(!e){let t=i.tail;for(;t;){const i=t;if(t=t.previous,i){const t=this.mirror.getId(ru.parentNode(i.value));if(-1===s(i.value))continue;if(-1!==t){e=i;break}{const t=ru.parentNode(i.value);if(t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const s=ru.host(t);if(-1!==this.mirror.getId(s)){e=i;break}}}}}}if(!e){for(;i.head;)i.removeNode(i.head.value);break}o=e.previous,i.removeNode(e.value),r(e.value)}const a={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const t=e.node,i=ru.parentNode(t);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const{attributes:t}=e;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){const i=JSON.stringify(e.styleDiff),s=JSON.stringify(e._unchangedStyles);t.style.length>i.length&&(i+s).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[s,n]of Object.entries(t))if("string"==typeof n||null===n){var i;t[s]=Xu({element:e.node,name:s,value:n,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(e.node))||void 0===i?void 0:i.has(s)})}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),Lu(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),Lu(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const i=Array.from(ru.childNodes(e),e=>ru.textContent(e)||"").join("");t.attributes.value=Ku({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:ed(e),value:i,maskInputFn:this.maskInputFn})}),Lu(this,"processMutation",e=>{if(!Vd(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=ru.textContent(e.target);jd(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:wd(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ud(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{var t;const s=e.target,n=Zu(s.tagName),r=e.attributeName,o=null!==(t=e.attributeNamespace)&&void 0!==t?t:null;let a=function(e,t,i){if(!i)return t;const s=e.getAttributeNodeNS(i,t);if(s)return s.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${t}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${t}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===t?t:`xmlns:${t}`;const n=e.lookupPrefix(i);return n?`${n}:${t}`:t}(s,r,o),l=o?s.getAttributeNS(o,r):e.target.getAttribute(r);if("value"===a){const e=s,t=ed(e);l=Ku({element:e,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:t,value:l,maskInputFn:this.maskInputFn})}if(jd(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;let c=this.attributeMap.get(e.target);const u="iframe"===n&&"src"===a;if(u&&!this.keepIframeSrcFn(l)&&s.contentDocument)return;if("type"===a&&"input"===n&&"password"===(e.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!yd(n,a)){var i;c||(c={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(c),this.attributeMap.set(e.target,c));const t=md(this.doc,n,Zu(a),l,s,this.dataURLOptions);if(u&&!this.keepIframeSrcFn(l)&&(a="rr_src"),c.attributes[a]=t,null===(i=this.generatedAttributes.get(e.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const t=this.unattachedDoc.createElement("span"),i=s.style;e.oldValue&&(t.style.cssText=e.oldValue);for(const e of Array.from(i)){const s=i.getPropertyValue(e),n=i.getPropertyPriority(e);s!==t.style.getPropertyValue(e)||n!==t.style.getPropertyPriority(e)?c.styleDiff[e]=""===n?s:[s,n]:c._unchangedStyles[e]=[s,n]}for(const e of Array.from(t.style))""===i.getPropertyValue(e)&&(c.styleDiff[e]=!1)}else if("open"===a&&"dialog"===n){c.attributes.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal";let t=this.generatedAttributes.get(e.target);t||(t=new Set,this.generatedAttributes.set(e.target,t)),t.add("rr_open_mode")}}break}case"childList":if(jd(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const i=this.mirror.getId(t),s=Ou(e.target)?this.mirror.getId(ru.host(e.target)):this.mirror.getId(e.target);jd(e.target,this.blockClass,this.blockSelector,!1)||Vd(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(oh(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===i||Gd(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[nh(i,s)]?oh(this.movedSet,t):(this.removes.push({parentId:s,id:i,isShadow:!(!Ou(e.target)||!$u(e.target))||void 0}),function(e,t){const i=[e];for(;i.length;){const e=i.pop();t.has(e)||(t.add(e),ru.childNodes(e).forEach(e=>i.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),Lu(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Vd(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&-1!==i&&(this.movedMap[nh(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!jd(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;const t=ru.childNodes(e);for(let e=0,i=t.length;i>e;e++){const i=t[e];i&&this.genAdds(i)}if(Jd(e)){const t=ru.childNodes(ru.shadowRoot(e));for(let i=0,s=t.length;s>i;i++){const s=t[i];s&&(this.processedNodeManager.add(s,this),this.genAdds(s,e))}}}}}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){const t=this.blockClass,i=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(i&&(i.lastIndex=0),jd(e,i||t,this.blockSelector,!0))return!0;const s="getRootNode"in e?ru.getRootNode(e):null;e=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?ru.host(s):null}return!1}};function oh(e,t){const i=[t];for(;i.length;){const t=i.pop();if(e.delete(t),t.nodeType===t.TEXT_NODE)continue;const s=ru.childNodes(t);for(let e=0,t=s.length;t>e;e++){const t=s[e];t&&i.push(t)}}}function ah(e,t,i){return 0!==e.size&&function(e,t){const i=ru.parentNode(t);return!!i&&e.has(i)}(e,t)}function lh(e,t){if(0===e.size)return!1;let i=ru.parentNode(t);for(;i;){if(e.has(i))return!0;i=ru.parentNode(i)}return!1}function ch(e){ih=e}function uh(){ih=void 0}var dh=(e,t="rrweb")=>ih?(...i)=>{try{return e(...i)}catch(e){if(ih&&!0===ih(e,t))return;throw e}}:e,hh=[];function ph(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function _h(e,t){const i=new rh;let s;i.init(e);try{s=new(su())(dh(i.processMutations.bind(i)));const n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),s.observe(t,n),hh.push(i),{observer:s,buffer:i}}catch(e){try{null==s||s.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function gh({scrollCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){const o=new Map,a=r=>{const a=ph(r);if(!a||jd(a,s,n,!0))return;const l=i.getId(a);let c,u;if(a===t&&t.defaultView){const e=Hd(t.defaultView);c=e.left,u=e.top}else c=a.scrollLeft,u=a.scrollTop;const d=`${c},${u}`;o.get(l)!==d&&(o.set(l,d),e({id:l,x:c,y:u}))},l=[Rd("scroll",dh(Nd(dh(e=>a(e)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(Rd("scrollend",dh(a),t)),()=>l.forEach(e=>e())}function fh(e,t){for(let i=hh.length-1;i>=0;i--){const s=hh[i];if(!s)continue;let n=s.bufferBelongsToIframe(e);!n&&t&&t.has(s.bufferDoc())&&(n=!0),n&&(s.reset(),hh.splice(i,1))}}var vh=["INPUT","TEXTAREA","SELECT"],mh=new WeakMap;function yh(e){return function e(t,i){if(Ch("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Ch("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Ch("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Ch("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const s=Array.from(t.parentRule.cssRules).indexOf(t);return i.unshift(s),e(t.parentRule,i)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);i.unshift(e)}return i}(e,[])}function bh(e,t,i){let s,n;return e?(e.ownerNode?s=t.getId(e.ownerNode):n=i.getId(e),{styleId:n,id:s}):{}}function Sh({mirror:e,stylesheetManager:t},i){var s,n;let r=null;r=e.getId("#document"===i.nodeName?i:ru.host(i));const o="#document"===i.nodeName?null===(s=i.defaultView)||void 0===s?void 0:s.Document:null===(n=i.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n?void 0:n.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){let i;try{var s;i=null===(s=a.set)||void 0===s?void 0:s.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(e){}return i}}),dh(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var wh=new Set;function kh(e,t={}){const i=e.doc.defaultView;if(!i)return()=>{};let s,n;!function(e,t){const{mutationCb:i,mousemoveCb:s,mouseInteractionCb:n,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:_}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),s(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),_(...e)}}(e,t);const r=[],o=dh(()=>{try{if(n)try{n.destroy(),n.reset()}finally{const e=hh.indexOf(n);-1!==e&&hh.splice(e,1)}e.shadowDomManager.resetForDoc(e.doc),null==s||s.disconnect()}finally{Od(r)}}),a=(e,t)=>{const i=dh(()=>{try{return t()}catch(t){throw wh.add(e),t}})();"function"==typeof i&&r.push(i)};try{if(e.recordDOM&&a("mutation",()=>{const t=_h(e,e.doc);s=t.observer,n=t.buffer}),a("move",()=>function({mousemoveCb:e,sampling:t,doc:i,mirror:s}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Nd(dh(t=>{const i=Date.now()-o;e(a.map(e=>(e.timeOffset-=i,e)),t),a=[],o=null}),r),c=dh(Nd(dh(e=>{const t=ph(e),{clientX:i,clientY:n}=Qd(e)?e.changedTouches[0]:e;o||(o=qd()),a.push({x:i,y:n,id:s.getId(t),timeOffset:qd()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?Hc.Drag:e instanceof MouseEvent?Hc.MouseMove:Hc.TouchMove)}),n,{trailing:!1})),u=[Rd("mousemove",c,i),Rd("touchmove",c,i),Rd("drag",c,i)];return dh(()=>{u.forEach(e=>e())})}(e)),a("mouseInteraction",()=>function({mouseInteractionCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];let l=null;return Object.keys(Wc).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(r=>{let o=Zu(r);const c=(t=>r=>{const o=ph(r);if(jd(o,s,n,!0))return;let a=null,c=t;if("pointerType"in r){switch(r.pointerType){case"mouse":a=zc.Mouse;break;case"touch":a=zc.Touch;break;case"pen":a=zc.Pen}a===zc.Touch&&(Wc[t]===Wc.MouseDown?c="TouchStart":Wc[t]===Wc.MouseUp&&(c="TouchEnd"))}else Qd(r)&&(a=zc.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===zc.Touch||c.startsWith("Mouse")&&a===zc.Mouse)&&(a=null)):Wc[t]===Wc.Click&&(a=l,l=null);const u=Qd(r)?r.changedTouches[0]:r;if(!u)return;const d=i.getId(o),{clientX:h,clientY:p}=u;dh(e)(ct({type:Wc[c],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Wc[r]){case Wc.MouseDown:case Wc.MouseUp:o=o.replace("mouse","pointer");break;case Wc.TouchStart:case Wc.TouchEnd:return}a.push(Rd(o,c,t))}),dh(()=>{a.forEach(e=>e())})}(e)),a("scroll",()=>gh(e)),a("viewportResize",()=>function({viewportResizeCb:e},{win:t}){let i=-1,s=-1;return Rd("resize",dh(Nd(dh(()=>{const t=Wd(),n=zd();i===t&&s===n||(e({width:Number(n),height:Number(t)}),i=t,s=n)}),200)),t)}(e,{win:i})),a("input",()=>function({inputCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(e){let i=ph(e);const c=e.isTrusted,d=t.defaultView;if(i&&d&&!(i instanceof d.HTMLElement))return;const p=i&&i.tagName;if(i&&"OPTION"===p&&(i=ru.parentElement(i)),!i||!p||0>vh.indexOf(p)||jd(i,s,n,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let _=i.value,g=!1;const f=ed(i)||"";"radio"===f||"checkbox"===f?g=i.checked:(a[p.toLowerCase()]||a[f])&&(_=Ku({element:i,maskInputOptions:a,tagName:p,type:f,value:_,maskInputFn:l})),h(i,u?{text:_,isChecked:g,userTriggered:c}:{text:_,isChecked:g});const v=i.name;"radio"===f&&v&&g&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==i){const t=e.value;h(e,u?{text:t,isChecked:!g,userTriggered:!1}:{text:t,isChecked:!g})}})}function h(t,s){const n=mh.get(t);if(!n||n.text!==s.text||n.isChecked!==s.isChecked){mh.set(t,s);const n=i.getId(t);dh(e)(ct(ct({},s),{},{id:n}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>Rd(e,dh(d),t)),_=t.defaultView;if(!_)return()=>{p.forEach(e=>e())};const g=_.Object.getOwnPropertyDescriptor(_.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[_.HTMLInputElement.prototype,"value"],[_.HTMLInputElement.prototype,"checked"],[_.HTMLSelectElement.prototype,"value"],[_.HTMLTextAreaElement.prototype,"value"],[_.HTMLSelectElement.prototype,"selectedIndex"],[_.HTMLOptionElement.prototype,"selected"]].map(e=>Bd(e[0],e[1],{set(){dh(d)({target:this,isTrusted:!1})}},!1,_))),dh(()=>{Od(p)})}(e)),a("mediaInteraction",()=>function({mediaInteractionCb:e,blockClass:t,blockSelector:i,mirror:s,sampling:n,doc:r}){const o=dh(r=>Nd(dh(n=>{const o=ph(n);if(!o||jd(o,t,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=o;e({type:r,id:s.getId(o),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}),n.media||500)),a=[Rd("play",o(jc.Play),r),Rd("pause",o(jc.Pause),r),Rd("seeked",o(jc.Seeked),r),Rd("volumechange",o(jc.VolumeChange),r),Rd("ratechange",o(jc.RateChange),r)];return dh(()=>{a.forEach(e=>e())})}(e)),e.recordDOM){const t=function(e){const t=new Map,i=new Set;let s=!0;const n=e=>{if(s)try{e()}catch(e){}},r=e=>{var i;const s=t.get(e);if(s){for(;null===(i=s[0])||void 0===i?void 0:i.ready;){const e=s.shift();(null==e?void 0:e.emit)&&n(e.emit)}0===s.length&&t.delete(e)}};return{queueMutation(e,i){if(!e)return void n(i);const s=t.get(e);s?(s.push({emit:i,ready:!0}),r(e)):n(i)},queuePendingMutation(o,a,l){if(!s)return()=>{};let c=t.get(o);c||(c=[],t.set(o,c));const u={emit:a,ready:!1};c.push(u);let d,h=!1,p=!1;const _=()=>{h||p||(h=!0,void 0!==d&&i.delete(d),u.ready=!0,u.emit=void 0,r(o))};try{d=e.setTimeout(_,5e3),h||p?e.clearTimeout(d):i.add(d)}catch(e){_()}return t=>{!p&&s&&(p=!0,void 0!==d&&(e.clearTimeout(d),i.delete(d)),h?t&&n(l):(u.ready=!0,t||(u.emit=void 0),r(o)))}},reset(){s=!1,i.forEach(t=>e.clearTimeout(t)),i.clear(),t.clear()}}}(i);r.push(t.reset),a("styleSheet",()=>function({styleSheetRuleCb:e,mirror:t,stylesheetManager:i},{win:s,mutationQueue:n}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const r=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:dh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=bh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,adds:[{rule:a,index:l}]})),l},"host")}),s.CSSStyleSheet.prototype.addRule=function(e,t,i=this.cssRules.length){return s.CSSStyleSheet.prototype.insertRule.apply(this,[`${e} { ${t} }`,i])};const o=s.CSSStyleSheet.prototype.deleteRule;let a,l;s.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:dh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=bh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,removes:[{index:a}]})),l},"host")}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:dh((s,r,o)=>{const[a]=o,l=s.apply(r,o);try{const s=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof s)return l;i.onCssomSheetMutation(r);const{id:o,styleId:c}=bh(r,t,i.styleMirror);if(!(o&&-1!==o||c&&-1!==c))return l;const u=n.queuePendingMutation(r,()=>e({id:o,styleId:c,replace:a}),()=>{const t=qu(r);null!==t&&e({id:o,styleId:c,replace:t})});try{s.call(l,()=>u(!0),()=>u(!1))}catch(e){u(!1)}}catch(e){}return l},"host")})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:dh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=bh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,replaceSync:a})),l},"host")}));const c={};xh("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(xh("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),xh("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),xh("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));const u={};return Object.entries(c).forEach(([s,r])=>{u[s]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(u[s].insertRule,{apply:dh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=bh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...yh(r),l];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,adds:[{rule:a,index:t}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(u[s].deleteRule,{apply:dh((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=bh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...yh(r),a];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,removes:[{index:t}]}))}return l},"host")})}),dh(()=>{s.CSSStyleSheet.prototype.insertRule=r,s.CSSStyleSheet.prototype.deleteRule=o,a&&(s.CSSStyleSheet.prototype.replace=a),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:i,mutationQueue:t})),a("adoptedStyleSheet",()=>Sh(e,e.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:i,stylesheetManager:s},{win:n,mutationQueue:r}){const o=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:dh((n,o,a)=>{var l;const[c,u,d]=a,h=n.apply(o,a);if(i.has(c))return h;const p=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(p);const{id:_,styleId:g}=bh(p,t,s.styleMirror);if(_&&-1!==_||g&&-1!==g){const t=yh(o.parentRule);r.queueMutation(p,()=>e({id:_,styleId:g,set:{property:c,value:u,priority:d},index:t}))}return h},"host")});const a=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:dh((n,o,a)=>{var l;const[c]=a,u=n.apply(o,a);if(i.has(c))return u;const d=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(d);const{id:h,styleId:p}=bh(d,t,s.styleMirror);if(h&&-1!==h||p&&-1!==p){const t=yh(o.parentRule);r.queueMutation(d,()=>e({id:h,styleId:p,remove:{property:c},index:t}))}return u},"host")}),dh(()=>{n.CSSStyleDeclaration.prototype.setProperty=o,n.CSSStyleDeclaration.prototype.removeProperty=a})}(e,{win:i,mutationQueue:t})),e.collectFonts&&a("font",()=>function({fontCb:e,doc:t}){const i=t.defaultView;if(!i)return()=>{};const s=[],n=new WeakMap,r=i.FontFace;i.FontFace=function(e,t,i){const s=new r(e,t,i);return n.set(s,{family:e,buffer:"string"!=typeof t,descriptors:i,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),s};const o=nu(t.fonts,"add",function(t){return function(i){return setTimeout(dh(()=>{const t=n.get(i);t&&(e(t),n.delete(i))}),0),t.apply(this,[i])}});return s.push(()=>{i.FontFace=r}),s.push(o),dh(()=>{s.forEach(e=>e())})}(e))}a("selection",()=>function(e){const{doc:t,mirror:i,blockClass:s,blockSelector:n,selectionCb:r}=e;let o=!0;const a=dh(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;l>t;t++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:c}=e.getRangeAt(t);jd(r,s,n,!0)||jd(l,s,n,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:c})}r({ranges:a})});return a(),Rd("selectionchange",a)}(e)),a("customElement",()=>function({doc:e,customElementCb:t}){const i=e.defaultView;return i&&i.customElements?nu(i.customElements,"define",function(e){return function(i,s,n){try{t({define:{name:i}})}catch(e){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,s,n])}}):()=>{}}(e));for(const t of e.plugins)a(`plugin:${t.name}`,()=>t.observer(t.callback,i,t.options))}catch(e){try{o()}catch(e){}throw e}return o}function Ch(e){return void 0!==window[e]}function xh(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Ih=class{constructor(e){Lu(this,"generateIdFn",void 0),Lu(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Lu(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,s){if(0>t)return t;const n=i||this.getRemoteIdToLocalIdMap(e),r=s||this.getLocalIdToRemoteIdMap(e);let o=n.get(t);return void 0===o&&(o=this.generateIdFn(),n.set(t,o),r.set(o,t)),o}getIds(e,t){const i=this.getRemoteIdToLocalIdMap(e),s=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,i,s))}getRemoteId(e,t,i){var s;return"number"!=typeof t||0>t?t:null!==(s=(i||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==s?s:-1}getRemoteIds(e,t){const i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},Eh=class{constructor(e){Lu(this,"iframes",new WeakMap),Lu(this,"crossOriginIframeMap",new WeakMap),Lu(this,"crossOriginIframeMirror",new Ih(dd)),Lu(this,"crossOriginIframeStyleMirror",void 0),Lu(this,"crossOriginIframeRootIdMap",new WeakMap),Lu(this,"mirror",void 0),Lu(this,"mutationCb",void 0),Lu(this,"wrappedEmit",void 0),Lu(this,"loadListener",void 0),Lu(this,"pageHideListener",void 0),Lu(this,"stylesheetManager",void 0),Lu(this,"recordCrossOriginIframes",void 0),Lu(this,"messageHandler",void 0),Lu(this,"nestedIframeListeners",new Map),Lu(this,"attachedWindows",new WeakMap),Lu(this,"attachedDocuments",new WeakMap),Lu(this,"attachedIframes",new Map),Lu(this,"loadListenerDisposers",new WeakMap),Lu(this,"iframeElementsById",new Map),Lu(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ih(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);const s=this.mirror.getId(e);-1!==s&&this.iframeElementsById.set(s,e)}getIframeElementById(e){var t,i,s;return null!==(t=null!==(i=null===(s=this.attachedIframes.get(e))||void 0===s?void 0:s.element)&&void 0!==i?i:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){const t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>Ad(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){const t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:e,handler:t})=>{Ld(e,"pagehide",t)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){const i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;const s=this.trackIframeContent(e,t);if(e.contentDocument){let t=this.attachedDocuments.get(e);t||(t=new Set,this.attachedDocuments.set(e,t)),t.add(e.contentDocument)}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){const t=this.handleMessage.bind(this);Ad(()=>{n.addEventListener("message",t),this.nestedIframeListeners.set(n,t);let i=this.attachedWindows.get(e);i||(i=new Set,this.attachedWindows.set(e,i)),i.add(n)})}Ad(()=>{const t=e.contentWindow;if(!t)return;let i=this.pageHideHandlers.get(e);if(i)for(const e of i)if(e.win===t)return;const s=()=>{var t;null===(t=this.pageHideListener)||void 0===t||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};t.addEventListener("pagehide",s),i||(i=new Set,this.pageHideHandlers.set(e,i)),i.add({win:t,handler:s})}),null===(i=this.loadListener)||void 0===i||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,t.data.event);s&&this.wrappedEmit(s,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case qc.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:qc.IncrementalSnapshot,data:{source:Hc.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case qc.Meta:case qc.Load:case qc.DomContentLoaded:return!1;case qc.Plugin:return t;case qc.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case qc.IncrementalSnapshot:switch(t.data.source){case Hc.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(t.node,i)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Hc.Drag:case Hc.TouchMove:case Hc.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Hc.ViewportResize:return!1;case Hc.MediaInteraction:case Hc.MouseInteraction:case Hc.Scroll:case Hc.CanvasMutation:case Hc.Input:return this.replaceIds(t.data,e,["id"]),t;case Hc.StyleSheetRule:case Hc.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Hc.Font:return t;case Hc.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Hc.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(i=t.data.styles)||void 0===i||i.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,i,s){for(const n of s)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(i,t[n]):e.getId(i,t[n]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Vc.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){const t=this.attachedIframes.get(e),i=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){const e=i.contentWindow,t=this.attachedWindows.get(i);t&&(t.forEach(e=>{const t=this.nestedIframeListeners.get(e);t&&(Ld(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(i)),e&&this.nestedIframeListeners.has(e)&&(Ld(e,"message",this.nestedIframeListeners.get(e)),this.nestedIframeListeners.delete(e)),e&&this.crossOriginIframeMap.delete(e),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const s=this.attachedDocuments.get(i);s&&(s.forEach(e=>{Ad(()=>this.mirror.removeNodeFromMap(e))}),Ad(()=>fh(i,s)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(e=>this.removeIframeById(e))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&Ld(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{Ld(t,"message",e)}),this.nestedIframeListeners.clear();const e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),e.forEach(e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Th=class{constructor(e){Lu(this,"shadowDoms",new WeakSet),Lu(this,"mutationCb",void 0),Lu(this,"scrollCb",void 0),Lu(this,"bypassOptions",void 0),Lu(this,"mirror",void 0),Lu(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var i,s;if(!$u(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=null!==(i=null===(s=ru.host(e))||void 0===s?void 0:s.ownerDocument)&&void 0!==i?i:t,{observer:r,buffer:o}=_h(ct(ct({},this.bypassOptions),{},{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push({doc:n,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const e=hh.indexOf(o);-1!==e&&hh.splice(e,1)}}),this.restoreHandlers.push({doc:n,handler:gh(ct(ct({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(ru.host(e))),this.restoreHandlers.push({doc:n,handler:Sh({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})},0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const i=this;this.restoreHandlers.push({doc:t,handler:nu(e.prototype,"attachShadow",function(e){return function(s){const n=e.call(this,s),r=ru.shadowRoot(this);return r&&eh(this)&&i.addShadowRoot(r,t),n}})})}reset(){this.restoreHandlers.forEach(({handler:e})=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){const t=[];for(const i of this.restoreHandlers)if(i.doc===e)try{i.handler()}catch(e){}else t.push(i);this.restoreHandlers=t}},Mh="skip-frame";function Ph(e){if("object"!=typeof e||null===e)return!1;const{x:t,y:i,width:s,height:n}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(n)&&s>=0&&n>=0}for(var Fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Lh=0;64>Lh;Lh++)Rh[Fh.charCodeAt(Lh)]=Lh;var Ah=function(e){var t,i=new Uint8Array(e),s=i.length,n="";for(t=0;s>t;t+=3)n+=Fh[i[t]>>2],n+=Fh[(3&i[t])<<4|i[t+1]>>4],n+=Fh[(15&i[t+1])<<2|i[t+2]>>6],n+=Fh[63&i[t+2]];return s%3==2?n=n.substring(0,n.length-1)+"=":s%3==1&&(n=n.substring(0,n.length-2)+"=="),n},Oh=new Map,$h=(e,t,i)=>{if(!e||!Bh(e,t)&&"object"!=typeof e)return;const s=function(e,t){let i=Oh.get(e);return i||(i=new Map,Oh.set(e,i)),i.has(t)||i.set(t,[]),i.get(t)}(i,e.constructor.name);let n=s.indexOf(e);return-1===n&&(n=s.length,s.push(e)),n};function Dh(e,t,i,s){if(e instanceof Array)return e.map(e=>Dh(e,t,i,s));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:Ah(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Dh(e.buffer,t,i,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:i}=e;return{rr_type:t,src:i}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(s.type,s.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[Dh(e.data,t,i,s),e.width,e.height]}:Bh(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:$h(e,t,i)}:e}var Nh=(e,t,i,s)=>e.map(e=>Dh(e,t,i,s)),Bh=(e,t)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(i.find(i=>e instanceof t[i]))},qh=["webgl","webgl2"];function Hh(e){return"nodeType"in e}function Wh(e,t,i,s){const n=[];try{if(s){const s=function(e,t,i){const s=e.GPUCanvasContext;if((null==s?void 0:s.prototype)&&"function"==typeof s.prototype.configure)return nu(s.prototype,"configure",function(s){return function(n){const r=function(e){const{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!r||Hh(r)&&jd(r,t,i,!0))return s.call(this,n);Hh(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(e){const t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return s.call(this,null!==o&&n?ct(ct({},n),{},{usage:"number"==typeof n.usage?n.usage|o:o}):n)}})}(e,t,i);s&&n.push(s)}const r=nu(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...r){const o=function(e){return"experimental-webgl"===e?"webgl":e}(n);if(!jd(this,t,i,!0)&&("__context"in this||(this.__context=o),s&&qh.includes(o)))if(r[0]&&"object"==typeof r[0]){const e=r[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[n,...r])}});n.push(r)}catch(e){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function zh(e,t,i,s,n,r,o){const a=[],l=Object.getOwnPropertyNames(e);for(const c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const l=nu(e,c,function(e){return function(...a){const l=e.apply(this,a);if($h(l,r,this),this.canvas&&"tagName"in this.canvas&&!jd(this.canvas,s,n,!0)){const e=Nh(a,r,this,o);i(this.canvas,{type:t,property:c,args:e})}return l}});a.push(l)}catch(r){const o=Bd(e,c,{set(e){this.canvas&&"tagName"in this.canvas&&!jd(this.canvas,s,n,!0)&&i(this.canvas,{type:t,property:c,args:[e],setter:!0})}});a.push(o)}return a}var Uh='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',jh="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Uh],{type:"text/javascript;charset=utf-8"});function Vh(e){let t;try{if(t=jh&&(self.URL||self.webkitURL).createObjectURL(jh),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Uh),{name:null==e?void 0:e.name})}}var Gh,Qh,Kh,Zh=class{onFullSnapshot(){var e;null===(e=this.resetFrameDedup)||void 0===e||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){Lu(this,"pendingCanvasMutations",new Map),Lu(this,"rafStamps",{latestId:0,invokeId:null}),Lu(this,"mirror",void 0),Lu(this,"mutationCb",void 0),Lu(this,"resetObservers",void 0),Lu(this,"frozen",!1),Lu(this,"locked",!1),Lu(this,"rafIdTimestamp",null),Lu(this,"rafIdFlush",null),Lu(this,"refCount",0),Lu(this,"torndown",!1),Lu(this,"resetFrameDedup",null),Lu(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});const{sampling:t="all",win:i,blockClass:s,blockSelector:n,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(i,s,n,o),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,s,n,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,s,n){var r=this;if(!("OffscreenCanvas"in t))return;const o="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,a=Wh(t,i,s,!0),l=new Map;let c;try{c=new Vh}catch(e){return}let u=!1;c.onerror=()=>{var e;u=!0,cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=e=>{const{id:t}=e.data;if(l.set(t,!1),!("base64"in e.data))return;const{base64:i,type:s,displayWidth:n,displayHeight:r}=e.data;this.mutationCb({id:t,type:Uc["2D"],commands:[{property:"clearRect",args:[0,0,n,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:s}]},0,0,n,r]}],displayWidth:n,displayHeight:r})};const d=1e3/e;let h,p=0;const _=e=>{var a;u||(p&&d>e-p||(p=e,(()=>{const e=[],n=t=>{try{t.querySelectorAll("canvas").forEach(t=>{jd(t,i,s,!0)||e.push(t)}),t.querySelectorAll("*").forEach(e=>{e.shadowRoot&&n(e.shadowRoot)})}catch(e){}};return n(t.document),e})().forEach((a=rt(function*(e){const t=r.mirror.getId(e);if(!l.get(t)&&0!==e.width&&0!==e.height){l.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var i,s;const n=e.getContext(e.__context);if(null==n||null===(i=n.isContextLost)||void 0===i?void 0:i.call(n))return void l.set(t,!1);!1===(null==n||null===(s=n.getContextAttributes())||void 0===s?void 0:s.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,a=e.clientHeight||e.height,u=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),h=function(e,t,i,s,n,r){if(!e||"function"!=typeof e.regionsFn)return;let o;try{o=e.regionsFn(t)}catch(e){return Mh}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Ph))return Mh;const a=i/n,l=s/r;return o.filter(e=>e.width>0&&e.height>0).map(e=>{const t=Math.floor(e.x*a),i=Math.floor(e.y*l);return{x:t,y:i,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-i}})}(n.canvasMasking,e,u,d,r,a);if("skip-frame"===h)return void l.set(t,!1);const p=yield createImageBitmap(e,1>o?{resizeWidth:u,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:u,resizeHeight:d});c.postMessage({id:t,bitmap:p,width:u,height:d,displayWidth:r,displayHeight:a,dataURLOptions:n.dataURLOptions,maskRegions:h},[p])}catch(e){l.set(t,!1)}}}),function(e){return a.apply(this,arguments)}))),h=requestAnimationFrame(_))};h=requestAnimationFrame(_),this.resetObservers=()=>{var e;a(),cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=Wh(e,t,i,!1),r=function(e,t,i,s,n){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=nu(t.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return jd(this.canvas,i,s,!0)||setTimeout(()=>{const i=Nh(o,t,this,n);e(this.canvas,{type:Uc["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(n){const o=Bd(t.CanvasRenderingContext2D.prototype,a,{set(t){jd(this.canvas,i,s,!0)||e(this.canvas,{type:Uc["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s),o=function(e,t,i,s,n){const r=[];return void 0!==t.WebGLRenderingContext&&r.push(...zh(t.WebGLRenderingContext.prototype,Uc.WebGL,e,i,s,t,n)),void 0!==t.WebGL2RenderingContext&&r.push(...zh(t.WebGL2RenderingContext.prototype,Uc.WebGL2,e,i,s,t,n)),()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s);this.resetObservers=()=>{n(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===t)return;const s=i.map(e=>mn(e,Bc)),{type:n}=i[0];this.mutationCb({id:t,type:n,commands:s}),this.pendingCanvasMutations.delete(e)}},Jh=class{constructor(e){var t;Lu(this,"trackedLinkElements",new WeakSet),Lu(this,"pendingDeferredSheets",new Set),Lu(this,"mutationCb",void 0),Lu(this,"adoptedStyleSheetCb",void 0),Lu(this,"maskAllElementAttributes",void 0),Lu(this,"maskAttributeFn",void 0),Lu(this,"styleMirror",new Xd),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(-1===t||!e.isConnected)return null;let i=null,s=null;try{s=e.sheet,s&&(i=Gu(s))}catch(e){}if(!i||!s)return Pu(),null;const n=i;let r=!1;const o={sheet:s,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=ou(),c=cu();let u=!0;try{if(r)return a=!0,Pu(),!0;if(!n.advance(i))return u=!1,!1;a=!0;const o=n.text();if(!e.isConnected)return!0;let l=null;try{l=e.sheet}catch(e){}return l!==s?(Pu(),!0):o?(this.emitCssTextMutation(e,t,o),!0):(Pu(),!0)}finally{u&&this.pendingDeferredSheets.delete(o),uu(d=ou()-l,null!=(h=c)?h:au)||(Su.totalMs+=d,d>Su.slowestSliceMs&&(Su.slowestSliceMs=d))}var d,h},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(const t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var i;null===(i=this.beginDeferredLinkInlining(e,t))||void 0===i||i.advance(1/0)}emitCssTextMutation(e,t,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:Xu({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const i={id:t,styleIds:[]},s=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{const i=this.styleMirror.add(t);e=i;const n=ou();try{Iu(()=>{try{const e=t.rules||t.cssRules;e&&xu(e)}catch(e){}s.push({styleId:i,rules:Array.from(t.rules||CSSRule,(e,i)=>({rule:Hu(e,t.href),index:i}))})})}finally{Eu(ou()-n)}}i.styleIds.push(e)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Cd.forEach(e=>e.abort()),Cd.clear()}trackStylesheetInLinkElement(e){}},Xh=class{constructor(){Lu(this,"nodeMap",new WeakMap),Lu(this,"active",!1)}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Yh=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var ep;const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null===(ep=e.contentWindow)||void 0===ep?void 0:ep.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var tp=new Qu,ip=new Set([Hc.Mutation,Hc.MediaInteraction,Hc.StyleSheetRule,Hc.CanvasMutation,Hc.Font,Hc.Log,Hc.StyleDeclaration,Hc.AdoptedStyleSheet]);function sp(e){const t=window;if("function"==typeof t.requestIdleCallback){const i=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,i)}}}const i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function np(e={}){let t;const{emit:i,checkoutEveryNms:s,checkoutEveryNth:n,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,inlineStylesheetBudgetRules:h,maskAllInputs:p,maskInputOptions:_,slimDOMOptions:g,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m=!1,maskAttributeFn:y,hooks:b,packFn:S,sampling:w={},dataURLOptions:k={},canvasResolutionScale:C,canvasMasking:x,mousemoveWait:I,recordDOM:E=!0,recordCanvas:T=!1,recordCrossOriginIframes:M=!1,recordAfter:P=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:F=!1,collectFonts:R=!1,inlineImages:L=!1,plugins:A,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:D=new Set([]),attributeFilter:N,errorHandler:B}=e;ch(B);const q=ct({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},k),H=!M||window.parent===window;let W=!1;if(!H)try{window.parent.document&&(W=!1)}catch(e){W=!0}if(H&&!i)throw new Error("emit function is required");if(!H&&!W)return()=>{};void 0!==I&&void 0===w.mousemove&&(w.mousemove=I),tp.reset();const z=!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==_?_:{password:!0},U=Pd(void 0!==g&&g);let j;!function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Q,K;const Z=e=>{for(const t of A||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!W&&(e=S(e)),e};Gh=(e,t)=>{var r;const o=e;if(o.timestamp=qd(),!(null===(r=hh[0])||void 0===r?void 0:r.isFrozen())||o.type===qc.FullSnapshot||o.type===qc.IncrementalSnapshot&&ip.has(o.data.source)||hh.forEach(e=>e.unfreeze()),H)null==i||i(Z(o),t);else if(W){const e={type:"rrweb",event:Z(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(e,"*")}if(o.type===qc.FullSnapshot)j=o,V=0;else if(o.type===qc.IncrementalSnapshot){if(o.data.source===Hc.Mutation&&o.data.isAttachIframe)return;V++,(n&&V>=n||s&&o.timestamp-j.timestamp>s)&&Qh(!0)}};const J=e=>{if(e.removes&&e.removes.length>0){const t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,i=new Set;if(e.adds.length>0)for(const t of e.adds){const e=tp.getNode(t.node.id);e&&"IFRAME"===e.nodeName&&i.add(e)}e.removes.forEach(({id:e})=>{if(t&&t.has(e))return;const s=te.getIframeElementById(e);s&&i.has(s)?te.forgetIframeId(e):(null==Q||Q(e),te.removeIframeById(e))}),null==K||K(),te.cleanupDetachedIframes()}Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Mutation},e)})},X=e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Scroll},e)}),Y=e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.CanvasMutation},e)}),ee=new Jh({mutationCb:J,adoptedStyleSheetCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.AdoptedStyleSheet},e)}),maskAllElementAttributes:m,maskAttributeFn:y}),te=new Eh({mirror:tp,mutationCb:J,stylesheetManager:ee,recordCrossOriginIframes:M,wrappedEmit:Gh});for(const e of A||[])e.getMirror&&e.getMirror({nodeMirror:tp,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const ie=new Xh,se=null==x?void 0:x.configured;Kh=new Zh({recordCanvas:T,mutationCb:Y,win:window,blockClass:r,blockSelector:o,mirror:tp,sampling:w.canvas,dataURLOptions:q,resolutionScale:C,canvasMasking:x});const ne=new Th({mutationCb:J,scrollCb:X,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:z,dataURLOptions:q,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,recordCanvas:T,canvasMaskingConfigured:se,inlineImages:L,sampling:w,slimDOMOptions:U,iframeManager:te,stylesheetManager:ee,canvasManager:Kh,keepIframeSrcFn:O,processedNodeManager:ie,attributeFilter:N},mirror:tp});Qh=(e=!1)=>{if(E){wu(h);try{Gh({type:qc.Meta,data:{href:window.location.href,width:zd(),height:Wd()}},e),null==t||t.cancel(),t=void 0,ee.reset(),ne.init(),hh.forEach(e=>e.lock());let i=null,s=[];try{i=function(e,t){const{mirror:i=new Qu,blockClass:s="rr-block",blockSelector:n=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,canvasMaskingConfigured:u,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_=!1,maskAttributeFn:g,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x=()=>!1,maxDepth:I,inlineStylesheetBudgetRules:E}=t||{},T=!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,M=Pd(f);wu(E);try{return Md(e,{doc:e,mirror:i,blockClass:s,blockSelector:n,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:T,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_,maskAttributeFn:g,slimDOMOptions:M,dataURLOptions:v,inlineImages:l,recordCanvas:c,canvasMaskingConfigured:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:x,newlyAddedElement:!1,maxDepth:I})}finally{ku()}}(document,{mirror:tp,blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:z,inlineStylesheetBudgetRules:h,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,slimDOM:U,dataURLOptions:q,recordCanvas:T,canvasMaskingConfigured:se,inlineImages:L,onSerialize(e){Kd(e,tp)&&te.addIframe(e),Zd(e,tp)&&ee.trackLinkElement(e),Jd(e)&&ne.addShadowRoot(ru.shadowRoot(e),document)},onIframeLoad(e,t){te.attachIframe(e,t),ne.observeAttachShadow(e)},onIframeListenerRegistered(e,t){te.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){ee.attachLinkElement(e,t)},keepIframeSrcFn:O})}finally{s=Mu()}if(!i)return console.warn("Failed to snapshot the document");if(Gh({type:qc.FullSnapshot,data:{node:i,initialOffset:Hd(window)}},e),hh.forEach(e=>e.unlock()),Kh.onFullSnapshot(),s.length){const e=function(e,t,i){let s=!1,n=null,r=0,o=null;const a=()=>null!==o||e.length>r,l=()=>{const i=e[r];e[r]=null,r+=1,i&&Ad(()=>{o=t.beginDeferredLinkInlining(i,tp.getId(i))})},c=()=>{if(!o)return;const e=o;let t=!0;Ad(()=>{t=e.advance(200)}),t&&(o=null)},u=()=>{o||l(),c()},d=e=>{if(n=null,s)return;let t=0;do{try{u()}catch(e){null==o||o.discard(),o=null,Fu(1)}t+=1}while(!s&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));s||(a()?n=sp(d):i())};return n=sp(d),{cancel(){s=!0,null==o||o.discard(),o=null,null==n||n.cancel(),n=null},flush(){if(s)return;s=!0,null==n||n.cancel(),n=null;let t=0,u=0;for(;a()&&50>t;){o||l();const e=o;if(e)if(Math.floor(e.remainingRules()/200)+1>50-t)e.discard(),o=null,u+=1;else{try{c()}catch(e){null==o||o.discard(),o=null,u+=1}t+=1}}if(a()||u>0){let t=u+(null!==o?1:0);for(let i=r;e.length>i;i++)null!==e[i]&&(t+=1);Fu(t),null==o||o.discard(),o=null}i()}}}(s,ee,()=>{t===e&&(t=void 0)});t=e}M&&te.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,tp.getId(document))}finally{ku()}}};try{const e=[];e.push(Rd("pagehide",()=>{try{null==t||t.flush()}catch(e){}t=void 0},window));for(const t of["visibilitychange","freeze","resume"])e.push(Rd(t,lu,document));Q=t=>{const i=G.get(t);i&&(i.forEach(t=>{Ad(t);const i=e.indexOf(t);-1!==i&&e.splice(i,1)}),G.delete(t))},K=()=>{for(const[e]of G){const t=tp.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==Q||Q(e)}catch(t){null==Q||Q(e)}else null==Q||Q(e)}};const i=e=>{var t;return dh(kh)({mutationCb:J,mousemoveCb:(e,t)=>Gh({type:qc.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.MouseInteraction},e)}),scrollCb:X,viewportResizeCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.ViewportResize},e)}),inputCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Input},e)}),mediaInteractionCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.MediaInteraction},e)}),styleSheetRuleCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.StyleSheetRule},e)}),styleDeclarationCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.StyleDeclaration},e)}),canvasMutationCb:Y,fontCb:e=>Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Font},e)}),selectionCb(e){Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.Selection},e)})},customElementCb(e){Gh({type:qc.IncrementalSnapshot,data:ct({source:Hc.CustomElement},e)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:u,maskInputOptions:z,inlineStylesheet:d,sampling:w,recordDOM:E,recordCanvas:T,canvasMaskingConfigured:se,inlineImages:L,userTriggeredOnInput:F,collectFonts:R,doc:e,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m,maskAttributeFn:y,keepIframeSrcFn:O,blockSelector:o,slimDOMOptions:U,dataURLOptions:q,mirror:tp,iframeManager:te,stylesheetManager:ee,shadowDomManager:ne,processedNodeManager:ie,canvasManager:Kh,ignoreCSSAttributes:D,attributeFilter:N,plugins:(null==A||null===(t=A.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({name:e.name,observer:e.observer,options:e.options,callback:t=>Gh({type:qc.Plugin,data:{plugin:e.name,payload:t}})})))||[]},b)};te.addLoadListener(t=>{try{const s=tp.getId(t),n=i(t.contentDocument);if("function"==typeof n&&(e.push(n),-1!==s)){let e=G.get(s);e||(e=new Set,G.set(s,e)),e.add(n)}}catch(e){console.warn(e)}}),te.addPageHideListener(e=>{const t=tp.getId(e);null==Q||Q(t),fh(e)});let s=-1;const n=e=>Gh({type:qc.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),h=()=>{var e,t,i,r;const o=document,a=null!==(e=null!==(t=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==t?t:o.msFullscreenElement)&&void 0!==e?e:null,l=a?tp.getId(a):-1;l!==s&&(-1!==s&&n({id:s,enter:!1}),s=l,-1!==l&&n({id:l,enter:!0}))},p=()=>{Qh();const t=i(document);"function"==typeof t&&e.push(t),e.push(Rd("fullscreenchange",h)),e.push(Rd("webkitfullscreenchange",h)),e.push(Rd("mozfullscreenchange",h)),e.push(Rd("MSFullscreenChange",h)),Yh=!0};return["interactive","complete"].includes(document.readyState)?p():(e.push(Rd("DOMContentLoaded",()=>{Gh({type:qc.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&p()})),e.push(Rd("load",()=>{Gh({type:qc.Load,data:{}}),"load"===P&&p()},window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Od(e),ie.destroy(),te.removeLoadListener(),te.destroy(),G.clear(),ne.reset(),tp.reset(),Yh=!1,uh()}}catch(e){console.warn(e)}}np.addCustomEvent=(e,t)=>{if(!Yh)throw new Error("please add custom event after start recording");Gh({type:qc.Custom,data:{tag:e,payload:t}})},np.freezePage=()=>{hh.forEach(e=>e.freeze())},np.takeFullSnapshot=e=>{if(!Yh)throw new Error("please take full snapshot after start recording");Qh(e)},np.mirror=tp,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var rp=Object.create(null);function op(e){return op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},op(e)}function ap(e,t,i){return(t=function(e){var t=function(e){if("object"!=op(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=op(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==op(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}rp.Node=Object.create(null),rp.ShadowRoot=Object.create(null),rp.MutationObserver=Object.create(null),rp.Element=Object.create(null);var lp=class{constructor(e){ap(this,"fileName",void 0),ap(this,"functionName",void 0),ap(this,"lineNumber",void 0),ap(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},cp=/(^|@)\S+:\d+/,up=/^\s*at .*(\S+:\d+|\(native\))/m,dp=/^(eval@)?(\[native code])?$/,hp={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(up)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(up)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=i?t.replace(i[0],""):t;const s=t.split(/\s+/).slice(1),n=this.extractLocation(i?i[1]:s.pop());return new lp({functionName:s.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0],lineNumber:n[1],columnNumber:n[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(dp)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new lp({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(t),s=i&&i[1]?i[1]:void 0,n=this.extractLocation(e.replace(t,""));return new lp({functionName:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),s=[];for(let e=2,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new lp({fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera10(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),s=[];for(let e=0,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new lp({functionName:n[3]||void 0,fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(cp)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),i=this.extractLocation(t.pop());return new lp({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function pp(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();const s=e.parentElement,n=[];if(s.children&&s.children.length>0)for(let e=0;s.children.length>e;e++){const t=s.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===i&&n.push(t)}n.length>1&&(i+=`:eq(${n.indexOf(e)})`),t=i+(t?">"+t:""),e=s}return t}function _p(e){return Array.isArray(e)}function gp(e){return"object"==typeof e&&null!==e&&!_p(e)}function fp(e,t){if(0===t)return!0;const i=Object.keys(e);for(const s of i)if(gp(e[s])&&fp(e[s],t-1))return!0;return!1}function vp(e,t){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);const s=[],n=[];return JSON.stringify(e,function(e,t){if(s.length>0){const i=s.indexOf(this);~i?s.splice(i+1):s.push(this),~i?n.splice(i,1/0,e):n.push(e),~s.indexOf(t)&&(t=s[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(t)).join(".")+"]")}else s.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(gp(r=t)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||gp(r)&&fp(r,i.depthOfLimit))return function(e){let t=e.toString();return i.stringLengthLimit&&t.length>i.stringLengthLimit&&(t=`${t.slice(0,i.stringLengthLimit)}...`),t}(t);var r;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const i in t){const s=t[i];e[i]=_p(s)?pp(s.length?s[0]:null):s}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var mp={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function yp(e,t,i){const s=i?Object.assign({},mp,i):mp,n=s.logger;if(!n)return()=>{};let r;r="string"==typeof n?t[n]:n;let o=0,a=!1,l=!0;const c=[];if(s.level.includes("error")){const i=t=>{const i=t.message;e({level:"error",trace:hp.parse(t.error).map(e=>e.toString()),payload:[vp(i,s.stringifyOptions)]})};t.addEventListener("error",i),c.push(()=>{t.removeEventListener("error",i)});const n=t=>{let i,n;t.reason instanceof Error?(i=t.reason,n=[vp(`Uncaught (in promise) ${i.name}: ${i.message}`,s.stringifyOptions)]):(i=new Error,n=[vp("Uncaught (in promise)",s.stringifyOptions),vp(t.reason,s.stringifyOptions)]),e({level:"error",trace:hp.parse(i).map(e=>e.toString()),payload:n})};t.addEventListener("unhandledrejection",n),c.push(()=>{t.removeEventListener("unhandledrejection",n)})}for(const e of s.level)c.push(u(r,e));return()=>{l=!1,c.forEach(e=>e())};function u(t,i){return t[i]?function(n,r){try{if(!(r in n))return()=>{};const c=n[r],u={next:c},d=(n=>(...r)=>{if(n.apply(t,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const t=hp.parse(new Error).map(e=>e.toString()).splice(1),n=("assert"===i?r.slice(1):r).map(e=>vp(e,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:i,trace:t,payload:n}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[vp("The number of log records reached the threshold.")]})}catch(e){n.apply(t,["rrweb logger error:",e,...r])}finally{a=!1}}})(function(...e){return u.next.apply(this,e)});return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:c},__rrweb_layer__:{enumerable:!1,value:u}})),n[r]=d,()=>{if(n[r]===d)return void(n[r]=u.next);const e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let t=n[r],i=e(t);for(;i;){if(i.next===d)return void(i.next=u.next);t=i.next,i=e(t)}}}catch(e){return()=>{}}}(t,i):()=>{}}}var bp=e=>({name:"rrweb/console@1",observer:yp,options:e});const Sp=()=>{},wp=e=>{var t;if(Ct(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function kp(e,t,i){try{if(!(t in e))return Sp;const s={next:e[t]},n=i(function(...e){return s.next.apply(this,e)});return Ct(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let i=e[t],r=wp(i);for(;r;){if(r.next===n)return void(r.next=s.next);i=r.next,r=wp(i)}}}catch(e){return Sp}}function Cp(e,t){var i;const s=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),n={hostname:s,isHostDenied:!1};if(!(null===(i=t.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==s?void 0:s.trim().length))return n;for(const e of t.payloadHostDenyList)if(s.endsWith(e))return{hostname:s,isHostDenied:!0};return n}const xp=Gn("[Recorder]"),Ip=e=>"navigation"===e.entryType,Ep=e=>"resource"===e.entryType;function Tp(e,t){return!!t&&(At(t)||t[e])}function Mp(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}const Pp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Fp({type:e,recordBody:t,headers:i,url:s}){function n(e){const t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),s=t&&i[t];return e.some(e=>null==s?void 0:s.toLowerCase().includes(e))}if(!t)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Mp(t)&&e(t.url)}catch(e){return!1}}(s))return!1;if(n(Pp))return!1;if(At(t))return!0;if(kt(t))return n(t);const r=t[e];return At(r)?r:n(r)}function Rp(e,t,i,s,n){return Lp.apply(this,arguments)}function Lp(){return Lp=rt(function*(e,t,i,s,n,r=0){if(r>10)return xp.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null;const o=function(e,t){for(let i=e.length-1;i>=0;i-=1)if(t(e[i]))return e[i]}(e.performance.getEntriesByName(i),e=>Ep(e)&&e.initiatorType===t&&(Et(s)||e.startTime>=s)&&(Et(n)||n>=e.startTime));return o||(yield new Promise(e=>setTimeout(e,50*r)),Rp(e,t,i,s,n,r+1))}),Lp.apply(this,arguments)}function Ap({body:e,options:t,url:i}){if(Ft(e))return null;const{hostname:s,isHostDenied:n}=Cp(i,t);if(n)return s+" is in deny list";if(Tt(e))return e;if((e=>"u">typeof Document&&e instanceof Document)(e))return e.textContent;if(Ot(e))return lr(e);if(xt(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}const Op=e=>!Pt(e)&&("navigation"===e.entryType||"resource"===e.entryType);function $p({entry:e,method:t,status:i,networkRequest:s,isInitial:n,start:r,end:o,url:a,initiatorType:l}){r=e?e.startTime:r,o=e?e.responseEnd:o;const c=Math.floor(Date.now()-performance.now()),u=Math.floor(c+(r||0)),d=[ct(ct({},e?e.toJSON():{name:a}),{},{startTime:Et(r)?void 0:Math.round(r),endTime:Et(o)?void 0:Math.round(o),timeOrigin:c,timestamp:u,method:t,initiatorType:l||(e?e.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:n})];if(Op(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:u,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const Dp=["video/","audio/"];function Np(e){return xt(e)&&Ct(e.getReader)&&Ct(e.tee)}const Bp="[SessionReplay] Timeout while trying to read body",qp="[SessionReplay] Failed to read body";function Hp(e){return`${qp}: ${e}`}function Wp(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function zp(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{const i=setTimeout(()=>t(Bp),500);try{e.clone().text().then(e=>t(e),e=>t(Hp(e))).finally(()=>clearTimeout(i))}catch(e){clearTimeout(i),t(qp)}})}(e);const i=so(t);return function(e,t){try{var i,s;const n=null===(i=e.headers)||void 0===i||null===(s=i.get)||void 0===s?void 0:s.call(i,"content-length");if(!n)return!1;const r=parseInt(n,10);return Number.isFinite(r)&&r>t}catch(e){return!1}}(e,i)?Promise.resolve(Wp(i)):function(e,t){return new Promise(i=>{let s,n=!1;function r(){try{null==s||s.cancel().catch(()=>{})}catch(e){}}function o(e){n||(n=!0,clearTimeout(a),r(),i(e))}const a=setTimeout(()=>o(Bp),500);let l;try{l=e.clone()}catch(e){return void o(qp)}const c=l.body;if(!Np(c)||"undefined"==typeof TextDecoder){try{l.text().then(e=>o(e),e=>o(Hp(e)))}catch(e){o(qp)}return}try{s=c.getReader()}catch(e){return void o(qp)}const u=[];let d=0;!function e(){s.read().then(({done:i,value:s})=>{if(n)r();else if(i)o((new TextDecoder).decode(function(e,t){const i=new Uint8Array(t);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i}(u,d)));else{if(s){if(d+s.byteLength>t)return void o(Wp(t));d+=s.byteLength,u.push(s)}e()}},e=>o(Hp(e)))}()})}(e,i)}function Up(){return Up=rt(function*({r:e,options:t,url:i}){const{hostname:s,isHostDenied:n}=Cp(i,t);return n?Promise.resolve(s+" is in deny list"):zp(e,t)}),Up.apply(this,arguments)}function jp(){return jp=rt(function*({r:e,options:t,url:i}){const s=function({r:e,options:t,url:i}){var s;if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const n=null===(s=e.headers.get("Content-Type"))||void 0===s?void 0:s.toLowerCase(),r=Dp.some(e=>null==n?void 0:n.startsWith(e));if(n&&r)return`Content-Type ${n} is not supported`;const{hostname:o,isHostDenied:a}=Cp(i,t);return a?o+" is in deny list":null}({r:e,options:t,url:i});return Pt(s)?zp(e,t):Promise.resolve(s)}),jp.apply(this,arguments)}let Vp=null;function Gp(e,t,i){if(!("performance"in t))return()=>{};if(Vp)return xp.warn("Network observer already initialised, doing nothing"),()=>{};const s=i?Object.assign({},no,i):no;let n=!0;const r=t=>{if(!n)return;const i=[];let r=!1;t.requests.forEach(e=>{const t="serverTiming"===e.entryType;if(t&&r)return;const n=s.maskRequestFn(e);t||(r=!n||(e=>!!e&&po.has(e))(n)),n&&i.push(n)}),i.length>0&&e(ct(ct({},t),{},{requests:i}))},o=function(e,t,i){i.recordInitialRequests&&e({requests:t.performance.getEntries().filter(e=>Ip(e)||Ep(e)&&i.initiatorTypes.includes(e.initiatorType)).flatMap(e=>$p({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const s=new t.PerformanceObserver(t=>{e({requests:t.getEntries().filter(e=>Ip(e)||Ep(e)&&i.initiatorTypes.includes(e.initiatorType)&&(e=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>$p({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),n=PerformanceObserver.supportedEntryTypes.filter(e=>i.performanceEntryTypeToObserve.includes(e));return s.observe({entryTypes:n}),()=>{s.disconnect()}}(r,t,s);let a=()=>{},l=()=>{};return(s.recordHeaders||s.recordBody)&&(a=function(e,t,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const s=Tp("request",i.recordHeaders),n=Tp("response",i.recordHeaders),r=kp(t.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,c,u){const d=this;try{const r=new Request(a),l={};let c,u;const h={},p=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(h[e]=t,p(e,t)),s&&(l.requestHeaders=h);const _=d.send.bind(d);d.send=e=>(Fp({type:"request",headers:h,url:a,recordBody:i.recordBody})&&(l.requestBody=Ap({body:e,options:i,url:a})),c=t.performance.now(),_(e));const g=()=>{d.removeEventListener("readystatechange",f),d.removeEventListener("error",g),d.removeEventListener("abort",g),d.removeEventListener("timeout",g)},f=()=>{if(d.readyState!==d.DONE)return;g(),u=t.performance.now();const s={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),n=t.join(": ");i&&(s[i]=n)}),n&&(l.responseHeaders=s),Fp({type:"response",headers:s,url:a,recordBody:i.recordBody})&&(l.responseBody=Ap({body:d.response,options:i,url:a})),Rp(t,"xmlhttprequest",r.url,c,u).then(t=>{e({requests:$p({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:l,start:c,end:u,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};d.addEventListener("readystatechange",f),d.addEventListener("error",g),d.addEventListener("abort",g),d.addEventListener("timeout",g)}catch(e){xp.error("Failed to instrument XHR for network capture",e)}r.call(d,o,a.toString(),l,c,u)});return()=>{r()}}(r,t,s),l=function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const s=Tp("request",i.recordHeaders),n=Tp("response",i.recordHeaders),r=kp(t,"fetch",r=>function(){var o=rt(function*(o,a){let l,c;try{l=new Request(o,a)}catch(e){return xp.error("Failed to instrument fetch for network capture",e),r(o,a)}const u={};let d,h;try{try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),s&&(u.requestHeaders=e),!Np(null==a?void 0:a.body)&&Fp({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(u.requestBody=yield function(e){return Up.apply(this,arguments)}({r:l,options:i,url:o}))}catch(e){xp.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),c=Mp(o)?yield r(l):yield r(o,a),h=t.performance.now();try{const e={};c.headers.forEach((t,i)=>{e[i]=t}),n&&(u.responseHeaders=e),Fp({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield function(e){return jp.apply(this,arguments)}({r:c,options:i,url:o}))}catch(e){xp.error("Failed to record fetch response for network capture",e)}return c}finally{Rp(t,"fetch",l.url,d,h).then(t=>{e({requests:$p({entry:t,method:l.method,status:null==c?void 0:c.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{r()}}(r,t,s)),Vp=()=>{n=!1,o(),a(),l(),Vp=null},Vp}const Qp=e=>({name:"rrweb/network@1",observer:Gp,options:e});var Kp,Zp,Jp,Xp,Yp,e_,t_,i_,s_,n_,r_,o_,a_,l_,c_;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:bp,getRecordNetworkPlugin:Qp},h.__PosthogExtensions__.rrweb={record:np,version:"v2",wasMaxDepthReached:()=>Td,resetMaxDepthState(){Td=!1,Ed=!1},getLastSnapshotCost:()=>gu,getMutationCost:()=>ct({},bu),getObserverInitFailures:()=>wh.size?Array.from(wh):void 0,resetSnapshotCostState(){du=0,hu=0,pu=0,au=0,_u={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},gu=null,fu=null,vu=[],mu=0,yu=0,bu={slowestBatchMs:0},Su={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:np,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:bp},h.getRecordNetworkPlugin=Qp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new Nc(e,t);var u_,d_,h_,p_,__={},g_=[],f_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v_=Array.isArray;function m_(e,t){for(var i in t)e[i]=t[i];return e}function y_(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function b_(e,t,i){var s,n,r,o={};for(r in t)"key"==r?s=t[r]:"ref"==r?n=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?Kp.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return S_(e,o,s,n,null)}function S_(e,t,i,s,n){var r={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++Jp:n,__i:-1,__u:0};return null==n&&null!=Zp.vnode&&Zp.vnode(r),r}function w_(e){return e.children}function k_(e,t){this.props=e,this.context=t}function C_(e,t){if(null==t)return e.__?C_(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?C_(e):null}function x_(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,s=[],n=[],r=m_({},t);r.__v=t.__v+1,Zp.vnode&&Zp.vnode(r),O_(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,s,null==i?C_(t):i,!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,D_(s,r,n),t.__e=t.__=null,r.__e!=i&&I_(r)}}function I_(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),I_(e)}function E_(e){(!e.__d&&(e.__d=!0)&&Xp.push(e)&&!T_.__r++||Yp!=Zp.debounceRendering)&&((Yp=Zp.debounceRendering)||e_)(T_)}function T_(){try{for(var e,t=1;Xp.length;)Xp.length>t&&Xp.sort(t_),e=Xp.shift(),t=Xp.length,x_(e)}finally{Xp.length=T_.__r=0}}function M_(e,t,i,s,n,r,o,a,l,c,u){var d,h,p,_,g,f,v,m=s&&s.__k||g_,y=t.length;for(l=function(e,t,i,s,n){var r,o,a,l,c,u=i.length,d=u,h=0;for(e.__k=new Array(n),r=0;n>r;r++)null!=(o=t[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[r]=S_(null,o,null,null,null):v_(o)?o=e.__k[r]=S_(w_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[r]=S_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[r]=o,l=r+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(c=o.__i=F_(o,i,l,d))&&(d--,(a=i[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(n>u?h--:u>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):e.__k[r]=null;if(d)for(r=0;u>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==s&&(s=C_(a)),q_(a,a));return s}(i,t,m,l,y),d=0;y>d;d++)null!=(p=i.__k[d])&&(h=-1!=p.__i&&m[p.__i]||__,p.__i=d,f=O_(e,p,h,n,r,o,a,l,c,u),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&B_(h.ref,null,p),u.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(v=!!(4&p.__u))||h.__k===p.__k?(l=P_(p,l,e,v),v&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==f?l=f:_&&(l=_.nextSibling),p.__u&=-7);return i.__e=g,l}function P_(e,t,i,s){var n,r;if("function"==typeof e.type){for(n=e.__k,r=0;n&&n.length>r;r++)n[r]&&(n[r].__=e,t=P_(n[r],t,i,s));return t}e.__e!=t&&(s&&(t&&e.type&&!t.parentNode&&(t=C_(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function F_(e,t,i,s){var n,r,o,a=e.key,l=e.type,c=t[i],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return i;if(s>(u?1:0))for(n=i-1,r=i+1;n>=0||t.length>r;)if(null!=(c=t[o=0>n?r++:n--])&&!(2&c.__u)&&a==c.key&&l==c.type)return o;return-1}function R_(e,t,i){"-"==t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||f_.test(t)?i:i+"px"}function L_(e,t,i,s,n){var r,o;e:if("style"==t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||R_(e.style,t,"");if(i)for(t in i)s&&i[t]==s[t]||R_(e.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(r_,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=i,i?s?i[n_]=s[n_]:(i[n_]=o_,e.addEventListener(t,r?l_:a_,r)):e.removeEventListener(t,r?l_:a_,r);else{if("http://www.w3.org/2000/svg"==n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==i?"":i))}}function A_(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[s_])t[s_]=o_++;else if(i[n_]>t[s_])return;return i(Zp.event?Zp.event(t):t)}}}function O_(e,t,i,s,n,r,o,a,l,c){var u,d,h,p,_,g,f,v,m,y,$,b,S,w,k,C,x=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=Zp.__b)&&u(t);e:if("function"==typeof x){d=o.length;try{if(m=t.props,y=x.prototype&&x.prototype.render,$=(u=x.contextType)&&s[u.__c],b=u?$?$.props.value:u.__:s,i.__c?v=(h=t.__c=i.__c).__=h.__E:(y?t.__c=h=new x(m,b):(t.__c=h=new k_(m,b),h.constructor=x,h.render=H_),$&&$.sub(h),h.state||(h.state={}),h.__n=s,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=x.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=m_({},h.__s)),m_(h.__s,x.getDerivedStateFromProps(m,h.__s))),_=h.props,g=h.state,h.__v=t,p)y&&null==x.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==x.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==i.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=i.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(e){e&&(e.__=t)}),g_.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(_,g,f)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=Zp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),g_.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(s=m_(m_({},s),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(f=h.getSnapshotBeforeUpdate(_,g)),k=null!=u&&u.type===w_&&null==u.key?N_(u.props.children):u,a=M_(e,v_(k)?k:[k],t,i,s,n,r,o,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),t.__e=a}else{if(null!=r)for(C=r.length;C--;)y_(r[C]);$_(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),e.then||$_(t);Zp.__e(e,t,i)}}else null==r&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=function(e,t,i,s,n,r,o,a,l){var c,u,d,h,p,_,g,f=i.props||__,v=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;r.length>c;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null==m)return document.createTextNode(v);e=document.createElementNS(n,m,v.is&&v),a&&(Zp.__m&&Zp.__m(t,r),a=!1),r=null}if(null==m)f===v||a&&e.data==v||(e.data=v);else{if(r="textarea"==m&&null!=v.defaultValue?null:r&&Kp.call(e.childNodes),!a&&null!=r)for(f={},c=0;e.attributes.length>c;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"dangerouslySetInnerHTML"==c?d=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||L_(e,c,null,p,n);for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?_=p:"checked"==c?g=p:a&&"function"!=typeof p||f[c]===p||L_(e,c,p,f[c],n);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),M_("template"==t.type?e.content:e,v_(h)?h:[h],t,i,s,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,r,o,r?r[0]:i.__k&&C_(i,0),a,l),null!=r)for(c=r.length;c--;)y_(r[c]);a&&"textarea"!=m||(c="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==m&&!_||"option"==m&&_!=f[c])&&L_(e,c,_,f[c],n),c="checked",null!=g&&g!=e[c]&&L_(e,c,g,f[c],n))}return e}(i.__e,t,i,s,n,r,o,l,c);return(u=Zp.diffed)&&u(t),128&t.__u?void 0:a}function $_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some($_))}function D_(e,t,i){for(var s=0;i.length>s;s++)B_(i[s],i[++s],i[++s]);Zp.__c&&Zp.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Zp.__e(e,t.__v)}})}function N_(e){return"object"!=typeof e||null==e||e.__b>0?e:v_(e)?e.map(N_):void 0!==e.constructor?null:m_({},e)}function B_(e,t,i){try{if("function"==typeof e){var s="function"==typeof e.__u;s&&e.__u(),s&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Zp.__e(e,i)}}function q_(e,t,i){var s,n;if(Zp.unmount&&Zp.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||B_(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){Zp.__e(e,t)}s.base=s.__P=s.__n=null}if(s=e.__k)for(n=0;s.length>n;n++)s[n]&&q_(s[n],t,i||"function"!=typeof e.type);i||y_(e.__e),e.__c=e.__=e.__e=void 0}function H_(e,t,i){return this.constructor(e,i)}function W_(e,t,i){var s,n,r,o;t==document&&(t=document.documentElement),Zp.__&&Zp.__(e,t),n=(s="function"==typeof i)?null:i&&i.__k||t.__k,r=[],o=[],O_(t,e=(!s&&i||t).__k=b_(w_,null,[e]),n||__,__,t.namespaceURI,!s&&i?[i]:n?null:t.firstChild?Kp.call(t.childNodes):null,r,!s&&i?i:n?n.__e:t.firstChild,s,o),D_(r,e,o),e.props.children=null}Kp=g_.slice,Zp={__e(e,t,i,s){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,s||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},Jp=0,k_.prototype.setState=function(e,t){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m_({},this.state);"function"==typeof e&&(e=e(m_({},i),this.props)),e&&m_(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),E_(this))},k_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E_(this))},k_.prototype.render=w_,Xp=[],e_="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,t_=function(e,t){return e.__v.__b-t.__v.__b},T_.__r=0,i_=Math.random().toString(8),s_="__d"+i_,n_="__a"+i_,r_=/(PointerCapture)$|Capture$/i,o_=0,a_=A_(!1),l_=A_(!0),c_=0;var z_=0,U_=[],j_=Zp,V_=j_.__b,G_=j_.__r,Q_=j_.diffed,K_=j_.__c,Z_=j_.unmount,J_=j_.__;function X_(e,t){j_.__h&&j_.__h(d_,e,z_||t),z_=0;var i=d_.__H||(d_.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function Y_(e){return z_=1,function(e,t){var i=X_(u_++,2);if(i.t=e,!i.__c&&(i.__=[ug(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],s=i.t(t,e);t!==s&&(i.__N=[s,i.__[1]],i.__c.setState({}))}],i.__c=d_,!d_.__f)){var s=function(e,t,s){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==e;if(i.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),n){var a=n.call(this,e,t,s);return r?a||o:a}return!r||o};d_.__f=!0;var n=d_.shouldComponentUpdate,r=d_.componentWillUpdate;d_.componentWillUpdate=function(e,t,i){if(this.__e){var o=n;n=void 0,s(e,t,i),n=o}r&&r.call(this,e,t,i)},d_.shouldComponentUpdate=s}return i.__N||i.__}(ug,e)}function eg(e,t){var i=X_(u_++,3);!j_.__s&&cg(i.__H,t)&&(i.__=e,i.u=t,d_.__H.__h.push(i))}function tg(e){return z_=5,ig(function(){return{current:e}},[])}function ig(e,t){var i=X_(u_++,7);return cg(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function sg(e){var t=d_.context[e.__c],i=X_(u_++,9);return i.c=e,t?(null==i.__&&(i.__=!0,t.sub(d_)),t.props.value):e.__}function ng(){for(var e;e=U_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ag),t.__h.some(lg),t.__h=[]}catch(i){t.__h=[],j_.__e(i,e.__v)}}}j_.__b=function(e){d_=null,V_&&V_(e)},j_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),J_&&J_(e,t)},j_.__r=function(e){G_&&G_(e),u_=0;var t=(d_=e.__c).__H;t&&(h_===d_?(t.__h=[],d_.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&ng(),u_=0)),h_=d_},j_.diffed=function(e){Q_&&Q_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==U_.push(t)&&p_===j_.requestAnimationFrame||((p_=j_.requestAnimationFrame)||og)(ng)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),h_=d_=null},j_.__c=function(e,t){t.some(function(e){try{e.__h.some(ag),e.__h=e.__h.filter(function(e){return!e.__||lg(e)})}catch(i){t.some(function(e){e.__h&&(e.__h=[])}),t=[],j_.__e(i,e.__v)}}),K_&&K_(e,t)},j_.unmount=function(e){Z_&&Z_(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(e){try{ag(e)}catch(e){t=e}}),i.__H=void 0,t&&j_.__e(t,i.__v))};var rg="function"==typeof requestAnimationFrame;function og(e){var t,i=function(){clearTimeout(s),rg&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(i,35);rg&&(t=requestAnimationFrame(i))}function ag(e){var t=d_,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),d_=t}function lg(e){var t=d_;e.__c=e.__(),d_=t}function cg(e,t){return!e||e.length!==t.length||t.some(function(t,i){return t!==e[i]})}function ug(e,t){return"function"==typeof t?t(e):t}const dg="gzip-js",hg="base64",pg="events",_g="cancelEvents",gg="tab",fg="left",vg="center",mg="right",yg="next_to_trigger",bg="popover",Sg="widget",wg="external_survey",kg="open",Cg="multiple_choice",xg="single_choice",Ig="rating",Eg="end",Tg="always",Mg="survey shown",Pg="survey dismissed",Fg="survey sent",Rg="$survey_id",Lg="$survey_name",Ag="$survey_iteration",Og="$survey_iteration_start_date",$g="$survey_partially_completed",Dg="$survey_submission_id",Ng="$survey_completed",Bg="$survey_last_seen_date",qg="$survey_language",Hg="popover";function Wg(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&Ct(i.then)&&i.then(void 0,()=>{})}}}}const zg=Gn("[Surveys]"),Ug="PostHog is not capturing, so a survey response cannot be recorded";function jg(e){return Ct(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing()}function Vg(e){return!(!e.start_date||e.end_date)}function Gg(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const Qg=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,Kg=e=>Qg("seenSurvey_",e),Zg=e=>{try{const t=Kg(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){zg.error("Failed to persist survey seen state",e)}},Jg=[bg,Sg,"api"],Xg={ignoreConditions:!1,ignoreDelay:!1,displayType:Hg},Yg="logs",ef=Gn("[Stylesheet Loader]"),tf=e,sf=s,nf="#020617",rf={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:mg,widgetType:gg,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:nf,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},of=[vg,fg,mg];function af(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function lf(e=rf.backgroundColor){let t;"#"===e[0]&&(t=af(e)),e.startsWith("rgb")&&(t=e);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=af(i)),!t)return nf;const s=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(s){const e=parseInt(s[1]),t=parseInt(s[2]),i=parseInt(s[3]);return Math.sqrt(e*e*.299+t*t*.587+i*i*.114)>127.5?nf:"white"}return nf}const cf=(e,t,i)=>{const s=Tf(e),n=sf.querySelector(`.${s}`);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};const r=sf.createElement("div");((e,t,i)=>{const s=ct(ct({},rf),i),n=e.style,r=!of.includes(s.position)||t===Sg&&(null==i?void 0:i.widgetType)===gg;n.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?`${e}, ${t}`:`-apple-system, ${t}`}(s.fontFamily)),n.setProperty("--ph-survey-box-padding",s.boxPadding),n.setProperty("--ph-survey-max-width",s.maxWidth),n.setProperty("--ph-survey-z-index",s.zIndex),n.setProperty("--ph-survey-border-color",s.borderColor),r?(n.setProperty("--ph-survey-border-radius",s.borderRadius),n.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(n.setProperty("--ph-survey-border-bottom","none"),n.setProperty("--ph-survey-border-radius",`${s.borderRadius} ${s.borderRadius} 0 0`)),n.setProperty("--ph-survey-background-color",s.backgroundColor),n.setProperty("--ph-survey-box-shadow",s.boxShadow),n.setProperty("--ph-survey-disabled-button-opacity",s.disabledButtonOpacity),n.setProperty("--ph-survey-submit-button-color",s.submitButtonColor),n.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||lf(s.submitButtonColor)),n.setProperty("--ph-survey-rating-bg-color",s.ratingButtonColor),n.setProperty("--ph-survey-rating-active-bg-color",s.ratingButtonActiveColor),n.setProperty("--ph-survey-rating-active-text-color",lf(s.ratingButtonActiveColor)),n.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||lf(s.backgroundColor)),n.setProperty("--ph-survey-text-subtle-color",s.textSubtleColor),n.setProperty("--ph-widget-color",s.widgetColor),n.setProperty("--ph-widget-text-color",lf(s.widgetColor)),n.setProperty("--ph-widget-z-index",s.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||s.inputBackground;o||"white"!==s.backgroundColor||(a="#f8f8f8"),n.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||lf(a);n.setProperty("--ph-survey-input-text-color",l),n.setProperty("--ph-survey-rating-text-color",l),n.setProperty("--ph-survey-scrollbar-thumb-color",s.scrollbarThumbColor),n.setProperty("--ph-survey-scrollbar-track-color",s.scrollbarTrackColor),n.setProperty("--ph-survey-outline-color",s.outlineColor)})(r,e.type,e.appearance),r.className=s;const o=r.attachShadow({mode:"open"}),a=function(e){const t=((e,t,i)=>{let s=e.createElement("style");s.innerText=t;const n=(e=>{var t;return Ct(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(i);return n&&(s=n(s)),s||(ef.error("prepare_external_dependency_stylesheet returned null"),null)})(sf,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(a){const e=o.querySelector("style");e&&o.removeChild(e),o.appendChild(a)}return(i||sf.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},uf=({responses:e,survey:t,surveySubmissionId:i,posthog:s,isSurveyCompleted:n,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;s?jg(s)&&(Zg(t),s.capture(Fg,ct(ct(ct(ct({[Lg]:t.name,[Rg]:t.id,[Ag]:t.current_iteration,[Og]:t.current_iteration_start_date,[Dg]:i,[Ng]:n},o&&{[qg]:o}),{},{sessionRecordingUrl:null===(l=s.get_session_replay_url)||void 0===l?void 0:l.call(s)},sl(e,t,a)),r),{},{$set:{[rl(t,"responded")]:!0}})),n&&(tf.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),Ef(t),s.reloadFeatureFlags())):zg.error("[survey sent] event not captured, PostHog instance not found.")},df=(e,t,i)=>{var s;return ct(ct({[Lg]:e.name,[Rg]:e.id,[Ag]:e.current_iteration,[Og]:e.current_iteration_start_date,[$g]:nl(null==t?void 0:t.responses)},(null==t?void 0:t.surveyLanguage)&&{[qg]:t.surveyLanguage}),{},{sessionRecordingUrl:null===(s=i.get_session_replay_url)||void 0===s?void 0:s.call(i),[Dg]:null==t?void 0:t.surveySubmissionId},sl(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots))},hf=(e,t,i,s)=>{if(!t)return void zg.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const n=xf(e),r=n?n.surveyLanguage:s;t.capture(Pg,ct(ct(ct({},df(e,n,t)),r&&{[qg]:r}),{},{$set:{[rl(e,"dismissed")]:!0}})),Ef(e),Zg(e),tf.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},pf=(e,t)=>{if(!t)return void zg.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(e=>Qg("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(i))return}catch(e){return}const s=xf(e);if(s){try{localStorage.setItem(i,"true")}catch(e){}t.capture("survey abandoned",df(e,s,t),{transport:"sendBeacon"})}},_f=e=>e.map(e=>({sort:Math.floor(10*Math.random()),value:e})).sort((e,t)=>e.sort-t.sort).map(e=>e.value),gf=(e,t)=>e.length===t.length&&e.every((e,i)=>e===t[i])?t.reverse():t,ff=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},vf=(e,t)=>{return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(i=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const i=new Map(e.questions.map(e=>[e.id,e])),s=[];for(const e of t){const t=i.get(e);if(!t)return null;s.push(t)}return s})(e,t.questionOrder))&&void 0!==i?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?gf(e.questions,_f(e.questions)):e.questions;var i},mf=e=>hl(e)||If(e),yf=function(e){function t(e){var i,s;return this.getChildContext||(i=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&i.forEach(function(e){e.__e=!0,E_(e)})},this.sub=function(e){i.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i&&i.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+c_++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),bf=()=>sg(yf),Sf=({component:e,children:t,renderAsHtml:i,style:s})=>function(e,t,i){var s,n,r,o,a=m_({},e.props);for(r in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==r?s=t[r]:"ref"==r?n=t[r]:a[r]=void 0===t[r]&&null!=o?o[r]:t[r];return arguments.length>2&&(a.children=arguments.length>3?Kp.call(arguments,2):i),S_(e.type,a,s||e.key,n||e.ref,null)}(e,i?{dangerouslySetInnerHTML:{__html:t},style:s}:{children:t,style:s});function wf(e,t){var i,s;if(!(null===(i=e.conditions)||void 0===i?void 0:i.url))return!0;const n=gr(t);if(!n)return!1;const r=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType);return gl[o](r,[n])}const kf=e=>Qg("inProgressSurvey_",e),Cf=(e,t)=>{try{localStorage.setItem(kf(e),JSON.stringify(t))}catch(e){zg.error("Error setting in-progress survey state in localStorage",e)}},xf=e=>{try{const t=localStorage.getItem(kf(e));if(t)return JSON.parse(t)}catch(e){zg.error("Error getting in-progress survey state from localStorage",e)}return null},If=e=>{const t=xf(e);return!Ft(null==t?void 0:t.surveySubmissionId)},Ef=e=>{try{localStorage.removeItem(kf(e))}catch(e){zg.error("Error clearing in-progress survey state from localStorage",e)}};function Tf(e,t=!1){const i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function Mf(e,t=mg,i){if(e===wg)return{};switch(t){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case fg:return{left:"30px"};case vg:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Sg&&i===gg?"60px":"30px"}}}var Pf=0;function Ff(e,t,i,s,n,r){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Pf,__i:-1,__u:0,__source:n,__self:r};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return Zp.vnode&&Zp.vnode(c),c}const Rf=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ff("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Lf=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ff("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Af=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ff("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Of=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ff("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),$f=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Ff("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Df=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Ff("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),Nf=Ff("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Ff("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Bf=({fill:e="currentColor"}={})=>Ff("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Ff("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Ff("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),qf=Ff("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Ff("g",{"clip-path":"url(#clip0_2415_6911)",children:[Ff("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Ff("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Ff("g",{mask:"url(#mask0_2415_6911)",children:[Ff("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),Ff("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),Ff("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),Ff("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),Ff("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),Ff("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),Ff("defs",{children:Ff("clipPath",{id:"clip0_2415_6911",children:Ff("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function Hf({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return Ff("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",qf]})}function Wf({text:t,submitDisabled:i,appearance:s,onSubmit:n,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:c}){const{isPreviewMode:u}=sg(yf),d=!!l&&!!c,h=!a&&Ff("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==e||e.open(r)),u?null==o||o():n()},children:t});return Ff("div",{className:"bottom-section",children:[d?Ff("div",{className:"form-buttons form-buttons-with-back",children:[Ff("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:s.backButtonText||"Back"}),h]}):h,!s.whiteLabel&&Ff(Hf,{urlParams:{utm_source:"survey-footer"}})]})}function zf({question:e,forceDisableHtml:t,htmlFor:i}){return Ff("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[Ff(e.type===kg?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&Sf({component:b_("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function Uf({onClick:e}){const{isPreviewMode:t}=sg(yf);return Ff("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:Bf({fill:"black"})})}const jf=e;function Vf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onClose:r}){const{isPopup:o}=sg(yf);return eg(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),r())};return sr(jf,"keydown",e),()=>{jf.removeEventListener("keydown",e)}},[r]),Ff("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Ff(Uf,{onClick:()=>r()}),Ff("h3",{className:"thank-you-message-header",children:e}),t&&Sf({component:b_("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!s&&"text"!==i}),o&&Ff(Wf,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>r()})]})}function Gf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=sg(yf);return Ff("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Ff(Uf,{onClick:()=>l()}),e&&Ff("h3",{className:"intro-screen-header",children:e}),t&&Sf({component:b_("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!s&&"text"!==i}),Ff(Wf,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const Qf=e=>kt(e)&&e.every(e=>Tt(e));function Kf({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=bf(),u=tg(null),[d,h]=Y_(()=>Tt(o)?o:""),p=null==i?void 0:i.disableAutofocus;eg(()=>{p||setTimeout(()=>{var e;c||null===(e=u.current)||void 0===e||e.focus()},100)},[c,p]);const _=`surveyQuestion${r}`,g=ig(()=>function(e,t,i){const s=e.trim();if(!i&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case ht:var n;if(void 0!==e.value&&e.value>s.length)return null!==(n=e.errorMessage)&&void 0!==n?n:`Please enter at least ${e.value} characters`;break;case pt:var r;if(void 0!==e.value&&s.length>e.value)return null!==(r=e.errorMessage)&&void 0!==r?r:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),f=Wn(e.validation,ht),v=Wn(e.validation,pt),m=ig(()=>function(e,t){const i=1===e?void 0:e;return i&&t?`Enter ${i}-${t} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(f,v),[f,v]),y=()=>{g||s(d.trim())},b=()=>{g||n(d.trim())};return Ff(w_,{children:[Ff("div",{className:"question-container",children:[Ff(zf,{question:e,forceDisableHtml:t,htmlFor:_}),Ff("textarea",{ref:u,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:f,maxLength:v,onInput(e){h(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||g||(e.preventDefault(),c?b():y())},value:d}),m&&Ff("div",{className:"validation-hint",children:m})]}),Ff(Wf,{text:e.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:a,onBack:l})]})}function Zf({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,canGoBack:r,onBack:o}){return Ff(w_,{children:[Ff("div",{className:"question-container",children:Ff(zf,{question:e,forceDisableHtml:t})}),Ff(Wf,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>s("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:r,onBack:o})]})}function Jf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;const u=e.scale,d=10===e.scale?0:1,[h,p]=Y_(()=>Rt(o)?o:kt(o)&&o.length>0&&Rt(parseInt(o[0]))?parseInt(o[0]):Tt(o)&&Rt(parseInt(o))?parseInt(o):null),_="emoji"===e.display&&2===e.scale,{isPreviewMode:g}=bf(),f=e=>g?r(e):n(e);return Ff(w_,{children:[Ff("div",{className:"question-container",children:[Ff(zf,{question:e,forceDisableHtml:t}),Ff("div",{className:"rating-section",children:[Ff("div",{className:"rating-options",children:["emoji"===e.display&&Ff("div",{className:"rating-options-emoji"+(_?" rating-options-emoji-2":""),children:null===(c=sv[e.scale])||void 0===c?void 0:c.map((t,s)=>Ff("button",{"aria-label":`Rate ${s+1}`,className:`ratings-emoji question-${i}-rating-${s} ${s+1===h?"rating-active":""}`,value:s+1,type:"button",onClick(){const t=s+1;p(t),e.skipSubmitButton&&f(t)},children:t},s))}),"number"===e.display&&Ff("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${u-d+1}, minmax(0, 1fr))`},children:nv(e.scale).map((t,n)=>Ff(Xf,{displayQuestionIndex:i,active:h===t,appearance:s,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&f(t)}},n))})]}),!_&&Ff("div",{className:"rating-text",children:[Ff("div",{children:e.lowerBoundLabel}),Ff("div",{children:e.upperBoundLabel})]})]})]}),Ff(Wf,{text:e.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:Pt(h)&&!e.optional,appearance:s,onSubmit:()=>n(h),onPreviewSubmit:()=>r(h),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function Xf({num:e,active:t,displayQuestionIndex:i,setActiveNumber:s}){return Ff("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){s(e)},children:e})}function Yf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const c=tg(null),u=ig(()=>(e=>{if(!e.shuffleOptions)return e.choices;const t=e.choices;let i="";e.hasOpenChoice&&(i=t.pop());const s=gf(t,_f(t));return e.hasOpenChoice&&(e.choices.push(i),s.push(i)),s})(e),[e]),[d,h]=Y_(()=>((e,t)=>Tt(e)||Qf(e)?e:t===xg?null:[])(o,e.type)),[p,_]=Y_(()=>((e,t)=>{if(Tt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(Qf(e)){const i=e.find(e=>!t.includes(e));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,u)),{isPreviewMode:g}=bf(),f=e.type===xg,v=e.type===Cg,m=e.skipSubmitButton&&f&&!e.hasOpenChoice,y=(e,t)=>{if(t){const e=!p.isSelected;return _(t=>ct(ct({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),f&&h(""),void(e&&setTimeout(()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()},75))}if(f)return h(e),_(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),void(m&&(n(e),g&&r(e)));v&&kt(d)&&(d.includes(e)?h(d.filter(t=>t!==e)):h([...d,e]))},b=e=>{e.stopPropagation();const t=e.currentTarget.value;_(e=>ct(ct({},e),{},{inputValue:t})),f&&h(t)},S=e=>{e.stopPropagation(),"Enter"!==e.key||w()||(e.preventDefault(),k()),"Escape"===e.key&&(e.preventDefault(),_(e=>ct(ct({},e),{},{isSelected:!1,inputValue:""})),f&&h(null))},w=()=>!(e.optional||!Pt(d)&&(!kt(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),k=()=>{p.isSelected&&v?kt(d)&&(g?r([...d,p.inputValue]):n([...d,p.inputValue])):g?r(d):n(d)};return Ff(w_,{children:[Ff("div",{className:"question-container",children:[Ff(zf,{question:e,forceDisableHtml:t}),Ff("fieldset",{className:"multiple-choice-options limit-height",children:[Ff("legend",{className:"sr-only",children:v?" Select all that apply":" Select one"}),u.map((t,s)=>{const n=!!e.hasOpenChoice&&s===e.choices.length-1,r=`surveyQuestion${i}Choice${s}`,o=`${r}Open`,a=n?p.isSelected:f?d===t:kt(d)&&d.includes(t);return Ff("label",{className:n?"choice-option-open":"",children:[Ff("div",{className:"response-choice",children:[Ff("input",{type:f?"radio":"checkbox",name:r,checked:a,onChange:()=>y(t,n),id:r,"aria-controls":o}),Ff("span",{children:n?`${t}:`:t})]}),n&&Ff("input",{type:"text",ref:c,id:o,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:b,onClick(e){p.isSelected||y(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},s)})]})]}),Ff(Wf,{text:e.buttonText||"Submit",submitDisabled:w(),appearance:s,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}const ev=[1,2,3,4,5],tv=[1,2,3,4,5,6,7],iv=[0,1,2,3,4,5,6,7,8,9,10],sv={2:[Df,Nf],3:[Af,Lf,Rf],5:[Of,Af,Lf,Rf,$f]};function nv(e){switch(e){case 5:default:return ev;case 7:return tv;case 10:return iv}}const rv=Gn("[Surveys]");function ov(e,t,i){var s;const n=e.questions[t],r=t+1;if(!(null===(s=n.branching)||void 0===s?void 0:s.type))return t===e.questions.length-1?Eg:r;if(n.branching.type===Eg)return Eg;if("specific_question"===n.branching.type){if(Number.isInteger(n.branching.index))return n.branching.index}else if("response_based"===n.branching.type){if(n.type===xg){var o;let e=n.choices.indexOf(`${i}`);if(-1===e&&n.hasOpenChoice&&(e=n.choices.length-1),null===(o=n.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===Eg?Eg:r}}else if(n.type===Ig){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,n.scale);if(null===(a=n.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===Eg?Eg:r}}return r}return rv.warn("Falling back to next question index due to unexpected branching type"),r}const av=Gn("[SurveyTranslations]");function lv(e,t){const i=function(e){return function({overrideLanguage:e,storedPersonProperties:t,locale:i},s){const n=ol(e);if(n)return null==s||s.info(`Using override display language: ${n}`),n;const r=function(e){return e&&"object"==typeof e&&"language"in e?ol(e.language):null}(t);if(r)return null==s||s.info(`Using person property language: ${r}`),r;const o=ol(i);return o?(null==s||s.info(`Using detected locale: ${o}`),o):(null==s||s.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Ct(e.get_property)?e.get_property(ae):void 0,locale:Rl()},av)}(t);if(!i)return av.info("No user language detected"),{survey:e,language:null};const s=ul(e,i,av);return{survey:s.survey,language:s.matchedKey}}const cv=e,uv=s,dv="ph:show_survey_widget",hv="PHWidgetSurveyClickListener";function pv(e,t){try{const i=e.getBoundingClientRect(),s=cv.innerHeight,n=cv.innerWidth;let r=i.left+i.width/2-t/2;r+t>n-20&&(r=n-t-20),20>r&&(r=20);const o=s-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?s-i.top+12+"px":"auto",zIndex:rf.zIndex}}catch(e){return zg.warn("Failed to calculate trigger position:",e),null}}var _v=class{constructor(e){this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this._loggedFeatureFlagsDisabledWarning=!1,this.handlePageUnload=()=>{const e=this._posthog.get_property(ue);if(e)for(const t of e)If(t)&&pf(t,this._posthog)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:i=!1}={})=>{var s,n,r,o,a,l;if(!jg(this._posthog))return;const{survey:c,language:u}=this._translateSurveyForRendering(e);this._currentLanguage=u,this._surveyPopupProps=null,this._displayOptions=t;const d=this._applyDisplayOverrides(c,t);this._clearSurveyTimeout(d.id);const{properties:h,initialResponses:p}=null!=t?t:{},_=!(!p||0>=Object.keys(p).length)&&this._handleInitialResponses(d,p,h,u);if(_&&!(null===(s=d.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this._addSurveyToFocus(d);let g={};if((null===(n=d.appearance)||void 0===n?void 0:n.position)===yg&&(null===(r=d.appearance)||void 0===r?void 0:r.widgetSelector)){const e=uv.querySelector(d.appearance.widgetSelector);var f;e&&(g=pv(e,parseInt((null===(f=d.appearance)||void 0===f?void 0:f.maxWidth)||rf.maxWidth))||{})}const v=(null===(o=d.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:m}=cf(d,this._posthog);this._renderedTargets.set(m,m.host);const y={posthog:this._posthog,survey:d,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:h,style:g,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:u};if(this._surveyPopupProps=y,0>=v)return this._surveyIsRendered=!0,W_(Ff(yv,ct({},y)),m);const b=()=>{this._surveyIsRendered=!0;const{survey:i,language:s}=this._translateSurveyForRendering(e);this._currentLanguage=s;const n=this._applyDisplayOverrides(i,t),r=ct(ct({},y),{},{survey:n,surveyLanguage:s});this._surveyPopupProps=r,W_(Ff(yv,ct(ct({},r),{},{survey:ct(ct({},n),{},{appearance:ct(ct({},n.appearance),{},{surveyPopupDelaySeconds:0})})})),m)},S=()=>{if(!jg(this._posthog)||!this._shouldDisplaySurvey(d))return zg.info(`Survey ${d.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(d);b()},w=i?null===(a=this._posthog.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(l=a.getActivationTimestamp)||void 0===l?void 0:l.call(a,d.id):void 0,k=Rt(w)?Math.max(0,Date.now()-w):0,C=Math.max(0,1e3*v-k);if(0>=C)return S();const x=cv.setTimeout(()=>{this._surveyTimeouts.delete(d.id),S()},C);this._surveyTimeouts.set(d.id,x)},this._handleWidget=e=>{var t;const{survey:i,language:s}=this._translateSurveyForRendering(e),{shadow:n,isNewlyCreated:r}=cf(i,this._posthog);this._renderedTargets.set(n,n.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===gg&&this._renderedTabWidgets.set(e.id,e),r&&W_(Ff(Sv,{posthog:this._posthog,survey:i,surveyLanguage:s},e.id),n)},this._detachWidgetSelectorListener=e=>{const t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(hv),this._widgetSelectorListeners.delete(e),zg.info(`Removed click listener for survey ${e}`))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._removeTabWidget=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._renderedTabWidgets.delete(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;const i=uv.querySelector(Tf(e,!0));return!!(null==i||null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{const i=uv.querySelector(t),s=this._widgetSelectorListeners.get(e.id);if(i){if(this._handleWidget(e),s){if(i===s.element)return;zg.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(e.id)}if(!i.hasAttribute(hv)){const t=t=>{var i,s;t.stopPropagation();const n=(null===(i=e.appearance)||void 0===i?void 0:i.position)===yg?pv(t.currentTarget,parseInt((null===(s=e.appearance)||void 0===s?void 0:s.maxWidth)||rf.maxWidth)):{};cv.dispatchEvent(new CustomEvent(dv,{detail:{surveyId:e.id,position:n}}))};sr(i,"click",t),i.setAttribute(hv,"true"),this._widgetSelectorListeners.set(e.id,{element:i,listener:t,survey:e}),zg.info(`Attached click listener for feedback button survey ${e.id}`)}}else s&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{if(!jg(this._posthog))return;const{survey:t,language:i}=this._translateSurveyForRendering(e),{shadow:s}=cf(t,this._posthog);this._renderedTargets.set(s,s.host),W_(Ff(yv,{posthog:this._posthog,survey:t,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,i)=>{var s;if(!jg(this._posthog))return;const{survey:n,language:r}=this._translateSurveyForRendering(e);let o=!1;(null===(s=this._posthog.config)||void 0===s||null===(s=s.surveys)||void 0===s?void 0:s.prefillFromUrl)&&(o=this._handleUrlPrefill(n,r,i)),W_(Ff(yv,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(t=>{e(t.filter(e=>this._shouldDisplaySurvey(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{const t=jg(this._posthog),i=e.filter(e=>t&&(e.type===bg||e.type===Sg)),s=new Set(i.map(e=>e.id));for(const e of Array.from(this._surveyTimeouts.keys()))s.has(e)||this.cancelSurvey(e);const n=this._sortSurveysByAppearanceDelay(i),r=new Set,o=new Set;n.forEach(e=>{if(e.type===Sg){var t,i,s,n;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===gg)return o.add(e.id),void this._handleWidget(e);"selector"===(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)&&(null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector)&&(r.add(e.id),this._manageWidgetSelectorListener(e,null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector))}Pt(this._surveyInFocus)&&e.type===bg&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:e})=>{r.has(e.id)||this._removeWidgetSelectorListener(e)}),this._renderedTabWidgets.forEach((e,t)=>{o.has(t)||this._removeTabWidget(e)})},e)},this._addSurveyToFocus=e=>{Pt(this._surveyInFocus)||zg.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${e.id}.`),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&zg.error(`Survey ${e.id} is not in focus. Cannot remove survey ${e.id}.`),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),sr(cv,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){if(Pt(this._surveyInFocus))return;const e=this._posthog.get_property(ue),t=null==e?void 0:e.find(e=>e.id===this._surveyInFocus);if(!t)return;const{survey:i,language:s}=this._translateSurveyForRendering(t);if(s===this._currentLanguage)return;if(this._currentLanguage=s,!this._surveyIsRendered)return;const n=this._applyDisplayOverrides(i,this._displayOptions),{shadow:r}=cf(n,this._posthog);W_(Ff(yv,ct(ct({},this._surveyPopupProps),{},{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),r)}get _featureFlags(){var e,t,i;return null!==(e=null===(t=(i=this._posthog).getExtension)||void 0===t?void 0:t.call(i,"featureFlags"))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?ct(ct({},e),{},{appearance:ct(ct(ct({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){const t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(zg.info(`Cancelled pending survey ${e}`),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null===(e=this._automaticDisplayDispose)||void 0===e||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(cv.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach((e,t)=>this._clearSurveyTimeout(t)),this._widgetSelectorListeners.forEach((e,t)=>this._detachWidgetSelectorListener(t)),this._renderedTargets.forEach((e,t)=>{W_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var i,s;const n=If(e),r=If(t);if(n&&!r)return-1;if(!n&&r)return 1;const o=e.schedule===Tg,a=t.schedule===Tg;return o&&!a?1:!o&&a?-1:((null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(s=t.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return lv(e,this._posthog)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;const{params:s}=function(e){const t={};let i=!1;const s=e.replace(/^\?/,"");if(!s)return{params:t,autoSubmit:i};const n=s.split("&");for(const e of n){const[s,n]=e.split("=");if(!s||Et(n))continue;const r=decodeURIComponent(s),o=decodeURIComponent(n);if("auto_submit"===r&&"true"===o){i=!0;continue}const a=r.match(/^q(\d+)$/);if(a){const e=parseInt(a[1],10);t[e]||(t[e]=[]),t[e].push(o)}}return{params:t,autoSubmit:i}}(cv.location.search);if(0===Object.keys(s).length)return!1;zg.info("[Survey Prefill] Detected URL prefill parameters");const n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,i,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,s){const{responses:n,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&uf({responses:o?n:a,survey:e,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:s})}_handleInitialResponses(e,t,i,s){const n={};for(const[e,i]of Object.entries(t))n[parseInt(e)]=kt(i)?i.map(String):[String(i)];zg.info("[Survey] Processing initial responses");const r=this._processPrefillData(e,n,s);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,s),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{const s=function(e,t){const i={};return e.questions.forEach((e,s)=>{if(!t[s]||!e.id)return;const n=t[s],r=tl(e.id);try{switch(e.type){case xg:{if(!e.choices||0===e.choices.length)return void Vn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=parseInt(n[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void Vn.warn(`[Survey Prefill] Invalid choice index for q${s}: ${n[0]}`);i[r]=e.choices[t];break}case Cg:{if(!e.choices||0===e.choices.length)return void Vn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=n.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void Vn.warn(`[Survey Prefill] No valid choices for q${s}`);const o=[...new Set(t.map(t=>e.choices[t]))];t.length>o.length&&Vn.warn(`[Survey Prefill] Removed duplicate choices for q${s}`),i[r]=o;break}case Ig:{const t=parseInt(n[0],10),o=e.scale||10;if(isNaN(t)||0>t||t>o)return void Vn.warn(`[Survey Prefill] Invalid rating for q${s}: ${n[0]} (scale: 0-${o})`);i[r]=t;break}default:Vn.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){Vn.error(`[Survey Prefill] Error converting q${s}:`,e)}}),i}(e,t);if(0===Object.keys(s).length)return zg.warn("[Survey Prefill] No valid responses after conversion"),null;const n=Pa(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(e,t,i){let s=0;const n={},r=[],o=e.questions.length+1;let a=0;for(;e.questions.length>s&&o>a&&(a++,t.includes(s));){const t=e.questions[s];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=tl(t.id);Et(i[e])||(n[e]=i[e])}r.push(s);const o=ov(e,s,t.id?i[tl(t.id)]:null);if(o===Eg)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:r};s=o}return{startQuestionIndex:s,skippedResponses:n,skippedIndices:r}}(e,Object.keys(t).map(e=>parseInt(e,10)),s),l=r>=e.questions.length;return Cf(e,{surveySubmissionId:n,responses:s,lastQuestionIndex:r,questionOrder:ff(e.questions),visitedIndices:a,surveyLanguage:i}),zg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:s,submissionId:n,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(e){return zg.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t=void 0){if(!e)return!0;const i=this._featureFlags,s=!!(null==i?void 0:i.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let n=!0;t&&(n=(null==i?void 0:i.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const r=s&&n;return r||this._warnIfFeatureFlagsDisabled(e),r}_warnIfFeatureFlagsDisabled(e){var t;!this._loggedFeatureFlagsDisabledWarning&&(null===(t=this._posthog.config)||void 0===t?void 0:t.advanced_disable_feature_flags)&&(this._loggedFeatureFlagsDisabledWarning=!0,zg.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}_isSurveyConditionMatched(t){return!t.conditions||wf(t,this._posthog)&&function(t){var s,n;return function(t,s){var n,r,o;if(!t||0===t.length)return!0;if(!c)return!1;const a=Zi(c,{userAgentDataPlatform:null==i||null===(n=i.userAgentData)||void 0===n?void 0:n.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==e||null===(r=e.screen)||void 0===r?void 0:r.width,screenHeight:null==e||null===(o=e.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return gl[null!=s?s:"icontains"](t,[a])}(null===(s=t.conditions)||void 0===s?void 0:s.deviceTypes,null===(n=t.conditions)||void 0===n?void 0:n.deviceTypesMatchType)}(t)&&function(e){var t;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null==sf?void 0:sf.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return mf(e)?{satisfied:!0}:e.internal_targeting_flag_key&&function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)&&!(null===(t=this._featureFlags)||void 0===t?void 0:t.hasLoadedFlags)?(this._warnIfFeatureFlagsDisabled(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;const s={eligible:!0,reason:void 0};if(!Vg(e))return s.eligible=!1,s.reason=`Survey is not running. It was completed on ${e.end_date}`,s;if(!Jg.includes(e.type))return s.eligible=!1,s.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,s;const n=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return s.eligible=!1,s.reason=n?`Survey linked feature flag is not enabled for variant ${n}`:"Survey linked feature flag is not enabled",s;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return s.eligible=!1,s.reason="Survey targeting feature flag is not enabled",s;const r=this._internalFlagCheckSatisfied(e);var o;return r.satisfied?function(e,t){if(!e||!t)return!0;const i="string"==typeof t?new Date(t):t,s=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(s/864e5)>e}(null===(i=e.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Da._get("lastSeenSurveyDate"))?(e=>!!Da._get(Kg(e))&&!mf(e))(e)?(s.eligible=!1,s.reason="Survey has already been seen and it can't be activated again",s):s:(s.eligible=!1,s.reason="Survey wait period has not passed",s):(s.eligible=!1,s.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",s)}checkSurveyCaptureEligibility(){return jg(this._posthog)?{eligible:!0}:{eligible:!1,reason:Ug}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!dl(e)&&!Gg(e))return!0;const i=null===(t=this._posthog.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==i?void 0:i.includes(e.id))}_checkFlags(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this._isSurveyFeatureFlagEnabled(t))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{const t=uv.querySelector(Tf(e,!0));(null==t?void 0:t.shadowRoot)&&(W_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){zg.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function gv(e,t){if(!uv||!cv)return;const i=new _v(e);if(e.config.disable_surveys_automatic_display)return zg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return zg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let s;i.callSurveysAndEvaluateDisplayLogic(!0);const n=()=>{Et(s)&&(s=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Et(s)||(clearInterval(s),s=void 0)};n();const o=()=>{uv.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return sr(uv,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),uv.removeEventListener("visibilitychange",o)}),i}function fv({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:s=!1,posthog:n}){eg(()=>{var r;if(s||!(null===(r=e.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var s;const r=e.type===Sg,o=wf(e,n),a=(null===(s=e.appearance)||void 0===s?void 0:s.widgetType)===gg&&r;if(!o)return zg.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);a&&(zg.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};sr(cv,"popstate",o),sr(cv,"hashchange",o);const a=cv.history.pushState,l=cv.history.replaceState;return cv.history.pushState=function(...e){a.apply(this,e),o()},cv.history.replaceState=function(...e){l.apply(this,e),o()},()=>{cv.removeEventListener("popstate",o),cv.removeEventListener("hashchange",o),cv.history.pushState=a,cv.history.replaceState=l}},[s,e,t,i,n])}const vv=200;function mv(e="right"){switch(e){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function yv({survey:e,forceDisableHtml:t,posthog:i,style:s={},previewPageIndex:n,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:u=()=>{},properties:d,isSurveyCompleted:h,skipShownEvent:p,surveyLanguage:_}){var g,f,v,m,y,b,S,w,k,C,x,I;const E=tg(null),T=Number.isInteger(n),{isPopupVisible:M,isSurveySent:P,hidePopupWithAnimation:F}=function(e,t,i,s,n,r,o,a,l){const[c,u]=Y_(s||0===i||e.type===wg),[d,h]=Y_(!1),p=tg(!1),_=()=>{const t=()=>{r&&n(e),u(!1)};if(p.current)return;const i=null==o?void 0:o.current;i?(p.current=!0,i.style.transition=`opacity ${vv}ms ease-out`,i.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},g=t=>{t.detail.surveyId===e.id&&_()};return eg(()=>{if(!t)return void zg.error("usePopupVisibility hook called without a PostHog instance.");if(s)return;let n;const r=t=>{var i,s;if(t.detail.surveyId===e.id){if(!(null===(i=e.appearance)||void 0===i?void 0:i.displayThankYouMessage))return _();h(!0),(null===(s=e.appearance)||void 0===s?void 0:s.autoDisappear)&&(n&&clearTimeout(n),n=setTimeout(_,5e3))}},o=()=>{if(wf(e,t)){var i;u(!0),cv.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(Mg,ct(ct({[Lg]:e.name,[Rg]:e.id,[Ag]:e.current_iteration,[Og]:e.current_iteration_start_date},l&&{[qg]:l}),{},{sessionRecordingUrl:null===(i=t.get_session_replay_url)||void 0===i?void 0:i.call(t)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};sr(cv,"PHSurveyClosed",g),sr(cv,"PHSurveySent",r);const c=i>0?setTimeout(o,i):void 0;return Et(c)&&o(),()=>{Et(c)||clearTimeout(c),Et(n)||clearTimeout(n),cv.removeEventListener("PHSurveyClosed",g),cv.removeEventListener("PHSurveySent",r)}},[]),fv({survey:e,removeSurveyFromFocus:n,setSurveyVisible:u,isPreviewMode:s,posthog:t}),{isPopupVisible:c,isSurveySent:d,setIsPopupVisible:u,hidePopupWithAnimation:_}}(e,i,(null===(g=e.appearance)||void 0===g?void 0:g.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,T,r,o,E,p,_),R=P||n===e.questions.length||!0===h,[L,A]=Y_(!1),O=ig(()=>!!xf(e),[e]),D=!(!(null===(f=e.appearance)||void 0===f?void 0:f.introScreenHeader)&&!(null===(v=e.appearance)||void 0===v?void 0:v.introScreenDescription)),N=T?-1===n:!!(null===(m=e.appearance)||void 0===m?void 0:m.displayIntroScreen)&&D&&!L&&!O,B=ig(()=>{const t=xf(e),s=(null==t?void 0:t.surveySubmissionId)||Pa();return{isPreviewMode:T,previewPageIndex:n,onPopupSurveyDismissed(){_?hf(e,i,T,_):hf(e,i,T),c()},isPopup:o||!1,surveySubmissionId:s,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:d,surveyLanguage:_}},[T,n,o,i,e,c,a,l,d,_]);return M?Ff(yf.Provider,{value:B,children:Ff("div",{className:"ph-survey",style:ct(ct({},Mf(e.type,null===(y=e.appearance)||void 0===y?void 0:y.position,null===(b=e.appearance)||void 0===b?void 0:b.widgetType)),s),ref:E,children:R?Ff(Vf,{header:(null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageHeader)||"Thank you!",description:(null===(w=e.appearance)||void 0===w?void 0:w.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||rf,onClose(){F(),u()}}):N?Ff(Gf,{header:(null===(C=e.appearance)||void 0===C?void 0:C.introScreenHeader)||"",description:(null===(x=e.appearance)||void 0===x?void 0:x.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(I=e.appearance)||void 0===I?void 0:I.introScreenDescriptionContentType,appearance:e.appearance||rf,onStart:()=>A(!0)}):Ff(bv,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function bv({survey:e,forceDisableHtml:t,posthog:i}){var s,n;const r=ig(()=>{const t=xf(e);if(!t)return null;const i=Rt(t.lastQuestionIndex);return!i||i&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(Ef(e),null)},[e]),[o,a]=Y_(()=>((null==r?void 0:r.responses)&&zg.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,c]=Y_(!1),{previewPageIndex:u,onPopupSurveyDismissed:d,isPopup:h,onPreviewSubmit:p,onPreviewBack:_,surveySubmissionId:g,isPreviewMode:f,properties:v,surveyLanguage:m}=sg(yf),[y,b]=Y_(()=>{const t=null==r?void 0:r.lastQuestionIndex,i=Rt(t)&&t>=0&&e.questions.length>t?t:0;return Rt(u)&&u>=0?u:i}),[S,w]=Y_(()=>{var t;return(null!==(t=null==r?void 0:r.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[k,C]=Y_(()=>{var t;const i=xf(e);return null!==(t=null==i?void 0:i.questionSnapshots)&&void 0!==t?t:{}}),x=ig(()=>ff(vf(e,r)),[e.id,r]),I=ig(()=>{if(!x||new Set(x).size!==x.length)return vf(e,r);const t=new Map(e.questions.map(e=>[e.id,e])),i=x.map(e=>t.get(e)).filter(e=>!!e);return i.length===x.length?i:e.questions},[x,e.questions,e,r]);eg(()=>{!f||Et(u)||0>u||b(u)},[u,f]);const E=!!(null===(s=e.appearance)||void 0===s?void 0:s.allowGoBack)&&(f?(null!=u?u:0)>0:S.length>0),T=I.at(y);return T?Ff("form",{className:"survey-form",name:"surveyForm",children:[h&&!0!==(null===(n=e.appearance)||void 0===n?void 0:n.hideCancelButton)&&Ff(Uf,{onClick(){d()}}),Ff("div",{className:"survey-box","data-question-index":y,children:[l&&Ff("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),wv({question:T,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||rf,onSubmit:t=>(({res:t,displayQuestionIndex:s,questionId:n})=>{if(!i)return void zg.error("onNextButtonClick called without a PostHog instance.");if(!jg(i))return void c(!0);if(c(!1),!n)return void zg.error("onNextButtonClick called without a questionId.");const r=tl(n),l=ct(ct({},o),{},{[r]:t});a(l);const u=I[s],d=(null==u?void 0:u.id)?ct(ct({},k),{},{[u.id]:u.question}):k;C(d);const h=ov(e,s,t),p=h===Eg,_=[...S,s];if(p||(w(_),b(h),Cf(e,{surveySubmissionId:g,responses:l,lastQuestionIndex:h,questionOrder:ff(I),visitedIndices:_,surveyLanguage:m,questionSnapshots:d})),e.enable_partial_responses||p){const t=new Set(_.map(e=>{var t;return null===(t=I[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>tl(e))),s=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));uf({responses:s,survey:e,surveySubmissionId:g,isSurveyCompleted:p,posthog:i,properties:v,surveyLanguage:m,questionSnapshots:d})}})({res:t,displayQuestionIndex:y,questionId:T.id}),onPreviewSubmit:p,initialValue:T.id?o[tl(T.id)]:void 0,canGoBack:E,onBack(){if(f)return void _();if(0===S.length)return;const t=S[S.length-1],i=S.slice(0,-1);w(i),b(t),Cf(e,{surveySubmissionId:g,responses:o,lastQuestionIndex:t,questionOrder:ff(I),visitedIndices:i,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function Sv({survey:e,forceDisableHtml:t,posthog:i,readOnly:s,surveyLanguage:n}){var r,o,a,l,c,u,d;const[h,p]=Y_(!0),[_,g]=Y_(!1),[f,v]=Y_({}),m=tg(void 0),y=()=>{(_||!i||s||jg(i))&&g(!_)};if(eg(()=>{var t;if(!i)return void zg.error("FeedbackWidget called without a PostHog instance.");if(s)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&v({top:"50%",bottom:"auto"});const n=t=>{var i;const s=t;(null===(i=s.detail)||void 0===i?void 0:i.surveyId)===e.id&&(zg.info(`Received show event for feedback button survey ${e.id}`),v(s.detail.position||{}),y())};return sr(cv,dv,n),()=>{Et(m.current)||(clearTimeout(m.current),m.current=void 0),cv.removeEventListener(dv,n)}},[i,s,e.id,null===(r=e.appearance)||void 0===r?void 0:r.widgetType,null===(o=e.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=e.appearance)||void 0===a?void 0:a.borderColor]),fv({survey:e,setSurveyVisible:p,posthog:i}),!h)return null;const b=()=>{e.schedule!==Tg&&p(!1),Et(m.current)||clearTimeout(m.current),m.current=setTimeout(()=>{m.current=void 0,g(!1)},200)};return Ff(w_,{children:["tab"===(null===(l=e.appearance)||void 0===l?void 0:l.widgetType)&&Ff("button",{className:"ph-survey-widget-tab "+("top"===(null===(c=e.appearance)||void 0===c?void 0:c.tabPosition)?"widget-tab-top":""),onClick:y,disabled:s,style:mv(null===(u=e.appearance)||void 0===u?void 0:u.tabPosition),children:(null===(d=e.appearance)||void 0===d?void 0:d.widgetLabel)||""}),_&&Ff(yv,{posthog:i,survey:e,forceDisableHtml:t,style:f,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:n})]})}const wv=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const c={forceDisableHtml:t,appearance:s,onPreviewSubmit(e){r(e)},onSubmit(e){n(e)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case kg:return b_(Kf,ct(ct({},c),{},{question:e,key:e.id}));case"link":return b_(Zf,ct(ct({},c),{},{question:e,key:e.id}));case Ig:return b_(Jf,ct(ct({},c),{},{question:e,key:e.id}));case xg:case Cg:return b_(Yf,ct(ct({},c),{},{question:e,key:e.id}));default:return zg.error(`Unsupported question type: ${e.type}`),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=gv,h.extendPostHogWithSurveys=gv;const kv=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},Cv=1e4,xv=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),Iv=(e,t,i)=>{const s=JSON.stringify(e);if(i.remaining>=s.length)return xv(t,s,i);if(i.truncated=!0,2>i.remaining)return!1;let n=0,r=Math.min(e.length,i.remaining-2);for(;r>n;){const t=Math.ceil((n+r)/2);JSON.stringify(e.slice(0,t)).length>i.remaining?r=t-1:n=t}return xv(t,JSON.stringify(e.slice(0,n)),i)},Ev=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Tv=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},Mv=(e,t,i)=>{if(!i.truncated)if(xt(e)){if(i.seen.has(e))return void Tv(t||"circular","[Circular]",i);i.seen.add(e);try{for(const s in e)try{if(!{}.hasOwnProperty.call(e,s))continue;if(Mv(e[s],t?`${t}.${s}`:s,i),i.truncated)return}catch(e){continue}}catch(e){}}else Tv(t,e,i)},Pv=(e,t,i,s,n=!1,r)=>{if(!Ev(e))return!n||xv(t,"null",i);if(Pt(e)||(e=>{try{return Rt(e)||At(e)}catch(e){return!1}})(e))return xv(t,JSON.stringify(e),i);if("string"==typeof e)return Iv(e,t,i);if(!xt(e)&&!kt(e))return xv(t,JSON.stringify(e),i);if(s.has(e))return Iv("[Circular]",t,i);s.add(e);try{const r=e.toJSON;if(Ct(r))return Pv(r.call(e),t,i,s,n)}catch(e){}try{const s={}.toString.call(e);if("[object String]"===s)return Iv(String(e.valueOf()),t,i);if("[object Number]"===s||"[object Boolean]"===s)return xv(t,JSON.stringify(e.valueOf()),i)}catch(e){}if(e instanceof Error){const o={};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t])}catch(e){}try{o.name=e.name}catch(e){}try{o.message=e.message}catch(e){}try{o.stack=e.stack}catch(e){}return Pv(o,t,i,s,n,r)}if(kt(e)){if(!xv(t,"[",i))return!1;for(let n=0;e.length>n;n++){if(n>0&&!xv(t,",",i))return!1;let r;try{r=e[n]}catch(e){r=void 0}if(!Pv(r,t,i,s,!0))return!1}return xv(t,"]",i)}if(!xv(t,"{",i))return!1;let o=!0;try{for(const n in e){if(!{}.hasOwnProperty.call(e,n))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=e[n]}catch(e){continue}if(r)try{Mv(a,n,r)}catch(e){}if(!Ev(a))continue;const l=`${o?"":","}${JSON.stringify(n)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const c=t.length,u=i.remaining,d=i.truncated;if(!xv(t,l,i))return!1;const h=t.length,p=Pv(a,t,i,s,!1),_=i.truncated;if(t.length!==h){if(o=!1,!p)return!1}else if(t.length=c,i.remaining=u,i.truncated=p?d:_,!p)return!1}}catch(e){}return xv(t,"}",i)},Fv=(e,t)=>{const i=[],s={remaining:t,truncated:!1},n=xt(e[0])?{result:{},keysRemaining:50,sizeRemaining:Cv,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let t=0;e.length>t&&(0>=t||xv(i," ",s))&&Pv(e[t],i,s,new WeakSet,!1,0===t?n:void 0);t++);return{body:i.join("")+(s.truncated?"...":""),truncated:s.truncated,attributes:(null==n?void 0:n.result)||{}}},Rv={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Lv=e=>"canCapture"in e,Av=e=>Lv(e)?e.canCapture?e.getExtension(Yg):void 0:e.is_capturing()?e.logs:void 0,Ov=(e,t,i)=>{if(Lv(e))return void t.captureConsoleLog(i);const s=(e=>{const t=/^1\.(\d+)\.(\d+)$/.exec(e);if(!t)return;const i=Number(t[1]),s=Number(t[2]);return 392>i||i>419?void 0:410===i?s>4?s>10?void 0:"de":"le":418===i?s>3?s>10?s>14?s>17?void 0:"vi":"ci":"ui":"he":419===i?s>2?void 0:"vi":410>i?"le":"he"})(e.version),n=s?t[s]:void 0;Ct(n)&&n.call(t,i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs(e){let t=e;const i=[],s={host:h.location.host};let n=!1;for(const e of Object.keys(Rv)){const r=i=>(...r)=>{let o=!1;try{const i=t;if(r.length>0&&!n&&i){const t=Av(i);if(t){n=!0,o=!0;const{body:a,truncated:l,attributes:c}=Fv(r,Cv),u=ct(ct({},s),l?{body_truncated:"true"}:{}),d={level:Rv[e],body:a,attributes:ct(ct({"log.source":`console.${e}`},u),c)};Ov(i,t,d)}}}catch(e){}finally{o&&(n=!1),i.apply(h.console,r)}},o=h.console[e];i.push(kp(h.console,e,e=>{const t=r(e);return t.__rrweb_original__=kv(o),t}))}return()=>{t=void 0,i.forEach(e=>e())}},replayConsoleBuffer(e,t){const i=Av(e);if(i)for(const e of t)try{var s;const{body:t,truncated:n,attributes:r}=Fv(e.args,Cv);null===(s=i.captureBufferedConsoleLog)||void 0===s||s.call(i,{level:Rv[e.level],body:t,attributes:ct(ct({"log.source":`console.${e.level}`,host:h.location.host},n?{body_truncated:"true"}:{}),r)},e.context,e.occurredAtMs)}catch(e){}}};const $v=e=>qt(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),Dv=Gn("[Error tracking]"),Nv="webkit-masked-url:",Bv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],qv=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Nv],Hv=["__firefox__","__gCrWeb"];function Wv(){return new vs([new Ns,new Qs,new qs,new Bs,new Vs,new js,new Ws,new Gs],function(e,...t){return(i,s=0)=>{const n=[],r=i.split("\n"),o=Math.min(r.length,s+1e3),a=[];for(let i=s;o>i;i++){const s=r[i];if(s.length>1024)continue;const o=Ps.test(s)?s.replace(Ps,"$1"):s;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){n.push(t);const e=Rs(n);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if($s(n,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=As(n,c);n.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)Ls(n,e);return a.some(e=>0===e.start&&n.length===e.length)&&function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Ds(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(n),function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return ct(ct({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})}(n)}}("web:javascript",Is,Ms))}const zv=Gn("[ExceptionAutocapture]"),Uv=Wv(),jv=(e,t)=>{try{return e()}catch(e){return t}},Vv=(e,t)=>jv(()=>e(t()),void 0),Gv=e=>jv(()=>Ct(e)&&Ct(e.call),!1),Qv=(e,t)=>jv(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),Kv=(e,t,i)=>{jv(()=>{var i;null===(i=e[t])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),jv(()=>{e[t]=i},void 0)},Zv=t=>{const i=e;i||zv.info("window not available, cannot wrap onerror");const s=jv(()=>i.onerror,void 0);return i.onerror=function(...e){var i;return Vv(t,()=>Uv.buildFromUnknown((([e,t,i,s,n])=>{if(null!=n)return n;if(Tt(e)&&Tt(t)&&t.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:e,filename:t,lineno:i,colno:s})}catch(t){return e}return e})(e),{mechanism:{handled:!1}})),!!Gv(s)&&null!==(i=s(...e))&&void 0!==i&&i},Qv(i,"onerror"),()=>Kv(i,"onerror",s)},Jv=(t,i=!1)=>{const s=e;s||zv.info("window not available, cannot wrap onUnhandledRejection");const n=jv(()=>s.onunhandledrejection,void 0);return s.onunhandledrejection=function(e){var s;return Vv(t,()=>Uv.buildFromUnknown(e,{mechanism:{handled:!1}})),Gv(n)?null!==(s=n(e))&&void 0!==s&&s:i},Qv(s,"onunhandledrejection"),()=>Kv(s,"onunhandledrejection",n)},Xv={wrapOnError:Zv,wrapUnhandledRejection:Jv,wrapConsoleError(e){const t=console;t||zv.info("console not available, cannot wrap console.error");const i=jv(()=>t.error,void 0);return t.error=function(...t){jv(()=>t.length>1&&Tt(t[0])&&(/^\[PostHog\.js\](?: |$)/.test(t[0])||"rrweb logger error:"===t[0]),!1)||Vv(e,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(e=>e instanceof Error);return Uv.buildFromUnknown(i||e,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Gv(i)&&i(...t)},Qv(t,"error"),()=>Kv(t,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=Xv,h.posthogErrorWrappingFunctions=Xv;const Yv=(e,t)=>{if(!Ct(null==e?void 0:e.capture))return;const i=null==t?void 0:t.autocaptureExceptions,s=!Pt(i)&&"object"==typeof i&&kt(i.errors_to_ignore)?i.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){zv.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],n=t=>{try{var i;null===(i=e.capture)||void 0===i||i.call(e,"$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){zv.error("Failed to capture exception for a legacy client",e)}};Zv(e=>{s.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||n(e)}),Jv(n,!0)};h.extendPostHogWithExceptionAutoCapture=Yv,h.extendPostHogWithExceptionAutocapture=Yv;const em="X-POSTHOG-SESSION-ID",tm="X-POSTHOG-WINDOW-ID",im="X-POSTHOG-DISTINCT-ID",sm=[em,tm,im],nm=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],rm=(e,t)=>({}.hasOwnProperty.call(e,t)),om=e=>"object"==typeof e&&!Pt(e)||Ct(e),am=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),lm=t=>{try{var i;return am(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null===(i=e.location)||void 0===i?void 0:i.href).toString()}catch(e){return}},cm=(e,t,i,s,n)=>{let r;try{r=new URL(s).hostname}catch(e){return!1}if(!e)return!1;if(kt(e)&&!e.includes(r))return!1;let o=!1;if(i){const{sessionId:e,windowId:t}=i.checkAndGetSessionAndWindowId(!0);n.set(em,e),n.set(tm,t),o=!0}const a=(e=>Ct(e)?e():e)(t);return a&&"$posthog_cookieless"!==a&&(n.set(im,a),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const um={_patchFetch:(t,i,s)=>kp(e,"fetch",e=>function(n,r){const o=arguments.length>1?[n,r]:[n];let a=o;try{const e=lm(n);if(e)if(am(n)){const e=new Request(n,r);cm(t,i,s,e.url,e.headers),a=[e]}else{const o=new Headers(om(r)?r.headers:void 0);if(cm(t,i,s,e,o)){const e=((e,t)=>{if(Et(e)||Pt(e))return{headers:t};if(!om(e))return;const i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const e=Object.create(i);return Object.defineProperty(e,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),e}return new Proxy({headers:t},{get:(e,t)=>rm(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>rm(e,t)||t in i,ownKeys(e){const t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach(e=>t.add(e)),nm.forEach(e=>{e in i&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){const s=Reflect.getOwnPropertyDescriptor(e,t);if(s)return s;if("string"==typeof t&&nm.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};const n=Reflect.getOwnPropertyDescriptor(i,t);return n?ct(ct({},n),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);e&&(a=[n,e])}}}catch(e){a=o}return e.apply(this,a)}),_patchXHR:(t,i,s)=>kp(e.XMLHttpRequest.prototype,"open",e=>function(n,r,o=!0,a,l){const c=this,u=new Headers,d=lm(r);d&&cm(t,i,s,d,u);const h=e.call(c,n,r,o,a,l);return sm.forEach(e=>{const t=u.get(e);if(t)try{c.setRequestHeader(e,t)}catch(e){}}),h})};h.__PosthogExtensions__.tracingHeadersPatchFns=um,h.postHogTracingHeadersPatchFns=um,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){const t=this.length;let i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){const s=this[i];if(e.call(t,s,i,this))return s}},writable:!0,enumerable:!1,configurable:!0});var dm=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;const i=this.i[0],s=this.i.at(-1);this.o&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const hm=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},pm=e=>{if("loading"===document.readyState)return"loading";const t=hm();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},_m=e=>{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},gm=e=>{let t="";try{for(;9!==(null==e?void 0:e.nodeType);){var i;const s=e,n=s.id?"#"+s.id:[_m(s),...Array.from(null!==(i=s.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch(e){}return t},fm=new WeakMap;function vm(e,t){let i=fm.get(t);return i||(i=new WeakMap,fm.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}let mm=-1;const ym=()=>mm,bm=e=>{addEventListener("pageshow",t=>{t.persisted&&(mm=t.timeStamp,e(t))},!0)},Sm=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},wm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},km=()=>{var e,t;return null!==(e=null===(t=hm())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let Cm=-1;const xm=new Set,Im=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Em=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of xm)e();isFinite(Cm)||(Cm="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Em,!0))}},Tm=(e=!1)=>{if(e&&(Cm=1/0),0>Cm){var t;const e=km(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;Cm=null!=i?i:Im(),addEventListener("visibilitychange",Em,!0),addEventListener("prerenderingchange",Em,!0),bm(()=>{setTimeout(()=>{Cm=Im()})})}return{get firstHiddenTime(){return Cm},onHidden(e){xm.add(e)}}},Mm=(e,t=-1,i,s=0,n,r,o)=>{const a=hm(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>ym()?a&&(document.prerendering||km()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Pm=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},Fm=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Rm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Lm=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Am=class{constructor(){this.u=void 0}};const Om=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},$m=[1800,3e3],Dm=(e,t={})=>{const i=Fm(t);Om(()=>{const s=vm(t,Am),n=Tm();let r,o=Mm("FCP");const a=Pm(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-km(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=Sm(e,o,$m,t.reportAllChanges),bm(i=>{o=Mm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,ym()),r=Sm(e,o,$m,t.reportAllChanges),wm(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Pm(["soft-navigation"],i=>{i.forEach(i=>{s.u&&i.navigationId&&Rm(s.u,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Mm("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Sm(e,o,$m,t.reportAllChanges),r(!0)})},t)})},Nm=[.1,.25],Bm=e=>e.find(e=>{var t;return 1===(null===(t=e.node)||void 0===t?void 0:t.nodeType)})||e[0],qm=(e,t={})=>{const i=vm(t=Object.assign({},t),dm),s=new WeakMap;i.t=e=>{var i;if(null==e||null===(i=e.sources)||void 0===i?void 0:i.length){const i=Bm(e.sources),o=null==i?void 0:i.node;if(o){var n,r;const e=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,o))&&void 0!==n?n:gm(o);s.set(i,e)}}},((e,t={})=>{const i=Tm();Dm(Lm(()=>{let s,n=Mm("CLS",0);const r=vm(t,dm),o=(i,o,a,l,c)=>{n=Mm("CLS",0,i,o,a,l,c),r.o=0,s=Sm(e,n,Nm,t.reportAllChanges)},a=(e=!1)=>{r.o>n.value&&(n.value=r.o,n.entries=r.i),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.l(t):l(t);a()},u=["layout-shift"];Fm(t)&&u.push("soft-navigation");const d=Pm(u,c);d&&(s=Sm(e,n,Nm,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),bm(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,ym()),wm(s)}),setTimeout(s))}))})(t=>{e((e=>{let t={};if(e.entries.length){var i;const n=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null==n||null===(i=n.sources)||void 0===i?void 0:i.length){const e=Bm(n.sources);e&&(t={largestShiftTarget:s.get(e),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:e,largestShiftEntry:n,loadState:pm(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Hm=(e,t={})=>{const i=vm(t=Object.assign({},t),Am);Fm(t)&&(i.u=new Map),Dm(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:pm(ym())};if("soft-navigation"!==e.navigationType){if(e.entries.length){const i=hm(),s=e.entries.at(-1);if(i){const n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:pm(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}else{var s;const n=null===(s=i.u)||void 0===s?void 0:s.get(e.navigationId);n&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:n})}return Object.assign(e,{attribution:t})})(t))},t)};let Wm=0,zm=1/0,Um=0;const jm=e=>{for(const t of e)t.interactionId&&(zm=Math.min(zm,t.interactionId),Um=Math.max(Um,t.interactionId),Wm=Um?(Um-zm)/7+1:0)};let Vm;const Gm=()=>{var e;return Vm?Wm:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var Qm=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Gm()-this.h}D(){this.h=Gm(),this.v.length=0,this.p.clear()}S(e){const t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if(null===(t=this.m)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.p.get(e.interactionId);if(s||10>this.v.length||e.duration>i.k){var n;if(s?e.duration>s.k?(s.entries=[e],s.k=e.duration):e.duration===s.k&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],k:e.duration},this.p.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.p.delete(t.id)}null===(n=this.M)||void 0===n||n.call(this,s)}}};const Km=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Lm(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},Zm=[200,500],Jm=(e,t={})=>{const i=vm(t=Object.assign({},t),Qm);let s=[],n=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const c=()=>{l||(Km(u),l=!0)},u=()=>{const e=new Set(i.v.map(e=>o.get(e.entries[0]))),t=n.length-10;n=n.filter((i,s)=>s>=t||e.has(i));const a=new Set;for(const e of n){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}s=s.filter(e=>e.startTime>r||a.has(e)),l=!1};i.m=e=>{const i=e.startTime+e.duration;let s;r=Math.max(r,e.processingEnd);for(let r=n.length-1;r>=0;r--){const o=n[r];if(8>=Math.abs(i-o.renderTime)){s=o,s.startTime=Math.min(e.startTime,s.startTime),s.processingStart=Math.min(e.processingStart,s.processingStart),s.processingEnd=Math.max(e.processingEnd,s.processingEnd),t.includeProcessedEventEntries&&s.entries.push(e);break}}s||(s={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]},n.push(s)),e.interactionId&&o.set(e,s),c()},i.M=e=>{if(!a.get(e)){var i;const o=null===(i=e.entries.find(e=>e.target))||void 0===i?void 0:i.target;if(o){var s,n;const i=null!==(s=null===(n=t.generateTarget)||void 0===n?void 0:n.call(t,o))&&void 0!==s?s:gm(o);a.set(e,i)}else{var r;const t=null===(r=e.entries.find(e=>e.targetSelector))||void 0===r?void 0:r.targetSelector;t&&a.set(e,t)}}};const d=(e,t)=>{const i=[];for(const n of s)if(n.startTime+n.duration>=e){if(n.startTime>t)break;i.push(n)}return i};Pm(["long-animation-frame"],e=>{s=s.concat(e),c()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Tm();Om(()=>{var s;"interactionCount"in performance||Vm||(Vm=Pm(["event"],jm,{durationThreshold:0}));let n,r=Mm("INP");const o=vm(t,Qm),a=(i,s,a,l,c)=>{o.D(),r=Mm("INP",-1,i,s,a,l,c),n=Sm(e,r,Zm,t.reportAllChanges)},l=()=>{const e=o.S(r.navigationType);e&&e.k!==r.value&&(r.value=e.k,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Km(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.l(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];Fm(t)&&d.push("soft-navigation");const h=Pm(d,u,ct(ct({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=Sm(e,r,Zm,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),bm(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,ym())}))})})(t=>{e((e=>{if(0===e.entries.length){const t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:pm(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}const t=e.entries[0],s=o.get(t),n=Math.max(s.processingStart,t.startTime),r=Math.max(t.startTime+t.duration,n),l=Math.min(s.processingEnd,r),c=s.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,l),h=i.p.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:n-t.startTime,processingDuration:l-n,presentationDelay:r-l,loadState:pm(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;const i=e.interactionTime,s=e.nextPaintTime;if(!(null===(t=e.longAnimationFrameEntries)||void 0===t?void 0:t.length)||!i||!s)return;const n=e.inputDelay,r=e.processingDuration;let o,a,l=0,c=0,u=0,d=0;for(const t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(const e of t.scripts){const t=e.startTime+e.duration;if(i>t)continue;const s=t-Math.max(i,e.startTime),u=e.duration?s/e.duration*e.forcedStyleAndLayoutDuration:0;l+=s-u,c+=u,s>d&&(a=i+n>e.startTime?"input-delay":i+n+r>e.startTime?"processing-duration":"presentation-delay",o=e,d=s)}}const h=e.longAnimationFrameEntries.at(-1),p=h?h.startTime+h.duration:0;p>=i+n+r&&(u=s-p),o&&a&&(e.longestScript={entry:o,subpart:a,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=u,e.totalUnattributedDuration=s-i-l-c-u})(p),Object.assign(e,{attribution:p})})(t))},t)};var Xm=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null===(t=this.m)||void 0===t||t.call(this,e)}};const $=[2500,4e3];let Ym=50;const ey=[];Pm(["resource"],e=>{for(const t of e)ey.push(t),ey.length>Ym&&ey.shift()});const ty=(e,t={})=>{null!=(t=Object.assign({},t)).resourceBufferSize&&(Ym=t.resourceBufferSize);const i=vm(t,Xm),s=new WeakMap;Fm(t)&&(i.u=new Map),i.m=e=>{const i=e.element;if(i){var n,r;const o=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,i))&&void 0!==n?n:gm(i);s.set(e,o)}else e.id&&s.set(e,`#${e.id}`)},((e,t={})=>{let i=!1;const s=Fm(t);Om(()=>{let n,r=Tm(),o=Mm("LCP");const a=vm(t,Xm),l=(s,a,l,c,u)=>{o=Mm("LCP",-1,s,a,l,c,u),n=Sm(e,o,$,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=Tm(!0))},c=e=>{var t;a.u&&e.navigationId&&Rm(a.u,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-km(),0),a.l(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.l(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=Pm(d,u);if(h){n=Sm(e,o,$,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;Km(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});bm(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,ym()),n=Sm(e,o,$,t.reportAllChanges),wm(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n,r,o;const a=e.entries.at(-1),l=a.url&&(ey.findLast(e=>e.name===a.url)||performance.getEntriesByType("resource").findLast(e=>e.name===a.url));let c;t.target=s.get(a),t.lcpEntry=a,a.url&&(t.url=a.url),l&&(t.lcpResourceEntry=l);let u=0,d=0;if("soft-navigation"!==e.navigationType?(c=hm(),u=null!==(n=null==c?void 0:c.activationStart)&&void 0!==n?n:0,d=null!==(r=null==c?void 0:c.responseStart)&&void 0!==r?r:0):(u=e.navigationStartTime||0,c=null===(o=i.u)||void 0===o?void 0:o.get(e.navigationId)),c){const i=Math.max(0,d-u),s=Math.max(i,l?(l.requestStart||l.startTime)-u:0),n=Math.min(e.value,Math.max(s,l?l.responseEnd-u:0));t=ct(ct({},t),{},{timeToFirstByte:i,resourceLoadDelay:s-i,resourceLoadDuration:n-s,elementRenderDelay:e.value-n,navigationEntry:c})}}return Object.assign(e,{attribution:t})})(t))},t)};let iy=-1;const sy=()=>iy,ny=e=>{addEventListener("pageshow",t=>{t.persisted&&(iy=t.timeStamp,e(t))},!0)},ry=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},oy=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ay=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ly=()=>{var e,t;return null!==(e=null===(t=ay())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let cy=-1;const uy=new Set,dy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,hy=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of uy)e();isFinite(cy)||(cy="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",hy,!0))}},py=(e=!1)=>{if(e&&(cy=1/0),0>cy){var t;const e=ly(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;cy=null!=i?i:dy(),addEventListener("visibilitychange",hy,!0),addEventListener("prerenderingchange",hy,!0),ny(()=>{setTimeout(()=>{cy=dy()})})}return{get firstHiddenTime(){return cy},onHidden(e){uy.add(e)}}},_y=(e,t=-1,i,s=0,n,r,o)=>{const a=ay(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>sy()?a&&(document.prerendering||ly()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},gy=new WeakMap;function fy(e,t){let i=gy.get(t);return i||(i=new WeakMap,gy.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var vy=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;const i=this.o[0],s=this.o.at(-1);this.i&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const my=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(ct({type:t,buffered:!0},i));return e}}catch(e){}},yy=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},by=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Sy=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var wy=class{constructor(){this.l=void 0}};const ky=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Cy=[1800,3e3],xy=(e,t={})=>{const i=yy(t);ky(()=>{const s=fy(t,wy),n=py();let r,o=_y("FCP");const a=my(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-ly(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=ry(e,o,Cy,t.reportAllChanges),ny(i=>{o=_y("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,sy()),r=ry(e,o,Cy,t.reportAllChanges),oy(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&my(["soft-navigation"],i=>{i.forEach(i=>{s.l&&i.navigationId&&by(s.l,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=_y("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=ry(e,o,Cy,t.reportAllChanges),r(!0)})},t)})},Iy=[.1,.25],Ey=(e,t={})=>{const i=py();xy(Sy(()=>{let s,n=_y("CLS",0);const r=fy(t,vy),o=(i,o,a,l,c)=>{n=_y("CLS",0,i,o,a,l,c),r.i=0,s=ry(e,n,Iy,t.reportAllChanges)},a=(e=!1)=>{r.i>n.value&&(n.value=r.i,n.entries=r.o),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.h(t):l(t);a()},u=["layout-shift"];yy(t)&&u.push("soft-navigation");const d=my(u,c);d&&(s=ry(e,n,Iy,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),ny(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,sy()),oy(s)}),setTimeout(s))}))};let Ty=0,My=1/0,Py=0;const Fy=e=>{for(const t of e)t.interactionId&&(My=Math.min(My,t.interactionId),Py=Math.max(Py,t.interactionId),Ty=Py?(Py-My)/7+1:0)};let Ry;const Ly=()=>{var e;return Ry?Ty:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var Ay=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Ly()-this.u}M(){this.u=Ly(),this.v.length=0,this.m.clear()}L(e){const t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if(null===(t=this.p)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.m.get(e.interactionId);if(s||10>this.v.length||e.duration>i.P){var n;if(s?e.duration>s.P?(s.entries=[e],s.P=e.duration):e.duration===s.P&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],P:e.duration},this.m.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}null===(n=this.T)||void 0===n||n.call(this,s)}}};const Oy=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Sy(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},$y=[200,500],Dy=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=py();ky(()=>{var s;"interactionCount"in performance||Ry||(Ry=my(["event"],Fy,{durationThreshold:0}));let n,r=_y("INP");const o=fy(t,Ay),a=(i,s,a,l,c)=>{o.M(),r=_y("INP",-1,i,s,a,l,c),n=ry(e,r,$y,t.reportAllChanges)},l=()=>{const e=o.L(r.navigationType);e&&e.P!==r.value&&(r.value=e.P,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{Oy(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];yy(t)&&d.push("soft-navigation");const h=my(d,u,ct(ct({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=ry(e,r,$y,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),ny(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,sy())}))})};var Ny=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null===(t=this.p)||void 0===t||t.call(this,e)}};const By=[2500,4e3],qy=(e,t={})=>{let i=!1;const s=yy(t);ky(()=>{let n,r=py(),o=_y("LCP");const a=fy(t,Ny),l=(s,a,l,c,u)=>{o=_y("LCP",-1,s,a,l,c,u),n=ry(e,o,By,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=py(!0))},c=e=>{var t;a.l&&e.navigationId&&by(a.l,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-ly(),0),a.h(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.h(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=my(d,u);if(h){n=ry(e,o,By,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;Oy(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});ny(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,sy()),n=ry(e,o,By,t.reportAllChanges),oy(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})},Hy={onLCP:ty,onCLS:qm,onFCP:Hm,onINP:Jm,withoutAttribution:{onLCP:qy,onCLS:Ey,onFCP:xy,onINP:Dy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Hy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Hy,h.postHogWebVitalsCallbacks=Hy;const Wy={onLCP:qy,onCLS:Ey,onFCP:xy,onINP:Dy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Wy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Wy,h.postHogWebVitalsCallbacks=Wy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Wy;const zy={onLCP:ty,onCLS:qm,onFCP:Hm,onINP:Jm,withoutAttribution:{onLCP:qy,onCLS:Ey,onFCP:xy,onINP:Dy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=zy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=zy,h.postHogWebVitalsCallbacks=zy;const Uy={onLCP:qy,onCLS:Ey,onFCP:xy,onINP:Dy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Uy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Uy,h.postHogWebVitalsCallbacks=Uy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Uy;var jy=class{constructor(e){this.disabled=!1===e;const t=xt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const Vy="$copy_autocapture",Gy=Gn("[AutoCapture]");function Qy(e,t){return t.length>e?t.slice(0,e)+"...":t}function Ky(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!vr(t));return t}function Zy(t,{e:i,maskAllElementAttributes:s,maskAllText:n,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,c;if(!vr(t))return{props:{}};const u=[t],d=new Set([t]);let h=t;for(;h.parentNode&&!mr(h,"body")&&1e3>u.length;){if(br(h.parentNode)){const e=h.parentNode.host;if(d.has(e))break;d.add(e),u.push(e),h=e;continue}if(!vr(h.parentNode))break;if(d.has(h.parentNode))break;d.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(e=>mr(e,"button")||mr(e,"a")):-1;p>0&&(n=n||u.slice(0,p+1).some(e=>!Wr(e)||zr(e)));const _=[],g={};let f,v=!1,m=!1;if(Kn(u,e=>{const t=Wr(e);if(mr(e,"a")&&!s&&!(null==r?void 0:r.includes("href"))){const i=e.getAttribute("href");v=!!(t&&i&&Jr(i))&&(a?ls(i):i)}ft(kr(e),"ph-no-capture")&&(m=!0),_.push(function(e,t,i,s,n=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};Er.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Qy(1024,Xr(e)):Qy(1024,xr(e)));const a=kr(e);t||(null==s?void 0:s.includes("class"))||0>=a.length||(o.classes=a.filter(function(e){return""!==e})),Kn(e.attributes,function(i){var r;if((!zr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&Jr(i.value)&&(!Tt(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=Sr(e).join(" ")),o["attr__"+i.name]=Qy(1024,"href"===i.name&&n?ls(e):e)}});let l=1,c=1,u=e;for(;u=Ky(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(e,s,n,r,a)),Kn(function(e){if(!Wr(e))return{};const t={};return Kn(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&Jr(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(g,t)||(g[t]=e)})}),m)return{props:{},explicitNoCapture:m};if(p>0&&(t=u[p],_.splice(0,p)),n||(_[0].$el_text=mr(t,"a")||mr(t,"button")?Xr(t):xr(t)),v){var y,b;_[0].attr__href=v;const t=null===(y=ar(v))||void 0===y?void 0:y.host,i=null==e||null===(b=e.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(f=v)}return{props:Zn((w=i.type,{$event_type:w,$ce_version:1}),o?{}:{$elements:_},{$elements_chain:(S=_,kt(S)?function(e){return e.map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)s+=`.${t.replace(/"/g,"")}`}const n=ct(ct(ct(ct({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return Jn(n).sort(([e],[t])=>function(e,t){return t>e?-1:e>t?1:0}(e,t)).forEach(([e,t])=>r[eo(e.toString())]=eo(t.toString())),s+=":",s+=Jn(r).map(([e,t])=>`${e}="${t}"`).join(""),s}).join(";")}(function(e){return e.map(e=>{var t,i;const s={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:to(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Jn(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),s})}(S)):"")},(null===(l=_[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(c=_[0])||void 0===c?void 0:c.$el_text}:{},f&&"click"===i.type?{$external_click_url:f}:{},g),target:t};var S,w}var Jy=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!Wr(e))return!0;const i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:Fr,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const e=n,t=kr(e);if(ft(t,"ph-no-capture")||ft(t,"ph-sensitive")||zr(e)||i.some(t=>Tr(e,t)))return!0;const r=n.parentNode;n=br(r)?r.host:r&&vr(r)?r:null}return!1}_trackPointer(e){if(!this.isEnabled||"pointercancel"===e.type)return void this._clearPointer();if("pointerdown"===e.type){this._clearPointer();const i=Ir(e);var t;return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&vr(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this._client)||void 0===t?void 0:t.distinctId}))}const i=this._pointerDown;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():"pointerup"===e.type&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;const i=this._pointerDown;this._clearPointer();const n=Ir(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this._client)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&n&&(mr(n,"html")||mr(n,"body"))){var r;if(i.excluded)return null;const e=null!==(r=this._refreshConfig().css_selector_ignorelist)&&void 0!==r?r:Fr;return[n,null==s?void 0:s.documentElement,null==s?void 0:s.body].some(t=>{if(!t)return!1;const i=kr(t);return ft(i,"ph-no-capture")||ft(i,"ph-sensitive")||!Wr(t)||zr(t)||e.some(e=>Tr(t,e))})?null:i.target}}constructor(e){this._configSource=e,this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new jy(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null===(e=this._config.url_allowlist)||void 0===e?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null===(t=this._config.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){if(!this.isBrowserSupported())return void Gy.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!s)return;const t=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{if("blur"===t.type)return void this._clearPointer();if(0===t.type.indexOf("pointer"))return void this._trackPointer(t);const e="click"===t.type?this._recoverClickTarget(t):void 0;if(Pt(e))return;this._captureEvent(t,"$autocapture",e)}catch(e){Gy.error("Failed to capture event",e)}};if(sr(e,"blur",t),sr(s,"submit",t,{capture:!0}),sr(s,"change",t,{capture:!0}),sr(s,"click",t,{capture:!0}),Kn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{sr(s,e,t,{capture:!0})}),this._refreshConfig().capture_copied_text){const t=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,Vy)}catch(e){Gy.error("Failed to capture clipboard event",e)}};sr(s,"copy",t,{capture:!0}),sr(s,"cut",t,{capture:!0}),sr(s,"paste",t,{capture:!0})}}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(null==e||e.removeEventListener("blur",this._domEventHandler),Kn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==s||s.removeEventListener(e,this._domEventHandler,!0)}),null==s||s.removeEventListener("submit",this._domEventHandler,!0),null==s||s.removeEventListener("change",this._domEventHandler,!0),null==s||s.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==s||s.removeEventListener("copy",this._copiedTextHandler,!0),null==s||s.removeEventListener("cut",this._copiedTextHandler,!0),null==s||s.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(this._disposed)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;At(i)&&(null===(s=this._client)||void 0===s||s.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e,t){var i;const n=[];return null===(i=this._elementSelectors)||void 0===i||i.forEach(i=>{const r=null==s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{e!==s&&t!==s||ft(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this._disposed)return!1;const i=null===(e=this._client)||void 0===e?void 0:e.kv.get(C),s=this._isDisabledServerSide,n=this._refreshConfig();if(!n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;const r=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(Pt(s)&&!At(i)&&!r)return!1;const o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!n.enabled&&!o}_captureEvent(t,i="$autocapture",s){if(!this.isEnabled)return void this._clearPointer();let n=s||Ir(t);yr(n)&&(n=n.parentNode||null);const r=this._compileUrlPatterns();var o;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Br(n,r.rageclick)&&this._captureEvent(t,"$rageclick",s);const a=i===Vy,l=a?ct(ct({},r),{},{dom_event_allowlist:void 0}):r;if(n&&function(t,i,s,n,r,o){var a;if(!e||qr(t))return!1;if((null==s?void 0:s.url_allowlist)&&!wr(s.url_allowlist,o))return!1;if((null==s?void 0:s.url_ignorelist)&&wr(s.url_ignorelist,o))return!1;if(null==s?void 0:s.dom_event_allowlist){const e=s.dom_event_allowlist;if(e&&!e.some(e=>i.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=Hr(t,n);if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(Et(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,s))return!1;if(!Mr(c,null==s?void 0:s.css_selector_allowlist))return!1;if(Mr(c,null!==(a=null==s?void 0:s.css_selector_ignorelist)&&void 0!==a?a:Fr))return!1;try{const s=e.getComputedStyle(t);if(s&&"pointer"===s.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(e){}const u=t.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return l?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Er.indexOf(u)>-1||"true"===t.getAttribute("contenteditable"))}}(n,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:s,explicitNoCapture:o,target:a}=Zy(n,{e:t,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(n,a);if(l&&l.length>0&&(s.$element_selectors=l),i===Vy){const i=t.type||"clipboard";if("paste"!==i){var u,d;const t=null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString(),i=Cr(t);if(!i)return!1;s.$selected_content=i,s.$clipboard_text_length=null!==(d=null==t?void 0:t.length)&&void 0!==d?d:0}s.$copy_type=i}return null===(c=this._client)||void 0===c||c.capture(i,s).catch(e=>Gy.error("Failed to capture event",e)),!0}}isBrowserSupported(){return Ct(null==s?void 0:s.querySelectorAll)}};const Xy={};function Yy(e,t){const i=Ir(e);return i?ct({node:i,originalEvent:e,timestamp:Date.now()},t):null}function eb(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function tb(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}const ib="canvas,video,audio,embed,object";function sb(e,t){return Rt(e)&&e>=t}function nb(e,t=1e3){return e>=0&&t>e?e:void 0}function rb(e,t,i=1e3){return Rt(t)?nb(e-t,i):void 0}var ob=class{_asRequiredConfig(e){var t,i,s,n,r,o,a,l;const c=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==e?void 0:e.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(s=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==s?s:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:c.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._hadSelection=!1,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=e=>{if(this._clearMouseSelection(),0===e.button){const t={path:e.composedPath(),trusted:e.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==s?void 0:s.getSelection();t.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._selectionTouchesGesture(i,t),this._mouseSelection=t}},this._onMouseOut=e=>{Pt(e.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=e=>{const t=this._mouseSelection,i=e;if(!t||0!==i.button||e.isTrusted!==t.trusted)return;const s=e.composedPath();for(const e of t.path)if(vr(e)&&-1!==s.indexOf(e)){t.clickTarget=e;break}t.clickDetail=i.detail,this._mouseSelectionTimer=h.setTimeout(this._clearMouseSelection,0)},this._onClick=e=>{const t=e,i=Yy(t,{type:"click"}),s=this._mouseSelection;i&&s&&0===t.button&&t.detail>0&&t.detail===s.clickDetail&&e.isTrusted===s.trusted&&i.node===s.clickTarget&&(i.selectionChangedDuringGesture=s.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),Pt(i)||this._ignore(i)||this._queueCandidate(i),this._scheduleCheck()},this._onScroll=()=>{const e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{Et(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=e=>{var t,i;const n=null==s?void 0:s.getSelection(),r=this._hadSelection;this._hadSelection="Range"===(null==n?void 0:n.type);const o=null==n?void 0:n.focusNode,a=o&&(vr(o)?o:o.parentElement),l=null==s?void 0:s.activeElement;let c=l;for(;null==c||null===(t=c.shadowRoot)||void 0===t?void 0:t.activeElement;)c=c.shadowRoot.activeElement;const u=Nr(Ir(e))||Nr(null!=a?a:null)||Nr(null!==(i=c)&&void 0!==i?i:null),d="Caret"===(null==n?void 0:n.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this._hadSelection||u||d))return;const h=Date.now();this._lastSelectionChanged=h;const p=this._mouseSelection;if(p&&(r||this._hadSelection||u)){const t=Ir(e);let i;if(Nr(t))i=t;else if("Caret"===(null==n?void 0:n.type)){var _;Nr(null!==(_=c)&&void 0!==_?_:null)||d?i=c:u&&(i=a)}const s=i?this._selectionIsInGesture(i,p):n&&(o||n.anchorNode)?this._selectionTouchesGesture(n,p):r&&!this._hadSelection&&p.selectionInitiallyRelated;p.selectionChanged=p.selectionChanged||s}this._clicks.forEach(e=>{const t=h-e.timestamp;0>t||!Et(e.selectionChangedDelayMs)&&t>=e.selectionChangedDelayMs||(e.selectionChangedDelayMs=t)})},this._onVisibilityChange=()=>{"hidden"===(null==s?void 0:s.visibilityState)&&this._clearMouseSelection();const e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{const e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{const t=e.touches,i=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t;const i=this._touchStart;if(this._touchStart=void 0,Et(i)||this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)return;const n=e,r=null===(t=n.changedTouches)||void 0===t?void 0:t[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,c=this._config.swipe_threshold_px;if(c*c>l)return;if([this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>Rt(e)&&e>=i.timestamp))return;var u,d;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==s||null===(d=s.elementsFromPoint)||void 0===d?void 0:d.call(s,i.x,i.y))&&void 0!==u?u:[]).some(e=>{var t;return null===(t=e.matches)||void 0===t?void 0:t.call(e,ib)}))return;const h=Yy(n,{type:"swipe",swipeDirection:eb(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Pt(h)||this._ignore(h)||this._queueCandidate(h),this._scheduleCheck()},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(t){if(!this._mutationObserver){const i=function(t){return function(t,i){const s=Xy[t];if(s)return s;let n=i[t];if((e=>Ct(e)&&-1!==e.toString().indexOf("[native code]"))(n)&&!(null==e?void 0:e.Zone))return Xy[t]=n.bind(i);const r=i.document;if(r&&Ct(r.createElement)){let e,s=!1;try{e=r.createElement("iframe"),e.hidden=!0,r.head.appendChild(e);const l=e.contentWindow;var o,a;l&&l[t]&&(n=l[t],"MutationObserver"===t&&function(e){return ft(e,"AppleWebKit")&&!ft(e,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(e.classList.add("rr-block","ph-no-capture"),s=!0))}catch(e){Vn.warn(`Could not create sandbox iframe for ${t} check, bailing to assignableWindow.${t}: `,e)}finally{!s&&(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)}}return n&&Ct(n)?Xy[t]=n.bind(i):n}("MutationObserver",t)}(h);this._mutationObserver=new i(e=>{this._onMutation(e)}),this._mutationObserver.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,h.removeEventListener("click",this._onClick,{capture:!0}),h.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),h.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),h.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),h.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),h.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),h.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),h.removeEventListener("scroll",this._onScroll,{capture:!0}),null==s||s.removeEventListener("selectionchange",this._onSelectionChange),h.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),h.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),h.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),h.removeEventListener("blur",this._onFocusChange),h.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){sr(h,"click",this._onClick,{capture:!0}),sr(h,"mousedown",this._onMouseDown,{capture:!0}),sr(h,"mouseup",this._onMouseUp,{capture:!0}),sr(h,"mouseout",this._onMouseOut,{capture:!0}),sr(h,"dragstart",this._clearMouseSelection,{capture:!0}),sr(h,"pointercancel",this._clearMouseSelection,{capture:!0}),sr(h,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=rb(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=rb(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=rb(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Et(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){sr(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection="Range"===(null==s||null===(e=s.getSelection())||void 0===e?void 0:e.type),sr(s,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){const i=t.path[0];for(;e;){if(-1!==t.path.indexOf(e)||vr(i)&&i.contains(e))return!0;e=e.getRootNode().host}return!1}_selectionTouchesGesture(e,t){const i=t.path[0],s=e.rangeCount>0?e.getRangeAt(0):void 0;if(s&&vr(i)&&s.startContainer.getRootNode()===i.getRootNode()){var n;if(!s.collapsed)return s.intersectsNode(i);const e=vr(s.startContainer)&&null!==(n=s.startContainer.childNodes[s.startOffset])&&void 0!==n?n:s.startContainer;return this._selectionIsInGesture(e,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){sr(s,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){sr(h,"blur",this._onFocusChange),sr(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>{const s=nb(t-i.timestamp);Rt(s)&&(Et(i[e])||i[e]>s)&&(i[e]=s)})}_startSwipeObserver(){sr(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),sr(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),sr(h,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){const e=Et(this._surfacesCheckedAt)||Rt(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Et(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!(null==s?void 0:s.querySelector(ib))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){return!(!fr(t.node)&&!this._clicks.some(e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!mr(t.node,"html")&&vr(t.node)&&function(t,i){var s;if(!e||qr(t))return!1;const n=At(i)?Or:null!==(s=null==i?void 0:i.css_selector_ignorelist)&&void 0!==s?s:Or,{targetElementList:r}=Hr(t,!1);return!Mr(r,n)}(t.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(t){return!(this._config.capture_clicks_with_modifier_keys||(i=t.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this._ignoreCommon(t)||function(t){if(!e||qr(t))return!1;const{targetElementList:i}=Hr(t,!1);return i.some(e=>mr(e,"a"))}(t.node);var i}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const i of e){var t;i.mutationDelayMs=null!==(t=i.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const e=sb(i.scrollDelayMs,this._config.scroll_threshold_ms),s=sb(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=sb(i.mutationDelayMs,this._config.mutation_threshold_ms),r=sb(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),o=Rt(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,a=Rt(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Rt(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,c=Rt(i.visibilityChangedDelayMs),u=Rt(i.focusChangedDelayMs);if(!(o||a||l||c||u))if(e||n||r||s){const t=tb(i);if("$dead_swipe"===t){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${t}_last_mutation_timestamp`]:this._lastMutation,[`${t}_event_timestamp`]:i.timestamp,[`${t}_scroll_timeout`]:e,[`${t}_mutation_timeout`]:n,[`${t}_absolute_timeout`]:r,[`${t}_selection_changed_timeout`]:s,[`${t}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){const i=tb(e);this.instance.capture(i,ct(ct(ct({},t),Zy(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new ob(e,t);var ab=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){const e=this._storage._get(this._storageKey);return Ut(e)?1:ft(jt,e)?0:-1}get _storage(){const e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Da:Oa,i=t._is_supported()?t:Ka;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;const t="localStorage"===e?Oa:Da;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ut(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(e=>Ut(e))}};const lb=Gn("[Dead Clicks]"),cb=()=>!0,ub=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(P)),s=e.instance.config.capture_dead_clicks;return At(s)?s:!!xt(s)||i};var db=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[P]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?lb.error("failed to load script",t):e()})}_start(){var e;if(s){if(!this._lazyLoadedDeadClicksAutocapture&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=xt(this.instance.config.capture_dead_clicks)?ct({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(s),lb.info("starting...")}}else lb.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,lb.info("stopping..."))}};const hb=Gn("[SegmentIntegration]");function pb(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:r}=(e=>Ct(e.register))(o=s)?{analytics:o}:o;var o;!function(e,t,i,s){const n=t=>{const n=()=>t.anonymousId()||Pa();e.config.get_device_id=n,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:n()}),e.persistence.set_property(Ie,Ze)),i(s?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&Ct(r.then)?r.then(n):n(r)}(e,n,i=>{n.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||hb.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=!!t&&s.event.anonymousId===t&&!s.event.userId;r||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(hb.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(hb.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));let o=e.calculateEventProperties(n,s.event.properties);if(!Ft(i)){const e=s.event.properties||{},t={};for(const i of Object.keys(o))St.call(e,i)||(t[i]=o[i]);const n=((e,t)=>{const i=kt(e)?e:[e];let s=ct({},t);for(const e of i)try{if(s=e(s),Ft(s))return null}catch(e){return hb.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(Ft(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(e){return s(e,e.event.event)},page(e){return s(e,et)},identify(e){return s(e,it)},screen(e){return s(e,"$screen")}}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{hb.error("Failed to register the Segment integration",e),t()})},i)}const _b="posthog-js";function gb(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==n&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],_=p.map(e=>ct(ct({},e),{},{stacktrace:e.stacktrace?ct(ct({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>ct(ct({},e),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var f;return t&&i&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(f=e.exceptions)||void 0===f||f.sendExceptionEvent(g)),o}}var fb=class{constructor(e,t,i,s,n,r){this.name=_b,this.setupOnce=function(o){o(gb(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},vb=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Vn.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null===(e=this._unsubscribeSessionId)||void 0===e||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,i){var s;const n=this._previousPageViewProperties(t,i);return this._currentPageview={pathname:null!==(s=null==e?void 0:e.location.pathname)&&void 0!==s?s:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){const i=this._currentPageview;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=n;if(!(Et(e)||Et(t)||Et(i)||Et(r)||Et(o)||Et(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const n=e>1?Qt(t/e,0,1,Vn):1,l=e>1?Qt(i/e,0,1,Vn):1,c=r>1?Qt(o/r,0,1,Vn):1,u=r>1?Qt(a/r,0,1,Vn):1;s=Zn(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};const mb=["flags","surveys"],yb={[p]:{exposure:"hidden"},[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[k]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"hidden"},[R]:{exposure:"hidden"},[I]:{exposure:"event"},[E]:{exposure:"hidden"},[T]:{exposure:"event"},[M]:{exposure:"event"},[P]:{exposure:"event"},[F]:{exposure:"hidden"},[L]:{exposure:"event"},[A]:{exposure:"hidden"},[O]:{exposure:"hidden"},[W]:{exposure:"hidden"},[z]:{exposure:"event"},[D]:{exposure:"event",shouldSkipFromEventProperties:e=>Pt(e)},[U]:{exposure:"event"},[j]:{exposure:"event"},[V]:{exposure:"event"},[Z]:{exposure:"event"},[J]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden",storageGroup:"flags"},[ee]:{exposure:"hidden"},[te]:{exposure:"hidden",storageGroup:"flags"},[ie]:{exposure:"hidden",storageGroup:"flags"},[se]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ne]:{exposure:"hidden",storageGroup:"flags"},[re]:{exposure:"hidden"},[oe]:{exposure:"hidden"},[ae]:{exposure:"hidden"},[le]:{exposure:"hidden"},[ue]:{exposure:"hidden",storageGroup:"surveys"},[de]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[he]:{exposure:"event"},[pe]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[ge]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[ve]:{exposure:"hidden"},[me]:{exposure:"event"},[ye]:{exposure:"event"},[be]:{exposure:"event"},[Se]:{exposure:"event"},[we]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[ce]:{exposure:"event"},[Ce]:{exposure:"hidden"},[xe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[Fe]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[N]:{exposure:"event"},[B]:{exposure:"event"},[q]:{exposure:"event"},[H]:{exposure:"event"},[Oe]:{exposure:"event"},[$e]:{exposure:"event"},[De]:{exposure:"event"},[Ne]:{exposure:"event"},[Be]:{exposure:"event"},[qe]:{exposure:"event"},[He]:{exposure:"event"},[We]:{exposure:"event"},[ze]:{exposure:"event"},[Ue]:{exposure:"event"},[Ge]:{exposure:"event"}},bb=[[G,{exposure:"hidden"}],[Q,{exposure:"hidden"}],[K,{exposure:"hidden"}]],Sb=e=>{const t=yb[e];if(t)return t;for(const[t,i]of bb)if(0===e.indexOf(t))return i},wb={flags:xe,surveys:de},kb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Cb=e=>`${e}_cookie_identity_change_pending`,xb=e=>{let t="",i=0;for(const s of e){const e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},Ib="main",Eb=[X,Y,te,ie,se,xe,ne,ae],Tb=e=>-1!==Eb.indexOf(e),Mb=[b,w],Pb=e=>-1!==Mb.indexOf(e),Fb=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Rb=e=>{if(!e)return{};const t=JSON.parse(e);return xt(t)?t:{}},Lb=(e,t)=>{Kn(e,(i,s)=>{const n=Sb(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};var Ab=class{constructor(t,i,s=!0){if(this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._metaIdentifierChangePending=new Set,this._crossTabFeatureFlagHandlers=new Set,this._config=t,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{let t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(t),this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&Vn.info("Persistence loaded",t.persistence,ct({},this.props)),this.update_config(t,t,i),this.save(),e){const t=()=>this.flush();sr(e,"beforeunload",t,{capture:!1}),sr(e,"pagehide",t,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){const e=mb.find(e=>t.key===this._groupEntryName(e));e&&this._syncCrossTabFeatureFlagProperties(t.key,e)}}else this._syncCrossTabFeatureFlagProperties(t.key,Ib)},sr(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!Tb(e)||!0===i)return;if(!0===t)return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this._setCrossTabFeatureFlagChangesPending(e,s)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let s,n;try{if(n=Da._get(e),Pt(n)){const e=this._slotWriteState(t);return e.storageValue=null,t!==Ib&&(e.persisted=!1),!1}s=Rb(n)}catch(e){return!1}const r=t===Ib?s:Da._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;const o=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===Ib&&this._splitStorage&&!Fb(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,n),o}_hasCrossTabFeatureFlagIdentityMismatch(e){const t=this.props[_],i=e[_];return!Et(t)&&!Et(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){const n=this._slotWriteState(t);n.storageValue=s,t!==Ib&&(n.persisted=i);try{n.fingerprint=this._entryFingerprint(e,t)}catch(e){n.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let s=!1;return Eb.forEach(i=>{var n;const r=null===(n=Sb(i))||void 0===n?void 0:n.storageGroup;if(t===Ib&&this._splitStorage&&r||t!==Ib&&r!==t)return;const o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&Fb(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),s=!0)}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),s}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;const e=Da._get(this._name),t=this._slotWriteState(Ib);let i,s=!1,n=!1;if(e!==t.storageValue)if(Pt(e))t.storageValue=null;else{if(i=Rb(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;n=this._mergeCrossTabFeatureFlagProperties(i,Ib,!1),!this._splitStorage||Fb(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,Ib,!0,e):t.storageValue=e,s=!0}return this._splitStorage&&mb.forEach(e=>{const t=Da._get(this._groupEntryName(e)),r=this._slotWriteState(e),o=i||{},a=s&&Eb.some(t=>{var i;return(null===(i=Sb(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(Pt(t))return r.storageValue=null,r.persisted=!1,void(a&&(n=this._mergeCrossTabFeatureFlagProperties(o,e,!1)||n));const l=Rb(t);n=this._mergeCrossTabFeatureFlagProperties(l,e,!1)||n,this._rememberCrossTabStorageFingerprint(l,e,!0,t)}),n}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);const i=Sb(e);(null==i?void 0:i.volatile)||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||Ib).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Eb.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{const e=Da._get(this._name),t=Rb(e);this._slotWriteState(Ib).storageValue=e,Eb.forEach(e=>{var i;const s=this._splitStorage?null===(i=Sb(e))||void 0===i?void 0:i.storageGroup:void 0,n=s?Da._get(this._groupEntryName(s)):null;if(s){const e=this._slotWriteState(s);e.storageValue=n,e.persisted=!Pt(n)}const r=s&&!Pt(n)?Rb(n):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,r[e],this.props[e]):e in r&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const s=new Set(kt(t)?t:[]),n=new Set(kt(this.props[e])?this.props[e]:[]);return i.forEach(e=>n.has(e)?s.add(e):s.delete(e)),Array.from(s)}const s=xt(t)?ct({},t):{},n=xt(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in n?s[e]=n[e]:delete s[e]}),s}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!Tb(e))return;const s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0===s)return;let n=t;if(this._splitStorageEligible)try{var r;const t=this._splitStorage?null===(r=Sb(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this._groupEntryName(t):this._name;n=Rb(Da._get(i))[e]}catch(e){}const o=new Set(s||[]);if("$active_feature_flags"===e){if(!Et(t)&&!kt(t)||!Et(n)&&!kt(n)||!kt(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(t||[]),r=new Set(n||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!xt(i))return void(Fb(n,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!Et(t)&&!xt(t)||Et(t)&&It(i)&&Et(n))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=xt(t)?t:{},r=xt(n)?n:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&Fb(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&Fb(r[e],i[e])&&o.delete(e)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Rt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{const t=za(e,this._config.cookie_persisted_properties||[]),i=ja(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=Oa._get(this._name)||void 0;n&&Ga(this._name,n)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=n)}catch(e){}else try{const e=Oa._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=e?Ga(this._name,e):void 0,this._lastSeenMainCookieValue=e}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=Oa._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;const s=Ga(this._name,i);let n;try{n=Wa(JSON.parse(i))}catch(e){return!1}if((Oa._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=i;const r=Va(this._name,i),o=[...Ba,...r.properties],a={};if(Object.keys(n).forEach(e=>{const t=n[e];(Et(t)||Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete n[e])}),It(n))return!1;const l="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,c=this.props,u=c[_],d=c[Ie],h=Zn({},c);[...Ba,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in n)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===Ba.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Zn(h,n),Eb.forEach(e=>{const t=e in this.props;e in c===t&&Fb(c[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,c[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._setProp(Ie,Ke);const p=this.props[_],g=this.props[Ie];return!l||p===u&&g===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Ja._set(Cb(this._name),!0),this._deleteProp(ae),this._deleteProp(Y),this._deleteProp(X),this._deleteProp(te),this._deleteProp(ie),this._deleteProp(se),this._deleteProp(xe),this._deleteProp(Ce),this._deleteProp(we),"anonymous"!==g||"identified"!==d&&"anonymous"!==n.$user_state&&(Et(u)||p===u)||(Lb(this.props,n),this._deleteProp(le)),"identified"===g?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(v)),!0}consumeCookieIdentityChange(){const e=Cb(this._name),t=this._cookieIdentityChangePending||!!Ja._get(e);return this._cookieIdentityChangePending=!1,t&&Ja._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Ib],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===kb.indexOf(t.persistence.toLowerCase())&&(Vn.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1)=>{const s=[...Ba,...t];return ct(ct({},Da),{},{_parse(e){try{let n,r={};try{n=Oa._get(e)||void 0,r=n?Wa(JSON.parse(n)):{}}catch(e){}const o=JSON.parse(Da._get(e)||"{}");let a;if(i){const i=Va(e,n),l=[...Ba,...i.properties],c={};Object.keys(r).forEach(e=>{const t=r[e];Pt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var t;const e=o[_],n=null!==(t=o.$user_state)&&void 0!==t?t:Ke;s.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const t=o[e];(i.isValid||-1===Ba.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!u||"$user_state"in r||"$user_state"in o||(o[Ie]=Ke),!u||("distinct_id"in c?c[_]:o[_])===e&&("$user_state"in c?c[Ie]:o[Ie])===n||(Na.forEach(e=>delete o[e]),"identified"===c.$user_state&&"distinct_id"in c?o.$user_id=c[_]:delete o.$user_id,"identified"!==c.$user_state&&(delete o[ce],delete o[le]),delete o.__alias)}a=Zn(o,c)}else a=Zn(r,o);return Da._set(e,a),a}catch(e){}return null},_set(e,s,n,r,o,a){const l=Da._set(e,s,void 0,void 0,a);try{const c=za(s,t);if(Object.keys(c).length){if(i){const i=qa(e),u=ja(c,t);if(Oa._set(i,u,n,r,o,a),Oa._get(i)!==JSON.stringify(u)){Oa._remove(i,r);const t=za(s);return Oa._set(e,t,n,r,o,a),l}}Oa._set(e,c,n,r,o,a)}}catch(e){Da._error(e)}return l},_remove(t,i){try{null==e||e.localStorage.removeItem(t),Oa._remove(t,i),Oa._remove(qa(t),i)}catch(e){Da._error(e)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let s,n=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&Da._is_supported()?(s=Da,r=!0):"localstorage+cookie"===o&&i._is_supported()?(s=i,r=!0,n=!0):"sessionstorage"===o&&Ja._is_supported()?s=Ja:"memory"===o?s=Ka:"cookie"===o&&Oa._is_supported()?(s=Oa,n=!0):i._is_supported()?(s=i,r=!0,n=!0):Oa._is_supported()?(s=Oa,n=!0):s=Ka,this._splitStorageEligible=r,this._storesIdentityInCookie=n,s}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){const e={};return Kn(this.props,(t,i)=>{const s=Sb(i);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;const t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?Da._parse(this._name):null;let s={};if(t)try{s=Wa(Oa._parse(this._name)),Kn(s,(e,t)=>{(Et(e)||Pt(e)||""===e)&&delete s[t]})}catch(e){}const n=this._storage._parse(this._name);if(n&&(this.props=Zn({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var r,o;const e=null==i?void 0:i[_],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Ke,a=n[_],l=null!==(o=n.$user_state)&&void 0!==o?o:Ke;if(a!==e||l!==t){this._cookieIdentityChangePending=!0,Ja._set(Cb(this._name),!0);const i=Zn({},this.props);Na.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(Et(e)||a===e)||(Lb(i,s),delete i[le]),this.props=i;const n=new Set;Na.forEach(e=>{var t;const i=null===(t=Sb(e))||void 0===t?void 0:t.storageGroup;i&&n.add(i)}),n.forEach(e=>{const t={};Kn(this.props,(i,s)=>{var n;(null===(n=Sb(s))||void 0===n?void 0:n.storageGroup)===e&&(t[s]=i)}),It(t)?(Da._remove(this._groupEntryName(e)),this._slotState[e]={}):Da._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Ja._get(Cb(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(const e of mb){const t=Da._parse(this._groupEntryName(e));if(t&&!It(t)){const i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Zn(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=Sb(t))||void 0===i?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){const i=wb[e];if(!i)return!1;const s=t[i],n=this.props[i];return Rt(s)&&Rt(n)&&n>s}refreshKey(e){var t;if(this._disabled)return;if(this._metaIdentifierChangePending.has(e))return;const i=this._splitStorage?null===(t=Sb(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?Da._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){const t=this._storage._parse(this._name);if(t&&e in t)return void this._setProp(e,t[e],!1)}this._deleteProp(e,!1)}}save(){if(this._disabled)return;const e=this._saveDebounceMs();e>0?Et(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||Mb.forEach(e=>this.refreshKey(e)));const t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);const i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&Vn.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));const s=this._writeEntry(this._storage,this._name,this.props,Ib);"written"===s&&this._rememberCurrentCookieProperties(this.props),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear()),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}_writeNowSplit(){const{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,Ib);"written"===i&&this._rememberCurrentCookieProperties(e),"failed"!==i&&(this._localIdentityChangePending=!1,this._metaIdentifierChangePending.clear(),Eb.forEach(e=>{var t;(null===(t=Sb(e))||void 0===t?void 0:t.storageGroup)||this._pendingCrossTabFeatureFlagChanges.delete(e)}));for(const e of mb){var s;const i=t[e];if(It(i)&&!(null===(s=this._slotState[e])||void 0===s?void 0:s.persisted)){Eb.forEach(t=>{var i;(null===(i=Sb(t))||void 0===i?void 0:i.storageGroup)===e&&this._pendingCrossTabFeatureFlagChanges.delete(t)});continue}const n=this._writeEntry(Da,this._groupEntryName(e),i,e);"failed"!==n&&Eb.forEach(t=>{const i=Sb(t);(null==i?void 0:i.storageGroup)!==e||"written"!==n&&i.volatile||this._pendingCrossTabFeatureFlagChanges.delete(t)})}}_partitionProps(){const e={},t={flags:{},surveys:{}};return Kn(this.props,(i,s)=>{var n;const r=null===(n=Sb(s))||void 0===n?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Ib)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;const i={};return Kn(e,(e,t)=>{var s;i[t]=(null===(s=Sb(t))||void 0===s?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){const n=this._slotWriteState(s);if(s!==Ib&&!n.dirty&&!Et(n.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==Ib&&(n.persisted=!0),Et(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=Da._get(t)),"written"):(this._config.debug&&Vn.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(const e of mb)Da._remove(this._groupEntryName(e));e?delete this._slotState[Ib]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(xt(e)){this.syncCookieProperties(),Et(t)&&(t="None"),this._expire_days=Et(i)?this._default_expiry:i;let s=!1;if(Kn(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(xt(e)){this.syncCookieProperties(),this._expire_days=Et(t)?this._default_expiry:t;let i=!1;if(Kn(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||xt(t)||kt(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this._deleteProp(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==s?void 0:s.URL;if(e===this._campaign_params_url)return;const t=Ml(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!It(Yn(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register(function(){const e=null==s?void 0:s.referrer;return e?Fl(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:Ol(),$referring_domain:(null==s?void 0:s.referrer)&&(null===(e=ar(s.referrer))||void 0===e?void 0:e.host)||Al},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=$l(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Fe]:this._storesIdentityInCookie?{r:xb(e.r),u:e.u?xb(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Kn([Pe,Me],t=>{const i=this.props[t];i&&Kn(i,function(t,i){e["$initial_"+mt(i)]=t})});const t=this.props[Fe];if(t){const i=function(e,t=!1){const i=Dl(e,t),s={};return Kn(i,function(e,t){s[`$initial_${mt(t)}`]=e}),s}(t,this._config.disable_capture_url_hashes);Zn(e,i)}return e}safe_merge(e){return Kn(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(s||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(ct(ct({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();const u=this._resolveSplitStorage(e),d=r||u!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this._storage=c,this._splitStorage=u,this.props=e,this.save()}else o&&(this._storage=c,a||(delete this._slotState[Ib],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){const e=this.props[Fe];if(!this._storesIdentityInCookie||!xt(e)||"string"!=typeof e.r)return;const t=xb(e.r),i="string"==typeof e.u?xb(e.u):e.u;t===e.r&&i===e.u||this._setProp(Fe,ct(ct({},e),{},{r:t,u:i}))}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this._setProp(k,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return Et(i)||(delete t[e],this._setProp(k,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var s;const n=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||n===t||(this._localIdentityChangePending=!0),Pb(e)&&!Fb(n,t)&&this._metaIdentifierChangePending.add(e),this._markPendingCrossTabFeatureFlagChanges(e,n,t),(null===(s=Sb(e))||void 0===s?void 0:s.volatile)||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&(Tb(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),Pb(e)&&this._metaIdentifierChangePending.add(e),this._markGroupDirty(e))}_markGroupDirty(e){var t;const i=null===(t=Sb(e))||void 0===t?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};const Ob=Gn("[RateLimiter]");var $b=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Ob.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Ob.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(Rt(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this._captureWarning(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){const t=this.instance.config.property_denylist;return!kt(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&(null==n?void 0:n.pathname))return`${null!==(e=n.origin)&&void 0!==e?e:""}${n.pathname}`}_captureWarning(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} 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: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const Db=Gn("[RemoteConfig]");var Nb=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}_loadRemoteConfigJs(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Db.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Db.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Db.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){Db.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Db.warn("Failed to fetch remote config from PostHog."):Db.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Db.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){Db.error("Error loading feature flags",e)}}};const Bb=!!o||!!r,qb=new WeakMap,Hb="text/plain";let Wb=0,zb=!1;const Ub=(e,t)=>{const[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},jb=(e,t,i=!0)=>{var s;const[n,r]=e.split("?"),o=ct({},t),a=null!==(s=null==r?void 0:r.split("&").map(e=>{var t;const[s,n]=e.split("="),r=i&&null!==(t=o[s])&&void 0!==t?t:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],l=lr(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},Vb=e=>{if(e._encodedBody)return e._encodedBody;const{data:t,compression:i}=e;if(!t)return;if(i===dg){const e=ba(Sa(or(t)),{mtime:0});return{contentType:Hb,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===hg){const e=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(or(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:or(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const s=or(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},Gb=e=>{const t=()=>"sendBeacon"===e.transport?{url:jb(e.url,{compression:hg}),encodedBody:Vb(ct(ct({},e),{},{compression:hg,_encodedBody:void 0}))}:{url:Ub(e.url,"compression"),encodedBody:Vb(ct(ct({},e),{},{compression:void 0,_encodedBody:void 0}))};let i;try{i=Vb(e)}catch(i){if(cn(e.compression,cr(e.url,"compression")))return Vn.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&cn(e.compression,cr(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?ln(new Uint8Array(s)):ArrayBuffer.isView(s)&&ln(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(zb=!0,t()):{url:e.url,encodedBody:i};var s},Qb=e=>{try{return Gb(e)}catch(i){var t;return Vn.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},Kb=function(){var e=rt(function*(e){const t=yield fn(or(e.data),Xa.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return ct(ct({},e),{},{_encodedBody:{contentType:Hb,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Zb=/Failed to fetch|NetworkError|Load failed/i,Jb=e=>"TypeError"===(null==e?void 0:e.name)&&Zb.test((null==e?void 0:e.message)||""),Xb=e=>{try{const t=function(e,t=Date.now()){if("string"!=typeof e||!e)return;const i=e.trim(),s=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(s)){const e=1e3*Math.min(Number(s),300);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const n=/^\w{3} \w{3} /.test(s)?s+" GMT":s,r=Date.parse(n)-t;return Number.isFinite(r)&&r>0?Math.min(r,ss):void 0}(e());return Et(t)?void 0:Math.min(t,3e4)}catch(e){return}},Yb=e=>{const t=Qb(e);if(!t)return;const i=new o;qb.set(i,!0);const{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);const{contentType:r,body:a}=null!=n?n:{};Kn(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,s,Xb(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},eS=e=>{const t=Qb(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:n,body:o,estimatedSize:l}=null!=s?s:{},c=new Headers;Kn(e.headers,function(e,t){c.append(t,e)}),n&&c.append("Content-Type",n);let u=null,d=!1;if(a){const t=new a;u={signal:t.signal,timeout:setTimeout(()=>{d=!0;try{t.abort(as("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))}catch(e){p(e)}var i},e.timeout)}}let h=!1;const p=t=>{var i;h||(h=!0,d&&"AbortError"===(null==t?void 0:t.name)||Jb(t)?Vn.warn(t):Vn.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t}))};let _=0;const g=()=>{Wb-=_,_=0,u&&clearTimeout(u.timeout)};try{const t=ct({method:(null==e?void 0:e.method)||"GET",headers:c,referrerPolicy:"strict-origin",body:o,signal:null==u?void 0:u.signal},e.fetchOptions),s=null!=l?l:Et(o)?0:void 0;t.keepalive="POST"===t.method&&!e._keepaliveDisabled&&!1!==t.keepalive&&t.body===o&&!Et(s)&&s>=0&&52428.8>Wb+s,t.keepalive&&(_=s,Wb+=_),r(i,t).then(t=>t.text().then(i=>{var s;if(h)return;const n={statusCode:t.status,text:i};if(200===t.status)try{n.json=JSON.parse(i)}catch(e){Vn.error(e)}h=!0,g(),null===(s=e.callback)||void 0===s||s.call(e,n,Xb(()=>t.headers.get("Retry-After")))})).catch(e=>{g(),p(e)}).finally(g)}catch(e){g(),p(e)}},tS=e=>{try{var t;const{url:s,encodedBody:n}=Gb(e),{contentType:o,body:a,estimatedSize:l}=null!=n?n:{};if(!a)return;const c=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(s,c))return;const u=kt(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(kt(u)&&u.length>1&&(null!=l?l:0)>16384){const t=Math.ceil(u.length/2),i=t=>kt(e.data)?t:ct(ct({},e.data),{},{batch:t});return tS(ct(ct({},e),{},{data:i(u.slice(0,t))})),void tS(ct(ct({},e),{},{data:i(u.slice(t))}))}Vn.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?eS(ct(ct({},e),{},{_keepaliveDisabled:!0})):Yb(e)}catch(e){Vn.warn("Beacon send failed",e)}},iS=(e,t,i,s)=>{const n="query"===s?"POST"===t?"sent_at":"_":void 0;return jb(i===dg?Ub(e,"compression"):e,ct(ct({},n?{[n]:Date.now().toString()}:{}),i===dg?{}:{compression:i}))},sS=(()=>{const e=[];return r&&e.push({transport:"fetch",method:eS}),o&&e.push({transport:"XHR",method:Yb}),(null==i?void 0:i.sendBeacon)&&e.push({transport:"sendBeacon",method:tS}),e})();let nS=!Bb&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla"));function rS(e,t,i){var s,n,r;i&&(t=ct(ct({},t),{},{callback:e=>i(e)})),e.__loaded?nS?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null===(n=t.callback)||void 0===n||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=ct(ct({},e.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!==(s=e.compression)&&void 0!==s?s:t.compressionFallback:t.compression,(Et(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((e,t)=>{var i,s,n;const r=ct(ct({},e),{},{callback:null!=t?t:t=>{var i;return null===(i=e.callback)||void 0===i?void 0:i.call(e,t)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Et(r.compression)&&r.data&&(r.compression=hg),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(e=>{var t,i;const s=(kt(e)?e:[e]).map(e=>ct(ct({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(t=null==n||null===(i=n.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((e,t=(new Date).toISOString())=>kt(e)?e.map(e=>ct(ct({},e),{},{sent_at:t})):ct(ct({},e),{},{sent_at:t}))(r.data))),r.url=iS(r.url,r.method,r.compression,r.timestampMode);const a=sS.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),c=null!==(s=null===(n=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(a,e=>e.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:a[0].method;if(!c)throw new Error("No available transport method");const u=e=>{try{c(e)}catch(e){var t;Jb(e)?Vn.warn(e):Vn.error(e),null===(t=r.callback)||void 0===t||t.call(r,{statusCode:0,error:e})}};"sendBeacon"!==o&&r.data&&r.compression===dg&&l&&"undefined"!=typeof Promise&&!zb?Kb(r).then(e=>{u(e)}).catch(t=>{if(un(t))return zb=!0,void u(ct(ct({},r),{},{compression:void 0,url:iS(e.url,e.method,void 0,e.timestampMode)}));dn(t)&&(zb=!0),u(r)}):c(r)})(t,(s,n)=>{var r,o,a;e.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=e.config).on_request_error)||void 0===r||r.call(o,s),i?i(s,n):null===(a=t.callback)||void 0===a||a.call(t,s)})):t.fireCallbackOnDrop&&(null===(r=t.callback)||void 0===r||r.call(t,{statusCode:0}))}var oS=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Qt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Vn.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();const e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(e,"sendBeacon")})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){const e=this._formatQueue();for(const t in e)this._sendRequestSafely(e[t])}},this._flushTimeoutMs))}_sendRequestSafely(e,t){try{this._sendRequest(e,t)}catch(e){Vn.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){const e={};return Kn(this._queue,t=>{var i;const s=t,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");Et(e[n])&&(e[n]=ct(ct({},s),{},{data:[]})),null===(i=e[n].data)||void 0===i||i.push(s.data)}),this._queue=[],e}};const aS=["retriesPerformedSoFar"];var lS=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!Et(e)&&"onLine"in e.navigator){if(this._areWeOnline=e.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},sr(e,"online",this._onlineListener),sr(e,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=mn(e,aS);Lt(i)&&(s.url=jb(s.url,{retry_count:i})),rS(this._instance,t?ct(ct({},s),{},{transport:t}):s,(e,t)=>{var n;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=i?i:0))return void this._enqueue(ct({retriesPerformedSoFar:i},s),t);0===e.statusCode&&Vn.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===(n=s.callback)||void 0===n||n.call(s,e)})}_enqueue(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const s=Math.max(function(e){const t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),n=(Math.random()-.5)*(s-i);return Math.ceil(s+n)}(i),null!=t?t:0),n=Date.now()+s;this._queue.push({retryAt:n,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Vn.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){const e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Et(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(const{requestOptions:e}of this._queue)try{this._instance._send_request(ct(ct({},e),{},{transport:"sendBeacon"}))}catch(e){Vn.error(e)}this._queue=[]}},cS=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=r+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(r),this._context.maxScrollY=Math.max(r,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){const e=this._context;return this._context=void 0,setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){sr(e,"scroll",this._updateScrollData,{capture:!0}),sr(e,"scrollend",this._updateScrollData,{capture:!0}),sr(e,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){const i=kt(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(const s of i){var t;const i=null==e||null===(t=e.document)||void 0===t?void 0:t.querySelector(s);if(i)return i}return}var i;return null==e||null===(i=e.document)||void 0===i?void 0:i.documentElement}_scrollPosition(t){var i,s;const n="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){const e=this.scrollElement();return e&&e[n]||0}return e?"y"===t?e.scrollY||e.pageYOffset||(null===(i=e.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:e.scrollX||e.pageXOffset||(null===(s=e.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}};const uS=e=>$l(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);var dS=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{const t=this._getStored();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Ee]:i})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||uS,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Ee]}getSetOnceProps(){var e;const t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?Dl(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return Kn(Yn(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${mt(i)}`]=t}),e}},hS=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(const i of this._events[e]||[])i(t);for(const i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}};const pS=Gn("[SessionId]"),_S=864e5;var gS=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new hS,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Lt(e)||!Lt(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Pa,this._windowIdGenerator=i||Pa;const n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Qt(this._config.session_idle_timeout_seconds||1800,60,36e3,pS.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){const e=Ja._parse(this._window_id_storage_key),t=Ja._parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Ja._remove(this._window_id_storage_key),Ja._set(this._primary_window_exists_storage_key,!0)}(null===(s=this._config.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Et(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Ja._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ja._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ja._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){const t=this._lastPersistedActivityTimestamp;return!Pt(t)&&!Pt(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){const s=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!s||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[W]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Lt(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(W):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(Pt(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();const[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[W]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}_freshestActivityTimestamp(){const[e]=this._getSessionId(),t=Lt(e)?e:0,i=Lt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){const e=this._persistence.props[W];return kt(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void pS.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void pS.error("Invalid sessionID in bootstrap",e)}})(e);return!Et(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(Ye,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Ja._remove(this._primary_window_exists_storage_key)},sr(e,Ye,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||(new Date).getTime(),n=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(Pt(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var r,o;null===(r=(o=this._persistence).syncCookieProperties)||void 0===r||r.call(o),this._lastCookieSyncTimestamp=s}let[,a,l]=this._getSessionId();const c=!Et(n)&&a!==n,u=this._freshestActivityTimestamp();let d=this._getWindowId();const h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>_S),_=h?p:Lt(l)&&Math.abs(s-l)>_S;let g=!1,f=c;const v=!a||!!h,m=a;let y=!v&&!e&&this._sessionHasBeenIdleTooLong(s,u);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(s),y||pS.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId()),v||y||_){f=!1;const e=h&&!p;a=e?h.sessionId:this._sessionIdGenerator(),d=this._windowIdGenerator(),pS.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_}}),l=e?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,g=!0}else d||(d=this._windowIdGenerator(),g=!0),f=f||a!==m,f&&(pS.info("adopted cross-tab session id",{sessionId:a,windowId:d}),g=!0);const b=Lt(u)&&e&&!_?u:s,S=Lt(l)?l:(new Date).getTime();this._setWindowId(d),this._setSessionId(a,b,S),e||this._resetIdleTimer();const w={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_,crossTabAdoption:f};return g&&this._sessionIdChangedHandlers.forEach(e=>e(a,d,w)),{sessionId:a,windowId:d,sessionStartTimestamp:S,changeReason:g?w:void 0,lastActivityTimestamp:u}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){const e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};const fS=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&Gt(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>Gt(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function vS(){return vS=rt(function*(){const e=null==i?void 0:i.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return Tt(i)&&i.length>0?i:void 0}catch(e){return void Vn.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),vS.apply(this,arguments)}const mS="custom",yS="i.posthog.com",bS=/^\/static\//,SS=["/s/","/e/","/i/"];var wS=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${yS}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":mS),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!bS.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){const t=ar(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;let s=i;const n=this.instance.config.rewriteRequestPath;if(n){var r;const e=(null===(r=ar(i))||void 0===r?void 0:r.href)||i;s=n(new URL(e)).toString()}if(n&&"api"===e&&SS.some(e=>0===t.indexOf(e))){const e=this._urlKey(s);if(e){const t=this.apiHost;let i=this._ingestionEndpoints;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===n||(i={apiHost:t,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){const t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){const i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,`${i}${t}`)}if(this.region===mS)return this._prepareEndpoint(e,t,this.apiHost+t);const i=yS+t;switch(e){case"assets":return this._prepareEndpoint(e,t,`https://${this.region}-assets.${i}`);case"api":return this._prepareEndpoint(e,t,`https://${this.region}.${i}`)}}};const kS=Gn("[PostHog ExternalIntegrations]"),CS={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var xS=class{constructor(e){this._instance=e}_loadScript(e,t){var i,s;null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,e,e=>{if(e)return kS.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[n,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,s;r&&!(null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[n])&&this._loadScript(CS[n],()=>{var e;null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[n])||void 0===e||e.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&(null===(s=h.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},IS=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return rt(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t._extensions.set(e.name,e);try{const i=e.setup(t._client);i&&(yield i)}catch(i){const s=t._extensions.get(e.name)===e;s&&t._extensions.delete(e.name),t._logger.error(`Failed to set up browser extension "${e.name}"`,i),s&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(this._disposed)return;this._disposed=!0;const e=Array.from(this._extensions.values()).reverse();this._extensions.clear();for(const t of e)this._disposeExtension(t)}_disposeExtension(e){try{var t;const i=null===(t=e.dispose)||void 0===t?void 0:t.call(e);i&&Ct(i.then)&&i.then(void 0,t=>{this._logger.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this._logger.error(`Failed to dispose browser extension "${e.name}"`,t)}}},ES=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const s of e){const e=null==t?void 0:t.get_property(s);Et(e)||(i[s]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}};const TS="extensionsRemoteConfig";var MS=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=Vn,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new ES(e),this.onEvent=e=>Wg(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this._disposed)return Wg(()=>{});const t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(TS,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Wg(i)},this._runtime=new IS(Vn.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property(g);return"string"==typeof e?e:void 0}get library(){return{name:Xa.LIB_NAME,version:Xa.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const n=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,i){var s=this;return rt(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return Wg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(TS,e))}sendRequest(e){var t=this;return rt(function*(e,i={}){var s;const n=t.instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),r={method:i.method,url:i.query?jb(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?dt.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(r),{statusCode:202}):new Promise(e=>{r.callback=e,t.instance._send_request(r)})}).apply(this,arguments)}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}};const PS={};let FS=0;const RS=()=>{},LS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',AS="Surveys module not available",OS="sanitize_properties is deprecated. Use before_send instead",$S="Invalid value for property_denylist config: ",DS=/^[A-Za-z0-9_-]{1,400}$/,NS=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,BS=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,qS=["token","distinct_id",Ae],HS="posthog",WS=e=>{const t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},zS=t=>{var i;return ct({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ir(null==s?void 0:s.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:RS,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:n&&Tt(null==n?void 0:n.search)&&-1!==n.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==e||null===(i=e.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(e){Vn.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Je,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:RS},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Lr,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:WS(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(t))},US=[["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"]],jS=e=>{const t={};for(const[i,s]of US)Et(e[i])||(t[s]=e[i]);const i=Zn({},t,e),s=e.__preview_external_dependency_versioned_paths;return Et(s)||(Et(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),Tt(s)&&Et(e.asset_host)&&(i.asset_host=s)),kt(e.property_blacklist)&&(Et(e.property_denylist)?i.property_denylist=e.property_blacklist:kt(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Vn.error($S+e.property_denylist)),i};var VS=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Vn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},GS=class t{_removeExtension(e){if(!e)return;const t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}_replaceExtension(e,t){var i;return this._removeExtension(e),this._extensions.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this._inCookielessMode())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this._hasStableInitialDistinctId)return;let t,i,s;e?(t=`persistence is set to '${this.config.persistence}'`,i="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."):(t="persistence is disabled (disable_persistence is true)",i="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._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}_healCookielessSentinelDistinctId(){if(this._inCookielessMode()||"$posthog_cookieless"!==this.get_distinct_id())return;const e=this.persistence;if(!e)return;this._is_persistence_disabled()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(Pa());this.register({distinct_id:t,$device_id:t}),e.set_property(Ie,Ke)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new VS,this._personProcessingSetOncePropertiesSent=!1,this.version=Xa.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new hS,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zS(),this.SentryIntegration=fb,this.sentryIntegration=e=>function(e,t){const i=gb(e,t);return{name:_b,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new cS(this),this.pageViewManager=new vb(this),this.rateLimiter=new $b(this),this.requestRouter=new wS(this),this.consent=new ab(this),this.externalIntegrations=new xS(this);const i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const s=Tt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{const s=Tt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Vn.info(`send "${null==e?void 0:e.event}"`,e))}init(e,i,s){if(s&&s!==HS){var n;const r=null!==(n=PS[s])&&void 0!==n?n:new t;return r._init(e,i,s),PS[s]=r,PS[HS][s]=r,r}return this._init(e,i,s)}_init(t,i={},s){var n,r,o;const a=Tt(t)?t.trim():"";if(!a)return Vn.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==(null===(l=this.config)||void 0===l?void 0:l.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=zS(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);const c=zS(i.defaults),u=jS(i),d=Zn({},c,u,{name:s,token:a});xt(c.rageclick)&&xt(u.rageclick)&&(d.rageclick=Zn({},c.rageclick,u.rageclick)),xt(c.session_recording)&&xt(u.session_recording)&&(d.session_recording=Zn({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Vn.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:dg;const h=this._is_persistence_disabled();if(this.persistence=new Ab(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ab(ct(ct({},this.config),{},{persistence:"sessionStorage"}),h,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Ja._is_supported()){const e=Ja._parse(this._sessionRegisteredPropertiesStorageKey);kt(e)&&e.forEach(e=>{Tt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Ja._remove(this._sessionRegisteredPropertiesStorageKey);const p=ct({},this.persistence.props),_=ct({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new oS((e,t)=>this._send_retriable_request(e,t),this.config.request_queue_config),this._retryQueue=new lS(this),this.__request_queue=[];const g=this._inCookielessMode();g||(this.sessionManager=new gS(this),this.sessionPropsManager=new dS(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Vn.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(g)},0)):(Vn.info("Initializing extensions synchronously"),this._initExtensions(g)),Xa.DEBUG=Xa.DEBUG||this.config.debug,Xa.DEBUG&&Vn.info("Starting in debug mode",{this:this,config:i,thisC:ct({},this.config),p:p,s:_}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=ct(ct({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!v&&!Mt(v),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const e=i.bootstrap.distinctID,t=this.get_distinct_id(),s=this.persistence.get_property(Ie);if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===s)this.identify(e);else if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===s)Vn.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 t=this.config.get_device_id(Pa()),s=i.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(Ie,i.bootstrap.isIdentifiedID?Ze:Ke),this.register({distinct_id:e,$device_id:s})}}if(g)this.register_once({distinct_id:Le,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(Pa());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(Ie,Ke)}return sr(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sr(e,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null===(e=this._retryQueue)||void 0===e||e.resume()}),i.segment?pb(this,()=>this._loaded()):this._loaded(),Ct(this.config._onCapture)&&this.config._onCapture!==RS&&(Vn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Vn.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 vS.apply(this,arguments)}().then(e=>{e&&this.register({[f]:e})}).catch(RS),this}_isSharedExtension(e){const t=e;return Tt(t.name)&&Ct(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}).catch(t=>{Vn.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var e,i,s;const n=null!==(e=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==e?e:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this._featureFlagsReloadingUnsubscribe)||void 0===r||r.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new n(this)),Ct(this.featureFlags.onReloading)&&Ct(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}_initExtensions(e){const i=performance.now(),s=ct(ct({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d;s.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this._extensions.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this._extensions.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this._extensions.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this._enrollExtension(this.autocapture=new s.autocapture(this),n),s.surveys&&this._enrollExtension(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this._enrollExtension(this.logs=null!==(a=this.logs)&&void 0!==a?a:new s.logs(this),n),s.metrics&&this._extensions.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new s.metrics(this)),s.conversations&&this._extensions.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new s.conversations(this)),s.productTours&&this._extensions.push(this.productTours=new s.productTours(this)),s.heatmaps&&this._extensions.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this._extensions.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,ub)),s.toolbar&&this._extensions.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new s.toolbar(this)),s.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this._extensions.forEach(e=>{e.initialize&&n.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),n.push(()=>{if(this._pendingRemoteConfig){const e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this._processInitTaskQueue(n,i)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);const i=e.shift();if(i)try{i()}catch(e){Vn.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[Oe]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[$e]:i}),this.config.__preview_deferred_init_extensions&&Vn.info(`PostHog extensions initialized (${i}ms)`)}_onRemoteConfig(e){var t;if(!s||!s.body)return Vn.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var i;const t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=ft(t.supportedCompression,dg)?dg:ft(t.supportedCompression,hg)?hg:void 0),(null===(i=t.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Je}),null===(t=this._browserClientAdapter)||void 0===t||t.handleRemoteConfig(e),this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}_loaded(){try{this.config.loaded(this)}catch(e){Vn.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const e=n.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Nb(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&Qn(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,n,r;this._isPageUnloading=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(tt),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this._requestQueue)||void 0===n||n.unload(),null===(r=this._retryQueue)||void 0===r||r.unload()):this._shouldCapturePageleave()&&this.capture(tt,null,{transport:"sendBeacon"})}_send_request(e){rS(this,e)}_send_retriable_request(e,t){this._retryQueue?this._retryQueue.retriableRequest(e,t):this._send_request(t?ct(ct({},e),{},{transport:t}):e)}_execute_array(e){FS++;try{let t;const i=[],s=[],n=[];Qn(e,e=>{if(e)if(t=e[0],kt(t))n.push(e);else if(Ct(e))try{e.call(this)}catch(t){Vn.error("Error executing queued PostHog call",e,t)}else kt(e)&&"alias"===t?i.push(e):kt(e)&&-1!==t.indexOf("capture")&&Ct(this[t])?n.push(e):s.push(e)});const r=function(e,t){Qn(e,function(e){try{if(kt(e[0])){let i=t;Kn(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Vn.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(s,this),r(n,this)}finally{FS--}}push(e){if(FS>0&&kt(e)&&Tt(e[0])){const i=t.prototype[e[0]];return void(Ct(i)&&i.apply(this,e.slice(1)))}this._execute_array([e])}get _facebookClickIdChannel(){return{property:y,persistenceKey:b,cookieName:"_fbc",pattern:NS,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[b]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(b)}}}get _facebookBrowserIdChannel(){return{property:S,persistenceKey:w,cookieName:"_fbp",pattern:BS,register:(e,t)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[w]:{value:e,delivered:t}})},unregister:()=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.unregister(w)}}}_getPersistedMetaIdentifier(e){var t;const i=null===(t=this.persistence)||void 0===t?void 0:t.get_property(e.persistenceKey);return Tt(i)&&e.pattern.test(i)?{value:i,delivered:!1}:xt(i)&&Tt(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_storeMetaIdentifier(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}_readMetaCookie(e){if(!this.config.save_campaign_params||this._inCookielessMode())return;const t=Ca(e.cookieName);return Tt(t)&&e.pattern.test(t)?t:void 0}_updateFacebookClickId(e,t,i,s){if(!this.persistence)return;const n=this._facebookClickIdChannel;this.persistence.refreshKey(n.persistenceKey);const r=this._getPersistedMetaIdentifier(n);if(s)return void n.unregister();if(i)return Tt(t)&&NS.test(t)?this._storeMetaIdentifier(n,t,r):void n.unregister();const o=Tt(e)&&DS.test(e)?e:void 0,a=this._readMetaCookie(n);return a&&((e,t,i)=>{const s=e.split(".");if(t)return s[3]===t;if(!i)return!0;const n=i.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(a,o,r)?this._storeMetaIdentifier(n,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this._storeMetaIdentifier(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}_updateFacebookBrowserId(e,t,i){if(!this.persistence)return;const s=this._facebookBrowserIdChannel;this.persistence.refreshKey(s.persistenceKey);const n=this._getPersistedMetaIdentifier(s);if(i)return void s.unregister();if(t)return Tt(e)&&BS.test(e)?this._storeMetaIdentifier(s,e,n):void s.unregister();const r=this._readMetaCookie(s);return r?this._storeMetaIdentifier(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}_markMetaIdentifierDelivered(e,t){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const i=this._getPersistedMetaIdentifier(e);(null==i?void 0:i.value)!==t||i.delivered||e.register(t,!0)}capture(e,t,i){var s,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void Vn.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Et(e)||!Tt(e))return void Vn.error("No event name provided to posthog.capture");this._healCookielessSentinelDistinctId();const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;const o=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Vn.critical("This capture call is ignored due to client rate limiting.");let a;(null==t?void 0:t.$current_url)&&!Tt(null==t?void 0:t.$current_url)&&(Vn.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i._originatedFromCaptureException)||Vn.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&&(a=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 l=new Date,c=(null==i?void 0:i.timestamp)||l,u=os(null==i?void 0:i.uuid,Pa);let d={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},c,u)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&r&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const h="$feature_flag_called"===e&&!1===d.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!h&&(d.$set=null==i?void 0:i.$set);const p=xt(null==t?void 0:t.$set)?t.$set:void 0,_=kt(null==t?void 0:t.$unset)?t.$unset:[],g=(null==i?void 0:i.$unset)||[],f=e=>{var t;const s=!!(null==i?void 0:i.$set)&&e in i.$set;return{hasProvided:s||!!p&&e in p,provided:s?null==i||null===(t=i.$set)||void 0===t?void 0:t[e]:null==p?void 0:p[e],unset:-1!==_.indexOf(e)||-1!==g.indexOf(e)}},v=f(y),m=f(S),b=[{channel:this._facebookClickIdChannel,hasProvided:v.hasProvided,update:this._updateFacebookClickId(null==a?void 0:a.fbclid,v.provided,v.hasProvided,v.unset)},{channel:this._facebookBrowserIdChannel,hasProvided:m.hasProvided,update:this._updateFacebookBrowserId(m.provided,m.hasProvided,m.unset)}];for(const{channel:e,hasProvided:t,update:i}of b)i&&!0===d.properties.$process_person_profile&&i.pending&&!t&&!h&&(d.$set=ct({[e.property]:i.value},d.$set));const w=null==i?void 0:i.$unset;w&&(d.$unset=w);const k=h?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==st,e===it);if(k&&(d.$set_once=k),(null==i?void 0:i._noTruncate)||(C=this.config.properties_string_max_length,d=function(e,t){const i=new Set;return function e(s,n){if(s!==Object(s))return t?t(s):s;if(i.has(s))return;let r;if(i.add(s),kt(s))r=[],Qn(s,t=>{r.push(e(t))});else{const t={};Kn(qt(s)?er(s):s,(s,n)=>{i.has(s)||(t[n]=e(s,n))}),r=t}return r}(e)}(d,e=>Tt(e)?e.slice(0,C):e)),d.timestamp=c,Et(null==i?void 0:i.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),h&&(d.properties=((e,t=[])=>{const i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return on.forEach(s),t.forEach(s),i})(d.properties,qS)),e===Pg||e===Fg){const i=null==t?void 0:t[Rg],s=null==t?void 0:t[Ag];Zg({id:i,current_iteration:s}),d.$set=ct(ct({},d.$set),{},{[rl({id:i,current_iteration:s},e===Fg?"responded":"dismissed")]:!0})}else e===Mg&&(d.$set=ct(ct({},d.$set),{},{[Bg]:(new Date).toISOString()}));var C;if("product tour shown"===e){const e=null==t?void 0:t.$product_tour_type;e&&(d.$set=ct(ct({},d.$set),{},{[`$product_tour_last_seen_date/${e}`]:(new Date).toISOString()}))}const x=ct(ct({},d.properties.$set),d.$set);if(It(x)||this.setPersonPropertiesForFlags(x),!Ft(this.config.before_send)){const e=this._runBeforeSend(d);if(!e)return;d=e,d.uuid=os(d.uuid,Pa)}const I=b.filter(({channel:e,update:t})=>{var i,s,n;const r=null!==(i=null===(s=d.$set)||void 0===s?void 0:s[e.property])&&void 0!==i?i:xt(null===(n=d.properties)||void 0===n?void 0:n.$set)?d.properties.$set[e.property]:void 0;return(null==t?void 0:t.pending)&&r===t.value});this._internalEventEmitter.emit("eventCaptured",d);const E=null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(E),M=ct(ct(ct({method:"POST",url:E,data:d,compression:"best-available",timestampMode:T?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},T&&(null===(n=d.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),I.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(const{channel:e,update:t}of I)this._markMetaIdentifierDelivered(e,t.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||I.length){var P;let e;!M.transport&&!M.callback&&It(null!==(P=this.config.request_headers)&&void 0!==P?P:{})&&this._isPageUnloading&&(e="sendBeacon"),this._send_retriable_request(M,e)}else this._requestQueue.enqueue(M);return d}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this._browserClientAdapter)||void 0===t?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new MS(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}_processCookieIdentityChange(e=!0){var t,i,s;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();const l=a?void 0:this.persistence.remove_event_timer(t);let u=ct({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this._inCookielessMode()&&(u[Ae]=!0),"$snapshot"===t){const e=ct(ct({},this.persistence.properties()),this.sessionPersistence.properties());return u.distinct_id=e.distinct_id,(!Tt(u.distinct_id)&&!Rt(u.distinct_id)||Mt(u.distinct_id))&&Vn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}const d=function(t,i,s,r=!1){var o,a,l,u;if(!c)return{};const d=t?[...xl,...i||[]]:[],[h,p]=Qi(c),[_,g]=function(e){for(let t=0;Xi.length>t;t++){const[i,s,n]=Xi[t],r=e.match(i);if(r){const t=n&&e.match(n)||r;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(c),f=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};Et(s)||(v.detectGoogleSearchApp=s);const m={},y=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,S=null==e||null===(l=e.screen)||void 0===l?void 0:l.width,w=null==e||null===(u=e.screen)||void 0===u?void 0:u.height,k=null==e?void 0:e.devicePixelRatio;Et(y)||(m.userAgentDataPlatform=y),Et(b)||(m.maxTouchPoints=b),Et(S)||(m.screenWidth=S),Et(w)||(m.screenHeight=w),Et(k)||(m.devicePixelRatio=k);const C=Zn(Yn({$os:h,$os_version:p,$browser:Ui(c,navigator.vendor,f,v),$webview_app:_,$webview_app_version:g,$device:Ki(c),$device_type:Zi(c,m),$timezone:Nl(),$timezone_offset:Bl()}),{$current_url:ur(r?ls(null==n?void 0:n.href):null==n?void 0:n.href,d,El),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:Vi(c,navigator.vendor,f,v),$browser_language:Rl(),$browser_language_prefix:Ll(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Un.LIB_NAME,$lib_version:Un.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Un.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=Un.SDK_DIST_CHANNEL),C}(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:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);u.$session_id=e,u.$window_id=t}this.sessionPropsManager&&Zn(u,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Zn(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null===(h=this._retryQueue)||void 0===h?void 0:h.length}catch(e){u.$sdk_debug_error_capturing_properties=String(e)}let p;if(this.requestRouter.region===mS&&(u.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),u=Zn(u,p),"$pageview"===t&&s&&(u.title=s.title),!Et(l)){const e=r.getTime()-l;u.$duration=parseFloat((e/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");const _=this.persistence.properties(),g=this.sessionPersistence.properties(),f=u.$groups,v=_.$groups;xt(f)&&!It(f)&&(u.$groups=ct(ct({},xt(v)?v:{}),f)),Kn(["$referrer","$referring_domain"],e=>{e in _&&delete g[e]});const m={};if(this._extensionEventPropertyProducers.length>0)for(const e of this._extensionEventPropertyProducers.slice())try{Zn(m,e())}catch(e){Vn.error("Failed to produce browser extension event properties",e)}u=Zn({},d,_,g,ct(ct({},m),u)),u.$is_identified=this._isIdentified(),kt(this.config.property_denylist)?Kn(this.config.property_denylist,function(e){delete u[e]}):Vn.error($S+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&(Vn.error(OS),u=y(u,t));const b=this._hasPersonProcessing();return u.$process_person_profile=b,b&&!a&&this._requirePersonProcessing("_calculate_event_properties"),u}_calculate_set_once_properties(e,t=!0,i=!1){var s;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Zn({},n,r||{},e||{});const a=this.config.sanitize_properties;return a&&(Vn.error(OS),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),It(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var s;null===(s=this.persistence)||void 0===s||s.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this._processCookieIdentityChange(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(!this._sessionRegisteredPropertiesStorageKey)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e._disabled)||!Ja._is_supported())return void Ja._remove(this._sessionRegisteredPropertiesStorageKey);const t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Ja._set(this._sessionRegisteredPropertiesStorageKey,t):Ja._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:AS}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:AS})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:AS})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=Xg){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:AS}}canRenderSurveyAsync(e,t=!1){var i,s;return null!==(i=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:AS})}_validateIdentifyId(e){return!e||Mt(e)?(Vn.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Vn.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Vn.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Vn.uninitializedWarning("posthog.identify");if(Rt(e)&&(e=e.toString(),Vn.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._validateIdentifyId(e))return;if(!this._requirePersonProcessing("posthog.identify"))return;this._healCookielessSentinelDistinctId();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression();let a=!1;try{const s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(v),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Ke,c=e!==s,u=!c&&o;if(c&&o){var l;const n=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(Ie,Ze),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$identify",n,{$set:t||{},$set_once:i||{}})&&(this._cachedPersonProperties=vl(e,t,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(u){this.persistence.set_property(Ie,Ze);const s=t||{},n=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:s,$set_once:n})&&(this._cachedPersonProperties=vl(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);c||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(we)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this._requirePersonProcessing("posthog.setPersonProperties"))return;const i=vl(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this._cachedPersonProperties=i)):Vn.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(kt(e)?e:[e]).filter(e=>Tt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,i){var s;if(!e||!t)return void Vn.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this._processCookieIdentityChange();const n=this.getGroups(),r=n[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ct(ct({},n),{},{[e]:t})}),(r||i)&&this._hasPersonProcessing()){const s={$group_type:e,$group_key:t};i&&(s.$group_set=i),this.capture(st,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=At(e)?e:null==e?void 0:e.resetDeviceID,i=At(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t=!1,i){var s,n,r,o,a,l;if(Vn.info("reset"),!this.__loaded)return Vn.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(s=this._originalUserConfig)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this._shouldDisableFlags());const u=this.get_property(g),d=this.get_property(f),h=this.get_property(A);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),t||!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===(a=this.persistence)||void 0===a||null===(l=a._beginCookieSyncSuppression)||void 0===l?void 0:l.call(a);let v=!1;try{var m,y,b,S,w,k,C,x,I,E,T,M,P;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Et(h)||null===(E=this.persistence)||void 0===E||E.register({$session_recording_remote_config:h}),null===(b=this.surveys)||void 0===b||b.reset(),null===(S=this.featureFlags)||void 0===S||S.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(C=this.metrics)||void 0===C||C.reset(),null===(x=this.persistence)||void 0===x||x.set_property("$user_state","anonymous"),null===(I=this.sessionManager)||void 0===I||I.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Le,$device_id:null},"");else{const t=this.config.get_device_id(Pa());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||Et(d)||this.register({[f]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this._inCookielessMode()&&(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(T=this.featureFlags)||void 0===T||T.initialize(),!Ft(c)&&!(null===(M=this.sessionManager)||void 0===M?void 0:M.setBootstrapSessionId(c,!0))){const e=ct({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var F,R;_&&(null===(F=this.persistence)||void 0===F||null===(R=F._endCookieSyncSuppression)||void 0===R||R.call(F,v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return rt(function*(){var e,i,s,n,r,o,a,l;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null===(e=t.sessionRecording)||void 0===e||e.dispose(),null===(i=t.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(s=t.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=t.metrics)||void 0===n||n.dispose(),null===(r=t._requestQueue)||void 0===r||r.unload(),null===(o=t._retryQueue)||void 0===o||o.unload();try{var c;null===(c=t.featureFlags)||void 0===c||c.destroy()}catch(e){Vn.error("Error while destroying feature flags",e)}null===(a=t.persistence)||void 0===a||a.destroy(),null===(l=t.sessionPersistence)||void 0===l||l.destroy()}else Vn.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null===(t=this.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var n;const t=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(Vn.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(v,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Vn.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=ct({},this.config);if(xt(e)){var i,s,n,r,o,a,l,c,u,d,h,p,_,g;Zn(this.config,jS(e));const v=this._is_persistence_disabled();null===(i=this.persistence)||void 0===i||i.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Ab(ct(ct({},this.config),{},{persistence:"sessionStorage"}),v,!1);const m=this._checkLocalStorageForDebug(this.config.debug);var f;At(m)&&(this.config.debug=m),At(this.config.debug)&&(this.config.debug?(Xa.DEBUG=!0,Da._is_supported()&&Da._set("ph_debug",!0),Vn.info("set_config",{config:e,oldConfig:t,newConfig:ct({},this.config)})):(Xa.DEBUG=!1,Da._is_supported()&&Da._remove("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this._shouldDisableFlags()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(c=this.tracingHeaders)||void 0===c||c.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(f=this.historyAutocapture)||void 0===f||f.startIfEnabledOrStop()),null===(h=this.exceptionObserver)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.deadClicksAutocapture)||void 0===p||p.startIfEnabledOrStop(),null===(_=this.surveys)||void 0===_||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),null===(g=this.externalIntegrations)||void 0===g||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&pb(this,RS,!1)}}_overrideSDKInfo(e,t){Xa.LIB_NAME=e,Xa.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var s,n,r,o,a;Object.values(i).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ct(ct({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var e,i;return null!==(e=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==e?e:t._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:HS;return t!==HS&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&It(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Vn.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Re,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t;const i=this._is_persistence_disabled();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s._onOptOut(),(null===(e=this.persistence)||void 0===e?void 0:e._disabled)!==i&&(null===(n=this.persistence)||void 0===n||n.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t._disabled)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),i}opt_in_capturing(e){var i;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var s,n,r,o,a,l;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new gS(this),this.pageViewManager=new vb(this),this.persistence&&(this.sessionPropsManager=new dS(this,this.sessionManager,this.persistence));const e=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=t.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;e&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new e(this)),this._lastRemoteConfig&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this._lastRemoteConfig)))}var d,h;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(Et(null==e?void 0:e.captureEventName)||(null==e?void 0:e.captureEventName))&&this.capture(null!==(h=null==e?void 0:e.captureEventName)&&void 0!==h?h:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Vn.warn(LS)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Vn.warn(LS);const e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var t,i;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Le,$device_id:null}),this._removeExtension(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return 1===e?"granted":0===e?"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._sync_opt_out_with_persistence()}_is_bot(){return i?fS(i,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){s&&("visible"===s.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(et,{title:s.title},{send_instantly:!0}),this._visibilityStateListener&&(s.removeEventListener(Xe,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),sr(s,Xe,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.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}))}_shouldDisableFlags(){const e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Vn.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(e,t,i,s,n){const r=t in e&&!Ft(e[t]),o=i in e&&!Ft(e[i]);return r?e[t]:!!o&&(n&&n.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Vn)}_runBeforeSend(e){var t;if(Ft(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Dt),s=kt(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=e;for(const t of s)try{if(n=t(n),Ft(n)){const t=`Event '${e.event}' was rejected in beforeSend function`;return $t(e.event)?Vn.warn(`${t}. This can cause unexpected behavior.`):Vn.info(t),null}n.properties&&!It(n.properties)||Vn.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return Vn.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(n.properties&&Ft(n.properties[t]))return Vn.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){const t=At(e)&&!e,i=Da._is_supported()&&"true"===Da._get("ph_debug");return!t&&(!!i||e)}};GS.__defaultExtensionClasses={},GS._noopLogger=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Xn(e.prototype[t[i]])}(GS,["identify"]);var QS=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=xt(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}};const KS=Gn("[ExceptionAutocapture]"),ZS=Gn("[TracingHeaders]"),JS=Gn("[Web Vitals]"),XS=9e5,YS=["CLS","FCP","INP","LCP"],ew=["INP","LCP"],tw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],iw=Gn("[SessionRecording]"),sw=Gn("[Heatmaps]");function nw(e){return xt(e)&&"clientX"in e&&"clientY"in e&&Rt(e.clientX)&&Rt(e.clientY)}const rw=Gn("[Product Tours]"),ow=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(F))},aw=["$set_once","$set"],lw=Gn("[SiteApps]"),cw="Error while initializing PostHog app with config id ",uw=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),dw="SDK is not enabled or survey functionality is not yet loaded",hw="Disabled. Not loading surveys.";var pw=class{constructor(e,t){this._configSource=e,this._initialClientState=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(this._disposed)return;if(this._config.disableSurveys)return;if(!e.ok)return zg.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(Ft(t))return zg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=At(t)?t:t.length>0,zg.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()}}setup(e){if(!this._disposed)return this._initializingClient=e,uw(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(s=i.dispose)||void 0===s||s.call(i),this._surveyManager=null,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach(e=>clearTimeout(e)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this._disposed||!this._client)return;const e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void zg.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void zg.info(hw);if(e.cookielessMode&&this._configSource.isOptedOut())return void zg.info("Not loading surveys in cookieless mode without consent.");const t=this._configSource.getExtensions();if(!t)return void zg.error("PostHog Extensions not found.");if(Et(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;const i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{const e=t.generateSurveys;if(e)return this._completeSurveyInitialization(e,i),void(this._isInitializingSurveys=!1);const s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(Qe),void(this._isInitializingSurveys=!1);s(e=>{try{if(this._disposed)return;const t=this._configSource.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),zg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){zg.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;const s=null!==(i=this._client)&&void 0!==i?i:this._initialClientState;if(!s||this._disposed)return;if(this._config.disableSurveys)return zg.info(hw),e([]);const n=s.kv.get(ue);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:t,context:i})=>{this._disposed||e(t,i)}).catch(e=>zg.error("Error in survey callback",e));const r=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(s,e)}catch(e){return zg.error("Error processing surveys response",e),this._handleSurveyResponse(s,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(s,{statusCode:0,error:e}));this._getSurveysInFlightPromise=r;const o=()=>{this._getSurveysInFlightPromise===r&&(this._getSurveysInFlightPromise=null)};r.then(t=>{o(),this._disposed||e(t.surveys,t.context)},o).catch(e=>zg.error("Error in survey callback",e))}_sendSurveysRequest(e,t){const i=this._client;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(dw)}))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:dw}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?zg.error(e):t.error||zg.warn(e),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this._lastSurveyRefreshFailedAt=null;const s=t.json.surveys||[],n=s.filter(e=>Vg(e)&&(dl(e)||Gg(e)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),e.kv.set({[ue]:s,[de]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t;const i=null===(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)||void 0===e?void 0:e.kv.get(de);return Rt(i)&&Date.now()-i>3e5}_isSurveyRefreshBackingOff(){return Rt(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};Zg(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(const t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){zg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!Ft(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);zg.warn("init was not called")}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}_checkSurveyEligibility(e){if(Ft(this._surveyManager))return{eligible:!1,reason:dw};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(!this._configSource.isCapturing())return{eligible:!1,reason:Ug};if(Ft(this._surveyManager))return{eligible:!1,reason:dw};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Ft(this._surveyManager))return zg.warn("init was not called"),{visible:!1,disabledReason:dw};const t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Ft(this._surveyManager)?(zg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dw})):new Promise(i=>{this.getSurveys(t=>{var s;const n=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(n){const e=this._checkSurveyRenderability(n);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var n;if(!this._configSource.isCapturing())return;if(Ft(this._surveyManager))return void zg.warn("init was not called");const r="string"==typeof e?this._getSurveyById(e):e;if(!(null==r?void 0:r.id))return void zg.warn("Survey not found");if(!Jg.includes(r.type))return void zg.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==s?void 0:s.querySelector(t);if(o){if(null===(n=r.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds){zg.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,s;this._renderTimeouts.delete(e),!this._disposed&&this._configSource.isCapturing()&&(zg.info(`Rendering survey ${r.id} with delay of ${null===(t=r.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(r,o,i),zg.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(e)}this._surveyManager.renderSurvey(r,o,i)}else zg.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this._configSource.isCapturing())return;if(Ft(this._surveyManager))return void zg.warn("init was not called");const s=this._getSurveyById(e);if(!s)return void zg.warn("Survey not found");let n=s;if((null===(i=s.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(n=ct(ct({},s),{},{appearance:ct(ct({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Hg&&t.initialResponses&&zg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this._checkSurveyEligibility(s);if(!e.eligible)return void zg.warn("Survey is not eligible to be displayed: ",e.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Ft(this._surveyManager)?zg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}};function _w(e,t,i){if(Ft(e))return!1;switch(i){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var gw=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new hS,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;Et(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null===(e=this._captureHookUnsubscribe)||void 0===e||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new hS}register(e){var t,i;if(!Et(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const e=new Set;this._actionRegistry.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(const i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null==t?void 0:t.url){var i;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!_w(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(!(null==t?void 0:t.href))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>_w(e.href,t.href,t.href_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&_w(function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(n),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!(null==t?void 0:t.text))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>_w(e.text,t.text,t.text_matching||"exact")||_w(e.$el_text,t.text,t.text_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&(r=function(e){const t=[],i=/(?::|")text="(.*?)"/g;let s;for(;!Ft(s=i.exec(e));)t.includes(s[1])||t.push(s[1]);return t}(n),o=t.text,a=t.text_matching||"exact",r.some(e=>_w(e,o,a)));var r,o,a}_checkStepSelector(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;const n=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==n?void 0:n.includes(t.selector))return!0;const r=(null==e||null===(s=e.properties)||void 0===s?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||fl(t.properties.reduce((e,t)=>{const i=kt(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},fw=class{constructor(e){var t,i;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null===(t=this._instance)||void 0===t||null===(i=t.onSessionId)||void 0===i?void 0:i.call(t,e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&fl(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){const i=new Map;return e.forEach(e=>{var s;null===(s=e.conditions)||void 0===s||null===(s=s[t])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(t=>{if(null==t?void 0:t.name){const s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}_getMatchingItems(e,t,i){const s=(i===pg?this._eventToItems:this._cancelEventToItems).get(e);let n=[];return this._getItems(e=>{n=e.filter(e=>null==s?void 0:s.includes(e.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[i])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(t=>t.name===e);return this._doesEventMatchFilter(r,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var i;Et(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var s;if(t&&this._actionToItems.clear(),0===i.length)return void(t&&(null===(s=this._actionMatcher)||void 0===s||s.replace([])));this._actionMatcher||(this._actionMatcher=new gw(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));const n=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(n.push(t),t.name){var i;const s=null!==(i=this._actionToItems.get(t.name))&&void 0!==i?i:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}})}),t?this._actionMatcher.replace(n):this._actionMatcher.register(n)}_mergeItemMaps(e,t){t.forEach((t,i)=>{var s;const n=null!==(s=e.get(i))&&void 0!==s?s:[];t.forEach(e=>{n.includes(e)||n.push(e)}),e.set(i,n)})}_setupEventBasedItems(e,t){var i,s;const n=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this._buildEventToItemMap(e,pg),a=this._buildEventToItemMap(e,_g);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==n.length||0!==r.length)&&(null!==(i=this._captureHookUnsubscribe)&&void 0!==i||(this._captureHookUnsubscribe=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;const n=this._getLogger(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(s=t.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const t=this._activationOutcome(e,r);if("consume"===t)return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if("persist"===t)return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){const i=this._getMatchingItems(e,t,_g);i.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._deactivateItems(i.map(e=>e.id)),i.forEach(e=>this._cancelPendingItem(e.id)))}if(!this._eventToItems.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});const o=this._getMatchingItems(e,t,pg);this._activateItems(o.map(e=>e.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t,i;if(0===e.length)return;const s=!!(null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t)),n=[];for(const t of e)s&&this._shouldPersistArmedActivation(t)?this._persistActivation(t)&&this._recordActivationTimestamp(t):n.push(t);n.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...n])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);const t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){const t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));const i=this._getRawPersistedActivatedIds(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this._setActivatedItems(s),0===s.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e;const t=this._getActivationTimestampsKey();if(!t)return{};const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t];return i&&"object"==typeof i?i:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps();this._writeActivationTimestamps(ct(ct({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps(),i={};let s=!1;for(const[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(It(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;const t=this._getRawActivationTimestamps()[e];return Rt(t)?t:void 0}_getRawPersistedActivatedIds(){var e;const t=this._getActivatedKey();return(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,i;const s=this._getRawPersistedActivatedIds();if(0===s.length)return[];const n=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this._getActivatedSessionKey()],r=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);return r&&n===r?s:[]}_stampActivationSession(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(t=e.get_session_id)||void 0===t?void 0:t.call(e);i&&this._setActivatedSession(i)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this._getActivatedSessionKey()];if(i&&i!==e){const e=this._getRawPersistedActivatedIds(),t=this._getRawActivationTimestamps();e.length>0&&(this._setActivatedItems([]),e.filter(e=>Rt(t[e])).forEach(e=>this._cancelPendingItem(e))),this._clearActivationSession(),this._clearAllActivationTimestamps()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,i;null===(e=this._sessionIdUnsubscribe)||void 0===e||e.call(this),this._sessionIdUnsubscribe=void 0,null===(t=this._captureHookUnsubscribe)||void 0===t||t.call(this),this._captureHookUnsubscribe=void 0,null===(i=this._actionMatcher)||void 0===i||i.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},vw=class extends fw{constructor(e){super(e)}_getActivatedKey(){return he}_getActivatedSessionKey(){return pe}_getActivationTimestampsKey(){return _e}_writeActivationTimestamps(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_timestamps:e})}_clearActivationTimestampsStore(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_timestamps")}_shouldPersistArmedActivation(e){var t;let i;this._getItems(t=>{i=t.find(t=>t.id===e)});const s=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return Rt(s)&&s>0}_getShownEventName(){return Mg}_getItems(e){var t;null===(t=this._instance)||void 0===t||t.getSurveys(e)}_cancelPendingItem(e){var t;null===(t=this._instance)||void 0===t||t.cancelPendingSurvey(e)}_getLogger(){return zg}_setActivatedItems(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated:e})}_setActivatedSession(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_session:e})}_clearActivatedSession(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_session")}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){let i;return this._getItems(e=>{i=e.find(e=>e.id===t)}),!i||hl(i)?e===Mg?"consume":"ignore":e===Mg?"persist":e===Pg||e===Fg?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},mw=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);const t={};for(const i of e){const e=this._instance.get_property(i);Et(e)||(t[i]=e)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}},yw=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(){return new vw(this._instance)}};const bw=(null==e?void 0:e.location)?dr(e.location.hash,"__posthog")||dr(location.hash,"state"):null,Sw="_postHogToolbarParams",ww=Gn("[Toolbar]"),kw=Gn("[FeatureFlags]");var Cw=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var i,s,n,r,o,a,l;return{bootstrap:{featureFlags:null!==(i=null===(s=e.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=e.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Et(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(l=e.evaluation_contexts)&&void 0!==l?l:e.evaluation_environments)&&void 0!==a?a:[],flagKeys:kt(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(kw.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Et(e.flag_keys)||kt(e.flag_keys)||kw.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}};const xw=Gn("[FeatureFlags]"),Iw=Gn("[FeatureFlags]",{debugEnabled:!0}),Ew="\" failed. Feature flags didn't load in time.",Tw=["click","keydown","wheel","touchstart","pointerdown"],Mw="connection_error",Pw=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},Fw=e=>{const t={};for(const[i,s]of Jn(e||{}))s&&(t[i]=s);return t},Rw="Refusing to render web experiment since the viewer is a likely bot",Lw={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>pl(t,e),not_regex:(e,t)=>!pl(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Aw=Gn("[Conversations]"),Ow="Conversations not available yet.";function $w(e,t){var s,n,r,o,a,l,c;const u=null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:3e3,d=null!==(n=null==e?void 0:e.maxBufferSize)&&void 0!==n?n:100,h=(null==t?void 0:t.consoleCapture)?void 0:null!==(r=null==e?void 0:e.maxLogsPerInterval)&&void 0!==r?r:1e3,p=Et(h)?Math.max(d,2048):Math.max(d,h),_=ct(ct({},function(){let e="",t="";try{const s=null==i?void 0:i.userAgent;s&&([e,t]=Qi(s))}catch(e){}return function(e,t){const i=function(e){if(e)return{}.hasOwnProperty.call(En,e)?En[e]:e}(e);return ct(ct({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==_?void 0:_["service.name"])&&void 0!==a?a:null==e?void 0:e.serviceName)&&void 0!==o?o:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(l=null==_?void 0:_["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(c=null==_?void 0:_["deployment.environment"])&&void 0!==c?c:null==e?void 0:e.environment,resourceAttributes:_,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Dw=["debug","log","warn","error","info"],Nw="console",Bw="__posthogHandledLogsRequestError",qw=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[Bw]=!0,i},Hw=e=>!!e&&"object"==typeof e&&!0===e[Bw],Ww=Gn("[NetworkMetrics]"),zw=()=>{var t;return(null==e||null===(t=e.performance)||void 0===t?void 0:t.now)?e.performance.now():Date.now()},Uw=e=>e?`${Math.floor(e/100)}xx`:"missing",jw=(e,t)=>{var i;const s=String(t);return{method:String(e).toUpperCase(),url:(null===(i=ar(s))||void 0===i?void 0:i.href)||s}},Vw=(e,t,i,s,n)=>{try{var r,o,a;const c=n();if(!c)return;const u=i||void 0,d=zw()-s,h=ar(t.url);if(h&&"http:"!==h.protocol&&"https:"!==h.protocol)return;const p={url:(null==h?void 0:h.href)||t.url,method:t.method},_=Ct(c.name)?c.name(p):Tt(c.name)?c.name:"http.client.request.duration";if(!_)return;const g=ct({method:p.method,host:null!==(r=null==h?void 0:h.hostname)&&void 0!==r?r:"",path:h?(l=h.pathname,l.split("/").map(e=>(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e))(e)?":id":e).join("/")):"",status_class:Uw(u)},null===(o=c.attributes)||void 0===o?void 0:o.call(c,p,{status:u,durationMs:d}));null===(a=e.metrics)||void 0===a||a.histogram(_,d,{unit:"ms",attributes:g})}catch(e){Ww.error("Failed to record network metric",e)}var l},Gw=()=>{},Qw=(t,i)=>Ct(null==e?void 0:e.fetch)?kp(e,"fetch",e=>function(...s){const n=zw(),r=e.apply(this,s);if(!i())return r;try{var o,a,l;const[e,c]=s,u=jw(null!==(o=null!==(a=null==c?void 0:c.method)&&void 0!==a?a:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(l=null==e?void 0:e.url)&&void 0!==l?l:e);return r.then(e=>(Vw(t,u,null==e?void 0:e.status,n,i),e),e=>{throw Vw(t,u,void 0,n,i),e})}catch(e){return Ww.error("Failed to observe fetch",e),r}}):Gw,Kw=(t,i)=>{var s;const n=null==e||null===(s=e.XMLHttpRequest)||void 0===s?void 0:s.prototype;if(!n)return Gw;const r=new WeakMap,o=kp(n,"open",e=>function(...t){try{(()=>qb.has(this))()||r.set(this,jw(t[0],t[1]))}catch(e){Ww.error("Failed to observe XHR open",e)}return e.apply(this,t)}),a=kp(n,"send",e=>function(...s){let n;try{const e=r.get(this);if(e&&i()){const s=zw();n=()=>{this.removeEventListener("loadend",n),Vw(t,e,this.status,s,i)},sr(this,"loadend",n)}}catch(e){Ww.error("Failed to observe XHR send",e)}try{return e.apply(this,s)}catch(e){throw n&&this.removeEventListener("loadend",n),e}});return()=>{o(),a()}},Zw={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=xw,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._hadUserInteraction=!1,this._onOnline=()=>{const e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t;const i=this._refreshIntervalMs,n=null!==(e=this._dueRefreshIntervalMs)&&void 0!==e?e:i;Et(i)||Et(n)||this._config.remoteRequestsDisabled||!s||"hidden"===s.visibilityState||Date.now()-(null!==(t=this._lastRefreshAt)&&void 0!==t?t:0)<n||(this._dueRefreshIntervalMs=this._hadUserInteraction||!this._config.idleRefreshBackoff?i:Math.min(2*n,36e5),this._hadUserInteraction=!1,this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onUserInteraction=()=>{this._hadUserInteraction&&this._dueRefreshIntervalMs===this._refreshIntervalMs||this._resumeConfiguredInterval()},this._onVisibilityChange=()=>{"visible"===(null==s?void 0:s.visibilityState)&&this._resumeConfiguredInterval()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new Cw(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var i;null===(i=this._mutableConfigSource)||void 0===i||i.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),uw(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(t){var i;if(this._client===t)return e&&sr(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_resumeConfiguredInterval(){this._hadUserInteraction=!0,this._dueRefreshIntervalMs=this._refreshIntervalMs,this._refreshIfDue()}_syncAutomaticRefresh(){const e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&s&&!Et(e)&&e>0?e:void 0;this._config.idleRefreshBackoff||(this._dueRefreshIntervalMs=t),t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Et(t)||(this._refreshIntervalMs=t,this._dueRefreshIntervalMs=t,this._scheduleNextRefresh(),(null==s?void 0:s.addEventListener)&&(sr(s,Xe,this._onVisibilityChange),Qn(Tw,e=>{sr(s,e,this._onUserInteraction,{capture:!0})}))))}_scheduleNextRefresh(){Et(this._refreshIntervalMs)||(Et(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e;Et(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==s||null===(e=s.removeEventListener)||void 0===e||e.call(s,"visibilitychange",this._onVisibilityChange),Qn(Tw,e=>{var t;null==s||null===(t=s.removeEventListener)||void 0===t||t.call(s,e,this._onUserInteraction,{capture:!0})})),this._refreshIntervalMs=void 0,this._dueRefreshIntervalMs=void 0,this._hadUserInteraction=!1,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t,i;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null===(t=this._dynamicProperties)||void 0===t||t.dispose(),this._dynamicProperties=void 0,null===(i=this._crossTabPersistenceUnsubscribe)||void 0===i||i.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null==e||e.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:null===(t=this._client)||void 0===t?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!Et(null===(e=this._client)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!e.$enabled_feature_flags)return;const n=this._prop("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?a:i&&!kt(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),u=this._prop("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||i?c:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),p=!l&&!i,_=!!p||c,g=!!p||h,f={[Y]:_,[X]:_,[ie]:g};e.$feature_flag_details&&(f[te]=_);for(const t of[se,xe,ne])Et(e[t])||(f[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(f)}_remove(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){const e={};for(const t of[Y,ie,se,re]){const i=this._prop(t);Et(i)||(e[t]=i)}this._baseEventProperties=e;const t=ct({},e),i=this._prop(X);if(i)for(const[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this._eventPropertiesWithFlagValues=t}_isCacheStale(){const e=this._config.cacheTtlMs;if(!e||0>=e)return!1;const t=this._prop(xe);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){const e=this._config.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_getValidFlagKeys(){const e=this._config.flagKeys;if(!Et(e))return e.filter(e=>{const t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t;const i=this._config,s=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var n,r;const e=null!==(n=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},t=Object.keys(s).filter(e=>!Et(s[e])).reduce((e,t)=>(e[t]=s[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this._receivedFeatureFlags({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;const r=(null==i?void 0:i.merge)&&null!==(s=this._prop("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==i?void 0:i.merge)&&null!==(n=this._prop("$feature_flag_payloads"))&&void 0!==n?n:{},a=ct(ct({},r),e),l=ct(ct({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:nn(t),variant:rn(t),reason:void 0,metadata:Et(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._prop(te),t=this._prop(re),i=this._prop(oe);if(!i&&!t)return e||{};const s=Zn({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of n){var r;const n=s[e],a=null==t?void 0:t[e],l=Et(a)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!a,c=Et(a)?null==n?void 0:n.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=ct(ct({},n),{},{enabled:l,variant:l?null!=c?c:null==n?void 0:n.variant:void 0});var o;l!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),c!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),u&&(d.metadata=ct(ct({},null==n?void 0:n.metadata),{},{payload:u,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[e]=d}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this._override_warning=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:nn(s),variant:rn(s),payload:sn(t[i])}})}getFlagVariants(){const e=this._prop(X),t=this._prop(re);if(!t)return e||{};const i=Zn({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){const e=this._prop(ie),t=this._prop(oe);if(!t)return e||{};const i=Zn({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEach(e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(we)}_callFlagsEndpoint(e){this._clearDebouncer();const t=this._client;if(!t||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return;if(this._requestInFlight)return void(this._additionalReloadRequested=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ct(ct(ct({},t.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(le),timezone:Nl()};Et(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this._config.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this._getValidEvaluationEnvironments();s.length&&(i.evaluation_contexts=s);const n=this._getValidFlagKeys();Et(n)||(i.flag_keys=n);const r=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;const l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},c=e=>{var t,s;const n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this._requestInFlight=!1,a!==this._requestGeneration)return void l();if(this._trackStatusZeroReachability(e.statusCode),o||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),i.disable_flags&&!this._additionalReloadRequested)return;this._flagsLoadedFromRemote=!o;const c=[];e.error?c.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?Mw:"unknown_error"):200!==e.statusCode&&c.push(`api_error_${e.statusCode}`),n.errorsWhileComputingFlags&&c.push("errors_while_computing_flags");const u=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));u&&c.push("quota_limited"),this._set({[Ce]:c}),u?this._logger.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."):i.disable_flags||this._receivedFeatureFlags(n,o,{partialResponse:r}),l()},u=e=>{this._requestInFlight=!1,a===this._requestGeneration?(this._set({[Ce]:[Mw]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(c).catch(u)}catch(e){u(e)}}_hasStatusZeroCircuitBreakerTripped(){return hr(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=pr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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(e,t={}){var i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+Ew);if(this._checkAndTriggerStaleRefresh())return;const s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+Ew);if(this._checkAndTriggerStaleRefresh())return;const i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0;let c,u=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var d;const e=null===(d=this._client)||void 0===d?void 0:d.session.sessionId,t=this._prop(ke);e&&e!==t&&(u={},c=e)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))c&&this._set({[we]:u,[ke]:c});else{var h,p,_,g,f,v,m,y,b,S,w,k;kt(u[e])?u[e].push(o):u[e]=[o],this._set(ct({[we]:u},c?{[ke]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(h=this._prop("$feature_flag_errors"))&&void 0!==h?h:[]];Et(n)&&i.push("flag_missing");const s={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(p=null===(_=this._config.bootstrap)||void 0===_||null===(_=_.featureFlags)||void 0===_?void 0:_[e])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(g=null===(f=this._config.bootstrap)||void 0===f||null===(f=f.featureFlagPayloads)||void 0===f?void 0:f[e])&&void 0!==g?g:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Et(null==t||null===(v=t.metadata)||void 0===v?void 0:v.has_experiment)||(s.$feature_flag_has_experiment=t.metadata.has_experiment),Et(null==t||null===(m=t.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=t.metadata.version);const d=null!==(y=null==t||null===(b=t.reason)||void 0===b?void 0:b.description)&&void 0!==y?y:null==t||null===(S=t.reason)||void 0===S?void 0:S.code;var C;d&&(s.$feature_flag_reason=d),(null==t||null===(w=t.metadata)||void 0===w?void 0:w.id)&&(s.$feature_flag_id=t.metadata.id),Et(null==t?void 0:t.original_variant)&&Et(null==t?void 0:t.original_enabled)||(s.$feature_flag_original_response=Et(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(k=t.metadata)||void 0===k?void 0:k.original_payload)&&(s.$feature_flag_original_payload=null==t||null===(C=t.metadata)||void 0===C?void 0:C.original_payload),i.length&&(s.$feature_flag_error=i.join(",")),this._captureFeatureFlagCalled(s)}else c&&this._set({[we]:u,[ke]:c});return s?{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:sn(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;null===(t=this._client)||void 0===t||t.capture("$feature_flag_called",e).catch(e=>{this._logger.error("Failed to capture feature flag call",e)})}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var i=this;return rt(function*(){const s=i._client;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i._getValidEvaluationEnvironments();r.length&&(n.evaluation_contexts=r);const o=i._getValidFlagKeys();let a;Et(o)||(n.flag_keys=o);try{var l;const t=null===(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i._logger.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i._logger.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+Ew),t.defaultValue;const i=this.getFeatureFlag(e,t);return Et(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;const s=((e,t={},i={},s={},n,r=xw)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!Et(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return ct(ct({},e),{},{featureFlags:t,featureFlagPayloads:s})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(kt(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[Y]:l,[X]:e,[ne]:!1}}let h=l,p=c,_=a;if(null==n?void 0:n.partialResponse){const e=Object.keys(h),n=p||{};h=ct(ct({},t),h),p=ct(ct({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=ct(ct({},s),_)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=ct(ct({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const n=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=ct(ct({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=ct(ct({},s),Object.fromEntries(Object.entries(_||{}).filter(([t])=>e.has(t))))}else h=ct(ct({},t),h),p=ct(ct({},i),p),_=ct(ct({},s),_);return ct(ct({[Y]:Object.keys(Fw(h)),[X]:h||{},[ie]:p||{},[te]:_||{},[ne]:!0===e.minimalFlagCalledEvents},u?{[se]:u}:{}),d?{[xe]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(s)if(!1===(null==i?void 0:i.persist)){const e=!Et(this._client.kv.get(X));this._bootstrapState=s,e||this._set(s)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(s,e,!!(null==i?void 0:i.partialResponse)),this._set(s);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,t=!1){this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([re,oe]),this._fireFeatureFlagsCallbacks(),void Iw.info("All overrides cleared");if(kt(e))return this._set({[re]:Pw(e)}),this._fireFeatureFlagsCallbacks(),void Iw.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const s={},n=i.flags,r=i.payloads;return n&&(s[re]=kt(n)?Pw(n):n),r&&(s[oe]=r),Object.keys(s).length&&this._set(s),!1===n&&!1===r?this._remove([re,oe]):!1===n?this._remove(re):!1===r&&this._remove(oe),this._fireFeatureFlagsCallbacks(),!1===n?Iw.info("Flag overrides cleared"):n&&Iw.info("Flag overrides set",{flags:n}),void(!1===r?Iw.info("Payload overrides cleared"):r&&Iw.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this._set({[re]:e}),this._fireFeatureFlagsCallbacks(),void Iw.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const n=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);const a=ct(ct({},this.getFlagVariants()),{},{[e]:t});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[Y]:Object.keys(Fw(a)),[X]:a,[ae]:ct(ct({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;null===(l=this._client)||void 0===l||l.capture("$feature_enrollment_update",o).catch(e=>{this._logger.error("Failed to capture early access feature enrollment",e)})}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){const s=this._prop(ee);!s||t?this._getEarlyAccessFeatures(e,i):e(s)}_getEarlyAccessFeatures(e,t){var i=this;return rt(function*(){const s=i._client;if(!s)return;const n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i._set({[ee]:r})}catch(e){return void i._logger.error("Early access feature request failed",e)}try{e(r)}catch(e){i._logger.error("Early access feature callback failed",e)}})()}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){const i=this._prop("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),n=null==e?void 0:e.$set_once,r={};if(n)for(const e in n)({}).hasOwnProperty.call(n,e)&&(e in i||(r[e]=n[e]));this._set({[ae]:ct(ct(ct({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=ct({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this._set({[ae]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(ae),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this._prop("$stored_group_properties")||{},s=ct({},i);for(const t of Object.keys(e))s[t]=ct(ct({},i[t]),e[t]);this._set({[le]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._prop("$stored_group_properties")||{};this._set({[le]:ct(ct({},t),{},{[e]:{}})})}else this._remove(le)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},Jw={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this._recordingStatus||"missing_config"===this._recordingStatus?this._recordingStatus:null!==(e=null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=_o,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!(null==s?void 0:s.visibilityState)||"visible"===s.visibilityState)return!0;const n=null==e||null===(t=e.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==n?void 0:n.length)||n.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e,t;"visible"===(null==s?void 0:s.visibilityState)&&(this._documentWasEverVisible=!0,null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw iw.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._config.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==s?void 0:s.addEventListener)&&sr(s,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,null==s||null===(t=s.removeEventListener)||void 0===t||t.call(s,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),s=!this._config.disable_session_recording,n=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&i&&s&&!n}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed)return;if(this._isRecordingEnabled&&(null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.isStarted))return;const i=!Et(Object.assign)&&!Et(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),iw.info("starting")):(this._recordingStatus=_o,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=yo),(null==h||null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var s,n;const t=this._instance.sessionManager;null===(s=h.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this._scriptName,i=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),iw.error("could not load recorder",i)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;null===(e=this._persistFlagsOnSessionListener)||void 0===e||e.call(this),this._persistFlagsOnSessionListener=void 0,null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.stop()}_discardRecording(e=!1){var t,i;null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=void 0,null===(i=this._lazyLoadedSessionRecording)||void 0===i||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null===(e=this._persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._persistence)||void 0===t||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Ft(e))return null;const i=Rt(e)?e:parseFloat(e);return"number"!=typeof(s=i)||!Number.isFinite(s)||0>s||s>1?(iw.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}_persistRemoteConfig(e){if(this._persistence){var t,i;const s=this._persistence,n=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null===(t=this._config.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=n?n:r;Ft(o)&&this._resetSampling();const a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[A]:ct(ct({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ct({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Et(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};n(),null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(n)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):("awaiting_config"===this._recordingStatus&&(this._recordingStatus="missing_config",iw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.log)?this._lazyLoadedSessionRecording.log(e,t):iw.warn("log called before recorder was ready")}get _scriptName(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(A);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){const e=this._instance.get_property(A);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return iw.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Ft(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,s;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return iw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[De]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null===(n=h.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if("missing_config"===this._recordingStatus||"awaiting_config"===this._recordingStatus)return;return this._recordingStatus="awaiting_config",iw.info("persisted remote config is stale, requesting fresh config before starting"),void new Nb(this._instance).load()}this._recordingStatus=yo,null===(i=(s=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||void 0===i||i.call(s,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=_o}onRRwebEmit(e){var t,i;null===(t=this._lazyLoadedSessionRecording)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null===(i=this._persistence)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},Xw={autocapture:class extends Jy{constructor(e){super(new QS(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Vn.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,Vn.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var i;if(!e||(null===(i=e.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const s=this;kp(e.history,t,e=>function(i,n,r){e.call(this,i,n,r),s._capturePageview(t)})}_getCurrentLocation(){const t=null==e?void 0:e.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:xt(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){const t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e){try{const t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(et,{navigation_type:e}),this._lastLocation=t}catch(t){Vn.error(`Error capturing ${e} pageview`,t)}}_setupPopstateListener(){if(this._popstateListener)return;const t=()=>{this._capturePageview("popstate")};sr(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}_setupHashchangeListener(){if(this._hashchangeListener)return;const t=()=>{this._capturePageview("hashchange")};sr(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!!(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[x]),this.rageclicks=new jy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return xt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Ft(this._config.capture_heatmaps)?Ft(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;sw.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[x]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){const e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){nw(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(s)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&s&&(this._flushHandler=this._flush.bind(this),sr(e,Ye,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),sr(s,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),sr(s,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new db(this.instance,cb,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),sr(s,Xe,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&s&&(this._flushHandler&&e.removeEventListener(Ye,this._flushHandler),this._onClickHandler&&s.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&s.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&s.removeEventListener(Xe,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null===(t=this._deadClicksCapture)||void 0===t||t.stop(),this._initialized=!1)}_getProperties(t,i){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,s){let n=t;for(;n&&vr(n)&&!mr(n,"body");){if(n===s)return!1;let t;try{var r,o,a;t=null===(r=null!==(o=null===(a=n.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:e)||void 0===r?void 0:r.getComputedStyle(n).position}catch(e){return!1}if(ft(i,t))return!0;n=Pr(n)}return!1}(Ir(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:s),target_fixed:o,type:i}}_onClick(e,t="click"){var i;if(fr(e.target)||!nw(e))return;const s=this._getProperties(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&Br(Ir(e),this.instance.config.rageclick)&&this._capture(ct(ct({},s),{},{type:"rageclick"})),this._capture(s)}_onMouseMove(e){!fr(e.target)&&nw(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(t){if(!e)return;const i=this._config.disable_capture_url_hashes?ls(e.location.href):e.location.href,s=this._config.custom_personal_data_properties,n=this._config.mask_personal_data_properties?[...xl,...s||[]]:[],r=ur(i,n,El);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(t)}_flush(){this._buffer&&!It(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:db,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",ct({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>ct(ct({},e),{},{[`$web_vitals_${t.name}_event`]:ct({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Ft(null==e?void 0:e.name)||Ft(null==e?void 0:e.value))return void JS.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this._maskedURL(i);if(Et(s))return;const n=Rt(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void JS.error("Ignoring metric with value >= "+this._maxAllowedValue,e);this._buffer.navigationKey!==n&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Et(this._buffer.navigationKey)&&(this._buffer.navigationKey=n,this._buffer.url=s),this._buffer.firstMetricTimestamp=Et(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=ct(ct(ct({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,xt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of tw){const s="url"===i&&"string"==typeof e.attribution[i]?this._maskedURL(e.attribution[i]):e.attribution[i];Et(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;Et(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let e,t,i,s,n=!1;const r=h.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Et(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Et(a)){const r=a.withoutAttribution,o=this.attributionMetrics;n=!Et(r),e=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(e&&t&&i&&s))return void JS.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},c=n&&this.attributionMetrics.indexOf("INP")>-1?ct(ct({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this),c),this._initialized=!0},this._enabledServerSide=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[M]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=xt(this._perfConfig)?null===(e=this._perfConfig)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Ft(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||YS:i}get flushToCaptureTimeoutMs(){return(xt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=xt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return At(e)?e?YS:[]:kt(e)?e:ew}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=xt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){const e=xt(this._perfConfig)&&Rt(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:XS;return e>0&&6e4>=e?XS:e}get isEnabled(){const e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return JS.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=xt(this._perfConfig)?this._perfConfig.web_vitals:At(this._perfConfig)?this._perfConfig:void 0;return At(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(JS.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=xt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=xt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[M]:i}),this._instance.persistence.register({[L]:s})),this._enabledServerSide=i,this.startIfEnabled()}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t;const i=h.__PosthogExtensions__,s=this._callbackFlavor,n=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&Et(n)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,s,t=>{t?JS.error("failed to load script",t):e()})}_maskedURL(t){const i=t||(null==e?void 0:e.location.href);if(!i)return void JS.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?ls(i):i,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...xl,...n||[]]:[];return ur(s,r,El)}}},Yw={exceptionObserver:class{constructor(t){var i;this._startCapturing=()=>{var t;if(!e||!this.isEnabled||!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=i(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=s(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=n(this.captureException.bind(this)))}catch(e){KS.error("failed to start",e),this._stopCapturing()}},this._instance=t,this._remoteEnabled=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[I]),this._rateLimiter=new Kt(ct(ct({},function(e={}){var t,i,s,n;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(s=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:KS})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xt(e)?t=ct(ct({},t),e):(Et(e)?this._remoteEnabled:e)&&(t=ct(ct({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(KS.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return KS.error("failed to load script",t);e()})}_stopCapturing(){var e,t,i;null===(e=this._unwrapOnError)||void 0===e||e.call(this),this._unwrapOnError=void 0,null===(t=this._unwrapUnhandledRejection)||void 0===t||t.call(this),this._unwrapUnhandledRejection=void 0,null===(i=this._unwrapConsoleError)||void 0===i||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[I]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,s;const n=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(n))return void KS.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=Wv(),this._instance=e,this._suppressionRules=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=Ys(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new en(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Ys(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const n=e.config;if(!("errorTracking"in n))return;const r=null!==(t=null===(i=n.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[E]:this._suppressionRules,[T]:o})}get _captureExtensionExceptions(){var e;const t=!!this._instance.get_property(T),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Tt(e)||0===e.trim().length)return void Dv.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>Js.has(s)?(t.push(s),i):(i[s]=e[s],i),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t));s.length>0&&Dv.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(ct({[Ks]:e,[Zs]:(new Date).toISOString()},i))}catch(e){Dv.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void Dv.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void Dv.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void Dv.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void Dv.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this._exceptionStepsConfig.enabled&&Ft(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,s=function(){const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();s&&(i.$release_id=s);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return e&&this._exceptionStepsBuffer.clear(),e}catch(e){return $v(e)||Dv.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void($v(e)||Dv.error("Failed to process exception event. Ignoring this exception.",e))}}_addBufferedExceptionSteps(e){try{const t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:ct(ct({},e),{},{$exception_steps:t})}catch(t){return Dv.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Ks]:e,[Zs]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return xt(e)?ct({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(Tt(t)&&t.length>0&&e.$exception_types.push(t),Tt(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{const i=e.values.map(e=>{const i=gl[e.operator],s=t[e.key];if(!i||!s)return!1;const n=kt(e.value)?e.value:[e.value];return n.length>0&&i(n,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return Dv.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&qv.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(Nv))||e.some(({type:e,value:t})=>"NoResponse"===e||Tt(t)&&Bv.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(Nv))))}_isInjectedBrowserScriptException(e){return e.some(({value:e})=>Tt(e)&&Hv.some(t=>e.includes(t)))}_isPostHogException(e){if(e.length>0){var t,i,s,n;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],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}_isExceptionList(e){return!Ft(e)&&kt(e)}}},ek=ct({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,s;if(this._persistence&&this._persistence.register({[F]:!!t.productTours}),!ow(this._instance))return!this._productTourManager&&Ft(null===(i=this._persistence)||void 0===i?void 0:i.props.ph_product_tours)||rw.info("product tours disabled; stopping and clearing cached tours"),null===(s=this._productTourManager)||void 0===s||s.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&ow(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"product-tours",t=>{t?rw.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this._productTourManager=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(kt(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});const i=this._persistence;if(i){const s=i.props[ge];if(kt(s)&&!t)return this._cachedTours=s,void e(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:t=>{if(!ow(this._instance))return void e([],{isLoaded:!0});const s=t.statusCode;if(200!==s||!t.json){const i=`Product Tours API could not be loaded, status: ${s}`;return 0===s?t.error||rw.warn(i):rw.error(i),void e([],{isLoaded:!1,error:i})}const n=kt(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[ge]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){Ft(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null===(t=this._productTourManager)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this._productTourManager)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this._productTourManager)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this._productTourManager)||void 0===e||e.previousStep()}clearCache(){var e;this._cachedTours=null,null===(e=this._persistence)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this._productTourManager)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.cancelPendingTour(e)}}},Zw),tk={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(!t)return;const i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:ct(ct({},mn(e,aw)),{},{properties:ct(ct(ct({},e.properties),h?{$set:ct(ct({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:ct(ct({},null!==(s=null===(n=e.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(e)||(lw.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(e)||(lw.error("prepare_external_dependency_script returned null"),null)}return e}_patchSiteAppElementInsertionMethods(){var e,t,i,n,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=null==s?void 0:s.defaultView,u=null==c||null===(e=c.Node)||void 0===e?void 0:e.prototype;if(!c||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();const d=[],h=this,p=new WeakSet,_=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const s=e[t];e[t]=i(s),d.push(()=>{e[t]=s})},g=e=>{if(p.has(e))return e;const t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!Pt(e));return _(u,"appendChild",e=>function(t){const i=g(t);return i?e.call(this,i):t}),_(u,"insertBefore",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):t}),_(u,"replaceChild",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):i}),[null===(t=c.Element)||void 0===t?void 0:t.prototype,null===(i=c.Document)||void 0===i?void 0:i.prototype,null===(n=c.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(e=>{_(e,"append",e=>function(...t){return e.apply(this,f(t))}),_(e,"prepend",e=>function(...t){return e.apply(this,f(t))})}),[null===(r=c.Element)||void 0===r?void 0:r.prototype,null===(o=c.CharacterData)||void 0===o?void 0:o.prototype,null===(a=c.DocumentType)||void 0===a?void 0:a.prototype].forEach(e=>{_(e,"before",e=>function(...t){return e.apply(this,f(t))}),_(e,"after",e=>function(...t){return e.apply(this,f(t))}),_(e,"replaceWith",e=>function(...t){const i=f(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),_(null===(l=c.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){const s=g(i);return s?e.call(this,t,s):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null===(t=this._restoreSiteAppElementPatches)||void 0===t||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){const i=this._patchSiteAppElementInsertionMethods();try{const s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(lw.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this._stopBuffering)||void 0===i||i.call(this))};let s=!1;const n=n=>{t.errored=!n,t.loaded=!0,lw.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:i}=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),n(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){lw.error(cw+e.id,t),n(!1)}if(s&&t.loaded)try{i()}catch(i){lw.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}_setupSiteApps(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){lw.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void lw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this._stopBuffering)||void 0===i||i.call(this),!e.ok)return;const n=e.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:e,url:t}of n.siteApps){var r,o;h[`__$$ph_site_app_${e}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return lw.error(cw+e,t)})}else lw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ik={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{const e=this._syncHostnamesForPatch();var t,i;e?(Et(this._restoreXHRPatch)&&(this._restoreXHRPatch=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Et(this._restoreFetchPatch)&&(this._restoreFetchPatch=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"tracing-headers",t=>{if(t)return ZS.error("failed to load script",t);e()})}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){const e=this._getConfiguredHostnames();return kt(e)?(kt(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(kt(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},sk=ct({surveys:class extends pw{constructor(e){var t;super(new yw(e),(t=e,{get projectToken(){return t.config.token},kv:new mw(t)})),this._instance=e}_sendSurveysRequest(e,t){const i=t.query?jb(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},Zw),nk={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){h.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,n=void 0){var r,o;if(nr(this.instance.config))return!1;if(!e||!s)return!1;t=null!==(r=t)&&void 0!==r?r:e.location,n=null!==(o=n)&&void 0!==o?o:e.history;try{if(!i){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}i=null==e?void 0:e.localStorage}const s=bw||dr(t.hash,"__posthog")||dr(t.hash,"state");let r;const o=s?cs(()=>JSON.parse(atob(decodeURIComponent(s))))||cs(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(Sw)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){const t=h.ph_load_toolbar||h.ph_load_editor;!Ft(t)&&Ct(t)?t(e,this.instance):ww.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==s?void 0:s.getElementById("__POSTHOG_TOOLBAR__"));if(!e||i)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ct(ct({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(e.localStorage.setItem(Sw,JSON.stringify(ct(ct({},r),{},{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var o,a;this._setToolbarState(1),null===(o=h.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",e=>{if(e)return ww.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)}),sr(e,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(r)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},rk=ct({experiments:class t{get _config(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(e=!1)=>{this.getWebExperiments(e=>{t._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;this._flagToExperiments&&(t._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=this._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e));const s=this._instance.getFeatureFlag(e.feature_flag_key);Tt(s)&&e.variants[s]&&this._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(const i in e.variants){const s=e.variants[i];t._matchesTestVariant(s,this._instance)&&this._applyTransforms(e.name,i,s.transforms)}})},e)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t._logInfo(Rw);else if(!this._config.disable_web_experiments){if(Ft(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t._logInfo("applying feature flags",e),e.forEach(e=>{var t;if(this._flagToExperiments&&(null===(t=this._flagToExperiments)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this._applyTransforms(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){const e=t.getWindowLocation();if(null==e?void 0:e.search){const i=cr(null==e?void 0:e.search,"__experiment_id"),s=cr(null==e?void 0:e.search,"__experiment_variant");i&&s&&(t._logInfo(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);const s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this._config.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,i,s){const n=s.filter(t=>t.id===e);n&&n.length>0&&(t._logInfo(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this._applyTransforms(n[0].name,i,n[0].variants[i].transforms))}static _matchesTestVariant(e,i){return!Ft(e.conditions)&&t._matchUrlConditions(e,i)&&t._matchUTMConditions(e)}static _matchUrlConditions(e,i){var s;if(Ft(e.conditions)||Ft(null===(s=e.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,a;const t=_r(i,n.href);return!(null===(r=e.conditions)||void 0===r?void 0:r.url)||Lw[null!==(o=null===(a=e.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](e.conditions.url,t)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(Ft(e.conditions)||Ft(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=Ml();if(i.utm_source){var s,n,r,o,a,l,c,u;const t=!(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static _logInfo(e,...t){Vn.info(`[WebExperiments] ${e}`,t)}_applyTransforms(e,i,s){this._is_bot()?t._logInfo(Rw):"control"!==i?s.forEach(s=>{if(s.selector){var n;t._logInfo(`applying transform of variant ${i} for experiment ${e} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(e=>{const t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):t._logInfo("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?fS(i,this._config.custom_blocked_useragents):void 0}}},Zw),ok={conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations)return;if(this._remoteConfigSuccessful=e.ok,!e.ok)return;const t=e.config.conversations;Ft(t)||(At(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this._isInitializing)return;if(this._instance.config.disable_conversations)return;if(nr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==h?void 0:h.__PosthogExtensions__;if(e&&!Et(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{const t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);const i=e.loadExternalDependency;if(!i)return void this._handleLoadError(Qe);i(this._instance,"conversations",t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else Aw.error("Conversations enabled but missing token in remote config.")}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,Aw.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Aw.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Aw.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():Aw.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Pt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":nr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Et(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Ft(this._remoteConfig)||!this._remoteConfig.token?"missing_token":(null==h?void 0:h.__PosthogExtensions__)?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return rt(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Aw.warn(Ow),null)})()}getMessages(e,t){var i=this;return rt(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Aw.warn(Ow),null)})()}markAsRead(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Aw.warn(Ow),null)})()}getTickets(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Aw.warn(Ow),null)})()}requestRestoreLink(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Aw.warn(Ow),null)})()}restoreFromToken(e){var t=this;return rt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Aw.warn(Ow),null)})()}restoreFromUrlToken(){var e=this;return rt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Aw.warn(Ow),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}_onIdentityCleared(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},ak={logs:class{constructor(t){var i;this._instance=t,this.name=Yg,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Gn("[logs]"),this._coreLogger=ct(ct({},this._logger),{},{error:(...e)=>{e.some(Hw)||this._logger.error(...e)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null===(e=this._core)||void 0===e||e.onReconnect(),null===(t=this._consoleCore)||void 0===t||t.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this._isLogsEnabled=!0),e&&sr(e,"online",this._onReconnect)}_buildCore(e,t,i,s){var n;const r=$w(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,i);return[new Dn(this._createHost(e,t),r,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,s),r]}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,e=>{this._queue=e})),this._core}_getConsoleCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._consoleCore&&this._consoleResolvedFrom===t||(null===(i=this._consoleCore)||void 0===i||i.reset(),this._consoleResolvedFrom=t,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Nw)),this._consoleCore}setup(e){var t;if(this._disposed)return;this._client=e,(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();let i=!1;const s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?s.dispose():(this._remoteConfigSubscription=s,i||this.loadIfEnabled())}dispose(){var t,i,s,n;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null===(t=this._remoteConfigSubscription)||void 0===t||t.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==e||e.removeEventListener("online",this._onReconnect),null===(i=this._consoleLogsDispose)||void 0===i||i.call(this),this._consoleLogsDispose=void 0,null===(s=this._core)||void 0===s||s.reset(),null===(n=this._consoleCore)||void 0===n||n.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;const s=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;Ft(s)?this._stopRecorderStartedByPersistedHint():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!s}),s?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,s;this._stopConsoleRecorder(),null===(e=this._core)||void 0===e||e.clearQueue(),this._queue=[],null===(t=this._core)||void 0===t||t.reset(),null===(i=this._consoleCore)||void 0===i||i.clearQueue(),this._consoleQueue=[],null===(s=this._consoleCore)||void 0===s||s.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_persistedCaptureHint(){var e;return!!(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e[R])}_remoteConfigWillArrive(){var e,t,i;return!(null===(e=this._instance)||void 0===e||null===(t=e._shouldDisableFlags)||void 0===t?void 0:t.call(e))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null===(e=this._consoleCore)||void 0===e||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!(null==h?void 0:h.console))return;const t=$w(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs).maxBufferSize;let i=!0;this._consoleRecorderUnpatchers.push(()=>{i=!1});for(const e of Dw){let s;try{s=kv(h.console[e])}catch(e){continue}s&&this._consoleRecorderUnpatchers.push(kp(h.console,e,n=>{const r=(...s)=>{try{i&&this._recordConsoleEntry(e,s,t)}catch(e){}return n.apply(h.console,s)};return r.__rrweb_original__=s,r}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var s;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(i>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(const e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){const e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(e=>this._logFlushError(e)),this._consoleCore&&this._consoleCore.flush().catch(e=>this._logFlushError(e)))}_logFlushError(e){Hw(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();const t=e.loadExternalDependency;if(!t)return this._logger.error(Qe),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",t=>{if(this._isLoading=!1,this._disposed||!this._isLogsEnabled)return;const i=e.logs;if(t||!(null==i?void 0:i.initializeLogs))this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var s;const e=this._takeConsoleBuffer();var n,r;this._consoleLogsDispose=i.initializeLogs(null!==(s=this._client)&&void 0!==s?s:this._instance),this._isLoaded=!0,e.length>0&&(null===(n=i.replayConsoleBuffer)||void 0===n||n.call(i,null!==(r=this._client)&&void 0!==r?r:this._instance,e))}})}catch(e){throw this._isLoading=!1,e}}_createHost(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===ut.LogsQueue?e():void 0,setPersistedProperty(e,i){var s;e===ut.LogsQueue&&t(null!==(s=i)&&void 0!==s?s:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Xa.LIB_NAME,getLibraryVersion:()=>Xa.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(hr(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:qw(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=e=>{i||(i=!0,clearTimeout(n),t(e))},n=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:qw(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{const t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`logs request failed with status ${t}`)});else{var i;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:qw(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`logs request failed with status ${t}`)})}}})})}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=pr(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,Xa.LIB_NAME,e=>{this._queue=e}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Nw,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,i,s,n){if(0===t.length)return;const r=t.map(e=>e.record);n([]);const o=Ln(r,Rn(i,Xa.LIB_NAME,Xa.LIB_VERSION),s,Xa.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,Ft(s)||(t.sessionStartTimestamp=s),Ft(n)||(t.lastActivityTimestamp=n)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ls(h.location.href):h.location.href),this._instance.featureFlags){const e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},lk={metrics:class{constructor(e){this._instance=e,this._logger=Gn("[metrics]"),this._disposed=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this._disposed)return;const t=!!(null===(e=this._instance.config.metrics)||void 0===e?void 0:e.network);t&&!this._stopNetworkMetrics?this._stopNetworkMetrics=(e=>{let t=!0;const i=()=>t?(e=>{var t;const i=null===(t=e.config.metrics)||void 0===t?void 0:t.network;return!0===i?{}:i||void 0})(e):void 0,s=Qw(e,i),n=Kw(e,i);return()=>{t=!1,s(),n()}})(this._instance):!t&&this._stopNetworkMetrics&&(this._stopNetworkMetrics(),this._stopNetworkMetrics=void 0)}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,this._core=new Hn(this._createHost(),function(e){var t,i,s,n,r;const o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){const t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(e=>this._logger.error("PostHog metrics flush failed:",e))}reset(){var e;null===(e=this._core)||void 0===e||e.reset()}dispose(){var e,t;this._disposed=!0,null===(e=this._stopNetworkMetrics)||void 0===e||e.call(this),this._stopNetworkMetrics=void 0,null===(t=this._core)||void 0===t||t.reset()}_createHost(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Xa.LIB_NAME,getLibraryVersion:()=>Xa.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(i=>{let s=!1;const n=e=>{s||(s=!0,clearTimeout(r),i(e))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ct(ct({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;n({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};GS.__defaultExtensionClasses=ct({},ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct(ct({},Zw),Jw),Xw),Yw),ek),tk),sk),ik),nk),rk),ok),ak),lk)),function(){Xa.SDK_DIST_CHANNEL="cdn";const t=h.posthog;if(t&&!kt(t._i))return;const i=PS[HS]=new GS;if(t){const e=[];Kn(t._i,function(s){if(s&&kt(s)){const n=i.init(s[0],s[1],s[2]),r=t[s[2]]||t;n.__loaded&&-1===e.indexOf(r)&&(e.push(r),n._execute_array.call(n.people,r.people),n._execute_array(r))}})}i.__SV=1,h.posthog=i,function(){function t(){t.done||(t.done=!0,nS=!1,Kn(PS,function(e){e._dom_loaded()}))}(null==s?void 0:s.addEventListener)?"complete"===s.readyState?t():sr(s,"DOMContentLoaded",t,{capture:!1}):e&&Vn.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
2
2
  //# sourceMappingURL=array.full.no-external.js.map