posthog-js 1.438.8 → 1.438.9

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
- const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const h=null!=t?t:{},d="$early_access_features",v="$active_feature_flags",f="$feature_flag_details",p="$feature_flag_errors",g="$feature_flag_evaluated_at",m="$feature_flag_request_id",y="$minimal_flag_called_events",b="$enabled_feature_flags",_="$stored_group_properties",w="$stored_person_properties",k="$flag_call_reported",S="$flag_call_reported_session_id",x="$feature_flag_payloads",C="$override_feature_flags",T="$override_feature_flag_payloads",E="visibilitychange",I="$people_distinct_id",M="distinct_id",R="$device_id",P="$device_model",A="__alias",O="__cmpns",F="$fbc",D="$fbc_persistence",L="$fbp",N="$fbp_persistence",q="__timers",j="$autocapture_disabled_server_side",B="$heatmaps_enabled_server_side",z="$exception_capture_enabled_server_side",U="$error_tracking_suppression_rules",H="$error_tracking_capture_extension_exceptions",W="$web_vitals_enabled_server_side",V="$dead_clicks_enabled_server_side",G="$product_tours_enabled_server_side",Q="$logs_capture_enabled_server_side",Z="$web_vitals_allowed_metrics",J="$session_recording_remote_config",K="$session_recording_enabled_server_side",Y="$replay_sample_rate",X="$replay_override_sampling",tt="$replay_override_linked_flag",et="$replay_override_url_trigger",it="$replay_override_event_trigger",nt="$sesid",st="$session_is_sampled",rt="$session_past_minimum_duration",ot="$session_recording_url_trigger_activated_session",at="$session_recording_event_trigger_activated_session",lt="$posthog_sr_group_event_trigger_",ut="$posthog_sr_group_url_trigger_",ct="$posthog_sr_group_sampling_",ht="$debug_first_full_snapshot_timestamp",dt="$sess_rec_flush_size",vt="$groups",ft="$surveys",pt="$surveys_loaded_at",gt="$surveys_activated",mt="$surveys_activated_session",yt="$surveys_activated_timestamps",bt="ph_product_tours",_t="$product_tours_activated",wt="$product_tours_activated_session",kt="$conversations_widget_session_id",St="$conversations_ticket_id",xt="$conversations_widget_state",$t="$conversations_user_traits",Ct="$user_state",Tt="$client_session_props",Et="$capture_rate_limit",It="$initial_campaign_params",Mt="$initial_referrer_info",Rt="$initial_person_info",Pt="$epp",At="$posthog_cookieless",Ot="$cookieless_mode",Ft="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Lt="$sdk_debug_recording_script_not_loaded",Nt="$sdk_debug_replay_stale_config",qt="$sdk_debug_replay_event_trigger_status",jt="$sdk_debug_replay_linked_flag_trigger_status",Bt="$sdk_debug_replay_matched_recording_trigger_groups",zt="$sdk_debug_replay_pending_trigger_conditions",Ut="$sdk_debug_replay_remote_trigger_matching_config",Ht="$sdk_debug_replay_trigger_groups_count",Wt="$sdk_debug_replay_url_trigger_status",Vt="$sdk_debug_rrweb_attached",Gt="$sdk_debug_rrweb_start_attempted",Qt="$session_recording_start_reason",Zt="PostHog loadExternalDependency extension not found.",Jt="anonymous",Kt="identified",Yt="identified_only",Xt="beforeunload",te="$pageview",ee="$pageleave",ie="$identify",ne="$groupidentify";function se(t,e,i,n,s,r,o){try{var a=t[r](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,s)}function re(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){se(r,n,s,o,a,"next",t)}function a(t){se(r,n,s,o,a,"throw",t)}o(void 0)})}}function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function ae(t,e,i){return(e=function(t){var e=function(t){if("object"!=oe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=oe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function le(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ue(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?le(Object(i),!0).forEach(function(e){ae(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):le(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var ce=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),he=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const de="min_length",ve="max_length",fe=["$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"],pe=["token"];function ge(t,e){return-1!==t.indexOf(e)}const me=function(t){return t.trim()},ye=function(t){return t.replace(/^\$/,"")};function be(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const _e=Object.prototype,we=_e.hasOwnProperty,ke=_e.toString,Se=Array.isArray||function(t){return"[object Array]"===ke.call(t)},xe=t=>"function"==typeof t,$e=t=>t===Object(t)&&!Se(t),Ce=t=>{if($e(t)){for(const e in t)if(we.call(t,e))return!1;return!0}return!1},Te=t=>void 0===t,Ee=t=>"[object String]"==ke.call(t),Ie=t=>Ee(t)&&0===t.trim().length,Me=t=>null===t,Re=t=>Te(t)||Me(t),Pe=t=>"[object Number]"==ke.call(t)&&t==t,Ae=t=>Pe(t)&&t>0,Oe=t=>"[object Boolean]"===ke.call(t),Fe=t=>t instanceof FormData,De=t=>ge(fe,t),Le=t=>ge(pe,t);function Ne(t){return null===t||"object"!=typeof t}function qe(t,e){return{}.toString.call(t)===`[object ${e}]`}function je(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ze(t,Error)}}function Be(t){return"u">typeof Event&&ze(t,Event)}function ze(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],He=t=>ge(Ue,t),We=[!1,"false",0,"0","no"],Ve=["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"],Ge=new Map,Qe=function(t,e=[]){if(!t)return!1;const i=function(t,e){let i="";for(let t=0;e.length>t;t++){const n=e[t];i+=n.length+":"+n}return t.length+":"+t+"|"+e.length+":"+i}(t,e),n=Ge.get(i);if(void 0!==n)return n;const s=t.toLowerCase(),r=Ve.concat(e).some(t=>-1!==s.indexOf(t.toLowerCase()));return 256>Ge.size||Ge.clear(),Ge.set(i,r),r};function Ze(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Pe(t)?t>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Ze(null!=s?s:i,e,i,n))}var Je=class{constructor(t){this.C={},this.I=t.I,this.R=Ze(t.bucketSize,0,100,t.A),this.$=Ze(t.refillRate,0,this.R,t.A),this.O=Ze(t.refillInterval,0,864e5,t.A)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.$,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ke="Mobile",Ye="Android",Xe="Tablet",ti="Android Tablet",ei="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",ai="Chrome iOS",li="Internet Explorer",ui="Internet Explorer Mobile",ci="Opera",hi="Microsoft Edge",di="Firefox",vi="Firefox iOS",fi="Nintendo",pi="PlayStation",gi="Xbox",mi="Android Mobile",yi="Mobile Safari",bi="Windows",_i="Windows Phone",wi="Nokia",ki="Ouya",Si="Generic "+Ke.toLowerCase(),xi="Generic "+Xe.toLowerCase(),$i="Konqueror",Ci="Oculus Browser",Ti="Vivaldi",Ei="Yandex",Ii="Whale",Mi="DuckDuckGo",Ri="Pale Moon",Pi="Waterfox",Ai="Brave",Oi="Claude",Fi="Codex",Di="ChatGPT",Li="Google Search App",Ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),qi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ji=new RegExp(gi,"i"),Bi=new RegExp("PlayStation \\w+","i"),zi=new RegExp("Nintendo \\w+","i"),Ui=new RegExp("BlackBerry|PlayBook|BB10","i"),Hi={"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"},Wi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ge(t,"GSA/")?Li:ge(t," OPR/")&&ge(t,"Mini")?"Opera Mini":ge(t," OPR/")?ci:Ui.test(t)?si:ge(t,"IEMobile")||ge(t,"WPDesktop")?ui:ge(t,"OculusBrowser")?Ci:ge(t,"SamsungBrowser")?ri:ge(t,"Edge")||ge(t,"Edg/")?hi:ge(t,"Vivaldi/")?Ti:ge(t,"YaBrowser/")?Ei:ge(t,"Whale/")?Ii:ge(t,"DuckDuckGo/")||ge(t,"Ddg/")?Mi:ge(t,"Claude/")?Oi:ge(t,"Codex/")?Fi:ge(t,"ChatGPT/")?Di:ge(t,"FBIOS")?"Facebook Mobile":ge(t,"UCWEB")||ge(t,"UCBrowser")?"UC Browser":ge(t,"CriOS")?ai:ge(t,"CrMo")||ge(t,oi)?oi:ge(t,Ye)&&ge(t,ni)?mi:ge(t,"FxiOS")?vi:ge(t.toLowerCase(),$i.toLowerCase())?$i:ge(t,"Brave/")?Ai:((t,e)=>e&&ge(e,"Apple")||function(t){return ge(t,ni)&&!ge(t,oi)&&!ge(t,Ye)}(t))(t,e)?ge(t,Ke)?yi:ni:ge(t,"PaleMoon/")?Ri:ge(t,"Waterfox/")?Pi:ge(t,di)?di:ge(t,"MSIE")||ge(t,"Trident/")?li:ge(t,"Gecko")?di:"")},Vi={[ui]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ni]:[Ni],[yi]:[Ni],[ci]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ni],[mi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Oi]:[qi],[Fi]:[qi],[Di]:[qi],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Li]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gi=function(t,e,i,n){const s=Wi(t,e,i,n),r=Vi[s];if(Te(r))return null;for(let e=0;r.length>e;e++){const i=t.match(r[e]);if(i)return parseFloat(i[i.length-2])}return null},Qi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[gi,t&&t[1]||""]],[new RegExp(fi,"i"),[fi,""]],[new RegExp(pi,"i"),[pi,""]],[Ui,[si,""]],[new RegExp(bi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Ke).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Hi[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[bi,t]}return[bi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Te(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Ye,[t[2],t[3],t[4]||"0"].join(".")]:[Ye,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Zi=function(t){for(let e=0;Qi.length>e;e++){const[i,n]=Qi[e],s=i.exec(t),r=s&&(xe(n)?n(s,t):n);if(r)return r}return["",""]},Ji=function(t){return zi.test(t)?fi:Bi.test(t)?pi:ji.test(t)?gi:new RegExp(ki,"i").test(t)?ki:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ei:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ii:Ui.test(t)?si:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wi,"i").test(t)?wi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Ke).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ye:ti:new RegExp("(pda|Mobile)","i").test(t)?Si:new RegExp(Xe,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?xi:""},Ki=function(t,e){var i;const n=Ji(t);return n===ei||n===ti||"Kobo"===n||"Kindle Fire"===n||n===xi?Xe:n===fi||n===gi||n===pi||n===ki?"Console":n===ii?"Wearable":n?Ke:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Ke:Xe:"Desktop";var s,r,o},Yi=/\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",Yi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Yi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Yi],[/\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"]],tn="[Truncated]",en="[Unserializable]";function nn(t){let e="";for(let i=0;t.length>i;i++){const n=t.charCodeAt(i);if(55296>n||n>56319)e+=56320>n||n>57343?t[i]:"�";else{const n=t.charCodeAt(i+1);56320>n||n>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}function sn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=en}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const rn=3e5;var on=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,rn);if(!e)return this.ts=i,void(this.es=i+n);this.es=Math.max(this.es,Math.min(i+n,this.ts+rn))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(rn,Math.max(0,this.es-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return"string"==typeof(i=t)&&an.test(i)?t:e();var i}function un(t,e){const i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function cn(t){return t?t.split("#")[0]:t}function hn(t){try{return t()}catch(t){return}}function dn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function vn(t,e,i){return fn.apply(this,arguments)}function fn(){return(fn=re(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=dn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let pn,gn,mn,yn;function bn(t){var e;const i=globalThis._posthogChunkIds,n=globalThis._debugIds;if(!i&&!n)return;const s=i?Object.keys(i):[],r=n?Object.keys(n):[];if(yn&&_n(i,s,gn)&&_n(n,r,mn))return yn;gn=i?ue({},i):void 0,mn=n?ue({},n):void 0,yn={},null!==(e=pn)&&void 0!==e||(pn={});const o=(e,i)=>{for(const s of e){const e=i[s];if(!e)continue;const r=null==pn?void 0:pn[s];if(r){yn[r]=e;continue}const o=t(s);for(let t=o.length-1;t>=0;t--){var n;const i=null===(n=o[t])||void 0===n?void 0:n.filename;if(i){yn[i]=e,pn[s]=i;break}}}};return n&&o(r,n),i&&o(s,i),yn}function _n(t,e,i){return t&&i?e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e]):t===i}var wn=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return re(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&Se(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i;let n,s;if(null!=t.cause&&(n=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return ue(ue({},t),{},{cause:n,stack:s,errors:null===(i=t.errors)||void 0===i?void 0:i.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return re(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){const i=[],n=(t,s,r)=>{var o;const a=i.length,l=void 0===s?ue(ue({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:a,parent_id:s},u={type:t.type,value:t.value,mechanism:l};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),i.push(u),t.cause&&n(t.cause,a,"cause");for(const e of null!==(o=t.errors)&&void 0!==o?o:[])n(e,a,"member")};return n(t),i}buildParsingContext(t){var e;return{chunkIdMap:bn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}getAggregateErrors(t){try{if(je(t)){let i=Object.getPrototypeOf(t);for(let n=0;i&&100>n;n++){var e;const n=null===(e=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===e?void 0:e.value;if("function"==typeof n&&"AggregateError"===n.name){const e=t.errors;return Se(e)?e:void 0}i=Object.getPrototypeOf(i)}}}catch(t){}}buildCoercingContext(t,e,i=0){let n=0,s=0,r=!1;const o=new Set,a=[],l={},u=(t,e,i=0)=>{const u=c(e,i),h=u.apply;if(u.apply=e=>{a.push(t);try{return h(e)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===i&&n>=50||d&&o.has(t))return;d&&o.add(t),0===i&&n++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw l}catch(t){if(t===l)return void(0===i&&n--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||n>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>n&&1e3>s&&p>t;t++){let i;s++;try{i=u.next(v[t])}catch(t){n++,i=this.coerceFallback(c(e+1))}i&&g.push(i)}return ue(ue({},f),{},{errors:g})},c=(i,n=0)=>ue(ue({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:0==i?t:{},apply(t){const e=u(t,i,n+1);if(!e)throw l;return e},next:t=>u(t,i+1)}),h=c(i);return ue(ue({},h),{},{apply:t=>{var e;return null!==(e=u(t,i))&&void 0!==e?e:this.coerceFallback(h)}})}};const kn=/^([a-z][a-z0-9.+-]+):/i,Sn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function xn(t){if(!t||"<anonymous>"===t)return!1;const e=kn.exec(t);return!e||Sn.includes(e[1].toLowerCase())}function $n(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:xn(e)};return Te(n)||(r.lineno=n),Te(s)||(r.colno=s),r}const Cn=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Tn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,En=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,In=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mn=(t,e)=>{const i=Tn.exec(t);if(i){const[,t,n,s]=i;return $n(e,t,"?",+n,+s)}const n=En.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=In.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=Cn(n[1]||"?",n[2]);return $n(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Rn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Pn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(t,e)=>{const i=Rn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=Pn.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=Cn(n,t),$n(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},On=/\(error: (.*)\)/;function Fn(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function Dn(t){for(let e=1;10>=e;e++){const i=t.length-2*e;if(0>i)break;let n=!0;for(let s=0;e>s;s++)if(!Fn(t[i+s],t[i+e+s])){n=!1;break}if(n){for(let n=0;e>n;n++)t[i+n]=t[i+e+n];return t.length=i+e,{start:i,length:e}}}}function Ln(t,e){const i=e.start+e.length,n=qn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Nn(t,e){let i=e.start;for(;i>0&&Fn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function qn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&Fn(t[n],t[n-e.length]);)n++;return n-i}function jn(t,e){const i=e[0];let n=t.length-(i?Nn(t,i):0);for(const i of e)n-=qn(t,i);return n}function Bn(t,e,i){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],r=t[(i+n)%t.length];if(s!==r)return r>s}return!1}var zn=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=Ee(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return qe(t,"DOMException")}isDOMError(t){return qe(t,"DOMError")}},Un=class{match(t){return je(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n?null===(i=e.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:s,cause:t.cause?e.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){try{const e=t.stacktrace;if("string"==typeof e&&e.length>0)return e;const i=t.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(t){return}}},Hn=class{match(t){return!!qe(t,"ErrorEvent")&&(null!=t.error||this.ar(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return ue(ue({},n),{},{stack:null!==(i=this.lr(t))&&void 0!==i?i:n.stack,synthetic:!0})}ar(t){return Ee(t.message)&&t.message.length>0}lr(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Ee(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const Wn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Vn=class{match(t){return"string"==typeof t}coerce(t,e){var i;const[n,s]=this.getInfos(t);return{type:null!=n?n:"Error",value:null!=s?s:t,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(t){let e="Error",i=t;const n=t.match(Wn);return n&&(e=n[1],i=n[2]),[e,i]}};const Gn=["fatal","error","warning","log","info","debug"];function Qn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Zn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Be(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Ee(e)&&!Ie(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let e=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(e+=` with message: '${t.message}'`),e}if("message"in t&&"string"==typeof t.message)return t.message;const e=this.getObjectClassName(t);return`${e&&"Object"!==e?`'${e}'`:"Object"} captured as exception with keys: ${Qn(t)}`}isSeverityLevel(t){return Ee(t)&&!Ie(t)&&Gn.indexOf(t)>=0}getStack(t){try{return Ee(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:Ee(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const i=t[e];if(je(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Jn=class{match(t){return Be(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Qn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Kn=class{match(t){return Ne(t)}coerce(t,e){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Yn=class{match(t){return qe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Be(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return Ne(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Xn="$message",ts="$timestamp",es=new Set([Xn,ts]),is={enabled:!0,max_bytes:32768};function ns(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:is.enabled,max_bytes:rs(t.max_bytes,is.max_bytes)}:ue({},is)}var ss=class{constructor(t){this.ns=[],this.ss=0,this.Mr=ns(t)}setConfig(t){this.Mr=ns(t),this.rs()}add(t){const e=function(t){let e;try{e=be(t)}catch(t){return}try{const t=JSON.parse(e);if(!$e(t))return;const i=t,n=i[Xn],s=i[ts];if(!Ee(n)||0===n.trim().length)return;if(!Ee(s)&&!Pe(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Mr.max_bytes||(this.ns.push({step:e.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function rs(t,e){if(!Pe(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const os=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function as(t){return"string"==typeof t||t}function ls(t){return"string"==typeof t?t:void 0}const us=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],cs="NativeGzipValidationError",hs=t=>t.length>=2&&31===t[0]&&139===t[1],ds=(t,e)=>t===he.GZipJS||e===he.GZipJS||"gzip"===e,vs=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),fs=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return vs(t)||e===cs};let ps;const gs=t=>{throw un(cs,`Native gzip produced invalid output: ${t}`)},ms=(ys=re(function*(t,e){18>t.size&&gs("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());hs(i)&&8===i[2]||gs("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(ps)return ps;ps=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;ps[t]=e>>>0}return ps})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&gs("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&gs("invalid-size")}),function(t,e){return ys.apply(this,arguments)});var ys;function bs(t){return _s.apply(this,arguments)}function _s(){return _s=re(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=re(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield ms(a,e),a}catch(t){if(null==i?void 0:i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var n}),_s.apply(this,arguments)}function ws(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const ks="[redacted]",Ss=/^[A-Za-z0-9+/\n\r]+=*$/,xs=/^[A-Za-z0-9_-]+={0,2}$/,$s=/[-_]/,Cs=/^data:[^,\s]*;base64,/i,Ts=/^[A-Za-z0-9+/_-]+={0,2}$/,Es=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Is=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Ms=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Rs=/[\s<>"]/,Ps=new RegExp(Ms.source,"i"),As=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Os=new RegExp(`^${As.source}`,"i"),Fs=new RegExp(As.source,"gi"),Ds=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Ls=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Ns=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,qs=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,js=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Bs=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,zs=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Us=/\b\d(?:[ ./-]?\d){12,}\b/g,Hs=/\d+/g,Ws=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Vs=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Gs(t){return function(t){return Is.test(t)}(t)||Ds.test(t)||Ls.test(t)}function Qs(t){return t.split("&",129).length>128}function Zs(t,e,i){return Gs(t)||e.includes(";")&&function(t){return t.split(";").some(t=>Gs(t.split("=",1)[0]))}(e)?ks:Ps.test(e)?i?er(e,{allowNestedUrls:!1,stripPunctuation:!0}):ks:e}function Js(t,e){const i=new URLSearchParams;let n=!1,s=!1;for(const[r,o]of new URLSearchParams(t)){const t=ir(r),a=ir(o);n||(n=t!==r||a!==o);const l=Zs(t,a,e);n||(n=l!==a),s=Gs(t)||l!==a,i.append(t,l)}return{changed:n,lastFieldSensitive:s,serialized:i.toString()}}function Ks(t,e){if(!t.includes("="))return{value:Ys(t,e),lastFieldSensitive:!1};const i=Js(t,e);return{value:i.changed?i.serialized:t,lastFieldSensitive:i.lastFieldSensitive}}function Ys(t,e){return e?er(t,{allowNestedUrls:!1,stripPunctuation:!0}):Ps.test(t)?ks:t}function Xs(t,e,i){return"#"===t?!e.fragment&&(e.fragment=!0):"?"===t&&(e.fragment?"="!==i&&!e.fragmentQuery&&(e.fragmentQuery=!0):!e.query&&(e.query=!0))}function tr(t,e){var i;if(t.length>8192&&Os.test(t))return ks;const{address:n,suffix:s}=e.stripPunctuation?function(t){let e=t.length;for(;e>0&&".,;:!?)]}'".includes(t[e-1]);)e--;return{address:t.slice(0,e),suffix:t.slice(e)}}(t):{address:t,suffix:""};let r;try{r=new URL(n)}catch(t){return ks+s}const o=r.search.slice(1),a=""!==r.hash,l=function(t){const e=t.slice(1),i=e.indexOf("?");return 0>i?{head:e,tail:null}:{head:e.slice(0,i),tail:e.slice(i+1)}}(r.hash);if(Qs(o)||Qs(l.head)||Qs(null!==(i=l.tail)&&void 0!==i?i:""))return ks+s;let u=!1;(r.username||r.password)&&(r.username=ks,r.password="",u=!0);const c=Js(o,e.allowNestedUrls);c.changed&&(r.search=c.serialized,u=!0);const h=Ks(l.head,e.allowNestedUrls),d=null===l.tail?null:(v=l.tail,h.lastFieldSensitive?{value:""===v?"":ks,lastFieldSensitive:!0}:Ks(v,e.allowNestedUrls));var v;const f=null===d?h.value:`${h.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=a?null!=d?d:h:c;return(u?ir(r.toString()):n)+(p.lastFieldSensitive?"":s)}function er(t,e){return t.replace(Ms,i=>function(t,e){const i=function(t){if(!t.includes("://"))return[];const e=[...t.matchAll(Fs)].map(t=>t.index),i=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,o="";for(let a=0;t.length>a&&e.length>s;a++){e[s]===a&&(a>0&&"="!==o&&i.push(a),s++);const l=t[a];Xs(l,n,o)?(o=l,r=!0):r&&"=&".includes(l)&&(o=l)}return i}(t);if(0===i.length)return tr(t,e);let n="",s=0;for(const r of i)n+=tr(t.slice(s,r),ue(ue({},e),{},{stripPunctuation:!1})),s=r;return n+tr(t.slice(s),e)}(i,ue(ue({},e),{},{stripPunctuation:e.stripPunctuation&&i.length!==t.length})))}function ir(t){return t.replace(Es,ks)}function nr(t,e){return function(t){return t.length>=10240&&(Ss.test(t)||function(t){const e=Cs.exec(t);if(!e)return!1;let i;try{i=decodeURIComponent(t.slice(e[0].length))}catch(t){return!1}return Ts.test(i.replace(/[\r\n]/g,""))}(t)||$s.test(t)&&xs.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,e,i){const n=4*i.maxStringLength;if(t.length>n){const s=e(t.slice(0,function(t,e){let i=e;for(;i>0&&!Rs.test(t[i-1]);)i--;return i}(t,n)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return e(t)}(t,t=>function(t){return er(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let e=t.replace(Ns," ");return e=e.replace(qs,ks),e=e.replace(js,ks),e=e.replace(Bs,`$1${ks}`),e=e.replace(Us,rr),e=e.replace(zs,ks),e=e.replace(Ws,`$1${ks}`),e=e.replace(Vs,`$1${ks}`),e}(ir(t))),e)}function sr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;if(0>s||s>9)return!1;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function rr(t){const e=[];for(let i=Hs.exec(t);null!==i;i=Hs.exec(t))e.push({digits:i[0],start:i.index,end:i.index+i[0].length});let i="",n=0,s=0;for(;e.length>s;){let r="",o=-1;for(let t=s;e.length>t&&(r+=e[t].digits,19>=r.length);t++)r.length>=13&&sr(r)&&(o=t);0>o?s++:(i+=t.slice(n,e[s].start)+ks,n=e[o].end,s=o+1)}return i+t.slice(n)}const or={}.propertyIsEnumerable;function ar(t,e){try{return cr(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function lr(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:tn};if(i.remainingNodes--,Oe(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:nn(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:tn};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?nn(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return lr(s.call(t),e,i,n+1)}catch(t){}return Se(t)?{arrayValue:{values:ur(t,e,i,n+1)}}:{kvlistValue:{values:cr(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:nn(String(t))}}function ur(t,e,i,n){const s=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(Re(r))continue;s.push(lr(r,e,i,n))}catch(t){s.push({stringValue:en})}return t.length>o&&s.push({stringValue:tn}),s}function cr(t,e,i,n){const s=[];for(const r in t)if(or.call(t,r)){if(!r){null==e||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(Me(o)||Te(o))continue;s.push({key:nn(r),value:lr(o,e,i,n)})}catch(t){s.push({key:nn(r),value:{stringValue:en}})}}return s}function hr(t,e,i){return ue(ue(ue(ue({},sn({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}const dr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function vr(t,e){const i=sn({},t),n={};for(const t of dr)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...ar(i,e),...ar(n,e)]}const fr={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 pr={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},gr=pr.info;function mr(t){try{return nn(String(t))}catch(t){return en}}function yr(t,e,i,n){const s=t.level||"info",{text:r,number:o}=pr[s]||gr,a=function(t=Date.now()){return String(t)+"000000"}(Pe(n)?n:void 0),l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),Re(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),Re(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);const u=ue({},l),c=t.attributes;if(c){let t=[];try{t=Object.keys(c)}catch(e){t=[]}for(const e of t){let t;try{t=c[e]}catch(e){t=en}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:mr(t.body)},attributes:ar(u,i)};return t.trace_id&&(h.traceId=t.trace_id),t.span_id&&(h.spanId=t.span_id),Te(t.trace_flags)||(h.flags=t.trace_flags),h}function br(t,e,i){return hr(t,e,i)}function _r(t,e,i,n){return{resourceLogs:[{resource:{attributes:vr(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var wr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=dn(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function kr(){return.75+.5*Math.random()}function Sr(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var xr=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var a;this._instance=t,this.Mr=e,this.A=i,this.hs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new wr(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new on,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ce.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:yr(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.hs(),this.A,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.A.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return n}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var t=this;return re(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return re(function*(){var e;t.ps.clear();let i=null!==(e=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t._s;t.bs=0;const n=Math.min(i.length,t.Es),a=i.slice(0,n),l=_r(a.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(l);if(t._s!==e)return;if("too-large"===u.kind&&a.length>1)t.Es=Math.max(1,Math.floor(a.length/2)),t.A.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(a.length),i=null!==(o=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==o?o:[],s+=a.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return re(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ce.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return br(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ce.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Sr(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ce.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield vn(i,t):yield i})()}flushWithTimeout(t){var e=this;return re(function*(){const i=e.flush();yield vn(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=kr(),this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const $r=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Cr(t){return String(t)+"000000"}function Tr(t,e,i,n){let s="";return n&&(s=Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(n[t])}`).join(",")),`${t}\0${e}\0${null!=i?i:""}\0${s}`}var Er=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.A=i,this.Hs=new Map,this.ps=new wr(()=>this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new on,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Qs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Qs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Qs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=re(function*(){e&&(yield e.catch(()=>{})),yield t.Zs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.A.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.A.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.A.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?ue({},e.attributes):void 0,n=Tr(e.type,e.name,e.unit,i)}catch(t){return void this.A.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.Hs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Hs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.A.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array($r.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,$r)]+=1;break}}}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.A.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return n}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Sr(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var t=this;return re(function*(){if(t.ps.clear(),0===t.Hs.size)return;const e=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=kr()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),n.kind){case"ok":return;case"retry-later":return t.co(e),void t.ps.armNoEarlierThan(t.zs());case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.ho(t),i=function(t,e,i){return hr(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:vr(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}ho(t){const e=Cr(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Tr(o.type,o.name,o.unit,void 0);let a=i.get(t);a||(a=ue({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(t,a));const l=ar(null!==(n=o.attributes)&&void 0!==n?n:{},this.A),u=Cr(o.windowStartMs);if("count"===o.type){var s;const t={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};a.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:l,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(t)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:$r})}return Array.from(i.values())}co(t){for(const[n,s]of t){const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.Hs.set(n,s)}}};function Ir(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Mr="0.9.4",Rr={DEBUG:!1,LIB_VERSION:Mr,LIB_NAME:"browser-common",JS_SDK_VERSION:Mr},Pr=(t,{debugEnabled:e}={})=>{const i={N(i,...n){let s;try{s=typeof window>"u"?void 0:window}catch(t){return}s&&(Rr.DEBUG||s.POSTHOG_DEBUG||e)&&!Te(s.console)&&s.console&&("__rrweb_original__"in s.console[i]?s.console[i].__rrweb_original__:s.console[i])(t,...n)},debug(...t){i.N("debug",...t)},info(...t){i.N("log",...t)},warn(...t){i.N("warn",...t)},error(...t){i.N("error",...t)},critical(...e){console.error(t,...e)},uninitializedWarning(t){i.error(`You must initialize PostHog before calling ${t}`)},createLogger:(e,i)=>Pr(`${t} ${e}`,i)};return i},Ar=Pr("[PostHog.js]"),Or=Ar.createLogger;function Fr(t,e){Se(t)&&t.forEach(e)}function Dr(t,e){if(!Re(t))if(Se(t))t.forEach(e);else if(Fe(t))t.forEach((t,i)=>e(t,i));else for(const i in t)we.call(t,i)&&e(t[i],i)}const Lr=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Nr(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const qr=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Ar.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ar.critical(t)}}},jr=function(t){const e={};return Dr(t,function(t,i){(Ee(t)&&t.length>0||Pe(t))&&(e[i]=t)}),e};function Br(t){const e=ue({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const zr=["herokuapp.com","vercel.app","netlify.app"];function Ur(t){const e=null==t?void 0:t.hostname;if(!Ee(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of zr)if(i===t)return!1;return!0}function Hr(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function Wr(t){return"ph_toolbar_internal"===t.name}const Vr=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Gr=(t,e)=>t>=e&&Vr(),Qr=(t,e,i,n)=>{if(0===t){if(Vr()){const t=e+1;return t===i&&n(),t}return e}return 0},Zr=["localhost","127.0.0.1"],Jr=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return je(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,Br(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return be(t)}},Kr=t=>{const e=null==n?void 0:n.createElement("a");return Te(e)?null:(e.href=t,e)},Yr=function(t,e="&"){let i,n;const s=[];return Dr(t,function(t,e){Te(t)||Te(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),n=encodeURIComponent(e),s[s.length]=n+"="+i)}),s.join(e)},Xr=function(t,e){const i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let t=0;i.length>t;t++){const s=i[t].split("=");if(s[0]===e){n=s;break}}if(!Se(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Ar.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},to=function(t,e,i){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],r=(n[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),u=[];for(let t=0;l.length>t;t++){const n=l[t].split("=");Se(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(l[t]))}let c=a;return null!=o&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},eo=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null};function io(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!xe(n))return e;try{const t=n(e);return Ee(t)&&t?t:e}catch(t){return Ar.error("Error in get_current_url, falling back to window.location.href",t),e}}function no(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Te(n)?void 0:io(e,n)}function so(t){var e;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(e=t.closest)||void 0===e?void 0:e.call(t,".toolbar-global-fade-container")))}function ro(t){return!!t&&1===t.nodeType}function oo(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function ao(t){return!!t&&3===t.nodeType}function lo(t){return!!t&&11===t.nodeType&&ro(t.host)}function uo(t){return t?me(t).split(/\s+/):[]}function co(t,e){const i=no(e);return!!(i&&t&&t.some(t=>i.match(t)))}function ho(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return uo(e)}function vo(t){return Re(t)?null:me(t).split(/(\s+)/).filter(t=>Wo(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function fo(t){let e="";return Do(t)&&!Lo(t)&&t.childNodes&&t.childNodes.length&&Dr(t.childNodes,function(t){var i;ao(t)&&t.textContent&&(e+=null!==(i=vo(t.textContent))&&void 0!==i?i:"")}),me(e)}function po(t){var e;return Te(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const go=["a","button","form","input","select","textarea","label"];function mo(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function yo(t,e){if(Te(e))return!0;for(const i of t)if(e.some(t=>mo(i,t)))return!0;return!1}function bo(t){const e=t.parentNode;return!(!e||!ro(e))&&e}const _o=[".ph-no-autocapture","[data-ph-no-autocapture]"],wo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],ko=[...wo,"+","-","−","–"],So=ko.length+10,xo=["button","a","input","select","textarea","label"],$o=["button","link","tab","menuitem","option"],Co=(t,e)=>/[a-z0-9]/i.test(e)?ge(ko,e)?new RegExp(`\\b${e}\\b`).test(t):t.includes(e):t===e,To=t=>ge(xo,t.tagName.toLowerCase())||ge($o,(t.getAttribute("role")||"").toLowerCase());function Eo(t){let e="",i="";const n=t=>{ro(t)&&Do(t)&&!Lo(t)&&(e+=` ${fo(t)}`,i=i||t.getAttribute("aria-label")||"",Dr(t.childNodes,n))};n(t),e=me(e.replace(/\s+/g," "));const s=(Wo(e)?e:"").toLowerCase(),r=t.getAttribute("aria-label")||(s?"":i);return{safeText:s,ariaLabel:me(r).toLowerCase()}}const Io=[".ph-no-deadclick",".ph-no-capture"],Mo=[".ph-no-rageclick",".ph-no-capture"],Ro=["","text","search","email","password","url","tel","number"];function Po(t){return!(!t||!ro(t))&&(!!oo(t,"textarea")||(oo(t,"input")?ge(Ro,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}function Ao(e,i){if(!t||Oo(e))return!1;let n,s,r;var o,a;if(Oe(i)?(n=!!i&&Mo,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Mo,s=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===n)return!1;if(r&&Po(e))return!1;const{targetElementList:l}=Fo(e,!1);return!(s&&function(t,{safeText:e,ariaLabel:i}){let n;if(!0===t)n=wo;else{if(!Se(t))return!1;if(t.length>So)return Ar.error(`[PostHog] content_ignorelist array cannot exceed ${So} items. Use css_selector_ignorelist for more complex matching.`),!1;n=t.map(t=>t.toLowerCase())}return n.some(t=>Co(e,t)||Co(i,t))}(s,function(e,i){for(const t of i)if(To(t))return Eo(t);for(const e of i){try{if("pointer"!==(null==t?void 0:t.getComputedStyle(e).getPropertyValue("cursor")))break}catch(t){break}const i=Eo(e);if(i.safeText||i.ariaLabel)return i}return Eo(e)}(e,l))||yo(l,n))}const Oo=t=>!t||oo(t,"html")||!ro(t),Fo=(e,i)=>{if(!t||Oo(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!oo(r,"body");){if(lo(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=bo(r);if(!e)break;if(i||go.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function Do(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!oo(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=ho(n);if(ge(t,"ph-sensitive")||ge(t,"ph-no-capture"))return!1}if(ge(ho(t),"ph-include"))return!0;const n=t.type||"";if(Ee(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!Ee(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Lo(t){return!!(oo(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||oo(t,"select")||oo(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const No=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}))$"),qo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,jo=[16,15,14,13],Bo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),zo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Uo=/[0-9A-Za-z_]/;function Ho(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function Wo(t,e=!0){if(Re(t))return!1;if(Ee(t)){if(t=me(t),e?No.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(qo.lastIndex=0;e=qo.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of jo){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(No.test(e)&&Ho(e))return!0}}}return!1}(t))return!1;if(e?Bo.test(t):function(t){let e;for(zo.lastIndex=0;e=zo.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Uo.test(t)&&Uo.test(i)))return!0}return!1}(t))return!1}return!0}function Vo(t){let e=fo(t);return e=`${e} ${Go(t)}`.trim(),Wo(e)?e:""}function Go(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Dr(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=fo(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${Go(t)}`.trim())}catch(t){Ar.error("[AutoCapture]",t)}}),e}function Qo(t){return t.replace(/"|\\"/g,'\\"')}function Zo(t){const e=t.attr__class;if(e)return Se(e)?e:uo(e)}const Jo=1e6;function Ko(t){var e;return Math.min(Jo,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Jo)}const Yo={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Jo,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},Xo=["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"],ta=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ea=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ia=t=>{Re(t)||Dr(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Xo.includes(e)||ea.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},na=["/s/","/e/","/i/"];function sa(t,e,i,n){if(Re(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return Ee(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function ra(t,e){if(Re(t))return t;let i=t;return Wo(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Dr(ta,t=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(t))&&(i="[SessionRecording] "+e+" body redacted as might contain: "+t)}),i}const oa=new WeakSet,aa="disabled",la="sampled",ua="active",ca="buffering",ha="paused",da="lazy_loading",va="rrweb_error",fa="trigger_activated",pa="trigger_pending",ga="trigger_disabled";function ma(t,e,i,n,s,r){return 0===e?ga:(null==t?void 0:t.get_property(i?n+i:s))===r?fa:pa}function ya(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function ba(t){return t.includes("trigger_activated")?fa:t.includes("trigger_pending")?pa:ga}function _a(t){const e=new Set(t);switch(e.delete(ga),e.size){case 0:return ga;case 1:return Array.from(e)[0];default:return pa}}var wa=class{constructor(t){this.q=t}triggerStatus(t){return ba(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return ba(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},ka=class{constructor(t){this.q=t}triggerStatus(t){return _a(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return _a(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Sa=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return fa}stop(){}};const xa=t=>"sessionRecording"in t;var $a=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(xa(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(xa(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.G()}G(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Ar.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Ar.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}Z(t){return ma(this._instance,this.j.length,this.V,ut,ot,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Wt]:e}),e}triggerStatusNoSideEffects(t){return this.Z(t)}isCurrentUrlBlocked(){const t=no(this._instance);if(!t)return!1;try{return ya(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=no(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=ya(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=no(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=ya(s,this.B,this.U);o&&!r?t():!o&&r&&e();const a=this.Z(n)===fa,l=ya(s,this.j,this.H);!a&&l&&i("url",s)}stop(){this.W=""}},Ca=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[jt]:t}),t}triggerStatusNoSideEffects(){let t=pa;return Re(this.linkedFlag)&&(t=ga),this.linkedFlagSeen&&(t=fa),t}onConfig(t,e){var i;if(this.linkedFlag=(xa(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Ee(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Ee(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if($e(s)&&t in s){const e=s[t];r=Oe(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Ta=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(xa(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return ma(this._instance,this.K.length,this.V,lt,at,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[qt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===fa,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Ea=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new $a(t,e.id),this.tt=new Ta(t,e.id),this.et=new Ca(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new wa(s):new ka(s)}else this.nt=new Sa}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===pa).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?ut+this.group.id:lt+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function Ia(t){if(t.rrwebError)return va;if(!t.receivedFlags)return ca;if(!t.isRecordingEnabled)return aa;if(t.urlTriggerMatching.urlBlocked)return ha;const e=!0===t.isSampled,i=new wa([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?la:"trigger_activated"===i?ua:"trigger_pending"===i?ca:!1===t.isSampled?aa:ua}function Ma(t){if(t.rrwebError)return va;if(!t.receivedFlags)return ca;if(!t.isRecordingEnabled)return aa;if(t.urlTriggerMatching.urlBlocked)return ha;const e=new ka([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==ga,n=Oe(t.isSampled);return i&&"trigger_pending"===e?ca:i&&"trigger_disabled"===e||n&&!t.isSampled?aa:!0===t.isSampled?la:ua}function Ra(){const t=[];return function(e,i){if($e(i)||Se(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function Pa(t){try{const e=JSON.stringify(t,Ra());return e?new Blob([e]).size:0}catch(t){return-1}}function Aa(t){if(Me(t))return 4;if(Te(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(Se(t)){let e=2;for(let i=0;t.length>i;i++){i>0&&(e+=1);const n=t[i];e+=Te(n)||Me(n)?4:Aa(n)}return e}const e=t;let i=2,n=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const s=e[t];Te(s)||(n||(i+=1),n=!1,i+=t.length+3+Aa(s))}return i}default:return 0}}function Oa(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),i=t.sizes.slice(0,e),n=t.sizes.slice(e);return[Oa({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Oa({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var Fa=Uint8Array,Da=Uint16Array,La=Uint32Array,Na=new Fa([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]),qa=new Fa([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]),ja=new Fa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ba=function(t,e){for(var i=new Da(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new La(i[30]);for(n=1;30>n;++n)for(var r=i[n];i[n+1]>r;++r)s[r]=r-i[n]<<5|n;return[i,s]},za=Ba(Na,2),Ua=za[1];za[0][28]=258,Ua[258]=28;for(var Ha=Ba(qa,0)[1],Wa=new Da(32768),Va=0;32768>Va;++Va){var Ga=(43690&Va)>>>1|(21845&Va)<<1;Wa[Va]=((65280&(Ga=(61680&(Ga=(52428&Ga)>>>2|(13107&Ga)<<2))>>>4|(3855&Ga)<<4))>>>8|(255&Ga)<<8)>>>1}var Qa=function(t,e,i){for(var n=t.length,s=0,r=new Da(e);n>s;++s)++r[t[s]-1];var o,a=new Da(e);for(s=0;e>s;++s)a[s]=a[s-1]+r[s-1]<<1;if(i){o=new Da(1<<e);var l=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],c=e-t[s],h=a[t[s]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Wa[h]>>>l]=u}else for(o=new Da(n),s=0;n>s;++s)o[s]=Wa[a[t[s]-1]++]>>>15-t[s];return o},Za=new Fa(288);for(Va=0;144>Va;++Va)Za[Va]=8;for(Va=144;256>Va;++Va)Za[Va]=9;for(Va=256;280>Va;++Va)Za[Va]=7;for(Va=280;288>Va;++Va)Za[Va]=8;var Ja=new Fa(32);for(Va=0;32>Va;++Va)Ja[Va]=5;var Ka=Qa(Za,9,0),Ya=Qa(Ja,5,0),Xa=function(t){return(t/8|0)+(7&t&&1)},tl=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Da?Da:t instanceof La?La:Fa)(i-e);return n.set(t.subarray(e,i)),n},el=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},il=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},nl=function(t,e){for(var i=[],n=0;t.length>n;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,r=i.slice();if(!s)return[new Fa(0),0];if(1==s){var o=new Fa(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Da(d+1),f=sl(i[c-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var b=r[n].s;e>v[b]?p-=1<<e-v[b]++-1:++n}for(;n>=0&&p;--n){var _=r[n].s;v[_]==e&&(--v[_],++p)}f=e}return[new Fa(v),f]},sl=function(t,e,i){return-1==t.s?Math.max(sl(t.l,e,i+1),sl(t.r,e,i+1)):e[t.s]=i},rl=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Da(++e),n=0,s=t[0],r=1,o=function(t){i[n++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++r;else{if(!s&&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(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=t[a]}return[i.subarray(0,n),e]},ol=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},al=function(t,e,i){var n=i.length,s=Xa(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;n>r;++r)t[s+r+4]=i[r];return 8*(s+4+n)},ll=function(t,e,i,n,s,r,o,a,l,u,c){el(e,c++,i),++s[256];for(var h=nl(s,15),d=h[0],v=h[1],f=nl(r,15),p=f[0],g=f[1],m=rl(d),y=m[0],b=m[1],_=rl(p),w=_[0],k=_[1],S=new Da(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=nl(S,7),T=C[0],E=C[1],I=19;I>4&&!T[ja[I-1]];--I);var M,R,P,A,O=u+5<<3,F=ol(s,Za)+ol(r,Ja)+o,D=ol(s,d)+ol(r,p)+o+14+3*I+ol(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=O&&D>=O)return al(e,c,t.subarray(l,l+u));if(el(e,c,1+(F>D)),c+=2,F>D){M=Qa(d,v,0),R=d,P=Qa(p,g,0),A=p;var L=Qa(T,E,0);for(el(e,c,b-257),el(e,c+5,k-1),el(e,c+10,I-4),c+=14,x=0;I>x;++x)el(e,c+3*x,T[ja[x]]);c+=3*I;for(var N=[y,w],q=0;2>q;++q){var j=N[q];for(x=0;j.length>x;++x)el(e,c,L[B=31&j[x]]),c+=T[B],B>15&&(el(e,c,j[x]>>>5&127),c+=j[x]>>>12)}}else M=Ka,R=Za,P=Ya,A=Ja;for(x=0;a>x;++x)if(n[x]>255){var B;il(e,c,M[257+(B=n[x]>>>18&31)]),c+=R[B+257],B>7&&(el(e,c,n[x]>>>23&31),c+=Na[B]);var z=31&n[x];il(e,c,P[z]),c+=A[z],z>3&&(il(e,c,n[x]>>>5&8191),c+=qa[z])}else il(e,c,M[n[x]]),c+=R[n[x]];return il(e,c,M[256]),c+R[256]},ul=new La([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),cl=new Fa(0),hl=function(){for(var t=new La(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),dl=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function vl(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,n=0;e.length>n;++n)i=hl[255&i^e[n]]^i>>>8;t=i},d(){return 4294967295^t}}}(),n=t.length;i.p(t);var s,r,o,a,l,u=(s=t,r=e,o=function(t){return 10+(t.filename&&t.filename.length+1||0)}(e),a=8,function(t,e,i,n,s,r){var o=t.length,a=new Fa(n+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(n,a.length-s),u=0;if(!e||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=al(l,u,t.subarray(c,h)):(l[c]=r,u=al(l,u,t.subarray(c,o)))}else{for(var d=ul[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Da(32768),m=new Da(p+1),y=Math.ceil(i/3),b=2*y,_=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},w=new La(25e3),k=new Da(288),S=new Da(32),x=0,C=0,T=(c=0,0),E=0,I=0;o>c;++c){var M=_(c),R=32767&c,P=m[M];if(g[R]=P,m[M]=R,c>=E){var A=o-c;if((x>7e3||T>24576)&&A>423){u=ll(t,l,0,w,k,S,C,T,I,c-I,u),T=x=C=0,I=c;for(var O=0;286>O;++O)k[O]=0;for(O=0;30>O;++O)S[O]=0}var F=2,D=0,L=f,N=R-P&32767;if(A>2&&M==_(c-N))for(var q=Math.min(v,A)-1,j=Math.min(32767,c),B=Math.min(258,A);j>=N&&--L&&R!=P;){if(t[c+F]==t[c+F-N]){for(var z=0;B>z&&t[c+z]==t[c+z-N];++z);if(z>F){if(F=z,D=N,z>q)break;var U=Math.min(N,z-2),H=0;for(O=0;U>O;++O){var W=c-N+O+32768&32767,V=W-g[W]+32768&32767;V>H&&(H=V,P=W)}}}N+=(R=P)-(P=g[R])+32768&32767}if(D){w[T++]=268435456|Ua[F]<<18|Ha[D];var G=31&Ua[F],Q=31&Ha[D];C+=Na[G]+qa[Q],++k[257+G],++S[Q],E=c+F,++x}else w[T++]=t[c],++k[t[c]]}}u=ll(t,l,r,w,k,S,C,T,I,c-I,u),r||(u=al(l,u,cl))}return tl(a,0,n+Xa(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,a,!l)),c=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&dl(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;i.length>=n;++n)t[n+10]=i.charCodeAt(n)}}(u,e),dl(u,c-8,i.d()),dl(u,c-4,n),u}function fl(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Fa(t.length+(t.length>>>1)),s=0,r=function(t){n[s++]=t},o=0;i>o;++o){if(s+5>n.length){var a=new Fa(s+8+(i-o<<1));a.set(n),n=a}var l=t.charCodeAt(o);128>l||e?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&t.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 tl(n,0,s)}function pl(t,e){var i="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var n=0;t.length>n;){var s=t[n++];128>s||e?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&t[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&t[n++])<<6|63&t[n++]):(s=((15&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var gl=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,a,l;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=t.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=Aa(t);var a,l;return o>this.ct?(null===(a=(l=this.it).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Je({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,A:Ar}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Pe(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const ml=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Pe(t)&&isFinite(t)&&Math.floor(t)===t});var yl=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,n,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>i||0>n||0>s||e>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|i>>>8,r[7]=i,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t(r)}toString(){let t="";for(let e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let e=0;16>e;e++){const i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},bl=class{generate(){const t=this.generateOrAbort();if(!Te(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(Te(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Pe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.It();else{if(this.Ct>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return yl.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new wl}};let _l=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Te(t.crypto)&&crypto.getRandomValues&&(_l=t=>crypto.getRandomValues(t));var wl=class{nextUint32(){return this.Rt.length>this.Et||(_l(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let kl;const Sl=()=>xl().toString(),xl=()=>(kl||(kl=new bl)).generate();let $l="";const Cl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Tl=null;const El={At(){if(!Me(Tl))return Tl;if(Tl=!1,n)try{const t=`__ph_cookie_support_${Sl()}`;El.$t(t,"xyz"),Tl='"xyz"'===ml(t),El.Pt(t)}catch(t){Tl=!1}return Tl},Lt(t){Ar.error("cookieStore error: "+t)},Ot:ml,Dt(t){let e;try{e=JSON.parse(El.Ot(t))||{}}catch(t){}return e},$t(t,e,i,s,r){if(!n)return!1;try{let o="",a="";const l=function(t,e){if(e){let e=function(t,e=n){if($l)return $l;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Sl();for(;!$l&&s--;){const t=i.slice(s).join("."),n=r+"=1;domain=."+t+";path=/";e.cookie=n+";max-age=3",e.cookie.includes(r)&&(e.cookie=n+";max-age=0",$l=t)}return $l}(t);if(!e){const i=(t=>{const e=t.match(Cl);return e?e[0]:""})(t);i!==e&&Ar.info("Warning: cookie subdomain discovery mismatch",i,e),e=i}return e?"; domain=."+e:""}return""}(n.location.hostname,s);if(i){const t=new Date;t.setTime(t.getTime()+864e5*i),o="; expires="+t.toUTCString()}r&&(a="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Ar.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Pt(t,e){if((null==n?void 0:n.cookie)&&(!e||!Me(ml(t))))try{El.$t(t,"",-1,e)}catch(t){return}}};let Il=null;const Ml={At(){if(!Me(Il))return Il;let e=!0;if(Te(t))e=!1;else try{const t="__mplssupport__";Ml.$t(t,"xyz"),'"xyz"'!==Ml.Ot(t)&&(e=!1),Ml.Pt(t)}catch(t){e=!1}return e||Ar.error("localStorage unsupported; falling back to cookie store"),Il=e,e},Lt(t){Ar.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ml.Lt(t)}return null},Dt(t){try{return JSON.parse(Ml.Ot(t))||{}}catch(t){}return null},$t(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ml.Lt(t)}return!1},Pt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ml.Lt(t)}}},Rl=[w,v,b,f,x,m,g,p,k],Pl=[R,M,nt,st,Pt,Rt,D,Ct],Al=t=>t+"_cpm",Ol=["__proto__","constructor","prototype"],Fl=t=>{if(!$e(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Ol.indexOf(i)&&(e[i]=t[i])}),e},Dl=(t,e=[])=>{const i={};return[...Pl,...e].forEach(e=>{const n=t[e];Te(n)||Me(n)||""===n||(i[e]=n)}),i},Ll=t=>{let e=5381,i=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Nl=(t,e)=>({p:e,f:Ll(JSON.stringify(t))}),ql=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=El.Dt(Al(t)),n=(null==i?void 0:i.f)===Ll(e)&&Se(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},jl=(t,e)=>e+"|"+(El.Ot(Al(t))||""),Bl={},zl={At:()=>!0,Lt(t){Ar.error("memoryStorage error: "+t)},Ot:t=>t in Bl?Bl[t]:null,Dt:t=>t in Bl?Bl[t]:null,$t:(t,e)=>(Bl[t]=e,!0),Pt(t){delete Bl[t]}};let Ul=null;const Hl={At(){if(!Me(Ul))return Ul;if(Ul=!0,Te(t))Ul=!1;else try{const t="__support__";Hl.$t(t,"xyz"),'"xyz"'!==Hl.Ot(t)&&(Ul=!1),Hl.Pt(t)}catch(t){Ul=!1}return Ul},Lt(t){Ar.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Hl.Lt(t)}return null},Dt(t){try{return JSON.parse(Hl.Ot(t))||null}catch(t){}return null},$t(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Hl.Lt(t)}return!1},Pt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Hl.Lt(t)}}};Rr.DEBUG=!1,Rr.LIB_VERSION="1.438.8",Rr.LIB_NAME="web";var Wl=Rr,Vl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(dt,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(dt);return $e(i=e)&&Ee(i.sessionId)&&Pe(i.size)&&e.sessionId===t?e.size:0;var i}};function Gl(t,e){return function(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return Math.abs(e)}(t)%100<Ze(100*e,0,100,Ar)}function Ql(t){return`$survey_response_${t}`}function Zl(t,e){if(!e)return null;const i=t[Ql(e)];return Se(i)?[...i]:i}function Jl({event:t,survey:e,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return ue(ue(ue(ue({},!Te(n)&&{$survey_submission_id:n}),"sent"===t?!Te(s)&&{$survey_completed:s}:{$survey_partially_completed:Kl(i)}),r&&{$survey_language:r}),function(t={},e,i){const n={};return e.questions.forEach(e=>{if(Te(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=Zl(t,e.id);Te(r)||(n[i]=r)}),ue(ue({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:Zl(t,e.id)}})},t),n)}(i,e,o))}function Kl(t={}){return Object.values(t).some(t=>!Re(t))}function Yl(t,e){let i=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(i=`$survey_${e}/${t.id}/${t.current_iteration}`),i}function Xl(t){return"string"==typeof t&&t.trim()?t.trim():null}function tu(t){return t.toLowerCase()}function eu(t,e,i){if(!t||!e)return null;const n=tu(e),s=Object.keys(t).find(t=>tu(t)===n);if(s)return null==i||i.debug(`Found exact translation match: ${s}`),s;if(n.includes("-")){const s=n.split("-")[0],r=Object.keys(t).find(t=>tu(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const iu=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function nu(t,e,i){var n;const s=eu(t.translations,e,i),r=ue({},t);let o=!1;if(s){var a;const e=null===(a=t.translations)||void 0===a?void 0:a[s];if(e)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),Te(e.name)||(r.name=e.name,o=!0),r.appearance){const t=ue({},r.appearance);for(const i of iu){const n=e[i];Te(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return iu.some(e=>!Te(t[e]))})(e)&&(o=!0)}const l=t.questions.map(t=>function(t,e,i){var n;const s=eu(t.translations,e,i);if(!s)return{question:t,matchedKey:null,hasChanges:!1};const r=null===(n=t.translations)||void 0===n?void 0:n[s];if(!r)return{question:t,matchedKey:null,hasChanges:!1};const o=ue({},t);let a=!1;return Te(r.question)||(o.question=r.question,a=!0),Te(r.description)||(o.description=r.description,a=!0),Te(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Te(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Te(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Te(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(t){return Se(t.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:t,matchedKey:a?s:null,hasChanges:a}}(t,e,i)),u=l.map(t=>t.question),c=l.some(t=>t.hasChanges);let h=null;return s||(h=(null===(n=l.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),c&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||h:null}}function su(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}function ru(t){var e;return su(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const ou=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},au=t=>t.toLowerCase(),lu={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>ou(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!ou(e,t))),icontains:(t,e)=>e.map(au).some(e=>t.map(au).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(au).every(e=>t.map(au).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i<parseFloat(t))})};function uu(t,e){return!t||Object.entries(t).every(([t,i])=>{const n=null==e?void 0:e[t];if(null==n)return!1;const s=lu[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const cu=t=>{const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e};function hu(t,e,i){return Jr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const du=new Set(["is_not","not_icontains","not_regex"]);function vu(t,e,i){return!t||0===t.length||t.every(t=>{const n="person"===t.type?i:e,s=null==n?void 0:n[t.key],r=t.operator||"exact";if(Te(s)||Me(s))return du.has(r);const o=lu[r];return!!o&&!Te(t.value)&&!Me(t.value)&&o(Se(t.value)?t.value.map(String):[String(t.value)],Se(s)?s.map(String):[String(s)])})}const fu=Or("[SessionRecording]");function pu(t,e){return e?t:"!"+t}function gu(t,e){return t===e||t!=="!"+e&&null}var mu=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.zt=null,this.Ht=Ma}onRemoteConfig(t){this.zt=Pe(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new wa([this.tt,this.Y]),this.Ht=Ia):(this.Ut=new ka([this.tt,this.Y]),this.Ht=Ma),this._instance.register_for_session({[Ut]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.Ht({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Pe(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Re(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){fu.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.zt;var n,s;if(!Pe(i))return null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"));const r=this._instance.get_property(st),o=this._instance.get_property(Y),a=gu(r,t),l=Pe(o)&&o!==i,u=Te(o)&&r===t,c=l||u||!Oe(a),h=c?Gl(t,i):a;c&&(h?this.qt("sampled"):fu.warn(`Sample rate (${i}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:pu(t,h),$replay_sample_rate:Me(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Pe(this.zt))return;const e=this._instance.get_property(st);Oe(gu(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===pa}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===pa).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},yu=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Gt=[],this.Qt=new Map,this.Zt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[Ut]:"v2_trigger_groups",[Ht]:t.triggerGroups.length}),this.Y.onConfig(t)):fu.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return va;if(!t.receivedFlags)return ca;if(!t.isRecordingEnabled)return aa;if(t.urlTriggerMatching.urlBlocked)return ha;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return aa;let n=!1,s=!1;for(const r of e){const e=r.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=r.group.id,e=i.get(t);Te(e)?Ar.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?la:n?ca:aa}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Gt,triggerGroupSamplingResults:this.Qt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Gt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Pe(t)&&(Me(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Gt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Zt)return fu.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Gt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(w);s.some(e=>!e.properties||0===e.properties.length||vu(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){fu.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Gt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=ct+s,a=this._instance.get_property(o);let l=null,u=!1,c=!1,h=!1;if($e(a)){const e=a.sessionId,i=a.sampleRate,n=a.sampled;u="string"==typeof e&&e!==t,c=Pe(i)&&i!==r,l=e===t&&Pe(i)&&i===r&&Oe(n)?n:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!Oe(l),v=d?Gl(t+s,r):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Qt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Zt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Gt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Gt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Qt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Bt]:e})}hasPendingTriggers(t){for(const e of this.Gt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Gt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||vu(i,e,this._instance.get_property(w))}Jt(t){this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear();for(const e of t){const t=new Ea(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Gt.push(t)}}};function bu(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const _u=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],wu=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._u],ku="<masked>",Su=["li_fat_id"];function xu(t,e,i){if(!n)return{};const s=e?[..._u,...i||[]]:[],r=$u(to(n.URL,s,ku),t),o=function(){const t={};return Dr(Su,function(e){const i=ml(e);t[e]=i||null}),t}();return Lr(o,r)}function $u(t,e){const i=wu.concat(e||[]),n={};return Dr(i,function(e){const i=Xr(t,e);n[e]=i||null}),n}function Cu(t){const e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!Me(e)){s.$search_engine=e;const t=n?Xr(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Tu(){return navigator.language||navigator.userLanguage}function Eu(){const t=Tu();return"string"==typeof t?t.split("-")[0]:void 0}const Iu="$direct";function Mu(){return(null==n?void 0:n.referrer)||Iu}function Ru(t,e,i=!1){const n=t?[..._u,...e||[]]:[],r=i?cn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Mu().substring(0,1e3),u:o?to(o,n,ku):void 0}}function Pu(t,e=!1){var i;const{r:n,u:s}=t,r=e?cn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Iu?Iu:null===(i=Kr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=Kr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=$u(r);Lr(o,e)}if(n){const t=Cu(n);Lr(o,t)}return o}function Au(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Ou=1e5,Fu=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Du=[],Lu=()=>!1,Nu="@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(" "),qu="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ju="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(" "),Bu="Accommodation AdministrativeArea Country Place State".split(" "),zu={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:qu,publisher:ju},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Du},Offer:{seller:ju},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:ju,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ju,areaServed:Bu,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Du}},Uu=[["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(" "),zu.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),zu.Event],[ju,zu.Organization],[Bu,zu.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),zu.Product]];function Hu(t,e){return we.call(t,e)?t[e]:void 0}function Wu(t){const e=typeof t;return Me(t)||"string"===e||"number"===e||"boolean"===e}function Vu(t,e){return e&&function(t){return Ee(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Gu(t,e){return Se(t)&&t.every(Wu)?t.map(t=>Vu(t,e)).filter(t=>!Te(t)):Wu(t)?Vu(t,e):void 0}function Qu(t,e){if("string"!=typeof t)return;const i=t.trim(),n=i.indexOf("#"),s=0>n?i:i.slice(n+1);if(!(!s||0>n&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return e(s)?s:void 0}catch(t){return}}function Zu(t){if(we.call(zu,t))return zu[t];for(const[e,i]of Uu)if(e.includes(t))return i}function Ju(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function Ku(t,e,i,n){if(Se(t)){const s=t.map(t=>Ku(t,e,i,n)).filter(t=>!Te(t));return s.length?s:void 0}return Yu(t,e,i,n)||void 0}function Yu(t,e,i,n){if(!$e(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Hu(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:Se(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Fu.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!Zu(t)&&(!n||!n.length||n.includes(t))),a={};for(const n of Nu){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Qu(Hu(t,n),e):Gu(Hu(t,n),i.maskUrl);Te(o)||Ju(a,n,o)}for(const n of o){const s=Zu(n);for(const n of Object.keys(s)){const r=Hu(t,n),o=s[n];if(!0===o){const t=Gu(r,i.maskUrl);Te(t)||Ju(a,n,t)}else{const t=Ku(r,e,i,o);Te(t)||Ju(a,n,t)}}}const l=Ku(Hu(t,"@graph"),e,i);return Te(l)||Ju(a,"@graph",l),Object.keys(a).length?a:null}function Xu(t,e,i){if(!$e(t))return null;const n=Hu(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=Yu(t,e,i);return s?ue({"@context":"https://schema.org"},s):null}function tc(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function ec(t,e,i){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!i&&t.matches(i)}catch(t){return!1}}function ic(t,e,i){for(let n=t;n;){if(ec(n,e,i))return!0;const t=n.parentNode;n=n.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function nc(t){return tc(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(tc)}function sc(t){return $e(t)?t.network_timing:t}const rc=Or("[SessionRecording]"),oc=[1,2,3,4,5,6,7,12],ac=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function lc(){var t;return null==h||null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function uc(){var t;return null===(t=lc())||void 0===t?void 0:t.record}function cc(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,Ra())}}function hc(t){return pl(vl(fl(cc(t))),!0)}function dc(t){return vc.apply(this,arguments)}function vc(){return(vc=re(function*(t){const e=yield bs(cc(t),Wl.DEBUG,{rethrow:!0});return pl(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let fc,pc;const gc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let mc=!1;function yc(t){var e;return Se(t)&&0===t.length?(fc=null!==(e=fc)&&void 0!==e?e:hc([]),fc):hc(t)}function bc(t){return _c.apply(this,arguments)}function _c(){return(_c=re(function*(t){var e;return Se(t)&&0===t.length?fc||(pc=null!==(e=pc)&&void 0!==e?e:dc([]).then(t=>(fc=t,t)).catch(t=>{throw fc=void 0,pc=void 0,t}),pc):dc(t)})).apply(this,arguments)}function wc(t){return gc&&!mc&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function kc(t){return{event:t,size:Aa(t)}}function Sc(t,e){return ue(ue({},t),{},{data:e,cv:"2024-10"})}function xc(t,e){return ue(ue({},t),{},{cv:"2024-10",data:ue(ue({},t.data),e)})}function $c(t){try{if(2===t.type)return kc(Sc(t,hc(t.data)));if(3===t.type&&0===t.data.source)return kc(xc(t,{texts:yc(t.data.texts),attributes:yc(t.data.attributes),removes:yc(t.data.removes),adds:yc(t.data.adds)}));if(3===t.type&&8===t.data.source)return kc(xc(t,{adds:t.data.adds?hc(t.data.adds):void 0,removes:t.data.removes?hc(t.data.removes):void 0}))}catch(t){rc.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:Pa(t)}}function Cc(){return Cc=re(function*(t){try{if(2===t.type)return kc(Sc(t,yield dc(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([bc(t.data.texts),bc(t.data.attributes),bc(t.data.removes),bc(t.data.adds)]);return kc(xc(t,{texts:e,attributes:i,removes:n,adds:s}))}if(3===t.type&&8===t.data.source){const[e,i]=yield Promise.all([t.data.adds?dc(t.data.adds):void 0,t.data.removes?dc(t.data.removes):void 0]);return kc(xc(t,{adds:e,removes:i}))}}catch(e){return fs(e)&&(mc=!0),rc.warn("could not compress event asynchronously - trying synchronous compression",e),$c(t)}return{event:t,size:Pa(t)}}),Cc.apply(this,arguments)}function Tc(t,e){return 5===t.type&&t.data.tag===e}function Ec(t){return Tc(t,"sessionIdle")}function Ic(t){return Tc(t,"$session_ending")}function Mc(t){return Tc(t,"$session_starting")}var Rc=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return gu(this._instance.get_property(st),this.sessionId)}get zt(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Pe(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=0,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Ie=!1,this.Me=!1,this.Te=void 0,this.Re=void 0,this.Ee=!1,this.Ae=[],this.$e=0,this.Oe=0,this.Pe=!1,this.Le=void 0,this.Wt=void 0,this.De=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.je)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this.Xt,u=this.je;var c;if(a&&this.Vt("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(c=this.Be)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),null===(s=lc())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.je===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.He(e)}a&&this.Vt("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.Ue=!1,this.We=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[rt])===this.Xt},this.Ve=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Pe(i)&&Pe(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Pe(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return Pe(t)&&t>=0&&i>t}if(this.We())return!1;const n=this.Ve();return!!Me(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.Ze=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Je&&(this.Ke(void 0),this.be&&(this.be=!1,this.jt())),this.Xe(),this.Ye(!0)):this.tn()},this.en=()=>{this.Ze()},this.nn=()=>{this.Vt("browser offline",{})},this.rn=()=>{this.Vt("browser online",{})},this.sn=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Je=!0),this.Vt("window "+n.visibilityState,{}))},this.Je=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.je=s,this._sessionStartTimestamp=r,this.et=new Ca(this._instance),this.Y=new $a(this._instance),this.tt=new Ta(this._instance),this.Rt=this.tn(),this.an="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||rc.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.Be=new Vl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Je=!0)}get ln(){var t,e,i,n,s,r,o,a,l;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,c={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},h=null!==(r=null==c?void 0:c.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(a=null==c?void 0:c.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,f=null!==(l=null==c?void 0:c.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Te(h)&&Te(d)&&Te(v)&&Te(f)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}un(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Re(e))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const n=null==i?void 0:i[t],s=e[t];return!Te(n)&&n!==s});0!==n.length&&(this.xe=!0,rc.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: '+n.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:e}))}get cn(){var t;return Ze(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Or("canvas recording resolution scale"),1)}get dn(){var t,e,i,n,s,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==e&&e,c=null!==(n=null!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==n?n:4;let h=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 h){const t=parseFloat(h);h=isNaN(t)?.4:t}return{enabled:u,fps:Ze(c,0,12,Or("canvas recording fps"),4),quality:Ze(h,0,1,Or("canvas recording quality"),.4)}}get hn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get fn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),a=sc(this._instance.config.capture_performance),l=sc(null==n?void 0:n.capturePerformance),u=!!(Oe(a)?a:l);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}vn(){var t,e;const i=[],n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.hn&&i.push(n());const r=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.fn&&xe(r))if(!Zr.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=xe(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(ue(ue({},((t,e,i)=>{const n={payloadSizeLimitBytes:Yo.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Yo.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Yo.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,r=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,a=(t=>{const e=Ko(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=sa(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=sa(t.responseBody,t.responseHeaders,e,"Response")),t)})(n),l=e=>{return a(((t,e,i)=>{var n;if(null==i?void 0:i(t.name))return;const s=Kr(t.name);let r=0===e.indexOf("http")?null===(n=Kr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&na.some(t=>0===o.indexOf(t))?void 0:t})((ia((n=e).requestHeaders),ia(n.responseHeaders),n),t.api_host,i));var n},u=xe(t.session_recording.maskNetworkRequestFn);return u&&xe(t.session_recording.maskCapturedNetworkRequestFn)?Ar.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:ue(ue({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=xe(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var i,n;const s=l(e);if(!s)return;const r=s.isInitial?{name:"",entryType:s.entryType,startTime:s.startTime,duration:s.duration,endTime:s.endTime,timeOrigin:s.timeOrigin,timestamp:s.timestamp,isInitial:!0}:void 0,o=null===(i=(n=t.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Re(o)&&r?(oa.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Te(t))return t.requestBody=ra(t.requestBody,"Request"),t.responseBody=ra(t.responseBody,"Response"),t}(l(t)),ue(ue(ue({},Yo),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.fn,t)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch})))}else rc.info("NetworkCapture not started because we are on localhost.");return i}pn(t){return this._instance.config.disable_capture_url_hashes?cn(t):t}mn(t,e=!1){const i=e?cn(t):this.pn(t),n=this._instance.config.mask_personal_data_properties?[..._u,...this._instance.config.custom_personal_data_properties||[]]:[];return this.gn(to(i,n,ku))}gn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}yn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):rc.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.yn(ac(()=>uc().addCustomEvent(t,e)))}bn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}wn(t){if(!this.bn())return!1;try{const e=uc();return!!e&&(e.addCustomEvent("$json_ld",t),this.bn())}catch(t){return!1}}kn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this._n)||void 0===e?void 0:e.scan(t)})}Sn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.mn(e.origin+e.pathname+e.search);this.xn!==i&&(this.xn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Cn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.yn(t)})}}jt(){return this.yn(ac(()=>uc().takeFullSnapshot()))}get In(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Pe(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Mn(){if(this.Tn&&clearInterval(this.Tn),!0===this.de)return;const t=this.In;t&&(this.Tn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.Rn(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Mn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this._n)||void 0===t||t.scan(),clearInterval(this.Tn),rc.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this._n)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.kn(),this.Mn(),this.Vt("recording resumed",{reason:"left blocked url"}),rc.info("recording resumed"))}$n(t,e){var i;if("event"===t&&this.Rn(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?ot:at;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.Ye(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(J);if(!t)return;let e;try{e=$e(t)?t:JSON.parse(t)}catch(t){return void rc.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ue){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void rc.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}On(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void rc.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ke(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.Pe&&(this.Pn(),this.tn());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.je=a,this._sessionStartTimestamp=l,this.Ln(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new yu(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new mu(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.$n(t,e)),this.On(X,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(X)}),this.On(tt,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(tt)}),this.On(it,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(it)}),this.On(et,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(et)}),this.re.makeSamplingDecisions(this.sessionId),this.Dn(),this.ke||(Hr(t,"beforeunload",this.Ze),Hr(t,"pagehide",this.en),Hr(t,"offline",this.nn),Hr(t,"online",this.rn),Hr(n,"visibilitychange",this.sn),!this.De&&xe(this.Yt.onSessionId)&&(this.De=this.Yt.onSessionId(this.qe)),!this.Fe&&xe(this.Yt.on)?this.Fe=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.Ne=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.Ne)||void 0===n||n.call(this),this.Ne=void 0,this.qe(t,e,i)})}):xe(this.Yt.on)||rc.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.Le)&&(this.Le=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.mn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){rc.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}Fn(){var e,i,s,r,o,a;null==t||t.removeEventListener("beforeunload",this.Ze),null==t||t.removeEventListener("pagehide",this.en),null==t||t.removeEventListener("offline",this.nn),null==t||t.removeEventListener("online",this.rn),null==n||n.removeEventListener("visibilitychange",this.sn),clearInterval(this.Tn),this.Nn(),null===(e=this.Le)||void 0===e||e.call(this),this.Le=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.De)||void 0===s||s.call(this),this.De=void 0,null===(r=this.Fe)||void 0===r||r.call(this),this.Fe=void 0,null===(o=this.Ne)||void 0===o||o.call(this),this.Ne=void 0,null===(a=this.re)||void 0===a||a.stop(),this.qn(),this.Pn()}Pn(){this.Oe+=1,this.Ae=[],this.$e=0,this.jn=void 0,this.Pe=!1}qn(){var t,e;null===(t=this.Bn)||void 0===t||t.stop(),this.ce=[],null===(e=this._n)||void 0===e||e.stop(),this._n=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){rc.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.jn||0===this.$e)return!1;if(this.Pe)return!0;this.Pe=!0,this.Hn=void 0;const t=this.Oe;return this.Nn(),this.qn(),this.jn.catch(()=>{}).then(()=>{t===this.Oe&&(this.Pe=!1,this.Ye(),this.tn(),this.Un(),this.Fn(),rc.info("stopped"))}).catch(()=>{this.Pe=!1,this.Un(),this.Fn(),rc.info("stopped")}),!0}stop(){if(this.qn(),this.Ue)this.Xe();else if(this.zn())return;this.Ye(),this.tn(),this.Un(),this.Fn(),rc.info("stopped")}Un(){this.Ke(void 0,{preserveLogDedup:this.Ue}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Xe(),this.Ye())}He(t){this.Ue=!0,this.le=Date.now();try{var e,i;this.stop(),this.Wn=void 0,this.me=0,this.fe=0,this.ve=0,this.pe=0,null===(e=lc())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.Ue=!1}this.Ke(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ke(t,{preserveLogDedup:e=!1}={}){if(this.ge=!Te(t),this.Hn=t,Te(t))return void(e||(this.Vn=void 0));if(this.Ue)return;const i=`${this.sessionId}:${t}`;i!==this.Vn&&(this.Vn=i,rc.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}Rn(){this.isStarted||(this.we=!0),this.ge&&(this.Ke(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Gn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.tn(),this.qn()),this.tn(),this.Fn(),this.tn(),this.Un(),rc.info("discarded")}Qn(t,e,i,n,s){if(-1===i)return this.me+=1,void rc.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Zn(t,n),this.Jn(r)):this.tn()}Kn(){try{this.Xn()}catch(t){this.Se||(this.Se=!0,rc.error("could not track full snapshot cost",t))}}Xn(){var t,e;const i=null===(t=lc())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Wn&&(this.Wn=i,500>i.durationMs||rc.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}))}Zn(t,e){2!==t.type?3===t.type&&(Te(this.Te)||this.Te===e||this.Re===e||(this.Re=e,rc.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Te=e}Yn(t){t.counted&&t.generation===this.Oe&&(this.$e=Math.max(0,this.$e-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ti(t,e,i){t.processed||t.generation!==this.Oe||(t.processed=!0,this.Qn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ei(t){try{let e,i=t.event;if(t.compressionEnabled)try{({event:i,size:e}=$c(t.event))}catch(t){rc.warn("could not process queued compression event - will use uncompressed event",t)}Te(e)&&(e=Pa(t.event));try{this.ti(t,i,e)}catch(t){rc.warn("could not capture queued compression event",t)}}finally{this.Yn(t)}}Xe(){[...this.Ae].forEach(t=>{try{this.ei(t)}catch(t){rc.warn("could not drain queued compression event",t)}})}ni(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Oe,processed:!1,counted:!0};this.Ae.push(r),this.$e+=1;const o=(a=re(function*(){try{if(r.processed)return;let i,n;try{const s=e?wc(t)?yield function(t){return Cc.apply(this,arguments)}(t):$c(t):{event:t,size:Pa(t)};i=s.event,n=s.size}catch(e){rc.warn("could not process queued compression event - will use uncompressed event",e),i=t,n=Pa(t)}s.ti(r,i,n)}finally{s.Yn(r)}}),function(){return a.apply(this,arguments)});var a;this.jn=this.jn?this.jn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,a,l,u,c,h,d;if(!this._instance.sessionManager)return;if(this.Cn(),!e||!$e(e))return;if(4===e.type){const t=this.mn(e.data.href);if(this.xn=t,!t)return;e.data.href=t}else this.Sn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.$n(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&(this.Kn(),Promise.resolve().then(()=>this.Kn()),this.Mn(),null===(h=this.Bn)||void 0===h||h.reset(),null===(d=this._instance.persistence)||void 0===d||d.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const v=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));v&&this.ii();const f=this.Bn?this.Bn.throttleMutations(e):e;if(!f)return void(!0===this.de&&this.he++);const p=function(t){const e=t;if(e&&$e(e)&&6===e.type&&$e(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(f),g=function(t){return Ic(t)?t.data.payload:null}(p),m=function(t){return Mc(t)?t.data.payload:null}(p),y=function(t){return Ec(t)?t.data.payload:null}(p);g||m?(null==g?void 0:g.lastActivityTimestamp)&&(p.timestamp=g.lastActivityTimestamp):(null==y?void 0:y.sessionId)||this.ri(p);const b=null!==(s=null!==(r=null!==(o=null==g?void 0:g.currentSessionId)&&void 0!==o?o:null==m?void 0:m.nextSessionId)&&void 0!==r?r:null==y?void 0:y.sessionId)&&void 0!==s?s:this.Xt,_=null!==(a=null!==(l=null!==(u=null==g?void 0:g.currentWindowId)&&void 0!==u?u:null==m?void 0:m.nextWindowId)&&void 0!==l?l:null==y?void 0:y.windowId)&&void 0!==a?a:this.je;if(!0===this.de&&!function(t){return Ec(t)||Ic(t)||Mc(t)}(p))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(p)&&this.he++);2===p.type&&(this.he=0),y&&(p.timestamp=y.lastActivityTimestamp+y.threshold);const w=this.ae;this.ae=!0,v?this.kn(!0):w||this.kn();const k=null===(c=this._instance.config.session_recording.compress_events)||void 0===c||c;if(5===p.type&&"$json_ld"===p.data.tag){let e;try{e=t?this.mn(t.location.href):void 0}catch(t){}p.data.href=e}if(this.$e>0||k&&wc(p))return void this.ni(p,k,b,_);const{event:S,size:x}=k?$c(p):{event:p,size:Pa(p)};this.Qn(p,S,x,b,_)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.ke,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):aa}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.Rn(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.Rn(),this.qt("sampling_overridden")}overrideTrigger(t){this.$n(t),this.Rn()}oi(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.mn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}Nn(){this.si&&(clearTimeout(this.si),this.si=void 0)}Gn(){this.si||(this.si=setTimeout(()=>{this.Ye()},2e3))}ai(){return this.Te!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Ic(t)&&!Mc(t))}li(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}ui(t){if("buffering"!==t)return Te(this.ci)||this._instance.register_for_session({[zt]:[]}),void(this.ci=void 0);const e=this.li();if(0===e.length)return Te(this.ci)||this._instance.register_for_session({[zt]:[]}),void(this.ci=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.ci&&(this.ci=n,this._instance.register_for_session({[zt]:e}),rc.info(`buffering: ${i}`))}di(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.hi)&&Hl.At()}fi(){0!==this.Rt.data.length&&this.Rt.size!==this.pi&&943718.4>=this.Rt.size&&this.di()&&(this.pi=this.Rt.size,Hl.$t(this.an,this.Rt))}Ln(){if(this.Ee||!this.di())return;this.Ee=!0;const t=Hl.Dt(this.an);Hl.Pt(this.an),$e(t)&&Se(t.data)&&0!==t.data.length&&Se(t.sizes)&&t.sizes.length===t.data.length&&Pe(t.size)&&t.sessionId===this.Xt&&t.windowId===this.je&&(this.Rt.data.length>0||(this.Rt=t))}Ye(t=!1){var e;if(this.Nn(),this.ge)return this.Rt;if(this.ai())return this.Rt.size>943718.4?this.tn():(t&&this.fi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Ge(),s=this.status;if(this.ui(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.fi(),this.Gn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.oi();Oa(i).forEach(e=>{try{var i;null===(i=this.Be)||void 0===i||i.trackSize(e.sessionId,e.size),this.mi(ue(ue(ue(ue({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Wl.LIB_NAME,$lib_version:Wl.LIB_VERSION,$snapshot_host:t},this.fe>0?{$sdk_debug_replay_throttled_mutations_dropped:this.fe}:{}),this.ve>0?{$sdk_debug_replay_oversized_mutations_dropped:this.ve}:{}),this.pe>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe}:{}),this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){rc.warn("could not capture snapshot chunk - skipping it",t)}}),Te(this.pi)||(Hl.Pt(this.an),this.pi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.tn()}Jn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.ge&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.Ye(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.tn()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.ge&&(this.be||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.be=!0:(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.ge||this.Gn())}mi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}ii(){if(!this.Rt||0===this.Rt.data.length)return this.tn();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.tn():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}tn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.je},this.Rt}qt(t,e){this._instance.register_for_session({[Qt]:t}),rc.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",ue({reason:t},e))}gi(t){var e;return 3===t.type&&-1!==oc.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ri(t){const e=this.gi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Tn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.je}),this.Ye());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.je!==i;if(this.je=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.He(t)}else if(e&&this.Rn(),s){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.re)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this.kn(),this.Mn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Hn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(t=this.Be)||void 0===t?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this.ke,[Vt]:this.yi,[Gt]:this._e}}get yi(){var t,e,i;return!!this.se&&(null===(t=null===(e=uc())||void 0===e||null===(i=e.isRecording)||void 0===i?void 0:i.call(e))||void 0===t||t)}Dn(){var e;if(this.se)return;this._e=!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},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=ue({password:!0},e);else if("sampling"===t){const t=null!=e?e:{},n={};Te(t.mousemove)||(n.mousemove=t.mousemove),Te(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),i.sampling=n}else i[t]=e;var r,o,a,l;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ue(ue({},i.slimDOMOptions),{},{script:!0})),this.dn&&this.dn.enabled&&(i.recordCanvas=!0,i.sampling=ue(ue({},i.sampling),{},{canvas:this.dn.fps}),i.dataURLOptions={type:"image/webp",quality:this.dn.quality},i.canvasResolutionScale=this.cn,i.canvasMasking={configured:()=>{var t;return xe(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const i=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(xe(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Ie||(this.Ie=!0,rc.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.ln&&(i.maskAllInputs=null===(r=this.ln.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.ln.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this.ln.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this.ln.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,rc.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.un();const u=uc();if(!u)return void rc.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Bn=null!==(e=this.Bn)&&void 0!==e?e:new gl(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const i=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;rc.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const c=this.vn();if(this.se=u(ue(ue({emit:t=>{this.onRRwebEmit(t)},plugins:c,errorHandler:(t,e)=>"rrweb"===e&&(this.Me||(this.Me=!0,rc.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i),{},{recordAfter:"DOMContentLoaded"})),!this.se)return this.ke=!0,void rc.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ke=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this._n&&(this._n=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Ou;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Lu:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!ic(n,e.blockClass,e.blockSelector)}}(t,i),a=e=>{try{const a=s();if(!r||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){return ic(t,e.blockClass,e.blockSelector)||ic(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const l=function(t,e=Lu,i){if(!t||t.length>Ou)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=Se(n)?n.map(t=>Xu(t,e,s)):Xu(n,e,s);if(s.exceeded||Me(r)||Se(r)&&(!r.length||r.some(Me)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(t){return null}}(e.text,o,i.maskUrl);if(!l)return void n.delete(e);const[u,c]=l;if(Me(a))return void n.set(e,c);if(n.get(e)!==c){if(c.length>r)return void(r=0);i.emit(u)&&(n.set(e,c),r-=c.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of nc(t))a(e)};for(const i of t)if("childList"===i.type)tc(i.target)&&a(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&tc(t)&&a(t)}else"attributes"===i.type&&tc(i.target)&&a(i.target)}catch(t){return}});return i.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){r&&!1!==s()&&nc(t.documentElement).forEach(t=>{e&&n.delete(t),a(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.mn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.bn()},emit:t=>this.wn(t)}),this.Y.isCurrentUrlBlocked()&&this._n.scan()),this.le=Date.now(),this.de=Oe(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:c.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const Pc=["type"];var Ac=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),Oc=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),Fc=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),Dc=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Lc=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Nc=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),qc=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function jc(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var Bc=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${Bc.source}`,"i"),new RegExp(Bc.source,"gi"),"0".repeat(32),"0".repeat(16);var zc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Uc={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Hc={};function Wc(t){if(Hc[t])return Hc[t];const e=function(t){var e,i;const n=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(i=e.__symbol__)||void 0===i?void 0:i.call(e,t);return n&&globalThis[n]?globalThis[n]:void 0}(t)||globalThis[t],i=e.prototype,n=t in zc?zc[t]:void 0,s=Boolean(n&&n.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(i,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),r=t in Uc?Uc[t]:void 0,o=Boolean(r&&r.every(t=>{var e;return"function"==typeof i[t]&&(null===(e=i[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(s&&o)return Hc[t]=e.prototype,e.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const n=a.contentWindow;if(!n)return e.prototype;const s=n[t].prototype;return s?(function(t){return jc(t,"AppleWebKit")&&!jc(t,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",t),l=!0),Hc[t]=s):i}catch(t){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Vc=Object.create(null);function Gc(t,e,i){var n;const s=Vc[t],r=s[i];if(r)return r.call(e);const o=Wc(t),a=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return a?(s[i]=a,a.call(e)):e[i]}Vc.Node=Object.create(null),Vc.ShadowRoot=Object.create(null),Vc.MutationObserver=Object.create(null),Vc.Element=Object.create(null);var Qc,Zc={};function Jc(t,e,i){const n=`${t}.${String(i)}`;if(Zc[n])return Zc[n].bind(e);const s=Wc(t)[i];return"function"!=typeof s?e[i]:(Zc[n]=s,s.bind(e))}function Kc(){return Wc("MutationObserver").constructor}function Yc(t,e,i){try{if(!(e in t))return()=>{};const n=t[e],s={next:n},r=i(function(...t){return s.next.apply(this,t)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=s.next);const i=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let n=t[e],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(t){return()=>{}}}var Xc={childNodes:t=>Gc("Node",t,"childNodes"),parentNode:t=>Gc("Node",t,"parentNode"),parentElement:t=>Gc("Node",t,"parentElement"),textContent:t=>Gc("Node",t,"textContent"),isConnected(t){if(void 0===Qc){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Wc("Node"),"isConnected"))||void 0===e?void 0:e.get;Qc=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==Qc?void 0:Qc.call(t)},contains:(t,e)=>Jc("Node",t,"contains")(e),getRootNode:t=>Jc("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Gc("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Gc("Element",t,"shadowRoot"):null,querySelector:(t,e)=>Jc("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>Jc("Element",t,"querySelectorAll")(e),mutationObserver:Kc,patch:Yc};function th(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var eh=0;function ih(){eh+=1}function nh(){return eh}function sh(t,e){return(e!==eh||t>6e4)&&!0}var rh=0,oh=0,ah=0,lh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},uh=null,ch=null,hh=[],dh=0,vh=0,fh={slowestBatchMs:0},ph={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function gh(t){(rh+=1)>1||(lh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},hh=[],dh=0,ch=(t=>t&&t>0?t:null)(t),oh=th(),ah=eh)}function mh(){return 0===rh?uh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(rh-=1)>0?lh:(lh.durationMs=th()-oh,lh.deferredStylesheetCount=dh,ph.deferredCount+=dh,ch=null,sh(lh.durationMs,ah)?lh:uh=lh)}function yh(t,e,i){let n=t.length;if(i>=32)return n;for(let s=0;t.length>s;s++){const r=t[s];try{const t=r.cssRules;if(t&&t.length)n+=yh(t,e,i+1);else if(e&&r.styleSheet){const t=r.styleSheet;if(!e.has(t)){e.add(t);const s=t.rules||t.cssRules;s&&(n+=yh(s,e,i+1))}}}catch(t){}}return n}function bh(t){if(0===rh)return;const e=yh(t,null,0);lh.cssRuleCount+=e,vh>0&&(lh.nonDeferrableCssRuleCount+=e)}function _h(t){vh+=1;try{return t()}finally{vh-=1}}function wh(t){rh>0&&(lh.stylesheetMs+=t)}function kh(t){if(0===rh||null===ch)return!1;const e=lh.cssRuleCount-lh.nonDeferrableCssRuleCount;return e>=ch||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),yh(e,i,0)}catch(t){return 0}}(t)>ch}function Sh(){const t=hh;return hh=[],t}function xh(){ph.failedCount+=1}function $h(t){t>0&&(ph.abandonedCount+=t)}function Ch(t){return Ch="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ch(t)}function Th(t,e,i){return(e=function(t){var e=function(t){if("object"!=Ch(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Ch(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ch(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Eh(t){return t.nodeType===t.ELEMENT_NODE}function Ih(t){const e=t&&"host"in t&&"mode"in t&&Xc.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Xc.shadowRoot(e)===t)}function Mh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function Rh(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function Ph(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const i=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?i.push("layer"):t.layerName&&i.push(`layer(${t.layerName})`),t.supportsText&&i.push(`supports(${t.supportsText})`),t.media.length&&i.push(t.media.mediaText),i.join(" ")+";"}var Ah=0;function Oh(t){const e=0===Ah,i=e?th():0;Ah+=1;try{const e=t.rules||t.cssRules;if(!e)return null;bh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),Rh(Array.from(e,t=>Fh(t,i)).join(""))}catch(t){return null}finally{Ah-=1,e&&wh(th()-i)}}function Fh(t,e){if(Lh(t)){let e;try{e=Oh(t.styleSheet)||Ph(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return Xh(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Nh(t)&&t.selectorText.includes(":")&&(i=Dh(i)),e?Xh(i,e):i}}function Dh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Lh(t){return"styleSheet"in t}function Nh(t){return"selectorText"in t}var qh=/^-?[A-Za-z_][\w-]*$/,jh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Bh(t){const e=[];let i=!1,n=null;const s=new Map;function r(t){const s=e.pop();if("group"===s.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void r(null)}const i=e[e.length-1];return i.parts.push(t),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=t);o(e[e.length-1],s.importRule,t)}function o(t,e,i){try{let s;try{s=i||Ph(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=Xh(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function a(t){const i=t.rules[t.index];if("sheet"===t.kind&&Lh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(Nh(t)){if("number"==typeof e.type&&1!==e.type)return null;const i=e.style?e.style.cssText:"";return`${t.selectorText} {${i?" "+i:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!qh.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let n="";try{var i;n=(null===(i=t.constructor)||void 0===i?void 0:i.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?qh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":jh.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?Xh(n,s):n,fixColons:"sheet"===i.kind&&Nh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Nh(i)&&i.selectorText.includes(":")&&(n=Dh(n)),t.parts.push(t.sheetHref?Xh(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;bh(i);let n=t.href;!n&&t.ownerNode&&(n=t.ownerNode.baseURI);const r=Array.from(i);return e.push({kind:"sheet",sheet:t,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(t,e){const i=[{sheet:e,rules:t,index:0}];for(;i.length>0;){const t=i[i.length-1];if(t.index>=t.rules.length){i.pop();continue}const e=t.rules[t.index];if(t.index+=1,!Lh(e)||s.has(e))continue;let n=null;try{n=e.styleSheet}catch(t){s.set(e,null);continue}if(n&&!i.some(t=>t.sheet===n))try{const t=n.rules||n.cssRules;if(!t)continue;bh(t);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(t);s.set(e,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(t){}}}(r,t),!0}catch(t){return!1}}(t)||(i=!0),{advance(t){if(i)return!0;const s=th();let o=t>0?t:1;try{for(;!i&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const i=t.prelude+t.parts.join("")+"}";e=t.fixColons?Dh(i):i}else e=Rh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{a(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{wh(th()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var zh=class{constructor(){Th(this,"idNodeMap",new Map),Th(this,"nodeMetaMap",new WeakMap)}getId(t){var e,i;return t&&null!==(e=null===(i=this.getMeta(t))||void 0===i?void 0:i.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),Eh(t)){const e=Xc.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const i=this.getNode(t);if(i){const t=this.nodeMetaMap.get(i);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Uh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const a=n&&Hh(n);return(e[i.toLowerCase()]||a&&e[a])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Hh(t){return t.toLowerCase()}var Wh=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 Vh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Wh.has(Hh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var Gh="__rrweb_original__";function Qh(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Hh(e):null}catch(t){return null}}var Zh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Jh=/^(?:[a-z+]+:)?\/\//i,Kh=/^www\..*/i,Yh=/^(data:)([^,]*),(.*)/i;function Xh(t,e){return(t||"").replace(Zh,(t,i,n,s,r,o)=>{const a=n||r||o,l=i||s||"";if(!a)return t;if(Jh.test(a)||Kh.test(a))return`url(${l}${a}${l})`;if(Yh.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+a}${l})`;const u=e.split("/"),c=a.split("/");u.pop();for(const t of c)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${l}${u.join("/")}${l})`})}var td,ed,id=new Map,nd=1,sd=new RegExp("[^a-z0-9-_:]");function rd(){return nd++}var od=!1,ad=/^[^ \t\n\r\u000c]+/,ld=/^[, \t\n\r\u000c]+/,ud=new WeakMap;function cd(t,e){return e&&""!==e.trim()?hd(t,e):e}function hd(t,e){let i=ud.get(t);if(i||(i=t.createElement("a"),ud.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function dd(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function vd(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=cd(t,n);if(i.startsWith("data:")){if("img"===e&&s){let t=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(t=function(t,e,i,n){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const s=id.get(e);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;const r=s.getContext("2d");if(!r)return e;r.drawImage(t,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),a=e.length>o.length?o:e;if(id.size>=10){const t=id.keys().next().value;void 0!==t&&id.delete(t)}return id.set(e,{type:i,quality:n,result:a}),a}catch(t){return e}}(s,i,r.type,r.quality)),dd(t,r)}if("image"===e)return dd(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=cd(t,n);return"image"===e&&i.startsWith("data:")?dd(i,r):i}return"background"!==i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===i?function(t,e){if(""===e.trim())return e;let i=0;function n(t){let n;const s=t.exec(e.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(ld),e.length>i;){let r=n(ad);if(","===r.slice(-1))r=cd(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=cd(t,r);let o=!1;for(;;){const t=e.charAt(i);if(""===t){s.push((r+n).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){i+=1,s.push((r+n).trim());break}"("===t&&(o=!0)}n+=t,i+=1}}}return s.join(", ")}(t,n):"style"===i?Xh(n,hd(t)):"object"===e&&"data"===i?cd(t,n):n:cd(t,n)}function fd(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Hh(e)}function pd(t){return"string"==typeof t&&Hh(t).split(/\s+/).includes("stylesheet")}function gd(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&gd(Xc.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&gd(Xc.parentNode(t),e,i)}function md(t,e,i,n){let s;if(Eh(t)){if(s=t,!Xc.childNodes(s).length)return!1}else{if(null===Xc.parentElement(t))return!1;s=Xc.parentElement(t)}try{if("string"==typeof e){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(gd(s,e,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(t){}return!1}function yd(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var bd=new Map;function _d(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function wd(t){return null==t?"":t.toLowerCase()}var kd=!1,Sd=!1;function xd(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:E=!1,depth:I=0,maxDepth:M=50}=e;let{needsMask:R}=e,{preserveWhiteSpace:P=!0}=e;if(I>=M)return Sd=!0,kd||(kd=!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;R||(R=md(t,o,a,void 0===R)),rh>0&&(lh.nodeCount+=1);const A=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAllElementAttributes:h=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,b=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:qc.Document,childNodes:[],compatMode:t.compatMode}:{type:qc.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:qc.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:u,dataURLOptions:c={},inlineImages:h,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Hh(t.tagName);return sd.test(e)?"div":e}(t),b=new Set;let _={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];fd(y,n.name)||(_[n.name]=vd(i,y,Hh(n.name),n.value,t,c))}if("link"===y&&r&&!m&&pd(_.rel)){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=_d(i,n),!e&&n.includes(".css"))&&(e=_d(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(kh(e)?rh>0&&(hh.push(t),dh+=1):n=Oh(e)),n&&(delete _.rel,delete _.href,_._cssText=n)}var k;if("style"===y&&t.sheet&&!(t.innerText||Xc.textContent(t)||"").trim().length){const e=_h(()=>Oh(t.sheet));e&&(_._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=Uh({element:t,type:Qh(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:a}):i&&(_.checked=i)}if("option"===y&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===y&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}b.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData,r=Gh in s?s[Gh]:s;let o;try{o=r.call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(_.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){const e=t.toDataURL(c.type,c.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(c.type,c.quality)&&(_.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(k=t)?void 0:k.name)?od||(od=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",k)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",k)}let S,x=!1;if("img"===y&&h){td||(td=i.createElement("canvas"),ed=td.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>x?Vh({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u}):i,o=()=>{yd(e,"load",o);try{td.width=e.naturalWidth,td.height=e.naturalHeight,ed.drawImage(e,0,0);const t=td.toDataURL(c.type,c.quality);_.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?_.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=_;e.rr_mediaState=t.paused?"paused":"played",b.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),m){var C,T,E;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(E=i.defaultView)||void 0===E?void 0:E.scrollY)||0))}px`},b.add("rr_width"),b.add("rr_height"),b.add("rr_left"),b.add("rr_top"),o&&(_.rr_position=o.position||"static",b.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,b.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,b.add("rr_display")))}if("iframe"!==y||f(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),l||u)for(const[e,i]of Object.entries(_))"string"!=typeof i&&null!==i||(_[e]=Vh({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:b.has(e)}));x=!0;try{customElements.get(y)&&(S=!0)}catch(t){}return{type:qc.Element,tagName:y,attributes:_,childNodes:[],isSVG:(I=t,Boolean("svg"===I.tagName||I.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:S};var I}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=Xc.parentNode(t),o=r&&r.tagName;let a=Xc.textContent(t);const l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var c;if(t.nextSibling||t.previousSibling);else if(kh(r.sheet));else if(null===(c=r.sheet)||void 0===c?void 0:c.cssRules){const t=Oh(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(a=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}a=Xh(a,hd(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&i&&(a=n?n(a,Xc.parentElement(t)):a.replace(/[\S]/g,"*")),{type:qc.Text,textContent:a||"",isStyle:l,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:qc.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:qc.Comment,textContent:Xc.textContent(t)||"",rootId:b};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:T,newlyAddedElement:E});if(!A)return console.warn(t,"not serialized"),null;let O;O=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===qc.Comment)return!0;if(t.type===qc.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let i;try{i=new URL(t,window.location.href)}catch(t){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==n?void 0:n[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(wd(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===wd(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(wd(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&wd(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(wd(t.attributes.property).match(/^(og|twitter|fb):/)||wd(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===wd(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(wd(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(wd(t.attributes.name))||wd(t.attributes.property).match(/^article:/)||wd(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(wd(t.attributes.name)))return!0}}return!1}(A,p)||!P&&A.type===qc.Text&&!A.isStyle&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?-2:rd();const F=Object.assign(A,{id:O});if(n.add(t,F),-2===O)return null;_&&_(t);let D=!l;if(F.type===qc.Element){D=D&&!F.needBlock,delete F.needBlock;const e=Xc.shadowRoot(t);e&&Mh(e)&&(F.isShadowHost=!0)}if((F.type===qc.Document||F.type===qc.Element)&&D){p.headWhitespace&&F.type===qc.Element&&"head"===F.tagName&&(P=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:P,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M};if(F.type===qc.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const i of Array.from(Xc.childNodes(t))){const t=xd(i,e);t&&F.childNodes.push(t)}let E=null;if(Eh(t)&&(E=Xc.shadowRoot(t)))for(const t of Array.from(Xc.childNodes(E))){const i=xd(t,e);i&&(Mh(E)&&(i.isShadow=!0),F.childNodes.push(i))}}const L=Xc.parentNode(t);if(L&&Ih(L)&&Mh(L)&&(F.isShadow=!0),F.type===qc.Element&&"iframe"===F.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),yd(t,"load",a),t.addEventListener("load",o),e())},a=()=>r();return s=setTimeout(r,i),t.addEventListener("load",a),()=>{null!==s&&(clearTimeout(s),s=null),n?yd(t,"load",o):(n=!0,yd(t,"load",a))}}const a="about:blank";let l;try{l=s.location.href}catch(t){return n}if(l!==a||t.src===a||""===t.src){const i=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(i),yd(t,"load",o)}}return t.addEventListener("load",o),()=>{yd(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=xd(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:P,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M});i&&w(t,i)}},k);null==S||S(t,e)}return F.type===qc.Element&&"link"===F.tagName&&pd(F.attributes.rel)&&function(e,l,S){if(bd.has(e))return;let E;try{E=e.sheet}catch(t){return}if(E)return;const A=new AbortController;let O=!1;const F=()=>{if(!O){O=!0;try{(()=>{if(x){const e=xd(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:P,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I,maxDepth:M});e&&x(t,e)}})()}finally{bd.delete(e),A.abort()}}},D=setTimeout(F,S);A.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",F,{signal:A.signal,once:!0}),bd.set(e,A)}(t,0,C),F}function $d(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var Cd=class t{constructor(...t){Th(this,"parentElement",null),Th(this,"parentNode",null),Th(this,"ownerDocument",void 0),Th(this,"firstChild",null),Th(this,"lastChild",null),Th(this,"previousSibling",null),Th(this,"nextSibling",null),Th(this,"ELEMENT_NODE",1),Th(this,"TEXT_NODE",3),Th(this,"nodeType",void 0),Th(this,"nodeName",void 0),Th(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Td(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Ed(i,t,e,n)}function Ed(t,e,i,n){Id(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Id(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Md(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var Rd="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.",Pd={map:{},getId(){return console.warn(Rd),-1},getNode(){return console.warn(Rd),null},removeNodeFromMap(){console.warn(Rd)},has(){return console.warn(Rd),!1},reset(){console.warn(Rd)}};function Ad(t,e,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const a=e-(o-s),l=this;0>=a||a>e?(n&&(clearTimeout(n),n=null),s=o,t.apply(l,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,t.apply(l,r)},a))}}function Od(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e),o=()=>Od(t,e,r||{},!0);if(n)return s.Object.defineProperty(t,e,i),o;const a=function(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var i,n;const s=null===(i=t.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?t[s]:void 0;"function"==typeof r&&(e=r)}catch(t){}if(!e)return()=>{};const s=e;return e=>{try{s.call(t,e,0)}catch(t){}}}(s);return s.Object.defineProperty(t,e,{set(t){if(a(()=>{try{i.set.call(this,t)}catch(t){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Pd=new Proxy(Pd,{get(t,e,i){return"map"===e&&console.warn(Rd),Reflect.get(t,e,i)}}));var Fd=Date.now;function Dd(t){var e,i,n,s;const r=t.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(e=Xc.parentElement(r.body))||void 0===e?void 0:e.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=Xc.parentElement(r.body))||void 0===n?void 0:n.scrollTop)||(null==r||null===(s=r.body)||void 0===s?void 0:s.scrollTop)||0}}function Ld(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Nd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function qd(t){return t?t.nodeType===t.ELEMENT_NODE?t:Xc.parentElement(t):null}function jd(t,e,i,n){if(!t)return!1;const s=qd(t);if(!s)return!1;try{if("string"==typeof e){if(s.classList.contains(e))return!0;if(n&&null!==s.closest("."+e))return!0}else if(gd(s,e,n))return!0}catch(t){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Bd(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function zd(t,e){if(Ih(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=Xc.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||zd(n,e))}function Ud(t){return Boolean(t.changedTouches)}function Hd(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Wd(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Vd(t){return!!t&&(t instanceof Cd&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Xc.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Fd=()=>(new Date).getTime());var Gd=class{constructor(){Th(this,"id",1),Th(this,"styleIDMap",new WeakMap),Th(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let i;return i=void 0===e?this.id++:e,this.styleIDMap.set(t,i),this.idStyleMap.set(i,t),i}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Qd(t){var e;let i=null;return"getRootNode"in t&&(null===(e=Xc.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Xc.host(Xc.getRootNode(t))&&(i=Xc.host(Xc.getRootNode(t))),i}function Zd(t){const e=t.ownerDocument;if(!e)return!1;if(Xc.contains(e,t))return!0;const i=Xc.isConnected(t);return"boolean"==typeof i?i:function(t){const e=t.ownerDocument;if(!e)return!1;const i=function(t){let e,i=t;for(;e=Qd(i);)i=e;return i}(t);return Xc.contains(e,i)}(t)}function Jd(t){return"__ln"in t}var Kd,Yd=class{constructor(){Th(this,"length",0),Th(this,"head",null),Th(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Jd(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&Jd(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Xd=(t,e)=>`${t}@${e}`,tv=class{constructor(){Th(this,"frozen",!1),Th(this,"locked",!1),Th(this,"texts",[]),Th(this,"attributes",[]),Th(this,"attributeMap",new WeakMap),Th(this,"generatedAttributes",new WeakMap),Th(this,"removes",[]),Th(this,"mapRemoves",new Set),Th(this,"movedMap",{}),Th(this,"addedSet",new Set),Th(this,"movedSet",new Set),Th(this,"droppedSet",new Set),Th(this,"removesSubTreeCache",new Set),Th(this,"mutationCb",void 0),Th(this,"blockClass",void 0),Th(this,"blockSelector",void 0),Th(this,"maskTextClass",void 0),Th(this,"maskTextSelector",void 0),Th(this,"inlineStylesheet",void 0),Th(this,"maskInputOptions",void 0),Th(this,"maskTextFn",void 0),Th(this,"maskInputFn",void 0),Th(this,"maskAllElementAttributes",void 0),Th(this,"maskAttributeFn",void 0),Th(this,"keepIframeSrcFn",void 0),Th(this,"recordCanvas",void 0),Th(this,"canvasMaskingConfigured",void 0),Th(this,"inlineImages",void 0),Th(this,"slimDOMOptions",void 0),Th(this,"dataURLOptions",void 0),Th(this,"doc",void 0),Th(this,"mirror",void 0),Th(this,"iframeManager",void 0),Th(this,"stylesheetManager",void 0),Th(this,"shadowDomManager",void 0),Th(this,"canvasManager",void 0),Th(this,"processedNodeManager",void 0),Th(this,"unattachedDoc",void 0),Th(this,"canvasManagerReleased",!1),Th(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Th(this,"emit",()=>{if(this.frozen||this.locked)return;const t=th(),e=nh();try{this.processBufferedMutations()}finally{i=th()-t,n=e,rh>0||sh(i,null!=n?n:eh)||i>fh.slowestBatchMs&&(fh.slowestBatchMs=i)}var i,n}),Th(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new Yd,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const a=Xc.parentNode(r);if(!a||!Zd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=Ih(a)?this.mirror.getId(Qd(r)):this.mirror.getId(a),u=n(r);if(-1===l||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={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:t=>{Hd(t,this.mirror)&&this.iframeManager.addIframe(t),Wd(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Vd(t)&&!jd(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Xc.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const c=xd(r,s);c&&(t.push({parentId:l,nextId:u,node:c}),e.add(c.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)iv(this.removesSubTreeCache,t)&&!this.movedSet.has(Xc.parentNode(t))||r(t);for(const t of this.addedSet)nv(this.droppedSet,t)||iv(this.removesSubTreeCache,t)?nv(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(Xc.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(Xc.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=Xc.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=Xc.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const a={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=Xc.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=Vh({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};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)}),Th(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Th(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(Xc.childNodes(t),t=>Xc.textContent(t)||"").join("");e.attributes.value=Uh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Qh(t),value:i,maskInputFn:this.maskInputFn})}),Th(this,"processMutation",t=>{if(!Bd(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=Xc.textContent(t.target);jd(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:md(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,qd(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Hh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let a=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),l=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===a){const t=n,e=Qh(t);l=Uh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(jd(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let u=this.attributeMap.get(t.target);const c="iframe"===s&&"src"===a;if(c&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if("type"===a&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!fd(s,a)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=vd(this.doc,s,Hh(a),l,n,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(l)&&(a="rr_src"),u.attributes[a]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===a&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(jd(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const i=this.mirror.getId(e),n=Ih(t.target)?this.mirror.getId(Xc.host(t.target)):this.mirror.getId(t.target);jd(t.target,this.blockClass,this.blockSelector,!1)||Bd(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(ev(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||zd(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Xd(i,n)]?ev(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Ih(t.target)||!Mh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),Xc.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Th(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Bd(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let i=null;e&&this.mirror.hasNode(e)&&(i=this.mirror.getId(e)),i&&-1!==i&&(this.movedMap[Xd(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!jd(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=Xc.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Vd(t)){const e=Xc.childNodes(Xc.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["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(e=>{this[e]=t[e]}),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 t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),jd(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?Xc.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Xc.host(n):null}return!1}};function ev(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=Xc.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function iv(t,e,i){return 0!==t.size&&function(t,e){const i=Xc.parentNode(e);return!!i&&t.has(i)}(t,e)}function nv(t,e){if(0===t.size)return!1;let i=Xc.parentNode(e);for(;i;){if(t.has(i))return!0;i=Xc.parentNode(i)}return!1}function sv(t){Kd=t}function rv(){Kd=void 0}var ov=(t,e="rrweb")=>Kd?(...i)=>{try{return t(...i)}catch(t){if(Kd&&!0===Kd(t,e))return;throw t}}:t,av=[];function lv(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function uv(t,e){const i=new tv;let n;i.init(t);try{n=new(Kc())(ov(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(s.attributeFilter=t.attributeFilter),n.observe(e,s),av.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function cv({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,a=r=>{const a=lv(r);if(!a||jd(a,n,s,!0))return;const l=i.getId(a);let u,c;if(a===e&&e.defaultView){const t=Dd(e.defaultView);u=t.left,c=t.top}else u=a.scrollLeft,c=a.scrollTop;const h=`${u},${c}`;o.get(l)!==h&&(o.set(l,h),t({id:l,x:u,y:c}))},l=[Td("scroll",ov(Ad(ov(t=>a(t)),r.scroll||100)),e)];return"onscrollend"in e&&l.push(Td("scrollend",ov(a),e)),()=>l.forEach(t=>t())}function hv(t,e){for(let i=av.length-1;i>=0;i--){const n=av[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),av.splice(i,1))}}var dv=["INPUT","TEXTAREA","SELECT"],vv=new WeakMap;function fv(t){return function t(e,i){if(bv("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||bv("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||bv("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||bv("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);return i.unshift(n),t(e.parentRule,i)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(t)}return i}(t,[])}function pv(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function gv({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:Xc.host(i));const o="#document"===i.nodeName?null===(n=i.defaultView)||void 0===n?void 0:n.Document:null===(s=i.ownerDocument)||void 0===s||null===(s=s.defaultView)||void 0===s?void 0:s.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 t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=a.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),ov(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var mv=new Set;function yv(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),c(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=ov(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=av.indexOf(s);-1!==t&&av.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Md(r)}}),a=(t,e)=>{const i=ov(()=>{try{return e()}catch(e){throw mv.add(t),e}})();"function"==typeof i&&r.push(i)};try{if(t.recordDOM&&a("mutation",()=>{const e=uv(t,t.doc);n=e.observer,s=e.buffer}),a("move",()=>function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const l=Ad(ov(e=>{const i=Date.now()-o;t(a.map(t=>(t.timeOffset-=i,t)),e),a=[],o=null}),r),u=ov(Ad(ov(t=>{const e=lv(t),{clientX:i,clientY:s}=Ud(t)?t.changedTouches[0]:t;o||(o=Fd()),a.push({x:i,y:s,id:n.getId(e),timeOffset:Fd()-o}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?Oc.Drag:t instanceof MouseEvent?Oc.MouseMove:Oc.TouchMove)}),s,{trailing:!1})),c=[Td("mousemove",u,i),Td("touchmove",u,i),Td("drag",u,i)];return ov(()=>{c.forEach(t=>t())})}(t)),a("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,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(Fc).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Hh(r);const u=(e=>r=>{const o=lv(r);if(jd(o,n,s,!0))return;let a=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Dc.Mouse;break;case"touch":a=Dc.Touch;break;case"pen":a=Dc.Pen}a===Dc.Touch&&(Fc[e]===Fc.MouseDown?u="TouchStart":Fc[e]===Fc.MouseUp&&(u="TouchEnd"))}else Ud(r)&&(a=Dc.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===Dc.Touch||u.startsWith("Mouse")&&a===Dc.Mouse)&&(a=null)):Fc[e]===Fc.Click&&(a=l,l=null);const c=Ud(r)?r.changedTouches[0]:r;if(!c)return;const h=i.getId(o),{clientX:d,clientY:v}=c;ov(t)(ue({type:Fc[u],id:h,x:d,y:v},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Fc[r]){case Fc.MouseDown:case Fc.MouseUp:o=o.replace("mouse","pointer");break;case Fc.TouchStart:case Fc.TouchEnd:return}a.push(Td(o,u,e))}),ov(()=>{a.forEach(t=>t())})}(t)),a("scroll",()=>cv(t)),a("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Td("resize",ov(Ad(ov(()=>{const e=Ld(),s=Nd();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),a("input",()=>function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function h(t){let i=lv(t);const u=t.isTrusted,h=e.defaultView;if(i&&h&&!(i instanceof h.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=Xc.parentElement(i)),!i||!v||0>dv.indexOf(v)||jd(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=Qh(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(a[v.toLowerCase()]||a[g])&&(f=Uh({element:i,maskInputOptions:a,tagName:v,type:g,value:f,maskInputFn:l})),d(i,c?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,c?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=vv.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){vv.set(e,n);const s=i.getId(e);ov(t)(ue(ue({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Td(t,ov(h),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Od(t[0],t[1],{set(){ov(h)({target:this,isTrusted:!1})}},!1,f))),ov(()=>{Md(v)})}(t)),a("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=ov(r=>Ad(ov(s=>{const o=lv(s);if(!o||jd(o,e,i,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:h}=o;t({type:r,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:h})}),s.media||500)),a=[Td("play",o(Nc.Play),r),Td("pause",o(Nc.Pause),r),Td("seeked",o(Nc.Seeked),r),Td("volumechange",o(Nc.VolumeChange),r),Td("ratechange",o(Nc.RateChange),r)];return ov(()=>{a.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,a,l){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const c={emit:a,ready:!1};u.push(c);let h,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==h&&i.delete(h),c.ready=!0,c.emit=void 0,r(o))};try{h=t.setTimeout(f,5e3),d||v?t.clearTimeout(h):i.add(h)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==h&&(t.clearTimeout(h),i.delete(h)),d?e&&s(l):(c.ready=!0,e||(c.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),a("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=pv(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let a,l;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=pv(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);try{const n=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof n)return l;i.onCssomSheetMutation(r);const{id:o,styleId:u}=pv(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return l;const c=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:a}),()=>{const e=Oh(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(l,()=>c(!0),()=>c(!1))}catch(t){c(!1)}}catch(t){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=pv(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,replaceSync:a})),l},"host")}));const u={};_v("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(_v("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),_v("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),_v("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(u).forEach(([n,r])=>{c[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(c[n].insertRule,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=pv(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...fv(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,adds:[{rule:a,index:e}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(c[n].deleteRule,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=pv(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...fv(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),ov(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})})}(t,{win:i,mutationQueue:e})),a("adoptedStyleSheet",()=>gv(t,t.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:ov((s,o,a)=>{var l;const[u,c,h]=a,d=s.apply(o,a);if(i.has(u))return d;const v=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=pv(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=fv(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:c,priority:h},index:e}))}return d},"host")});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:ov((s,o,a)=>{var l;const[u]=a,c=s.apply(o,a);if(i.has(u))return c;const h=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(h);const{id:d,styleId:v}=pv(h,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=fv(o.parentRule);r.queueMutation(h,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return c},"host")}),ov(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:i,mutationQueue:e})),t.collectFonts&&a("font",()=>function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=Yc(e.fonts,"add",function(e){return function(i){return setTimeout(ov(()=>{const e=s.get(i);e&&(t(e),s.delete(i))}),0),e.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),ov(()=>{n.forEach(t=>t())})}(t))}a("selection",()=>function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const a=ov(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;l>e;e++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:u}=t.getRangeAt(e);jd(r,n,s,!0)||jd(l,n,s,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:u})}r({ranges:a})});return a(),Td("selectionchange",a)}(t)),a("customElement",()=>function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?Yc(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)a(`plugin:${e.name}`,()=>e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function bv(t){return void 0!==window[t]}function _v(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var wv=class{constructor(t){Th(this,"generateIdFn",void 0),Th(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Th(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,i,n){if(0>e)return e;const s=i||this.getRemoteIdToLocalIdMap(t),r=n||this.getLocalIdToRemoteIdMap(t);let o=s.get(e);return void 0===o&&(o=this.generateIdFn(),s.set(e,o),r.set(o,e)),o}getIds(t,e){const i=this.getRemoteIdToLocalIdMap(t),n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,i,n))}getRemoteId(t,e,i){var n;return"number"!=typeof e||0>e?e:null!==(n=(i||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==n?n:-1}getRemoteIds(t,e){const i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,i))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},kv=class{constructor(t){Th(this,"iframes",new WeakMap),Th(this,"crossOriginIframeMap",new WeakMap),Th(this,"crossOriginIframeMirror",new wv(rd)),Th(this,"crossOriginIframeStyleMirror",void 0),Th(this,"crossOriginIframeRootIdMap",new WeakMap),Th(this,"mirror",void 0),Th(this,"mutationCb",void 0),Th(this,"wrappedEmit",void 0),Th(this,"loadListener",void 0),Th(this,"pageHideListener",void 0),Th(this,"stylesheetManager",void 0),Th(this,"recordCrossOriginIframes",void 0),Th(this,"messageHandler",void 0),Th(this,"nestedIframeListeners",new Map),Th(this,"attachedWindows",new WeakMap),Th(this,"attachedDocuments",new WeakMap),Th(this,"attachedIframes",new Map),Th(this,"loadListenerDisposers",new WeakMap),Th(this,"iframeElementsById",new Map),Th(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new wv(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>Id(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Ed(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const i=this.mirror.getId(t);return this.attachedIframes.set(i,{element:t,content:e}),i}attachIframe(t,e){var i;const n=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const e=this.handleMessage.bind(this);Id(()=>{s.addEventListener("message",e),this.nestedIframeListeners.set(s,e);let i=this.attachedWindows.get(t);i||(i=new Set,this.attachedWindows.set(t,i)),i.add(s)})}Id(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Ac.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:Ac.IncrementalSnapshot,data:{source:Oc.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ac.Meta:case Ac.Load:case Ac.DomContentLoaded:return!1;case Ac.Plugin:return e;case Ac.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Ac.IncrementalSnapshot:switch(e.data.source){case Oc.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(e.node,i)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Oc.Drag:case Oc.TouchMove:case Oc.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Oc.ViewportResize:return!1;case Oc.MediaInteraction:case Oc.MouseInteraction:case Oc.Scroll:case Oc.CanvasMutation:case Oc.Input:return this.replaceIds(e.data,t,["id"]),e;case Oc.StyleSheetRule:case Oc.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Oc.Font:return e;case Oc.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case Oc.AdoptedStyleSheet:var i;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(i=e.data.styles)||void 0===i||i.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,i,n){for(const s of n)(Array.isArray(e[s])||"number"==typeof e[s])&&(e[s]=Array.isArray(e[s])?t.getIds(i,e[s]):t.getId(i,e[s]));return e}replaceIds(t,e,i){return this.replace(this.crossOriginIframeMirror,t,e,i)}replaceStyleIds(t,e,i){return this.replace(this.crossOriginIframeStyleMirror,t,e,i)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===qc.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),i=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),i){const t=i.contentWindow,e=this.attachedWindows.get(i);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(Ed(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Ed(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(t=>{Id(()=>this.mirror.removeNodeFromMap(t))}),Id(()=>hv(i,n)),this.attachedDocuments.delete(i))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,i)=>{this.mirror.has(i)||t.push(i)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&Ed(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Ed(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),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}},Sv=class{constructor(t){Th(this,"shadowDoms",new WeakSet),Th(this,"mutationCb",void 0),Th(this,"scrollCb",void 0),Th(this,"bypassOptions",void 0),Th(this,"mirror",void 0),Th(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(!Mh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=Xc.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=uv(ue(ue({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=av.indexOf(o);-1!==t&&av.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:cv(ue(ue({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(Xc.host(t))),this.restoreHandlers.push({doc:s,handler:gv({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){Id(()=>{const e=t.contentWindow,i=t.contentDocument;e&&i&&this.patchAttachShadow(e.Element,i)})}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:Yc(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=Xc.shadowRoot(this);return r&&Zd(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},xv="skip-frame";function $v(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:i,width:n,height:s}=t;return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Cv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tv="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ev=0;64>Ev;Ev++)Tv[Cv.charCodeAt(Ev)]=Ev;var Iv=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Cv[i[e]>>2],s+=Cv[(3&i[e])<<4|i[e+1]>>4],s+=Cv[(15&i[e+1])<<2|i[e+2]>>6],s+=Cv[63&i[e+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Mv=!1,Rv=new Map,Pv=(t,e,i)=>{if(!t||!Fv(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Rv.get(t);return i||(i=new Map,Rv.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}(i,t.constructor.name);let s=n.indexOf(t);return-1===s&&(s=n.length,n.push(t)),s};function Av(t,e,i,n){if(t instanceof Array)return t.map(t=>Av(t,e,i,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:Iv(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Av(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let i;try{i=t.toDataURL(n.type,n.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?Mv||(Mv=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:i}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[Av(t.data,e,i,n),t.width,t.height]}:Fv(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Pv(t,e,i)}:t}var Ov=(t,e,i,n)=>t.map(t=>Av(t,e,i,n)),Fv=(t,e)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(i.find(i=>t instanceof e[i]))},Dv=["webgl","webgl2"];function Lv(t){return"nodeType"in t}function Nv(t,e,i,n){const s=[];try{if(n){const n=function(t,e,i){const n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return Yc(n.prototype,"configure",function(n){return function(s){const r=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!r||Lv(r)&&jd(r,e,i,!0))return n.call(this,s);Lv(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?ue(ue({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=Yc(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!jd(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Dv.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function qv(t,e,i,n,s,r,o){const a=[],l=Object.getOwnPropertyNames(t);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const l=Yc(t,u,function(t){return function(...a){const l=t.apply(this,a);if(Pv(l,r,this),this.canvas&&"tagName"in this.canvas&&!jd(this.canvas,n,s,!0)){let t;try{t=Ov(a,r,this,o)}catch(t){}t&&i(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(r){const o=Od(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!jd(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var jv='(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',Bv="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jv],{type:"text/javascript;charset=utf-8"});function zv(t){let e;try{if(e=Bv&&(self.URL||self.webkitURL).createObjectURL(Bv),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jv),{name:null==t?void 0:t.name})}}var Uv="A page CSP that omits blob: from worker-src or script-src blocks it";function Hv(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var Wv,Vv,Gv,Qv=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.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(t){Th(this,"pendingCanvasMutations",new Map),Th(this,"rafStamps",{latestId:0,invokeId:null}),Th(this,"mirror",void 0),Th(this,"mutationCb",void 0),Th(this,"resetObservers",void 0),Th(this,"frozen",!1),Th(this,"locked",!1),Th(this,"rafIdTimestamp",null),Th(this,"rafIdFlush",null),Th(this,"refCount",0),Th(this,"torndown",!1),Th(this,"resetFrameDedup",null),Th(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return void Hv("disabled because this browser does not support OffscreenCanvas");const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,a=Nv(e,i,n,!0),l=new Map;let u;try{u=new zv}catch(t){return Hv(`disabled because the encode worker did not start. ${Uv}`,t),void a()}let c=!1;u.onerror=t=>{var e;c=!0,Hv(`stopped because the encode worker failed. ${Uv}`,t),cancelAnimationFrame(f),null===(e=u.terminate)||void 0===e||e.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(l.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,type:Lc["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};let h=!1,d=!1;const v=1e3/t;let f,p=0;const g=t=>{var a;c||(p&&v>t-p||(p=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{jd(e,i,n,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&s(t.shadowRoot)})}catch(t){}};return s(e.document),t})().forEach((a=re(function*(t){const e=r.mirror.getId(t);if(-1!==e&&!l.get(e)&&0!==t.width&&0!==t.height){l.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void l.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,a=t.clientHeight||t.height,c=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),v=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return xv}if(void 0===o)return;if(!Array.isArray(o)||!o.every($v))return xv;const a=i/s,l=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*a),i=Math.floor(t.y*l);return{x:e,y:i,width:Math.ceil((t.x+t.width)*a)-e,height:Math.ceil((t.y+t.height)*l)-i}})}(s.canvasMasking,t,c,d,r,a);if("skip-frame"===v)return h||(h=!0,Hv("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void l.set(e,!1);const f=yield createImageBitmap(t,1>o?{resizeWidth:c,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:d});u.postMessage({id:e,bitmap:f,width:c,height:d,displayWidth:r,displayHeight:a,dataURLOptions:s.dataURLOptions,maskRegions:v},[f])}catch(t){d||(d=!0,Hv("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),l.set(e,!1)}}}),function(t){return a.apply(this,arguments)}))),f=requestAnimationFrame(g))};f=requestAnimationFrame(g),this.resetObservers=()=>{var t;a(),cancelAnimationFrame(f),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Nv(t,e,i,!1),r=function(t,e,i,n,s){const r=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])continue;const o=Yc(e.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return jd(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Ov(o,e,this,s)}catch(t){return}t(this.canvas,{type:Lc["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Od(e.CanvasRenderingContext2D.prototype,a,{set(e){jd(this.canvas,i,n,!0)||t(this.canvas,{type:Lc["2D"],property:a,args:[e],setter:!0})}});r.push(o)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n),o=function(t,e,i,n,s){const r=[];return void 0!==e.WebGLRenderingContext&&r.push(...qv(e.WebGLRenderingContext.prototype,Lc.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...qv(e.WebGL2RenderingContext.prototype,Lc.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>ws(t,Pc)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Zv=class{constructor(t){var e;Th(this,"trackedLinkElements",new WeakSet),Th(this,"pendingDeferredSheets",new Set),Th(this,"mutationCb",void 0),Th(this,"adoptedStyleSheetCb",void 0),Th(this,"maskAllElementAttributes",void 0),Th(this,"maskAttributeFn",void 0),Th(this,"styleMirror",new Gd),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Bh(n))}catch(t){}if(!i||!n)return xh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=th(),u=nh();let c=!0;try{if(r)return a=!0,xh(),!0;if(!s.advance(i))return c=!1,!1;a=!0;const o=s.text();if(!t.isConnected)return!0;let l=null;try{l=t.sheet}catch(t){}return l!==n?(xh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(xh(),!0)}finally{c&&this.pendingDeferredSheets.delete(o),sh(h=th()-l,null!=(d=u)?d:eh)||(ph.totalMs+=h,h>ph.slowestSliceMs&&(ph.slowestSliceMs=h))}var h,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:Vh({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=th();try{_h(()=>{try{const t=e.rules||e.cssRules;t&&bh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:Fh(t,e.href),index:i}))})})}finally{wh(th()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),bd.forEach(t=>t.abort()),bd.clear()}trackStylesheetInLinkElement(t){}},Jv=class{constructor(){Th(this,"nodeMap",new WeakMap),Th(this,"active",!1)}inOtherBuffer(t,e){const i=this.nodeMap.get(t);return i&&Array.from(i).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},Kv=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Yv;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Yv=t.contentWindow)||void 0===Yv?void 0:Yv.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Xv=new zh,tf=new Set([Oc.Mutation,Oc.MediaInteraction,Oc.StyleSheetRule,Oc.CanvasMutation,Oc.Font,Oc.Log,Oc.StyleDeclaration,Oc.AdoptedStyleSheet]);function ef(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function nf(t={}){let e,i=!1,n=!1;const{emit:s,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:a="rr-block",blockSelector:l=null,ignoreClass:u="rr-ignore",ignoreSelector:c=null,maskTextClass:h="rr-mask",maskTextSelector:d=null,inlineStylesheet:v=!0,inlineStylesheetBudgetRules:f,maskAllInputs:p,maskInputOptions:g,slimDOMOptions:m,maskInputFn:y,maskTextFn:b,maskAllElementAttributes:_=!1,maskAttributeFn:w,hooks:k,packFn:S,sampling:x={},dataURLOptions:C={},canvasResolutionScale:T,canvasMasking:E,mousemoveWait:I,recordDOM:M=!0,recordCanvas:R=!1,recordCrossOriginIframes:P=!1,recordAfter:A=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:O=!1,collectFonts:F=!1,inlineImages:D=!1,plugins:L,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:q=new Set([]),attributeFilter:j,errorHandler:B}=t;sv(B);const z=ue({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},C),U=!P||window.parent===window;let H=!1;if(!U)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(U&&!s)throw new Error("emit function is required");if(!U&&!H)return()=>{};void 0!==I&&void 0===x.mousemove&&(x.mousemove=I),Xv.reset();const W=!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!==g?g:{password:!0},V=$d(void 0!==m&&m);let G;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let Q=0;const Z=new Map;let J,K;const Y=t=>{for(const e of L||[])e.eventProcessor&&(t=e.eventProcessor(t));return S&&!H&&(t=S(t)),t};Wv=(t,e)=>{var i;const n=t;if(n.timestamp=Fd(),!(null===(i=av[0])||void 0===i?void 0:i.isFrozen())||n.type===Ac.FullSnapshot||n.type===Ac.IncrementalSnapshot&&tf.has(n.data.source)||av.forEach(t=>t.unfreeze()),U)null==s||s(Y(n),e);else if(H){const t={type:"rrweb",event:Y(n),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(n.type===Ac.FullSnapshot)G=n,Q=0;else if(n.type===Ac.IncrementalSnapshot){if(n.data.source===Oc.Mutation&&n.data.isAttachIframe)return;Q++,(o&&Q>=o||r&&n.timestamp-G.timestamp>r)&&Vv(!0)}};const X=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=Xv.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=nt.getIframeElementById(t);n&&i.has(n)?nt.forgetIframeId(t):(null==J||J(t),nt.removeIframeById(t))}),null==K||K(),nt.cleanupDetachedIframes()}Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Mutation},t)})},tt=t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Scroll},t)}),et=t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.CanvasMutation},t)}),it=new Zv({mutationCb:X,adoptedStyleSheetCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.AdoptedStyleSheet},t)}),maskAllElementAttributes:_,maskAttributeFn:w}),nt=new kv({mirror:Xv,mutationCb:X,stylesheetManager:it,recordCrossOriginIframes:P,wrappedEmit:Wv});for(const t of L||[])t.getMirror&&t.getMirror({nodeMirror:Xv,crossOriginIframeMirror:nt.crossOriginIframeMirror,crossOriginIframeStyleMirror:nt.crossOriginIframeStyleMirror});const st=new Jv,rt=null==E?void 0:E.configured;Gv=new Qv({recordCanvas:R,mutationCb:et,win:window,blockClass:a,blockSelector:l,mirror:Xv,sampling:x.canvas,dataURLOptions:z,resolutionScale:T,canvasMasking:E});const ot=new Sv({mutationCb:X,scrollCb:tt,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskInputOptions:W,dataURLOptions:z,maskTextFn:b,maskInputFn:y,maskAllElementAttributes:_,maskAttributeFn:w,recordCanvas:R,canvasMaskingConfigured:rt,inlineImages:D,sampling:x,slimDOMOptions:V,iframeManager:nt,stylesheetManager:it,canvasManager:Gv,keepIframeSrcFn:N,processedNodeManager:st,attributeFilter:j},mirror:Xv});Vv=(t=!1)=>{if(M){gh(f);try{if(Wv({type:Ac.Meta,data:{href:window.location.href,width:Nd(),height:Ld()}},t),i)return;null==e||e.cancel(),e=void 0,it.reset(),ot.init(),av.forEach(t=>t.lock());let n=null,s=[];try{n=function(t,e){const{mirror:i=new zh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,canvasMaskingConfigured:c,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:E}=e||{},I=!0===h?{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===h?{password:!0}:h,M=$d(g);gh(E);try{return xd(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:I,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:M,dataURLOptions:m,inlineImages:l,recordCanvas:u,canvasMaskingConfigured:c,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{mh()}}(document,{mirror:Xv,blockClass:a,blockSelector:l,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskAllInputs:W,inlineStylesheetBudgetRules:f,maskTextFn:b,maskInputFn:y,maskAllElementAttributes:_,maskAttributeFn:w,slimDOM:V,dataURLOptions:z,recordCanvas:R,canvasMaskingConfigured:rt,inlineImages:D,onSerialize(t){Hd(t,Xv)&&nt.addIframe(t),Wd(t,Xv)&&it.trackLinkElement(t),Vd(t)&&ot.addShadowRoot(Xc.shadowRoot(t),document)},onIframeLoad(t,e){nt.attachIframe(t,e),ot.observeAttachShadow(t)},onIframeListenerRegistered(t,e){nt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){it.attachLinkElement(t,e)},keepIframeSrcFn:N})}finally{s=Sh()}if(i)return;if(!n)return console.warn("Failed to snapshot the document");if(Wv({type:Ac.FullSnapshot,data:{node:n,initialOffset:Dd(window)}},t),i)return;if(av.forEach(t=>t.unlock()),Gv.onFullSnapshot(),s.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const a=()=>null!==o||t.length>r,l=()=>{const i=t[r];t[r]=null,r+=1,i&&Id(()=>{o=e.beginDeferredLinkInlining(i,Xv.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Id(()=>{e=t.advance(200)}),e&&(o=null)},c=()=>{o||l(),u()},h=t=>{if(s=null,n)return;let e=0;do{try{c()}catch(t){null==o||o.discard(),o=null,$h(1)}e+=1}while(!n&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(a()?s=ef(h):i())};return s=ef(h),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,c=0;for(;a()&&50>e;){o||l();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,c+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,c+=1}e+=1}}if(a()||c>0){let e=c+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);$h(e),null==o||o.discard(),o=null}i()}}}(s,it,()=>{e===t&&(e=void 0)});e=t}P&&nt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&it.adoptStyleSheets(document.adoptedStyleSheets,Xv.getId(document))}finally{mh()}}};try{const t=[];t.push(Td("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Td(e,ih,document));J=e=>{const i=Z.get(e);i&&(i.forEach(e=>{Id(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),Z.delete(e))},K=()=>{for(const[t]of Z){const e=Xv.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==J||J(t)}catch(e){null==J||J(t)}else null==J||J(t)}};const s=t=>{var e;return ov(yv)({mutationCb:X,mousemoveCb:(t,e)=>Wv({type:Ac.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.MouseInteraction},t)}),scrollCb:tt,viewportResizeCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.ViewportResize},t)}),inputCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Input},t)}),mediaInteractionCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.MediaInteraction},t)}),styleSheetRuleCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.StyleSheetRule},t)}),styleDeclarationCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.StyleDeclaration},t)}),canvasMutationCb:et,fontCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Font},t)}),selectionCb(t){Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Selection},t)})},customElementCb(t){Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.CustomElement},t)})},blockClass:a,ignoreClass:u,ignoreSelector:c,maskTextClass:h,maskTextSelector:d,maskInputOptions:W,inlineStylesheet:v,sampling:x,recordDOM:M,recordCanvas:R,canvasMaskingConfigured:rt,inlineImages:D,userTriggeredOnInput:O,collectFonts:F,doc:t,maskInputFn:y,maskTextFn:b,maskAllElementAttributes:_,maskAttributeFn:w,keepIframeSrcFn:N,blockSelector:l,slimDOMOptions:V,dataURLOptions:z,mirror:Xv,iframeManager:nt,stylesheetManager:it,shadowDomManager:ot,processedNodeManager:st,canvasManager:Gv,ignoreCSSAttributes:q,attributeFilter:j,plugins:(null==L||null===(e=L.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>Wv({type:Ac.Plugin,data:{plugin:t.name,payload:e}})})))||[]},k)};nt.addLoadListener(e=>{try{const i=Xv.getId(e),n=s(e.contentDocument);if("function"==typeof n&&(t.push(n),-1!==i)){let t=Z.get(i);t||(t=new Set,Z.set(i,t)),t.add(n)}}catch(t){console.warn(t)}}),nt.addPageHideListener(t=>{const e=Xv.getId(t);null==J||J(e),hv(t)});let r=-1;const o=t=>Wv({type:Ac.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),f=()=>{var t,e,i,n;const s=document,a=null!==(t=null!==(e=null!==(i=null!==(n=s.fullscreenElement)&&void 0!==n?n:s.webkitFullscreenElement)&&void 0!==i?i:s.mozFullScreenElement)&&void 0!==e?e:s.msFullscreenElement)&&void 0!==t?t:null,l=a?Xv.getId(a):-1;l!==r&&(-1!==r&&o({id:r,enter:!1}),r=l,-1!==l&&o({id:l,enter:!0}))},p=()=>{if(i||n)return;if(n=!0,Vv(),i)return;const e=s(document);i?"function"==typeof e&&Md([e]):("function"==typeof e&&t.push(e),t.push(Td("fullscreenchange",f)),t.push(Td("webkitfullscreenchange",f)),t.push(Td("mozfullscreenchange",f)),t.push(Td("MSFullscreenChange",f)),Kv=!0)};return["interactive","complete"].includes(document.readyState)?p():(t.push(Td("DOMContentLoaded",()=>{Wv({type:Ac.DomContentLoaded,data:{}}),"DOMContentLoaded"===A&&setTimeout(p,0)})),t.push(Td("load",()=>{Wv({type:Ac.Load,data:{}}),"load"===A&&p()},window))),()=>{i=!0;try{null==e||e.flush()}catch(t){}e=void 0,Md(t),st.destroy(),nt.removeLoadListener(),nt.destroy(),Z.clear(),ot.reset(),Xv.reset(),Kv=!1,rv()}}catch(t){console.warn(t)}}nf.addCustomEvent=(t,e)=>{if(!Kv)throw new Error("please add custom event after start recording");Wv({type:Ac.Custom,data:{tag:t,payload:e}})},nf.freezePage=()=>{av.forEach(t=>t.freeze())},nf.takeFullSnapshot=t=>{if(!Kv)throw new Error("please take full snapshot after start recording");Vv(t)},nf.isRecording=()=>Kv,nf.mirror=Xv,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var sf=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${sf.source}`,"i"),new RegExp(sf.source,"gi"),"0".repeat(32),"0".repeat(16);var rf=Object.create(null);function of(t){return of="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},of(t)}function af(t,e,i){return(e=function(t){var e=function(t){if("object"!=of(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=of(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==of(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}rf.Node=Object.create(null),rf.ShadowRoot=Object.create(null),rf.MutationObserver=Object.create(null),rf.Element=Object.create(null);var lf=class{constructor(t){af(this,"fileName",void 0),af(this,"functionName",void 0),af(this,"lineNumber",void 0),af(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},uf=/(^|@)\S+:\d+/,cf=/^\s*at .*(\S+:\d+|\(native\))/m,hf=/^(eval@)?(\[native code])?$/,df={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(cf)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(cf)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=i?e.replace(i[0],""):e;const n=e.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new lf({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(hf)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new lf({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new lf({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[];for(let t=2,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new lf({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[];for(let t=0,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new lf({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(uf)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new lf({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function vf(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let i=t.localName;if(!i)break;i=i.toLowerCase();const n=t.parentElement,s=[];if(n.children&&n.children.length>0)for(let t=0;n.children.length>t;t++){const e=n.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===i&&s.push(e)}s.length>1&&(i+=`:eq(${s.indexOf(t)})`),e=i+(e?">"+e:""),t=n}return e}function ff(t){return Array.isArray(t)}function pf(t){return"object"==typeof t&&null!==t&&!ff(t)}function gf(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(pf(t[n])&&gf(t[n],e-1))return!0;return!1}function mf(t,e){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,e);const n=[],s=[];return JSON.stringify(t,function(t,e){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,t):s.push(t),~n.indexOf(e)&&(e=n[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(e)).join(".")+"]")}else n.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(pf(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||pf(r)&&gf(r,i.depthOfLimit))return function(t){let e=t.toString();return i.stringLengthLimit&&e.length>i.stringLengthLimit&&(e=`${e.slice(0,i.stringLengthLimit)}...`),e}(e);var r;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const i in e){const n=e[i];t[i]=ff(n)?vf(n.length?n[0]:null):n}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var yf={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 bf(t,e,i){const n=i?Object.assign({},yf,i):yf,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,a=!1,l=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:df.parse(e.error).map(t=>t.toString()),payload:[mf(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[mf(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[mf("Uncaught (in promise)",n.stringifyOptions),mf(e.reason,n.stringifyOptions)]),t({level:"error",trace:df.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(c(r,t));return()=>{l=!1,u.forEach(t=>t())};function c(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],c={next:u},h=(s=>(...r)=>{if(s.apply(e,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const e=df.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>mf(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[mf("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{a=!1}}})(function(...t){return c.next.apply(this,t)});return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),s[r]=h,()=>{if(s[r]===h)return void(s[r]=c.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===h)return void(i.next=c.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var _f=t=>({name:"rrweb/console@1",observer:bf,options:t});const wf=()=>{},kf=t=>{var e;if(xe(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Sf(t,e,i){try{if(!(e in t))return wf;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return xe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],r=kf(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=kf(i)}}}catch(t){return wf}}function xf(t,e){var i;const n=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),s={hostname:n,isHostDenied:!1};if(!(null===(i=e.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const t of e.payloadHostDenyList)if(n.endsWith(t))return{hostname:n,isHostDenied:!0};return s}const $f=Or("[Recorder]"),Cf=t=>"navigation"===t.entryType,Tf=t=>"resource"===t.entryType,Ef=()=>{};function If(t,e){var i;return Cf(e)&&"complete"===(null===(i=t.document)||void 0===i?void 0:i.readyState)&&e.loadEventEnd>0}function Mf(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(i=>If(t,i)||Tf(i)&&e.initiatorTypes.includes(i.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>If(t,e))}(t):[]}function Rf(t,e){return!!e&&(Oe(e)||e[t])}function Pf(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const Af=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Of({type:t,recordBody:e,headers:i,url:n}){function s(t){const e=Object.keys(i).find(t=>"content-type"===t.toLowerCase()),n=e&&i[e];return t.some(t=>null==n?void 0:n.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Pf(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(Af))return!1;if(Oe(e))return!0;if(Se(e))return s(e);const r=e[t];return Oe(r)?r:s(r)}function Ff(t,e,i,n,s){return Df.apply(this,arguments)}function Df(){return Df=re(function*(t,e,i,n,s,r=0){if(r>10)return $f.warn("Failed to get performance entry for request",{url:i,initiatorType:e}),null;const o=function(t,e){for(let i=t.length-1;i>=0;i-=1)if(e(t[i]))return t[i]}(t.performance.getEntriesByName(i),t=>Tf(t)&&t.initiatorType===e&&(Te(n)||t.startTime>=n)&&(Te(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Ff(t,e,i,n,s,r+1))}),Df.apply(this,arguments)}function Lf({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=xf(i,e);if(s)return n+" is in deny list";if(Ee(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(Fe(t))return Yr(t);if($e(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Nf=t=>!Me(t)&&("navigation"===t.entryType||"resource"===t.entryType);function qf(t,{entry:e,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:a,url:l,initiatorType:u}){o=e?e.startTime:o,a=e?e.responseEnd:a;const c=Math.floor(Date.now()-t.performance.now()),h=Math.floor(c+(o||0)),d=[ue(ue({},e?JSON.parse(JSON.stringify(e.toJSON())):{name:l}),{},{startTime:Te(o)?void 0:Math.round(o),endTime:Te(a)?void 0:Math.round(a),timeOrigin:c,timestamp:h,method:i,initiatorType:u||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Nf(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:h,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const jf=["video/","audio/"];function Bf(t){return $e(t)&&xe(t.getReader)&&xe(t.tee)}const zf="[SessionReplay] Timeout while trying to read body",Uf="[SessionReplay] Failed to read body";function Hf(t){return`${Uf}: ${t}`}function Wf(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Vf(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(zf),500);try{t.clone().text().then(t=>e(t),t=>e(Hf(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Uf)}})}(t);const i=Ko(e);return function(t,e){try{var i,n;const s=null===(i=t.headers)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"content-length");if(!s)return!1;const r=parseInt(s,10);return Number.isFinite(r)&&r>e}catch(t){return!1}}(t,i)?Promise.resolve(Wf(i)):function(t,e){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(t){}}function o(t){s||(s=!0,clearTimeout(a),r(),i(t))}const a=setTimeout(()=>o(zf),500);let l;try{l=t.clone()}catch(t){return void o(Uf)}const u=l.body;if(!Bf(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(Hf(t)))}catch(t){o(Uf)}return}try{n=u.getReader()}catch(t){return void o(Uf)}const c=[];let h=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(c,h)));else{if(n){if(h+n.byteLength>e)return void o(Wf(e));h+=n.byteLength,c.push(n)}t()}},t=>o(Hf(t)))}()})}(t,i)}function Gf(t){return Qf.apply(this,arguments)}function Qf(){return Qf=re(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=xf(i,e);return s?Promise.resolve(n+" is in deny list"):Vf(t,e)}),Qf.apply(this,arguments)}function Zf(t){return Jf.apply(this,arguments)}function Jf(){return Jf=re(function*({r:t,options:e,url:i}){const n=function({r:t,options:e,url:i}){var n;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=t.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=jf.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:a}=xf(i,e);return a?o+" is in deny list":null}({r:t,options:e,url:i});return Me(n)?Vf(t,e):Promise.resolve(n)}),Jf.apply(this,arguments)}let Kf=null;function Yf(t,e,i){if(!("performance"in e))return()=>{};if(Kf)return $f.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},Yo,i):Yo;let s=!0,r=!1;const o=e=>{if(!s)return;const i=[];let o=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&o)return;let s;try{s=n.maskRequestFn(t)}catch(t){return r||(r=!0,$f.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(e||(o=!0))}e||(o=!s||(t=>!!t&&oa.has(t))(s)),s&&i.push(s)}),i.length>0&&t(ue(ue({},e),{},{requests:i}))},a=function(t,e,i){try{t({requests:Mf(e,i).flatMap(t=>qf(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){$f.error("Failed to capture initial performance entries for network capture",t)}const n=e.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!Se(s))return;const r=s.filter(t=>i.performanceEntryTypeToObserve.includes(t));if(!r.length)return;const o=new n(n=>{t({requests:n.getEntries().filter(t=>Cf(t)||Tf(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>qf(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(o,e,n),l=n.recordHeaders||n.recordBody;if(!a&&!l)return s=!1,Ef;let u=()=>{},c=()=>{};return l&&(u=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=Rf("request",i.recordHeaders),s=Rf("response",i.recordHeaders),r=Sf(e.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,u,c){const h=this;try{const r=new Request(a),l={};let u,c;const d={},v=h.setRequestHeader.bind(h);h.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(l.requestHeaders=d);const f=h.send.bind(h);h.send=t=>(Of({type:"request",headers:d,url:a,recordBody:i.recordBody})&&(l.requestBody=Lf({body:t,options:i,url:a})),u=e.performance.now(),f(t));const p=()=>{h.removeEventListener("readystatechange",g),h.removeEventListener("error",p),h.removeEventListener("abort",p),h.removeEventListener("timeout",p)},g=()=>{if(h.readyState!==h.DONE)return;p(),c=e.performance.now();const n={};h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(l.responseHeaders=n),Of({type:"response",headers:n,url:a,recordBody:i.recordBody})&&(l.responseBody=Lf({body:h.response,options:i,url:a})),Ff(e,"xmlhttprequest",r.url,u,c).then(i=>{t({requests:qf(e,{entry:i,method:o,status:null==h?void 0:h.status,networkRequest:l,start:u,end:c,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};h.addEventListener("readystatechange",g),h.addEventListener("error",p),h.addEventListener("abort",p),h.addEventListener("timeout",p)}catch(t){$f.error("Failed to instrument XHR for network capture",t)}r.call(h,o,a.toString(),l,u,c)});return()=>{r()}}(o,e,n),c=!0===n.captureFetchSynchronously?function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Rf("request",i.recordHeaders),s=Rf("response",i.recordHeaders),r=Sf(e,"fetch",r=>function(o,a){let l;try{l=new Request(o,a)}catch(t){$f.error("Failed to instrument fetch for network capture",t);try{return Promise.resolve(r(o,a))}catch(t){return new Promise((e,i)=>i(t))}}const u={};let c,h;const d=re(function*(){try{const t={};l.headers.forEach((e,i)=>{t[i]=e}),n&&(u.requestHeaders=t),!Bf(null==a?void 0:a.body)&&Of({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(u.requestBody=yield Gf({r:l,options:i,url:o}))}catch(t){$f.error("Failed to record fetch request for network capture",t)}})(),v=(f=re(function*(t){try{const e={};t.headers.forEach((t,i)=>{e[i]=t}),s&&(u.responseHeaders=e),Of({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield Zf({r:t,options:i,url:o}))}catch(t){$f.error("Failed to record fetch response for network capture",t)}}),function(t){return f.apply(this,arguments)});var f;try{c=e.performance.now()}catch(t){}let p;try{p=Pf(o)?r(l):r(o,a)}catch(t){p=new Promise((e,i)=>i(t))}const g=Promise.resolve(p).then(t=>{try{h=e.performance.now()}catch(t){}return{status:"fulfilled",response:t}},t=>({status:"rejected",error:t}));return re(function*(){let i;try{yield d;const t=yield g;if("rejected"===t.status)throw t.error;return i=t.response,yield v(i),i}finally{(n=i,Ff(e,"fetch",l.url,c,h).then(i=>{t({requests:qf(e,{entry:i,method:l.method,status:null==n?void 0:n.status,networkRequest:u,start:c,end:h,url:l.url,initiatorType:"fetch"})})})).catch(()=>{})}var n})()});return()=>{r()}}(o,e,n):function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Rf("request",i.recordHeaders),s=Rf("response",i.recordHeaders),r=Sf(e,"fetch",r=>function(){var o=re(function*(o,a){let l,u;try{l=new Request(o,a)}catch(t){return $f.error("Failed to instrument fetch for network capture",t),r(o,a)}const c={};let h,d;try{try{const t={};l.headers.forEach((e,i)=>{t[i]=e}),n&&(c.requestHeaders=t),!Bf(null==a?void 0:a.body)&&Of({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(c.requestBody=yield Gf({r:l,options:i,url:o}))}catch(t){$f.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=Pf(o)?yield r(l):yield r(o,a),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(c.responseHeaders=t),Of({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(c.responseBody=yield Zf({r:u,options:i,url:o}))}catch(t){$f.error("Failed to record fetch response for network capture",t)}return u}finally{Ff(e,"fetch",l.url,h,d).then(i=>{t({requests:qf(e,{entry:i,method:l.method,status:null==u?void 0:u.status,networkRequest:c,start:h,end:d,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(o,e,n)),Kf=()=>{s=!1,null==a||a(),u(),c(),Kf=null},Kf}const Xf=t=>({name:"rrweb/network@1",observer:Yf,options:t});var tp,ep,ip,np,sp,rp,op,ap,lp,up,cp,hp,dp,vp,fp;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:_f,getRecordNetworkPlugin:Xf},h.__PosthogExtensions__.rrweb={record:nf,version:"v2",wasMaxDepthReached:()=>Sd,resetMaxDepthState(){Sd=!1,kd=!1},getLastSnapshotCost:()=>uh,getMutationCost:()=>ue({},fh),getObserverInitFailures:()=>mv.size?Array.from(mv):void 0,resetSnapshotCostState(){rh=0,oh=0,ah=0,eh=0,lh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},uh=null,ch=null,hh=[],dh=0,vh=0,fh={slowestBatchMs:0},ph={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:nf,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:_f},h.getRecordNetworkPlugin=Xf,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(t,e)=>new Rc(t,e);var pp,gp,mp,yp,bp={},_p=[],wp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,kp=Array.isArray;function Sp(t,e){for(var i in e)t[i]=e[i];return t}function xp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function $p(t,e,i){var n,s,r,o={};for(r in e)"key"==r?n=e[r]:"ref"==r?s=e[r]:o[r]=e[r];if(arguments.length>2&&(o.children=arguments.length>3?tp.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===o[r]&&(o[r]=t.defaultProps[r]);return Cp(t,o,n,s,null)}function Cp(t,e,i,n,s){var r={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++ip:s,__i:-1,__u:0};return null==s&&null!=ep.vnode&&ep.vnode(r),r}function Tp(t){return t.children}function Ep(t,e){this.props=t,this.context=e}function Ip(t,e){if(null==e)return t.__?Ip(t.__,t.__i+1):null;for(var i;t.__k.length>e;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Ip(t):null}function Mp(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=Sp({},e);r.__v=e.__v+1,ep.vnode&&ep.vnode(r),jp(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Ip(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,zp(n,r,s),e.__e=e.__=null,r.__e!=i&&Rp(r)}}function Rp(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),Rp(t)}function Pp(t){(!t.__d&&(t.__d=!0)&&np.push(t)&&!Ap.__r++||sp!=ep.debounceRendering)&&((sp=ep.debounceRendering)||rp)(Ap)}function Ap(){try{for(var t,e=1;np.length;)np.length>e&&np.sort(op),t=np.shift(),e=np.length,Mp(t)}finally{np.length=Ap.__r=0}}function Op(t,e,i,n,s,r,o,a,l,u,c){var h,d,v,f,p,g,m,y=n&&n.__k||_p,b=e.length;for(l=function(t,e,i,n,s){var r,o,a,l,u,c=i.length,h=c,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=Cp(null,o,null,null,null):kp(o)?o=t.__k[r]=Cp(Tp,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=Cp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,l=r+d,o.__=t,o.__b=t.__b+1,a=null,-1!=(u=o.__i=Dp(o,i,l,h))&&(h--,(a=i[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>c?d--:c>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?d--:u==l+1?d++:(u>l?d--:d++,o.__u|=4))):t.__k[r]=null;if(h)for(r=0;c>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==n&&(n=Ip(a)),Wp(a,a));return n}(i,e,y,l,b),h=0;b>h;h++)null!=(v=i.__k[h])&&(d=-1!=v.__i&&y[v.__i]||bp,v.__i=h,g=jp(t,v,d,s,r,o,a,l,u,c),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Hp(d.ref,null,v),c.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(l=Fp(v,l,t,m),m&&d.__e&&(d.__e=null)):"function"==typeof v.type&&void 0!==g?l=g:f&&(l=f.nextSibling),v.__u&=-7);return i.__e=p,l}function Fp(t,e,i,n){var s,r;if("function"==typeof t.type){for(s=t.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=t,e=Fp(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Ip(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Dp(t,e,i,n){var s,r,o,a=t.key,l=t.type,u=e[i],c=null!=u&&!(2&u.__u);if(null===u&&null==a||c&&a==u.key&&l==u.type)return i;if(n>(c?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Lp(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||wp.test(e)?i:i+"px"}function Np(t,e,i,n,s){var r,o;t:if("style"==e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Lp(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Lp(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(cp,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=i,i?n?i[up]=n[up]:(i[up]=hp,t.addEventListener(e,r?vp:dp,r)):t.removeEventListener(e,r?vp:dp,r);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null==i||!1===i&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==i?"":i))}}function qp(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[lp])e[lp]=hp++;else if(i[up]>e[lp])return;return i(ep.event?ep.event(e):e)}}}function jp(t,e,i,n,s,r,o,a,l,u){var c,h,d,v,f,p,g,m,y,b,$,_,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=e.__e=i.__e]),(c=ep.__b)&&c(e);t:if("function"==typeof C){h=o.length;try{if(y=e.props,b=C.prototype&&C.prototype.render,$=(c=C.contextType)&&n[c.__c],_=c?$?$.props.value:c.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new C(y,_):(e.__c=d=new Ep(y,_),d.constructor=C,d.render=Vp),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Sp({},d.__s)),Sp(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),_p.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,_),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=_,d.props=y,d.__P=t,d.__e=!1,w=ep.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),_p.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=Sp(Sp({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=c&&c.type===Tp&&null==c.key?Up(c.props.children):c,a=Op(t,kp(S)?S:[S],e,i,n,s,r,o,a,l,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=h,e.__v=null,l||null!=r)if(t.then){for(e.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),e.__e=a}else{if(null!=r)for(x=r.length;x--;)xp(r[x]);Bp(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Bp(e);ep.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):a=e.__e=function(t,e,i,n,s,r,o,a,l){var u,c,h,d,v,f,p,g=i.props||bp,m=e.props,y=e.type;if("svg"==y?s="http://www.w3.org/2000/svg":"math"==y?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(u=0;r.length>u;u++)if((v=r[u])&&"setAttribute"in v==!!y&&(y?v.localName==y:3==v.nodeType)){t=v,r[u]=null;break}if(null==t){if(null==y)return document.createTextNode(m);t=document.createElementNS(s,y,m.is&&m),a&&(ep.__m&&ep.__m(e,r),a=!1),r=null}if(null==y)g===m||a&&t.data==m||(t.data=m);else{if(r="textarea"==y&&null!=m.defaultValue?null:r&&tp.call(t.childNodes),!a&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?h=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||Np(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?c=v:"value"==u?f=v:"checked"==u?p=v:a&&"function"!=typeof v||g[u]===v||Np(t,u,v,g[u],s);if(c)a||h&&(c.__html==h.__html||c.__html==t.innerHTML)||(t.innerHTML=c.__html),e.__k=[];else if(h&&(t.innerHTML=""),Op("template"==e.type?t.content:t,kp(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Ip(i,0),a,l),null!=r)for(u=r.length;u--;)xp(r[u]);a&&"textarea"!=y||(u="value","progress"==y&&null==f?t.removeAttribute("value"):null!=f&&(f!==t[u]||"progress"==y&&!f||"option"==y&&f!=g[u])&&Np(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Np(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,l,u);return(c=ep.diffed)&&c(e),128&e.__u?void 0:a}function Bp(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Bp))}function zp(t,e,i){for(var n=0;i.length>n;n++)Hp(i[n],i[++n],i[++n]);ep.__c&&ep.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){ep.__e(t,e.__v)}})}function Up(t){return"object"!=typeof t||null==t||t.__b>0?t:kp(t)?t.map(Up):void 0!==t.constructor?null:Sp({},t)}function Hp(t,e,i){try{if("function"==typeof t){var n="function"==typeof t.__u;n&&t.__u(),n&&null==e||(t.__u=t(e))}else t.current=e}catch(t){ep.__e(t,i)}}function Wp(t,e,i){var n,s;if(ep.unmount&&ep.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Hp(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){ep.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&Wp(n[s],e,i||"function"!=typeof t.type);i||xp(t.__e),t.__c=t.__=t.__e=void 0}function Vp(t,e,i){return this.constructor(t,i)}function Gp(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),ep.__&&ep.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],jp(e,t=(!n&&i||e).__k=$p(Tp,null,[t]),s||bp,bp,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?tp.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),zp(r,t,o),t.props.children=null}tp=_p.slice,ep={__e(t,e,i,n){for(var s,r,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(t)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,n||{}),o=s.__d),o)return s.__E=s}catch(e){t=e}throw t}},ip=0,Ep.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Sp({},this.state);"function"==typeof t&&(t=t(Sp({},i),this.props)),t&&Sp(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),Pp(this))},Ep.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Pp(this))},Ep.prototype.render=Tp,np=[],rp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,op=function(t,e){return t.__v.__b-e.__v.__b},Ap.__r=0,ap=Math.random().toString(8),lp="__d"+ap,up="__a"+ap,cp=/(PointerCapture)$|Capture$/i,hp=0,dp=qp(!1),vp=qp(!0),fp=0;var Qp=0,Zp=[],Jp=ep,Kp=Jp.__b,Yp=Jp.__r,Xp=Jp.diffed,tg=Jp.__c,eg=Jp.unmount,ig=Jp.__;function ng(t,e){Jp.__h&&Jp.__h(gp,t,Qp||e),Qp=0;var i=gp.__H||(gp.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function sg(t){return Qp=1,function(t,e){var i=ng(pp++,2);if(i.t=t,!i.__c&&(i.__=[pg(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=gp,!gp.__f)){var n=function(t,e,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==t;if(i.__c.__H.__.some(function(t){if(t.__N){r=!0;var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),s){var a=s.call(this,t,e,n);return r?a||o:a}return!r||o};gp.__f=!0;var s=gp.shouldComponentUpdate,r=gp.componentWillUpdate;gp.componentWillUpdate=function(t,e,i){if(this.__e){var o=s;s=void 0,n(t,e,i),s=o}r&&r.call(this,t,e,i)},gp.shouldComponentUpdate=n}return i.__N||i.__}(pg,t)}function rg(t,e){var i=ng(pp++,3);!Jp.__s&&fg(i.__H,e)&&(i.__=t,i.u=e,gp.__H.__h.push(i))}function og(t){return Qp=5,ag(function(){return{current:t}},[])}function ag(t,e){var i=ng(pp++,7);return fg(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function lg(t){var e=gp.context[t.__c],i=ng(pp++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(gp)),e.props.value):t.__}function ug(){for(var t;t=Zp.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(dg),e.__h.some(vg),e.__h=[]}catch(i){e.__h=[],Jp.__e(i,t.__v)}}}Jp.__b=function(t){gp=null,Kp&&Kp(t)},Jp.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ig&&ig(t,e)},Jp.__r=function(t){Yp&&Yp(t),pp=0;var e=(gp=t.__c).__H;e&&(mp===gp?(e.__h=[],gp.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&ug(),pp=0)),mp=gp},Jp.diffed=function(t){Xp&&Xp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Zp.push(e)&&yp===Jp.requestAnimationFrame||((yp=Jp.requestAnimationFrame)||hg)(ug)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),mp=gp=null},Jp.__c=function(t,e){e.some(function(t){try{t.__h.some(dg),t.__h=t.__h.filter(function(t){return!t.__||vg(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Jp.__e(i,t.__v)}}),tg&&tg(t,e)},Jp.unmount=function(t){eg&&eg(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{dg(t)}catch(t){e=t}}),i.__H=void 0,e&&Jp.__e(e,i.__v))};var cg="function"==typeof requestAnimationFrame;function hg(t){var e,i=function(){clearTimeout(n),cg&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);cg&&(e=requestAnimationFrame(i))}function dg(t){var e=gp,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),gp=e}function vg(t){var e=gp;t.__c=t.__(),gp=e}function fg(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function pg(t,e){return"function"==typeof e?e(t):e}const gg={GZipJS:"gzip-js",Base64:"base64"},mg={Activation:"events",Cancellation:"cancelEvents"},yg={Button:"button",Tab:"tab",Selector:"selector"},bg={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},_g={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},wg={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},kg={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Sg={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},xg={Once:"once",Recurring:"recurring",Always:"always"},$g={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Cg={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Tg={Popover:"popover",Inline:"inline"};function Eg(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&xe(i.then)&&i.then(void 0,()=>{})}}}}const Ig=Or("[Surveys]"),Mg="PostHog is not capturing, so a survey response cannot be recorded";function Rg(t){return xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function Pg(t){return!(!t.start_date||t.end_date)}function Ag(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}const Og=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Fg=t=>Og("seenSurvey_",t),Dg=t=>{try{const e=Fg(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Ig.error("Failed to persist survey seen state",t)}},Lg=[wg.Popover,wg.Widget,wg.API],Ng={ignoreConditions:!1,ignoreDelay:!1,displayType:Tg.Popover},qg="autocapture",jg="featureFlags",Bg="logs",zg="surveys",Ug=Or("[Stylesheet Loader]"),Hg=t,Wg=n,Vg="#020617",Gg={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:bg.Right,widgetType:yg.Tab,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:Vg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Qg=[bg.Center,bg.Left,bg.Right];function Zg(t){if(t.startsWith("#")){let e=t.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(e)&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),/^[0-9A-Fa-f]{6}$/.test(e)?`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function Jg(t=Gg.backgroundColor){let e;"#"===t[0]&&(e=Zg(t)),t.startsWith("rgb")&&(e=t);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"}[t.toLowerCase()];if(i&&(e=Zg(i)),!e)return Vg;const n=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const t=parseInt(n[1]),e=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(t*t*.299+e*e*.587+i*i*.114)>127.5?Vg:"white"}return Vg}const Kg=(t,e,i)=>{const n=pm(t),s=Wg.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Wg.createElement("div");((t,e,i)=>{const n=ue(ue({},Gg),i),s=t.style,r=!Qg.includes(n.position)||e===wg.Widget&&(null==i?void 0:i.widgetType)===yg.Tab;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||Jg(n.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",n.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",n.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",Jg(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Jg(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Jg(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||n.inputBackground;o||"white"!==n.backgroundColor||(a="#f8f8f8"),s.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||Jg(a);s.setProperty("--ph-survey-input-text-color",l),s.setProperty("--ph-survey-rating-text-color",l),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),a=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return xe(t)?t:null==t||null===(e=t.config)||void 0===e?void 0:e.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(Ug.error("prepare_external_dependency_stylesheet returned null"),null)})(Wg,':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)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(a){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(a)}return(i||Wg.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Yg=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;n?Rg(n)&&(Dg(e),s&&fm(e),n.capture($g.SENT,ue(ue(ue({[Cg.SURVEY_NAME]:e.name,[Cg.SURVEY_ID]:e.id,[Cg.SURVEY_ITERATION]:e.current_iteration,[Cg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:null===(l=n.get_session_replay_url)||void 0===l?void 0:l.call(n)},Jl({event:"sent",survey:e,responses:t,submissionId:i,completed:s,surveyLanguage:o,questionSnapshots:a})),r),{},{$set:{[Yl(e,"responded")]:!0}})),s&&(Hg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),n.reloadFeatureFlags())):Ig.error("[survey sent] event not captured, PostHog instance not found.")},Xg=(t,e,i,n)=>{var s;return ue({[Cg.SURVEY_NAME]:e.name,[Cg.SURVEY_ID]:e.id,[Cg.SURVEY_ITERATION]:e.current_iteration,[Cg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:null===(s=n.get_session_replay_url)||void 0===s?void 0:s.call(n)},Jl({event:t,survey:e,responses:null==i?void 0:i.responses,submissionId:null==i?void 0:i.surveySubmissionId,surveyLanguage:null==i?void 0:i.surveyLanguage,questionSnapshots:null==i?void 0:i.questionSnapshots}))},tm=(t,e,i,n)=>{if(!e)return void Ig.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=dm(t),r=s?s.surveyLanguage:n,o=ue(ue(ue({},Xg("dismissed",t,s,e)),r&&{[Cg.SURVEY_LANGUAGE]:r}),{},{$set:{[Yl(t,"dismissed")]:!0}});fm(t),Dg(t),e.capture($g.DISMISSED,o),Hg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},em=(t,e)=>{if(!e)return void Ig.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>Og("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=dm(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture($g.ABANDONED,Xg("abandoned",t,n,e),{transport:"sendBeacon"})}},im=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},nm=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?(n=t.questions,s=cu(t.questions),n.length===s.length&&n.every((t,e)=>t===s[e])?s.reverse():s):t.questions;var i,n,s},sm=t=>ru(t)||vm(t),rm=function(t){function e(t){var i,n;return this.getChildContext||(i=new Set,(n={})[e.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&i.forEach(function(t){t.__e=!0,Pp(t)})},this.sub=function(t){i.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i&&i.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+fp++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),om=()=>lg(rm),am=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,a=Sp({},t.props);for(r in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)"key"==r?n=e[r]:"ref"==r?s=e[r]:a[r]=void 0===e[r]&&null!=o?o[r]:e[r];return arguments.length>2&&(a.children=arguments.length>3?tp.call(arguments,2):i),Cp(t.type,a,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function lm(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=no(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return lu[o](r,[s])}const um=t=>Og("inProgressSurvey_",t),cm={},hm=(t,e)=>{const i=um(t);try{localStorage.setItem(i,JSON.stringify(e)),delete cm[i]}catch(t){Ig.error("Error setting in-progress survey state in localStorage",t),cm[i]=e}},dm=t=>{const e=um(t),i=cm[e];if(i)return i;try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(t){Ig.error("Error getting in-progress survey state from localStorage",t)}return null},vm=t=>{const e=dm(t);return!Re(null==e?void 0:e.surveySubmissionId)},fm=t=>{const e=um(t);delete cm[e];try{localStorage.removeItem(e)}catch(t){Ig.error("Error clearing in-progress survey state from localStorage",t)}};function pm(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function gm(t,e=bg.Right,i){if(t===wg.ExternalSurvey)return{};switch(e){case bg.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case bg.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case bg.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case bg.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case bg.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case bg.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case bg.Left:return{left:"30px"};case bg.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===wg.Widget&&i===yg.Tab?"60px":"30px"}}}var mm=0;function ym(t,e,i,n,s,r){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)"ref"==a?o=e[a]:l[a]=e[a];var u={type:t,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--mm,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof t&&(o=t.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return ep.vnode&&ep.vnode(u),u}const bm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),_m=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),wm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),km=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),Sm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),xm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ym("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"})}),$m=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ym("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"})}),Cm=({fill:t="currentColor"}={})=>ym("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[ym("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ym("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:t})]}),Tm=ym("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ym("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[ym("path",{fill:"currentColor",d:"m50 23.34-.35-.05A4.5 4.5 0 0 1 47 21.97L35.56 10.1c-.3-.33-.86-.1-.86.35V27.5c0 .27.22.5.5.5h13.78c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.67-1.89zm-10.81.2a1.8 1.8 0 1 1 0-3.58 1.8 1.8 0 0 1 0 3.58"}),ym("path",{fill:"#0054ff",d:"M.87 19.13a.5.5 0 0 0-.87.34v5.94a2.6 2.6 0 0 0 2.59 2.58H7.8a.5.5 0 0 0 .37-.84zM.86 8.4c-.3-.32-.86-.1-.86.36v6.73q0 .2.13.34l8.81 9.68 1.8 2.06v-8.82zM4.59.82A2.67 2.67 0 0 0 0 2.68v1.93q0 .4.27.69l10.47 10.95v-9.1z"}),ym("path",{fill:"#ff5506",d:"M11.36 28h7.08a.5.5 0 0 0 .36-.85l-8.05-8.4v8.8l.23.28q.16.17.38.17m-.61-11.76 8.84 9.25 2.1 2.33q.1.11.27.14V18.7L10.75 7.15zm0-13.7v1.41a2 2 0 0 0 .55 1.28L21.96 16.2V7.65L15.32.8a2.67 2.67 0 0 0-4.57 1.71z"}),ym("path",{fill:"#ffb70f",d:"M22.06 28h7.76a.5.5 0 0 0 .36-.86l-8.22-8.45v9.27l.09.02zM31 25.49l1.13 1.14c.32.31.85.09.85-.35v-7.3l-.49-.51L21.96 7.64v8.55zM22.52 5.73l9.62 9.89c.3.32.86.1.86-.35V7.46L26.56.82a2.67 2.67 0 0 0-4.59 1.84v1.7c0 .51.2 1 .57 1.37z"})]}),ym("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),ym("defs",{children:ym("clipPath",{id:"ph-survey-logo-clip",children:ym("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function Em({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return ym("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Tm]})}function Im({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:u}){const{isPreviewMode:c}=lg(rm),h=!!l&&!!u,d=!a&&ym("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),c?null==o||o():s()},children:e});return ym("div",{className:"bottom-section",children:[h?ym("div",{className:"form-buttons form-buttons-with-back",children:[ym("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&ym(Em,{urlParams:{utm_source:"survey-footer"}})]})}function Mm({question:t,forceDisableHtml:e,htmlFor:i}){return ym("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[ym(t.type===kg.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&am({component:$p("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Rm({onClick:t}){const{isPreviewMode:e}=lg(rm);return ym("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:Cm({fill:"black"})})}const Pm=t;function Am({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=lg(rm);return rg(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return Hr(Pm,"keydown",t),()=>{Pm.removeEventListener("keydown",t)}},[r]),ym("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ym(Rm,{onClick:()=>r()}),ym("h3",{className:"thank-you-message-header",children:t}),e&&am({component:$p("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&ym(Im,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function Om({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=lg(rm);return ym("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ym(Rm,{onClick:()=>l()}),t&&ym("h3",{className:"intro-screen-header",children:t}),e&&am({component:$p("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),ym(Im,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const Fm=t=>Se(t)&&t.every(t=>Ee(t));function Dm({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:u}=om(),c=og(null),[h,d]=sg(()=>Ee(o)?o:""),v=null==i?void 0:i.disableAutofocus;rg(()=>{v||setTimeout(()=>{var t;u||null===(t=c.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=ag(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case de:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case ve:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(h,t.validation,t.optional),[h,t.validation,t.optional]),g=Ir(t.validation,de),m=Ir(t.validation,ve),y=ag(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),b=()=>{p||n(h.trim())},_=()=>{p||s(h.trim())};return ym(Tp,{children:[ym("div",{className:"question-container",children:[ym(Mm,{question:t,forceDisableHtml:e,htmlFor:f}),ym("textarea",{ref:c,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:h}),y&&ym("div",{className:"validation-hint",children:y})]}),ym(Im,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:a,onBack:l})]})}function Lm({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return ym(Tp,{children:[ym("div",{className:"question-container",children:ym(Mm,{question:t,forceDisableHtml:e})}),ym(Im,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Nm({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var u;const c=t.scale,h=10===t.scale?0:1,[d,v]=sg(()=>Pe(o)?o:Se(o)&&o.length>0&&Pe(parseInt(o[0]))?parseInt(o[0]):Ee(o)&&Pe(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=om(),g=t=>p?r(t):s(t);return ym(Tp,{children:[ym("div",{className:"question-container",children:[ym(Mm,{question:t,forceDisableHtml:e}),ym("div",{className:"rating-section",children:[ym("div",{className:"rating-options",children:["emoji"===t.display&&ym("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Hm[t.scale])||void 0===u?void 0:u.map((e,n)=>ym("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===d?"rating-active":""}`,value:n+1,type:"button",onClick(){const e=n+1;v(e),t.skipSubmitButton&&g(e)},children:e},n))}),"number"===t.display&&ym("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${c-h+1}, minmax(0, 1fr))`},children:Wm(t.scale).map((e,s)=>ym(qm,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&ym("div",{className:"rating-text",children:[ym("div",{children:t.lowerBoundLabel}),ym("div",{children:t.upperBoundLabel})]})]})]}),ym(Im,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Me(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:a,onBack:l})]})}function qm({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return ym("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function jm({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const u=og(null),c=ag(()=>(t=>{var e;if(!t.shuffleOptions)return t.choices;const i=[...t.choices],n=t.hasOpenChoice&&null!==(e=i.pop())&&void 0!==e?e:null,s=(r=i,(o=cu(i)).length>1&&r.every((t,e)=>t===o[e])?o.reverse():o);var r,o;return Me(n)||s.push(n),s})(t),[t]),[h,d]=sg(()=>((t,e)=>Ee(t)||Fm(t)?t:e===kg.SingleChoice?null:[])(o,t.type)),[v,f]=sg(()=>((t,e)=>{if(Ee(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Fm(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,c)),{isPreviewMode:p}=om(),g=t.type===kg.SingleChoice,m=t.type===kg.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>ue(ue({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&Se(h)&&(h.includes(t)?d(h.filter(e=>e!==t)):d([...h,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>ue(ue({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Me(h)&&(!Se(h)||v.isSelected||0!==h.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?Se(h)&&(p?r([...h,v.inputValue]):s([...h,v.inputValue])):p?r(h):s(h)};return ym(Tp,{children:[ym("div",{className:"question-container",children:[ym(Mm,{question:t,forceDisableHtml:e}),ym("fieldset",{className:"multiple-choice-options limit-height",children:[ym("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),c.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,a=s?v.isSelected:g?h===e:Se(h)&&h.includes(e);return ym("label",{className:s?"choice-option-open":"",children:[ym("div",{className:"response-choice",children:[ym("input",{type:g?"radio":"checkbox",name:r,checked:a,onChange:()=>b(e,s),id:r,"aria-controls":o}),ym("span",{children:s?`${e}:`:e})]}),s&&ym("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:_,onClick(t){v.isSelected||b(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),ym(Im,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:a,onBack:l})]})}const Bm=[1,2,3,4,5],zm=[1,2,3,4,5,6,7],Um=[0,1,2,3,4,5,6,7,8,9,10],Hm={2:[xm,$m],3:[wm,_m,bm],5:[km,wm,_m,bm,Sm]};function Wm(t){switch(t){case 5:default:return Bm;case 7:return zm;case 10:return Um}}const Vm=Or("[Surveys]");function Gm(t,e,i){var n;const s=t.questions[e],r=e+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return e===t.questions.length-1?Sg.End:r;if(s.branching.type===Sg.End)return Sg.End;if(s.branching.type===Sg.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===Sg.ResponseBased){if(s.type===kg.SingleChoice){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Sg.End?Sg.End:r}}else if(s.type===kg.Rating){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(a=s.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Sg.End?Sg.End:r}}return r}return Vm.warn("Falling back to next question index due to unexpected branching type"),r}const Qm=Or("[SurveyTranslations]");function Zm(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=Xl(t);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(t){return t&&"object"==typeof t&&"language"in t?Xl(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=Xl(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:xe(t.get_property)?t.get_property(w):void 0,locale:Tu()},Qm)}(e);if(!i)return Qm.info("No user language detected"),{survey:t,language:null};const n=nu(t,i,Qm);return{survey:n.survey,language:n.matchedKey}}const Jm=t,Km=n,Ym="ph:show_survey_widget",Xm="PHWidgetSurveyClickListener";function ty(t,e){try{const i=t.getBoundingClientRect(),n=Jm.innerHeight,s=Jm.innerWidth;let r=i.left+i.width/2-e/2;r+e>s-20&&(r=s-e-20),20>r&&(r=20);const o=n-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?n-i.top+12+"px":"auto",zIndex:Gg.zIndex}}catch(t){return Ig.warn("Failed to calculate trigger position:",t),null}}var ey=class{constructor(t){this.bi=new Map,this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Set,this.Ci=null,this.Ii=!1,this.Mi=null,this.Ti=null,this.Ri=null,this.Ei=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(ft);if(t)for(const e of t)vm(e)&&em(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,a,l;if(!Rg(this._posthog))return;const{survey:u,language:c}=this.Ai(t);this.Ci=c,this.Ri=null,this.$i=e;const h=this.Oi(u,e);this.Pi(h.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Li(h,v,d,c);if(f&&!(null===(n=h.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Di(h);let p={};if((null===(s=h.appearance)||void 0===s?void 0:s.position)===bg.NextToTrigger&&(null===(r=h.appearance)||void 0===r?void 0:r.widgetSelector)){const t=Km.querySelector(h.appearance.widgetSelector);var g;t&&(p=ty(t,parseInt((null===(g=h.appearance)||void 0===g?void 0:g.maxWidth)||Gg.maxWidth))||{})}const m=(null===(o=h.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Kg(h,this._posthog);this.Si.set(y,y.host);const b={posthog:this._posthog,survey:h,removeSurveyFromFocus:this.Fi,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:c};if(this.Ri=b,0>=m)return this.Ii=!0,Gp(ym(oy,ue({},b)),y);const _=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Ci=n;const s=this.Oi(i,e),r=ue(ue({},b),{},{survey:s,surveyLanguage:n});this.Ri=r,Gp(ym(oy,ue(ue({},r),{},{survey:ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Rg(this._posthog)||!this.Ni(h))return Ig.info(`Survey ${h.id} no longer eligible when its display delay elapsed; not displaying`),this.Fi(h);_()},k=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,h.id):void 0,S=Pe(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Jm.setTimeout(()=>{this.bi.delete(h.id),w()},x);this.bi.set(h.id,C)},this.qi=t=>{var e;const{survey:i,language:n}=this.Ai(t),{shadow:s,isNewlyCreated:r}=Kg(i,this._posthog);this.Si.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===yg.Tab&&this.ki.set(t.id,t),r&&Gp(ym(ly,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.ji=t=>{const e=this.wi.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(Xm),this.wi.delete(t),Ig.info(`Removed click listener for survey ${t}`))},this.Bi=t=>{this.zi(t)||(this.Hi(t),this.ji(t.id))},this.Ui=t=>{this.zi(t)||(this.Hi(t),this.ki.delete(t.id))},this.zi=t=>{try{var e;const i=Km.querySelector(pm(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Wi=(t,e)=>{const i=Km.querySelector(e),n=this.wi.get(t.id);if(i){if(this.qi(t),n){if(i===n.element)return;Ig.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.ji(t.id)}if(!i.hasAttribute(Xm)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===bg.NextToTrigger?ty(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Gg.maxWidth)):{};Jm.dispatchEvent(new CustomEvent(Ym,{detail:{surveyId:t.id,position:s}}))};Hr(i,"click",e),i.setAttribute(Xm,"true"),this.wi.set(t.id,{element:i,listener:e,survey:t}),Ig.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Bi(t)},this.renderPopover=t=>{if(!Rg(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Kg(e,this._posthog);this.Si.set(n,n.host),Gp(ym(oy,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Fi,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Rg(this._posthog))return;const{survey:s,language:r}=this.Ai(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Vi(s,r,i)),Gp(ym(oy,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Fi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.Ni(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Rg(this._posthog),i=t.filter(t=>e&&(t.type===wg.Popover||t.type===wg.Widget)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.bi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===wg.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===yg.Tab)return o.add(t.id),void this.qi(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===yg.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Wi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Me(this.Qi)&&t.type===wg.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.wi.forEach(({survey:t})=>{r.has(t.id)||this.Bi(t)}),this.ki.forEach((t,e)=>{o.has(e)||this.Ui(t)})},t)},this.Di=t=>{Me(this.Qi)||Ig.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Fi=t=>{this.Qi!==t.id&&Ig.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Ci=null,this.Ii=!1,this.Ri=null,this.$i=void 0,this.Hi(t)},this._posthog=t,this.Qi=null,this.Mi=()=>this.Zi(),Hr(Jm,"languagechange",this.Mi),this.Ti=t.onFeatureFlags(()=>this.Zi())}Zi(){if(Me(this.Qi))return;const t=this._posthog.get_property(ft),e=null==t?void 0:t.find(t=>t.id===this.Qi);if(!e)return;const{survey:i,language:n}=this.Ai(e);if(n===this.Ci)return;if(this.Ci=n,!this.Ii)return;const s=this.Oi(i,this.$i),{shadow:r}=Kg(s,this._posthog);Gp(ym(oy,ue(ue({},this.Ri),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Fi,surveyLanguage:n})),r)}get Ji(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Oi(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?ue(ue({},t),{},{appearance:ue(ue(ue({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Pi(t){const e=this.bi.get(t);e&&(clearTimeout(e),this.bi.delete(t))}cancelSurvey(t){this.bi.has(t)&&(Ig.info(`Cancelled pending survey ${t}`),this.Pi(t),this.Qi===t&&(this.Qi=null,this.Ci=null,this.Ii=!1,this.Ri=null,this.$i=void 0))}clearInMemoryInProgressSurveyState(){(()=>{for(const t of Object.keys(cm))delete cm[t]})()}setAutomaticDisplayDispose(t){this.Ki=t}dispose(){var t;null===(t=this.Ki)||void 0===t||t.call(this),this.Ki=void 0,this.Mi&&(Jm.removeEventListener("languagechange",this.Mi),this.Mi=null),this.Ti&&(this.Ti(),this.Ti=null),this.bi.forEach((t,e)=>this.Pi(e)),this.wi.forEach((t,e)=>this.ji(e)),this.Si.forEach((t,e)=>{Gp(null,e),null==t||t.remove()}),this.Si.clear(),this.ki.clear(),this.Qi=null}Gi(t){return t.sort((t,e)=>{var i,n;const s=vm(t),r=vm(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===xg.Always,a=e.schedule===xg.Always;return o&&!a?1:!o&&a?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return Zm(t,this._posthog)}Vi(t,e,i){if(this.xi.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=Jm.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const n=i.indexOf("=");if(0>=n)continue;let s,r;try{s=decodeURIComponent(i.slice(0,n)),r=decodeURIComponent(i.slice(n+1))}catch(t){continue}if("auto_submit"===s&&"true"===r){e=!0;continue}const o=s.match(/^q(\d+)$/);if(o){const e=parseInt(o[1],10);t[e]||(t[e]=[]),t[e].push(r)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;Ig.info("[Survey Prefill] Detected URL prefill parameters");const s=this.Xi(t,n,e);return!!s&&(this.Yi(t,s,i,e),this.xi.add(t.id),s.isSurveyCompleted)}Yi(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=e;(Object.keys(a).length>0&&t.enable_partial_responses||o)&&Yg({responses:o?s:a,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Li(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=Se(i)?i.map(String):[String(i)];Ig.info("[Survey] Processing initial responses");const r=this.Xi(t,s,n);return!!r&&(this.Yi(t,r,i,n),r.isSurveyCompleted)}Xi(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=Ql(t.id);try{switch(t.type){case kg.SingleChoice:{if(!t.choices||0===t.choices.length)return void Ar.warn(`[Survey Prefill] Question ${n} has no choices`);const e=parseInt(s[0],10);if(isNaN(e)||0>e||e>=t.choices.length)return void Ar.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case kg.MultipleChoice:{if(!t.choices||0===t.choices.length)return void Ar.warn(`[Survey Prefill] Question ${n} has no choices`);const e=s.map(t=>parseInt(t,10)).filter(e=>!isNaN(e)&&e>=0&&t.choices.length>e);if(0===e.length)return void Ar.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Ar.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case kg.Rating:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Ar.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Ar.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Ar.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Ig.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Sl(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let a=0;for(;t.questions.length>n&&o>a&&(a++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=Ql(e.id);Te(i[t])||(s[t]=i[t])}r.push(n);const o=Gm(t,n,e.id?i[Ql(e.id)]:null);if(o===Sg.End)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),l=r>=t.questions.length;return hm(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:im(t.questions),visitedIndices:a,surveyLanguage:i}),Ig.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(t){return Ig.error("[Survey Prefill] Error handling prefill:",t),null}}tr(t,e=void 0){if(!t)return!0;const i=this.Ji,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.er(t),r}er(t){var e;!this.Ei&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ei=!0,Ig.warn(`Survey feature flag "${t}" 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.`))}nr(e){return!e.conditions||lm(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const a=Ki(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return lu[null!=n?n:"icontains"](e,[a])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==Wg?void 0:Wg.querySelector(t.conditions.selector))}(e)}ir(t){var e;return sm(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Ji)||void 0===e?void 0:e.hasLoadedFlags)?(this.er(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.tr(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Pg(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Lg.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.tr(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.tr(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.ir(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Ml.Ot("lastSeenSurveyDate"))?(t=>!!Ml.Ot(Fg(t))&&!sm(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.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",n)}checkSurveyCaptureEligibility(){return Rg(this._posthog)?{eligible:!0}:{eligible:!1,reason:Mg}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.rr(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}rr(t){var e;if(!su(t)&&!Ag(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}sr(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.tr(e))}Ni(t){return this.checkSurveyEligibility(t).eligible&&this.nr(t)&&this.rr(t)&&this.sr(t)}Hi(t){try{const e=Km.querySelector(pm(t,!0));(null==e?void 0:e.shadowRoot)&&(Gp(null,e.shadowRoot),this.Si.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Ig.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Di,removeSurveyFromFocus:this.Fi,surveyInFocus:this.Qi,surveyTimeouts:this.bi,handleWidget:this.qi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Wi,sortSurveysByAppearanceDelay:this.Gi,checkFlags:this.sr.bind(this),isSurveyFeatureFlagEnabled:this.tr.bind(this),onLanguageChange:this.Zi.bind(this),currentLanguage:this.Ci,surveyIsRendered:this.Ii}}};function iy(t,e){if(!Km||!Jm)return;const i=new ey(t);if(t.config.disable_surveys_automatic_display)return Ig.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Ig.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Te(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Te(n)||(clearInterval(n),n=void 0)};s();const o=()=>{Km.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return Hr(Km,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Km.removeEventListener("visibilitychange",o)}),i}function ny({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){rg(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===wg.Widget,o=lm(t,s),a=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===yg.Tab&&r;if(!o)return Ig.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);a&&(Ig.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};Hr(Jm,"popstate",o),Hr(Jm,"hashchange",o);const a=Jm.history.pushState,l=Jm.history.replaceState;return Jm.history.pushState=function(...t){a.apply(this,t),o()},Jm.history.replaceState=function(...t){l.apply(this,t),o()},()=>{Jm.removeEventListener("popstate",o),Jm.removeEventListener("hashchange",o),Jm.history.pushState=a,Jm.history.replaceState=l}},[n,t,e,i,s])}const sy=200;function ry(t=_g.Right){switch(t){case _g.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case _g.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case _g.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function oy({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:c=()=>{},properties:h,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,C,T;const E=og(null),I=Number.isInteger(s),{isPopupVisible:M,isSurveySent:R,hidePopupWithAnimation:P}=function(t,e,i,n,s,r,o,a,l){const[u,c]=sg(n||0===i||t.type===wg.ExternalSurvey),[h,d]=sg(!1),v=og(!1),f=()=>{const e=()=>{r&&s(t),c(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${sy}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return rg(()=>{if(!e)return void Ig.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(lm(t,e)){c(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}var i;Jm.dispatchEvent(new Event("PHSurveyShown")),a||e.capture($g.SHOWN,ue(ue({[Cg.SURVEY_NAME]:t.name,[Cg.SURVEY_ID]:t.id,[Cg.SURVEY_ITERATION]:t.current_iteration,[Cg.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},l&&{[Cg.SURVEY_LANGUAGE]:l}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}))}};Hr(Jm,"PHSurveyClosed",p),Hr(Jm,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Te(u)&&o(),()=>{Te(u)||clearTimeout(u),Te(s)||clearTimeout(s),Jm.removeEventListener("PHSurveyClosed",p),Jm.removeEventListener("PHSurveySent",r)}},[]),ny({survey:t,removeSurveyFromFocus:s,setSurveyVisible:c,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:h,setIsPopupVisible:c,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,I,r,o,E,v,f),A=R||s===t.questions.length||!0===d,[O,F]=sg(!1),D=ag(()=>!!dm(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=I?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!O&&!D,q=ag(()=>{const e=dm(t),n=(null==e?void 0:e.surveySubmissionId)||Sl();return{isPreviewMode:I,previewPageIndex:s,onPopupSurveyDismissed(){f?tm(t,i,I,f):tm(t,i,I),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:h,surveyLanguage:f}},[I,s,o,i,t,u,a,l,h,f]);return M?ym(rm.Provider,{value:q,children:ym("div",{className:"ph-survey",style:ue(ue({},gm(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:E,children:A?ym(Am,{header:(null===(w=t.appearance)||void 0===w?void 0:w.thankYouMessageHeader)||"Thank you!",description:(null===(k=t.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!e,contentType:null===(S=t.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:t.appearance||Gg,onClose(){P(),c()}}):N?ym(Om,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||Gg,onStart:()=>F(!0)}):ym(ay,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function ay({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=ag(()=>{const e=dm(t);if(!e)return null;const i=Pe(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(fm(t),null)},[t]),[o,a]=sg(()=>((null==r?void 0:r.responses)&&Ig.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,u]=sg(!1),{previewPageIndex:c,onPopupSurveyDismissed:h,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=lg(rm),[b,_]=sg(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Pe(e)&&e>=0&&t.questions.length>e?e:0;return Pe(c)&&c>=0?c:i}),[w,k]=sg(()=>{var e;return(null!==(e=null==r?void 0:r.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&t.questions.length>e)}),[S,x]=sg(()=>{var e;const i=dm(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=ag(()=>im(nm(t,r)),[t.id,r]),T=ag(()=>{if(!C||new Set(C).size!==C.length)return nm(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);rg(()=>{!g||Te(c)||0>c||_(c)},[c,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=c?c:0)>0:w.length>0),I=T.at(b);return I?ym("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&ym(Rm,{onClick(){h()}}),ym("div",{className:"survey-box","data-question-index":b,children:[l&&ym("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),uy({question:I,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||Gg,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Ig.error("onNextButtonClick called without a PostHog instance.");if(!Rg(i))return void u(!0);if(u(!1),!s)return void Ig.error("onNextButtonClick called without a questionId.");const{responses:r,questionSnapshots:l}=function({responses:t,questionSnapshots:e={}},i,n,s){return{responses:ue(ue({},t),{},{[Ql(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?ue(ue({},e),{},{[s.id]:s.question}):e}}({responses:o,questionSnapshots:S},s,e,T[n]);a(r),x(l);const c=Gm(t,n,e),h=c===Sg.End,d=[...w,n];if(h||(k(d),_(c),hm(t,{surveySubmissionId:p,responses:r,lastQuestionIndex:c,questionOrder:im(T),visitedIndices:d,surveyLanguage:y,questionSnapshots:l})),t.enable_partial_responses||h){const e=new Set(d.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>Ql(t))),n=Object.fromEntries(Object.entries(r).filter(([t])=>e.has(t)));Yg({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:h,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:l})}})({res:e,displayQuestionIndex:b,questionId:I.id}),onPreviewSubmit:v,initialValue:I.id?o[Ql(I.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),_(e),hm(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:im(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function ly({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,a,l,u,c,h;const[d,v]=sg(!0),[f,p]=sg(!1),[g,m]=sg({}),y=og(void 0),b=()=>{(f||!i||n||Rg(i))&&p(!f)};if(rg(()=>{var e;if(!i)return void Ig.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Ig.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),b())};return Hr(Jm,Ym,s),()=>{Te(y.current)||(clearTimeout(y.current),y.current=void 0),Jm.removeEventListener(Ym,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=t.appearance)||void 0===a?void 0:a.borderColor]),ny({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const _=()=>{t.schedule!==xg.Always&&v(!1),Te(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return ym(Tp,{children:["tab"===(null===(l=t.appearance)||void 0===l?void 0:l.widgetType)&&ym("button",{className:"ph-survey-widget-tab "+((null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)===_g.Top?"widget-tab-top":""),onClick:b,disabled:n,style:ry(null===(c=t.appearance)||void 0===c?void 0:c.tabPosition),children:(null===(h=t.appearance)||void 0===h?void 0:h.widgetLabel)||""}),f&&ym(oy,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:_,onCloseConfirmationMessage:_,surveyLanguage:s})]})}const uy=({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const u={forceDisableHtml:e,appearance:n,onPreviewSubmit(t){r(t)},onSubmit(t){s(t)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(t.type){case kg.Open:return $p(Dm,ue(ue({},u),{},{question:t,key:t.id}));case kg.Link:return $p(Lm,ue(ue({},u),{},{question:t,key:t.id}));case kg.Rating:return $p(Nm,ue(ue({},u),{},{question:t,key:t.id}));case kg.SingleChoice:case kg.MultipleChoice:return $p(jm,ue(ue({},u),{},{question:t,key:t.id}));default:return Ig.error(`Unsupported question type: ${t.type}`),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=iy,h.extendPostHogWithSurveys=iy;const cy=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},hy=1e4,dy=(t,e,i)=>i.remaining>0?e.length>i.remaining?(t.push(e.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(t.push(e),i.remaining-=e.length,!0):(i.truncated=!0,!1),vy=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return dy(e,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(t.length,i.remaining-2);for(;r>s;){const e=Math.ceil((s+r)/2);JSON.stringify(t.slice(0,e)).length>i.remaining?r=e-1:s=e}return dy(e,JSON.stringify(t.slice(0,s)),i)},fy=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,py=(t,e,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(e).length+t.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[t]=e}},gy=(t,e,i)=>{if(!i.truncated)if($e(t)){if(i.seen.has(t))return void py(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(gy(t[n],e?`${e}.${n}`:n,i),i.truncated)break}catch(t){continue}}catch(t){}}else py(e,t,i)},my=(t,e,i,n,s=!1,r)=>{if(!fy(t))return!s||dy(e,"null",i);if(Me(t)||(t=>{try{return Pe(t)||Oe(t)}catch(t){return!1}})(t))return dy(e,JSON.stringify(t),i);if("string"==typeof t)return vy(t,e,i);if(!$e(t)&&!Se(t))return dy(e,JSON.stringify(t),i);if(n.has(t))return vy("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(xe(r))return my(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return vy(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return dy(e,JSON.stringify(t.valueOf()),i)}catch(t){}if(t instanceof Error){const o={};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(o[e]=t[e])}catch(t){}try{o.name=t.name}catch(t){}try{o.message=t.message}catch(t){}try{o.stack=t.stack}catch(t){}return my(o,e,i,n,s,r)}if(Se(t)){if(!dy(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!dy(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!my(r,e,i,n,!0))return!1}return dy(e,"]",i)}if(!dy(e,"{",i))return!1;let o=!0;try{for(const s in t){if(!{}.hasOwnProperty.call(t,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=t[s]}catch(t){continue}if(r)try{gy(a,s,r)}catch(t){}if(!fy(a))continue;const l=`${o?"":","}${JSON.stringify(s)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,c=i.remaining,h=i.truncated;if(!dy(e,l,i))return!1;const d=e.length,v=my(a,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=c,i.truncated=v?h:f,!v)return!1}}catch(t){}return dy(e,"}",i)},yy=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=$e(t[0])?{result:{},keysRemaining:50,sizeRemaining:hy,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||dy(i," ",n))&&my(t[e],i,n,new WeakSet,!1,0===e?s:void 0);e++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},by={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},_y=t=>"canCapture"in t,wy=t=>({console:h.console,hostname:h.location.host,getCapturingLogs(){let e;return e=_y(t)?t.canCapture?t.getExtension(Bg):void 0:(xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing())?t.logs:void 0,e?{captureConsoleLog:i=>((t,e,i)=>{if(_y(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;n?xe(s)&&s.call(e,i):xe(e.captureConsoleLog)&&e.captureConsoleLog(i)})(t,e,i),captureBufferedConsoleLog(t,i,n){var s;return null===(s=e.captureBufferedConsoleLog)||void 0===s?void 0:s.call(e,t,i,n)}}:void 0}});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs:t=>(t=>{const e=t.console;let i=t;const n=[],s={host:t.hostname};let r=!1;const o=()=>{i=void 0;for(const t of n)try{t()}catch(t){}};try{for(const t of Object.keys(by)){const o=n=>(...o)=>{let a=!1;try{if(o.length>0&&!r&&i){const e=i.getCapturingLogs();if(e){r=!0,a=!0;const{body:i,truncated:n,attributes:l}=yy(o,hy),u=ue(ue({},s),n?{body_truncated:"true"}:{}),c={level:by[t],body:i,attributes:ue(ue({"log.source":`console.${t}`},u),l)};e.captureConsoleLog(c)}}}catch(t){}finally{a&&(r=!1),n.apply(e,o)}},a=e[t];n.push(Sf(e,t,t=>{const e=o(t);return e.__rrweb_original__=cy(a),e}))}}catch(t){throw o(),t}return o})(wy(t)),replayConsoleBuffer:(t,e)=>((t,e)=>{const i=t.getCapturingLogs();if(i)for(const s of e)try{var n;const{body:e,truncated:r,attributes:o}=yy(s.args,hy);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:by[s.level],body:e,attributes:ue(ue({"log.source":`console.${s.level}`,host:t.hostname},r?{body_truncated:"true"}:{}),o)},s.context,s.occurredAtMs)}catch(t){}})(wy(t),e)};const ky=t=>je(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Sy=Or("[Error tracking]"),xy="webkit-masked-url:",$y=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Cy=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",xy],Ty=["__firefox__","__gCrWeb"];function Ey(){return new wn([new zn,new Yn,new Hn,new Un,new Jn,new Zn,new Vn,new Kn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),a=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=On.test(n)?n.replace(On,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=Dn(s);if(t){for(let e=a.length-1;e>=0;e--){const i=a[e];if(t.start>=i.start+i.length)break;a.pop()}a.push(t)}break}}if(jn(s,a)>=50)break}}const l=[...a].sort((t,e)=>e.start-t.start),u=l[l.length-1];if(u){const t=Nn(s,u);s.splice(u.start-t,t);for(const e of l)e.start-=t}for(const t of l)Ln(s,t);return a.some(t=>0===t.start&&s.length===t.length)&&function(t){const e=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let i=0;for(let t=1;e.length>t;t++)Bn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return ue(ue({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",Mn,An))}const Iy=Or("[ExceptionAutocapture]"),My=Ey(),Ry=(t,e)=>{try{return t()}catch(t){return e}},Py=(t,e)=>Ry(()=>t(e()),void 0),Ay=t=>Ry(()=>xe(t)&&xe(t.call),!1),Oy=(t,e)=>Ry(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),Fy=(t,e,i)=>{Ry(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Ry(()=>{t[e]=i},void 0)},Dy=e=>{const i=t;i||Iy.info("window not available, cannot wrap onerror");const n=Ry(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Py(e,()=>My.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if(Ee(t)&&Ee(e)&&e.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:e,lineno:i,colno:n})}catch(e){return t}return t})(t),{mechanism:{handled:!1}})),!!Ay(n)&&null!==(i=n(...t))&&void 0!==i&&i},Oy(i,"onerror"),()=>Fy(i,"onerror",n)},Ly=(e,i=!1)=>{const n=t;n||Iy.info("window not available, cannot wrap onUnhandledRejection");const s=Ry(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Py(e,()=>My.buildFromUnknown(t,{mechanism:{handled:!1}})),Ay(s)?null!==(n=s(t))&&void 0!==n&&n:i},Oy(n,"onunhandledrejection"),()=>Fy(n,"onunhandledrejection",s)},Ny={wrapOnError:Dy,wrapUnhandledRejection:Ly,wrapConsoleError(t){const e=console;e||Iy.info("console not available, cannot wrap console.error");const i=Ry(()=>e.error,void 0);return e.error=function(...e){Ry(()=>e.length>1&&Ee(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Py(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return My.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Ay(i)&&i(...e)},Oy(e,"error"),()=>Fy(e,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=Ny,h.posthogErrorWrappingFunctions=Ny;const qy=(t,e)=>{if(!xe(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Me(i)&&"object"==typeof i&&Se(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Iy.error("Ignoring invalid legacy exception exclusion rule",e,t)}return t},[]):[],s=e=>{try{var i;null===(i=t.capture)||void 0===i||i.call(t,"$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(t){Iy.error("Failed to capture exception for a legacy client",t)}};Dy(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Ly(s,!0)};h.extendPostHogWithExceptionAutoCapture=qy,h.extendPostHogWithExceptionAutocapture=qy;const jy="X-POSTHOG-SESSION-ID",By="X-POSTHOG-WINDOW-ID",zy="X-POSTHOG-DISTINCT-ID",Uy=[jy,By,zy],Hy=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Wy=(t,e)=>({}.hasOwnProperty.call(t,e)),Vy=t=>"object"==typeof t&&!Me(t)||xe(t),Gy=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),Qy=e=>{try{var i;return Gy(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==t||null===(i=t.location)||void 0===i?void 0:i.href).toString()}catch(t){return}},Zy=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(Se(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(jy,t),s.set(By,e),o=!0}const a=(t=>xe(t)?t():t)(e);return a&&"$posthog_cookieless"!==a&&(s.set(zy,a),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const Jy={_patchFetch:(e,i,n)=>Sf(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let a=o;try{const t=Qy(s);if(t)if(Gy(s)){const t=new Request(s,r);Zy(e,i,n,t.url,t.headers),a=[t]}else{const o=new Headers(Vy(r)?r.headers:void 0);if(Zy(e,i,n,t,o)){const t=((t,e)=>{if(Te(t)||Me(t))return{headers:e};if(!Vy(t))return;const i=t;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const t=Object.create(i);return Object.defineProperty(t,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),t}return new Proxy({headers:e},{get:(t,e)=>Wy(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Wy(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),Hy.forEach(t=>{t in i&&e.add(t)}),Array.from(e)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;if("string"==typeof e&&Hy.includes(e)&&e in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,e,i)}};const s=Reflect.getOwnPropertyDescriptor(i,e);return s?ue(ue({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(a=[s,t])}}}catch(t){a=o}return t.apply(this,a)}),_patchXHR:(e,i,n)=>Sf(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,a,l){const u=this,c=new Headers,h=Qy(r);h&&Zy(e,i,n,h,c);const d=t.call(u,s,r,o,a,l);return Uy.forEach(t=>{const e=c.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};h.__PosthogExtensions__.tracingHeadersPatchFns=Jy,h.postHogTracingHeadersPatchFns=Jy,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(t){const e=this.length;let i=Math.trunc(t)||0;return 0>i&&(i+=e),0>i||i>=e?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(t,e){for(let i=this.length-1;i>=0;i--){const n=this[i];if(t.call(e,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var Ky=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(t){var e;if(t.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Yy=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Xy=t=>{if("loading"===document.readyState)return"loading";const e=Yy();if(e){if(e.domInteractive>t)return"loading";if(0===e.domContentLoadedEventStart||e.domContentLoadedEventStart>t)return"dom-interactive";if(0===e.domComplete||e.domComplete>t)return"dom-content-loaded"}return"complete"},tb=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},eb=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[tb(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(e.length+s.length>99)return e||s;if(e=e?s+">"+e:s,n.id)break;t=n.parentNode}}catch(t){}return e},ib=new WeakMap;function nb(t,e){let i=ib.get(e);return i||(i=new WeakMap,ib.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let sb=-1;const rb=()=>sb,ob=t=>{addEventListener("pageshow",e=>{e.persisted&&(sb=e.timeStamp,t(e))},!0)},ab=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},lb=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},ub=()=>{var t,e;return null!==(t=null===(e=Yy())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let cb=-1;const hb=new Set,db=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,vb=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of hb)t();isFinite(cb)||(cb="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",vb,!0))}},fb=(t=!1)=>{if(t&&(cb=1/0),0>cb){var e;const t=ub(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;cb=null!=i?i:db(),addEventListener("visibilitychange",vb,!0),addEventListener("prerenderingchange",vb,!0),ob(()=>{setTimeout(()=>{cb=db()})})}return{get firstHiddenTime(){return cb},onHidden(t){hb.add(t)}}},pb=(t,e=-1,i,n=0,s,r,o)=>{const a=Yy(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>rb()?a&&(document.prerendering||ub()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},gb=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},mb=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},yb=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},bb=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var _b=class{constructor(){this.u=void 0}};const wb=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},kb=[1800,3e3],Sb=(t,e={})=>{const i=mb(e);wb(()=>{const n=nb(e,_b),s=fb();let r,o=pb("FCP");const a=gb(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-ub(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=ab(t,o,kb,e.reportAllChanges),ob(i=>{o=pb("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,rb()),r=ab(t,o,kb,e.reportAllChanges),lb(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&gb(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&yb(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=pb("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=ab(t,o,kb,e.reportAllChanges),r(!0)})},e)})},xb=[.1,.25],$b=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],Cb=(t,e={})=>{const i=nb(e=Object.assign({},e),Ky),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=$b(t.sources),o=null==i?void 0:i.node;if(o){var s,r;const t=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,o))&&void 0!==s?s:eb(o);n.set(i,t)}}},((t,e={})=>{const i=fb();Sb(bb(()=>{let n,s=pb("CLS",0);const r=nb(e,Ky),o=(i,o,a,l,u)=>{s=pb("CLS",0,i,o,a,l,u),r.o=0,n=ab(t,s,xb,e.reportAllChanges)},a=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):l(e);a()},c=["layout-shift"];mb(e)&&c.push("soft-navigation");const h=gb(c,u);h&&(n=ab(t,s,xb,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),ob(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,rb()),lb(n)}),setTimeout(n))}))})(e=>{t((t=>{let e={};if(t.entries.length){var i;const s=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const t=$b(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Xy(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},Tb=(t,e={})=>{const i=nb(e=Object.assign({},e),_b);mb(e)&&(i.u=new Map),Sb(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Xy(rb())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Yy(),n=t.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));e={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:Xy(t.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(t.navigationId);s&&(e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:"complete",navigationEntry:s})}return Object.assign(t,{attribution:e})})(e))},e)};let Eb=0,Ib=1/0,Mb=0;const Rb=t=>{for(const e of t)e.interactionId&&(Ib=Math.min(Ib,e.interactionId),Mb=Math.max(Mb,e.interactionId),Eb=Mb?(Mb-Ib)/7+1:0)};let Pb;const Ab=()=>{var t;return Pb?Eb:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Ob=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Ab()-this.h}D(){this.h=Ab(),this.v.length=0,this.p.clear()}S(t){const e=this.T(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{k:8,id:-1,entries:[]}}l(t){var e;if(null===(e=this.m)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.p.get(t.interactionId);if(n||10>this.v.length||t.duration>i.k){var s;if(n?t.duration>n.k?(n.entries=[t],n.k=t.duration):t.duration===n.k&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],k:t.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.p.delete(e.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const Fb=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=bb(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},Db=[200,500],Lb=(t,e={})=>{const i=nb(e=Object.assign({},e),Ob);let n=[],s=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const u=()=>{l||(Fb(c),l=!0)},c=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const a=new Set;for(const t of s){const e=h(t.startTime,t.processingEnd);for(const t of e)a.add(t)}n=n.filter(t=>t.startTime>r||a.has(t)),l=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!a.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:eb(o);a.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&a.set(t,e)}}};const h=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};gb(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=fb();wb(()=>{var n;"interactionCount"in performance||Pb||(Pb=gb(["event"],Rb,{durationThreshold:0}));let s,r=pb("INP");const o=nb(e,Ob),a=(i,n,a,l,u)=>{o.D(),r=pb("INP",-1,i,n,a,l,u),s=ab(t,r,Db,e.reportAllChanges)},l=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},c=(t,e=!1)=>{Fb(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);l(),e&&s(!0)})},h=["event","first-input"];mb(e)&&h.push("soft-navigation");const d=gb(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=ab(t,r,Db,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),ob(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,rb())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Xy(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),l=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),c=h(e.startTime,l),d=i.p.get(e.interactionId),v={interactionTarget:a.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:c,inputDelay:s-e.startTime,processingDuration:l-s,presentationDelay:r-l,loadState:Xy(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,a,l=0,u=0,c=0,h=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),c=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;l+=n-c,u+=c,n>h&&(a=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,h=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(c=n-v),o&&a&&(t.longestScript={entry:o,subpart:a,intersectingDuration:h}),t.totalScriptDuration=l,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=c,t.totalUnattributedDuration=n-i-l-u-c})(v),Object.assign(t,{attribution:v})})(e))},e)};var Nb=class{constructor(){this.m=void 0,this.u=void 0}l(t){var e;null===(e=this.m)||void 0===e||e.call(this,t)}};const $=[2500,4e3];let qb=50;const jb=[];gb(["resource"],t=>{for(const e of t)jb.push(e),jb.length>qb&&jb.shift()});const Bb=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(qb=e.resourceBufferSize);const i=nb(e,Nb),n=new WeakMap;mb(e)&&(i.u=new Map),i.m=t=>{const i=t.element;if(i){var s,r;const o=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,i))&&void 0!==s?s:eb(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=mb(e);wb(()=>{let s,r=fb(),o=pb("LCP");const a=nb(e,Nb),l=(n,a,l,u,c)=>{o=pb("LCP",-1,n,a,l,u,c),s=ab(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=fb(!0))},u=t=>{var e;a.u&&t.navigationId&&yb(a.u,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-ub(),0),a.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=gb(h,c);if(d){s=ab(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;Fb(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});ob(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,rb()),s=ab(t,o,$,e.reportAllChanges),lb(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var s,r,o;const a=t.entries.at(-1),l=a.url&&(jb.findLast(t=>t.name===a.url)||performance.getEntriesByType("resource").findLast(t=>t.name===a.url));let u;e.target=n.get(a),e.lcpEntry=a,a.url&&(e.url=a.url),l&&(e.lcpResourceEntry=l);let c=0,h=0;if("soft-navigation"!==t.navigationType?(u=Yy(),c=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,h=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(c=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,h-c),n=Math.max(i,l?(l.requestStart||l.startTime)-c:0),s=Math.min(t.value,Math.max(n,l?l.responseEnd-c:0));e=ue(ue({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let zb=-1;const Ub=()=>zb,Hb=t=>{addEventListener("pageshow",e=>{e.persisted&&(zb=e.timeStamp,t(e))},!0)},Wb=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},Vb=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Gb=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Qb=()=>{var t,e;return null!==(t=null===(e=Gb())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let Zb=-1;const Jb=new Set,Kb=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Yb=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Jb)t();isFinite(Zb)||(Zb="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Yb,!0))}},Xb=(t=!1)=>{if(t&&(Zb=1/0),0>Zb){var e;const t=Qb(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;Zb=null!=i?i:Kb(),addEventListener("visibilitychange",Yb,!0),addEventListener("prerenderingchange",Yb,!0),Hb(()=>{setTimeout(()=>{Zb=Kb()})})}return{get firstHiddenTime(){return Zb},onHidden(t){Jb.add(t)}}},t_=(t,e=-1,i,n=0,s,r,o)=>{const a=Gb(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>Ub()?a&&(document.prerendering||Qb()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},e_=new WeakMap;function i_(t,e){let i=e_.get(e);return i||(i=new WeakMap,e_.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var n_=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(t){var e;if(t.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const s_=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},r_=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},o_=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},a_=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var l_=class{constructor(){this.l=void 0}};const u_=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},c_=[1800,3e3],h_=(t,e={})=>{const i=r_(e);u_(()=>{const n=i_(e,l_),s=Xb();let r,o=t_("FCP");const a=s_(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Qb(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=Wb(t,o,c_,e.reportAllChanges),Hb(i=>{o=t_("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ub()),r=Wb(t,o,c_,e.reportAllChanges),Vb(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&s_(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&o_(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=t_("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Wb(t,o,c_,e.reportAllChanges),r(!0)})},e)})},d_=[.1,.25],v_=(t,e={})=>{const i=Xb();h_(a_(()=>{let n,s=t_("CLS",0);const r=i_(e,n_),o=(i,o,a,l,u)=>{s=t_("CLS",0,i,o,a,l,u),r.i=0,n=Wb(t,s,d_,e.reportAllChanges)},a=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):l(e);a()},c=["layout-shift"];r_(e)&&c.push("soft-navigation");const h=s_(c,u);h&&(n=Wb(t,s,d_,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),Hb(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ub()),Vb(n)}),setTimeout(n))}))};let f_=0,p_=1/0,g_=0;const m_=t=>{for(const e of t)e.interactionId&&(p_=Math.min(p_,e.interactionId),g_=Math.max(g_,e.interactionId),f_=g_?(g_-p_)/7+1:0)};let y_;const b_=()=>{var t;return y_?f_:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var __=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return b_()-this.u}M(){this.u=b_(),this.v.length=0,this.m.clear()}L(t){const e=this._(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{P:8,id:-1,entries:[]}}h(t){var e;if(null===(e=this.p)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.m.get(t.interactionId);if(n||10>this.v.length||t.duration>i.P){var s;if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.P-t.P),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.m.delete(e.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const w_=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=a_(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},k_=[200,500],S_=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Xb();u_(()=>{var n;"interactionCount"in performance||y_||(y_=s_(["event"],m_,{durationThreshold:0}));let s,r=t_("INP");const o=i_(e,__),a=(i,n,a,l,u)=>{o.M(),r=t_("INP",-1,i,n,a,l,u),s=Wb(t,r,k_,e.reportAllChanges)},l=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},c=(t,e=!1)=>{w_(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);l(),e&&s(!0)})},h=["event","first-input"];r_(e)&&h.push("soft-navigation");const d=s_(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Wb(t,r,k_,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),Hb(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ub())}))})};var x_=class{constructor(){this.p=void 0,this.l=void 0}h(t){var e;null===(e=this.p)||void 0===e||e.call(this,t)}};const $_=[2500,4e3],C_=(t,e={})=>{let i=!1;const n=r_(e);u_(()=>{let s,r=Xb(),o=t_("LCP");const a=i_(e,x_),l=(n,a,l,u,c)=>{o=t_("LCP",-1,n,a,l,u,c),s=Wb(t,o,$_,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Xb(!0))},u=t=>{var e;a.l&&t.navigationId&&o_(a.l,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Qb(),0),a.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=s_(h,c);if(d){s=Wb(t,o,$_,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;w_(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});Hb(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ub()),s=Wb(t,o,$_,e.reportAllChanges),Vb(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},T_={onLCP:Bb,onCLS:Cb,onFCP:Tb,onINP:Lb,withoutAttribution:{onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=T_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=T_,h.postHogWebVitalsCallbacks=T_;const E_={onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=E_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=E_,h.postHogWebVitalsCallbacks=E_,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>E_;const I_={onLCP:Bb,onCLS:Cb,onFCP:Tb,onINP:Lb,withoutAttribution:{onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=I_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=I_,h.postHogWebVitalsCallbacks=I_;const M_={onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=M_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=M_,h.postHogWebVitalsCallbacks=M_,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>M_;var R_=class{constructor(t){this.disabled=!1===t;const e=$e(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const P_="$copy_autocapture",A_=Or("[AutoCapture]");function O_(t,e){return e.length>t?e.slice(0,t)+"...":e}function F_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!ro(e));return e}function D_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,u;if(!ro(e))return{props:{}};const c=[e],h=new Set([e]);let d=e;for(;d.parentNode&&!oo(d,"body")&&1e3>c.length;){if(lo(d.parentNode)){const t=d.parentNode.host;if(h.has(t))break;h.add(t),c.push(t),d=t;continue}if(!ro(d.parentNode))break;if(h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?c.findIndex(t=>oo(t,"button")||oo(t,"a")):-1;v>0&&(s=s||c.slice(0,v+1).some(t=>!Do(t)||Lo(t)));const f=[],p={};let g,m=!1,y=!1;if(Dr(c,t=>{const e=Do(t);if(oo(t,"a")&&!n&&!(null==r?void 0:r.includes("href"))){const i=t.getAttribute("href");m=!!(e&&i&&Wo(i))&&(a?cn(i):i)}ge(ho(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};go.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?O_(1024,Vo(t)):O_(1024,fo(t)));const a=ho(t);e||(null==n?void 0:n.includes("class"))||0>=a.length||(o.classes=a.filter(function(t){return""!==t})),Dr(t.attributes,function(i){var r;if((!Lo(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Wo(i.value)&&(!Ee(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=uo(t).join(" ")),o["attr__"+i.name]=O_(1024,"href"===i.name&&s?cn(t):t)}});let l=1,u=1,c=t;for(;c=F_(c);)l++,c.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,n,s,r,a)),Dr(function(t){if(!Do(t))return{};const e={};return Dr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&Wo(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=c[v],f.splice(0,v)),s||(f[0].$el_text=oo(e,"a")||oo(e,"button")?Vo(e):fo(e)),m){var b,_;f[0].attr__href=m;const e=null===(b=Kr(m))||void 0===b?void 0:b.host,i=null==t||null===(_=t.location)||void 0===_?void 0:_.host;e&&i&&e!==i&&(g=m)}return{props:Lr((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,Se(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=ue(ue(ue(ue({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Nr(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[Qo(t.toString())]=Qo(e.toString())),n+=":",n+=Nr(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Zo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Nr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(l=f[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var L_=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(t){var e;if(!Do(t))return!0;const i=null!==(e=this.mo().css_selector_ignorelist)&&void 0!==e?e:_o,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=ho(t);if(ge(e,"ph-no-capture")||ge(e,"ph-sensitive")||Lo(t)||i.some(e=>mo(t,e)))return!0;const r=s.parentNode;s=lo(r)?r.host:r&&ro(r)?r:null}return!1}yo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.do();if("pointerdown"===t.type){this.do();const i=po(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&ro(i)&&(this.vo={target:i,excluded:this.po(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.bo)||void 0===e?void 0:e.distinctId}))}const i=this.vo;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.do():"pointerup"===t.type&&(i.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(t){var e;const i=this.vo;this.do();const s=po(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.bo)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(oo(s,"html")||oo(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.mo().css_selector_ignorelist)&&void 0!==r?r:_o;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=ho(e);return ge(i,"ph-no-capture")||ge(i,"ph-sensitive")||!Do(e)||Lo(e)||t.some(t=>mo(e,t))})?null:i.target}}constructor(t){this.wo=t,this.name=qg,this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new R_(this.Mr.rageclick),this.Io=null}setup(t){this.Mo(),this.bo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?e.dispose():(this.Eo=e,this.startIfEnabled())}dispose(){var t;this.To||(this.To=!0,this.bo=void 0,null===(t=this.Eo)||void 0===t||t.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var t,e;return this.mo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}Ro(){if(!this.isBrowserSupported())return void A_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Ao=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.do();if(0===e.type.indexOf("pointer"))return void this.yo(e);const t="click"===e.type?this._o(e):void 0;if(Me(t))return;this.Fo(e,"$autocapture",t)}catch(t){A_.error("Failed to capture event",t)}};if(Hr(t,"blur",e),Hr(n,"submit",e,{capture:!0}),Hr(n,"change",e,{capture:!0}),Hr(n,"click",e,{capture:!0}),Dr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Hr(n,t,e,{capture:!0})}),this.mo().capture_copied_text){const e=this.Oo=e=>{e=e||(null==t?void 0:t.event);try{this.Fo(e,P_)}catch(t){A_.error("Failed to capture clipboard event",t)}};Hr(n,"copy",e,{capture:!0}),Hr(n,"cut",e,{capture:!0}),Hr(n,"paste",e,{capture:!0})}}Po(){this.do(),this.Ao&&(null==t||t.removeEventListener("blur",this.Ao),Dr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Ao,!0)}),null==n||n.removeEventListener("submit",this.Ao,!0),null==n||n.removeEventListener("change",this.Ao,!0),null==n||n.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(null==n||n.removeEventListener("copy",this.Oo,!0),null==n||n.removeEventListener("cut",this.Oo,!0),null==n||n.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(t){if(this.To)return;if(this.xo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.Co=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Oe(i)&&(null===(n=this.bo)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.So=i),this.startIfEnabled()}setElementSelectors(t,e=this){if(this.To)return;t.size?this.$o.set(e,new Set(t)):this.$o.delete(e);const i=new Set;this.$o.forEach(t=>{t.forEach(t=>i.add(t))}),this.Io=i}getElementSelectors(t,e){var i;const s=[];return null===(i=this.Io)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||ge(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.To)return!1;const i=null===(t=this.bo)||void 0===t?void 0:t.kv.get(j),n=this.So,s=this.mo();if(!s.remoteRequestsDisabled&&!this.xo)return!1;const r=s.remoteRequestsDisabled&&!this.xo;if(Me(n)&&!Oe(i)&&!r)return!1;const o=null!==(e=this.So)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Fo(e,i="$autocapture",n){if(!this.isEnabled)return void this.do();let s=n||po(e);ao(s)&&(s=s.parentNode||null);const r=this.Mo();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&Ao(s,r.rageclick)&&this.Fo(e,"$rageclick",n);const a=i===P_,l=a?ue(ue({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var a;if(!t||Oo(e))return!1;if((null==n?void 0:n.url_allowlist)&&!co(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&co(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:l,targetElementList:u}=Fo(e,s);if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Te(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,n))return!1;if(!yo(u,null==n?void 0:n.css_selector_allowlist))return!1;if(yo(u,null!==(a=null==n?void 0:n.css_selector_ignorelist)&&void 0!==a?a:_o))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const c=e.tagName.toLowerCase();switch(c){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&&(go.indexOf(c)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:a}=D_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(s,a);if(l&&l.length>0&&(n.$element_selectors=l),i===P_){const i=e.type||"clipboard";if("paste"!==i){var c,h;const e=null==t||null===(c=t.getSelection())||void 0===c?void 0:c.toString(),i=vo(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(h=null==e?void 0:e.length)&&void 0!==h?h:0}n.$copy_type=i}return null===(u=this.bo)||void 0===u||u.capture(i,n),!0}}isBrowserSupported(){return xe(null==n?void 0:n.querySelectorAll)}};const N_={};function q_(t,e){const i=po(t);return i?ue({node:i,originalEvent:t,timestamp:Date.now()},e):null}function j_(t){return!!hn(()=>ro(t))}function B_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function z_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const U_="canvas,video,audio,embed,object";function H_(t,e){return Pe(t)&&t>=e}function W_(t,e=1e3){return t>=0&&e>t?t:void 0}function V_(t,e,i=1e3){return Pe(e)?W_(t-e,i):void 0}var G_=class{ur(t){var e,i,n,s,r,o,a,l;const u=this.cr((null==t?void 0:t.__onCapture)||this.dr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==t?void 0:t.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.hr=new WeakSet,this.vr=!1,this.pr=[],this.mr=0,this.cr=t=>({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:t}),this.gr=()=>{clearTimeout(this.yr),this.yr=void 0,this.br=void 0},this.wr=t=>{if(this.kr(t),this.gr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._r(i,e),this.br=e}},this.Sr=t=>{Me(t.relatedTarget)&&this.gr()},this.Cr=t=>{const e=this.br,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(j_(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.yr=h.setTimeout(this.gr,0)},this.Ir=t=>{this.kr(t);const e=t,i=q_(e,{type:"click"}),n=this.br;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Mr.selection_change_threshold_ms>0,this.gr()),Me(i)||this.Tr(i)||this.Rr(i),this.Er()},this.Ar=()=>{const t=Date.now();this.$r=t,t%50==0&&this.pr.forEach(e=>{Te(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Or=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.vr;this.vr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,a=o&&(ro(o)?o:o.parentElement),l=null==n?void 0:n.activeElement;let u=l;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const c=Po(po(t))||Po(null!=a?a:null)||Po(null!==(i=u)&&void 0!==i?i:null),h="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this.vr||c||h))return;const d=Date.now();this.Pr=d;const v=this.br;if(v&&(r||this.vr||c)){const e=po(t);let i;if(Po(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Po(null!==(f=u)&&void 0!==f?f:null)||h?i=u:c&&(i=a)}const n=i?this.Lr(i,v):s&&(o||s.anchorNode)?this._r(s,v):r&&!this.vr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.pr.forEach(t=>{const e=d-t.timestamp;0>e||!Te(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.sn=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.gr();const t=Date.now();this.Dr=t,this.Fr("visibilityChangedDelayMs",t)},this.Nr=()=>{const t=Date.now();this.qr=t,this.Fr("focusChangedDelayMs",t)},this.jr=t=>{this.kr(t);const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.Br=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.zr=()=>{this.Br=void 0},this.Hr=t=>{var e;const i=this.Br;if(this.Br=void 0,Te(i)||this.mr>=this.Mr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,u=this.Mr.swipe_threshold_px;if(u*u>l)return;if([this.$r,this.Ur,this.Pr].some(t=>Pe(t)&&t>=i.timestamp))return;var c,h;if(this.Wr()&&(null!==(c=null==n||null===(h=n.elementsFromPoint)||void 0===h?void 0:h.call(n,i.x,i.y))&&void 0!==c?c:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,U_)}))return;const d=q_(s,{type:"swipe",swipeDirection:B_(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Me(d)||this.Tr(d)||this.Rr(d),this.Er()},this.Mr=this.ur(e),this._onCapture=this.Mr.__onCapture}start(t){this.Vr(),this.Gr(),this.Qr(),this.Zr(),this.Jr(),this.Kr(t),this.Mr.capture_dead_swipes&&this.Xr()}Kr(e){if(!this.Yr){const i=function(e){return function(e,i){const n=N_[e];if(n)return n;let s=i[e];if((t=>xe(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return N_[e]=s.bind(i);const r=i.document;if(r&&xe(r.createElement)){let t,n=!1;try{t=r.createElement("iframe"),t.hidden=!0,r.head.appendChild(t);const l=t.contentWindow;var o,a;l&&l[e]&&(s=l[e],"MutationObserver"===e&&function(t){return ge(t,"AppleWebKit")&&!ge(t,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){Ar.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}return s&&xe(s)?N_[e]=s.bind(i):s}("MutationObserver",e)}(h);this.Yr=new i(t=>{this.eo(t)}),this.no(e)}}no(t){t&&this.Yr&&(this.hr.has(t)||(this.Yr.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this.hr.add(t),this.io(t)))}io(t,e){var i,n;ro(t)&&t.shadowRoot&&this.no(t.shadowRoot);const s=null!==(i=null===(n=t.querySelectorAll)||void 0===n?void 0:n.call(t,"*"))&&void 0!==i?i:[];for(let t=0;s.length>t;t++)null==e||e.add(s[t]),this.no(s[t].shadowRoot)}kr(t){var e,i;const n=null!==(e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t))&&void 0!==e?e:[];for(let t=0;n.length>t;t++){const e=n[t];j_(e)&&this.no(e.shadowRoot)}}stop(){var t;null===(t=this.Yr)||void 0===t||t.disconnect(),this.Yr=void 0,this.hr=new WeakSet,h.removeEventListener("click",this.Ir,{capture:!0}),h.removeEventListener("mousedown",this.wr,{capture:!0}),h.removeEventListener("mouseup",this.Cr,{capture:!0}),h.removeEventListener("mouseout",this.Sr,{capture:!0}),h.removeEventListener("dragstart",this.gr,{capture:!0}),h.removeEventListener("pointercancel",this.gr,{capture:!0}),h.removeEventListener("blur",this.gr),this.gr(),h.removeEventListener("scroll",this.Ar,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Or),h.removeEventListener("touchstart",this.jr,{capture:!0}),h.removeEventListener("touchend",this.Hr,{capture:!0}),h.removeEventListener("touchcancel",this.zr,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.sn),h.removeEventListener("blur",this.Nr),h.removeEventListener("focus",this.Nr),this.Br=void 0}eo(t){const e=new Set;for(const n of t)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this.Ur=Date.now();const t=n.addedNodes;for(let i=0;t.length>i;i++){const n=t[i];j_(n)&&!e.has(n)&&this.io(n,e)}}catch(t){}}Vr(){Hr(h,"click",this.Ir,{capture:!0}),Hr(h,"mousedown",this.wr,{capture:!0}),Hr(h,"mouseup",this.Cr,{capture:!0}),Hr(h,"mouseout",this.Sr,{capture:!0}),Hr(h,"dragstart",this.gr,{capture:!0}),Hr(h,"pointercancel",this.gr,{capture:!0}),Hr(h,"blur",this.gr)}Rr(t){t.selectionChangedDelayMs=V_(t.timestamp,this.Pr,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=V_(t.timestamp,this.Dr),t.focusChangedDelayMs=V_(t.timestamp,this.qr),this.pr.push(t)}Er(){this.pr.length&&Te(this.ro)&&(this.ro=h.setTimeout(()=>{this.oo()},1e3))}Gr(){Hr(h,"scroll",this.Ar,{capture:!0})}Qr(){var t;this.vr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),Hr(n,"selectionchange",this.Or)}Lr(t,e){const i=e.path[0];try{for(;t;){if(-1!==e.path.indexOf(t)||ro(i)&&i.contains(t))return!0;t=t.getRootNode().host}}catch(t){}return!1}_r(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0,s=!!n&&hn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&ro(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const t=ro(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this.Lr(t,e)}return this.Lr(t.focusNode,e)||this.Lr(t.anchorNode,e)}Zr(){Hr(n,"visibilitychange",this.sn)}Jr(){Hr(h,"blur",this.Nr),Hr(h,"focus",this.Nr)}Fr(t,e){this.pr.forEach(i=>{const n=W_(e-i.timestamp);Pe(n)&&(Te(i[t])||i[t]>n)&&(i[t]=n)})}Xr(){Hr(h,"touchstart",this.jr,{capture:!0,passive:!0}),Hr(h,"touchend",this.Hr,{capture:!0,passive:!0}),Hr(h,"touchcancel",this.zr,{capture:!0,passive:!0})}Wr(){const t=Te(this.so)||Pe(this.Ur)&&this.Ur>this.so;return(Te(this.ao)||t)&&(this.so=Date.now(),this.ao=!!(null==n?void 0:n.querySelector(U_))),!!this.ao}Tr(t){return!t||("swipe"===t.type?this.lo(t):this.uo(t))}lo(e){return!(!so(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!oo(e.node,"html")&&ro(e.node)&&function(e,i){var n;if(!t||Oo(e))return!1;const s=Oe(i)?Io:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Io,{targetElementList:r}=Fo(e,!1);return!yo(r,s)}(e.node,{css_selector_ignorelist:this.Mr.css_selector_ignorelist}))}uo(e){return!(this.Mr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.lo(e)||function(e){if(!t||Oo(e))return!1;const{targetElementList:i}=Fo(e,!1);return i.some(t=>oo(t,"a"))}(e.node);var i}oo(){if(!this.pr.length)return;clearTimeout(this.ro),this.ro=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Ur&&this.Ur>=i.timestamp?this.Ur-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=H_(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=H_(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=H_(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=H_(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Pe(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,a=Pe(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Pe(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Pe(i.visibilityChangedDelayMs),c=Pe(i.focusChangedDelayMs);if(!(o||a||l||u||c))if(t||s||r||n){const e=z_(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Ur,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Er()}dr(t,e){const i=z_(t);this.instance.capture(i,ue(ue(ue({},e),D_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Mr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new G_(t,e);const Q_=Or("[ExternalScriptsLoader]"),Z_=t=>{const e=null==n?void 0:n.querySelectorAll("script");if(e)for(let i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},J_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Q_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=Z_(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(Z_(e))return J_(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},K_={},Y_=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void J_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=K_[s];if("fallback"===n&&r){if(Z_(r))return void J_(t,r,i);delete K_[s]}return void J_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=Y_(t,e);K_[s]=n;const r=Z_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),J_(t,n,i)}else i(void 0,r)}:i)}J_(t,Y_(t,e),i)},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);J_(t,n,i)};var X_=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.No.$t(this.qo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get Lo(){const t=this.No.Ot(this.qo);return He(t)?1:ge(We,t)?0:-1}get No(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?Ml:El,i=e.At()?e:zl;if(!this.jo||this.jo!==i){this.jo=i;const e="localStorage"===t?El:Ml;e.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(He(e.Ot(this.qo))),e.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const tw=Or("[Dead Clicks]"),ew=()=>!0,iw=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(V)),n=t.instance.config.capture_dead_clicks;return Oe(n)?n:!!$e(n)||i};var nw=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[V]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?tw.error("failed to load script",e):t()})}Ho(){var t;if(n){if(!this.Bo&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=$e(this.instance.config.capture_dead_clicks)?ue({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(n),tw.info("starting...")}}else tw.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,tw.info("stopping..."))}};const sw=Or("[SegmentIntegration]");function rw(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>xe(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||Sl();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ct,Kt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&xe(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||sw.warn("This browser does not have Promise support, and can not use the segment integration");const n=(n,s)=>{if(!s)return n;const r=!!e&&n.event.anonymousId===e&&!n.event.userId;r||n.event.userId||n.event.anonymousId===t.get_distinct_id()||(sw.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(sw.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Re(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))we.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=Se(t)?t:[t];let n=ue({},e);for(const t of i)try{if(n=t(n),Re(n))return null}catch(t){return sw.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Re(s))return n;o=s}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,te)},identify(t){return n(t,ie)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{sw.error("Failed to register the Segment integration",t),e()})},i)}const ow="posthog-js";function aw(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,u,c,h;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],f=v.map(t=>ue(ue({},t),{},{stacktrace:t.stacktrace?ue(ue({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>ue(ue({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(l=v[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(c=v[0])||void 0===c?void 0:c.value)||o.message,$sentry_exception_type:null===(h=v[0])||void 0===h?void 0:h.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var lw=class{constructor(t,e,i,n,s,r){this.name=ow,this.setupOnce=function(o){o(aw(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},uw=class{constructor(t){this.Uo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ar.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Vo()}Vo(){var t;this.Go=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Uo)}destroy(){var t;null===(t=this.Go)||void 0===t||t.call(this),this.Go=void 0}doPageView(e,i){var n;const s=this.Qo(e,i);return this.Wo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Qo(t,null===(e=this.Wo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Wo)||void 0===t?void 0:t.pageViewId}}Qo(t,e){const i=this.Wo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(Te(t)||Te(e)||Te(i)||Te(r)||Te(o)||Te(a))){t=Math.ceil(t),e=Math.ceil(e),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const s=t>1?Ze(e/t,0,1,Ar):1,l=t>1?Ze(i/t,0,1,Ar):1,u=r>1?Ze(o/r,0,1,Ar):1,c=r>1?Ze(a/r,0,1,Ar):1;n=Lr(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:c})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const cw=["flags","surveys"],hw={[I]:{exposure:"hidden"},[A]:{exposure:"hidden"},[O]:{exposure:"hidden"},[q]:{exposure:"hidden"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[j]:{exposure:"event"},[B]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[z]:{exposure:"event"},[U]:{exposure:"hidden"},[H]:{exposure:"event"},[W]:{exposure:"event"},[V]:{exposure:"event"},[G]:{exposure:"hidden"},[Z]:{exposure:"event"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[st]:{exposure:"event"},[Y]:{exposure:"event",shouldSkipFromEventProperties:t=>Me(t)},[rt]:{exposure:"event"},[ot]:{exposure:"event"},[at]:{exposure:"event"},[ht]:{exposure:"event"},[dt]:{exposure:"hidden"},[b]:{exposure:"hidden",storageGroup:"flags"},[v]:{exposure:"hidden",storageGroup:"flags"},[d]:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden",storageGroup:"flags"},[m]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[y]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden"},[T]:{exposure:"hidden"},[w]:{exposure:"hidden"},[_]:{exposure:"hidden"},[ft]:{exposure:"hidden",storageGroup:"surveys"},[pt]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gt]:{exposure:"event"},[mt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[kt]:{exposure:"event"},[St]:{exposure:"event"},[xt]:{exposure:"event"},[$t]:{exposure:"event"},[k]:{exposure:"hidden"},[S]:{exposure:"hidden"},[vt]:{exposure:"event"},[p]:{exposure:"hidden"},[g]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ct]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[X]:{exposure:"event"},[tt]:{exposure:"event"},[et]:{exposure:"event"},[it]:{exposure:"event"},[Ft]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"hidden"},[Nt]:{exposure:"hidden"},[qt]:{exposure:"hidden"},[jt]:{exposure:"hidden"},[Bt]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Qt]:{exposure:"event"}},dw=[[lt,{exposure:"hidden"}],[ut,{exposure:"hidden"}],[ct,{exposure:"hidden"}]],vw=t=>{const e=hw[t];if(e)return e;for(const[e,i]of dw)if(0===t.indexOf(e))return i},fw={flags:g,surveys:pt},pw=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gw=t=>`${t}_cookie_identity_change_pending`,mw=t=>{let e="",i=0;for(const n of t){const t=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+t>1e3)break;e+=n,i+=t}return e},yw="main",bw=[b,v,f,x,m,g,y,w],_w=t=>-1!==bw.indexOf(t),ww=[D,N],kw=t=>-1!==ww.indexOf(t),Sw=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},xw=t=>{if(!t)return{};const e=JSON.parse(t);return $e(e)?e:{}},$w=(t,e)=>{Dr(t,(i,n)=>{const s=vw(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var Cw=class{constructor(e,i,n=!0,s=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=n,this.props={},this.la=void 0,this.ua=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.hi=e.disable_persistence||!!i,this.No=this.ca(e),this.Xo=this.ha(e),this.load(s),this.da(),e.debug&&Ar.info("Persistence loaded",e.persistence,ue({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();Hr(t,"beforeunload",e,{capture:!1}),Hr(t,"pagehide",e,{capture:!1}),this.va=e=>{if(this.Jo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.ua){if(this.Xo){const t=cw.find(t=>e.key===this.fa(t));t&&this.pa(e.key,t)}}else this.pa(e.key,yw)},Hr(t,"storage",this.va)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.ea.get(t);if(!_w(t)||!0===i)return;if(!0===e)return void this.ga(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.ga(t,n)})}onCrossTabFeatureFlagChange(t){return this.oa.add(t),()=>this.oa.delete(t)}destroy(){this.va&&t&&(t.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(t,e,i=!0){if(this.hi)return!1;let n,s;try{if(s=Ml.Ot(t),Me(s)){const t=this.ma(e);return t.storageValue=null,e!==yw&&(t.persisted=!1),!1}n=xw(s)}catch(t){return!1}const r=e===yw?n:Ml.Dt(this.ua);if(r&&this.ya(r))return!1;const o=this.ba(n,e,i);return e===yw&&this.Xo&&!Sw(this._a().main,n)||this.wa(n,e,!0,s),o}ya(t){const e=this.props[M],i=t[M];return!Te(e)&&!Te(i)&&e!==i}wa(t,e,i,n){const s=this.ma(e);s.storageValue=n,e!==yw&&(s.persisted=i);try{s.fingerprint=this.ka(t,e)}catch(t){s.fingerprint=void 0}}ba(t,e,i){let n=!1;return bw.forEach(i=>{var s;const r=null===(s=vw(i))||void 0===s?void 0:s.storageGroup;if(e===yw&&this.Xo&&r||e!==yw&&r!==e)return;const o=i in t,a=this.Sa(i,o?t[i]:void 0),l=this.ea.has(i)?i in this.props:o;l===i in this.props&&Sw(a,this.props[i])||(l?this.xa(i,a,!1):this.$a(i,!1),n=!0)}),n&&i&&this.oa.forEach(t=>t()),n}Ca(){if(!this.Jo)return!1;try{this.sa=!1;const t=Ml.Ot(this.ua),e=this.ma(yw);let i,n=!1,s=!1;if(t!==e.storageValue)if(Me(t))e.storageValue=null;else{if(i=xw(t),this.sa=!this.na&&this.ya(i),this.sa)return!1;s=this.ba(i,yw,!1),!this.Xo||Sw(this._a().main,i)?this.wa(i,yw,!0,t):e.storageValue=t,n=!0}return this.Xo&&cw.forEach(t=>{const e=Ml.Ot(this.fa(t)),r=this.ma(t),o=i||{},a=n&&bw.some(e=>{var i;return(null===(i=vw(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!a)return;if(Me(e))return r.storageValue=null,r.persisted=!1,void(a&&(s=this.ba(o,t,!1)||s));const l=xw(e);s=this.ba(l,t,!1)||s,this.wa(l,t,!0,e)}),s}catch(t){return!1}}ga(t,e){this.ea.set(t,e);const i=vw(t);(null==i?void 0:i.volatile)||(this.ma((this.Xo?null==i?void 0:i.storageGroup:void 0)||yw).fingerprint=void 0,this.Ta(t))}Ia(){bw.forEach(t=>this.ea.set(t,!0))}da(){if(this.Jo)try{const t=Ml.Ot(this.ua),e=xw(t);this.ma(yw).storageValue=t,bw.forEach(t=>{var i;const n=this.Xo?null===(i=vw(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ml.Ot(this.fa(n)):null;if(n){const t=this.ma(n);t.storageValue=s,t.persisted=!Me(s)}const r=n&&!Me(s)?xw(s):e;t in this.props?this.Ma(t,r[t],this.props[t]):t in r&&this.ga(t,!0)})}catch(t){}}Sa(t,e){const i=this.ea.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(Se(e)?e:[]),s=new Set(Se(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=$e(e)?ue({},e):{},s=$e(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Ma(t,e,i){if(!_w(t))return;const n=this.ea.get(t);if(!0===n)return;let s=e;if(this.Jo)try{var r;const e=this.Xo?null===(r=vw(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.fa(e):this.ua;s=xw(Ml.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Te(e)&&!Se(e)||!Te(s)&&!Se(s)||!Se(i))return void this.ga(t,!0);const n=new Set(e||[]),r=new Set(s||[]),a=new Set(i);new Set([...n,...a]).forEach(t=>{n.has(t)!==a.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===a.has(t)&&o.delete(t)})}else{if(!$e(i))return void(Sw(s,i)?this.ea.delete(t):this.ga(t,!0));{if(!Te(e)&&!$e(e)||Te(e)&&Ce(i)&&Te(s))return void this.ga(t,!0);const n=$e(e)?e:{},r=$e(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&Sw(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&Sw(r[t],i[t])&&o.delete(t)})}}o.size?this.ga(t,o):this.ea.delete(t)}Ea(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Pe(e)&&e>0?e:0}Pa(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=Dl(t,this.Mr.cookie_persisted_properties||[]),i=Nl(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=El.Ot(this.ua)||void 0;s&&jl(this.ua,s)===n&&(this.Ra=n,this.Aa=s)}catch(t){}else try{const t=El.Ot(this.ua)||void 0;this.Ra=t?jl(this.ua,t):void 0,this.Aa=t}catch(t){}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(t,e=!1){if(this.hi&&!e||this.ta||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=El.Ot(this.ua)||void 0}catch(t){}if(!i||i===this.Aa)return!1;const n=jl(this.ua,i);let s;try{s=Fl(JSON.parse(i))}catch(t){return!1}if((El.Ot(this.ua)||void 0)!==i)return!1;this.Ra=n,this.Aa=i;const r=ql(this.ua,i),o=[...Pl,...r.properties],a={};if(Object.keys(s).forEach(t=>{const e=s[t];(Te(e)||Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete s[t])}),Ce(s))return!1;const l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,c=u[M],h=u[Ct],d=Lr({},u);[...Pl,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in s)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){const e=d[t];(r.isValid||-1===Pl.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Lr(d,s),bw.forEach(t=>{const e=t in this.props;t in u===e&&Sw(u[t],this.props[t])||(e?this.Ma(t,u[t],this.props[t]):this.ga(t,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this.xa(Ct,Jt);const y=this.props[M],S=this.props[Ct];return!l||y===c&&S===h||(this.na=!0,this.Yo=!0,Hl.$t(gw(this.ua),!0),this.$a(w),this.$a(v),this.$a(b),this.$a(f),this.$a(x),this.$a(m),this.$a(g),this.$a(p),this.$a(k),"anonymous"!==S||"identified"!==h&&"anonymous"!==s.$user_state&&(Te(c)||y===c)||($w(this.props,s),this.$a(_)),"identified"===S?this.props.$user_id=y:delete this.props.$user_id,this.$a(A)),!0}consumeCookieIdentityChange(){const t=gw(this.ua),e=this.Yo||!!Hl.Ot(t);return this.Yo=!1,e&&Hl.Pt(t),e}Oa(t=!1){return!(this.ta||this.hi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.ta=!0,0))}Da(){this.ta&&(Te(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[yw],this.Na(!0))}qa(t=!0){if(this.ta)try{t?this.Da():Te(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){-1===pw.indexOf(e.persistence.toLowerCase())&&(Ar.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1,n=()=>!1)=>{const s=[...Pl,...e];return ue(ue({},Ml),{},{Dt(t){try{let r,o={};try{r=El.Ot(t)||void 0,o=r?Fl(JSON.parse(r)):{}}catch(t){}const a=JSON.parse(Ml.Ot(t)||"{}");let l;if(i){const i=ql(t,r),n=[...Pl,...i.properties],u={};Object.keys(o).forEach(t=>{const e=o[t];Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const c="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=a[M],r=null!==(e=a.$user_state)&&void 0!==e?e:Jt;s.forEach(t=>{if(-1!==n.indexOf(t)&&!(t in o)&&(c||"distinct_id"!==t&&"$user_state"!==t)){const e=a[t];(i.isValid||-1===Pl.indexOf(t)||!1!==e&&0!==e)&&delete a[t]}}),!c||"$user_state"in o||"$user_state"in a||(a[Ct]=Jt),!c||("distinct_id"in u?u[M]:a[M])===t&&("$user_state"in u?u[Ct]:a[Ct])===r||(Rl.forEach(t=>delete a[t]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[M]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[vt],delete a[_]),delete a.__alias)}l=Lr(a,u)}else l=Lr(o,a);return n()||Ml.$t(t,l),l}catch(t){}return null},$t(t,n,s,r,o,a){const l=Ml.$t(t,n,void 0,void 0,a);try{const u=Dl(n,e);if(Object.keys(u).length){if(i){const i=Al(t),c=Nl(u,e);if(El.$t(i,c,s,r,o,a),El.Ot(i)!==JSON.stringify(c)){El.Pt(i,r);const e=Dl(n);return El.$t(t,e,s,r,o,a),l}}El.$t(t,u,s,r,o,a)}}catch(t){Ml.Lt(t)}return l},Pt(e,i){try{null==t||t.localStorage.removeItem(e),El.Pt(e,i),El.Pt(Al(e),i)}catch(t){Ml.Lt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Ml.At()?(n=Ml,r=!0):"localstorage+cookie"===o&&i.At()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Hl.At()?n=Hl:"memory"===o?n=zl:"cookie"===o&&El.At()?(n=El,s=!0):i.At()?(n=i,r=!0,s=!0):El.At()?(n=El,s=!0):n=zl,this.Jo=r,this.Ko=s,n}fa(t){return`${this.ua}__${t}`}ha(t){return this.Jo&&!!t.split_storage}properties(){const t={};return Dr(this.props,(e,i)=>{const n=vw(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.hi&&!t)return;const e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?Ml.Dt(this.ua):null;let n={};if(e)try{n=Fl(El.Dt(this.ua)),Dr(n,(t,e)=>{(Te(t)||Me(t)||""===t)&&delete n[e]})}catch(t){}const s=this.No.Dt(this.ua);if(s&&(this.props=Lr({},s)),this.Xo&&this.ja(),e&&s){var r,o;const t=null==i?void 0:i[M],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Jt,a=s[M],l=null!==(o=s.$user_state)&&void 0!==o?o:Jt;if(a!==t||l!==e){this.Yo=!0,this.hi||Hl.$t(gw(this.ua),!0);const i=Lr({},this.props);Rl.forEach(t=>delete i[t]),"anonymous"!==l||"identified"!==e&&"anonymous"!==n.$user_state&&(Te(t)||a===t)||($w(i,n),delete i[_]),this.props=i;const s=new Set;Rl.forEach(t=>{var e;const i=null===(e=vw(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{if(this.hi)return;const e={};Dr(this.props,(i,n)=>{var s;(null===(s=vw(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),Ce(e)?(Ml.Pt(this.fa(t)),this.Zo[t]={}):Ml.$t(this.fa(t),e)&&(this.Zo[t]={persisted:!0,fingerprint:this.ka(e,t)})})}}Hl.Ot(gw(this.ua))&&(this.Yo=!0)}ja(){for(const t of cw){const e=Ml.Dt(this.fa(t));if(e&&!Ce(e)){const i=this.ma(t);i.persisted=!0,this.Ba(t)||(i.fingerprint=this.ka(e,t)),this.za(t,e)||Lr(this.props,e)}}}Ba(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=vw(e))||void 0===i?void 0:i.storageGroup)===t})}za(t,e){const i=fw[t];if(!i)return!1;const n=e[i],s=this.props[i];return Pe(n)&&Pe(s)&&s>n}refreshKey(t){var e;if(this.hi)return;if(this.ra.has(t))return;const i=this.Xo?null===(e=vw(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Ml.Dt(this.fa(i)):this.No.Dt(this.ua);if(n&&t in n)this.xa(t,n[t],!1);else{if(i){const e=this.No.Dt(this.ua);if(e&&t in e)return void this.xa(t,e[t],!1)}this.$a(t,!1)}}save(){if(this.hi)return;const t=this.Ea();t>0?Te(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},t)):this.Na()}flush(){Te(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(t=!1){if(this.hi||this.ta&&!t)return;t||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||ww.forEach(t=>this.refreshKey(t)));const e=!t&&!this.ia;e||(this.sa=!1);const i=!!e&&this.Ca();if(this.sa)return void(this.Mr.debug&&Ar.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(i&&this.oa.forEach(t=>t()));const n=this.Ua(this.No,this.ua,this.props,yw);"written"===n&&this.Pa(this.props),"failed"!==n&&(this.ea.clear(),this.na=!1,this.ra.clear()),i&&this.oa.forEach(t=>t())}Ha(){const{main:t,groups:e}=this._a(),i=this.Ua(this.No,this.ua,t,yw);"written"===i&&this.Pa(t),"failed"!==i&&(this.na=!1,this.ra.clear(),bw.forEach(t=>{var e;(null===(e=vw(t))||void 0===e?void 0:e.storageGroup)||this.ea.delete(t)}));for(const t of cw){var n;const i=e[t];if(Ce(i)&&!(null===(n=this.Zo[t])||void 0===n?void 0:n.persisted)){bw.forEach(e=>{var i;(null===(i=vw(e))||void 0===i?void 0:i.storageGroup)===t&&this.ea.delete(e)});continue}const s=this.Ua(Ml,this.fa(t),i,t);"failed"!==s&&bw.forEach(e=>{const i=vw(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.ea.delete(e)})}}_a(){const t={},e={flags:{},surveys:{}};return Dr(this.props,(i,n)=>{var s;const r=null===(s=vw(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}ka(t,e){if(e===yw)return JSON.stringify(t)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const i={};return Dr(t,(t,e)=>{var n;i[e]=(null===(n=vw(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}Ua(t,e,i,n){const s=this.ma(n);if(n!==yw&&!s.dirty&&!Te(s.fingerprint))return"skipped";let r;try{if(r=this.ka(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(e,i,this.Wa,this.Va,this.Ga,this.Mr.debug)?(s.dirty=!1,n!==yw&&(s.persisted=!0),Te(r)||(s.fingerprint=r),this.Jo&&(s.storageValue=Ml.Ot(e)),"written"):(this.Mr.debug&&Ar.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Ia(),Te(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!t&&this.aa)for(const t of cw)Ml.Pt(this.fa(t));t?delete this.Zo[yw]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if($e(t)){this.syncCookieProperties(),Te(e)&&(e="None"),this.Wa=Te(i)?this.Qa:i;let n=!1;if(Dr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.xa(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if($e(t)){this.syncCookieProperties(),this.Wa=Te(e)?this.Qa:e;let i=!1;if(Dr(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||$e(e)||Se(e))&&(this.xa(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.$a(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.la)return;const e=xu(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!Ce(jr(e));return i&&this.register(e),this.la=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Cu(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Mu(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=Kr(n.referrer))||void 0===t?void 0:t.host)||Iu},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Ru(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Rt]:this.Ko?{r:mw(t.r),u:t.u?mw(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Dr([Mt,It],e=>{const i=this.props[e];i&&Dr(i,function(e,i){t["$initial_"+ye(i)]=e})});const e=this.props[Rt];if(e){const i=function(t,e=!1){const i=Pu(t,e),n={};return Dr(i,function(t,e){n[`$initial_${ye(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Lr(t,i)}return t}safe_merge(t){return Dr(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.hi&&!a;a||this.Fa(e,l),this.Mr=t,!a&&(n||s||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(ue(ue({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),l));const u=r||o?this.ca(t):this.No;this.Za();const c=this.ha(t),h=r||c!==this.Xo,d=!a&&(h||t.cross_subdomain_cookie!==this.Va||t.secure_cookie!==this.Ga)&&this.Oa(l);this.ia=h;try{if(this.Qa=this.Wa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),h){const t=this.props;this.clear(),this.No=u,this.Xo=c,this.props=t,this.save()}else o&&(this.No=u,a||(delete this.Zo[yw],this.Na()))}finally{this.ia=!1,d&&this.qa()}}Za(){const t=this.props[Rt];if(!this.Ko||!$e(t)||"string"!=typeof t.r)return;const e=mw(t.r),i="string"==typeof t.u?mw(t.u):t.u;e===t.r&&i===t.u||this.xa(Rt,ue(ue({},t),{},{r:e,u:i}))}set_disabled(t){this.hi=t,this.hi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Va&&(this.Va=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ga&&(this.Ga=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.xa(q,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Te(i)||(delete e[t],this.xa(q,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.xa(t,e),this.save()}xa(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.na=!0),kw(t)&&!Sw(s,e)&&this.ra.add(t),this.Ma(t,s,e),(null===(n=vw(t))||void 0===n?void 0:n.volatile)||this.Ta(t))}$a(t,e=!0){delete this.props[t],e&&(_w(t)&&this.ga(t,!0),kw(t)&&this.ra.add(t),this.Ta(t))}Ta(t){var e;const i=null===(e=vw(t))||void 0===e?void 0:e.storageGroup;i&&(this.ma(i).dirty=!0)}ma(t){return this.Zo[t]||(this.Zo[t]={})}};const Tw={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Ew={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Iw={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Mw=Or("[RateLimiter]");var Rw=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Mw.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Mw.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>s&&(a.tokens=s);const l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){const t=(Pe(a.dropped)?a.dropped:0)+1;a.dropped=t,!this.lastEventRateLimited&&this.Ja(t)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Ka(t){const e=this.instance.config.property_denylist;return!Se(e)||!e.includes(t)}Xa(){var t;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Ja(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Xa(),o=this.Ka("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,a=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const Pw=Or("[RemoteConfig]");var Aw=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ya(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}tl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return Pw.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void Pw.warn("Remote config is disabled. Falling back to local config.");this.Ya(t=>{if(!t)return Pw.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(t)})}catch(t){Pw.error("Error loading remote config",t),this.el()}}el(t,e){!t&&e&&(0===e.statusCode?e.error||Pw.warn("Failed to fetch remote config from PostHog."):Pw.error("Failed to fetch remote config from PostHog."));try{this._instance.el(t?{ok:!0,config:t}:{ok:!1})}catch(t){Pw.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(t){Pw.error("Error loading feature flags",t)}}};const Ow=["fatal","error","warning","log","info","debug"],Fw=!!o||!!r,Dw=new WeakMap,Lw="text/plain";let Nw=0,qw=!1;const jw=(t,e)=>{const[i,n]=t.split("#"),[s,r]=i.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==e).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},Bw=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=ue({},e),a=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],l=Yr(o);return l&&a.push(l),a.length>0?`${s}?${a.join("&")}`:s},zw=t=>{if(t.nl)return t.nl;const{data:e,compression:i}=t;if(!e)return;if(i===gg.GZipJS){const t=vl(fl(Jr(e)),{mtime:0});return{contentType:Lw,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===gg.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Jr(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:Jr(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=Jr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},Uw=t=>{const e=()=>"sendBeacon"===t.transport?{url:Bw(t.url,{compression:gg.Base64}),encodedBody:zw(ue(ue({},t),{},{compression:gg.Base64,nl:void 0}))}:{url:jw(t.url,"compression"),encodedBody:zw(ue(ue({},t),{},{compression:void 0,nl:void 0}))};let i;try{i=zw(t)}catch(i){if(ds(t.compression,Xr(t.url,"compression")))return Ar.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&ds(t.compression,Xr(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?hs(new Uint8Array(n)):ArrayBuffer.isView(n)&&hs(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(qw=!0,e()):{url:t.url,encodedBody:i};var n},Hw=t=>{try{return Uw(t)}catch(i){var e;return Ar.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},Ww=function(){var t=re(function*(t){const e=yield bs(Jr(t.data),Wl.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return ue(ue({},t),{},{nl:{contentType:Lw,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Vw=/Failed to fetch|NetworkError|Load failed/i,Gw=t=>"TypeError"===(null==t?void 0:t.name)&&Vw.test((null==t?void 0:t.message)||""),Qw=t=>{try{const e=function(t,e=Date.now()){if("string"!=typeof t||!t)return;const i=t.trim(),n=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const s=/^\w{3} \w{3} /.test(n)?n+" GMT":n,r=Date.parse(s)-e;return Number.isFinite(r)&&r>0?Math.min(r,rn):void 0}(t());return Te(e)?void 0:Math.min(e,3e4)}catch(t){return}},Zw=t=>{const e=Hw(t);if(!e)return;const i=new o;Dw.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:a}=null!=s?s:{};Dr(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n,Qw(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},Jw=t=>{const e=Hw(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:l}=null!=n?n:{},u=new Headers;Dr(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let c=null,h=!1;if(a){const e=new a;c={signal:e.signal,timeout:setTimeout(()=>{h=!0;try{e.abort(un("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))}catch(t){v(t)}var i},t.timeout)}}let d=!1;const v=e=>{var i;d||(d=!0,h&&"AbortError"===(null==e?void 0:e.name)||Gw(e)?Ar.warn(e):Ar.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))};let f=0;const p=()=>{Nw-=f,f=0,c&&clearTimeout(c.timeout)};try{const e=ue({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==c?void 0:c.signal},t.fetchOptions),n=null!=l?l:Te(o)?0:void 0;e.keepalive="POST"===e.method&&!t.sl&&!1!==e.keepalive&&e.body===o&&!Te(n)&&n>=0&&52428.8>Nw+n,e.keepalive&&(f=n,Nw+=f),r(i,e).then(e=>e.text().then(i=>{var n;if(d)return;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Ar.error(t)}d=!0,p(),null===(n=t.callback)||void 0===n||n.call(t,s,Qw(()=>e.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},Kw=t=>{try{var e;const{url:n,encodedBody:s}=Uw(t),{contentType:o,body:a,estimatedSize:l}=null!=s?s:{};if(!a)return;const u=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(n,u))return;const c=Se(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(Se(c)&&c.length>1&&(null!=l?l:0)>16384){const e=Math.ceil(c.length/2),i=e=>Se(t.data)?e:ue(ue({},t.data),{},{batch:e});return Kw(ue(ue({},t),{},{data:i(c.slice(0,e))})),void Kw(ue(ue({},t),{},{data:i(c.slice(e))}))}Ar.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Jw(ue(ue({},t),{},{sl:!0})):Zw(t)}catch(t){Ar.warn("Beacon send failed",t)}},Yw=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return Bw(i===gg.GZipJS?jw(t,"compression"):t,ue(ue({},s?{[s]:Date.now().toString()}:{}),i===gg.GZipJS?{}:{compression:i}))},Xw=(()=>{const t=[];return r&&t.push({transport:"fetch",method:Jw}),o&&t.push({transport:"XHR",method:Zw}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:Kw}),t})();let tk=!Fw&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function ek(t,e,i){var n,s,r;i&&(e=ue(ue({},e),{},{callback:t=>i(t)})),t.__loaded?tk?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=ue(ue({},t.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(n=t.compression)&&void 0!==n?n:e.compressionFallback:e.compression,(Te(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var i,n,s;const r=ue(ue({},t),{},{callback:null!=e?e:e=>{var i;return null===(i=t.callback)||void 0===i?void 0:i.call(t,e)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Te(r.compression)&&r.data&&(r.compression=gg.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var e,i;const n=(Se(t)?t:[t]).map(t=>ue(ue({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(e=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==e?e:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,e=(new Date).toISOString())=>Se(t)?t.map(t=>ue(ue({},t),{},{sent_at:e})):ue(ue({},t),{},{sent_at:e}))(r.data))),r.url=Yw(r.url,r.method,r.compression,r.timestampMode);const a=Xw.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(n=null===(s=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(a,t=>t.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:a[0].method;if(!u)throw new Error("No available transport method");const c=t=>{try{u(t)}catch(t){var e;Gw(t)?Ar.warn(t):Ar.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===gg.GZipJS&&l&&"undefined"!=typeof Promise&&!qw?Ww(r).then(t=>{c(t)}).catch(e=>{if(vs(e))return qw=!0,void c(ue(ue({},r),{},{compression:void 0,url:Yw(t.url,t.method,void 0,t.timestampMode)}));fs(e)&&(qw=!0),c(r)}):c(r)})(e,(n,s)=>{var r,o,a;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(a=e.callback)||void 0===a||a.call(e,n)})):e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.call(e,{statusCode:0}))}var ik=class{constructor(t,e){this.rl=!0,this.ol=[],this.al=Ze((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Ar.createLogger("flush interval"),3e3),this.ll=t}enqueue(t){this.ol.push(t),this.ul||this.cl()}unload(){this.hl();const t=this.ol.length>0?this.dl():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.vl(ue(ue({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){const t=this.dl();for(const e in t)this.vl(t[e])}}vl(t,e){try{this.ll(t,e)}catch(t){Ar.error(t)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){const t={},e={};Dr(this.ol,i=>{var n;const s=i,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");Te(t[r])&&(t[r]=ue(ue({},s),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),e[r]=[]),null===(n=t[r].data)||void 0===n||n.push(s.data),s.callback&&e[r].push(s.callback)});for(const i in e){const n=e[i];n.length&&(t[i].callback=t=>{for(const e of n)e(t)})}return this.ol=[],t}};const nk=["retriesPerformedSoFar"];var sk=class{constructor(t){this._instance=t,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!Te(t)&&"onLine"in t.navigator){if(this.ml=t.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},Hr(t,"online",this.yl),Hr(t,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=ws(t,nk);Ae(i)&&(n.url=Bw(n.url,{retry_count:i})),ek(this._instance,e?ue(ue({},n),{},{transport:e}):n,(t,e)=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(ue({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Ar.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null===(s=n.callback)||void 0===s||s.call(n,t)})}Ls(t,e){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const n=Math.max(function(t){const e=3e3*Math.pow(2,t),i=e/2,n=Math.min(18e5,e),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=e?e:0),s=Date.now()+n;this.ol.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Ar.warn(r),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),0===this.ol.length)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){const t=Date.now(),e=[],i=this.ol.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ol=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,Te(t)||(this.yl&&(t.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(t.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:t}of this.ol)try{this._instance._send_request(ue(ue({},t),{},{callback:Se(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Ar.error(t)}this.ol=[]}},rk=class{constructor(t){this._instance=t,this.kl=()=>{var t,e,i,n;this.Sl||(this.Sl={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=r+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(r),this.Sl.maxScrollY=Math.max(r,null!==(t=this.Sl.maxScrollY)&&void 0!==t?t:0),this.Sl.maxScrollHeight=Math.max(o,null!==(e=this.Sl.maxScrollHeight)&&void 0!==e?e:0),this.Sl.lastContentY=a,this.Sl.maxContentY=Math.max(a,null!==(i=this.Sl.maxContentY)&&void 0!==i?i:0),this.Sl.maxContentHeight=Math.max(l,null!==(n=this.Sl.maxContentHeight)&&void 0!==n?n:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const t=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),t}startMeasuringScrollPosition(){Hr(t,"scroll",this.kl,{capture:!0}),Hr(t,"scrollend",this.kl,{capture:!0}),Hr(t,"resize",this.kl)}scrollElement(){if(this.xl){const i=Se(this.xl)?this.xl:[this.xl];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}$l(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.xl){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const ok=t=>Ru(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var ak=class{constructor(t,e,i,n){this.qe=t=>{const e=this.Cl();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Tl(this._instance)};this.Il.register({[Tt]:i})},this._instance=t,this.Ml=e,this.Il=i,this.Tl=n||ok,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[Tt]}getSetOnceProps(){var t;const e=null===(t=this.Cl())||void 0===t?void 0:t.props;return e?"r"in e?Pu(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Dr(jr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ye(i)}`]=e}),t}},lk=class{on(t,e){return this.El[t]||(this.El[t]=[]),this.El[t].push(e),()=>{this.El[t]=this.El[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.El[t]||[])i(e);for(const i of this.El["*"]||[])i(t,e)}constructor(){this.El={}}};const uk=Or("[SessionId]"),ck=864e5;var hk=class{on(t,e){return this.Pl.on(t,e)}constructor(t,e,i){var n;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new lk,this.Ll=(t,e)=>!(!Ae(t)||!Ae(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.Il=t.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=e||Sl,this.jl=i||Sl;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ze(this.Mr.session_idle_timeout_seconds||1800,60,36e3,uk.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+s+"_window_id",this.Hl="ph_"+s+"_primary_window_exists",this.Ul()){const t=Hl.Dt(this.zl),e=Hl.Dt(this.Hl);t&&!e?this.je=t:Hl.Pt(this.zl),Hl.$t(this.Hl,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.Fl)&&(this.Fl=[]),this.Fl.push(t),this.Xt&&t(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(e=>e!==t)}}Ul(){return"memory"!==this.Mr.persistence&&!this.Il.hi&&Hl.At()}Vl(t){t!==this.je&&(this.je=t,this.Ul()&&Hl.$t(this.zl,t))}Gl(){return this.je?this.je:this.Ul()?Hl.Dt(this.zl):null}Ql(t){const e=this.Rl;return!Me(e)&&!Me(t)&&5e3>Math.abs(t-e)}Zl(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ql(e)||(this.Rl=e,this.Il.register({[nt]:[e,t,i]}))}Jl(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ae(e)&&e>0}Kl(){this.Jl()?this.Il.refreshKey(nt):(this.Il.flush(),this.Il.load())}Xl(){var t;if(Me(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,e,i]=this.Yl();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[nt]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[t]=this.Yl(),e=Ae(t)?t:0,i=Ae(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}eu(t){return this.Kl(),this.Ll(t,this.tu())}Yl(){const t=this.Il.props[nt];return Se(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void uk.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void uk.error("Invalid sessionID in bootstrap",t)}})(t);return!Te(i)&&(e?this.Nl={sessionId:t,sessionStartTimestamp:i}:this.Zl(t,(new Date).getTime(),i),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&t&&(t.removeEventListener(Xt,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Hl.Pt(this.Hl)},Hr(t,Xt,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Al=n;else if(Me(this.Al)||this.Al>n||n-this.Al>=1e3){var r,o;null===(r=(o=this.Il).syncCookieProperties)||void 0===r||r.call(o),this.Al=n}let[,a,l]=this.Yl();const u=!Te(s)&&a!==s,c=this.tu();let h=this.Gl();const d=this.Nl,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>ck),f=d?v:Ae(l)&&Math.abs(n-l)>ck;let p=!1,g=u,m=!a||!!d;const y=a;let b=!m&&!t&&this.Ll(n,c);if(b&&(b=this.eu(n),b||uk.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Yl(),b||(m=!a||!!d)),m||b||f){g=!1;const t=d&&!v;a=t?d.sessionId:this.ql(),h=this.jl(),uk.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),l=t?d.sessionStartTimestamp:n,this.Nl=void 0,p=!0}else h||(h=this.jl(),p=!0),g=g||a!==y,g&&(uk.info("adopted cross-tab session id",{sessionId:a,windowId:h}),p=!0);const _=Ae(c)&&t&&!f?c:n,w=Ae(l)?l:(new Date).getTime();this.Vl(h),this.Zl(a,_,w),t||this.Bl();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Fl.forEach(t=>t(a,h,k)),{sessionId:a,windowId:h,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:c}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:t})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const dk=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Qe(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Qe(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function vk(){return vk=re(function*(){const t=null==i?void 0:i.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return Ee(i)&&i.length>0?i:void 0}catch(t){return void Ar.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),vk.apply(this,arguments)}const fk="custom",pk="i.posthog.com",gk=/^\/static\//,mk=["/s/","/e/","/i/"];var yk=class{constructor(t){this.nu={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${pk}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.nu[this.apiHost]||(this.nu[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":fk),this.nu[this.apiHost]}su(t){if(!gk.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}ru(t){const e=Kr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}ou(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=Kr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&mk.some(t=>0===e.indexOf(t))){const t=this.ru(n);if(t){const e=this.apiHost;let i=this.au;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.au=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.au,i=this.ru(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.ou(t,e,this.uiHost+e);if("flags"===t)return this.ou(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.su(e);if(i)return this.ou(t,e,`${i}${e}`)}if(this.region===fk)return this.ou(t,e,this.apiHost+e);const i=pk+e;switch(t){case"assets":return this.ou(t,e,`https://${this.region}-assets.${i}`);case"api":return this.ou(t,e,`https://${this.region}.${i}`)}}};const bk=Or("[PostHog ExternalIntegrations]"),_k={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var wk=class{constructor(t){this._instance=t}zo(t,e){var i,n;null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return bk.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.zo(_k[s],()=>{var t;null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=h.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}},kk=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);const i={};for(const n of t){const t=null==e?void 0:e.get_property(n);Te(t)||(i[n]=t)}return i}set(t,e){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null===(e=this._instance.persistence)||void 0===e||e.unregister(t)}},Sk=class{constructor(t){this.instance=t,this.A=Ar,this.kv=new kk(t),this.onEvent=t=>Eg(this.instance._addCaptureHook((e,i)=>{if(i)try{t({event:e,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const e=e=>{try{t(e)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},i=this.instance.lu.on("extensionsRemoteConfig",e);return this.instance.uu&&e(this.instance.uu),Eg(i)}}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(R);return"string"==typeof t?t:void 0}get library(){return{name:Wl.LIB_NAME,version:Wl.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n,s;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==r?void 0:r.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==r?void 0:r.sessionStartTimestamp)&&void 0!==n?n:0,lastActivityTimestamp:null!==(s=null==r?void 0:r.lastActivityTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return xe(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(t){let e;switch(t){case jg:case"featureFlagsCommon":e=this.instance.featureFlags;break;case Bg:e=this.instance.logs;break;case zg:e=this.instance.surveys;break;case qg:e=this.instance.autocapture}return e}capture(t,e,i){i?this.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Eg(this.instance.cu(t))}sendRequest(t){var e=this;return re(function*(t,i={}){var n;const s=null!==(n=i.target)&&void 0!==n?n:"api",r=e.instance.requestRouter.endpointFor(s,t),o="api"===s&&"/i/v1/logs"===t,a={method:i.method,url:i.query?Bw(r,i.query):r,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?he.Base64:void 0,timestampMode:i.sentAt};return o&&(a.batchKey="logs"),"sendBeacon"===i.transport?(e.instance._send_request(a),{statusCode:202}):new Promise(t=>{a.callback=t,e.instance._send_request(a)})}).apply(this,arguments)}};const xk={};let $k=0;const Ck=()=>{},Tk='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ek="Surveys module not available",Ik="sanitize_properties is deprecated. Use before_send instead",Mk="Invalid value for property_denylist config: ",Rk=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Pk=["$feature_flag_called","$$heatmap","$snapshot"],Ak=t=>"$"===t.charAt(0)&&!ge(Pk,t),Ok=/^[A-Za-z0-9_-]{1,400}$/,Fk=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Dk=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Lk=["token","distinct_id",Ot],Nk="posthog",qk=t=>{const e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},jk=e=>{var i;return ue({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ur(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ck,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Ee(null==s?void 0:s.search)&&-1!==s.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==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Ar.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Yt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Ck},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:ko,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:qk(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},Bk=[["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"]],zk=t=>{const e={};for(const[i,n]of Bk)Te(t[i])||(e[n]=t[i]);const i=Lr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Te(n)||(Te(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Ee(n)&&Te(t.asset_host)&&(i.asset_host=n)),Se(t.property_blacklist)&&(Te(t.property_denylist)?i.property_denylist=t.property_blacklist:Se(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ar.error(Mk+t.property_denylist)),i};var Uk=class{constructor(){this.__forceAllowLocalhost=!1}get hu(){return this.__forceAllowLocalhost}set hu(t){Ar.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Hk=class e{du(t){if(!t)return;const e=this.vu.indexOf(t);-1!==e&&this.vu.splice(e,1)}fu(t,e){var i;return this.du(t),this.vu.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}pu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}gu(){if(this.mu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.pu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.yu)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.mu=!0,console.warn("[PostHog.js]",`${e} 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. ${n}`)}bu(){const t=this.persistence;if(!t||this._u)return;if(this.pu())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.wu(),this.ku()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.Su()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(Sl());this.register({distinct_id:e,$device_id:e}),t.set_property(Ct,Jt)}this.wu()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.xu=!1,this.$u=!1,this.webPerformance=new Uk,this.Cu=!1,this.version=Wl.LIB_VERSION,this.Tu=new Set,this.Iu="",this.lu=new lk,this.vu=[],this.Mu=[],this.Eu=!1,this.yu=!1,this.mu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jk(),this.SentryIntegration=lw,this.sentryIntegration=t=>function(t,e){const i=aw(t,e);return{name:ow,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Pu=!1,this.Ru=null,this.Au=null,this.Fu=null,this.scrollManager=new rk(this),this.pageViewManager=new uw(this),this.rateLimiter=new Rw(this),this.requestRouter=new yk(this),this.consent=new X_(this),this.externalIntegrations=new wk(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Ar.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Nk){var s;const r=null!==(s=xk[n])&&void 0!==s?s:new e;return r._init(t,i,n),xk[n]=r,xk[Nk][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const a=Ee(e)?e.trim():"";if(!a)return Ar.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=jk(i.defaults),i.debug=this.Ou(i.debug),this.Du=i,this.Lu=[],i.person_profiles?this.Au=i.person_profiles:i.process_person&&(this.Au=i.process_person);const u=jk(i.defaults),c=zk(i),h=Lr({},u,c,{name:n,token:a});$e(u.rageclick)&&$e(c.rageclick)&&(h.rageclick=Lr({},u.rageclick,c.rageclick)),$e(u.session_recording)&&$e(c.session_recording)&&(h.session_recording=Lr({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Ar.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:gg.GZipJS;const d=this.Su(),v=!this.pu();if(this.persistence=new Cw(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cw(ue(ue({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.Iu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Hl.At()){const t=Hl.Dt(this.Iu);Se(t)&&t.forEach(t=>{Ee(t)&&this.Tu.add(t)})}else Hl.Pt(this.Iu);const f=ue({},this.persistence.props),p=ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Nu=new ik((t,e)=>this.qu(t,e),this.config.request_queue_config),this.ju=new sk(this),this.__request_queue=[];const g=this.pu();g||(this.sessionManager=new hk(this),this.sessionPropsManager=new ak(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Bu()})),this.zu(),this.config.__preview_deferred_init_extensions?(Ar.info("Deferring extension initialization to improve startup performance"),this.Hu=setTimeout(()=>{this.Hu=void 0,this.Uu(g)},0)):(Ar.info("Initializing extensions synchronously"),this.Uu(g)),Wl.DEBUG=Wl.DEBUG||this.config.debug,Wl.DEBUG&&Ar.info("Starting in debug mode",{this:this,config:i,thisC:ue({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ue(ue({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.yu=!!m&&!Ie(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property(Ct);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Ar.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(Sl()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(Ct,i.bootstrap.isIdentifiedID?Kt:Jt),this.register({distinct_id:t,$device_id:n})}}if(g)this.register_once({distinct_id:At,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Sl());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(Ct,Jt)}return Hr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Hr(t,"pageshow",()=>{var t;this.xu=!1,this.$u||null===(t=this.ju)||void 0===t||t.resume()}),i.segment?rw(this,()=>this.Wu()):this.Wu(),xe(this.config._onCapture)&&this.config._onCapture!==Ck&&(Ar.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ar.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 vk.apply(this,arguments)}().then(t=>{t&&this.register({[P]:t})}).catch(Ck),this}Vu(t){const e=t;return Ee(e.name)&&xe(e.setup)}Gu(t,e){var i=this;this.Vu(t)?e.push(re(function*(){try{yield t.setup(i.Qu())}catch(i){Ar.error(`Failed to set up extension "${t.name}"`,i);try{var e;yield null===(e=t.dispose)||void 0===e?void 0:e.call(t)}catch(e){Ar.error(`Failed to dispose extension "${t.name}"`,e)}}})):this.vu.push(t)}zu(){var t,i,n,s=this;const r=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var o,a,l;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Zu)||void 0===o||o.call(this),this.Zu=void 0,this.featureFlags=new r(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)){if(!this.Zu){this.Zu=this.featureFlags.onReloading(()=>{this.lu.emit("featureFlagsReloading",!0)});const t=this.featureFlags;re(function*(){try{yield t.setup(s.Qu())}catch(e){Ar.error("Failed to set up feature flags",e);const i=s.Zu;s.Zu=void 0;try{null==i||i()}catch(t){Ar.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Ar.error("Failed to dispose feature flags",t)}}})()}}else null===(a=(l=this.featureFlags).initialize)||void 0===a||a.call(l)}Uu(t){const i=performance.now(),n=ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,a,l,u,c,h,d;n.exceptions&&this.vu.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.vu.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.vu.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.vu.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.vu.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Gu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Gu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Gu(this.logs=null!==(a=this.logs)&&void 0!==a?a:new n.logs(this),s),n.metrics&&this.vu.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new n.metrics(this)),n.conversations&&this.vu.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.vu.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.vu.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.vu.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.vu.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.vu.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,iw)),n.toolbar&&this.vu.push(this.toolbar=null!==(c=this.toolbar)&&void 0!==c?c:new n.toolbar(this)),n.experiments&&this.vu.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new n.experiments(this)),n.webMCP&&this.vu.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new n.webMCP(this)),this.vu.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Ju){const t=this.Ju;this.Ju=void 0,this.vu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Ku(s,i)}Ku(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void(this.Hu=setTimeout(()=>{this.Hu=void 0,this.Ku(t,e)},0));const i=t.shift();if(i)try{i()}catch(t){Ar.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ft]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:i}),this.config.__preview_deferred_init_extensions&&Ar.info(`PostHog extensions initialized (${i}ms)`)}el(t){if(!n||!n.body)return Ar.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.uu=t,this.compression=void 0,t.ok){var e;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ge(i.supportedCompression,gg.GZipJS)?gg.GZipJS:ge(i.supportedCompression,gg.Base64)?gg.Base64:void 0),(null===(e=i.analytics)||void 0===e?void 0:e.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Au?this.Au:Yt}),this.lu.emit("extensionsRemoteConfig",t),this.vu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Wu(){try{this.config.loaded(this)}catch(t){Ar.critical("`loaded` function failed",t)}if(this.Xu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.pu())&&this.Yu()},1),this.tc=new Aw(this),this.tc.load()}Xu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Nu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Fr(this.__request_queue,t=>this.qu(t)),this.__request_queue=[],this.Xu()}_handle_unload(){var t,e,i,n,s,r;this.xu=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.ec()&&this.capture(ee),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Nu)||void 0===s||s.unload(),null===(r=this.ju)||void 0===r||r.unload()):this.ec()&&this.capture(ee,null,{transport:"sendBeacon"})}_send_request(t){ek(this,t)}qu(t,e){this.ju?this.ju.retriableRequest(t,e):this._send_request(e?ue(ue({},t),{},{transport:e}):t)}_execute_array(t){$k++;try{let e;const i=[],n=[],s=[];Fr(t,t=>{if(t)if(e=t[0],Se(e))s.push(t);else if(xe(t))try{t.call(this)}catch(e){Ar.error("Error executing queued PostHog call",t,e)}else Se(t)&&"alias"===e?i.push(t):Se(t)&&-1!==e.indexOf("capture")&&xe(this[e])?s.push(t):n.push(t)});const r=function(t,e){Fr(t,function(t){try{if(Se(t[0])){let i=e;Dr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Ar.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{$k--}}push(t){if($k>0&&Se(t)&&Ee(t[0])){const i=e.prototype[t[0]];return void(xe(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nc(){return{property:F,persistenceKey:D,cookieName:"_fbc",pattern:Fk,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[D]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(D)}}}get sc(){return{property:L,persistenceKey:N,cookieName:"_fbp",pattern:Dk,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[N]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(N)}}}rc(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Ee(i)&&t.pattern.test(i)?{value:i,delivered:!1}:$e(i)&&Ee(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}oc(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ac(t){if(!this.config.save_campaign_params||this.pu())return;const e=ml(t.cookieName);return Ee(e)&&t.pattern.test(e)?e:void 0}lc(t,e,i,n){if(!this.persistence)return;const s=this.nc;this.persistence.refreshKey(s.persistenceKey);const r=this.rc(s);if(n)return void s.unregister();if(i)return Ee(e)&&Fk.test(e)?this.oc(s,e,r):void s.unregister();const o=Ee(t)&&Ok.test(t)?t:void 0,a=this.ac(s);return a&&((t,e,i)=>{const n=t.split(".");if(e)return n[3]===e;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(a,o,r)?this.oc(s,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.oc(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}uc(t,e,i){if(!this.persistence)return;const n=this.sc;this.persistence.refreshKey(n.persistenceKey);const s=this.rc(n);if(i)return void n.unregister();if(e)return Ee(t)&&Dk.test(t)?this.oc(n,t,s):void n.unregister();const r=this.ac(n);return r?this.oc(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}cc(t,e){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.rc(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}capture(t,e,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Nu))return void Ar.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Te(t)||!Ee(t))return void Ar.error("No event name provided to posthog.capture");if(this.bu(),"$snapshot"===t&&this.pu())return;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 Ar.critical("This capture call is ignored due to client rate limiting.");let a;(null==e?void 0:e.$current_url)&&!Ee(null==e?void 0:e.$current_url)&&(Ar.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||(null==i?void 0:i.hc)||Ar.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,u=(null==i?void 0:i.timestamp)||l,c=ln(null==i?void 0:i.uuid,Sl);let h={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},u,c)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),o&&(h.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const d="$feature_flag_called"===t&&!1===h.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!d&&(h.$set=null==i?void 0:i.$set);const v=$e(null==e?void 0:e.$set)?e.$set:void 0,f=Se(null==e?void 0:e.$unset)?e.$unset:[],p=(null==i?void 0:i.$unset)||[],g=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!v&&t in v,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},m=g(F),y=g(L),b=[{channel:this.nc,hasProvided:m.hasProvided,update:this.lc(null==a?void 0:a.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.sc,hasProvided:y.hasProvided,update:this.uc(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:e,update:i}of b)i&&!0===h.properties.$process_person_profile&&i.pending&&!e&&!d&&(h.$set=ue({[t.property]:i.value},h.$set));const _=null==i?void 0:i.$unset;_&&(h.$unset=_);const w=d?void 0:this.dc(null==i?void 0:i.$set_once,t!==ne,t===ie);if(w&&(h.$set_once=w),(null==i?void 0:i._noTruncate)||(k=this.config.properties_string_max_length,h=function(t,e){const i=new Set;return function t(n,s){if(n!==Object(n))return e?e(n):n;if(i.has(n))return;let r;if(i.add(n),Se(n))r=[],Fr(n,e=>{r.push(t(e))});else{const e={};Dr(je(n)?Br(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(h,t=>Ee(t)?t.slice(0,k):t)),h.timestamp=u,Te(null==i?void 0:i.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=l),d&&(h.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return us.forEach(n),e.forEach(n),i})(h.properties,Lk)),t===$g.DISMISSED||t===$g.SENT){const i=null==e?void 0:e[Cg.SURVEY_ID],n=null==e?void 0:e[Cg.SURVEY_ITERATION];Dg({id:i,current_iteration:n}),h.$set=ue(ue({},h.$set),{},{[Yl({id:i,current_iteration:n},t===$g.SENT?"responded":"dismissed")]:!0})}else t===$g.SHOWN&&(h.$set=ue(ue({},h.$set),{},{[Cg.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var k;if(t===Ew.SHOWN){const t=null==e?void 0:e[Iw.TOUR_TYPE];t&&(h.$set=ue(ue({},h.$set),{},{[`${Iw.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const S=ue(ue({},h.properties.$set),h.$set);if(Ce(S)||this.setPersonPropertiesForFlags(S),!Re(this.config.before_send)){const t=this.Os(h);if(!t)return;h=t,h.uuid=ln(h.uuid,Sl)}this.sessionRecording&&!this.Eu&&Ak(t)&&(this.Eu=!0,setTimeout(()=>this.Eu=!1,3e4));const x=b.filter(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=h.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:$e(null===(s=h.properties)||void 0===s?void 0:s.$set)?h.properties.$set[t.property]:void 0;return(null==e?void 0:e.pending)&&r===e.value});this.lu.emit("eventCaptured",h);const C=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(C),E=ue(ue(ue({method:"POST",url:C,data:h,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:T?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},T&&(null===(s=h.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),x.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:e}of x)this.cc(t,e.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)){var I;let t;!E.transport&&!E.callback&&Ce(null!==(I=this.config.request_headers)&&void 0!==I?I:{})&&this.xu&&(t="sendBeacon"),this.qu(E,t)}else this.Nu.enqueue(E);return h}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.vc)||void 0===e?void 0:e.getExtension(t)}Qu(){var t;return null!==(t=this.vc)&&void 0!==t?t:this.vc=new Sk(this)}cu(t){this.Mu.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.Mu.indexOf(t);-1!==i&&this.Mu.splice(i,1)}}fc(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Fu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.Tu.clear(),this.gc()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.bu(),this.persistence.syncCookieProperties(),this.fc();const l=a?void 0:this.persistence.remove_event_timer(e);let c=ue({},i);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.pu()&&(c[Ot]=!0),"$snapshot"===e){const t=ue(ue({},this.persistence.properties()),this.sessionPersistence.properties());return c.distinct_id=t.distinct_id,(!Ee(c.distinct_id)&&!Pe(c.distinct_id)||Ie(c.distinct_id))&&Ar.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}const h=function(e,i,n,r=!1){var o,a,l,c;if(!u)return{};const h=e?[..._u,...i||[]]:[],[d,v]=Zi(u),[f,p]=function(t){for(let e=0;Xi.length>e;e++){const[i,n,s]=Xi[e],r=t.match(i);if(r){const e=s&&t.match(s)||r;return[n,(null==e?void 0:e[1])||""]}}return["",""]}(u),g=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};Te(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,_=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,w=null==t||null===(l=t.screen)||void 0===l?void 0:l.width,k=null==t||null===(c=t.screen)||void 0===c?void 0:c.height,S=null==t?void 0:t.devicePixelRatio;Te(b)||(y.userAgentDataPlatform=b),Te(_)||(y.maxTouchPoints=_),Te(w)||(y.screenWidth=w),Te(k)||(y.screenHeight=k),Te(S)||(y.devicePixelRatio=S);const x=Lr(jr({$os:d,$os_version:v,$browser:Wi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Ji(u),$device_type:Ki(u,y),$timezone:bu(),$timezone_offset:Au()}),{$current_url:to(r?cn(null==s?void 0:s.href):null==s?void 0:s.href,h,ku),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Gi(u,navigator.vendor,g,m),$browser_language:Tu(),$browser_language_prefix:Eu(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:Rr.LIB_NAME,$lib_version:Rr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Rr.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Rr.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:e}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);c.$session_id=t,c.$window_id=e}this.sessionPropsManager&&Lr(c,this.sessionPropsManager.getSessionProps());try{var d;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,i=!this.Eu&&Ak(e);for(const e in t)(i||ge(Rk,e))&&(c[e]=t[e])}c.$sdk_debug_retry_queue_size=null===(d=this.ju)||void 0===d?void 0:d.length}catch(t){c.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===fk&&(c.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||a?"$pageleave"!==e||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),c=Lr(c,v),"$pageview"===e&&n&&(c.title=n.title),!Te(l)){const t=r.getTime()-l;c.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=c.$groups,m=f.$groups;$e(g)&&!Ce(g)&&(c.$groups=ue(ue({},$e(m)?m:{}),g)),Dr(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.Mu.length>0)for(const t of this.Mu.slice())try{Lr(y,t())}catch(t){Ar.error("Failed to produce browser extension event properties",t)}c=Lr({},h,f,p,ue(ue({},y),c)),c.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Dr(this.config.property_denylist,function(t){delete c[t]}):Ar.error(Mk+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const b=this.config.sanitize_properties;b&&(Ar.error(Ik),c=b(c,e));const _=this.mc();return c.$process_person_profile=_,_&&!a&&this.yc("_calculate_event_properties"),c}dc(t,e=!0,i=!1){var n;if(!this.persistence||!this.mc())return t;if(this.Cu&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Lr({},s,r||{},t||{});const a=this.config.sanitize_properties;return a&&(Ar.error(Ik),o=a(o,"$set_once")),e&&(this.Cu=!0),Ce(o)?void 0:o}register(t,e){var i;null===(i=this.persistence)||void 0===i||i.register(t,e)}register_once(t,e,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(t,e,i)}register_for_session(t){var e,i;null===(e=this.persistence)||void 0===e||e.syncCookieProperties(),this.fc(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.Tu.add(t)),this.gc()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.Tu.delete(t),this.gc()}bc(t,e){this.register({[t]:e})}Bu(){this.Tu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.Tu.clear(),this.gc()}gc(){var t;if(!this.Iu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.hi)||!Hl.At())return void Hl.Pt(this.Iu);const e=[];this.Tu.forEach(t=>e.push(t)),e.length>0?Hl.$t(this.Iu,e):Hl.Pt(this.Iu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.lu.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ek}),()=>{})}onSessionId(t){var e,i;return null!==(e=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e=!1){this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Ek})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Ek})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Ek}),()=>{})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Ng){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null===(e=this.surveys)||void 0===e||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Ek}}canRenderSurveyAsync(t,e=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Ek})}_c(t){return!t||Ie(t)?(Ar.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ar.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ar.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Ar.uninitializedWarning("posthog.identify");if(Pe(t)&&(t=t.toString(),Ar.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._c(t))return;if(!this.yc("posthog.identify"))return;this.bu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.fc(!1),o=this.persistence.Oa();let a=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(A),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Jt,u=t!==n,c=!u&&o;if(u&&o){var l;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property(Ct,Kt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.Fu=hu(t,e,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(c){this.persistence.set_property(Ct,Kt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:n,$set_once:s})&&(this.Fu=hu(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(k)):c&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.qa(a)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.yc("posthog.setPersonProperties"))return;const i=hu(this.get_distinct_id(),t,e);this.Fu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Fu=i)):Ar.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(Se(t)?t:[t]).filter(t=>Ee(t)&&t.length>0);0!==i.length&&this.yc("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Fu=null)}group(t,e,i){var n;if(!t||!e)return void Ar.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.fc();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ue(ue({},s),{},{[t]:e})}),(r||i)&&this.mc()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ne,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t=!0){var e;null===(e=this.featureFlags)||void 0===e||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e=!0){var i;this.yc("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Oe(t)?t:null==t?void 0:t.resetDeviceID,i=Oe(t)||null==t?void 0:t.bootstrap;this.wc(e,!1,i)}wc(t,e=!1,i){var n,s,r,o,a,l;if(Ar.info("reset"),!this.__loaded)return Ar.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Du)||void 0===n?void 0:n.bootstrap)||{},null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.il());const c=this.get_property(R),h=this.get_property(P),d=this.get_property(J);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();e||this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(a=this.persistence)||void 0===a||null===(l=a.Oa)||void 0===l?void 0:l.call(a),p=this._u;this._u=p||e;let g=!1;try{var m,y,b,_,w,k,S,x,C,T,E,I,M;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this.Tu.clear(),this.gc(),Te(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(_=this.featureFlags)||void 0===_||_.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(x=this.persistence)||void 0===x||x.set_property("$user_state","anonymous"),null===(C=this.sessionManager)||void 0===C||C.resetSessionId(),this.Fu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:At,$device_id:null},"");else{const e=this.config.get_device_id(Sl());this.register_once({distinct_id:e,$device_id:t?e:c},""),t||Te(h)||this.register({[P]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.pu()&&(null===(M=this.persistence)||void 0===M||M.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(E=this.featureFlags)||void 0===E||E.initialize(),!Re(u)&&!(null===(I=this.sessionManager)||void 0===I?void 0:I.setBootstrapSessionId(u,!0))){const t=ue({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var A,O;this._u=p,f&&(null===(A=this.persistence)||void 0===A||null===(O=A.qa)||void 0===O||O.call(A,g))}this.reloadFeatureFlags()}shutdown(t){var e=this;return re(function*(){if(!e.__loaded)return void Ar.uninitializedWarning("posthog.shutdown");e.$u=!0,clearTimeout(e.Hu),e.Hu=void 0;const t=e.Zu;e.Zu=void 0;for(const i of[()=>{var t;return null===(t=e.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=e.Nu)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.ju)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=i();t&&xe(t.then)&&t.then(void 0,t=>{Ar.error("Error during shutdown",t)})}catch(t){Ar.error("Error during shutdown",t)}})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.kc()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.Sc()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null===(e=this.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${e}`);if((null==t?void 0:t.withTimestamp)&&i){var s;const e=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-e,0)}`}return n}alias(t,e){return t===this.get_property("$people_distinct_id")?(Ar.critical("Attempting to create alias for existing People user - aborting."),-2):this.yc("posthog.alias")?(Te(e)&&(e=this.get_distinct_id()),t!==e?(this.bc(A,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ar.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=ue({},this.config);if($e(t)){var i,n,s,r,o,a,l,u,c,h,d,v,f,p;Lr(this.config,zk(t));const _=this.Su();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var g,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(g=this.sessionPersistence)||void 0===g||g.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,e,_),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Cw(ue(ue({},this.config),{},{persistence:"sessionStorage"}),_,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(ue(ue({},this.config),{},{persistence:"sessionStorage"}),ue(ue({},e),{},{persistence:"sessionStorage"}),_)}}const w=this.Ou(this.config.debug);var b;Oe(w)&&(this.config.debug=w),Oe(this.config.debug)&&(this.config.debug?(Wl.DEBUG=!0,Ml.At()&&Ml.$t("ph_debug",!0),Ar.info("set_config",{config:t,oldConfig:e,newConfig:ue({},this.config)})):(Wl.DEBUG=!1,Ml.At()&&Ml.Pt("ph_debug"))),null===(i=this.featureFlags)||void 0===i||null===(n=i.updateConfig)||void 0===n||n.call(i,this.config,this.il()),null===(s=this.exceptionObserver)||void 0===s||s.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(a=this.webMCP)||void 0===a||a.startIfEnabled(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(h=this.heatmaps)||void 0===h||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.wu(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&rw(this,Ck,!1)}}_overrideSDKInfo(t,e){Wl.LIB_NAME=t,Wl.LIB_VERSION=e}startSessionRecording(t){const e=!0===t,i={sampling:e||!!(null==t?void 0:t.sampling),linked_flag:e||!!(null==t?void 0:t.linked_flag),url_trigger:e||!!(null==t?void 0:t.url_trigger),event_trigger:e||!!(null==t?void 0:t.event_trigger)};var n,s,r,o,a;Object.values(i).some(Boolean)&&(null===(n=this.sessionManager)||void 0===n||n.checkAndGetSessionAndWindowId(),i.sampling&&(null===(s=this.sessionRecording)||void 0===s||s.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 t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,e){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ue(ue({},i),e))}catch(t){return}}addExceptionStep(t,e){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(t,e)}captureLog(t){var e;null===(e=this.logs)||void 0===e||e.captureLog(t)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e.xc}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null===(e=this.persistence)||void 0===e?void 0:e.props[t]}getSessionProperty(t){var e;return null===(e=this.sessionPersistence)||void 0===e?void 0:e.props[t]}toString(){var t;let e=null!==(t=this.config.name)&&void 0!==t?t:Nk;return e!==Nk&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(e=this.sessionPersistence)||void 0===e?void 0:e.get_property("$user_state"))}mc(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Ce(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.$epp))}ec(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.mc()||this.yc("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.yc("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}yc(t){return"never"===this.config.person_profiles?(Ar.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gu(),this.bc(Pt,!0),!0)}Su(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}wu(){var t,e;const i=this.Su();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.$c(),(null===(t=this.persistence)||void 0===t?void 0:t.hi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.hi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),this.gc(),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.pu()){var n,s,r,o,a,l;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.wc(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new hk(this),this.pageViewManager=new uw(this),this.persistence&&(this.sessionPropsManager=new ak(this,this.sessionManager,this.persistence));const t=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=e.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var u,c;t&&(this.sessionRecording=this.fu(this.sessionRecording,new t(this)),this.uu&&(null===(u=this.sessionRecording)||void 0===u||null===(c=u.onRemoteConfig)||void 0===c||c.call(u,this.uu)))}var h,d;this.consent.optInOut(!0),this.wu(),this.Xu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(h=this.surveys)||void 0===h||h.loadIfEnabled()),(Te(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Yu()}else Ar.warn(Tk)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.wu(),"on_reject"===this.config.cookieless_mode&&this.ku()):Ar.warn(Tk)}ku(){var t,e;const i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.wc(!0,!0),this.register({distinct_id:At,$device_id:null}),this.du(i),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(e=this.pageViewManager)||void 0===e||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Yu(),this.Xu()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this._u&&("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.wu()}_is_bot(){return i?dk(i,this.config.custom_blocked_useragents):void 0}Yu(){n&&("visible"===n.visibilityState?this.Pu||(this.Pu=!0,this.capture(te,{title:n.title},{send_instantly:!0}),this.Ru&&(n.removeEventListener(E,this.Ru),this.Ru=null)):this.Ru||(this.Ru=this.Yu.bind(this),Hr(n,E,this.Ru)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}il(){const t=this.Du||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ar.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,n,s){const r=e in t&&!Re(t[e]),o=i in t&&!Re(t[i]);return r?t[e]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Ar)}Os(t){var e;if(Re(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Le),n=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Re(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return De(t.event)?Ar.warn(`${e}. This can cause unexpected behavior.`):Ar.info(e),null}s.properties&&!Ce(s.properties)||Ar.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Ar.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Re(s.properties[e]))return Ar.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Wo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Ou(t){const e=Oe(t)&&!t,i=Ml.At()&&"true"===Ml.Ot("ph_debug");return!e&&(!!i||t)}};Hk.__defaultExtensionClasses={},Hk.xc=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=qr(t.prototype[e[i]])}(Hk,["identify"]);var Wk=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=$e(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.il(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Vk=Or("[ExceptionAutocapture]"),Gk=Or("[TracingHeaders]"),Qk=Or("[Web Vitals]"),Zk=9e5,Jk=["CLS","FCP","INP","LCP"],Kk=["INP","LCP"],Yk=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Xk=Or("[SessionRecording]"),tS=[Lt,Nt,qt,jt,Bt,zt,Ut,Ht,Wt],eS=Or("[Heatmaps]");function iS(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Pe(t.clientX)&&Pe(t.clientY)}const nS=Or("[Product Tours]"),sS=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(G))},rS=["$set_once","$set"],oS=Or("[SiteApps]"),aS="Error while initializing PostHog app with config id ",lS=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),uS="SDK is not enabled or survey functionality is not yet loaded",cS="Disabled. Not loading surveys.";var hS=class{constructor(t,e){this.wo=t,this.Cc=e,this.name=zg,this._surveyEventReceiver=null,this._surveyManager=null,this.Tc=!1,this.Ic=!1,this.Mc=[],this.Ec=[],this.Pc=null,this.Rc=null,this.To=!1,this.Ac=new Set,this.onRemoteConfig=t=>{if(this.To)return;if(this.Mr.disableSurveys)return;if(!t.ok)return this.Ic=!0,this.Fc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Ig.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Ig.warn("Flags not loaded yet. Not loading surveys.");this.Oc=Oe(e)?e:e.length>0,Ig.info(`flags response received, isSurveysEnabled: ${this.Oc}`),this.loadIfEnabled()},this.Fc=t=>{this.Ec.slice().forEach(e=>this.Dc(e,t))}}setup(t){if(!this.To)return this.Lc=t,lS(t.kv.initialize(),()=>{if(this.Lc!==t||this.To)return;this.Lc=void 0,this.bo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.To?e.dispose():(this.Eo=e,this.loadIfEnabled())})}dispose(){var t,e,i,n,s;this.To||(this.To=!0,this.Lc=void 0,this.bo=void 0,null===(t=this.Eo)||void 0===t||t.dispose(),this.Eo=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.Mc=[],this.Ec.forEach(t=>{t.active=!1}),this.Ec=[],null===(s=this.Nc)||void 0===s||s.call(this),this.Nc=void 0,this.Pc=null,this.Ac.forEach(t=>clearTimeout(t)),this.Ac.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.clearInMemoryInProgressSurveyState)||void 0===e||e.call(t);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.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(t=>localStorage.removeItem(t))}catch(t){}this.Fc()}loadIfEnabled(){if(this.To||!this.bo)return;const t=this.Mr;if(this._surveyManager)return;if(this.Tc)return void Ig.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Ig.info(cS);if(t.cookielessMode&&this.wo.isOptedOut())return void Ig.info("Not loading surveys in cookieless mode without consent.");const e=this.wo.getExtensions();if(!e)return void this.qc("PostHog Extensions not found.");if(Te(this.Oc)&&!t.advancedEnableSurveys)return;const i=this.Oc||t.advancedEnableSurveys;this.Tc=!0,this.Ic=!1;try{const t=e.generateSurveys;if(t)return this.jc(t,i),void(this.Tc=!1);const n=e.loadExternalDependency;if(!n)return this.qc(Zt),void(this.Tc=!1);n(t=>{try{if(this.To)return;const e=this.wo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.qc("Could not load surveys script",t):this.jc(e.generateSurveys,i)}finally{this.Tc=!1}})}catch(t){throw this.Tc=!1,this.qc("Error initializing surveys",t),t}}jc(t,e){var i,n;if(this.To)return;this._surveyManager=t(e),this._surveyEventReceiver=this.wo.createEventReceiver(this.Fc);const s=null===(i=null!==(n=this.bo)&&void 0!==n?n:this.Cc)||void 0===i?void 0:i.kv.get(ft);s&&this.Bc(s),Ig.info("Surveys loaded successfully"),this.zc(),this.Fc(),this.Hc({isLoaded:!0})}qc(t,e){this.Ic=!0,Ig.error(t,e),this.Fc({isLoaded:!1,error:t}),this.Hc({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Mc.push(t),this._surveyManager&&this.Hc({isLoaded:!0}),()=>{this.Mc=this.Mc.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.bo)&&void 0!==i?i:this.Cc;if(!n||this.To)return;if(this.Mr.disableSurveys)return Ig.info(cS),t([]);const s=n.kv.get(ft);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Uc()&&this.getSurveys(()=>{},!0));if(this.Pc)return void this.Pc.then(({surveys:e,context:i})=>{this.To||t(e,i)}).catch(t=>Ig.error("Error in survey callback",t));const r=this.Wc("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Vc(n,t)}catch(t){return Ig.error("Error processing surveys response",t),this.Vc(n,{statusCode:0,error:t})}},t=>this.Vc(n,{statusCode:0,error:t}));this.Pc=r;const o=()=>{this.Pc===r&&(this.Pc=null)};r.then(e=>{o(),this.To||(this.Fc(e.context),t(e.surveys,e.context))},o).catch(t=>Ig.error("Error in survey callback",t))}Wc(t,e){const i=this.bo;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(uS)}))}Vc(t,e){if(this.To)return{surveys:[],context:{isLoaded:!1,error:uS}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Ig.error(t):e.error||Ig.warn(t),this.Rc=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Rc=null;const n=e.json.surveys||[];return t.kv.set({[ft]:n,[pt]:Date.now()}),this.Bc(n),{surveys:n,context:{isLoaded:!0}}}Bc(t){var e;const i=t.filter(t=>Pg(t)&&(su(t)||Ag(t)));null===(e=this._surveyEventReceiver)||void 0===e||e.replace(i)}Uc(){return this.Gc()&&!this.Pc&&!this.Qc()}Gc(){var t,e;const i=null===(t=null!==(e=this.bo)&&void 0!==e?e:this.Cc)||void 0===t?void 0:t.kv.get(pt);return Pe(i)&&Date.now()-i>3e5}Qc(){return Pe(this.Rc)&&3e5>Date.now()-this.Rc}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Dg(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.Fc()}Hc(t){for(const e of this.Mc)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ig.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ig.warn("init was not called")}onActiveMatchingSurveysChanged(t){var e,i;if(this.To)return()=>{};const n={callback:t,active:!0,revision:0};this.Ec.push(n),this.zc();const s=null===(e=null!==(i=this.bo)&&void 0!==i?i:this.Cc)||void 0===e?void 0:e.kv.get(ft);return this.Mr.disableSurveys||!this._surveyManager&&this.Ic&&!this.Tc||!s&&!Re(this.Rc)&&!this.Pc?this.Dc(n,{isLoaded:!1}):this._surveyManager&&this.Dc(n),()=>{var t;n.active=!1,this.Ec=this.Ec.filter(t=>t!==n),0===this.Ec.length&&(null===(t=this.Nc)||void 0===t||t.call(this),this.Nc=void 0)}}zc(){var t,e,i;this._surveyManager&&this.Ec.length>0&&(null!==(t=this.Nc)&&void 0!==t||(this.Nc=null===(e=(i=this.wo).onMatchingConditionsChanged)||void 0===e?void 0:e.call(i,this.Fc)))}Dc(t,e){if(this.To||!t.active)return;const i=++t.revision,n=n=>{if(!this.To&&t.active&&i===t.revision)try{const i=null!=e?e:{isLoaded:!0},s=JSON.stringify([n,i]);if(s===t.lastResult)return;t.lastResult=s,t.callback(n,i)}catch(t){Ig.error("Error in active matching surveys callback",t)}};try{e&&!e.isLoaded?n([]):this.getActiveMatchingSurveys(n)}catch(t){Ig.error("Error in active matching surveys callback",t)}}Zc(t){let e=null;return this.getSurveys(i=>{var n;e=null!==(n=i.find(e=>e.id===t))&&void 0!==n?n:null}),e}Jc(t){if(Re(this._surveyManager))return{eligible:!1,reason:uS};const e="string"==typeof t?this.Zc(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Kc(t){if(!this.wo.isCapturing())return{eligible:!1,reason:Mg};if(Re(this._surveyManager))return{eligible:!1,reason:uS};const e="string"==typeof t?this.Zc(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Ig.warn("init was not called"),{visible:!1,disabledReason:uS};const e=this.Kc(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Ig.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:uS})):new Promise(i=>{this.getSurveys(e=>{var n;const s=null!==(n=e.find(e=>e.id===t))&&void 0!==n?n:null;if(s){const t=this.Kc(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.wo.isCapturing())return;if(Re(this._surveyManager))return void Ig.warn("init was not called");const r="string"==typeof t?this.Zc(t):t;if(!(null==r?void 0:r.id))return void Ig.warn("Survey not found");if(!Lg.includes(r.type))return void Ig.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Ig.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.Ac.delete(t),!this.To&&this.wo.isCapturing()&&(Ig.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Ig.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Ac.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Ig.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.wo.isCapturing())return;if(Re(this._surveyManager))return void Ig.warn("init was not called");const n=this.Zc(t);if(!n)return void Ig.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=ue(ue({},n),{},{appearance:ue(ue({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Tg.Popover&&e.initialResponses&&Ig.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Jc(n);if(!t.eligible)return void Ig.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==Tg.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Ig.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function dS(t,e,i){if(Re(t))return!1;switch(i){case"exact":return t===e;case"contains":{const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}var vS=class{constructor(t){this._instance=t,this.Xc=new Set,this.Yc=new Set,this.th=new lk,this.eh=(t,e)=>this.ih(t,e)&&this.nh(t,e)&&this.sh(t,e)&&this.rh(t,e),this.ih=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Te(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.oh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t,e;null===(t=this.oh)||void 0===t||t.call(this),this.oh=void 0,null===(e=this._instance)||void 0===e||null===(e=e.autocapture)||void 0===e||e.setElementSelectors(new Set,this),this.th=new lk}register(t){var e,i;if(!Te(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Xc.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Yc.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Xc.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t,this)}}replace(t){this.Xc.clear(),this.Yc.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Yc.has(t)||this.Yc.has(e.event))&&this.Xc.forEach(t=>{this.ah(e,t)&&this.th.emit("actionCaptured",t.name)})}uh(t){this.onAction("actionCaptured",e=>t(e))}ah(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.eh(t,i))return!0;return!1}onAction(t,e){return this.th.on(t,e)}nh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!dS(n,e.url,e.url_matching||"contains"))return!1}return!0}sh(t,e){return!!this.hh(t,e)&&!!this.dh(t,e)&&!!this.fh(t,e)}hh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.ph(t);if(n.length>0)return n.some(t=>dS(t.href,e.href,e.href_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&dS(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}dh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.ph(t);if(n.length>0)return n.some(t=>dS(t.text,e.text,e.text_matching||"exact")||dS(t.$el_text,e.text,e.text_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(t){const e=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Re(n=i.exec(t));)e.includes(n[1])||e.push(n[1]);return e}(s),o=e.text,a=e.text_matching||"exact",r.some(t=>dS(t,o,a)));var r,o,a}fh(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}ph(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}rh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||uu(e.properties.reduce((t,e)=>{const i=Se(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t},{}),null==t?void 0:t.properties)}},fS=class{constructor(t,e){var i,n;this.gh=[],this._instance=t,this.mh=e,this.yh=new Map,this.bh=new Map,this._h=new Map,this.wh=null===(i=this._instance)||void 0===i||null===(n=i.onSessionId)||void 0===n?void 0:n.call(i,t=>this.kh(t))}Sh(t){return!1}xh(){return null}$h(t){}Ch(){}Th(t,e){return!!t&&uu(t.propertyFilters,null==e?void 0:e.properties)}Ih(t,e){const i=new Map;return t.forEach(t=>{var n;null===(n=t.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(e=>{if(null==e?void 0:e.name){const n=i.get(e.name)||[];n.push(t.id),i.set(e.name,n)}})}),i}Mh(t,e,i){const n=(i===mg.Activation?this.yh:this.bh).get(t);let s=[];return this.Eh(t=>{s=t.filter(t=>null==n?void 0:n.includes(t.id))}),s.filter(n=>{var s;const r=null===(s=n.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s?void 0:s.find(e=>e.name===t);return this.Th(r,e)})}register(t){this.Ph(t,!1)}replace(t){this.Ph(t,!0)}Ph(t,e){var i;Te(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.Rh(t,e),this.Ah(t,e))}Ah(t,e){const i=t.filter(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length});var n;if(e&&this._h.clear(),0===i.length)return void(e&&(null===(n=this.Fh)||void 0===n||n.replace([])));this.Fh||(this.Fh=new vS(this._instance),this.Fh.init(),this.Fh.uh(t=>this.onAction(t)));const s=[];i.forEach(t=>{var e;null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||e.values.forEach(e=>{if(s.push(e),e.name){var i;const n=null!==(i=this._h.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this._h.set(e.name,n)}})}),e?this.Fh.replace(s):this.Fh.register(s)}Oh(t,e){e.forEach((e,i)=>{var n;const s=null!==(n=t.get(i))&&void 0!==n?n:[];e.forEach(t=>{s.includes(t)||s.push(t)}),t.set(i,s)})}Rh(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.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.Ih(t,mg.Activation),a=this.Ih(t,mg.Cancellation);e?(this.yh=o,this.bh=a):(this.Oh(this.yh,o),this.Oh(this.bh,a)),(0!==s.length||0!==r.length||t.some(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length}))&&(null!==(i=this.oh)&&void 0!==i||(this.oh=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Dh(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const i=this.Lh(t,r,e);if("consume"===i)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Nh([r]);if("persist"===i)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.qh(r),void this.jh([r])}if(this.bh.has(t)){const i=this.Mh(t,e,mg.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Nh(i.map(t=>t.id)),i.forEach(t=>this.Bh(t.id)))}if(!this.yh.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.yh.get(t)});const o=this.Mh(t,e,mg.Activation);this.zh(o.map(t=>t.id))}onAction(t){this._h.has(t)&&this.zh(this._h.get(t)||[])}zh(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.Sh(e)?this.qh(e)&&this.Hh(e):s.push(e);s.length>0&&(this.gh=[...new Set([...this.gh,...s])]),this.Dh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uh()}qh(t){this.gh=this.gh.filter(e=>e!==t);const e=this.Wh();return!e.includes(t)&&(this.Vh([...e,t]),this.Gh(),!0)}Nh(t){const e=new Set(t);this.gh=this.gh.filter(t=>!e.has(t));const i=this.Qh(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Vh(n),0===n.length&&this.Zh()),this.jh(t),this.Uh()}Uh(){try{var t;null===(t=this.mh)||void 0===t||t.call(this)}catch(t){this.Dh().error("Error while handling activated items change",t)}}Jh(){var t;const e=this.xh();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Hh(t){if(!this.xh())return;const e=this.Jh();this.$h(ue(ue({},e),{},{[t]:Date.now()}))}jh(t){if(!this.xh())return;const e=this.Jh(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(Ce(i)?this.Ch():this.$h(i))}Kh(){this.xh()&&this.Ch()}getActivationTimestamp(t){if(!this.Wh().includes(t))return;const e=this.Jh()[t];return Pe(e)?e:void 0}Qh(){var t;const e=this.Xh();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}Wh(){var t,e,i;const n=this.Qh();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Yh()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}Gh(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.td(i)}Zh(){this.ed()}kh(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Yh()];if(i&&i!==t){const t=this.Qh(),e=this.Jh();t.length>0&&(this.Vh([]),t.filter(t=>Pe(e[t])).forEach(t=>this.Bh(t))),this.Zh(),this.Kh(),t.length>0&&this.Uh()}}getActivatedIds(){return[...new Set([...this.Wh(),...this.gh])].filter(t=>!this.nd(t))}dispose(){var t,e,i;null===(t=this.wh)||void 0===t||t.call(this),this.wh=void 0,null===(e=this.oh)||void 0===e||e.call(this),this.oh=void 0,null===(i=this.Fh)||void 0===i||i.dispose(),this.Fh=void 0}reset(){this.gh=[],this.Qh().length>0&&this.Vh([]),this.Zh(),this.Kh(),this.Uh()}getEventToItemsMap(){return this.yh}sd(){return this.Fh}},pS=class extends fS{constructor(t,e){super(t,e)}Xh(){return gt}Yh(){return mt}xh(){return yt}$h(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}Ch(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}Sh(t){var e;let i;this.Eh(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Pe(n)&&n>0}rd(){return $g.SHOWN}Eh(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Bh(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}Dh(){return Ig}Vh(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}td(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}ed(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}nd(){return!1}Lh(t,e,i){var n;if(t===$g.SENT&&!1===(null==i||null===(n=i.properties)||void 0===n?void 0:n.$survey_completed))return"ignore";let s;return this.Eh(t=>{s=t.find(t=>t.id===e)}),!s||ru(s)?t===$g.SHOWN?"consume":"ignore":t===$g.SHOWN?"persist":t===$g.DISMISSED||t===$g.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},gS=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Te(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},mS=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==h?void 0:h.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(t){return new pS(this._instance,t)}onMatchingConditionsChanged(e){const i=this._instance._addCaptureHook(t=>{"$pageview"!==t&&t!==$g.SHOWN&&t!==$g.DISMISSED&&t!==$g.SENT||e()}),n=()=>e();Hr(t,"PHSurveyShown",n);let s=!1;const r=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,i(),r(),null==t||t.removeEventListener("PHSurveyShown",n)}}};const yS=(null==t?void 0:t.location)?eo(t.location.hash,"__posthog")||eo(location.hash,"state"):null,bS="_postHogToolbarParams",_S=Or("[Toolbar]"),wS=Or("[FeatureFlags]"),kS=Or("[FeatureFlags]",{debugEnabled:!0}),SS="\" failed. Feature flags didn't load in time.",xS=[502,504],$S=["click","keydown","wheel","touchstart","pointerdown"],CS="connection_error",TS=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},ES=t=>{const e={};for(const[i,n]of Nr(t||{}))n&&(e[i]=n);return e};var IS=class{constructor(t){this.name="featureFlags",this.od=!1,this.featureFlagEventHandlers=[],this.A=wS,this.ad={},this.ld={},this.ud=[],this.hd=new Set,this.dd=new Set,this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const t=this.kd();this._d=0,t&&this.reloadFeatureFlags()},this.Sd=()=>{var t,e;const i=this.xd,n=null!==(t=this.$d)&&void 0!==t?t:i;Te(i)||Te(n)||this.Mr.remoteRequestsDisabled||!this.Cd||"hidden"===this.Cd.visibilityState||Date.now()-(null!==(e=this.Td)&&void 0!==e?e:0)<n||(this.$d=this.wd||!this.Mr.idleRefreshBackoff?i:Math.min(2*n,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Id())},this.Md=()=>{this.wd&&this.$d===this.xd||this.Ed()},this.sn=()=>{var t;"visible"===(null===(t=this.Cd)||void 0===t?void 0:t.visibilityState)&&this.Ed()},this.wo=t}get Pd(){}Rd(){this.bo&&this.Ad()}setup(t){try{this.Fd=typeof window>"u"?void 0:window,this.Cd=typeof document>"u"?void 0:document}catch(t){this.Fd=void 0,this.Cd=void 0}return this.Lc=t,this.A=t.logger.createLogger("[FeatureFlags]"),lS(t.kv.initialize(),()=>{this.Lc===t&&(this.Lc=void 0,this.bo=t,this.Od(t))})}Od(t){var e;if(this.bo===t)return this.Fd&&Hr(this.Fd,"online",this.rn),this.Ad(),this.Dd=t.registerDynamicEventProperties(()=>this.Ld()?this.ad:this.ld),this.Nd=null===(e=this.Pd)||void 0===e?void 0:e.onCrossTabFeatureFlagChange(()=>{this.qd(),this.jd(),this.Bd()}),this.jd(),this.initialize()}Ed(){this.wd=!0,this.$d=this.xd,this.Sd()}Ad(){var t;const e=this.Mr.refreshIntervalMs,i=!this.Mr.remoteRequestsDisabled&&this.Cd&&!Te(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.$d=i),i!==this.xd&&(this.zd(),Te(i)||(this.xd=i,this.$d=i,this.Id(),(null===(t=this.Cd)||void 0===t?void 0:t.addEventListener)&&(Hr(this.Cd,E,this.sn),Fr($S,t=>{Hr(this.Cd,t,this.Md,{capture:!0})}))))}Id(){Te(this.xd)||(Te(this.Hd)||clearInterval(this.Hd),this.Td=Date.now(),this.Hd=setInterval(this.Sd,this.xd))}zd(){var t,e;Te(this.Hd)||(clearInterval(this.Hd),this.Hd=void 0,null===(t=this.Cd)||void 0===t||null===(e=t.removeEventListener)||void 0===e||e.call(t,"visibilitychange",this.sn),Fr($S,t=>{var e,i;null===(e=this.Cd)||void 0===e||null===(i=e.removeEventListener)||void 0===i||i.call(e,t,this.Md,{capture:!0})})),this.xd=void 0,this.$d=void 0,this.wd=!1,this.Td=void 0}destroy(){this.Ud()}dispose(){this.Ud()}Ud(){var t,e,i;this.zd(),this.pd++,this.md=!1,this.Lc=void 0,this.Wd(this.hd,"cancelled"),this.Wd(this.dd,"cancelled"),this.bo&&(this.Vd(),null===(t=this.Dd)||void 0===t||t.dispose(),this.Dd=void 0,null===(e=this.Nd)||void 0===e||e.call(this),this.Nd=void 0,this.ud=[],null===(i=this.Fd)||void 0===i||i.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Gd(t){var e;return this.Qd&&t in this.Qd?this.Qd[t]:null===(e=this.bo)||void 0===e?void 0:e.kv.get(t)}qd(){return!!this.Qd&&(this.Qd=void 0,!0)}Zd(){var t;return!Te(null===(t=this.bo)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.qd()}$t(t){this.Jd(()=>{var e;return null===(e=this.bo)||void 0===e?void 0:e.kv.set(t)})}Kd(t,e,i){if(!this.Pd||!t.$enabled_feature_flags)return;const n=this.Gd("$enabled_feature_flags")||{},s=t.$enabled_feature_flags||{},r=e.flags||e.featureFlags,o=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!e.errorsWhileComputingFlags&&!!e.flags,l=a?o:i&&!Se(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(n),...Object.keys(s)])),u=this.Gd("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},h=a||i?l:Array.from(new Set([...Object.keys(u),...Object.keys(c)])),d=!a&&!i,p=!!d||l,_=!!d||h,w={[v]:p,[b]:p,[x]:_};t.$feature_flag_details&&(w[f]=p);for(const e of[m,g,y])Te(t[e])||(w[e]=!0);this.Pd.markCrossTabFeatureFlagChanges(w)}Pt(t){this.Jd(()=>{var e;return null===(e=this.bo)||void 0===e?void 0:e.kv.remove(t)})}Jd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}jd(){const t={};for(const e of[v,x,m,C]){const i=this.Gd(e);Te(i)||(t[e]=i)}this.ad=t;const e=ue({},t),i=this.Gd(b);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.ld=e}Ld(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Gd(g);return"number"!=typeof e||Date.now()-e>t}Xd(){return!!this.Ld()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Yd(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}tv(){const t=this.Mr.flagKeys;if(!Te(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Mr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Te(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.ev({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.Gd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.Gd("$feature_flag_payloads"))&&void 0!==s?s:{},a=ue(ue({},r),t),l=ue(ue({},o),e),u={};for(const[t,e]of Object.entries(a))u[t]={key:t,enabled:as(e),variant:ls(e),reason:void 0,metadata:Te(null==l?void 0:l[t])?void 0:{id:0,version:void 0,description:void 0,payload:l[t]}};this.ev({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Gd(f),e=this.Gd(C),i=this.Gd(T);if(!i&&!e)return t||{};const n=Lr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r,o;const s=n[t],a=null==e?void 0:e[t],l=Te(a)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!a,u=Te(a)?null==s?void 0:s.variant:"string"==typeof a?a:void 0,c=null==i?void 0:i[t],h=ue(ue({},s),{},{enabled:l,variant:l?null!=u?u:null==s?void 0:s.variant:void 0});l!==(null==s?void 0:s.enabled)&&(h.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(h.original_variant=null==s?void 0:s.variant),c&&(h.metadata=ue(ue({},null==s?void 0:s.metadata),{},{payload:c,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=h}return this.od||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.od=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:as(n),variant:ls(n),payload:os(e[i])}})}getFlagVariants(){const t=this.Gd(b),e=this.Gd(C);if(!e)return t||{};const i=Lr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.od||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.od=!0),i}getFlagPayloads(){const t=this.Gd(x),e=this.Gd(T);if(!e)return t||{};const i=Lr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.od||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.od=!0),i}reloadFeatureFlags(){this.gd||this.Mr.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.iv||(this.ud.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.iv=setTimeout(()=>{this.nv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.gd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.kd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.hd.add(t),this.reloadFeatureFlags()})}Wd(t,e){t.forEach(t=>t({status:e})),t.clear()}Vd(){clearTimeout(this.iv),this.iv=void 0}onReloading(t){return this.ud.push(t),()=>{this.ud=this.ud.filter(e=>e!==t)}}ensureFlagsLoaded(){this.vd||this.fd||this.iv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.Pt(k)}nv(t){var e;this.Vd();const i=this.bo;if(!i||this.Mr.remoteRequestsDisabled||this.kd())return void this.Wd(this.hd,"skipped");if(this.fd)return void(this.md=!0);const n={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ue(ue(ue({},i.initialPersonProperties),this.Gd("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Gd(_),timezone:bu()};Te(i.deviceId)||(n.$device_id=i.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(n.disable_flags=!0);const s=this.Yd();s.length&&(n.evaluation_contexts=s);const r=this.tv();Te(r)||(n.flag_keys=r);const o=this.Mr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.pd,u=this.hd;this.hd=new Set,this.dd=u,this.fd=!0;const c=()=>{this.md&&(this.md=!1,this.nv())},h=t=>{var e,i;const s=null!==(e=t.json)&&void 0!==e?e:{},r=200!==t.statusCode;if(this.fd=!1,l!==this.pd)return void c();if(this.sv(t.statusCode),r||this.md||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.md)return void this.Wd(u,"skipped");this.yd=!r;const a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?CS:"unknown_error"):200!==t.statusCode&&a.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");const h=!!(null===(i=s.quotaLimited)||void 0===i?void 0:i.includes("feature_flags"));h&&a.push("quota_limited"),this.$t({[p]:a}),h?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.ev(s,r,{partialResponse:o}),this.Wd(u,n.disable_flags?"skipped":a.length||!s.flags&&!s.featureFlags?"error":"loaded"),c()},d=t=>{this.fd=!1,l===this.pd?(this.$t({[p]:[CS]}),this.A.error("Feature flag request failed",t),this.Zd()&&this.Bd(!0),this.Wd(u,"error"),c()):c()};let v=null!==(e=this.Mr.requestMaxRetries)&&void 0!==e?e:1;const f=()=>v>0&&l===this.pd,g=()=>{if(l!==this.pd||!this.bo||this.Mr.remoteRequestsDisabled)return this.fd=!1,this.Wd(u,"skipped"),void c();try{i.sendRequest(a,{target:"flags",method:"POST",body:n,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{if((t=>xS.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(g,500);h(t)}).catch(d)}catch(t){d(t)}};g()}kd(){return Gr(this._d,3)}sv(t){this._d=Qr(t,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+t+SS);if(this.Xd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+t+SS);if(this.Xd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),a=this.Gd("$feature_flag_request_id")||void 0,l=this.Gd("$feature_flag_evaluated_at")||void 0;let u,c=this.Gd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var h;const t=null===(h=this.bo)||void 0===h||null===(h=h.session)||void 0===h?void 0:h.sessionId,e=this.Gd(S);t&&t!==e&&(c={},u=t)}if(!e.send_event&&"send_event"in e)u&&this.$t({[k]:c,[S]:u});else if(t in c&&c[t].includes(o))u&&this.$t({[k]:c,[S]:u});else{var d,v,f,p,g,m,y,b,_,w,x,C,T;Se(c[t])?c[t].push(o):c[t]=[o],this.$t(ue({[k]:c},u?{[S]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.Gd("$feature_flag_errors"))&&void 0!==d?d:[]];Te(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Mr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.yd};Te(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Te(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const h=null!==(b=null==e||null===(_=e.reason)||void 0===_?void 0:_.description)&&void 0!==b?b:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;h&&(n.$feature_flag_reason=h),(null==e||null===(x=e.metadata)||void 0===x?void 0:x.id)&&(n.$feature_flag_id=e.metadata.id),Te(null==e?void 0:e.original_variant)&&Te(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Te(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(C=e.metadata)||void 0===C?void 0:C.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(T=e.metadata)||void 0===T?void 0:T.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.rv(n)}return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:os(r)}:void 0}rv(t){try{var e;null===(e=this.bo)||void 0===e||e.capture("$feature_flag_called",t)}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.ov(t,e)}ov(t,e){var i=this;return re(function*(){const n=i.bo;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.Yd();r.length&&(s.evaluation_contexts=r);const o=i.tv();let a;Te(o)||(s.flag_keys=o);try{var l;const e=null===(l=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==e?void 0:e[t])||void 0}catch(t){return void i.A.error("Remote config feature flag request failed",t)}try{e(a)}catch(t){i.A.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.yd)return e.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+SS),e.defaultValue;const i=this.getFeatureFlag(t,e);return Te(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){this.ev(t,e,i)}ev(t,e,i){if(!this.bo)return;this.vd=!0;const n=((t,e={},i={},n={},s,r=wS)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!Te(null===(e=i[t].metadata)||void 0===e?void 0:e.payload)}).map(t=>{var e;return[t,null===(e=i[t].metadata)||void 0===e?void 0:e.payload]}));return ue(ue({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(!l)return;const c=t.requestId,h=t.evaluatedAt;if(Se(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(l)for(let e=0;l.length>e;e++)t[l[e]]=!0;return{[v]:l,[b]:t,[y]:!1}}let d=l,p=u,_=a;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=p||{};d=ue(ue({},e),d),p=ue(ue({},i),s),t.forEach(t=>{t in s||null==p||delete p[t]}),_=ue(ue({},n),_)}else if(t.errorsWhileComputingFlags)if(a){const t=new Set(Object.keys(a).filter(t=>{var e;return!(null===(e=a[t])||void 0===e?void 0:e.failed)}));d=ue(ue({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(p||{}).filter(([e])=>t.has(e)));p=ue(ue({},i),s),t.forEach(t=>{t in s||null==p||delete p[t]}),_=ue(ue({},n),Object.fromEntries(Object.entries(_||{}).filter(([e])=>t.has(e))))}else d=ue(ue({},e),d),p=ue(ue({},i),p),_=ue(ue({},n),_);return ue(ue({[v]:Object.keys(ES(d)),[b]:d||{},[x]:p||{},[f]:_||{},[y]:!0===t.minimalFlagCalledEvents},c?{[m]:c}:{}),h?{[g]:h}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.A);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Te(this.bo.kv.get(b));this.Qd=n,t||this.$t(n)}else this.qd(),this.Kd(n,t,!!(null==i?void 0:i.partialResponse)),this.$t(n);else e&&this.Zd();e||(this.bd=!1),this.Bd(e)}override(t,e=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.av(t)}av(t){if(this.bo){if(!1===t)return this.Pt([C,T]),this.Bd(),void kS.info("All overrides cleared");if(Se(t))return this.$t({[C]:TS(t)}),this.Bd(),void kS.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.od=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[C]=Se(s)?TS(s):s),r&&(n[T]=r),Object.keys(n).length&&this.$t(n),!1===s&&!1===r?this.Pt([C,T]):!1===s?this.Pt(C):!1===r&&this.Pt(T),this.Bd(),!1===s?kS.info("Flag overrides cleared"):s&&kS.info("Flag overrides set",{flags:s}),void(!1===r?kS.info("Payload overrides cleared"):r&&kS.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[C]:t}),this.Bd(),void kS.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){const{flags:e,flagVariants:i}=this.lv();try{t(e,i)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.Gd("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const a=ue(ue({},this.getFlagVariants()),{},{[t]:e});null===(n=this.Pd)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.$t({[v]:Object.keys(ES(a)),[b]:a,[w]:ue(ue({},this.Gd("$stored_person_properties")||{}),r)}),this.Bd();try{var l;null===(l=this.bo)||void 0===l||l.capture("$feature_enrollment_update",o)}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.Gd(d);!n||e?this.uv(t,i):t(n)}uv(t,e){var i=this;return re(function*(){const n=i.bo;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.$t({[d]:r})}catch(t){return void i.A.error("Early access feature request failed",t)}try{t(r)}catch(t){i.A.error("Early access feature callback failed",t)}})()}lv(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}Bd(t){this.jd();const{flags:e,flagVariants:i}=this.lv();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.hv(t,e)}hv(t,e=!0){const i=this.Gd("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.$t({[w]:ue(ue(ue({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=ue({},this.Gd("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.$t({[w]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Pt(w),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.Gd("$stored_group_properties")||{},n=ue({},i);for(const e of Object.keys(t))n[e]=ue(ue({},i[e]),t[e]);this.$t({[_]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Gd("$stored_group_properties")||{};this.$t({[_]:ue(ue({},e),{},{[t]:{}})})}else this.Pt(_)}reset(){this.pd++,this.Wd(this.hd,"cancelled"),this.Wd(this.dd,"cancelled"),this.md=!1,this.ad={},this.ld={},this.Qd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Vd(),this.od=!1,this._d=0}};const MS=Or("[FeatureFlags]");var RS=class{constructor(t,e=!1){this.dv=!1,this.update(t,e)}update(t,e){this.vv=((t,e)=>{var i,n,s,r,o,a,l,u;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Te(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(a=t.feature_flag_request_max_retries)&&void 0!==a?a:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:Se(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.dv||(MS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.dv=!0),Te(t.flag_keys)||Se(t.flag_keys)||MS.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.vv}};const PS="Refusing to render web experiment since the viewer is a likely bot",AS={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ou(e,t),not_regex:(t,e)=>!ou(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},OS=Or("[Conversations]"),FS="Conversations not available yet.";function DS(t,e){var i,n,s,r,o,a,l;const u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,c=null!==(n=null==t?void 0:t.maxBufferSize)&&void 0!==n?n:100,h=(null==e?void 0:e.consoleCapture)?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,d=Te(h)?Math.max(c,2048):Math.max(c,h),v=ue(ue({},function(){let t="",e="";try{var i;const n="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,s=null==n||null===(i=n.navigator)||void 0===i?void 0:i.userAgent;s&&([t,e]=Zi(s))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(fr,t)?fr[t]:t}(t);return ue(ue({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==v?void 0:v["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==v?void 0:v["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const LS=["debug","log","warn","error","info"],NS="console",qS="__posthogHandledLogsRequestError",jS=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[qS]=!0,i},BS=t=>!!t&&"object"==typeof t&&!0===t[qS];var zS=class{get fv(){return ue(ue({},this.A),{},{error:(...t)=>{t.some(BS)||this.A.error(...t)}})}constructor(t,e){var i;this.wo=t,this.pv=e,this.name="logs",this.gv=!1,this.mv=!1,this.yv=!1,this.A=Or("[logs]"),this.ol=[],this.bv=[],this._d=0,this._v=!1,this.To=!1,this.wv=[],this.Sv=[],this.xv=!1,this.$v=!1,this.Cv=!1,this.Tv=()=>{var t,e;this.To||(this._d=0,null===(t=this.Iv)||void 0===t||t.onReconnect(),null===(e=this.Mv)||void 0===e||e.onReconnect())},this.gv=!!(null===(i=t.get())||void 0===i?void 0:i.captureConsoleLogs)}get Ev(){return!0}Pv(){}Rv(){if(!this.Cv){try{this.Fd=typeof window>"u"?void 0:window}catch(t){this.Fd=void 0}this.Fd&&(Hr(this.Fd,"online",this.Tv),this.Cv=!0)}}Av(t,e,i,n){this.Rv();const s=DS(this.wo.get(),i);return[new xr(this.Fv(t,e),s,this.fv,()=>this.pv(),t=>t(),void 0,n),s]}Ov(){const t=this.wo.get();var e;return this.Iv&&this.Dv===t||(null===(e=this.Iv)||void 0===e||e.reset(),this.Dv=t,[this.Iv,this.Lv]=this.Av(()=>this.ol,t=>{this.ol=t})),this.Iv}Nv(){const t=this.wo.get();var e;return this.Mv&&this.qv===t||(null===(e=this.Mv)||void 0===e||e.reset(),this.qv=t,[this.Mv,this.jv]=this.Av(()=>this.bv,t=>{this.bv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},NS)),this.Mv}setup(t){if(!this.To&&!this._v)return this._v=!0,this.bo=t,this.A=t.logger.createLogger("[logs]"),lS(t.kv.initialize(),()=>{this.To||this.Od(t)})}Od(t){var e;this.Rv(),(null===(e=this.wo.get())||void 0===e?void 0:e.captureConsoleLogs)&&(this.gv=!0),(this.gv||this.wo.remoteConfigWillArrive&&t.kv.get(this.wo.captureHintKey))&&this.Bv();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.To?n.dispose():(this.Eo=n,i||this.loadIfEnabled())}dispose(){var t,e,i,n,s,r,o;this.To||(this.To=!0,this.zv(),null===(t=this.Eo)||void 0===t||t.dispose(),this.Eo=void 0,this.bo=void 0,this.yv=!1,null===(e=this.Fd)||void 0===e||e.removeEventListener("online",this.Tv),null===(i=this.Hv)||void 0===i||i.call(this),this.Hv=void 0,null===(n=this.Iv)||void 0===n||n.clearQueue(),null===(s=this.Mv)||void 0===s||s.clearQueue(),null===(r=this.Iv)||void 0===r||r.reset(),null===(o=this.Mv)||void 0===o||o.reset())}onRemoteConfig(t){var e,i;if(this.To)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.Uv():(null===(i=this.bo)||void 0===i||i.kv.set(this.wo.captureHintKey,!!n),n?(this.gv=!0,this.mv||this.Bv(),this.loadIfEnabled()):this.Uv())}reset(){var t,e,i,n;this.zv(),null===(t=this.Iv)||void 0===t||t.clearQueue(),this.ol=[],null===(e=this.Iv)||void 0===e||e.reset(),null===(i=this.Mv)||void 0===i||i.clearQueue(),this.bv=[],null===(n=this.Mv)||void 0===n||n.reset(),this._d=0}captureLog(t){!this.To&&this.bo&&this.Ov().captureLog(t)}captureConsoleLog(t){!this.To&&this.bo&&this.Nv().captureLog(t)}captureBufferedConsoleLog(t,e,i){!this.To&&this.bo&&this.Nv().captureLog(t,{context:e,occurredAtMs:i})}$c(){var t;this.zv(),null===(t=this.Mv)||void 0===t||t.clearQueue(),this.bv=[]}Uv(){this.gv||this.zv()}Bv(){var t;if(this.xv||!(null===(t=this.Fd)||void 0===t?void 0:t.console))return;const e=DS(this.wo.get()).maxBufferSize;let i=!0;this.Sv.push(()=>{i=!1});for(const t of LS){let n;try{n=cy(this.Fd.console[t])}catch(t){continue}n&&this.Sv.push(Sf(this.Fd.console,t,s=>{const r=(...n)=>{try{i&&this.Wv(t,n,e)}catch(t){}return s.apply(this.Fd.console,n)};return r.__rrweb_original__=n,r}))}this.xv=!0,this.Vv=setTimeout(()=>{this.zv()},3e4)}Wv(t,e,i){var n;if(this.xv&&!this.$v&&0!==e.length)if(null===(n=this.bo)||void 0===n?void 0:n.canCapture){if(i>this.wv.length){this.$v=!0;try{this.wv.push({level:t,args:e,occurredAtMs:Date.now(),context:this.pv()})}finally{this.$v=!1}}}else this.zv()}zv(){if(this.wv=[],this.xv){this.xv=!1,this.Vv&&(clearTimeout(this.Vv),this.Vv=void 0);for(const t of this.Sv)t();this.Sv=[]}}Gv(){const t=this.wv;return this.zv(),t}get logger(){return this.Qv||(this.Qv={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Qv}flushLogs(t){this.bo&&(t?this.Zv(t):(this.Iv&&this.Iv.flush().catch(t=>this.Jv(t)),this.Mv&&this.Mv.flush().catch(t=>this.Jv(t))))}flush(){var t=this;return re(function*(){var e,i;const n=null===(e=t.Iv)||void 0===e?void 0:e.flush().catch(e=>t.Jv(e)),s=null===(i=t.Mv)||void 0===i?void 0:i.flush().catch(e=>t.Jv(e));yield n,yield s})()}Jv(t){BS(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.To||!this.gv||this.mv||this.yv)return;const t=this.Pv();if(t){this.yv=!0;try{t((t,e)=>{if(this.yv=!1,!this.To&&this.gv)if(t||!e)this.A.error("Could not load logs script",t),this.zv();else{const t=this.Gv();this.Hv=e.initialize(this.bo),this.mv=!0,t.length>0&&e.replay(this.bo,t)}})}catch(t){throw this.yv=!1,t}}else this.zv()}Fv(t,e){const i=this.bo;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:e=>e===ce.LogsQueue?t():void 0,setPersistedProperty(t,i){t===ce.LogsQueue&&e(null!=i?i:[])},js:t=>this.js(t),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}js(t){return new Promise(e=>{if(Gr(this._d,3))return void e({kind:"fatal",error:jS(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:jS(void 0,"logs request timed out")})},9e4),r=this.Ev;this.bo.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.bo.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var e;const i=t.statusCode;this.Kv(i,r),i>=200&&300>i?n({kind:"ok"}):413===i?n({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?n({kind:"fatal",error:new Error(`logs request failed with status ${i}`)}):0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:jS(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`logs request failed with status ${i}`)})},t=>{n({kind:"retry-later",error:t})})})}Kv(t,e){(0!==t||e)&&(this._d=Qr(t,this._d,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Zv(t){this.ol.length>0&&this.Xv(t,this.ol,this.Lv,this.bo.library.name,t=>{this.ol=t}),this.bv.length>0&&this.Xv(t,this.bv,this.jv,NS,t=>{this.bv=t})}Xv(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=_r(r,br(i,this.bo.library.name,this.bo.library.version),n,this.bo.library.version);this.bo.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.bo.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.Jv(t))}};const US=Or("[NetworkMetrics]"),HS=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},WS={"http:":80,"https:":443},VS=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),GS=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=Kr(n))||void 0===i?void 0:i.href)||n}},QS=(t,e,i,n,s,r,o=!1)=>{try{var a,l;const u=s();if(!u)return;const c=i||void 0,h=HS()-n,d=Kr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=xe(u.name)?u.name(v):Ee(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!c?void 0:((t,e)=>t?400>t?void 0:String(t):(null==e?void 0:e.name)||"_OTHER")(c,r),g=ue(ue(ue(ue(ue({},(t=>{const e=VS.has(t)?t:"_OTHER";return ue({"http.request.method":e},"_OTHER"===e&&t!==e?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||WS[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(e=t.pathname,e.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var e})(d):{}),c?{"http.response.status_code":c}:{}),p?{"error.type":p}:{}),null===(a=u.attributes)||void 0===a?void 0:a.call(u,v,{status:c,durationMs:h}));null===(l=t.metrics)||void 0===l||l.histogram(f,h,{unit:"ms",attributes:g})}catch(t){US.error("Failed to record network metric",t)}},ZS=()=>{},JS=(e,i)=>xe(null==t?void 0:t.fetch)?Sf(t,"fetch",t=>function(...n){const s=HS(),r=t.apply(this,n);if(!i())return r;try{var o,a,l;const[t,u]=n,c=GS(null!==(o=null!==(a=null==u?void 0:u.method)&&void 0!==a?a:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(l=null==t?void 0:t.url)&&void 0!==l?l:t);return r.then(t=>(QS(e,c,null==t?void 0:t.status,s,i,void 0,!0),t),t=>{throw QS(e,c,void 0,s,i,t),t})}catch(t){return US.error("Failed to observe fetch",t),r}}):ZS,KS=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return ZS;const r=new WeakMap,o=Sf(s,"open",t=>function(...e){try{(()=>Dw.has(this))()||r.set(this,GS(e[0],e[1]))}catch(t){US.error("Failed to observe XHR open",t)}return t.apply(this,e)}),a=Sf(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=HS();s=()=>{this.removeEventListener("loadend",s),QS(e,t,this.status,n,i)},Hr(this,"loadend",s)}}catch(t){US.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),a()}},YS=new WeakMap,XS=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),tx={maxStringLength:2048,truncationSuffix:"..."},ex={maxStringLength:2048,truncationSuffix:"..."};function ix(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function nx(t,e){return{}.hasOwnProperty.call(t,e)}function sx(t,e){const i=Object.create(t);return e&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:e}),i}function rx(t,e,i=!1){if(!Ee(t))return;const n=t.trim();return n?(i?nr(n,tx):n).slice(0,e):void 0}function ox(t){try{return $e(t)&&!0===t.isError}catch(t){return!1}}function ax(t,e){try{return nr((e?function(t){try{if(!$e(t)||!Se(t.content))return;return t.content.filter(t=>$e(t)&&"text"===t.type&&Ee(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):$e(t)&&Ee(t.message)?t.message:Ee(t)?t:String(t))||"Unknown error",ex).slice(0,2048)}catch(t){return"Unknown error"}}function lx(t,e){if(e)return"Error";try{if(!$e(t))return"Error";let e=Ee(t.name)?t.name.trim():"";const i=t.constructor;return e&&"Error"!==e||!xe(i)||"Error"===i.name||(e=i.name),(e||"Error").slice(0,256)}catch(t){return"Error"}}function ux(t,e){return{message:ax(t,e),type:lx(t,e)}}const cx={featureFlags:class extends IS{constructor(t){const e=new RS(t.config,t.il());super(e),this.name=jg,this._instance=t,this.Yv=e}get Pd(){return this._instance.persistence}updateConfig(t,e){this.Yv.update(t,e),this.Rd()}}},hx={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.tf)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.ef||"missing_config"===this.ef?this.ef:null!==(t=null===(e=this.tf)||void 0===e?void 0:e.status)&&void 0!==t?t:this.ef}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.ef=aa,this.if=void 0,this.nf=!1,this.Je=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.sn=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Je=!0,null===(t=this.tf)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw Xk.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&Hr(n,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.nf=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.sn),t?this.sf(!0):this.stopRecording()}get rf(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.nf)return;if(this.rf&&(null===(e=this.tf)||void 0===e?void 0:e.isStarted))return;const i=!Te(Object.assign)&&!Te(Array.from);this.rf&&i?(this.af(t),Xk.info("starting")):(this.ef=aa,this.stopRecording())}af(t){var e,i;if(this.rf)if("awaiting_config"!==this.ef&&"missing_config"!==this.ef&&(this.ef=da),(null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.lf(t);else{var n,s;const e=this._instance.sessionManager;null===(n=h.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.uf,i=>{if(!this.nf&&this.rf&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Xk.error("could not load recorder",i)):void this.lf(t);this.ef="disabled"})}}stopRecording(){var t,e;null===(t=this.if)||void 0===t||t.call(this),this.if=void 0,null===(e=this.tf)||void 0===e||e.stop()}sf(t=!1){var e,i;null===(e=this.if)||void 0===e||e.call(this),this.if=void 0,null===(i=this.tf)||void 0===i||i.discard({discardProducerEvents:t})}cf(){var t,e;null===(t=this.Il)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.Il)||void 0===e||e.unregister("$replay_sample_rate")}hf(t,e){if(Re(t))return null;const i=Pe(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Xk.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}df(t){if(this.Il){var e,i;const n=this.Il,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.hf(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.hf(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.cf();const a=null==i?void 0:i.minimumDurationMilliseconds;n.register({[J]:ue(ue({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ue({capturePerformance:t.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:Te(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})})};s(),null===(e=this.if)||void 0===e||e.call(this),this.if=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.df(e),void this.sf()):(this.df(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.ef&&(this.ef="missing_config",this._instance.register_for_session({[Nt]:!0}),Xk.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.tf)||void 0===i?void 0:i.log)?this.tf.log(t,e):Xk.warn("log called before recorder was ready")}get uf(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(J);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}vf(){const t=this._instance.get_property(J);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return Xk.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Re(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}lf(t){var e,i,n;if(!this.nf&&this.rf&&this._instance.sessionManager){if(!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return Xk.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lt]:!0});var s;if(this.tf||(this.tf=null===(s=h.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Je),this.tf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.vf()){if("missing_config"===this.ef||"awaiting_config"===this.ef)return;return this.ef="awaiting_config",Xk.info("persisted remote config is stale, requesting fresh config before starting"),void new Aw(this._instance).load()}this.ef=da,null===(i=(n=this.tf).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Je),this.tf.start(t)}else this.ef=aa}onRRwebEmit(t){var e,i;null===(e=this.tf)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.tf||null===(e=this.Il)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.tf)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.tf||null===(e=this.Il)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.tf)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.tf||null===(i=this.Il)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.tf)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;const e={};for(const t of tS){var i;const n=null===(i=this._instance.sessionPersistence)||void 0===i?void 0:i.get_property(t);Te(n)||(e[t]=n)}return ue(ue({},e),(null===(t=this.tf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.tf)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.tf)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},dx={autocapture:class extends L_{constructor(t){super(new Wk(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.ff=!1,this._instance=t,this.pf=this.gf()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.mf();return!!(t.path||t.search||this.yf(t))}startIfEnabled(){this.isEnabled&&(Ar.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.pf=this.gf(),this.startIfEnabled()}stop(){this.bf&&this.bf(),this.bf=void 0,this._f&&this._f(),this._f=void 0,Ar.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.wf("pushState"),this.wf("replaceState"),this.kf(),this.yf()&&this.Sf())}wf(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;Sf(t.history,e,i=>function(s,r,o){var a;n.xf(o)&&n.$f(),i.call(this,s,r,o),n.Cf(e,!n.ff&&"popstate"!==(null==t||null===(a=t.event)||void 0===a?void 0:a.type))})}gf(){const e=null==t?void 0:t.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}mf(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:$e(t)?t:{}}yf(t=this.mf()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Tf(t){const e=this.mf(),i=this.pf;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.yf(e)&&t.hash!==i.hash))}Cf(t,e=!1){try{e||this.$f();const i=this.gf();if(!i)return;if(this.Tf(i)){const i=()=>this._instance.capture(te,{navigation_type:t});e?(this.If=i,Promise.resolve().then(()=>this.$f())):i()}this.pf=i}catch(e){Ar.error(`Error capturing ${t} pageview`,e)}}xf(e){var i,n;return!(Re(e)||!t)&&(null===(i=Kr(String(e)))||void 0===i?void 0:i.href)!==(null===(n=t.location)||void 0===n?void 0:n.href)}$f(){const t=this.If;if(t){this.If=void 0,this.ff=!0;try{t()}catch(t){Ar.error("Error capturing deferred pageview",t)}finally{this.ff=!1}this.pf=this.gf()}}kf(){if(this.bf)return;const e=()=>{this.Cf("popstate")};Hr(t,"popstate",e),this.bf=()=>{t&&t.removeEventListener("popstate",e)}}Sf(){if(this._f)return;const e=()=>{this.Cf("hashchange")};Hr(t,"hashchange",e),this._f=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.Mf=!1,this.ko=!1,this.Ef=null,this.instance=t,this.Mf=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[B]),this.rageclicks=new R_(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return $e(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Mr.capture_heatmaps)?Re(this.Mr.enable_heatmaps)?this.Mf:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.ko)return;eS.info("starting..."),this.Pf(),this.sn()}else{var t;clearInterval(null!==(t=this.Ef)&&void 0!==t?t:void 0),this.Rf(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[B]:i}),this.Mf=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Af(t){iS(t.originalEvent)&&this.Ir(t.originalEvent,"deadclick")}sn(){this.Ef&&clearInterval(this.Ef),this.Ef="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Pf(){t&&n&&(this.Ff=this.fl.bind(this),Hr(t,Xt,this.Ff),this.Of=e=>this.Ir(e||(null==t?void 0:t.event)),Hr(n,"click",this.Of,{capture:!0}),this.Df=e=>this.Lf(e||(null==t?void 0:t.event)),Hr(n,"mousemove",this.Df,{capture:!0}),this.Nf=new nw(this.instance,ew,this.Af.bind(this)),this.Nf.startIfEnabledOrStop(),this.qf=this.sn.bind(this),Hr(n,E,this.qf),this.ko=!0)}Rf(){var e;t&&n&&(this.Ff&&t.removeEventListener(Xt,this.Ff),this.Of&&n.removeEventListener("click",this.Of,{capture:!0}),this.Df&&n.removeEventListener("mousemove",this.Df,{capture:!0}),this.qf&&n.removeEventListener(E,this.qf),clearTimeout(this.jf),null===(e=this.Nf)||void 0===e||e.stop(),this.ko=!1)}Bf(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&ro(s)&&!oo(s,"body");){if(s===n)return!1;let e;try{var r,o,a;e=null===(r=null!==(o=null===(a=s.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(s).position}catch(t){return!1}if(ge(i,e))return!0;s=bo(s)}return!1}(po(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Ir(t,e="click"){var i;if(so(t.target)||!iS(t))return;const n=this.Bf(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Ao(po(t),this.instance.config.rageclick)&&this.Qs(ue(ue({},n),{},{type:"rageclick"})),this.Qs(n)}Lf(t){!so(t.target)&&iS(t)&&(clearTimeout(this.jf),this.jf=setTimeout(()=>{this.Qs(this.Bf(t,"mousemove"))},500))}Qs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?cn(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[..._u,...n||[]]:[],r=to(i,s,ku);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fl(){this.Rt&&!Ce(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:nw,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Mf=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.zf=()=>{clearTimeout(this.Hf),this.Hf=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ue({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>ue(ue({},t),{},{[`$web_vitals_${e.name}_event`]:ue({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uf=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Re(null==t?void 0:t.name)||Re(null==t?void 0:t.value))return void Qk.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.Wf(i);if(Te(n))return;const s=Pe(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Vf&&t.value>=this.Vf)return void Qk.error("Ignoring metric with value >= "+this.Vf,t);this.Rt.navigationKey!==s&&(this.zf(),this.Hf=setTimeout(this.zf,this.flushToCaptureTimeoutMs)),Te(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Te(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=ue(ue(ue({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,$e(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of Yk){const n="url"===i&&"string"==typeof t.attribution[i]?this.Wf(t.attribution[i]):t.attribution[i];Te(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Te(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.zf()},this.Gf=()=>{if(this.ko)return;let t,e,i,n,s=!1;const r=h.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Qf])||("web-vitals"===this.Qf&&Te(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Te(a)){const r=a.withoutAttribution,o=this.attributionMetrics;s=!Te(r),t=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,e=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,n=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(t&&e&&i&&n))return void Qk.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?ue(ue({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uf.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Uf.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uf.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&n(this.Uf.bind(this),u),this.ko=!0},this.Mf=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[W]),this.startIfEnabled()}get Zf(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=$e(this.Zf)?null===(t=this.Zf)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Re(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||Jk:i}get flushToCaptureTimeoutMs(){return($e(this.Zf)?this.Zf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=$e(this.Zf)?this.Zf.web_vitals_attribution:void 0;return Oe(t)?t?Jk:[]:Se(t)?t:Kk}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=$e(this.Zf)?this.Zf.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Vf(){const t=$e(this.Zf)&&Pe(this.Zf.__web_vitals_max_value)?this.Zf.__web_vitals_max_value:Zk;return t>0&&6e4>=t?Zk:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Qk.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=$e(this.Zf)?this.Zf.web_vitals:Oe(this.Zf)?this.Zf:void 0;return Oe(e)?e:this.Mf}startIfEnabled(){this.isEnabled&&!this.ko&&(Qk.info("enabled, starting..."),this.zo(this.Gf))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=$e(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$e(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[W]:i}),this._instance.persistence.register({[Z]:n})),this.Mf=i,this.startIfEnabled()}get Qf(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const i=h.__PosthogExtensions__,n=this.Qf,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Te(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?Qk.error("failed to load script",e):t()})}Wf(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Qk.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?cn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[..._u,...s||[]]:[];return to(n,r,ku)}}},vx={exceptionObserver:class{constructor(e){var i;this.Gf=()=>{var e;if(!t||!this.isEnabled||!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Jf&&this.Mr.capture_unhandled_errors&&(this.Jf=i(this.captureException.bind(this))),!this.Kf&&this.Mr.capture_unhandled_rejections&&(this.Kf=n(this.captureException.bind(this))),!this.Xf&&this.Mr.capture_console_errors&&(this.Xf=s(this.captureException.bind(this)))}catch(t){Vk.error("failed to start",t),this.Yf()}},this._instance=e,this.tp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[z]),this.wt=new Je(ue(ue({},function(t={}){var e,i,n,s;return{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(n=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Vk})),this.Mr=this.ep(),this.startIfEnabledOrStop()}ep(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $e(t)?e=ue(ue({},e),t):(Te(t)?this.tp:t)&&(e=ue(ue({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Vk.info("enabled"),this.Yf(),this.zo(this.Gf)):this.Yf()}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Vk.error("failed to load script",e);t()})}Yf(){var t,e,i;null===(t=this.Jf)||void 0===t||t.call(this),this.Jf=void 0,null===(e=this.Kf)||void 0===e||e.call(this),this.Kf=void 0,null===(i=this.Xf)||void 0===i||i.call(this),this.Xf=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.tp=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[z]:this.tp}),this.Mr=this.ep(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.ep()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void Vk.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var e,i;this.np=[],this.sp=Ey(),this._instance=t,this.np=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.rp=ns(this.op()),this.ap=new ss(this.rp)}onConfigChange(){this.rp=ns(this.op()),this.ap.setConfig(this.rp)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.np=r,this._instance.persistence&&this._instance.persistence.register({[U]:this.np,[H]:o})}get lp(){var t;const e=!!this._instance.get_property(H),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.sp.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.rp.enabled)try{if(!Ee(t)||0===t.trim().length)return void Sy.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const e=[];return{sanitizedProperties:Object.keys(t).reduce((i,n)=>es.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.up(e));n.length>0&&Sy.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ap.add(ue({[Xn]:t,[ts]:(new Date).toISOString()},i))}catch(t){Sy.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.cp(e)){if(this.hp(e))return this.dp("Exception dropped: matched a suppression rule"),void Sy.info("Skipping exception capture because a suppression rule matched");if(!this.lp&&this.vp(e))return this.dp("Exception dropped: thrown by a browser extension"),void Sy.info("Skipping exception capture because it was thrown by an extension");if(!this.lp&&this.fp(e))return this.dp("Exception dropped: thrown by an injected browser script"),void Sy.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.pp(e))return this.dp("Exception dropped: thrown by the PostHog SDK"),void Sy.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.rp.enabled&&Re(t.$exception_steps)?this.gp(t):t,n=function(){if("u">typeof process){var t;const e=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(e)return e}const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",hc:!0});return t&&this.ap.clear(),t}catch(t){return ky(t)||Sy.error("Failed to capture exception event. Dropping this exception.",t),void this.ap.clear()}}catch(t){return void(ky(t)||Sy.error("Failed to process exception event. Ignoring this exception.",t))}}gp(t){try{const e=this.ap.getAttachable();return 0===e.length?t:ue(ue({},t),{},{$exception_steps:e})}catch(e){return Sy.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}dp(t){this.rp.enabled&&this.ap.add({[Xn]:t,[ts]:(new Date).toISOString()})}up(t){return $e(t)?ue({},t):{}}op(){var t,e;return null!==(t=null===(e=this._instance.config.error_tracking)||void 0===e?void 0:e.exception_steps)&&void 0!==t?t:{}}hp(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>(Ee(e)&&e.length>0&&t.$exception_types.push(e),Ee(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.np.some(t=>{const i=t.values.map(t=>{const i=lu[t.operator],n=e[t.key];if(!i||!n)return!1;const s=Se(t.value)?t.value:[t.value];return s.length>0&&i(s,n)});return"OR"===t.type?i.some(Boolean):i.every(Boolean)})}catch(t){return Sy.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}vp(t){const e=t.flatMap(t=>{var e,i;return null!==(e=null===(i=t.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[]}),i=e.filter(({filename:t})=>!!t&&Cy.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(xy))||t.some(({type:t,value:e})=>"NoResponse"===t||Ee(e)&&$y.some(({value:t,exact:i})=>i?e===t:e.includes(t)))&&!e.some(({in_app:t,filename:e})=>t&&!(null==e?void 0:e.startsWith(xy))))}fp(t){return t.some(({value:t})=>Ee(t)&&Ty.some(e=>t.includes(e)))}pp(t){if(t.length>0){var e,i,n,s;const r=null!==(e=null===(i=t[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}cp(t){return!Re(t)&&Se(t)}}},fx=ue({productTours:class{get Il(){return this._instance.persistence}constructor(t){this.mp=null,this.yp=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.Il&&this.Il.register({[G]:!!e.productTours}),!sS(this._instance))return!this.mp&&Re(null===(i=this.Il)||void 0===i?void 0:i.props.ph_product_tours)||nS.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.mp)||void 0===n||n.stop(),this.mp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.mp&&sS(this._instance)&&this.zo(()=>this.bp())}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?nS.error("Could not load product tours script",e):t()})}bp(){var t;!this.mp&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.mp=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(Se(this.yp)&&!e)return void t(this.yp,{isLoaded:!0});const i=this.Il;if(i){const n=i.props[bt];if(Se(n)&&!e)return this.yp=n,void t(n,{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:e=>{if(!sS(this._instance))return void t([],{isLoaded:!0});const n=e.statusCode;if(200!==n||!e.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?e.error||nS.warn(i):nS.error(i),void t([],{isLoaded:!1,error:i})}const s=Se(e.json.product_tours)?e.json.product_tours:[];this.yp=s,i&&i.register({[bt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.mp)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.mp.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.mp)||void 0===e||e.showTourById(t)}previewTour(t){this.mp?this.mp.previewTour(t):this.zo(()=>{var e;this.bp(),null===(e=this.mp)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.mp)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.mp)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.mp)||void 0===t||t.previousStep()}clearCache(){var t;this.yp=null,null===(t=this.Il)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.mp)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.mp)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.mp)||void 0===e||e.cancelPendingTour(t)}}},cx),px={siteApps:class{constructor(t){this._instance=t,this._p=0,this.wp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}kp(t,e){if(!e)return;const i=this.globalsForEvent(e);this.wp.push(i),this.wp.length>1e3&&(this.wp=this.wp.slice(10))}get siteAppLoaders(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.kp.bind(this));this.Sp=()=>{t(),this.wp=[],this.Sp=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,a;if(!t)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(c))l[t]={id:u[t],type:t,properties:e};const{$set_once:h,$set:d}=t;return{event:ue(ue({},ws(t,rS)),{},{properties:ue(ue(ue({},t.properties),d?{$set:ue(ue({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),h?{$set_once:ue(ue({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),h)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=t.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}xp(t){var e;const i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(oS.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(t)||(oS.error("prepare_external_dependency_script returned null"),null)}return t}$p(){var t,e,i,s,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,c=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!c)return()=>{};if(this._p++,this.Cp)return this.Tp();const h=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),h.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.xp(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Me(t));return f(c,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(c,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(c,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(a=u.DocumentType)||void 0===a?void 0:a.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(l=u.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.Cp=()=>{h.forEach(t=>t()),this.Cp=void 0},this.Tp()}Tp(){let t=!1;return()=>{var e;t||(t=!0,this._p--,0===this._p&&(null===(e=this.Cp)||void 0===e||e.call(this)))}}Ip(t,e=!0){const i=this.$p();try{const n=t(i);return e&&i(),n}catch(t){throw i(),t}}setupSiteApp(t){const e=this.apps[t.id],i=()=>{var i;!e.errored&&this.wp.length&&(oS.info(`Processing ${this.wp.length} events for site app with id ${t.id}`),this.wp.forEach(t=>this.Ip(()=>{var i;return null===(i=e.processEvent)||void 0===i?void 0:i.call(e,t)})),e.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(i=this.Sp)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,oS.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.Ip(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){oS.error(aS+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){oS.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}Mp(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Ep(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.Ip(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){oS.error(`Error while processing event ${t.event} for site app ${i.id}`,e)}}onRemoteConfig(t){var e,i,n;if(null===(e=this.siteAppLoaders)||void 0===e?void 0:e.length)return this.isEnabled?(this.Mp(),void this._instance.on("eventCaptured",t=>this.Ep(t))):void oS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.Sp)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;h[`__$$ph_site_app_${t}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return oS.error(aS+t,e)})}else oS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},gx={tracingHeaders:class{constructor(t){this._instance=t,this.Pp=void 0,this.Rp=void 0,this.Ap=void 0,this.Gf=()=>{const t=this.Fp();var e,i;t?(Te(this.Pp)&&(this.Pp=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Te(this.Rp)&&(this.Rp=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Yf()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Gk.error("failed to load script",e);t()})}Op(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Fp(){const t=this.Op();return Se(t)?(Se(this.Ap)?this.Ap.splice(0,this.Ap.length,...t):this.Ap=[...t],t.length>0?this.Ap:void 0):(Se(this.Ap)&&this.Ap.splice(0),this.Ap=t||void 0,this.Ap)}Yf(){var t,e;null===(t=this.Pp)||void 0===t||t.call(this),null===(e=this.Rp)||void 0===e||e.call(this),this.Pp=void 0,this.Rp=void 0}startIfEnabledOrStop(){this.Fp()?this.zo(this.Gf):this.Yf()}}},mx=ue({surveys:class extends hS{constructor(t){var e;super(new mS(t),(e=t,{get projectToken(){return e.config.token},kv:new gS(e)})),this._instance=t}Wc(t,e){const i=e.query?Bw(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},cx),yx={toolbar:class{constructor(t){this.instance=t}Dp(t){h.ph_toolbar_state=t}Lp(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(Wr(this.instance.config))return!1;if(!t||!n)return!1;e=null!==(r=e)&&void 0!==r?r:t.location,s=null!==(o=s)&&void 0!==o?o:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}const n=yS||eo(e.hash,"__posthog")||eo(e.hash,"state");let r;const o=n?hn(()=>JSON.parse(atob(decodeURIComponent(n))))||hn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(r=JSON.parse(i.getItem(bS)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Np(t){const e=h.ph_load_toolbar||h.ph_load_editor;!Re(e)&&xe(e)?e(t,this.instance):_S.warn("No toolbar load function found")}loadToolbar(e){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!t||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ue(ue({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(bS,JSON.stringify(ue(ue({},r),{},{source:void 0}))),2===this.Lp())this.Np(r);else if(0===this.Lp()){var o,a;this.Dp(1),null===(o=h.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",t=>{if(t)return _S.error("[Toolbar] Failed to load",t),void this.Dp(0);this.Dp(2),this.Np(r)}),Hr(t,"turbolinks:load",()=>{this.Dp(0),this.loadToolbar(r)})}return!0}qp(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},bx=ue({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.jp("retrieved web experiments from the server"),this.Bp=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Bp&&(e.jp("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.Bp)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);Ee(n)&&t.variants[n]&&this.zp(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.Hp(n,this._instance)&&this.zp(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.jp(PS);else if(!this.Mr.disable_web_experiments){if(Re(this.Bp))return this.Bp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.jp("applying feature flags",t),t.forEach(t=>{var e;if(this.Bp&&(null===(e=this.Bp)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.Bp)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.zp(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=Xr(null==t?void 0:t.search,"__experiment_id"),n=Xr(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.jp(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.Up(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Up(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.jp(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.zp(s[0].name,i,s[0].variants[i].transforms))}static Hp(t,i){return!Re(t.conditions)&&e.Wp(t,i)&&e.Vp(t)}static Wp(t,i){var n;if(Re(t.conditions)||Re(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;const s=e.getWindowLocation();if(s){var r,o,a;const e=io(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||AS[null!==(o=null===(a=t.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Vp(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=xu();if(i.utm_source){var n,s,r,o,a,l,u,c;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,h=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(c=t.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)==i.utm_term;return e&&d&&v&&h}return!1}static jp(t,...e){Ar.info(`[WebExperiments] ${t}`,e)}zp(t,i,n){this._is_bot()?e.jp(PS):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.jp(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.jp("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?dk(i,this.Mr.custom_blocked_useragents):void 0}}},cx),_x={conversations:class{constructor(t){this._instance=t,this.Gp=void 0,this._conversationsManager=null,this.Qp=!1,this.ne=null,this.Zp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Jp=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)||(Oe(e)?this.Gp=e:(this.Gp=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Gp=void 0,this.ne=null,this.Jp=void 0,this.Zp=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Qp)return;if(this._instance.config.disable_conversations)return;if(Wr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==h?void 0:h.__PosthogExtensions__;if(t&&!Te(this.Gp)&&this.Gp)if(this.ne&&this.ne.token){this.Qp=!0;try{const e=t.initConversations;if(e)return this.Kp(e),void(this.Qp=!1);const i=t.loadExternalDependency;if(!i)return void this.Xp(Zt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Xp("Could not load conversations script",e):this.Kp(t.initConversations),this.Qp=!1})}catch(t){this.Xp("Error initializing conversations",t),this.Qp=!1}}else OS.error("Conversations enabled but missing token in remote config.")}Kp(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Zp=!1,OS.info("Conversations loaded successfully")}catch(t){this.Xp("Error completing conversations initialization",t)}else OS.error("Cannot complete initialization: remote config is null")}Xp(t,e){OS.error(t,e),this._conversationsManager=null,this.Qp=!1,this.Zp=!0}show(){this._conversationsManager?this._conversationsManager.show():OS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Gp&&!Me(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Wr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Jp?"remote_config_failed":Te(this.Gp)?this.Jp?"disabled_in_project":"remote_config_pending":this.Gp?Re(this.ne)||!this.ne.token?"missing_token":(null==h?void 0:h.__PosthogExtensions__)?this.Qp?"initializing":this.Zp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var n=this;return re(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(OS.warn(FS),null)})()}getMessages(t,e){var i=this;return re(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(OS.warn(FS),null)})()}markAsRead(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(OS.warn(FS),null)})()}getTickets(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(OS.warn(FS),null)})()}requestRestoreLink(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(OS.warn(FS),null)})()}restoreFromToken(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(OS.warn(FS),null)})()}restoreFromUrlToken(){var t=this;return re(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(OS.warn(FS),null)})()}getCurrentTicketId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}kc(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}Sc(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},wx={logs:class extends zS{constructor(t){super({get(){var e;return null==t||null===(e=t.config)||void 0===e?void 0:e.logs},captureHintKey:Q,get remoteConfigWillArrive(){var e,i;return!(null===(e=t.il)||void 0===e?void 0:e.call(t))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[t.config.token])||void 0===i?void 0:i.config)}},()=>function(t){var e;const i={};if(i.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:e,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=e,i.windowId=n,Re(s)||(i.sessionStartTimestamp=s),Re(r)||(i.lastActivityTimestamp=r)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(i.currentUrl=t.config.disable_capture_url_hashes?cn(h.location.href):h.location.href),t.featureFlags){const e=t.featureFlags.getFlags();e&&e.length>0&&(i.activeFeatureFlags=e)}return i}(t)),this._instance=t,this.name=Bg,this.Rv()}get Ev(){return this._instance.__loaded}Pv(){const t=Or("[logs]"),e=null==h?void 0:h.__PosthogExtensions__;if(!e)return void t.error("PostHog Extensions not found.");const i=e.loadExternalDependency;if(i)return t=>{i(this._instance,"logs",i=>{const n=e.logs;t(i,(null==n?void 0:n.initializeLogs)?{initialize:t=>n.initializeLogs(t),replay(t,e){var i;return null===(i=n.replayConsoleBuffer)||void 0===i?void 0:i.call(n,t,e)}}:void 0)})};t.error(Zt)}}},kx={metrics:class{constructor(t){this._instance=t,this.A=Or("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.To)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.Yp?this.Yp=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=JS(t,i),s=KS(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.Yp&&(this.Yp(),this.Yp=void 0)}Ov(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.Iv&&this.Dv===e||(null===(i=this.Iv)||void 0===i||i.reset(),this.Dv=e,this.Iv=new Er(this.Fv(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.A)),this.Iv}count(t,e=1,i){this.Ov().count(t,e,i)}gauge(t,e,i){this.Ov().gauge(t,e,i)}histogram(t,e,i){this.Ov().histogram(t,e,i)}flush(t){if(!this.Iv)return Promise.resolve();if(t){const e=this.Iv.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Iv.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Iv)||void 0===t||t.reset()}dispose(){var t,e;this.To=!0,null===(t=this.Yp)||void 0===t||t.call(this),this.Yp=void 0,null===(e=this.Iv)||void 0===e||e.reset()}Fv(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Wl.LIB_NAME,getLibraryVersion:()=>Wl.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ue(ue({method:"POST",url:this.tg(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}tg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Sx={webMCP:class{constructor(t){this._instance=t,this.eg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.eg)return;const t=null==n?void 0:n.modelContext;if(!t||!xe(t.registerTool))return;const e=YS.get(t);if(e)return e.instances.add(this._instance),void(this.eg=!0);const i={instances:new Set([this._instance])},s=t.registerTool,r=this;Sf(t,"registerTool",t=>{const e=t;return function(t,...n){let s=t;try{s=r.ig(t,i)}catch(i){return e.call(this,t,...n)}return e.call(this,s,...n)}}),t.registerTool!==s&&(YS.set(t,i),this.eg=!0)}ig(t,e){if(!t||!xe(t.execute))return t;const i=t.execute,n=this,{tool:s,injected:r}=function(t,e){const i={intent:!1,model:!1},n=t.inputSchema;if(!function(t){return!!Te(t)||$e(t)&&Object.keys(t).every(t=>XS.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!$e(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||$e(t.properties))&&(!t.required||Se(t.required))}(n))return{tool:sx(t),injected:i};const s=(null==n?void 0:n.properties)||{},r=t=>nx(s,t)||Se(null==n?void 0:n.required)&&n.required.includes(t);if(i.intent=e.intent&&!r("context"),i.model=e.model&&!r("llm_model"),!i.intent&&!i.model)return{tool:sx(t),injected:i};const o=ue({},s),a=Se(null==n?void 0:n.required)?[...n.required]:[];return i.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},a.includes("context")||a.push("context")),i.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},a.includes("llm_model")||a.push("llm_model")),{tool:sx(t,ue(ue({},n),{},{type:(null==n?void 0:n.type)||"object",properties:o,required:a})),injected:i}}(t,function(t){const e={intent:!1,model:!1};for(const i of t.instances){const t=ix(i.config.capture_webmcp);e.intent||(e.intent=!0===(null==t?void 0:t.intent)),e.model||(e.model=!0===(null==t?void 0:t.model))}return e}(e));return Object.defineProperty(s,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const a=new Date,l=function(t,e){if(!$e(t))return{};try{const i=e.intent?rx(t.context,2048,!0):void 0,n=e.model?rx(t.llm_model,256):void 0;return ue(ue({},i&&"{}"!==i?{intent:i}:{}),n&&"unknown"!==n.toLowerCase()?{model:n}:{})}catch(t){return{}}}(o[0],r),u=function(t,e){const i=t[0];if(!$e(i))return t;try{const n=e.intent&&nx(i,"context"),s=e.model&&nx(i,"llm_model");if(!n&&!s)return t;const r=ue({},i);return n&&delete r.context,s&&delete r.llm_model,[r,...t.slice(1)]}catch(e){return t}}(o,r);let c;try{c=i.apply(this===s?t:this,u)}catch(t){throw n.ng(e,s,a,{error:t,errorResult:!1},l),t}if((h=c)&&"function"==typeof h.then)return Promise.resolve(c).then(t=>{const i=ox(t)?{error:t,errorResult:!0}:void 0;return n.ng(e,s,a,i,l),t},t=>{throw n.ng(e,s,a,{error:t,errorResult:!1},l),t});var h;const d=ox(c)?{error:c,errorResult:!0}:void 0;return n.ng(e,s,a,d,l),c}}),s}ng(t,e,i,n,r){const o=Date.now()-i.getTime();let a;for(const l of t.instances){const t=ix(l.config.capture_webmcp);if(t){n&&!a&&(a=ux(n.error,n.errorResult));try{l.capture("$mcp_tool_call",ue(ue(ue({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==s?void 0:s.hostname,$mcp_duration_ms:o,$mcp_is_error:!!n},a?{$mcp_error_type:a.type,$mcp_error_message:a.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch(t){continue}}}}}};Hk.__defaultExtensionClasses=ue({},ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue({},cx),hx),dx),vx),fx),px),mx),gx),yx),bx),_x),wx),kx),Sx));const xx=function(){Wl.SDK_DIST_CHANNEL="npm";const e=xk[Nk]=new Hk;return function(){function e(){e.done||(e.done=!0,tk=!1,Dr(xk,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():Hr(n,"DOMContentLoaded",e,{capture:!1}):t&&Ar.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var $x=xx;export{gg as Compression,Tw as DEFAULT_PRODUCT_TOUR_APPEARANCE,Tg as DisplaySurveyType,Hk as PostHog,Ew as ProductTourEventName,Iw as ProductTourEventProperties,$g as SurveyEventName,Cg as SurveyEventProperties,mg as SurveyEventType,bg as SurveyPosition,Sg as SurveyQuestionBranchingType,kg as SurveyQuestionType,xg as SurveySchedule,_g as SurveyTabPosition,wg as SurveyType,yg as SurveyWidgetType,$x as default,xx as posthog,Ow as severityLevels};
1
+ const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const h=null!=t?t:{},d="$early_access_features",v="$active_feature_flags",f="$feature_flag_details",p="$feature_flag_errors",g="$feature_flag_evaluated_at",m="$feature_flag_request_id",y="$minimal_flag_called_events",b="$enabled_feature_flags",_="$stored_group_properties",w="$stored_person_properties",k="$flag_call_reported",S="$flag_call_reported_session_id",x="$feature_flag_payloads",C="$override_feature_flags",T="$override_feature_flag_payloads",E="visibilitychange",I="$people_distinct_id",M="distinct_id",R="$device_id",P="$device_model",A="__alias",O="__cmpns",F="$fbc",D="$fbc_persistence",L="$fbp",N="$fbp_persistence",q="__timers",j="$autocapture_disabled_server_side",B="$heatmaps_enabled_server_side",z="$exception_capture_enabled_server_side",U="$error_tracking_suppression_rules",H="$error_tracking_capture_extension_exceptions",W="$web_vitals_enabled_server_side",V="$dead_clicks_enabled_server_side",G="$product_tours_enabled_server_side",Q="$logs_capture_enabled_server_side",Z="$web_vitals_allowed_metrics",J="$session_recording_remote_config",K="$session_recording_enabled_server_side",Y="$replay_sample_rate",X="$replay_override_sampling",tt="$replay_override_linked_flag",et="$replay_override_url_trigger",it="$replay_override_event_trigger",nt="$sesid",st="$session_is_sampled",rt="$session_past_minimum_duration",ot="$session_recording_url_trigger_activated_session",at="$session_recording_event_trigger_activated_session",lt="$posthog_sr_group_event_trigger_",ut="$posthog_sr_group_url_trigger_",ct="$posthog_sr_group_sampling_",ht="$debug_first_full_snapshot_timestamp",dt="$sess_rec_flush_size",vt="$groups",ft="$surveys",pt="$surveys_loaded_at",gt="$surveys_activated",mt="$surveys_activated_session",yt="$surveys_activated_timestamps",bt="ph_product_tours",_t="$product_tours_activated",wt="$product_tours_activated_session",kt="$conversations_widget_session_id",St="$conversations_ticket_id",xt="$conversations_widget_state",$t="$conversations_user_traits",Ct="$user_state",Tt="$client_session_props",Et="$capture_rate_limit",It="$initial_campaign_params",Mt="$initial_referrer_info",Rt="$initial_person_info",Pt="$epp",At="$posthog_cookieless",Ot="$cookieless_mode",Ft="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Lt="$sdk_debug_recording_script_not_loaded",Nt="$sdk_debug_replay_stale_config",qt="$sdk_debug_replay_event_trigger_status",jt="$sdk_debug_replay_linked_flag_trigger_status",Bt="$sdk_debug_replay_matched_recording_trigger_groups",zt="$sdk_debug_replay_pending_trigger_conditions",Ut="$sdk_debug_replay_remote_trigger_matching_config",Ht="$sdk_debug_replay_trigger_groups_count",Wt="$sdk_debug_replay_url_trigger_status",Vt="$sdk_debug_rrweb_attached",Gt="$sdk_debug_rrweb_start_attempted",Qt="$session_recording_start_reason",Zt="PostHog loadExternalDependency extension not found.",Jt="anonymous",Kt="identified",Yt="identified_only",Xt="beforeunload",te="$pageview",ee="$pageleave",ie="$identify",ne="$groupidentify";function se(t,e,i,n,s,r,o){try{var a=t[r](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,s)}function re(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){se(r,n,s,o,a,"next",t)}function a(t){se(r,n,s,o,a,"throw",t)}o(void 0)})}}function oe(t){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oe(t)}function ae(t,e,i){return(e=function(t){var e=function(t){if("object"!=oe(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=oe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==oe(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function le(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function ue(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?le(Object(i),!0).forEach(function(e){ae(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):le(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var ce=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),he=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const de="min_length",ve="max_length",fe=["$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"],pe=["token"];function ge(t,e){return-1!==t.indexOf(e)}const me=function(t){return t.trim()},ye=function(t){return t.replace(/^\$/,"")};function be(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const _e=Object.prototype,we=_e.hasOwnProperty,ke=_e.toString,Se=Array.isArray||function(t){return"[object Array]"===ke.call(t)},xe=t=>"function"==typeof t,$e=t=>t===Object(t)&&!Se(t),Ce=t=>{if($e(t)){for(const e in t)if(we.call(t,e))return!1;return!0}return!1},Te=t=>void 0===t,Ee=t=>"[object String]"==ke.call(t),Ie=t=>Ee(t)&&0===t.trim().length,Me=t=>null===t,Re=t=>Te(t)||Me(t),Pe=t=>"[object Number]"==ke.call(t)&&t==t,Ae=t=>Pe(t)&&t>0,Oe=t=>"[object Boolean]"===ke.call(t),Fe=t=>t instanceof FormData,De=t=>ge(fe,t),Le=t=>ge(pe,t);function Ne(t){return null===t||"object"!=typeof t}function qe(t,e){return{}.toString.call(t)===`[object ${e}]`}function je(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ze(t,Error)}}function Be(t){return"u">typeof Event&&ze(t,Event)}function ze(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],He=t=>ge(Ue,t),We=[!1,"false",0,"0","no"],Ve=["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"],Ge=new Map,Qe=function(t,e=[]){if(!t)return!1;const i=function(t,e){let i="";for(let t=0;e.length>t;t++){const n=e[t];i+=n.length+":"+n}return t.length+":"+t+"|"+e.length+":"+i}(t,e),n=Ge.get(i);if(void 0!==n)return n;const s=t.toLowerCase(),r=Ve.concat(e).some(t=>-1!==s.indexOf(t.toLowerCase()));return 256>Ge.size||Ge.clear(),Ge.set(i,r),r};function Ze(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Pe(t)?t>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Ze(null!=s?s:i,e,i,n))}var Je=class{constructor(t){this.C={},this.I=t.I,this.R=Ze(t.bucketSize,0,100,t.A),this.$=Ze(t.refillRate,0,this.R,t.A),this.O=Ze(t.refillInterval,0,864e5,t.A)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.$,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ke="Mobile",Ye="Android",Xe="Tablet",ti="Android Tablet",ei="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",ai="Chrome iOS",li="Internet Explorer",ui="Internet Explorer Mobile",ci="Opera",hi="Microsoft Edge",di="Firefox",vi="Firefox iOS",fi="Nintendo",pi="PlayStation",gi="Xbox",mi="Android Mobile",yi="Mobile Safari",bi="Windows",_i="Windows Phone",wi="Nokia",ki="Ouya",Si="Generic "+Ke.toLowerCase(),xi="Generic "+Xe.toLowerCase(),$i="Konqueror",Ci="Oculus Browser",Ti="Vivaldi",Ei="Yandex",Ii="Whale",Mi="DuckDuckGo",Ri="Pale Moon",Pi="Waterfox",Ai="Brave",Oi="Claude",Fi="Codex",Di="ChatGPT",Li="Google Search App",Ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),qi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ji=new RegExp(gi,"i"),Bi=new RegExp("PlayStation \\w+","i"),zi=new RegExp("Nintendo \\w+","i"),Ui=new RegExp("BlackBerry|PlayBook|BB10","i"),Hi={"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"},Wi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&ge(t,"GSA/")?Li:ge(t," OPR/")&&ge(t,"Mini")?"Opera Mini":ge(t," OPR/")?ci:Ui.test(t)?si:ge(t,"IEMobile")||ge(t,"WPDesktop")?ui:ge(t,"OculusBrowser")?Ci:ge(t,"SamsungBrowser")?ri:ge(t,"Edge")||ge(t,"Edg/")?hi:ge(t,"Vivaldi/")?Ti:ge(t,"YaBrowser/")?Ei:ge(t,"Whale/")?Ii:ge(t,"DuckDuckGo/")||ge(t,"Ddg/")?Mi:ge(t,"Claude/")?Oi:ge(t,"Codex/")?Fi:ge(t,"ChatGPT/")?Di:ge(t,"FBIOS")?"Facebook Mobile":ge(t,"UCWEB")||ge(t,"UCBrowser")?"UC Browser":ge(t,"CriOS")?ai:ge(t,"CrMo")||ge(t,oi)?oi:ge(t,Ye)&&ge(t,ni)?mi:ge(t,"FxiOS")?vi:ge(t.toLowerCase(),$i.toLowerCase())?$i:ge(t,"Brave/")?Ai:((t,e)=>e&&ge(e,"Apple")||function(t){return ge(t,ni)&&!ge(t,oi)&&!ge(t,Ye)}(t))(t,e)?ge(t,Ke)?yi:ni:ge(t,"PaleMoon/")?Ri:ge(t,"Waterfox/")?Pi:ge(t,di)?di:ge(t,"MSIE")||ge(t,"Trident/")?li:ge(t,"Gecko")?di:"")},Vi={[ui]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ni]:[Ni],[yi]:[Ni],[ci]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ni],[mi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Oi]:[qi],[Fi]:[qi],[Di]:[qi],[Mi]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Li]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gi=function(t,e,i,n){const s=Wi(t,e,i,n),r=Vi[s];if(Te(r))return null;for(let e=0;r.length>e;e++){const i=t.match(r[e]);if(i)return parseFloat(i[i.length-2])}return null},Qi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[gi,t&&t[1]||""]],[new RegExp(fi,"i"),[fi,""]],[new RegExp(pi,"i"),[pi,""]],[Ui,[si,""]],[new RegExp(bi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Ke).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Hi[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[bi,t]}return[bi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Te(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Ye,[t[2],t[3],t[4]||"0"].join(".")]:[Ye,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Zi=function(t){for(let e=0;Qi.length>e;e++){const[i,n]=Qi[e],s=i.exec(t),r=s&&(xe(n)?n(s,t):n);if(r)return r}return["",""]},Ji=function(t){return zi.test(t)?fi:Bi.test(t)?pi:ji.test(t)?gi:new RegExp(ki,"i").test(t)?ki:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ei:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ii:Ui.test(t)?si:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wi,"i").test(t)?wi:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Ke).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ye:ti:new RegExp("(pda|Mobile)","i").test(t)?Si:new RegExp(Xe,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?xi:""},Ki=function(t,e){var i;const n=Ji(t);return n===ei||n===ti||"Kobo"===n||"Kindle Fire"===n||n===xi?Xe:n===fi||n===gi||n===pi||n===ki?"Console":n===ii?"Wearable":n?Ke:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Ke:Xe:"Desktop";var s,r,o},Yi=/\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",Yi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Yi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Yi],[/\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"]],tn="[Truncated]",en="[Unserializable]";function nn(t){let e="";for(let i=0;t.length>i;i++){const n=t.charCodeAt(i);if(55296>n||n>56319)e+=56320>n||n>57343?t[i]:"�";else{const n=t.charCodeAt(i+1);56320>n||n>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}function sn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=en}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const rn=3e5;var on=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,rn);if(!e)return this.ts=i,void(this.es=i+n);this.es=Math.max(this.es,Math.min(i+n,this.ts+rn))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(rn,Math.max(0,this.es-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return"string"==typeof(i=t)&&an.test(i)?t:e();var i}function un(t,e){const i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function cn(t){return t?t.split("#")[0]:t}function hn(t){try{return t()}catch(t){return}}function dn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function vn(t,e,i){return fn.apply(this,arguments)}function fn(){return(fn=re(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=dn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let pn,gn,mn,yn;function bn(t){var e;const i=globalThis._posthogChunkIds,n=globalThis._debugIds;if(!i&&!n)return;const s=i?Object.keys(i):[],r=n?Object.keys(n):[];if(yn&&_n(i,s,gn)&&_n(n,r,mn))return yn;gn=i?ue({},i):void 0,mn=n?ue({},n):void 0,yn={},null!==(e=pn)&&void 0!==e||(pn={});const o=(e,i)=>{for(const s of e){const e=i[s];if(!e)continue;const r=null==pn?void 0:pn[s];if(r){yn[r]=e;continue}const o=t(s);for(let t=o.length-1;t>=0;t--){var n;const i=null===(n=o[t])||void 0===n?void 0:n.filename;if(i){yn[i]=e,pn[s]=i;break}}}};return n&&o(r,n),i&&o(s,i),yn}function _n(t,e,i){return t&&i?e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e]):t===i}var wn=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return re(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&Se(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i;let n,s;if(null!=t.cause&&(n=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return ue(ue({},t),{},{cause:n,stack:s,errors:null===(i=t.errors)||void 0===i?void 0:i.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return re(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){const i=[],n=(t,s,r)=>{var o;const a=i.length,l=void 0===s?ue(ue({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:a,parent_id:s},u={type:t.type,value:t.value,mechanism:l};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),i.push(u),t.cause&&n(t.cause,a,"cause");for(const e of null!==(o=t.errors)&&void 0!==o?o:[])n(e,a,"member")};return n(t),i}buildParsingContext(t){var e;return{chunkIdMap:bn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}getAggregateErrors(t){try{if(je(t)){let i=Object.getPrototypeOf(t);for(let n=0;i&&100>n;n++){var e;const n=null===(e=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===e?void 0:e.value;if("function"==typeof n&&"AggregateError"===n.name){const e=t.errors;return Se(e)?e:void 0}i=Object.getPrototypeOf(i)}}}catch(t){}}buildCoercingContext(t,e,i=0){let n=0,s=0,r=!1;const o=new Set,a=[],l={},u=(t,e,i=0)=>{const u=c(e,i),h=u.apply;if(u.apply=e=>{a.push(t);try{return h(e)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===i&&n>=50||d&&o.has(t))return;d&&o.add(t),0===i&&n++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw l}catch(t){if(t===l)return void(0===i&&n--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||n>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>n&&1e3>s&&p>t;t++){let i;s++;try{i=u.next(v[t])}catch(t){n++,i=this.coerceFallback(c(e+1))}i&&g.push(i)}return ue(ue({},f),{},{errors:g})},c=(i,n=0)=>ue(ue({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:0==i?t:{},apply(t){const e=u(t,i,n+1);if(!e)throw l;return e},next:t=>u(t,i+1)}),h=c(i);return ue(ue({},h),{},{apply:t=>{var e;return null!==(e=u(t,i))&&void 0!==e?e:this.coerceFallback(h)}})}};const kn=/^([a-z][a-z0-9.+-]+):/i,Sn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function xn(t){if(!t||"<anonymous>"===t)return!1;const e=kn.exec(t);return!e||Sn.includes(e[1].toLowerCase())}function $n(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:xn(e)};return Te(n)||(r.lineno=n),Te(s)||(r.colno=s),r}const Cn=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Tn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,En=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,In=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mn=(t,e)=>{const i=Tn.exec(t);if(i){const[,t,n,s]=i;return $n(e,t,"?",+n,+s)}const n=En.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=In.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=Cn(n[1]||"?",n[2]);return $n(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Rn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Pn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(t,e)=>{const i=Rn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=Pn.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=Cn(n,t),$n(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},On=/\(error: (.*)\)/;function Fn(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function Dn(t){for(let e=1;10>=e;e++){const i=t.length-2*e;if(0>i)break;let n=!0;for(let s=0;e>s;s++)if(!Fn(t[i+s],t[i+e+s])){n=!1;break}if(n){for(let n=0;e>n;n++)t[i+n]=t[i+e+n];return t.length=i+e,{start:i,length:e}}}}function Ln(t,e){const i=e.start+e.length,n=qn(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Nn(t,e){let i=e.start;for(;i>0&&Fn(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function qn(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&Fn(t[n],t[n-e.length]);)n++;return n-i}function jn(t,e){const i=e[0];let n=t.length-(i?Nn(t,i):0);for(const i of e)n-=qn(t,i);return n}function Bn(t,e,i){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],r=t[(i+n)%t.length];if(s!==r)return r>s}return!1}var zn=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=Ee(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return qe(t,"DOMException")}isDOMError(t){return qe(t,"DOMError")}},Un=class{match(t){return je(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n?null===(i=e.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:s,cause:t.cause?e.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){try{const e=t.stacktrace;if("string"==typeof e&&e.length>0)return e;const i=t.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(t){return}}},Hn=class{match(t){return!!qe(t,"ErrorEvent")&&(null!=t.error||this.ar(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return ue(ue({},n),{},{stack:null!==(i=this.lr(t))&&void 0!==i?i:n.stack,synthetic:!0})}ar(t){return Ee(t.message)&&t.message.length>0}lr(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Ee(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const Wn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Vn=class{match(t){return"string"==typeof t}coerce(t,e){var i;const[n,s]=this.getInfos(t);return{type:null!=n?n:"Error",value:null!=s?s:t,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(t){let e="Error",i=t;const n=t.match(Wn);return n&&(e=n[1],i=n[2]),[e,i]}};const Gn=["fatal","error","warning","log","info","debug"];function Qn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Zn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Be(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Ee(e)&&!Ie(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let e=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(e+=` with message: '${t.message}'`),e}if("message"in t&&"string"==typeof t.message)return t.message;const e=this.getObjectClassName(t);return`${e&&"Object"!==e?`'${e}'`:"Object"} captured as exception with keys: ${Qn(t)}`}isSeverityLevel(t){return Ee(t)&&!Ie(t)&&Gn.indexOf(t)>=0}getStack(t){try{return Ee(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:Ee(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const i=t[e];if(je(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Jn=class{match(t){return Be(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Qn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Kn=class{match(t){return Ne(t)}coerce(t,e){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Yn=class{match(t){return qe(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Be(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return Ne(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Xn="$message",ts="$timestamp",es=new Set([Xn,ts]),is={enabled:!0,max_bytes:32768};function ns(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:is.enabled,max_bytes:rs(t.max_bytes,is.max_bytes)}:ue({},is)}var ss=class{constructor(t){this.ns=[],this.ss=0,this.Mr=ns(t)}setConfig(t){this.Mr=ns(t),this.rs()}add(t){const e=function(t){let e;try{e=be(t)}catch(t){return}try{const t=JSON.parse(e);if(!$e(t))return;const i=t,n=i[Xn],s=i[ts];if(!Ee(n)||0===n.trim().length)return;if(!Ee(s)&&!Pe(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Mr.max_bytes||(this.ns.push({step:e.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function rs(t,e){if(!Pe(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const os=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function as(t){return"string"==typeof t||t}function ls(t){return"string"==typeof t?t:void 0}const us=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],cs="NativeGzipValidationError",hs=t=>t.length>=2&&31===t[0]&&139===t[1],ds=(t,e)=>t===he.GZipJS||e===he.GZipJS||"gzip"===e,vs=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),fs=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return vs(t)||e===cs};let ps;const gs=t=>{throw un(cs,`Native gzip produced invalid output: ${t}`)},ms=(ys=re(function*(t,e){18>t.size&&gs("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());hs(i)&&8===i[2]||gs("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(ps)return ps;ps=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;ps[t]=e>>>0}return ps})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&gs("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&gs("invalid-size")}),function(t,e){return ys.apply(this,arguments)});var ys;function bs(t){return _s.apply(this,arguments)}function _s(){return _s=re(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=re(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield ms(a,e),a}catch(t){if(null==i?void 0:i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var n}),_s.apply(this,arguments)}function ws(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const ks="[redacted]",Ss=/^[A-Za-z0-9+/\n\r]+=*$/,xs=/^[A-Za-z0-9_-]+={0,2}$/,$s=/[-_]/,Cs=/^data:[^,\s]*;base64,/i,Ts=/^[A-Za-z0-9+/_-]+={0,2}$/,Es=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Is=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Ms=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Rs=/[\s<>"]/,Ps=new RegExp(Ms.source,"i"),As=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Os=new RegExp(`^${As.source}`,"i"),Fs=new RegExp(As.source,"gi"),Ds=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Ls=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Ns=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,qs=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,js=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Bs=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,zs=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Us=/\b\d(?:[ ./-]?\d){12,}\b/g,Hs=/\d+/g,Ws=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Vs=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Gs(t){return function(t){return Is.test(t)}(t)||Ds.test(t)||Ls.test(t)}function Qs(t){return t.split("&",129).length>128}function Zs(t,e,i){return Gs(t)||e.includes(";")&&function(t){return t.split(";").some(t=>Gs(t.split("=",1)[0]))}(e)?ks:Ps.test(e)?i?er(e,{allowNestedUrls:!1,stripPunctuation:!0}):ks:e}function Js(t,e){const i=new URLSearchParams;let n=!1,s=!1;for(const[r,o]of new URLSearchParams(t)){const t=ir(r),a=ir(o);n||(n=t!==r||a!==o);const l=Zs(t,a,e);n||(n=l!==a),s=Gs(t)||l!==a,i.append(t,l)}return{changed:n,lastFieldSensitive:s,serialized:i.toString()}}function Ks(t,e){if(!t.includes("="))return{value:Ys(t,e),lastFieldSensitive:!1};const i=Js(t,e);return{value:i.changed?i.serialized:t,lastFieldSensitive:i.lastFieldSensitive}}function Ys(t,e){return e?er(t,{allowNestedUrls:!1,stripPunctuation:!0}):Ps.test(t)?ks:t}function Xs(t,e,i){return"#"===t?!e.fragment&&(e.fragment=!0):"?"===t&&(e.fragment?"="!==i&&!e.fragmentQuery&&(e.fragmentQuery=!0):!e.query&&(e.query=!0))}function tr(t,e){var i;if(t.length>8192&&Os.test(t))return ks;const{address:n,suffix:s}=e.stripPunctuation?function(t){let e=t.length;for(;e>0&&".,;:!?)]}'".includes(t[e-1]);)e--;return{address:t.slice(0,e),suffix:t.slice(e)}}(t):{address:t,suffix:""};let r;try{r=new URL(n)}catch(t){return ks+s}const o=r.search.slice(1),a=""!==r.hash,l=function(t){const e=t.slice(1),i=e.indexOf("?");return 0>i?{head:e,tail:null}:{head:e.slice(0,i),tail:e.slice(i+1)}}(r.hash);if(Qs(o)||Qs(l.head)||Qs(null!==(i=l.tail)&&void 0!==i?i:""))return ks+s;let u=!1;(r.username||r.password)&&(r.username=ks,r.password="",u=!0);const c=Js(o,e.allowNestedUrls);c.changed&&(r.search=c.serialized,u=!0);const h=Ks(l.head,e.allowNestedUrls),d=null===l.tail?null:(v=l.tail,h.lastFieldSensitive?{value:""===v?"":ks,lastFieldSensitive:!0}:Ks(v,e.allowNestedUrls));var v;const f=null===d?h.value:`${h.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=a?null!=d?d:h:c;return(u?ir(r.toString()):n)+(p.lastFieldSensitive?"":s)}function er(t,e){return t.replace(Ms,i=>function(t,e){const i=function(t){if(!t.includes("://"))return[];const e=[...t.matchAll(Fs)].map(t=>t.index),i=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,o="";for(let a=0;t.length>a&&e.length>s;a++){e[s]===a&&(a>0&&"="!==o&&i.push(a),s++);const l=t[a];Xs(l,n,o)?(o=l,r=!0):r&&"=&".includes(l)&&(o=l)}return i}(t);if(0===i.length)return tr(t,e);let n="",s=0;for(const r of i)n+=tr(t.slice(s,r),ue(ue({},e),{},{stripPunctuation:!1})),s=r;return n+tr(t.slice(s),e)}(i,ue(ue({},e),{},{stripPunctuation:e.stripPunctuation&&i.length!==t.length})))}function ir(t){return t.replace(Es,ks)}function nr(t,e){return function(t){return t.length>=10240&&(Ss.test(t)||function(t){const e=Cs.exec(t);if(!e)return!1;let i;try{i=decodeURIComponent(t.slice(e[0].length))}catch(t){return!1}return Ts.test(i.replace(/[\r\n]/g,""))}(t)||$s.test(t)&&xs.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,e,i){const n=4*i.maxStringLength;if(t.length>n){const s=e(t.slice(0,function(t,e){let i=e;for(;i>0&&!Rs.test(t[i-1]);)i--;return i}(t,n)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return e(t)}(t,t=>function(t){return er(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let e=t.replace(Ns," ");return e=e.replace(qs,ks),e=e.replace(js,ks),e=e.replace(Bs,`$1${ks}`),e=e.replace(Us,rr),e=e.replace(zs,ks),e=e.replace(Ws,`$1${ks}`),e=e.replace(Vs,`$1${ks}`),e}(ir(t))),e)}function sr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;if(0>s||s>9)return!1;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function rr(t){const e=[];for(let i=Hs.exec(t);null!==i;i=Hs.exec(t))e.push({digits:i[0],start:i.index,end:i.index+i[0].length});let i="",n=0,s=0;for(;e.length>s;){let r="",o=-1;for(let t=s;e.length>t&&(r+=e[t].digits,19>=r.length);t++)r.length>=13&&sr(r)&&(o=t);0>o?s++:(i+=t.slice(n,e[s].start)+ks,n=e[o].end,s=o+1)}return i+t.slice(n)}const or={}.propertyIsEnumerable;function ar(t,e){try{return cr(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function lr(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:tn};if(i.remainingNodes--,Oe(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:nn(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:tn};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?nn(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return lr(s.call(t),e,i,n+1)}catch(t){}return Se(t)?{arrayValue:{values:ur(t,e,i,n+1)}}:{kvlistValue:{values:cr(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:nn(String(t))}}function ur(t,e,i,n){const s=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(Re(r))continue;s.push(lr(r,e,i,n))}catch(t){s.push({stringValue:en})}return t.length>o&&s.push({stringValue:tn}),s}function cr(t,e,i,n){const s=[];for(const r in t)if(or.call(t,r)){if(!r){null==e||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(Me(o)||Te(o))continue;s.push({key:nn(r),value:lr(o,e,i,n)})}catch(t){s.push({key:nn(r),value:{stringValue:en}})}}return s}function hr(t,e,i){return ue(ue(ue(ue({},sn({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}const dr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function vr(t,e){const i=sn({},t),n={};for(const t of dr)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...ar(i,e),...ar(n,e)]}const fr={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 pr={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},gr=pr.info;function mr(t){try{return nn(String(t))}catch(t){return en}}function yr(t,e,i,n){const s=t.level||"info",{text:r,number:o}=pr[s]||gr,a=function(t=Date.now()){return String(t)+"000000"}(Pe(n)?n:void 0),l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),Re(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),Re(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);const u=ue({},l),c=t.attributes;if(c){let t=[];try{t=Object.keys(c)}catch(e){t=[]}for(const e of t){let t;try{t=c[e]}catch(e){t=en}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:mr(t.body)},attributes:ar(u,i)};return t.trace_id&&(h.traceId=t.trace_id),t.span_id&&(h.spanId=t.span_id),Te(t.trace_flags)||(h.flags=t.trace_flags),h}function br(t,e,i){return hr(t,e,i)}function _r(t,e,i,n){return{resourceLogs:[{resource:{attributes:vr(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var wr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=dn(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function kr(){return.75+.5*Math.random()}function Sr(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var xr=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var a;this._instance=t,this.Mr=e,this.A=i,this.hs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new wr(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new on,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ce.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:yr(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.hs(),this.A,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.A.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return n}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var t=this;return re(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return re(function*(){var e;t.ps.clear();let i=null!==(e=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t._s;t.bs=0;const n=Math.min(i.length,t.Es),a=i.slice(0,n),l=_r(a.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(l);if(t._s!==e)return;if("too-large"===u.kind&&a.length>1)t.Es=Math.max(1,Math.floor(a.length/2)),t.A.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Mr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Mr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(a.length),i=null!==(o=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==o?o:[],s+=a.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return re(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ce.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return br(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ce.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Sr(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ce.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return re(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield vn(i,t):yield i})()}flushWithTimeout(t){var e=this;return re(function*(){const i=e.flush();yield vn(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=kr(),this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const $r=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Cr(t){return String(t)+"000000"}function Tr(t,e,i,n){let s="";return n&&(s=Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(n[t])}`).join(",")),`${t}\0${e}\0${null!=i?i:""}\0${s}`}var Er=class{constructor(t,e,i){this._instance=t,this.Mr=e,this.A=i,this.Hs=new Map,this.ps=new wr(()=>this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new on,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Qs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Qs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Qs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=re(function*(){e&&(yield e.catch(()=>{})),yield t.Zs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.A.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.A.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.A.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?ue({},e.attributes):void 0,n=Tr(e.type,e.name,e.unit,i)}catch(t){return void this.A.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.Hs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Hs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.A.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array($r.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,$r)]+=1;break}}}Os(t){const e=this.Mr.beforeSend;if(!e)return t;const i=Se(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.A.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return n}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Sr(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var t=this;return re(function*(){if(t.ps.clear(),0===t.Hs.size)return;const e=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=kr()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),n.kind){case"ok":return;case"retry-later":return t.co(e),void t.ps.armNoEarlierThan(t.zs());case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.ho(t),i=function(t,e,i){return hr(t,e,i)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:vr(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}ho(t){const e=Cr(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Tr(o.type,o.name,o.unit,void 0);let a=i.get(t);a||(a=ue({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(t,a));const l=ar(null!==(n=o.attributes)&&void 0!==n?n:{},this.A),u=Cr(o.windowStartMs);if("count"===o.type){var s;const t={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};a.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:l,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(t)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:$r})}return Array.from(i.values())}co(t){for(const[n,s]of t){const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.Hs.set(n,s)}}};function Ir(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Mr="0.9.4",Rr={DEBUG:!1,LIB_VERSION:Mr,LIB_NAME:"browser-common",JS_SDK_VERSION:Mr},Pr=(t,{debugEnabled:e}={})=>{const i={N(i,...n){let s;try{s=typeof window>"u"?void 0:window}catch(t){return}s&&(Rr.DEBUG||s.POSTHOG_DEBUG||e)&&!Te(s.console)&&s.console&&("__rrweb_original__"in s.console[i]?s.console[i].__rrweb_original__:s.console[i])(t,...n)},debug(...t){i.N("debug",...t)},info(...t){i.N("log",...t)},warn(...t){i.N("warn",...t)},error(...t){i.N("error",...t)},critical(...e){console.error(t,...e)},uninitializedWarning(t){i.error(`You must initialize PostHog before calling ${t}`)},createLogger:(e,i)=>Pr(`${t} ${e}`,i)};return i},Ar=Pr("[PostHog.js]"),Or=Ar.createLogger;function Fr(t,e){Se(t)&&t.forEach(e)}function Dr(t,e){if(!Re(t))if(Se(t))t.forEach(e);else if(Fe(t))t.forEach((t,i)=>e(t,i));else for(const i in t)we.call(t,i)&&e(t[i],i)}const Lr=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Nr(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const qr=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Ar.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ar.critical(t)}}},jr=function(t){const e={};return Dr(t,function(t,i){(Ee(t)&&t.length>0||Pe(t))&&(e[i]=t)}),e};function Br(t){const e=ue({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const zr=["herokuapp.com","vercel.app","netlify.app"];function Ur(t){const e=null==t?void 0:t.hostname;if(!Ee(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of zr)if(i===t)return!1;return!0}function Hr(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function Wr(t){return"ph_toolbar_internal"===t.name}const Vr=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Gr=(t,e)=>t>=e&&Vr(),Qr=(t,e,i,n)=>{if(0===t){if(Vr()){const t=e+1;return t===i&&n(),t}return e}return 0},Zr=["localhost","127.0.0.1"],Jr=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return je(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,Br(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return be(t)}},Kr=t=>{const e=null==n?void 0:n.createElement("a");return Te(e)?null:(e.href=t,e)},Yr=function(t,e="&"){let i,n;const s=[];return Dr(t,function(t,e){Te(t)||Te(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),n=encodeURIComponent(e),s[s.length]=n+"="+i)}),s.join(e)},Xr=function(t,e){const i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let t=0;i.length>t;t++){const s=i[t].split("=");if(s[0]===e){n=s;break}}if(!Se(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Ar.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},to=function(t,e,i){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],r=(n[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),u=[];for(let t=0;l.length>t;t++){const n=l[t].split("=");Se(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(l[t]))}let c=a;return null!=o&&(c+="?"+u.join("&")),null!=s&&(c+="#"+s),c},eo=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null};function io(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!xe(n))return e;try{const t=n(e);return Ee(t)&&t?t:e}catch(t){return Ar.error("Error in get_current_url, falling back to window.location.href",t),e}}function no(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Te(n)?void 0:io(e,n)}function so(t){var e;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(e=t.closest)||void 0===e?void 0:e.call(t,".toolbar-global-fade-container")))}function ro(t){return!!t&&1===t.nodeType}function oo(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function ao(t){return!!t&&3===t.nodeType}function lo(t){return!!t&&11===t.nodeType&&ro(t.host)}function uo(t){return t?me(t).split(/\s+/):[]}function co(t,e){const i=no(e);return!!(i&&t&&t.some(t=>i.match(t)))}function ho(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return uo(e)}function vo(t){return Re(t)?null:me(t).split(/(\s+)/).filter(t=>Wo(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function fo(t){let e="";return Do(t)&&!Lo(t)&&t.childNodes&&t.childNodes.length&&Dr(t.childNodes,function(t){var i;ao(t)&&t.textContent&&(e+=null!==(i=vo(t.textContent))&&void 0!==i?i:"")}),me(e)}function po(t){var e;return Te(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const go=["a","button","form","input","select","textarea","label"];function mo(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function yo(t,e){if(Te(e))return!0;for(const i of t)if(e.some(t=>mo(i,t)))return!0;return!1}function bo(t){const e=t.parentNode;return!(!e||!ro(e))&&e}const _o=[".ph-no-autocapture","[data-ph-no-autocapture]"],wo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],ko=[...wo,"+","-","−","–"],So=ko.length+10,xo=["button","a","input","select","textarea","label"],$o=["button","link","tab","menuitem","option"],Co=(t,e)=>/[a-z0-9]/i.test(e)?ge(ko,e)?new RegExp(`\\b${e}\\b`).test(t):t.includes(e):t===e,To=t=>ge(xo,t.tagName.toLowerCase())||ge($o,(t.getAttribute("role")||"").toLowerCase());function Eo(t){let e="",i="";const n=t=>{ro(t)&&Do(t)&&!Lo(t)&&(e+=` ${fo(t)}`,i=i||t.getAttribute("aria-label")||"",Dr(t.childNodes,n))};n(t),e=me(e.replace(/\s+/g," "));const s=(Wo(e)?e:"").toLowerCase(),r=t.getAttribute("aria-label")||(s?"":i);return{safeText:s,ariaLabel:me(r).toLowerCase()}}const Io=[".ph-no-deadclick",".ph-no-capture"],Mo=[".ph-no-rageclick",".ph-no-capture"],Ro=["","text","search","email","password","url","tel","number"];function Po(t){return!(!t||!ro(t))&&(!!oo(t,"textarea")||(oo(t,"input")?ge(Ro,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}function Ao(e,i){if(!t||Oo(e))return!1;let n,s,r;var o,a;if(Oe(i)?(n=!!i&&Mo,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Mo,s=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===n)return!1;if(r&&Po(e))return!1;const{targetElementList:l}=Fo(e,!1);return!(s&&function(t,{safeText:e,ariaLabel:i}){let n;if(!0===t)n=wo;else{if(!Se(t))return!1;if(t.length>So)return Ar.error(`[PostHog] content_ignorelist array cannot exceed ${So} items. Use css_selector_ignorelist for more complex matching.`),!1;n=t.map(t=>t.toLowerCase())}return n.some(t=>Co(e,t)||Co(i,t))}(s,function(e,i){for(const t of i)if(To(t))return Eo(t);for(const e of i){try{if("pointer"!==(null==t?void 0:t.getComputedStyle(e).getPropertyValue("cursor")))break}catch(t){break}const i=Eo(e);if(i.safeText||i.ariaLabel)return i}return Eo(e)}(e,l))||yo(l,n))}const Oo=t=>!t||oo(t,"html")||!ro(t),Fo=(e,i)=>{if(!t||Oo(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!oo(r,"body");){if(lo(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=bo(r);if(!e)break;if(i||go.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function Do(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!oo(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=ho(n);if(ge(t,"ph-sensitive")||ge(t,"ph-no-capture"))return!1}if(ge(ho(t),"ph-include"))return!0;const n=t.type||"";if(Ee(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!Ee(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Lo(t){return!!(oo(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||oo(t,"select")||oo(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const No=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}))$"),qo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,jo=[16,15,14,13],Bo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),zo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Uo=/[0-9A-Za-z_]/;function Ho(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function Wo(t,e=!0){if(Re(t))return!1;if(Ee(t)){if(t=me(t),e?No.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(qo.lastIndex=0;e=qo.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of jo){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(No.test(e)&&Ho(e))return!0}}}return!1}(t))return!1;if(e?Bo.test(t):function(t){let e;for(zo.lastIndex=0;e=zo.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Uo.test(t)&&Uo.test(i)))return!0}return!1}(t))return!1}return!0}function Vo(t){let e=fo(t);return e=`${e} ${Go(t)}`.trim(),Wo(e)?e:""}function Go(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Dr(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=fo(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${Go(t)}`.trim())}catch(t){Ar.error("[AutoCapture]",t)}}),e}function Qo(t){return t.replace(/"|\\"/g,'\\"')}function Zo(t){const e=t.attr__class;if(e)return Se(e)?e:uo(e)}const Jo=1e6;function Ko(t){var e;return Math.min(Jo,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:Jo)}const Yo={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Jo,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},Xo=["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"],ta=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ea=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ia=t=>{Re(t)||Dr(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return Xo.includes(e)||ea.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},na=["/s/","/e/","/i/"];function sa(t,e,i,n){if(Re(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return Ee(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function ra(t,e){if(Re(t))return t;let i=t;return Wo(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Dr(ta,t=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(t))&&(i="[SessionRecording] "+e+" body redacted as might contain: "+t)}),i}const oa=new WeakSet,aa="disabled",la="sampled",ua="active",ca="buffering",ha="paused",da="lazy_loading",va="rrweb_error",fa="trigger_activated",pa="trigger_pending",ga="trigger_disabled";function ma(t,e,i,n,s,r){return 0===e?ga:(null==t?void 0:t.get_property(i?n+i:s))===r?fa:pa}function ya(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function ba(t){return t.includes("trigger_activated")?fa:t.includes("trigger_pending")?pa:ga}function _a(t){const e=new Set(t);switch(e.delete(ga),e.size){case 0:return ga;case 1:return Array.from(e)[0];default:return pa}}var wa=class{constructor(t){this.q=t}triggerStatus(t){return ba(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return ba(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},ka=class{constructor(t){this.q=t}triggerStatus(t){return _a(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return _a(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Sa=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return fa}stop(){}};const xa=t=>"sessionRecording"in t;var $a=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(xa(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(xa(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.G()}G(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Ar.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Ar.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}Z(t){return ma(this._instance,this.j.length,this.V,ut,ot,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Wt]:e}),e}triggerStatusNoSideEffects(t){return this.Z(t)}isCurrentUrlBlocked(){const t=no(this._instance);if(!t)return!1;try{return ya(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=no(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=ya(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=no(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=ya(s,this.B,this.U);o&&!r?t():!o&&r&&e();const a=this.Z(n)===fa,l=ya(s,this.j,this.H);!a&&l&&i("url",s)}stop(){this.W=""}},Ca=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[jt]:t}),t}triggerStatusNoSideEffects(){let t=pa;return Re(this.linkedFlag)&&(t=ga),this.linkedFlagSeen&&(t=fa),t}onConfig(t,e){var i;if(this.linkedFlag=(xa(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Ee(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Ee(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if($e(s)&&t in s){const e=s[t];r=Oe(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Ta=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(xa(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return ma(this._instance,this.K.length,this.V,lt,at,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[qt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===fa,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Ea=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new $a(t,e.id),this.tt=new Ta(t,e.id),this.et=new Ca(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new wa(s):new ka(s)}else this.nt=new Sa}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===pa).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?ut+this.group.id:lt+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function Ia(t){if(t.rrwebError)return va;if(!t.receivedFlags)return ca;if(!t.isRecordingEnabled)return aa;if(t.urlTriggerMatching.urlBlocked)return ha;const e=!0===t.isSampled,i=new wa([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?la:"trigger_activated"===i?ua:"trigger_pending"===i?ca:!1===t.isSampled?aa:ua}function Ma(t){if(t.rrwebError)return va;if(!t.receivedFlags)return ca;if(!t.isRecordingEnabled)return aa;if(t.urlTriggerMatching.urlBlocked)return ha;const e=new ka([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==ga,n=Oe(t.isSampled);return i&&"trigger_pending"===e?ca:i&&"trigger_disabled"===e||n&&!t.isSampled?aa:!0===t.isSampled?la:ua}function Ra(){const t=[];return function(e,i){if($e(i)||Se(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function Pa(t){try{const e=JSON.stringify(t,Ra());return e?new Blob([e]).size:0}catch(t){return-1}}function Aa(t){if(Me(t))return 4;if(Te(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(Se(t)){let e=2;for(let i=0;t.length>i;i++){i>0&&(e+=1);const n=t[i];e+=Te(n)||Me(n)?4:Aa(n)}return e}const e=t;let i=2,n=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const s=e[t];Te(s)||(n||(i+=1),n=!1,i+=t.length+3+Aa(s))}return i}default:return 0}}function Oa(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),i=t.sizes.slice(0,e),n=t.sizes.slice(e);return[Oa({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Oa({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var Fa=Uint8Array,Da=Uint16Array,La=Uint32Array,Na=new Fa([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]),qa=new Fa([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]),ja=new Fa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ba=function(t,e){for(var i=new Da(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new La(i[30]);for(n=1;30>n;++n)for(var r=i[n];i[n+1]>r;++r)s[r]=r-i[n]<<5|n;return[i,s]},za=Ba(Na,2),Ua=za[1];za[0][28]=258,Ua[258]=28;for(var Ha=Ba(qa,0)[1],Wa=new Da(32768),Va=0;32768>Va;++Va){var Ga=(43690&Va)>>>1|(21845&Va)<<1;Wa[Va]=((65280&(Ga=(61680&(Ga=(52428&Ga)>>>2|(13107&Ga)<<2))>>>4|(3855&Ga)<<4))>>>8|(255&Ga)<<8)>>>1}var Qa=function(t,e,i){for(var n=t.length,s=0,r=new Da(e);n>s;++s)++r[t[s]-1];var o,a=new Da(e);for(s=0;e>s;++s)a[s]=a[s-1]+r[s-1]<<1;if(i){o=new Da(1<<e);var l=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],c=e-t[s],h=a[t[s]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[Wa[h]>>>l]=u}else for(o=new Da(n),s=0;n>s;++s)o[s]=Wa[a[t[s]-1]++]>>>15-t[s];return o},Za=new Fa(288);for(Va=0;144>Va;++Va)Za[Va]=8;for(Va=144;256>Va;++Va)Za[Va]=9;for(Va=256;280>Va;++Va)Za[Va]=7;for(Va=280;288>Va;++Va)Za[Va]=8;var Ja=new Fa(32);for(Va=0;32>Va;++Va)Ja[Va]=5;var Ka=Qa(Za,9,0),Ya=Qa(Ja,5,0),Xa=function(t){return(t/8|0)+(7&t&&1)},tl=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Da?Da:t instanceof La?La:Fa)(i-e);return n.set(t.subarray(e,i)),n},el=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},il=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},nl=function(t,e){for(var i=[],n=0;t.length>n;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,r=i.slice();if(!s)return[new Fa(0),0];if(1==s){var o=new Fa(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Da(d+1),f=sl(i[c-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var b=r[n].s;e>v[b]?p-=1<<e-v[b]++-1:++n}for(;n>=0&&p;--n){var _=r[n].s;v[_]==e&&(--v[_],++p)}f=e}return[new Fa(v),f]},sl=function(t,e,i){return-1==t.s?Math.max(sl(t.l,e,i+1),sl(t.r,e,i+1)):e[t.s]=i},rl=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Da(++e),n=0,s=t[0],r=1,o=function(t){i[n++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++r;else{if(!s&&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(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=t[a]}return[i.subarray(0,n),e]},ol=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},al=function(t,e,i){var n=i.length,s=Xa(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;n>r;++r)t[s+r+4]=i[r];return 8*(s+4+n)},ll=function(t,e,i,n,s,r,o,a,l,u,c){el(e,c++,i),++s[256];for(var h=nl(s,15),d=h[0],v=h[1],f=nl(r,15),p=f[0],g=f[1],m=rl(d),y=m[0],b=m[1],_=rl(p),w=_[0],k=_[1],S=new Da(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=nl(S,7),T=C[0],E=C[1],I=19;I>4&&!T[ja[I-1]];--I);var M,R,P,A,O=u+5<<3,F=ol(s,Za)+ol(r,Ja)+o,D=ol(s,d)+ol(r,p)+o+14+3*I+ol(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=O&&D>=O)return al(e,c,t.subarray(l,l+u));if(el(e,c,1+(F>D)),c+=2,F>D){M=Qa(d,v,0),R=d,P=Qa(p,g,0),A=p;var L=Qa(T,E,0);for(el(e,c,b-257),el(e,c+5,k-1),el(e,c+10,I-4),c+=14,x=0;I>x;++x)el(e,c+3*x,T[ja[x]]);c+=3*I;for(var N=[y,w],q=0;2>q;++q){var j=N[q];for(x=0;j.length>x;++x)el(e,c,L[B=31&j[x]]),c+=T[B],B>15&&(el(e,c,j[x]>>>5&127),c+=j[x]>>>12)}}else M=Ka,R=Za,P=Ya,A=Ja;for(x=0;a>x;++x)if(n[x]>255){var B;il(e,c,M[257+(B=n[x]>>>18&31)]),c+=R[B+257],B>7&&(el(e,c,n[x]>>>23&31),c+=Na[B]);var z=31&n[x];il(e,c,P[z]),c+=A[z],z>3&&(il(e,c,n[x]>>>5&8191),c+=qa[z])}else il(e,c,M[n[x]]),c+=R[n[x]];return il(e,c,M[256]),c+R[256]},ul=new La([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),cl=new Fa(0),hl=function(){for(var t=new La(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),dl=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function vl(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,n=0;e.length>n;++n)i=hl[255&i^e[n]]^i>>>8;t=i},d(){return 4294967295^t}}}(),n=t.length;i.p(t);var s,r,o,a,l,u=(s=t,r=e,o=function(t){return 10+(t.filename&&t.filename.length+1||0)}(e),a=8,function(t,e,i,n,s,r){var o=t.length,a=new Fa(n+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(n,a.length-s),u=0;if(!e||8>o)for(var c=0;o>=c;c+=65535){var h=c+65535;o>h?u=al(l,u,t.subarray(c,h)):(l[c]=r,u=al(l,u,t.subarray(c,o)))}else{for(var d=ul[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Da(32768),m=new Da(p+1),y=Math.ceil(i/3),b=2*y,_=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},w=new La(25e3),k=new Da(288),S=new Da(32),x=0,C=0,T=(c=0,0),E=0,I=0;o>c;++c){var M=_(c),R=32767&c,P=m[M];if(g[R]=P,m[M]=R,c>=E){var A=o-c;if((x>7e3||T>24576)&&A>423){u=ll(t,l,0,w,k,S,C,T,I,c-I,u),T=x=C=0,I=c;for(var O=0;286>O;++O)k[O]=0;for(O=0;30>O;++O)S[O]=0}var F=2,D=0,L=f,N=R-P&32767;if(A>2&&M==_(c-N))for(var q=Math.min(v,A)-1,j=Math.min(32767,c),B=Math.min(258,A);j>=N&&--L&&R!=P;){if(t[c+F]==t[c+F-N]){for(var z=0;B>z&&t[c+z]==t[c+z-N];++z);if(z>F){if(F=z,D=N,z>q)break;var U=Math.min(N,z-2),H=0;for(O=0;U>O;++O){var W=c-N+O+32768&32767,V=W-g[W]+32768&32767;V>H&&(H=V,P=W)}}}N+=(R=P)-(P=g[R])+32768&32767}if(D){w[T++]=268435456|Ua[F]<<18|Ha[D];var G=31&Ua[F],Q=31&Ha[D];C+=Na[G]+qa[Q],++k[257+G],++S[Q],E=c+F,++x}else w[T++]=t[c],++k[t[c]]}}u=ll(t,l,r,w,k,S,C,T,I,c-I,u),r||(u=al(l,u,cl))}return tl(a,0,n+Xa(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,a,!l)),c=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&dl(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;i.length>=n;++n)t[n+10]=i.charCodeAt(n)}}(u,e),dl(u,c-8,i.d()),dl(u,c-4,n),u}function fl(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new Fa(t.length+(t.length>>>1)),s=0,r=function(t){n[s++]=t},o=0;i>o;++o){if(s+5>n.length){var a=new Fa(s+8+(i-o<<1));a.set(n),n=a}var l=t.charCodeAt(o);128>l||e?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&t.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 tl(n,0,s)}function pl(t,e){var i="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var n=0;t.length>n;){var s=t[n++];128>s||e?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&t[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&t[n++])<<6|63&t[n++]):(s=((15&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var gl=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,a,l;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=t.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=Aa(t);var a,l;return o>this.ct?(null===(a=(l=this.it).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Je({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,A:Ar}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Pe(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const ml=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Pe(t)&&isFinite(t)&&Math.floor(t)===t});var yl=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,n,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>i||0>n||0>s||e>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|i>>>8,r[7]=i,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t(r)}toString(){let t="";for(let e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let e=0;16>e;e++){const i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},bl=class{generate(){const t=this.generateOrAbort();if(!Te(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(Te(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Pe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.It();else{if(this.Ct>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return yl.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new wl}};let _l=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Te(t.crypto)&&crypto.getRandomValues&&(_l=t=>crypto.getRandomValues(t));var wl=class{nextUint32(){return this.Rt.length>this.Et||(_l(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let kl;const Sl=()=>xl().toString(),xl=()=>(kl||(kl=new bl)).generate();let $l="";const Cl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Tl=null;const El={At(){if(!Me(Tl))return Tl;if(Tl=!1,n)try{const t=`__ph_cookie_support_${Sl()}`;El.$t(t,"xyz"),Tl='"xyz"'===ml(t),El.Pt(t)}catch(t){Tl=!1}return Tl},Lt(t){Ar.error("cookieStore error: "+t)},Ot:ml,Dt(t){let e;try{e=JSON.parse(El.Ot(t))||{}}catch(t){}return e},$t(t,e,i,s,r){if(!n)return!1;try{let o="",a="";const l=function(t,e){if(e){let e=function(t,e=n){if($l)return $l;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Sl();for(;!$l&&s--;){const t=i.slice(s).join("."),n=r+"=1;domain=."+t+";path=/";e.cookie=n+";max-age=3",e.cookie.includes(r)&&(e.cookie=n+";max-age=0",$l=t)}return $l}(t);if(!e){const i=(t=>{const e=t.match(Cl);return e?e[0]:""})(t);i!==e&&Ar.info("Warning: cookie subdomain discovery mismatch",i,e),e=i}return e?"; domain=."+e:""}return""}(n.location.hostname,s);if(i){const t=new Date;t.setTime(t.getTime()+864e5*i),o="; expires="+t.toUTCString()}r&&(a="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Ar.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Pt(t,e){if((null==n?void 0:n.cookie)&&(!e||!Me(ml(t))))try{El.$t(t,"",-1,e)}catch(t){return}}};let Il=null;const Ml={At(){if(!Me(Il))return Il;let e=!0;if(Te(t))e=!1;else try{const t="__mplssupport__";Ml.$t(t,"xyz"),'"xyz"'!==Ml.Ot(t)&&(e=!1),Ml.Pt(t)}catch(t){e=!1}return e||Ar.error("localStorage unsupported; falling back to cookie store"),Il=e,e},Lt(t){Ar.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ml.Lt(t)}return null},Dt(t){try{return JSON.parse(Ml.Ot(t))||{}}catch(t){}return null},$t(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ml.Lt(t)}return!1},Pt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ml.Lt(t)}}},Rl=[w,v,b,f,x,m,g,p,k],Pl=[R,M,nt,st,Pt,Rt,D,Ct],Al=t=>t+"_cpm",Ol=["__proto__","constructor","prototype"],Fl=t=>{if(!$e(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Ol.indexOf(i)&&(e[i]=t[i])}),e},Dl=(t,e=[])=>{const i={};return[...Pl,...e].forEach(e=>{const n=t[e];Te(n)||Me(n)||""===n||(i[e]=n)}),i},Ll=t=>{let e=5381,i=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Nl=(t,e)=>({p:e,f:Ll(JSON.stringify(t))}),ql=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=El.Dt(Al(t)),n=(null==i?void 0:i.f)===Ll(e)&&Se(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},jl=(t,e)=>e+"|"+(El.Ot(Al(t))||""),Bl={},zl={At:()=>!0,Lt(t){Ar.error("memoryStorage error: "+t)},Ot:t=>t in Bl?Bl[t]:null,Dt:t=>t in Bl?Bl[t]:null,$t:(t,e)=>(Bl[t]=e,!0),Pt(t){delete Bl[t]}};let Ul=null;const Hl={At(){if(!Me(Ul))return Ul;if(Ul=!0,Te(t))Ul=!1;else try{const t="__support__";Hl.$t(t,"xyz"),'"xyz"'!==Hl.Ot(t)&&(Ul=!1),Hl.Pt(t)}catch(t){Ul=!1}return Ul},Lt(t){Ar.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Hl.Lt(t)}return null},Dt(t){try{return JSON.parse(Hl.Ot(t))||null}catch(t){}return null},$t(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Hl.Lt(t)}return!1},Pt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Hl.Lt(t)}}};Rr.DEBUG=!1,Rr.LIB_VERSION="1.438.9",Rr.LIB_NAME="web";var Wl=Rr,Vl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(dt,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(dt);return $e(i=e)&&Ee(i.sessionId)&&Pe(i.size)&&e.sessionId===t?e.size:0;var i}};function Gl(t,e){return function(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return Math.abs(e)}(t)%100<Ze(100*e,0,100,Ar)}function Ql(t){return`$survey_response_${t}`}function Zl(t,e){if(!e)return null;const i=t[Ql(e)];return Se(i)?[...i]:i}function Jl({event:t,survey:e,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return ue(ue(ue(ue({},!Te(n)&&{$survey_submission_id:n}),"sent"===t?!Te(s)&&{$survey_completed:s}:{$survey_partially_completed:Kl(i)}),r&&{$survey_language:r}),function(t={},e,i){const n={};return e.questions.forEach(e=>{if(Te(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=Zl(t,e.id);Te(r)||(n[i]=r)}),ue(ue({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:Zl(t,e.id)}})},t),n)}(i,e,o))}function Kl(t={}){return Object.values(t).some(t=>!Re(t))}function Yl(t,e){let i=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(i=`$survey_${e}/${t.id}/${t.current_iteration}`),i}function Xl(t){return"string"==typeof t&&t.trim()?t.trim():null}function tu(t){return t.toLowerCase()}function eu(t,e,i){if(!t||!e)return null;const n=tu(e),s=Object.keys(t).find(t=>tu(t)===n);if(s)return null==i||i.debug(`Found exact translation match: ${s}`),s;if(n.includes("-")){const s=n.split("-")[0],r=Object.keys(t).find(t=>tu(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const iu=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function nu(t,e,i){var n;const s=eu(t.translations,e,i),r=ue({},t);let o=!1;if(s){var a;const e=null===(a=t.translations)||void 0===a?void 0:a[s];if(e)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),Te(e.name)||(r.name=e.name,o=!0),r.appearance){const t=ue({},r.appearance);for(const i of iu){const n=e[i];Te(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return iu.some(e=>!Te(t[e]))})(e)&&(o=!0)}const l=t.questions.map(t=>function(t,e,i){var n;const s=eu(t.translations,e,i);if(!s)return{question:t,matchedKey:null,hasChanges:!1};const r=null===(n=t.translations)||void 0===n?void 0:n[s];if(!r)return{question:t,matchedKey:null,hasChanges:!1};const o=ue({},t);let a=!1;return Te(r.question)||(o.question=r.question,a=!0),Te(r.description)||(o.description=r.description,a=!0),Te(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Te(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Te(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Te(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(t){return Se(t.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:t,matchedKey:a?s:null,hasChanges:a}}(t,e,i)),u=l.map(t=>t.question),c=l.some(t=>t.hasChanges);let h=null;return s||(h=(null===(n=l.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),c&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||h:null}}function su(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}function ru(t){var e;return su(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const ou=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},au=t=>t.toLowerCase(),lu={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>ou(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!ou(e,t))),icontains:(t,e)=>e.map(au).some(e=>t.map(au).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(au).every(e=>t.map(au).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i<parseFloat(t))})};function uu(t,e){return!t||Object.entries(t).every(([t,i])=>{const n=null==e?void 0:e[t];if(null==n)return!1;const s=lu[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const cu=t=>{const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e};function hu(t,e,i){return Jr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const du=new Set(["is_not","not_icontains","not_regex"]);function vu(t,e,i){return!t||0===t.length||t.every(t=>{const n="person"===t.type?i:e,s=null==n?void 0:n[t.key],r=t.operator||"exact";if(Te(s)||Me(s))return du.has(r);const o=lu[r];return!!o&&!Te(t.value)&&!Me(t.value)&&o(Se(t.value)?t.value.map(String):[String(t.value)],Se(s)?s.map(String):[String(s)])})}const fu=Or("[SessionRecording]");function pu(t,e){return e?t:"!"+t}function gu(t,e){return t===e||t!=="!"+e&&null}var mu=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.zt=null,this.Ht=Ma}onRemoteConfig(t){this.zt=Pe(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new wa([this.tt,this.Y]),this.Ht=Ia):(this.Ut=new ka([this.tt,this.Y]),this.Ht=Ma),this._instance.register_for_session({[Ut]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.Ht({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Pe(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Re(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){fu.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.zt;var n,s;if(!Pe(i))return null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"));const r=this._instance.get_property(st),o=this._instance.get_property(Y),a=gu(r,t),l=Pe(o)&&o!==i,u=Te(o)&&r===t,c=l||u||!Oe(a),h=c?Gl(t,i):a;c&&(h?this.qt("sampled"):fu.warn(`Sample rate (${i}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:pu(t,h),$replay_sample_rate:Me(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Pe(this.zt))return;const e=this._instance.get_property(st);Oe(gu(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===pa}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===pa).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},yu=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Gt=[],this.Qt=new Map,this.Zt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[Ut]:"v2_trigger_groups",[Ht]:t.triggerGroups.length}),this.Y.onConfig(t)):fu.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return va;if(!t.receivedFlags)return ca;if(!t.isRecordingEnabled)return aa;if(t.urlTriggerMatching.urlBlocked)return ha;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return aa;let n=!1,s=!1;for(const r of e){const e=r.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=r.group.id,e=i.get(t);Te(e)?Ar.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?la:n?ca:aa}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Gt,triggerGroupSamplingResults:this.Qt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Gt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Pe(t)&&(Me(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Gt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Zt)return fu.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Gt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(w);s.some(e=>!e.properties||0===e.properties.length||vu(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){fu.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Gt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=ct+s,a=this._instance.get_property(o);let l=null,u=!1,c=!1,h=!1;if($e(a)){const e=a.sessionId,i=a.sampleRate,n=a.sampled;u="string"==typeof e&&e!==t,c=Pe(i)&&i!==r,l=e===t&&Pe(i)&&i===r&&Oe(n)?n:null}else l=a===t||null,u="string"==typeof a&&a!==t,h=a===t;const d=u||c||h||!Oe(l),v=d?Gl(t+s,r):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Qt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Zt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Gt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Gt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Qt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Bt]:e})}hasPendingTriggers(t){for(const e of this.Gt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Gt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||vu(i,e,this._instance.get_property(w))}Jt(t){this.Gt.forEach(t=>t.stop()),this.Gt=[],this.Qt.clear();for(const e of t){const t=new Ea(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Gt.push(t)}}};function bu(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const _u=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],wu=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._u],ku="<masked>",Su=["li_fat_id"];function xu(t,e,i){if(!n)return{};const s=e?[..._u,...i||[]]:[],r=$u(to(n.URL,s,ku),t),o=function(){const t={};return Dr(Su,function(e){const i=ml(e);t[e]=i||null}),t}();return Lr(o,r)}function $u(t,e){const i=wu.concat(e||[]),n={};return Dr(i,function(e){const i=Xr(t,e);n[e]=i||null}),n}function Cu(t){const e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!Me(e)){s.$search_engine=e;const t=n?Xr(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Tu(){return navigator.language||navigator.userLanguage}function Eu(){const t=Tu();return"string"==typeof t?t.split("-")[0]:void 0}const Iu="$direct";function Mu(){return(null==n?void 0:n.referrer)||Iu}function Ru(t,e,i=!1){const n=t?[..._u,...e||[]]:[],r=i?cn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Mu().substring(0,1e3),u:o?to(o,n,ku):void 0}}function Pu(t,e=!1){var i;const{r:n,u:s}=t,r=e?cn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Iu?Iu:null===(i=Kr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=Kr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=$u(r);Lr(o,e)}if(n){const t=Cu(n);Lr(o,t)}return o}function Au(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Ou=1e5,Fu=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Du=[],Lu=()=>!1,Nu="@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(" "),qu="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ju="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(" "),Bu="Accommodation AdministrativeArea Country Place State".split(" "),zu={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:qu,publisher:ju},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Du},Offer:{seller:ju},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:ju,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ju,areaServed:Bu,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Du}},Uu=[["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(" "),zu.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),zu.Event],[ju,zu.Organization],[Bu,zu.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),zu.Product]];function Hu(t,e){return we.call(t,e)?t[e]:void 0}function Wu(t){const e=typeof t;return Me(t)||"string"===e||"number"===e||"boolean"===e}function Vu(t,e){return e&&function(t){return Ee(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function Gu(t,e){return Se(t)&&t.every(Wu)?t.map(t=>Vu(t,e)).filter(t=>!Te(t)):Wu(t)?Vu(t,e):void 0}function Qu(t,e){if("string"!=typeof t)return;const i=t.trim(),n=i.indexOf("#"),s=0>n?i:i.slice(n+1);if(!(!s||0>n&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return e(s)?s:void 0}catch(t){return}}function Zu(t){if(we.call(zu,t))return zu[t];for(const[e,i]of Uu)if(e.includes(t))return i}function Ju(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function Ku(t,e,i,n){if(Se(t)){const s=t.map(t=>Ku(t,e,i,n)).filter(t=>!Te(t));return s.length?s:void 0}return Yu(t,e,i,n)||void 0}function Yu(t,e,i,n){if(!$e(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Hu(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:Se(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Fu.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!Zu(t)&&(!n||!n.length||n.includes(t))),a={};for(const n of Nu){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?Qu(Hu(t,n),e):Gu(Hu(t,n),i.maskUrl);Te(o)||Ju(a,n,o)}for(const n of o){const s=Zu(n);for(const n of Object.keys(s)){const r=Hu(t,n),o=s[n];if(!0===o){const t=Gu(r,i.maskUrl);Te(t)||Ju(a,n,t)}else{const t=Ku(r,e,i,o);Te(t)||Ju(a,n,t)}}}const l=Ku(Hu(t,"@graph"),e,i);return Te(l)||Ju(a,"@graph",l),Object.keys(a).length?a:null}function Xu(t,e,i){if(!$e(t))return null;const n=Hu(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=Yu(t,e,i);return s?ue({"@context":"https://schema.org"},s):null}function tc(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function ec(t,e,i){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!i&&t.matches(i)}catch(t){return!1}}function ic(t,e,i){for(let n=t;n;){if(ec(n,e,i))return!0;const t=n.parentNode;n=n.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function nc(t){return tc(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(tc)}function sc(t){return $e(t)?t.network_timing:t}const rc=Or("[SessionRecording]"),oc=[1,2,3,4,5,6,7,12],ac=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function lc(){var t;return null==h||null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function uc(){var t;return null===(t=lc())||void 0===t?void 0:t.record}function cc(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,Ra())}}function hc(t){return pl(vl(fl(cc(t))),!0)}function dc(t){return vc.apply(this,arguments)}function vc(){return(vc=re(function*(t){const e=yield bs(cc(t),Wl.DEBUG,{rethrow:!0});return pl(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let fc,pc;const gc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let mc=!1;function yc(t){var e;return Se(t)&&0===t.length?(fc=null!==(e=fc)&&void 0!==e?e:hc([]),fc):hc(t)}function bc(t){return _c.apply(this,arguments)}function _c(){return(_c=re(function*(t){var e;return Se(t)&&0===t.length?fc||(pc=null!==(e=pc)&&void 0!==e?e:dc([]).then(t=>(fc=t,t)).catch(t=>{throw fc=void 0,pc=void 0,t}),pc):dc(t)})).apply(this,arguments)}function wc(t){return gc&&!mc&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function kc(t){return{event:t,size:Aa(t)}}function Sc(t,e){return ue(ue({},t),{},{data:e,cv:"2024-10"})}function xc(t,e){return ue(ue({},t),{},{cv:"2024-10",data:ue(ue({},t.data),e)})}function $c(t){try{if(2===t.type)return kc(Sc(t,hc(t.data)));if(3===t.type&&0===t.data.source)return kc(xc(t,{texts:yc(t.data.texts),attributes:yc(t.data.attributes),removes:yc(t.data.removes),adds:yc(t.data.adds)}));if(3===t.type&&8===t.data.source)return kc(xc(t,{adds:t.data.adds?hc(t.data.adds):void 0,removes:t.data.removes?hc(t.data.removes):void 0}))}catch(t){rc.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:Pa(t)}}function Cc(){return Cc=re(function*(t){try{if(2===t.type)return kc(Sc(t,yield dc(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([bc(t.data.texts),bc(t.data.attributes),bc(t.data.removes),bc(t.data.adds)]);return kc(xc(t,{texts:e,attributes:i,removes:n,adds:s}))}if(3===t.type&&8===t.data.source){const[e,i]=yield Promise.all([t.data.adds?dc(t.data.adds):void 0,t.data.removes?dc(t.data.removes):void 0]);return kc(xc(t,{adds:e,removes:i}))}}catch(e){return fs(e)&&(mc=!0),rc.warn("could not compress event asynchronously - trying synchronous compression",e),$c(t)}return{event:t,size:Pa(t)}}),Cc.apply(this,arguments)}function Tc(t,e){return 5===t.type&&t.data.tag===e}function Ec(t){return Tc(t,"sessionIdle")}function Ic(t){return Tc(t,"$session_ending")}function Mc(t){return Tc(t,"$session_starting")}var Rc=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return gu(this._instance.get_property(st),this.sessionId)}get zt(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Pe(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=0,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Ie=!1,this.Me=!1,this.Te=void 0,this.Re=void 0,this.Ee=!1,this.Ae=[],this.$e=0,this.Oe=0,this.Pe=!1,this.Le=void 0,this.Wt=void 0,this.De=void 0,this.Fe=void 0,this.Ne=void 0,this.qe=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.je)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this.Xt,u=this.je;var c;if(a&&this.Vt("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(c=this.Be)||void 0===c?void 0:c.currentTrackedSize(l)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),null===(s=lc())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.ze(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.je===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.He(e)}a&&this.Vt("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.Ue=!1,this.We=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[rt])===this.Xt},this.Ve=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Pe(i)&&Pe(n)?n-i:null},this.Ge=()=>{var t,e;const i=this.ie;if(!Pe(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Qe;return Pe(t)&&t>=0&&i>t}if(this.We())return!1;const n=this.Ve();return!!Me(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.Ze=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Je&&(this.Ke(void 0),this.be&&(this.be=!1,this.jt())),this.Xe(),this.Ye(!0)):this.tn()},this.en=()=>{this.Ze()},this.nn=()=>{this.Vt("browser offline",{})},this.rn=()=>{this.Vt("browser online",{})},this.sn=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Je=!0),this.Vt("window "+n.visibilityState,{}))},this.Je=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.je=s,this._sessionStartTimestamp=r,this.et=new Ca(this._instance),this.Y=new $a(this._instance),this.tt=new Ta(this._instance),this.Rt=this.tn(),this.an="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||rc.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.Be=new Vl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Je=!0)}get ln(){var t,e,i,n,s,r,o,a,l;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,c={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},h=null!==(r=null==c?void 0:c.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(a=null==c?void 0:c.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,f=null!==(l=null==c?void 0:c.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Te(h)&&Te(d)&&Te(v)&&Te(f)?void 0:{maskAllInputs:null==h||h,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}un(){var t;if(this.xe)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Re(e))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const n=null==i?void 0:i[t],s=e[t];return!Te(n)&&n!==s});0!==n.length&&(this.xe=!0,rc.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: '+n.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:e}))}get cn(){var t;return Ze(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Or("canvas recording resolution scale"),1)}get dn(){var t,e,i,n,s,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==e&&e,c=null!==(n=null!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==n?n:4;let h=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 h){const t=parseFloat(h);h=isNaN(t)?.4:t}return{enabled:u,fps:Ze(c,0,12,Or("canvas recording fps"),4),quality:Ze(h,0,1,Or("canvas recording quality"),.4)}}get hn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get fn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),a=sc(this._instance.config.capture_performance),l=sc(null==n?void 0:n.capturePerformance),u=!!(Oe(a)?a:l);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}vn(){var t,e;const i=[],n=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.hn&&i.push(n());const r=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.fn&&xe(r))if(!Zr.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=xe(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(ue(ue({},((t,e,i)=>{const n={payloadSizeLimitBytes:Yo.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Yo.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Yo.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,r=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,a=(t=>{const e=Ko(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=sa(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=sa(t.responseBody,t.responseHeaders,e,"Response")),t)})(n),l=e=>{return a(((t,e,i)=>{var n;if(null==i?void 0:i(t.name))return;const s=Kr(t.name);let r=0===e.indexOf("http")?null===(n=Kr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&na.some(t=>0===o.indexOf(t))?void 0:t})((ia((n=e).requestHeaders),ia(n.responseHeaders),n),t.api_host,i));var n},u=xe(t.session_recording.maskNetworkRequestFn);return u&&xe(t.session_recording.maskCapturedNetworkRequestFn)?Ar.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."):u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:ue(ue({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=xe(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var i,n;const s=l(e);if(!s)return;const r=s.isInitial?{name:"",entryType:s.entryType,startTime:s.startTime,duration:s.duration,endTime:s.endTime,timeOrigin:s.timeOrigin,timestamp:s.timestamp,isInitial:!0}:void 0,o=null===(i=(n=t.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Re(o)&&r?(oa.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Te(t))return t.requestBody=ra(t.requestBody,"Request"),t.responseBody=ra(t.responseBody,"Response"),t}(l(t)),ue(ue(ue({},Yo),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.fn,t)),{},{captureFetchSynchronously:!0===this._instance.config.__preview_replay_sync_fetch})))}else rc.info("NetworkCapture not started because we are on localhost.");return i}pn(t){return this._instance.config.disable_capture_url_hashes?cn(t):t}mn(t,e=!1){const i=e?cn(t):this.pn(t),n=this._instance.config.mask_personal_data_properties?[..._u,...this._instance.config.custom_personal_data_properties||[]]:[];return this.gn(to(i,n,ku))}gn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}yn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):rc.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.yn(ac(()=>uc().addCustomEvent(t,e)))}bn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}wn(t){if(!this.bn())return!1;try{const e=uc();return!!e&&(e.addCustomEvent("$json_ld",t),this.bn())}catch(t){return!1}}kn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this._n)||void 0===e?void 0:e.scan(t)})}Sn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.mn(e.origin+e.pathname+e.search);this.xn!==i&&(this.xn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}Cn(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.yn(t)})}}jt(){return this.yn(ac(()=>uc().takeFullSnapshot()))}get In(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Pe(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Mn(){if(this.Tn&&clearInterval(this.Tn),!0===this.de)return;const t=this.In;t&&(this.Tn=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.Rn(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Mn()}En(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this._n)||void 0===t||t.scan(),clearInterval(this.Tn),rc.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}An(){var t;this.Y.urlBlocked&&(null===(t=this._n)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.kn(),this.Mn(),this.Vt("recording resumed",{reason:"left blocked url"}),rc.info("recording resumed"))}$n(t,e){var i;if("event"===t&&this.Rn(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?ot:at;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.Ye(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(J);if(!t)return;let e;try{e=$e(t)?t:JSON.parse(t)}catch(t){return void rc.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ue){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void rc.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}On(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void rc.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ke(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.Pe&&(this.Pn(),this.tn());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.je=a,this._sessionStartTimestamp=l,this.Ln(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new yu(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new mu(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.$n(t,e)),this.On(X,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(X)}),this.On(tt,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(tt)}),this.On(it,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(it)}),this.On(et,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(et)}),this.re.makeSamplingDecisions(this.sessionId),this.Dn(),this.ke||(Hr(t,"beforeunload",this.Ze),Hr(t,"pagehide",this.en),Hr(t,"offline",this.nn),Hr(t,"online",this.rn),Hr(n,"visibilitychange",this.sn),!this.De&&xe(this.Yt.onSessionId)&&(this.De=this.Yt.onSessionId(this.qe)),!this.Fe&&xe(this.Yt.on)?this.Fe=this.Yt.on("forcedIdleReset",()=>{this.ze(),this.de="unknown",this.stop(),this.Ne=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.Ne)||void 0===n||n.call(this),this.Ne=void 0,this.qe(t,e,i)})}):xe(this.Yt.on)||rc.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.Le)&&(this.Le=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.mn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){rc.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}Fn(){var e,i,s,r,o,a;null==t||t.removeEventListener("beforeunload",this.Ze),null==t||t.removeEventListener("pagehide",this.en),null==t||t.removeEventListener("offline",this.nn),null==t||t.removeEventListener("online",this.rn),null==n||n.removeEventListener("visibilitychange",this.sn),clearInterval(this.Tn),this.Nn(),null===(e=this.Le)||void 0===e||e.call(this),this.Le=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.De)||void 0===s||s.call(this),this.De=void 0,null===(r=this.Fe)||void 0===r||r.call(this),this.Fe=void 0,null===(o=this.Ne)||void 0===o||o.call(this),this.Ne=void 0,null===(a=this.re)||void 0===a||a.stop(),this.qn(),this.Pn()}Pn(){this.Oe+=1,this.Ae=[],this.$e=0,this.jn=void 0,this.Pe=!1}qn(){var t,e;null===(t=this.Bn)||void 0===t||t.stop(),this.ce=[],null===(e=this._n)||void 0===e||e.stop(),this._n=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){rc.warn("could not stop rrweb",t)}this.se=void 0}zn(){if(!this.jn||0===this.$e)return!1;if(this.Pe)return!0;this.Pe=!0,this.Hn=void 0;const t=this.Oe;return this.Nn(),this.qn(),this.jn.catch(()=>{}).then(()=>{t===this.Oe&&(this.Pe=!1,this.Ye(),this.tn(),this.Un(),this.Fn(),rc.info("stopped"))}).catch(()=>{this.Pe=!1,this.Un(),this.Fn(),rc.info("stopped")}),!0}stop(){if(this.qn(),this.Ue)this.Xe();else if(this.zn())return;this.Ye(),this.tn(),this.Un(),this.Fn(),rc.info("stopped")}Un(){this.Ke(void 0,{preserveLogDedup:this.Ue}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.Pe)&&(this.Xe(),this.Ye())}He(t){this.Ue=!0,this.le=Date.now();try{var e,i;this.stop(),this.Wn=void 0,this.me=0,this.fe=0,this.ve=0,this.pe=0,null===(e=lc())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.Ue=!1}this.Ke(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ke(t,{preserveLogDedup:e=!1}={}){if(this.ge=!Te(t),this.Hn=t,Te(t))return void(e||(this.Vn=void 0));if(this.Ue)return;const i=`${this.sessionId}:${t}`;i!==this.Vn&&(this.Vn=i,rc.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}Rn(){this.isStarted||(this.we=!0),this.ge&&(this.Ke(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Gn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.tn(),this.qn()),this.tn(),this.Fn(),this.tn(),this.Un(),rc.info("discarded")}Qn(t,e,i,n,s){if(-1===i)return this.me+=1,void rc.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Zn(t,n),this.Jn(r)):this.tn()}Kn(){try{this.Xn()}catch(t){this.Se||(this.Se=!0,rc.error("could not track full snapshot cost",t))}}Xn(){var t,e;const i=null===(t=lc())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Wn&&(this.Wn=i,500>i.durationMs||rc.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}))}Zn(t,e){2!==t.type?3===t.type&&(Te(this.Te)||this.Te===e||this.Re===e||(this.Re=e,rc.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.Te=e}Yn(t){t.counted&&t.generation===this.Oe&&(this.$e=Math.max(0,this.$e-1)),t.counted=!1,this.Ae=this.Ae.filter(e=>e!==t)}ti(t,e,i){t.processed||t.generation!==this.Oe||(t.processed=!0,this.Qn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ei(t){try{let e,i=t.event;if(t.compressionEnabled)try{({event:i,size:e}=$c(t.event))}catch(t){rc.warn("could not process queued compression event - will use uncompressed event",t)}Te(e)&&(e=Pa(t.event));try{this.ti(t,i,e)}catch(t){rc.warn("could not capture queued compression event",t)}}finally{this.Yn(t)}}Xe(){[...this.Ae].forEach(t=>{try{this.ei(t)}catch(t){rc.warn("could not drain queued compression event",t)}})}ni(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Oe,processed:!1,counted:!0};this.Ae.push(r),this.$e+=1;const o=(a=re(function*(){try{if(r.processed)return;let i,n;try{const s=e?wc(t)?yield function(t){return Cc.apply(this,arguments)}(t):$c(t):{event:t,size:Pa(t)};i=s.event,n=s.size}catch(e){rc.warn("could not process queued compression event - will use uncompressed event",e),i=t,n=Pa(t)}s.ti(r,i,n)}finally{s.Yn(r)}}),function(){return a.apply(this,arguments)});var a;this.jn=this.jn?this.jn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,a,l,u,c,h,d;if(!this._instance.sessionManager)return;if(this.Cn(),!e||!$e(e))return;if(4===e.type){const t=this.mn(e.data.href);if(this.xn=t,!t)return;e.data.href=t}else this.Sn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.En(),()=>this.An(),(t,e)=>this.$n(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&(this.Kn(),Promise.resolve().then(()=>this.Kn()),this.Mn(),null===(h=this.Bn)||void 0===h||h.reset(),null===(d=this._instance.persistence)||void 0===d||d.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const v=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));v&&this.ii();const f=this.Bn?this.Bn.throttleMutations(e):e;if(!f)return void(!0===this.de&&this.he++);const p=function(t){const e=t;if(e&&$e(e)&&6===e.type&&$e(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(f),g=function(t){return Ic(t)?t.data.payload:null}(p),m=function(t){return Mc(t)?t.data.payload:null}(p),y=function(t){return Ec(t)?t.data.payload:null}(p);g||m?(null==g?void 0:g.lastActivityTimestamp)&&(p.timestamp=g.lastActivityTimestamp):(null==y?void 0:y.sessionId)||this.ri(p);const b=null!==(s=null!==(r=null!==(o=null==g?void 0:g.currentSessionId)&&void 0!==o?o:null==m?void 0:m.nextSessionId)&&void 0!==r?r:null==y?void 0:y.sessionId)&&void 0!==s?s:this.Xt,_=null!==(a=null!==(l=null!==(u=null==g?void 0:g.currentWindowId)&&void 0!==u?u:null==m?void 0:m.nextWindowId)&&void 0!==l?l:null==y?void 0:y.windowId)&&void 0!==a?a:this.je;if(!0===this.de&&!function(t){return Ec(t)||Ic(t)||Mc(t)}(p))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(p)&&this.he++);2===p.type&&(this.he=0),y&&(p.timestamp=y.lastActivityTimestamp+y.threshold);const w=this.ae;this.ae=!0,v?this.kn(!0):w||this.kn();const k=null===(c=this._instance.config.session_recording.compress_events)||void 0===c||c;if(5===p.type&&"$json_ld"===p.data.tag){let e;try{e=t?this.mn(t.location.href):void 0}catch(t){}p.data.href=e}if(this.$e>0||k&&wc(p))return void this.ni(p,k,b,_);const{event:S,size:x}=k?$c(p):{event:p,size:Pa(p)};this.Qn(p,S,x,b,_)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.ke,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):aa}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.Rn(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.Rn(),this.qt("sampling_overridden")}overrideTrigger(t){this.$n(t),this.Rn()}oi(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.mn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}Nn(){this.si&&(clearTimeout(this.si),this.si=void 0)}Gn(){this.si||(this.si=setTimeout(()=>{this.Ye()},2e3))}ai(){return this.Te!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Ic(t)&&!Mc(t))}li(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}ui(t){if("buffering"!==t)return Te(this.ci)||this._instance.register_for_session({[zt]:[]}),void(this.ci=void 0);const e=this.li();if(0===e.length)return Te(this.ci)||this._instance.register_for_session({[zt]:[]}),void(this.ci=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.ci&&(this.ci=n,this._instance.register_for_session({[zt]:e}),rc.info(`buffering: ${i}`))}di(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.hi)&&Hl.At()}fi(){0!==this.Rt.data.length&&this.Rt.size!==this.pi&&943718.4>=this.Rt.size&&this.di()&&(this.pi=this.Rt.size,Hl.$t(this.an,this.Rt))}Ln(){if(this.Ee||!this.di())return;this.Ee=!0;const t=Hl.Dt(this.an);Hl.Pt(this.an),$e(t)&&Se(t.data)&&0!==t.data.length&&Se(t.sizes)&&t.sizes.length===t.data.length&&Pe(t.size)&&t.sessionId===this.Xt&&t.windowId===this.je&&(this.Rt.data.length>0||(this.Rt=t))}Ye(t=!1){var e;if(this.Nn(),this.ge)return this.Rt;if(this.ai())return this.Rt.size>943718.4?this.tn():(t&&this.fi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Ge(),s=this.status;if(this.ui(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.fi(),this.Gn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.oi();Oa(i).forEach(e=>{try{var i;null===(i=this.Be)||void 0===i||i.trackSize(e.sessionId,e.size),this.mi(ue(ue(ue(ue({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Wl.LIB_NAME,$lib_version:Wl.LIB_VERSION,$snapshot_host:t},this.fe>0?{$sdk_debug_replay_throttled_mutations_dropped:this.fe}:{}),this.ve>0?{$sdk_debug_replay_oversized_mutations_dropped:this.ve}:{}),this.pe>0?{$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe}:{}),this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){rc.warn("could not capture snapshot chunk - skipping it",t)}}),Te(this.pi)||(Hl.Pt(this.an),this.pi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.tn()}Jn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.ge&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.Ye(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.tn()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.ge&&(this.be||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.be=!0:(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.ge||this.Gn())}mi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Qe(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}ii(){if(!this.Rt||0===this.Rt.data.length)return this.tn();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.tn():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}tn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.je},this.Rt}qt(t,e){this._instance.register_for_session({[Qt]:t}),rc.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",ue({reason:t},e))}gi(t){var e;return 3===t.type&&-1!==oc.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ri(t){const e=this.gi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.Tn),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.je}),this.Ye());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.je!==i;if(this.je=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.He(t)}else if(e&&this.Rn(),s){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.re)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this.kn(),this.Mn()}}ze(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t;return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Hn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(t=this.Be)||void 0===t?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_rrweb_error:this.ke,[Vt]:this.yi,[Gt]:this._e}}get yi(){var t,e,i;return!!this.se&&(null===(t=null===(e=uc())||void 0===e||null===(i=e.isRecording)||void 0===i?void 0:i.call(e))||void 0===t||t)}Dn(){var e;if(this.se)return;this._e=!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},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=ue({password:!0},e);else if("sampling"===t){const t=null!=e?e:{},n={};Te(t.mousemove)||(n.mousemove=t.mousemove),Te(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),i.sampling=n}else i[t]=e;var r,o,a,l;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=ue(ue({},i.slimDOMOptions),{},{script:!0})),this.dn&&this.dn.enabled&&(i.recordCanvas=!0,i.sampling=ue(ue({},i.sampling),{},{canvas:this.dn.fps}),i.dataURLOptions={type:"image/webp",quality:this.dn.quality},i.canvasResolutionScale=this.cn,i.canvasMasking={configured:()=>{var t;return xe(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const i=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(xe(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Ie||(this.Ie=!0,rc.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.ln&&(i.maskAllInputs=null===(r=this.ln.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.ln.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this.ln.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this.ln.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Ce||(this.Ce=!0,rc.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.un();const u=uc();if(!u)return void rc.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.Bn=null!==(e=this.Bn)&&void 0!==e?e:new gl(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const i=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;rc.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.In,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const c=this.vn();if(this.se=u(ue(ue({emit:t=>{this.onRRwebEmit(t)},plugins:c,errorHandler:(t,e)=>"rrweb"===e&&(this.Me||(this.Me=!0,rc.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i),{},{recordAfter:"DOMContentLoaded"})),!this.se)return this.ke=!0,void rc.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ke=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this._n&&(this._n=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Ou;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Lu:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!ic(n,e.blockClass,e.blockSelector)}}(t,i),a=e=>{try{const a=s();if(!r||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){return ic(t,e.blockClass,e.blockSelector)||ic(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const l=function(t,e=Lu,i){if(!t||t.length>Ou)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=Se(n)?n.map(t=>Xu(t,e,s)):Xu(n,e,s);if(s.exceeded||Me(r)||Se(r)&&(!r.length||r.some(Me)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(t){return null}}(e.text,o,i.maskUrl);if(!l)return void n.delete(e);const[u,c]=l;if(Me(a))return void n.set(e,c);if(n.get(e)!==c){if(c.length>r)return void(r=0);i.emit(u)&&(n.set(e,c),r-=c.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of nc(t))a(e)};for(const i of t)if("childList"===i.type)tc(i.target)&&a(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&tc(t)&&a(t)}else"attributes"===i.type&&tc(i.target)&&a(i.target)}catch(t){return}});return i.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){r&&!1!==s()&&nc(t.documentElement).forEach(t=>{e&&n.delete(t),a(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.mn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.bn()},emit:t=>this.wn(t)}),this.Y.isCurrentUrlBlocked()&&this._n.scan()),this.le=Date.now(),this.de=Oe(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:c.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const Pc=["type"];var Ac=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),Oc=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),Fc=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),Dc=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Lc=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Nc=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),qc=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function jc(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var Bc=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${Bc.source}`,"i"),new RegExp(Bc.source,"gi"),"0".repeat(32),"0".repeat(16);var zc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Uc={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Hc={};function Wc(t){if(Hc[t])return Hc[t];const e=function(t){var e,i;const n=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(i=e.__symbol__)||void 0===i?void 0:i.call(e,t);return n&&globalThis[n]?globalThis[n]:void 0}(t)||globalThis[t],i=e.prototype,n=t in zc?zc[t]:void 0,s=Boolean(n&&n.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(i,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),r=t in Uc?Uc[t]:void 0,o=Boolean(r&&r.every(t=>{var e;return"function"==typeof i[t]&&(null===(e=i[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(s&&o)return Hc[t]=e.prototype,e.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const n=a.contentWindow;if(!n)return e.prototype;const s=n[t].prototype;return s?(function(t){return jc(t,"AppleWebKit")&&!jc(t,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",t),l=!0),Hc[t]=s):i}catch(t){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Vc=Object.create(null);function Gc(t,e,i){var n;const s=Vc[t],r=s[i];if(r)return r.call(e);const o=Wc(t),a=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return a?(s[i]=a,a.call(e)):e[i]}Vc.Node=Object.create(null),Vc.ShadowRoot=Object.create(null),Vc.MutationObserver=Object.create(null),Vc.Element=Object.create(null);var Qc,Zc={};function Jc(t,e,i){const n=`${t}.${String(i)}`;if(Zc[n])return Zc[n].bind(e);const s=Wc(t)[i];return"function"!=typeof s?e[i]:(Zc[n]=s,s.bind(e))}function Kc(){return Wc("MutationObserver").constructor}function Yc(t,e,i){try{if(!(e in t))return()=>{};const n=t[e],s={next:n},r=i(function(...t){return s.next.apply(this,t)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=s.next);const i=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let n=t[e],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(t){return()=>{}}}var Xc={childNodes:t=>Gc("Node",t,"childNodes"),parentNode:t=>Gc("Node",t,"parentNode"),parentElement:t=>Gc("Node",t,"parentElement"),textContent:t=>Gc("Node",t,"textContent"),isConnected(t){if(void 0===Qc){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Wc("Node"),"isConnected"))||void 0===e?void 0:e.get;Qc=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==Qc?void 0:Qc.call(t)},contains:(t,e)=>Jc("Node",t,"contains")(e),getRootNode:t=>Jc("Node",t,"getRootNode")(),host:t=>t&&"host"in t?Gc("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?Gc("Element",t,"shadowRoot"):null,querySelector:(t,e)=>Jc("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>Jc("Element",t,"querySelectorAll")(e),mutationObserver:Kc,patch:Yc};function th(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var eh=0;function ih(){eh+=1}function nh(){return eh}function sh(t,e){return(e!==eh||t>6e4)&&!0}var rh=0,oh=0,ah=0,lh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},uh=null,ch=null,hh=[],dh=0,vh=0,fh={slowestBatchMs:0},ph={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function gh(t){(rh+=1)>1||(lh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},hh=[],dh=0,ch=(t=>t&&t>0?t:null)(t),oh=th(),ah=eh)}function mh(){return 0===rh?uh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(rh-=1)>0?lh:(lh.durationMs=th()-oh,lh.deferredStylesheetCount=dh,ph.deferredCount+=dh,ch=null,sh(lh.durationMs,ah)?lh:uh=lh)}function yh(t,e,i){let n=t.length;if(i>=32)return n;for(let s=0;t.length>s;s++){const r=t[s];try{const t=r.cssRules;if(t&&t.length)n+=yh(t,e,i+1);else if(e&&r.styleSheet){const t=r.styleSheet;if(!e.has(t)){e.add(t);const s=t.rules||t.cssRules;s&&(n+=yh(s,e,i+1))}}}catch(t){}}return n}function bh(t){if(0===rh)return;const e=yh(t,null,0);lh.cssRuleCount+=e,vh>0&&(lh.nonDeferrableCssRuleCount+=e)}function _h(t){vh+=1;try{return t()}finally{vh-=1}}function wh(t){rh>0&&(lh.stylesheetMs+=t)}function kh(t){if(0===rh||null===ch)return!1;const e=lh.cssRuleCount-lh.nonDeferrableCssRuleCount;return e>=ch||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),yh(e,i,0)}catch(t){return 0}}(t)>ch}function Sh(){const t=hh;return hh=[],t}function xh(){ph.failedCount+=1}function $h(t){t>0&&(ph.abandonedCount+=t)}function Ch(t){return Ch="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ch(t)}function Th(t,e,i){return(e=function(t){var e=function(t){if("object"!=Ch(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Ch(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ch(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Eh(t){return t.nodeType===t.ELEMENT_NODE}function Ih(t){const e=t&&"host"in t&&"mode"in t&&Xc.host(t)||null;return Boolean(e&&"shadowRoot"in e&&Xc.shadowRoot(e)===t)}function Mh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function Rh(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function Ph(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const i=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?i.push("layer"):t.layerName&&i.push(`layer(${t.layerName})`),t.supportsText&&i.push(`supports(${t.supportsText})`),t.media.length&&i.push(t.media.mediaText),i.join(" ")+";"}var Ah=0;function Oh(t){const e=0===Ah,i=e?th():0;Ah+=1;try{const e=t.rules||t.cssRules;if(!e)return null;bh(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),Rh(Array.from(e,t=>Fh(t,i)).join(""))}catch(t){return null}finally{Ah-=1,e&&wh(th()-i)}}function Fh(t,e){if(Lh(t)){let e;try{e=Oh(t.styleSheet)||Ph(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return Xh(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Nh(t)&&t.selectorText.includes(":")&&(i=Dh(i)),e?Xh(i,e):i}}function Dh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Lh(t){return"styleSheet"in t}function Nh(t){return"selectorText"in t}var qh=/^-?[A-Za-z_][\w-]*$/,jh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Bh(t){const e=[];let i=!1,n=null;const s=new Map;function r(t){const s=e.pop();if("group"===s.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void r(null)}const i=e[e.length-1];return i.parts.push(t),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=t);o(e[e.length-1],s.importRule,t)}function o(t,e,i){try{let s;try{s=i||Ph(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=Xh(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function a(t){const i=t.rules[t.index];if("sheet"===t.kind&&Lh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(Nh(t)){if("number"==typeof e.type&&1!==e.type)return null;const i=e.style?e.style.cssText:"";return`${t.selectorText} {${i?" "+i:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!qh.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let n="";try{var i;n=(null===(i=t.constructor)||void 0===i?void 0:i.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?qh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":jh.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?Xh(n,s):n,fixColons:"sheet"===i.kind&&Nh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Nh(i)&&i.selectorText.includes(":")&&(n=Dh(n)),t.parts.push(t.sheetHref?Xh(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;bh(i);let n=t.href;!n&&t.ownerNode&&(n=t.ownerNode.baseURI);const r=Array.from(i);return e.push({kind:"sheet",sheet:t,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(t,e){const i=[{sheet:e,rules:t,index:0}];for(;i.length>0;){const t=i[i.length-1];if(t.index>=t.rules.length){i.pop();continue}const e=t.rules[t.index];if(t.index+=1,!Lh(e)||s.has(e))continue;let n=null;try{n=e.styleSheet}catch(t){s.set(e,null);continue}if(n&&!i.some(t=>t.sheet===n))try{const t=n.rules||n.cssRules;if(!t)continue;bh(t);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(t);s.set(e,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(t){}}}(r,t),!0}catch(t){return!1}}(t)||(i=!0),{advance(t){if(i)return!0;const s=th();let o=t>0?t:1;try{for(;!i&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const i=t.prelude+t.parts.join("")+"}";e=t.fixColons?Dh(i):i}else e=Rh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{a(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{wh(th()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var zh=class{constructor(){Th(this,"idNodeMap",new Map),Th(this,"nodeMetaMap",new WeakMap)}getId(t){var e,i;return t&&null!==(e=null===(i=this.getMeta(t))||void 0===i?void 0:i.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),Eh(t)){const e=Xc.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const i=this.getNode(t);if(i){const t=this.nodeMetaMap.get(i);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Uh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const a=n&&Hh(n);return(e[i.toLowerCase()]||a&&e[a])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Hh(t){return t.toLowerCase()}var Wh=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 Vh({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Wh.has(Hh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var Gh="__rrweb_original__";function Qh(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Hh(e):null}catch(t){return null}}var Zh=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Jh=/^(?:[a-z+]+:)?\/\//i,Kh=/^www\..*/i,Yh=/^(data:)([^,]*),(.*)/i;function Xh(t,e){return(t||"").replace(Zh,(t,i,n,s,r,o)=>{const a=n||r||o,l=i||s||"";if(!a)return t;if(Jh.test(a)||Kh.test(a))return`url(${l}${a}${l})`;if(Yh.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+a}${l})`;const u=e.split("/"),c=a.split("/");u.pop();for(const t of c)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${l}${u.join("/")}${l})`})}var td,ed,id=new Map,nd=1,sd=new RegExp("[^a-z0-9-_:]");function rd(){return nd++}var od=!1,ad=/^[^ \t\n\r\u000c]+/,ld=/^[, \t\n\r\u000c]+/,ud=new WeakMap;function cd(t,e){return e&&""!==e.trim()?hd(t,e):e}function hd(t,e){let i=ud.get(t);if(i||(i=t.createElement("a"),ud.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function dd(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function vd(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=cd(t,n);if(i.startsWith("data:")){if("img"===e&&s){let t=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(t=function(t,e,i,n){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const s=id.get(e);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;const r=s.getContext("2d");if(!r)return e;r.drawImage(t,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),a=e.length>o.length?o:e;if(id.size>=10){const t=id.keys().next().value;void 0!==t&&id.delete(t)}return id.set(e,{type:i,quality:n,result:a}),a}catch(t){return e}}(s,i,r.type,r.quality)),dd(t,r)}if("image"===e)return dd(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=cd(t,n);return"image"===e&&i.startsWith("data:")?dd(i,r):i}return"background"!==i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===i?function(t,e){if(""===e.trim())return e;let i=0;function n(t){let n;const s=t.exec(e.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(ld),e.length>i;){let r=n(ad);if(","===r.slice(-1))r=cd(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=cd(t,r);let o=!1;for(;;){const t=e.charAt(i);if(""===t){s.push((r+n).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){i+=1,s.push((r+n).trim());break}"("===t&&(o=!0)}n+=t,i+=1}}}return s.join(", ")}(t,n):"style"===i?Xh(n,hd(t)):"object"===e&&"data"===i?cd(t,n):n:cd(t,n)}function fd(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Hh(e)}function pd(t){return"string"==typeof t&&Hh(t).split(/\s+/).includes("stylesheet")}function gd(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&gd(Xc.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&gd(Xc.parentNode(t),e,i)}function md(t,e,i,n){let s;if(Eh(t)){if(s=t,!Xc.childNodes(s).length)return!1}else{if(null===Xc.parentElement(t))return!1;s=Xc.parentElement(t)}try{if("string"==typeof e){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(gd(s,e,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(t){}return!1}function yd(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var bd=new Map;function _d(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function wd(t){return null==t?"":t.toLowerCase()}var kd=!1,Sd=!1;function xd(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:E=!1,depth:I=0,maxDepth:M=50}=e;let{needsMask:R}=e,{preserveWhiteSpace:P=!0}=e;if(I>=M)return Sd=!0,kd||(kd=!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;R||(R=md(t,o,a,void 0===R)),rh>0&&(lh.nodeCount+=1);const A=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:c,maskAllElementAttributes:h=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,b=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:qc.Document,childNodes:[],compatMode:t.compatMode}:{type:qc.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:qc.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:u,dataURLOptions:c={},inlineImages:h,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Hh(t.tagName);return sd.test(e)?"div":e}(t),b=new Set;let _={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];fd(y,n.name)||(_[n.name]=vd(i,y,Hh(n.name),n.value,t,c))}if("link"===y&&r&&!m&&pd(_.rel)){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=_d(i,n),!e&&n.includes(".css"))&&(e=_d(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(kh(e)?rh>0&&(hh.push(t),dh+=1):n=Oh(e)),n&&(delete _.rel,delete _.href,_._cssText=n)}var k;if("style"===y&&t.sheet&&!(t.innerText||Xc.textContent(t)||"").trim().length){const e=_h(()=>Oh(t.sheet));e&&(_._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=Uh({element:t,type:Qh(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:a}):i&&(_.checked=i)}if("option"===y&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===y&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}b.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData,r=Gh in s?s[Gh]:s;let o;try{o=r.call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(_.rr_dataURL=t.toDataURL(c.type,c.quality));else if(!("__context"in t)){const e=t.toDataURL(c.type,c.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(c.type,c.quality)&&(_.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(k=t)?void 0:k.name)?od||(od=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",k)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",k)}let S,x=!1;if("img"===y&&h){td||(td=i.createElement("canvas"),ed=td.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>x?Vh({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u}):i,o=()=>{yd(e,"load",o);try{td.width=e.naturalWidth,td.height=e.naturalHeight,ed.drawImage(e,0,0);const t=td.toDataURL(c.type,c.quality);_.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?_.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=_;e.rr_mediaState=t.paused?"paused":"played",b.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),m){var C,T,E;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(E=i.defaultView)||void 0===E?void 0:E.scrollY)||0))}px`},b.add("rr_width"),b.add("rr_height"),b.add("rr_left"),b.add("rr_top"),o&&(_.rr_position=o.position||"static",b.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,b.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,b.add("rr_display")))}if("iframe"!==y||f(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),l||u)for(const[e,i]of Object.entries(_))"string"!=typeof i&&null!==i||(_[e]=Vh({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:b.has(e)}));x=!0;try{customElements.get(y)&&(S=!0)}catch(t){}return{type:qc.Element,tagName:y,attributes:_,childNodes:[],isSVG:(I=t,Boolean("svg"===I.tagName||I.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:S};var I}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=Xc.parentNode(t),o=r&&r.tagName;let a=Xc.textContent(t);const l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var c;if(t.nextSibling||t.previousSibling);else if(kh(r.sheet));else if(null===(c=r.sheet)||void 0===c?void 0:c.cssRules){const t=Oh(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(a=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}a=Xh(a,hd(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&i&&(a=n?n(a,Xc.parentElement(t)):a.replace(/[\S]/g,"*")),{type:qc.Text,textContent:a||"",isStyle:l,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:qc.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:qc.Comment,textContent:Xc.textContent(t)||"",rootId:b};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:T,newlyAddedElement:E});if(!A)return console.warn(t,"not serialized"),null;let O;O=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===qc.Comment)return!0;if(t.type===qc.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let i;try{i=new URL(t,window.location.href)}catch(t){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==n?void 0:n[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(wd(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===wd(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(wd(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&wd(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(wd(t.attributes.property).match(/^(og|twitter|fb):/)||wd(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===wd(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(wd(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(wd(t.attributes.name))||wd(t.attributes.property).match(/^article:/)||wd(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(wd(t.attributes.name)))return!0}}return!1}(A,p)||!P&&A.type===qc.Text&&!A.isStyle&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?-2:rd();const F=Object.assign(A,{id:O});if(n.add(t,F),-2===O)return null;_&&_(t);let D=!l;if(F.type===qc.Element){D=D&&!F.needBlock,delete F.needBlock;const e=Xc.shadowRoot(t);e&&Mh(e)&&(F.isShadowHost=!0)}if((F.type===qc.Document||F.type===qc.Element)&&D){p.headWhitespace&&F.type===qc.Element&&"head"===F.tagName&&(P=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:P,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M};if(F.type===qc.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else for(const i of Array.from(Xc.childNodes(t))){const t=xd(i,e);t&&F.childNodes.push(t)}let E=null;if(Eh(t)&&(E=Xc.shadowRoot(t)))for(const t of Array.from(Xc.childNodes(E))){const i=xd(t,e);i&&(Mh(E)&&(i.isShadow=!0),F.childNodes.push(i))}}const L=Xc.parentNode(t);if(L&&Ih(L)&&Mh(L)&&(F.isShadow=!0),F.type===qc.Element&&"iframe"===F.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),yd(t,"load",a),t.addEventListener("load",o),e())},a=()=>r();return s=setTimeout(r,i),t.addEventListener("load",a),()=>{null!==s&&(clearTimeout(s),s=null),n?yd(t,"load",o):(n=!0,yd(t,"load",a))}}const a="about:blank";let l;try{l=s.location.href}catch(t){return n}if(l!==a||t.src===a||""===t.src){const i=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(i),yd(t,"load",o)}}return t.addEventListener("load",o),()=>{yd(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=xd(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:P,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I+1,maxDepth:M});i&&w(t,i)}},k);null==S||S(t,e)}return F.type===qc.Element&&"link"===F.tagName&&pd(F.attributes.rel)&&function(e,l,S){if(bd.has(e))return;let E;try{E=e.sheet}catch(t){return}if(E)return;const A=new AbortController;let O=!1;const F=()=>{if(!O){O=!0;try{(()=>{if(x){const e=xd(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:R,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:P,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:I,maxDepth:M});e&&x(t,e)}})()}finally{bd.delete(e),A.abort()}}},D=setTimeout(F,S);A.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",F,{signal:A.signal,once:!0}),bd.set(e,A)}(t,0,C),F}function $d(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var Cd=class t{constructor(...t){Th(this,"parentElement",null),Th(this,"parentNode",null),Th(this,"ownerDocument",void 0),Th(this,"firstChild",null),Th(this,"lastChild",null),Th(this,"previousSibling",null),Th(this,"nextSibling",null),Th(this,"ELEMENT_NODE",1),Th(this,"TEXT_NODE",3),Th(this,"nodeType",void 0),Th(this,"nodeName",void 0),Th(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Td(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Ed(i,t,e,n)}function Ed(t,e,i,n){Id(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Id(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Md(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var Rd="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.",Pd={map:{},getId(){return console.warn(Rd),-1},getNode(){return console.warn(Rd),null},removeNodeFromMap(){console.warn(Rd)},has(){return console.warn(Rd),!1},reset(){console.warn(Rd)}};function Ad(t,e,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const a=e-(o-s),l=this;0>=a||a>e?(n&&(clearTimeout(n),n=null),s=o,t.apply(l,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,t.apply(l,r)},a))}}function Od(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e),o=()=>Od(t,e,r||{},!0);if(n)return s.Object.defineProperty(t,e,i),o;const a=function(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var i,n;const s=null===(i=t.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?t[s]:void 0;"function"==typeof r&&(e=r)}catch(t){}if(!e)return()=>{};const s=e;return e=>{try{s.call(t,e,0)}catch(t){}}}(s);return s.Object.defineProperty(t,e,{set(t){if(a(()=>{try{i.set.call(this,t)}catch(t){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Pd=new Proxy(Pd,{get(t,e,i){return"map"===e&&console.warn(Rd),Reflect.get(t,e,i)}}));var Fd=Date.now;function Dd(t){var e,i,n,s;const r=t.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(e=Xc.parentElement(r.body))||void 0===e?void 0:e.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=Xc.parentElement(r.body))||void 0===n?void 0:n.scrollTop)||(null==r||null===(s=r.body)||void 0===s?void 0:s.scrollTop)||0}}function Ld(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Nd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function qd(t){return t?t.nodeType===t.ELEMENT_NODE?t:Xc.parentElement(t):null}function jd(t,e,i,n){if(!t)return!1;const s=qd(t);if(!s)return!1;try{if("string"==typeof e){if(s.classList.contains(e))return!0;if(n&&null!==s.closest("."+e))return!0}else if(gd(s,e,n))return!0}catch(t){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Bd(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function zd(t,e){if(Ih(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=Xc.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||zd(n,e))}function Ud(t){return Boolean(t.changedTouches)}function Hd(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Wd(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function Vd(t){return!!t&&(t instanceof Cd&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(Xc.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(Fd=()=>(new Date).getTime());var Gd=class{constructor(){Th(this,"id",1),Th(this,"styleIDMap",new WeakMap),Th(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let i;return i=void 0===e?this.id++:e,this.styleIDMap.set(t,i),this.idStyleMap.set(i,t),i}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Qd(t){var e;let i=null;return"getRootNode"in t&&(null===(e=Xc.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Xc.host(Xc.getRootNode(t))&&(i=Xc.host(Xc.getRootNode(t))),i}function Zd(t){const e=t.ownerDocument;if(!e)return!1;if(Xc.contains(e,t))return!0;const i=Xc.isConnected(t);return"boolean"==typeof i?i:function(t){const e=t.ownerDocument;if(!e)return!1;const i=function(t){let e,i=t;for(;e=Qd(i);)i=e;return i}(t);return Xc.contains(e,i)}(t)}function Jd(t){return"__ln"in t}var Kd,Yd=class{constructor(){Th(this,"length",0),Th(this,"head",null),Th(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&Jd(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&Jd(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},Xd=(t,e)=>`${t}@${e}`,tv=class{constructor(){Th(this,"frozen",!1),Th(this,"locked",!1),Th(this,"texts",[]),Th(this,"attributes",[]),Th(this,"attributeMap",new WeakMap),Th(this,"generatedAttributes",new WeakMap),Th(this,"removes",[]),Th(this,"mapRemoves",new Set),Th(this,"movedMap",{}),Th(this,"addedSet",new Set),Th(this,"movedSet",new Set),Th(this,"droppedSet",new Set),Th(this,"removesSubTreeCache",new Set),Th(this,"mutationCb",void 0),Th(this,"blockClass",void 0),Th(this,"blockSelector",void 0),Th(this,"maskTextClass",void 0),Th(this,"maskTextSelector",void 0),Th(this,"inlineStylesheet",void 0),Th(this,"maskInputOptions",void 0),Th(this,"maskTextFn",void 0),Th(this,"maskInputFn",void 0),Th(this,"maskAllElementAttributes",void 0),Th(this,"maskAttributeFn",void 0),Th(this,"keepIframeSrcFn",void 0),Th(this,"recordCanvas",void 0),Th(this,"canvasMaskingConfigured",void 0),Th(this,"inlineImages",void 0),Th(this,"slimDOMOptions",void 0),Th(this,"dataURLOptions",void 0),Th(this,"doc",void 0),Th(this,"mirror",void 0),Th(this,"iframeManager",void 0),Th(this,"stylesheetManager",void 0),Th(this,"shadowDomManager",void 0),Th(this,"canvasManager",void 0),Th(this,"processedNodeManager",void 0),Th(this,"unattachedDoc",void 0),Th(this,"canvasManagerReleased",!1),Th(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Th(this,"emit",()=>{if(this.frozen||this.locked)return;const t=th(),e=nh();try{this.processBufferedMutations()}finally{i=th()-t,n=e,rh>0||sh(i,null!=n?n:eh)||i>fh.slowestBatchMs&&(fh.slowestBatchMs=i)}var i,n}),Th(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new Yd,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const a=Xc.parentNode(r);if(!a||!Zd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=Ih(a)?this.mirror.getId(Qd(r)):this.mirror.getId(a),u=n(r);if(-1===l||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={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:t=>{Hd(t,this.mirror)&&this.iframeManager.addIframe(t),Wd(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),Vd(t)&&!jd(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Xc.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const c=xd(r,s);c&&(t.push({parentId:l,nextId:u,node:c}),e.add(c.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)iv(this.removesSubTreeCache,t)&&!this.movedSet.has(Xc.parentNode(t))||r(t);for(const t of this.addedSet)nv(this.droppedSet,t)||iv(this.removesSubTreeCache,t)?nv(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(Xc.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(Xc.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=Xc.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=Xc.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const a={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=Xc.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=Vh({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};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)}),Th(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Th(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(Xc.childNodes(t),t=>Xc.textContent(t)||"").join("");e.attributes.value=Uh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Qh(t),value:i,maskInputFn:this.maskInputFn})}),Th(this,"processMutation",t=>{if(!Bd(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=Xc.textContent(t.target);jd(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:md(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,qd(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Hh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let a=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),l=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===a){const t=n,e=Qh(t);l=Uh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(jd(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let u=this.attributeMap.get(t.target);const c="iframe"===s&&"src"===a;if(c&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if("type"===a&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!fd(s,a)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=vd(this.doc,s,Hh(a),l,n,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(l)&&(a="rr_src"),u.attributes[a]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===a&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(jd(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const i=this.mirror.getId(e),n=Ih(t.target)?this.mirror.getId(Xc.host(t.target)):this.mirror.getId(t.target);jd(t.target,this.blockClass,this.blockSelector,!1)||Bd(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(ev(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||zd(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[Xd(i,n)]?ev(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Ih(t.target)||!Mh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),Xc.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Th(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Bd(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let i=null;e&&this.mirror.hasNode(e)&&(i=this.mirror.getId(e)),i&&-1!==i&&(this.movedMap[Xd(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!jd(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=Xc.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(Vd(t)){const e=Xc.childNodes(Xc.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["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(e=>{this[e]=t[e]}),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 t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),jd(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?Xc.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Xc.host(n):null}return!1}};function ev(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=Xc.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function iv(t,e,i){return 0!==t.size&&function(t,e){const i=Xc.parentNode(e);return!!i&&t.has(i)}(t,e)}function nv(t,e){if(0===t.size)return!1;let i=Xc.parentNode(e);for(;i;){if(t.has(i))return!0;i=Xc.parentNode(i)}return!1}function sv(t){Kd=t}function rv(){Kd=void 0}var ov=(t,e="rrweb")=>Kd?(...i)=>{try{return t(...i)}catch(t){if(Kd&&!0===Kd(t,e))return;throw t}}:t,av=[];function lv(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function uv(t,e){const i=new tv;let n;i.init(t);try{n=new(Kc())(ov(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(s.attributeFilter=t.attributeFilter),n.observe(e,s),av.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function cv({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,a=r=>{const a=lv(r);if(!a||jd(a,n,s,!0))return;const l=i.getId(a);let u,c;if(a===e&&e.defaultView){const t=Dd(e.defaultView);u=t.left,c=t.top}else u=a.scrollLeft,c=a.scrollTop;const h=`${u},${c}`;o.get(l)!==h&&(o.set(l,h),t({id:l,x:u,y:c}))},l=[Td("scroll",ov(Ad(ov(t=>a(t)),r.scroll||100)),e)];return"onscrollend"in e&&l.push(Td("scrollend",ov(a),e)),()=>l.forEach(t=>t())}function hv(t,e){for(let i=av.length-1;i>=0;i--){const n=av[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),av.splice(i,1))}}var dv=["INPUT","TEXTAREA","SELECT"],vv=new WeakMap;function fv(t){return function t(e,i){if(bv("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||bv("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||bv("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||bv("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);return i.unshift(n),t(e.parentRule,i)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(t)}return i}(t,[])}function pv(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function gv({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:Xc.host(i));const o="#document"===i.nodeName?null===(n=i.defaultView)||void 0===n?void 0:n.Document:null===(s=i.ownerDocument)||void 0===s||null===(s=s.defaultView)||void 0===s?void 0:s.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 t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=a.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),ov(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var mv=new Set;function yv(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),c(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),h(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=ov(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=av.indexOf(s);-1!==t&&av.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Md(r)}}),a=(t,e)=>{const i=ov(()=>{try{return e()}catch(e){throw mv.add(t),e}})();"function"==typeof i&&r.push(i)};try{if(t.recordDOM&&a("mutation",()=>{const e=uv(t,t.doc);n=e.observer,s=e.buffer}),a("move",()=>function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const l=Ad(ov(e=>{const i=Date.now()-o;t(a.map(t=>(t.timeOffset-=i,t)),e),a=[],o=null}),r),u=ov(Ad(ov(t=>{const e=lv(t),{clientX:i,clientY:s}=Ud(t)?t.changedTouches[0]:t;o||(o=Fd()),a.push({x:i,y:s,id:n.getId(e),timeOffset:Fd()-o}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?Oc.Drag:t instanceof MouseEvent?Oc.MouseMove:Oc.TouchMove)}),s,{trailing:!1})),c=[Td("mousemove",u,i),Td("touchmove",u,i),Td("drag",u,i)];return ov(()=>{c.forEach(t=>t())})}(t)),a("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,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(Fc).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Hh(r);const u=(e=>r=>{const o=lv(r);if(jd(o,n,s,!0))return;let a=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Dc.Mouse;break;case"touch":a=Dc.Touch;break;case"pen":a=Dc.Pen}a===Dc.Touch&&(Fc[e]===Fc.MouseDown?u="TouchStart":Fc[e]===Fc.MouseUp&&(u="TouchEnd"))}else Ud(r)&&(a=Dc.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===Dc.Touch||u.startsWith("Mouse")&&a===Dc.Mouse)&&(a=null)):Fc[e]===Fc.Click&&(a=l,l=null);const c=Ud(r)?r.changedTouches[0]:r;if(!c)return;const h=i.getId(o),{clientX:d,clientY:v}=c;ov(t)(ue({type:Fc[u],id:h,x:d,y:v},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Fc[r]){case Fc.MouseDown:case Fc.MouseUp:o=o.replace("mouse","pointer");break;case Fc.TouchStart:case Fc.TouchEnd:return}a.push(Td(o,u,e))}),ov(()=>{a.forEach(t=>t())})}(t)),a("scroll",()=>cv(t)),a("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Td("resize",ov(Ad(ov(()=>{const e=Ld(),s=Nd();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),a("input",()=>function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:c}){function h(t){let i=lv(t);const u=t.isTrusted,h=e.defaultView;if(i&&h&&!(i instanceof h.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=Xc.parentElement(i)),!i||!v||0>dv.indexOf(v)||jd(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=Qh(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(a[v.toLowerCase()]||a[g])&&(f=Uh({element:i,maskInputOptions:a,tagName:v,type:g,value:f,maskInputFn:l})),d(i,c?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,c?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=vv.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){vv.set(e,n);const s=i.getId(e);ov(t)(ue(ue({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Td(t,ov(h),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Od(t[0],t[1],{set(){ov(h)({target:this,isTrusted:!1})}},!1,f))),ov(()=>{Md(v)})}(t)),a("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=ov(r=>Ad(ov(s=>{const o=lv(s);if(!o||jd(o,e,i,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:c,loop:h}=o;t({type:r,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:h})}),s.media||500)),a=[Td("play",o(Nc.Play),r),Td("pause",o(Nc.Pause),r),Td("seeked",o(Nc.Seeked),r),Td("volumechange",o(Nc.VolumeChange),r),Td("ratechange",o(Nc.RateChange),r)];return ov(()=>{a.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,a,l){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const c={emit:a,ready:!1};u.push(c);let h,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==h&&i.delete(h),c.ready=!0,c.emit=void 0,r(o))};try{h=t.setTimeout(f,5e3),d||v?t.clearTimeout(h):i.add(h)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==h&&(t.clearTimeout(h),i.delete(h)),d?e&&s(l):(c.ready=!0,e||(c.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),a("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=pv(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let a,l;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=pv(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);try{const n=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof n)return l;i.onCssomSheetMutation(r);const{id:o,styleId:u}=pv(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return l;const c=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:a}),()=>{const e=Oh(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(l,()=>c(!0),()=>c(!1))}catch(t){c(!1)}}catch(t){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:c}=pv(r,e,i.styleMirror);return(u&&-1!==u||c&&-1!==c)&&s.queueMutation(r,()=>t({id:u,styleId:c,replaceSync:a})),l},"host")}));const u={};_v("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(_v("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),_v("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),_v("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(u).forEach(([n,r])=>{c[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(c[n].insertRule,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=pv(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...fv(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,adds:[{rule:a,index:e}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(c[n].deleteRule,{apply:ov((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:c}=pv(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||c&&-1!==c)){const e=[...fv(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:c,removes:[{index:e}]}))}return l},"host")})}),ov(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=c[t].insertRule,e.prototype.deleteRule=c[t].deleteRule})})}(t,{win:i,mutationQueue:e})),a("adoptedStyleSheet",()=>gv(t,t.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:ov((s,o,a)=>{var l;const[u,c,h]=a,d=s.apply(o,a);if(i.has(u))return d;const v=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=pv(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=fv(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:c,priority:h},index:e}))}return d},"host")});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:ov((s,o,a)=>{var l;const[u]=a,c=s.apply(o,a);if(i.has(u))return c;const h=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(h);const{id:d,styleId:v}=pv(h,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=fv(o.parentRule);r.queueMutation(h,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return c},"host")}),ov(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:i,mutationQueue:e})),t.collectFonts&&a("font",()=>function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=Yc(e.fonts,"add",function(e){return function(i){return setTimeout(ov(()=>{const e=s.get(i);e&&(t(e),s.delete(i))}),0),e.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),ov(()=>{n.forEach(t=>t())})}(t))}a("selection",()=>function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const a=ov(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;l>e;e++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:u}=t.getRangeAt(e);jd(r,n,s,!0)||jd(l,n,s,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:u})}r({ranges:a})});return a(),Td("selectionchange",a)}(t)),a("customElement",()=>function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?Yc(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)a(`plugin:${e.name}`,()=>e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function bv(t){return void 0!==window[t]}function _v(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var wv=class{constructor(t){Th(this,"generateIdFn",void 0),Th(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Th(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,i,n){if(0>e)return e;const s=i||this.getRemoteIdToLocalIdMap(t),r=n||this.getLocalIdToRemoteIdMap(t);let o=s.get(e);return void 0===o&&(o=this.generateIdFn(),s.set(e,o),r.set(o,e)),o}getIds(t,e){const i=this.getRemoteIdToLocalIdMap(t),n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,i,n))}getRemoteId(t,e,i){var n;return"number"!=typeof e||0>e?e:null!==(n=(i||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==n?n:-1}getRemoteIds(t,e){const i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,i))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},kv=class{constructor(t){Th(this,"iframes",new WeakMap),Th(this,"crossOriginIframeMap",new WeakMap),Th(this,"crossOriginIframeMirror",new wv(rd)),Th(this,"crossOriginIframeStyleMirror",void 0),Th(this,"crossOriginIframeRootIdMap",new WeakMap),Th(this,"mirror",void 0),Th(this,"mutationCb",void 0),Th(this,"wrappedEmit",void 0),Th(this,"loadListener",void 0),Th(this,"pageHideListener",void 0),Th(this,"stylesheetManager",void 0),Th(this,"recordCrossOriginIframes",void 0),Th(this,"messageHandler",void 0),Th(this,"nestedIframeListeners",new Map),Th(this,"attachedWindows",new WeakMap),Th(this,"attachedDocuments",new WeakMap),Th(this,"attachedIframes",new Map),Th(this,"loadListenerDisposers",new WeakMap),Th(this,"iframeElementsById",new Map),Th(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new wv(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>Id(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Ed(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const i=this.mirror.getId(t);return this.attachedIframes.set(i,{element:t,content:e}),i}attachIframe(t,e){var i;const n=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const e=this.handleMessage.bind(this);Id(()=>{s.addEventListener("message",e),this.nestedIframeListeners.set(s,e);let i=this.attachedWindows.get(t);i||(i=new Set,this.attachedWindows.set(t,i)),i.add(s)})}Id(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Ac.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:Ac.IncrementalSnapshot,data:{source:Oc.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ac.Meta:case Ac.Load:case Ac.DomContentLoaded:return!1;case Ac.Plugin:return e;case Ac.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Ac.IncrementalSnapshot:switch(e.data.source){case Oc.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(e.node,i)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Oc.Drag:case Oc.TouchMove:case Oc.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case Oc.ViewportResize:return!1;case Oc.MediaInteraction:case Oc.MouseInteraction:case Oc.Scroll:case Oc.CanvasMutation:case Oc.Input:return this.replaceIds(e.data,t,["id"]),e;case Oc.StyleSheetRule:case Oc.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case Oc.Font:return e;case Oc.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case Oc.AdoptedStyleSheet:var i;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(i=e.data.styles)||void 0===i||i.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,i,n){for(const s of n)(Array.isArray(e[s])||"number"==typeof e[s])&&(e[s]=Array.isArray(e[s])?t.getIds(i,e[s]):t.getId(i,e[s]));return e}replaceIds(t,e,i){return this.replace(this.crossOriginIframeMirror,t,e,i)}replaceStyleIds(t,e,i){return this.replace(this.crossOriginIframeStyleMirror,t,e,i)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===qc.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),i=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),i){const t=i.contentWindow,e=this.attachedWindows.get(i);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(Ed(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Ed(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(t=>{Id(()=>this.mirror.removeNodeFromMap(t))}),Id(()=>hv(i,n)),this.attachedDocuments.delete(i))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,i)=>{this.mirror.has(i)||t.push(i)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&Ed(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Ed(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),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}},Sv=class{constructor(t){Th(this,"shadowDoms",new WeakSet),Th(this,"mutationCb",void 0),Th(this,"scrollCb",void 0),Th(this,"bypassOptions",void 0),Th(this,"mirror",void 0),Th(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(!Mh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=Xc.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=uv(ue(ue({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=av.indexOf(o);-1!==t&&av.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:cv(ue(ue({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(Xc.host(t))),this.restoreHandlers.push({doc:s,handler:gv({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){Id(()=>{const e=t.contentWindow,i=t.contentDocument;e&&i&&this.patchAttachShadow(e.Element,i)})}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:Yc(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=Xc.shadowRoot(this);return r&&Zd(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},xv="skip-frame";function $v(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:i,width:n,height:s}=t;return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Cv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tv="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ev=0;64>Ev;Ev++)Tv[Cv.charCodeAt(Ev)]=Ev;var Iv=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Cv[i[e]>>2],s+=Cv[(3&i[e])<<4|i[e+1]>>4],s+=Cv[(15&i[e+1])<<2|i[e+2]>>6],s+=Cv[63&i[e+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Mv=!1,Rv=new Map,Pv=(t,e,i)=>{if(!t||!Fv(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=Rv.get(t);return i||(i=new Map,Rv.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}(i,t.constructor.name);let s=n.indexOf(t);return-1===s&&(s=n.length,n.push(t)),s};function Av(t,e,i,n){if(t instanceof Array)return t.map(t=>Av(t,e,i,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:Iv(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Av(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let i;try{i=t.toDataURL(n.type,n.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?Mv||(Mv=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:i}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[Av(t.data,e,i,n),t.width,t.height]}:Fv(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:Pv(t,e,i)}:t}var Ov=(t,e,i,n)=>t.map(t=>Av(t,e,i,n)),Fv=(t,e)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(i.find(i=>t instanceof e[i]))},Dv=["webgl","webgl2"];function Lv(t){return"nodeType"in t}function Nv(t,e,i,n){const s=[];try{if(n){const n=function(t,e,i){const n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return Yc(n.prototype,"configure",function(n){return function(s){const r=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!r||Lv(r)&&jd(r,e,i,!0))return n.call(this,s);Lv(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?ue(ue({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=Yc(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!jd(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Dv.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function qv(t,e,i,n,s,r,o){const a=[],l=Object.getOwnPropertyNames(t);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const l=Yc(t,u,function(t){return function(...a){const l=t.apply(this,a);if(Pv(l,r,this),this.canvas&&"tagName"in this.canvas&&!jd(this.canvas,n,s,!0)){let t;try{t=Ov(a,r,this,o)}catch(t){}t&&i(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(r){const o=Od(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!jd(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var jv='(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',Bv="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",jv],{type:"text/javascript;charset=utf-8"});function zv(t){let e;try{if(e=Bv&&(self.URL||self.webkitURL).createObjectURL(Bv),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(jv),{name:null==t?void 0:t.name})}}var Uv="A page CSP that omits blob: from worker-src or script-src blocks it";function Hv(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var Wv,Vv,Gv,Qv=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.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(t){Th(this,"pendingCanvasMutations",new Map),Th(this,"rafStamps",{latestId:0,invokeId:null}),Th(this,"mirror",void 0),Th(this,"mutationCb",void 0),Th(this,"resetObservers",void 0),Th(this,"frozen",!1),Th(this,"locked",!1),Th(this,"rafIdTimestamp",null),Th(this,"rafIdFlush",null),Th(this,"refCount",0),Th(this,"torndown",!1),Th(this,"resetFrameDedup",null),Th(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return void Hv("disabled because this browser does not support OffscreenCanvas");const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,a=Nv(e,i,n,!0),l=new Map;let u;try{u=new zv}catch(t){return Hv(`disabled because the encode worker did not start. ${Uv}`,t),void a()}let c=!1;u.onerror=t=>{var e;c=!0,Hv(`stopped because the encode worker failed. ${Uv}`,t),cancelAnimationFrame(f),null===(e=u.terminate)||void 0===e||e.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(l.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,type:Lc["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};let h=!1,d=!1;const v=1e3/t;let f,p=0;const g=t=>{var a;c||(p&&v>t-p||(p=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{jd(e,i,n,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&s(t.shadowRoot)})}catch(t){}};return s(e.document),t})().forEach((a=re(function*(t){const e=r.mirror.getId(t);if(-1!==e&&!l.get(e)&&0!==t.width&&0!==t.height){l.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void l.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,a=t.clientHeight||t.height,c=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),v=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return xv}if(void 0===o)return;if(!Array.isArray(o)||!o.every($v))return xv;const a=i/s,l=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*a),i=Math.floor(t.y*l);return{x:e,y:i,width:Math.ceil((t.x+t.width)*a)-e,height:Math.ceil((t.y+t.height)*l)-i}})}(s.canvasMasking,t,c,d,r,a);if("skip-frame"===v)return h||(h=!0,Hv("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void l.set(e,!1);const f=yield createImageBitmap(t,1>o?{resizeWidth:c,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:c,resizeHeight:d});u.postMessage({id:e,bitmap:f,width:c,height:d,displayWidth:r,displayHeight:a,dataURLOptions:s.dataURLOptions,maskRegions:v},[f])}catch(t){d||(d=!0,Hv("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),l.set(e,!1)}}}),function(t){return a.apply(this,arguments)}))),f=requestAnimationFrame(g))};f=requestAnimationFrame(g),this.resetObservers=()=>{var t;a(),cancelAnimationFrame(f),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Nv(t,e,i,!1),r=function(t,e,i,n,s){const r=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])continue;const o=Yc(e.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return jd(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Ov(o,e,this,s)}catch(t){return}t(this.canvas,{type:Lc["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Od(e.CanvasRenderingContext2D.prototype,a,{set(e){jd(this.canvas,i,n,!0)||t(this.canvas,{type:Lc["2D"],property:a,args:[e],setter:!0})}});r.push(o)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n),o=function(t,e,i,n,s){const r=[];return void 0!==e.WebGLRenderingContext&&r.push(...qv(e.WebGLRenderingContext.prototype,Lc.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...qv(e.WebGL2RenderingContext.prototype,Lc.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>ws(t,Pc)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},Zv=class{constructor(t){var e;Th(this,"trackedLinkElements",new WeakSet),Th(this,"pendingDeferredSheets",new Set),Th(this,"mutationCb",void 0),Th(this,"adoptedStyleSheetCb",void 0),Th(this,"maskAllElementAttributes",void 0),Th(this,"maskAttributeFn",void 0),Th(this,"styleMirror",new Gd),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Bh(n))}catch(t){}if(!i||!n)return xh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=th(),u=nh();let c=!0;try{if(r)return a=!0,xh(),!0;if(!s.advance(i))return c=!1,!1;a=!0;const o=s.text();if(!t.isConnected)return!0;let l=null;try{l=t.sheet}catch(t){}return l!==n?(xh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(xh(),!0)}finally{c&&this.pendingDeferredSheets.delete(o),sh(h=th()-l,null!=(d=u)?d:eh)||(ph.totalMs+=h,h>ph.slowestSliceMs&&(ph.slowestSliceMs=h))}var h,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:Vh({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=th();try{_h(()=>{try{const t=e.rules||e.cssRules;t&&bh(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:Fh(t,e.href),index:i}))})})}finally{wh(th()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),bd.forEach(t=>t.abort()),bd.clear()}trackStylesheetInLinkElement(t){}},Jv=class{constructor(){Th(this,"nodeMap",new WeakMap),Th(this,"active",!1)}inOtherBuffer(t,e){const i=this.nodeMap.get(t);return i&&Array.from(i).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},Kv=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var Yv;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(Yv=t.contentWindow)||void 0===Yv?void 0:Yv.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var Xv=new zh,tf=new Set([Oc.Mutation,Oc.MediaInteraction,Oc.StyleSheetRule,Oc.CanvasMutation,Oc.Font,Oc.Log,Oc.StyleDeclaration,Oc.AdoptedStyleSheet]);function ef(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function nf(t={}){let e,i=!1,n=!1;const{emit:s,checkoutEveryNms:r,checkoutEveryNth:o,blockClass:a="rr-block",blockSelector:l=null,ignoreClass:u="rr-ignore",ignoreSelector:c=null,maskTextClass:h="rr-mask",maskTextSelector:d=null,inlineStylesheet:v=!0,inlineStylesheetBudgetRules:f,maskAllInputs:p,maskInputOptions:g,slimDOMOptions:m,maskInputFn:y,maskTextFn:b,maskAllElementAttributes:_=!1,maskAttributeFn:w,hooks:k,packFn:S,sampling:x={},dataURLOptions:C={},canvasResolutionScale:T,canvasMasking:E,mousemoveWait:I,recordDOM:M=!0,recordCanvas:R=!1,recordCrossOriginIframes:P=!1,recordAfter:A=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:O=!1,collectFonts:F=!1,inlineImages:D=!1,plugins:L,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:q=new Set([]),attributeFilter:j,errorHandler:B}=t;sv(B);const z=ue({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},C),U=!P||window.parent===window;let H=!1;if(!U)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(U&&!s)throw new Error("emit function is required");if(!U&&!H)return()=>{};void 0!==I&&void 0===x.mousemove&&(x.mousemove=I),Xv.reset();const W=!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!==g?g:{password:!0},V=$d(void 0!==m&&m);let G;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let Q=0;const Z=new Map;let J,K;const Y=t=>{for(const e of L||[])e.eventProcessor&&(t=e.eventProcessor(t));return S&&!H&&(t=S(t)),t};Wv=(t,e)=>{var i;const n=t;if(n.timestamp=Fd(),!(null===(i=av[0])||void 0===i?void 0:i.isFrozen())||n.type===Ac.FullSnapshot||n.type===Ac.IncrementalSnapshot&&tf.has(n.data.source)||av.forEach(t=>t.unfreeze()),U)null==s||s(Y(n),e);else if(H){const t={type:"rrweb",event:Y(n),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(n.type===Ac.FullSnapshot)G=n,Q=0;else if(n.type===Ac.IncrementalSnapshot){if(n.data.source===Oc.Mutation&&n.data.isAttachIframe)return;Q++,(o&&Q>=o||r&&n.timestamp-G.timestamp>r)&&Vv(!0)}};const X=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=Xv.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=nt.getIframeElementById(t);n&&i.has(n)?nt.forgetIframeId(t):(null==J||J(t),nt.removeIframeById(t))}),null==K||K(),nt.cleanupDetachedIframes()}Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Mutation},t)})},tt=t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Scroll},t)}),et=t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.CanvasMutation},t)}),it=new Zv({mutationCb:X,adoptedStyleSheetCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.AdoptedStyleSheet},t)}),maskAllElementAttributes:_,maskAttributeFn:w}),nt=new kv({mirror:Xv,mutationCb:X,stylesheetManager:it,recordCrossOriginIframes:P,wrappedEmit:Wv});for(const t of L||[])t.getMirror&&t.getMirror({nodeMirror:Xv,crossOriginIframeMirror:nt.crossOriginIframeMirror,crossOriginIframeStyleMirror:nt.crossOriginIframeStyleMirror});const st=new Jv,rt=null==E?void 0:E.configured;Gv=new Qv({recordCanvas:R,mutationCb:et,win:window,blockClass:a,blockSelector:l,mirror:Xv,sampling:x.canvas,dataURLOptions:z,resolutionScale:T,canvasMasking:E});const ot=new Sv({mutationCb:X,scrollCb:tt,bypassOptions:{blockClass:a,blockSelector:l,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskInputOptions:W,dataURLOptions:z,maskTextFn:b,maskInputFn:y,maskAllElementAttributes:_,maskAttributeFn:w,recordCanvas:R,canvasMaskingConfigured:rt,inlineImages:D,sampling:x,slimDOMOptions:V,iframeManager:nt,stylesheetManager:it,canvasManager:Gv,keepIframeSrcFn:N,processedNodeManager:st,attributeFilter:j},mirror:Xv});Vv=(t=!1)=>{if(M){gh(f);try{if(Wv({type:Ac.Meta,data:{href:window.location.href,width:Nd(),height:Ld()}},t),i)return;null==e||e.cancel(),e=void 0,it.reset(),ot.init(),av.forEach(t=>t.lock());let n=null,s=[];try{n=function(t,e){const{mirror:i=new zh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,canvasMaskingConfigured:c,maskAllInputs:h=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:E}=e||{},I=!0===h?{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===h?{password:!0}:h,M=$d(g);gh(E);try{return xd(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:I,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:M,dataURLOptions:m,inlineImages:l,recordCanvas:u,canvasMaskingConfigured:c,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{mh()}}(document,{mirror:Xv,blockClass:a,blockSelector:l,maskTextClass:h,maskTextSelector:d,inlineStylesheet:v,maskAllInputs:W,inlineStylesheetBudgetRules:f,maskTextFn:b,maskInputFn:y,maskAllElementAttributes:_,maskAttributeFn:w,slimDOM:V,dataURLOptions:z,recordCanvas:R,canvasMaskingConfigured:rt,inlineImages:D,onSerialize(t){Hd(t,Xv)&&nt.addIframe(t),Wd(t,Xv)&&it.trackLinkElement(t),Vd(t)&&ot.addShadowRoot(Xc.shadowRoot(t),document)},onIframeLoad(t,e){nt.attachIframe(t,e),ot.observeAttachShadow(t)},onIframeListenerRegistered(t,e){nt.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){it.attachLinkElement(t,e)},keepIframeSrcFn:N})}finally{s=Sh()}if(i)return;if(!n)return console.warn("Failed to snapshot the document");if(Wv({type:Ac.FullSnapshot,data:{node:n,initialOffset:Dd(window)}},t),i)return;if(av.forEach(t=>t.unlock()),Gv.onFullSnapshot(),s.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const a=()=>null!==o||t.length>r,l=()=>{const i=t[r];t[r]=null,r+=1,i&&Id(()=>{o=e.beginDeferredLinkInlining(i,Xv.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Id(()=>{e=t.advance(200)}),e&&(o=null)},c=()=>{o||l(),u()},h=t=>{if(s=null,n)return;let e=0;do{try{c()}catch(t){null==o||o.discard(),o=null,$h(1)}e+=1}while(!n&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(a()?s=ef(h):i())};return s=ef(h),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,c=0;for(;a()&&50>e;){o||l();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,c+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,c+=1}e+=1}}if(a()||c>0){let e=c+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);$h(e),null==o||o.discard(),o=null}i()}}}(s,it,()=>{e===t&&(e=void 0)});e=t}P&&nt.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&it.adoptStyleSheets(document.adoptedStyleSheets,Xv.getId(document))}finally{mh()}}};try{const t=[];t.push(Td("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Td(e,ih,document));J=e=>{const i=Z.get(e);i&&(i.forEach(e=>{Id(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),Z.delete(e))},K=()=>{for(const[t]of Z){const e=Xv.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==J||J(t)}catch(e){null==J||J(t)}else null==J||J(t)}};const s=t=>{var e;return ov(yv)({mutationCb:X,mousemoveCb:(t,e)=>Wv({type:Ac.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.MouseInteraction},t)}),scrollCb:tt,viewportResizeCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.ViewportResize},t)}),inputCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Input},t)}),mediaInteractionCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.MediaInteraction},t)}),styleSheetRuleCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.StyleSheetRule},t)}),styleDeclarationCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.StyleDeclaration},t)}),canvasMutationCb:et,fontCb:t=>Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Font},t)}),selectionCb(t){Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.Selection},t)})},customElementCb(t){Wv({type:Ac.IncrementalSnapshot,data:ue({source:Oc.CustomElement},t)})},blockClass:a,ignoreClass:u,ignoreSelector:c,maskTextClass:h,maskTextSelector:d,maskInputOptions:W,inlineStylesheet:v,sampling:x,recordDOM:M,recordCanvas:R,canvasMaskingConfigured:rt,inlineImages:D,userTriggeredOnInput:O,collectFonts:F,doc:t,maskInputFn:y,maskTextFn:b,maskAllElementAttributes:_,maskAttributeFn:w,keepIframeSrcFn:N,blockSelector:l,slimDOMOptions:V,dataURLOptions:z,mirror:Xv,iframeManager:nt,stylesheetManager:it,shadowDomManager:ot,processedNodeManager:st,canvasManager:Gv,ignoreCSSAttributes:q,attributeFilter:j,plugins:(null==L||null===(e=L.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>Wv({type:Ac.Plugin,data:{plugin:t.name,payload:e}})})))||[]},k)};nt.addLoadListener(e=>{try{const i=Xv.getId(e),n=s(e.contentDocument);if("function"==typeof n&&(t.push(n),-1!==i)){let t=Z.get(i);t||(t=new Set,Z.set(i,t)),t.add(n)}}catch(t){console.warn(t)}}),nt.addPageHideListener(t=>{const e=Xv.getId(t);null==J||J(e),hv(t)});let r=-1;const o=t=>Wv({type:Ac.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),f=()=>{var t,e,i,n;const s=document,a=null!==(t=null!==(e=null!==(i=null!==(n=s.fullscreenElement)&&void 0!==n?n:s.webkitFullscreenElement)&&void 0!==i?i:s.mozFullScreenElement)&&void 0!==e?e:s.msFullscreenElement)&&void 0!==t?t:null,l=a?Xv.getId(a):-1;l!==r&&(-1!==r&&o({id:r,enter:!1}),r=l,-1!==l&&o({id:l,enter:!0}))},p=()=>{if(i||n)return;if(n=!0,Vv(),i)return;const e=s(document);i?"function"==typeof e&&Md([e]):("function"==typeof e&&t.push(e),t.push(Td("fullscreenchange",f)),t.push(Td("webkitfullscreenchange",f)),t.push(Td("mozfullscreenchange",f)),t.push(Td("MSFullscreenChange",f)),Kv=!0)};return["interactive","complete"].includes(document.readyState)?p():(t.push(Td("DOMContentLoaded",()=>{Wv({type:Ac.DomContentLoaded,data:{}}),"DOMContentLoaded"===A&&setTimeout(p,0)})),t.push(Td("load",()=>{Wv({type:Ac.Load,data:{}}),"load"===A&&p()},window))),()=>{i=!0;try{null==e||e.flush()}catch(t){}e=void 0,Md(t),st.destroy(),nt.removeLoadListener(),nt.destroy(),Z.clear(),ot.reset(),Xv.reset(),Kv=!1,rv()}}catch(t){console.warn(t)}}nf.addCustomEvent=(t,e)=>{if(!Kv)throw new Error("please add custom event after start recording");Wv({type:Ac.Custom,data:{tag:t,payload:e}})},nf.freezePage=()=>{av.forEach(t=>t.freeze())},nf.takeFullSnapshot=t=>{if(!Kv)throw new Error("please take full snapshot after start recording");Vv(t)},nf.isRecording=()=>Kv,nf.mirror=Xv,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,new RegExp(/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi.source,"i");var sf=/[a-z][a-z0-9+.-]{0,63}:\/\//i;new RegExp(`^${sf.source}`,"i"),new RegExp(sf.source,"gi"),"0".repeat(32),"0".repeat(16);var rf=Object.create(null);function of(t){return of="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},of(t)}function af(t,e,i){return(e=function(t){var e=function(t){if("object"!=of(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=of(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==of(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}rf.Node=Object.create(null),rf.ShadowRoot=Object.create(null),rf.MutationObserver=Object.create(null),rf.Element=Object.create(null);var lf=class{constructor(t){af(this,"fileName",void 0),af(this,"functionName",void 0),af(this,"lineNumber",void 0),af(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},uf=/(^|@)\S+:\d+/,cf=/^\s*at .*(\S+:\d+|\(native\))/m,hf=/^(eval@)?(\[native code])?$/,df={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(cf)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(cf)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=i?e.replace(i[0],""):e;const n=e.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new lf({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(hf)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new lf({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new lf({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[];for(let t=2,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new lf({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[];for(let t=0,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new lf({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(uf)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new lf({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function vf(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let i=t.localName;if(!i)break;i=i.toLowerCase();const n=t.parentElement,s=[];if(n.children&&n.children.length>0)for(let t=0;n.children.length>t;t++){const e=n.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===i&&s.push(e)}s.length>1&&(i+=`:eq(${s.indexOf(t)})`),e=i+(e?">"+e:""),t=n}return e}function ff(t){return Array.isArray(t)}function pf(t){return"object"==typeof t&&null!==t&&!ff(t)}function gf(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(pf(t[n])&&gf(t[n],e-1))return!0;return!1}function mf(t,e){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,e);const n=[],s=[];return JSON.stringify(t,function(t,e){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,t):s.push(t),~n.indexOf(e)&&(e=n[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(e)).join(".")+"]")}else n.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(pf(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||pf(r)&&gf(r,i.depthOfLimit))return function(t){let e=t.toString();return i.stringLengthLimit&&e.length>i.stringLengthLimit&&(e=`${e.slice(0,i.stringLengthLimit)}...`),e}(e);var r;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const i in e){const n=e[i];t[i]=ff(n)?vf(n.length?n[0]:null):n}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var yf={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 bf(t,e,i){const n=i?Object.assign({},yf,i):yf,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,a=!1,l=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:df.parse(e.error).map(t=>t.toString()),payload:[mf(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[mf(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[mf("Uncaught (in promise)",n.stringifyOptions),mf(e.reason,n.stringifyOptions)]),t({level:"error",trace:df.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(c(r,t));return()=>{l=!1,u.forEach(t=>t())};function c(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],c={next:u},h=(s=>(...r)=>{if(s.apply(e,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const e=df.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>mf(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[mf("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{a=!1}}})(function(...t){return c.next.apply(this,t)});return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),s[r]=h,()=>{if(s[r]===h)return void(s[r]=c.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===h)return void(i.next=c.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var _f=t=>({name:"rrweb/console@1",observer:bf,options:t});const wf=()=>{},kf=t=>{var e;if(xe(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Sf(t,e,i){try{if(!(e in t))return wf;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return xe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],r=kf(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=kf(i)}}}catch(t){return wf}}function xf(t,e){var i;const n=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),s={hostname:n,isHostDenied:!1};if(!(null===(i=e.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const t of e.payloadHostDenyList)if(n.endsWith(t))return{hostname:n,isHostDenied:!0};return s}const $f=Or("[Recorder]"),Cf=t=>"navigation"===t.entryType,Tf=t=>"resource"===t.entryType,Ef=()=>{};function If(t,e){var i;return Cf(e)&&"complete"===(null===(i=t.document)||void 0===i?void 0:i.readyState)&&e.loadEventEnd>0}function Mf(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(i=>If(t,i)||Tf(i)&&e.initiatorTypes.includes(i.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>If(t,e))}(t):[]}function Rf(t,e){return!!e&&(Oe(e)||e[t])}function Pf(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const Af=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Of({type:t,recordBody:e,headers:i,url:n}){function s(t){const e=Object.keys(i).find(t=>"content-type"===t.toLowerCase()),n=e&&i[e];return t.some(t=>null==n?void 0:n.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Pf(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(Af))return!1;if(Oe(e))return!0;if(Se(e))return s(e);const r=e[t];return Oe(r)?r:s(r)}function Ff(t,e,i,n,s){return Df.apply(this,arguments)}function Df(){return Df=re(function*(t,e,i,n,s,r=0){if(r>10)return $f.warn("Failed to get performance entry for request",{url:i,initiatorType:e}),null;const o=function(t,e){for(let i=t.length-1;i>=0;i-=1)if(e(t[i]))return t[i]}(t.performance.getEntriesByName(i),t=>Tf(t)&&t.initiatorType===e&&(Te(n)||t.startTime>=n)&&(Te(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Ff(t,e,i,n,s,r+1))}),Df.apply(this,arguments)}function Lf({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=xf(i,e);if(s)return n+" is in deny list";if(Ee(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(Fe(t))return Yr(t);if($e(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Nf=t=>!Me(t)&&("navigation"===t.entryType||"resource"===t.entryType);function qf(t,{entry:e,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:a,url:l,initiatorType:u}){o=e?e.startTime:o,a=e?e.responseEnd:a;const c=Math.floor(Date.now()-t.performance.now()),h=Math.floor(c+(o||0)),d=[ue(ue({},e?JSON.parse(JSON.stringify(e.toJSON())):{name:l}),{},{startTime:Te(o)?void 0:Math.round(o),endTime:Te(a)?void 0:Math.round(a),timeOrigin:c,timestamp:h,method:i,initiatorType:u||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Nf(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:h,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const jf=["video/","audio/"];function Bf(t){return $e(t)&&xe(t.getReader)&&xe(t.tee)}const zf="[SessionReplay] Timeout while trying to read body",Uf="[SessionReplay] Failed to read body";function Hf(t){return`${Uf}: ${t}`}function Wf(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Vf(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(zf),500);try{t.clone().text().then(t=>e(t),t=>e(Hf(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Uf)}})}(t);const i=Ko(e);return function(t,e){try{var i,n;const s=null===(i=t.headers)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"content-length");if(!s)return!1;const r=parseInt(s,10);return Number.isFinite(r)&&r>e}catch(t){return!1}}(t,i)?Promise.resolve(Wf(i)):function(t,e){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(t){}}function o(t){s||(s=!0,clearTimeout(a),r(),i(t))}const a=setTimeout(()=>o(zf),500);let l;try{l=t.clone()}catch(t){return void o(Uf)}const u=l.body;if(!Bf(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(Hf(t)))}catch(t){o(Uf)}return}try{n=u.getReader()}catch(t){return void o(Uf)}const c=[];let h=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(c,h)));else{if(n){if(h+n.byteLength>e)return void o(Wf(e));h+=n.byteLength,c.push(n)}t()}},t=>o(Hf(t)))}()})}(t,i)}function Gf(t){return Qf.apply(this,arguments)}function Qf(){return Qf=re(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=xf(i,e);return s?Promise.resolve(n+" is in deny list"):Vf(t,e)}),Qf.apply(this,arguments)}function Zf(t){return Jf.apply(this,arguments)}function Jf(){return Jf=re(function*({r:t,options:e,url:i}){const n=function({r:t,options:e,url:i}){var n;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=t.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=jf.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:a}=xf(i,e);return a?o+" is in deny list":null}({r:t,options:e,url:i});return Me(n)?Vf(t,e):Promise.resolve(n)}),Jf.apply(this,arguments)}let Kf=null;function Yf(t,e,i){if(!("performance"in e))return()=>{};if(Kf)return $f.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},Yo,i):Yo;let s=!0,r=!1;const o=e=>{if(!s)return;const i=[];let o=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&o)return;let s;try{s=n.maskRequestFn(t)}catch(t){return r||(r=!0,$f.warn("Network capture masking callback failed; dropping the record. Further masking failures will not be logged for this observer.")),void(e||(o=!0))}e||(o=!s||(t=>!!t&&oa.has(t))(s)),s&&i.push(s)}),i.length>0&&t(ue(ue({},e),{},{requests:i}))},a=function(t,e,i){try{t({requests:Mf(e,i).flatMap(t=>qf(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){$f.error("Failed to capture initial performance entries for network capture",t)}const n=e.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!Se(s))return;const r=s.filter(t=>i.performanceEntryTypeToObserve.includes(t));if(!r.length)return;const o=new n(n=>{t({requests:n.getEntries().filter(t=>Cf(t)||Tf(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>qf(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(o,e,n),l=n.recordHeaders||n.recordBody;if(!a&&!l)return s=!1,Ef;let u=()=>{},c=()=>{};return l&&(u=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=Rf("request",i.recordHeaders),s=Rf("response",i.recordHeaders),r=Sf(e.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,u,c){const h=this;try{const r=new Request(a),l={};let u,c;const d={},v=h.setRequestHeader.bind(h);h.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(l.requestHeaders=d);const f=h.send.bind(h);h.send=t=>(Of({type:"request",headers:d,url:a,recordBody:i.recordBody})&&(l.requestBody=Lf({body:t,options:i,url:a})),u=e.performance.now(),f(t));const p=()=>{h.removeEventListener("readystatechange",g),h.removeEventListener("error",p),h.removeEventListener("abort",p),h.removeEventListener("timeout",p)},g=()=>{if(h.readyState!==h.DONE)return;p(),c=e.performance.now();const n={};h.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(l.responseHeaders=n),Of({type:"response",headers:n,url:a,recordBody:i.recordBody})&&(l.responseBody=Lf({body:h.response,options:i,url:a})),Ff(e,"xmlhttprequest",r.url,u,c).then(i=>{t({requests:qf(e,{entry:i,method:o,status:null==h?void 0:h.status,networkRequest:l,start:u,end:c,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};h.addEventListener("readystatechange",g),h.addEventListener("error",p),h.addEventListener("abort",p),h.addEventListener("timeout",p)}catch(t){$f.error("Failed to instrument XHR for network capture",t)}r.call(h,o,a.toString(),l,u,c)});return()=>{r()}}(o,e,n),c=!0===n.captureFetchSynchronously?function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Rf("request",i.recordHeaders),s=Rf("response",i.recordHeaders),r=Sf(e,"fetch",r=>function(o,a){let l;try{l=new Request(o,a)}catch(t){$f.error("Failed to instrument fetch for network capture",t);try{return Promise.resolve(r(o,a))}catch(t){return new Promise((e,i)=>i(t))}}const u={};let c,h;const d=re(function*(){try{const t={};l.headers.forEach((e,i)=>{t[i]=e}),n&&(u.requestHeaders=t),!Bf(null==a?void 0:a.body)&&Of({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(u.requestBody=yield Gf({r:l,options:i,url:o}))}catch(t){$f.error("Failed to record fetch request for network capture",t)}})(),v=(f=re(function*(t){try{const e={};t.headers.forEach((t,i)=>{e[i]=t}),s&&(u.responseHeaders=e),Of({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield Zf({r:t,options:i,url:o}))}catch(t){$f.error("Failed to record fetch response for network capture",t)}}),function(t){return f.apply(this,arguments)});var f;try{c=e.performance.now()}catch(t){}let p;try{p=Pf(o)?r(l):r(o,a)}catch(t){p=new Promise((e,i)=>i(t))}const g=Promise.resolve(p).then(t=>{try{h=e.performance.now()}catch(t){}return{status:"fulfilled",response:t}},t=>({status:"rejected",error:t}));return re(function*(){let i;try{yield d;const t=yield g;if("rejected"===t.status)throw t.error;return i=t.response,yield v(i),i}finally{(n=i,Ff(e,"fetch",l.url,c,h).then(i=>{t({requests:qf(e,{entry:i,method:l.method,status:null==n?void 0:n.status,networkRequest:u,start:c,end:h,url:l.url,initiatorType:"fetch"})})})).catch(()=>{})}var n})()});return()=>{r()}}(o,e,n):function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Rf("request",i.recordHeaders),s=Rf("response",i.recordHeaders),r=Sf(e,"fetch",r=>function(){var o=re(function*(o,a){let l,u;try{l=new Request(o,a)}catch(t){return $f.error("Failed to instrument fetch for network capture",t),r(o,a)}const c={};let h,d;try{try{const t={};l.headers.forEach((e,i)=>{t[i]=e}),n&&(c.requestHeaders=t),!Bf(null==a?void 0:a.body)&&Of({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(c.requestBody=yield Gf({r:l,options:i,url:o}))}catch(t){$f.error("Failed to record fetch request for network capture",t)}h=e.performance.now(),u=Pf(o)?yield r(l):yield r(o,a),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(c.responseHeaders=t),Of({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(c.responseBody=yield Zf({r:u,options:i,url:o}))}catch(t){$f.error("Failed to record fetch response for network capture",t)}return u}finally{Ff(e,"fetch",l.url,h,d).then(i=>{t({requests:qf(e,{entry:i,method:l.method,status:null==u?void 0:u.status,networkRequest:c,start:h,end:d,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(o,e,n)),Kf=()=>{s=!1,null==a||a(),u(),c(),Kf=null},Kf}const Xf=t=>({name:"rrweb/network@1",observer:Yf,options:t});var tp,ep,ip,np,sp,rp,op,ap,lp,up,cp,hp,dp,vp,fp;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:_f,getRecordNetworkPlugin:Xf},h.__PosthogExtensions__.rrweb={record:nf,version:"v2",wasMaxDepthReached:()=>Sd,resetMaxDepthState(){Sd=!1,kd=!1},getLastSnapshotCost:()=>uh,getMutationCost:()=>ue({},fh),getObserverInitFailures:()=>mv.size?Array.from(mv):void 0,resetSnapshotCostState(){rh=0,oh=0,ah=0,eh=0,lh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},uh=null,ch=null,hh=[],dh=0,vh=0,fh={slowestBatchMs:0},ph={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:nf,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:_f},h.getRecordNetworkPlugin=Xf,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(t,e)=>new Rc(t,e);var pp,gp,mp,yp,bp={},_p=[],wp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,kp=Array.isArray;function Sp(t,e){for(var i in e)t[i]=e[i];return t}function xp(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function $p(t,e,i){var n,s,r,o={};for(r in e)"key"==r?n=e[r]:"ref"==r?s=e[r]:o[r]=e[r];if(arguments.length>2&&(o.children=arguments.length>3?tp.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===o[r]&&(o[r]=t.defaultProps[r]);return Cp(t,o,n,s,null)}function Cp(t,e,i,n,s){var r={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++ip:s,__i:-1,__u:0};return null==s&&null!=ep.vnode&&ep.vnode(r),r}function Tp(t){return t.children}function Ep(t,e){this.props=t,this.context=e}function Ip(t,e){if(null==e)return t.__?Ip(t.__,t.__i+1):null;for(var i;t.__k.length>e;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Ip(t):null}function Mp(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=Sp({},e);r.__v=e.__v+1,ep.vnode&&ep.vnode(r),jp(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Ip(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,zp(n,r,s),e.__e=e.__=null,r.__e!=i&&Rp(r)}}function Rp(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),Rp(t)}function Pp(t){(!t.__d&&(t.__d=!0)&&np.push(t)&&!Ap.__r++||sp!=ep.debounceRendering)&&((sp=ep.debounceRendering)||rp)(Ap)}function Ap(){try{for(var t,e=1;np.length;)np.length>e&&np.sort(op),t=np.shift(),e=np.length,Mp(t)}finally{np.length=Ap.__r=0}}function Op(t,e,i,n,s,r,o,a,l,u,c){var h,d,v,f,p,g,m,y=n&&n.__k||_p,b=e.length;for(l=function(t,e,i,n,s){var r,o,a,l,u,c=i.length,h=c,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=Cp(null,o,null,null,null):kp(o)?o=t.__k[r]=Cp(Tp,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=Cp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,l=r+d,o.__=t,o.__b=t.__b+1,a=null,-1!=(u=o.__i=Dp(o,i,l,h))&&(h--,(a=i[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>c?d--:c>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?d--:u==l+1?d++:(u>l?d--:d++,o.__u|=4))):t.__k[r]=null;if(h)for(r=0;c>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==n&&(n=Ip(a)),Wp(a,a));return n}(i,e,y,l,b),h=0;b>h;h++)null!=(v=i.__k[h])&&(d=-1!=v.__i&&y[v.__i]||bp,v.__i=h,g=jp(t,v,d,s,r,o,a,l,u,c),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Hp(d.ref,null,v),c.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(l=Fp(v,l,t,m),m&&d.__e&&(d.__e=null)):"function"==typeof v.type&&void 0!==g?l=g:f&&(l=f.nextSibling),v.__u&=-7);return i.__e=p,l}function Fp(t,e,i,n){var s,r;if("function"==typeof t.type){for(s=t.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=t,e=Fp(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Ip(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Dp(t,e,i,n){var s,r,o,a=t.key,l=t.type,u=e[i],c=null!=u&&!(2&u.__u);if(null===u&&null==a||c&&a==u.key&&l==u.type)return i;if(n>(c?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Lp(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||wp.test(e)?i:i+"px"}function Np(t,e,i,n,s){var r,o;t:if("style"==e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Lp(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Lp(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(cp,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=i,i?n?i[up]=n[up]:(i[up]=hp,t.addEventListener(e,r?vp:dp,r)):t.removeEventListener(e,r?vp:dp,r);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null==i||!1===i&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==i?"":i))}}function qp(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[lp])e[lp]=hp++;else if(i[up]>e[lp])return;return i(ep.event?ep.event(e):e)}}}function jp(t,e,i,n,s,r,o,a,l,u){var c,h,d,v,f,p,g,m,y,b,$,_,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=e.__e=i.__e]),(c=ep.__b)&&c(e);t:if("function"==typeof C){h=o.length;try{if(y=e.props,b=C.prototype&&C.prototype.render,$=(c=C.contextType)&&n[c.__c],_=c?$?$.props.value:c.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new C(y,_):(e.__c=d=new Ep(y,_),d.constructor=C,d.render=Vp),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=Sp({},d.__s)),Sp(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),_p.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,_),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=_,d.props=y,d.__P=t,d.__e=!1,w=ep.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),_p.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=Sp(Sp({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=c&&c.type===Tp&&null==c.key?Up(c.props.children):c,a=Op(t,kp(S)?S:[S],e,i,n,s,r,o,a,l,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=h,e.__v=null,l||null!=r)if(t.then){for(e.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),e.__e=a}else{if(null!=r)for(x=r.length;x--;)xp(r[x]);Bp(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Bp(e);ep.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):a=e.__e=function(t,e,i,n,s,r,o,a,l){var u,c,h,d,v,f,p,g=i.props||bp,m=e.props,y=e.type;if("svg"==y?s="http://www.w3.org/2000/svg":"math"==y?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(u=0;r.length>u;u++)if((v=r[u])&&"setAttribute"in v==!!y&&(y?v.localName==y:3==v.nodeType)){t=v,r[u]=null;break}if(null==t){if(null==y)return document.createTextNode(m);t=document.createElementNS(s,y,m.is&&m),a&&(ep.__m&&ep.__m(e,r),a=!1),r=null}if(null==y)g===m||a&&t.data==m||(t.data=m);else{if(r="textarea"==y&&null!=m.defaultValue?null:r&&tp.call(t.childNodes),!a&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?h=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||Np(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?c=v:"value"==u?f=v:"checked"==u?p=v:a&&"function"!=typeof v||g[u]===v||Np(t,u,v,g[u],s);if(c)a||h&&(c.__html==h.__html||c.__html==t.innerHTML)||(t.innerHTML=c.__html),e.__k=[];else if(h&&(t.innerHTML=""),Op("template"==e.type?t.content:t,kp(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Ip(i,0),a,l),null!=r)for(u=r.length;u--;)xp(r[u]);a&&"textarea"!=y||(u="value","progress"==y&&null==f?t.removeAttribute("value"):null!=f&&(f!==t[u]||"progress"==y&&!f||"option"==y&&f!=g[u])&&Np(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&Np(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,l,u);return(c=ep.diffed)&&c(e),128&e.__u?void 0:a}function Bp(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Bp))}function zp(t,e,i){for(var n=0;i.length>n;n++)Hp(i[n],i[++n],i[++n]);ep.__c&&ep.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){ep.__e(t,e.__v)}})}function Up(t){return"object"!=typeof t||null==t||t.__b>0?t:kp(t)?t.map(Up):void 0!==t.constructor?null:Sp({},t)}function Hp(t,e,i){try{if("function"==typeof t){var n="function"==typeof t.__u;n&&t.__u(),n&&null==e||(t.__u=t(e))}else t.current=e}catch(t){ep.__e(t,i)}}function Wp(t,e,i){var n,s;if(ep.unmount&&ep.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Hp(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){ep.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&Wp(n[s],e,i||"function"!=typeof t.type);i||xp(t.__e),t.__c=t.__=t.__e=void 0}function Vp(t,e,i){return this.constructor(t,i)}function Gp(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),ep.__&&ep.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],jp(e,t=(!n&&i||e).__k=$p(Tp,null,[t]),s||bp,bp,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?tp.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),zp(r,t,o),t.props.children=null}tp=_p.slice,ep={__e(t,e,i,n){for(var s,r,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(t)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,n||{}),o=s.__d),o)return s.__E=s}catch(e){t=e}throw t}},ip=0,Ep.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Sp({},this.state);"function"==typeof t&&(t=t(Sp({},i),this.props)),t&&Sp(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),Pp(this))},Ep.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Pp(this))},Ep.prototype.render=Tp,np=[],rp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,op=function(t,e){return t.__v.__b-e.__v.__b},Ap.__r=0,ap=Math.random().toString(8),lp="__d"+ap,up="__a"+ap,cp=/(PointerCapture)$|Capture$/i,hp=0,dp=qp(!1),vp=qp(!0),fp=0;var Qp=0,Zp=[],Jp=ep,Kp=Jp.__b,Yp=Jp.__r,Xp=Jp.diffed,tg=Jp.__c,eg=Jp.unmount,ig=Jp.__;function ng(t,e){Jp.__h&&Jp.__h(gp,t,Qp||e),Qp=0;var i=gp.__H||(gp.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function sg(t){return Qp=1,function(t,e){var i=ng(pp++,2);if(i.t=t,!i.__c&&(i.__=[pg(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=gp,!gp.__f)){var n=function(t,e,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==t;if(i.__c.__H.__.some(function(t){if(t.__N){r=!0;var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),s){var a=s.call(this,t,e,n);return r?a||o:a}return!r||o};gp.__f=!0;var s=gp.shouldComponentUpdate,r=gp.componentWillUpdate;gp.componentWillUpdate=function(t,e,i){if(this.__e){var o=s;s=void 0,n(t,e,i),s=o}r&&r.call(this,t,e,i)},gp.shouldComponentUpdate=n}return i.__N||i.__}(pg,t)}function rg(t,e){var i=ng(pp++,3);!Jp.__s&&fg(i.__H,e)&&(i.__=t,i.u=e,gp.__H.__h.push(i))}function og(t){return Qp=5,ag(function(){return{current:t}},[])}function ag(t,e){var i=ng(pp++,7);return fg(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function lg(t){var e=gp.context[t.__c],i=ng(pp++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(gp)),e.props.value):t.__}function ug(){for(var t;t=Zp.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(dg),e.__h.some(vg),e.__h=[]}catch(i){e.__h=[],Jp.__e(i,t.__v)}}}Jp.__b=function(t){gp=null,Kp&&Kp(t)},Jp.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ig&&ig(t,e)},Jp.__r=function(t){Yp&&Yp(t),pp=0;var e=(gp=t.__c).__H;e&&(mp===gp?(e.__h=[],gp.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&ug(),pp=0)),mp=gp},Jp.diffed=function(t){Xp&&Xp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==Zp.push(e)&&yp===Jp.requestAnimationFrame||((yp=Jp.requestAnimationFrame)||hg)(ug)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),mp=gp=null},Jp.__c=function(t,e){e.some(function(t){try{t.__h.some(dg),t.__h=t.__h.filter(function(t){return!t.__||vg(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],Jp.__e(i,t.__v)}}),tg&&tg(t,e)},Jp.unmount=function(t){eg&&eg(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{dg(t)}catch(t){e=t}}),i.__H=void 0,e&&Jp.__e(e,i.__v))};var cg="function"==typeof requestAnimationFrame;function hg(t){var e,i=function(){clearTimeout(n),cg&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);cg&&(e=requestAnimationFrame(i))}function dg(t){var e=gp,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),gp=e}function vg(t){var e=gp;t.__c=t.__(),gp=e}function fg(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function pg(t,e){return"function"==typeof e?e(t):e}const gg={GZipJS:"gzip-js",Base64:"base64"},mg={Activation:"events",Cancellation:"cancelEvents"},yg={Button:"button",Tab:"tab",Selector:"selector"},bg={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},_g={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},wg={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},kg={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Sg={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},xg={Once:"once",Recurring:"recurring",Always:"always"},$g={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Cg={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Tg={Popover:"popover",Inline:"inline"};function Eg(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&xe(i.then)&&i.then(void 0,()=>{})}}}}const Ig=Or("[Surveys]"),Mg="PostHog is not capturing, so a survey response cannot be recorded";function Rg(t){return xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function Pg(t){return!(!t.start_date||t.end_date)}function Ag(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}const Og=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,Fg=t=>Og("seenSurvey_",t),Dg=t=>{try{const e=Fg(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Ig.error("Failed to persist survey seen state",t)}},Lg=[wg.Popover,wg.Widget,wg.API],Ng={ignoreConditions:!1,ignoreDelay:!1,displayType:Tg.Popover},qg="autocapture",jg="featureFlags",Bg="logs",zg="surveys",Ug=Or("[Stylesheet Loader]"),Hg=t,Wg=n,Vg="#020617",Gg={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:bg.Right,widgetType:yg.Tab,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:Vg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Qg=[bg.Center,bg.Left,bg.Right];function Zg(t){if(t.startsWith("#")){let e=t.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(e)&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),/^[0-9A-Fa-f]{6}$/.test(e)?`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function Jg(t=Gg.backgroundColor){let e;"#"===t[0]&&(e=Zg(t)),t.startsWith("rgb")&&(e=t);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"}[t.toLowerCase()];if(i&&(e=Zg(i)),!e)return Vg;const n=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const t=parseInt(n[1]),e=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(t*t*.299+e*e*.587+i*i*.114)>127.5?Vg:"white"}return Vg}const Kg=(t,e,i)=>{const n=pm(t),s=Wg.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=Wg.createElement("div");((t,e,i)=>{const n=ue(ue({},Gg),i),s=t.style,r=!Qg.includes(n.position)||e===wg.Widget&&(null==i?void 0:i.widgetType)===yg.Tab;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||Jg(n.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",n.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",n.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",Jg(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Jg(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",Jg(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||n.inputBackground;o||"white"!==n.backgroundColor||(a="#f8f8f8"),s.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||Jg(a);s.setProperty("--ph-survey-input-text-color",l),s.setProperty("--ph-survey-rating-text-color",l),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),a=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return xe(t)?t:null==t||null===(e=t.config)||void 0===e?void 0:e.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(Ug.error("prepare_external_dependency_stylesheet returned null"),null)})(Wg,':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)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(a){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(a)}return(i||Wg.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Yg=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;n?Rg(n)&&(Dg(e),s&&fm(e),n.capture($g.SENT,ue(ue(ue({[Cg.SURVEY_NAME]:e.name,[Cg.SURVEY_ID]:e.id,[Cg.SURVEY_ITERATION]:e.current_iteration,[Cg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:null===(l=n.get_session_replay_url)||void 0===l?void 0:l.call(n)},Jl({event:"sent",survey:e,responses:t,submissionId:i,completed:s,surveyLanguage:o,questionSnapshots:a})),r),{},{$set:{[Yl(e,"responded")]:!0}})),s&&(Hg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),n.reloadFeatureFlags())):Ig.error("[survey sent] event not captured, PostHog instance not found.")},Xg=(t,e,i,n)=>{var s;return ue({[Cg.SURVEY_NAME]:e.name,[Cg.SURVEY_ID]:e.id,[Cg.SURVEY_ITERATION]:e.current_iteration,[Cg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,sessionRecordingUrl:null===(s=n.get_session_replay_url)||void 0===s?void 0:s.call(n)},Jl({event:t,survey:e,responses:null==i?void 0:i.responses,submissionId:null==i?void 0:i.surveySubmissionId,surveyLanguage:null==i?void 0:i.surveyLanguage,questionSnapshots:null==i?void 0:i.questionSnapshots}))},tm=(t,e,i,n)=>{if(!e)return void Ig.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=dm(t),r=s?s.surveyLanguage:n,o=ue(ue(ue({},Xg("dismissed",t,s,e)),r&&{[Cg.SURVEY_LANGUAGE]:r}),{},{$set:{[Yl(t,"dismissed")]:!0}});fm(t),Dg(t),e.capture($g.DISMISSED,o),Hg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},em=(t,e)=>{if(!e)return void Ig.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>Og("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=dm(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture($g.ABANDONED,Xg("abandoned",t,n,e),{transport:"sendBeacon"})}},im=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},nm=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?(n=t.questions,s=cu(t.questions),n.length===s.length&&n.every((t,e)=>t===s[e])?s.reverse():s):t.questions;var i,n,s},sm=t=>ru(t)||vm(t),rm=function(t){function e(t){var i,n;return this.getChildContext||(i=new Set,(n={})[e.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&i.forEach(function(t){t.__e=!0,Pp(t)})},this.sub=function(t){i.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i&&i.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+fp++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),om=()=>lg(rm),am=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,a=Sp({},t.props);for(r in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)"key"==r?n=e[r]:"ref"==r?s=e[r]:a[r]=void 0===e[r]&&null!=o?o[r]:e[r];return arguments.length>2&&(a.children=arguments.length>3?tp.call(arguments,2):i),Cp(t.type,a,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function lm(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=no(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return lu[o](r,[s])}const um=t=>Og("inProgressSurvey_",t),cm={},hm=(t,e)=>{const i=um(t);try{localStorage.setItem(i,JSON.stringify(e)),delete cm[i]}catch(t){Ig.error("Error setting in-progress survey state in localStorage",t),cm[i]=e}},dm=t=>{const e=um(t),i=cm[e];if(i)return i;try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(t){Ig.error("Error getting in-progress survey state from localStorage",t)}return null},vm=t=>{const e=dm(t);return!Re(null==e?void 0:e.surveySubmissionId)},fm=t=>{const e=um(t);delete cm[e];try{localStorage.removeItem(e)}catch(t){Ig.error("Error clearing in-progress survey state from localStorage",t)}};function pm(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function gm(t,e=bg.Right,i){if(t===wg.ExternalSurvey)return{};switch(e){case bg.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case bg.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case bg.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case bg.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case bg.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case bg.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case bg.Left:return{left:"30px"};case bg.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===wg.Widget&&i===yg.Tab?"60px":"30px"}}}var mm=0;function ym(t,e,i,n,s,r){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)"ref"==a?o=e[a]:l[a]=e[a];var u={type:t,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--mm,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof t&&(o=t.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return ep.vnode&&ep.vnode(u),u}const bm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),_m=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),wm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),km=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),Sm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:ym("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"})}),xm=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ym("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"})}),$m=ym("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:ym("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"})}),Cm=({fill:t="currentColor"}={})=>ym("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[ym("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),ym("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:t})]}),Tm=ym("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[ym("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[ym("path",{fill:"currentColor",d:"m50 23.34-.35-.05A4.5 4.5 0 0 1 47 21.97L35.56 10.1c-.3-.33-.86-.1-.86.35V27.5c0 .27.22.5.5.5h13.78c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.67-1.89zm-10.81.2a1.8 1.8 0 1 1 0-3.58 1.8 1.8 0 0 1 0 3.58"}),ym("path",{fill:"#0054ff",d:"M.87 19.13a.5.5 0 0 0-.87.34v5.94a2.6 2.6 0 0 0 2.59 2.58H7.8a.5.5 0 0 0 .37-.84zM.86 8.4c-.3-.32-.86-.1-.86.36v6.73q0 .2.13.34l8.81 9.68 1.8 2.06v-8.82zM4.59.82A2.67 2.67 0 0 0 0 2.68v1.93q0 .4.27.69l10.47 10.95v-9.1z"}),ym("path",{fill:"#ff5506",d:"M11.36 28h7.08a.5.5 0 0 0 .36-.85l-8.05-8.4v8.8l.23.28q.16.17.38.17m-.61-11.76 8.84 9.25 2.1 2.33q.1.11.27.14V18.7L10.75 7.15zm0-13.7v1.41a2 2 0 0 0 .55 1.28L21.96 16.2V7.65L15.32.8a2.67 2.67 0 0 0-4.57 1.71z"}),ym("path",{fill:"#ffb70f",d:"M22.06 28h7.76a.5.5 0 0 0 .36-.86l-8.22-8.45v9.27l.09.02zM31 25.49l1.13 1.14c.32.31.85.09.85-.35v-7.3l-.49-.51L21.96 7.64v8.55zM22.52 5.73l9.62 9.89c.3.32.86.1.86-.35V7.46L26.56.82a2.67 2.67 0 0 0-4.59 1.84v1.7c0 .51.2 1 .57 1.37z"})]}),ym("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),ym("defs",{children:ym("clipPath",{id:"ph-survey-logo-clip",children:ym("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function Em({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return ym("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Tm]})}function Im({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:u}){const{isPreviewMode:c}=lg(rm),h=!!l&&!!u,d=!a&&ym("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),c?null==o||o():s()},children:e});return ym("div",{className:"bottom-section",children:[h?ym("div",{className:"form-buttons form-buttons-with-back",children:[ym("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&ym(Em,{urlParams:{utm_source:"survey-footer"}})]})}function Mm({question:t,forceDisableHtml:e,htmlFor:i}){return ym("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[ym(t.type===kg.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&am({component:$p("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Rm({onClick:t}){const{isPreviewMode:e}=lg(rm);return ym("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:Cm({fill:"black"})})}const Pm=t;function Am({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=lg(rm);return rg(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return Hr(Pm,"keydown",t),()=>{Pm.removeEventListener("keydown",t)}},[r]),ym("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ym(Rm,{onClick:()=>r()}),ym("h3",{className:"thank-you-message-header",children:t}),e&&am({component:$p("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&ym(Im,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function Om({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=lg(rm);return ym("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&ym(Rm,{onClick:()=>l()}),t&&ym("h3",{className:"intro-screen-header",children:t}),e&&am({component:$p("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),ym(Im,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const Fm=t=>Se(t)&&t.every(t=>Ee(t));function Dm({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:u}=om(),c=og(null),[h,d]=sg(()=>Ee(o)?o:""),v=null==i?void 0:i.disableAutofocus;rg(()=>{v||setTimeout(()=>{var t;u||null===(t=c.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=ag(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case de:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case ve:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(h,t.validation,t.optional),[h,t.validation,t.optional]),g=Ir(t.validation,de),m=Ir(t.validation,ve),y=ag(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),b=()=>{p||n(h.trim())},_=()=>{p||s(h.trim())};return ym(Tp,{children:[ym("div",{className:"question-container",children:[ym(Mm,{question:t,forceDisableHtml:e,htmlFor:f}),ym("textarea",{ref:c,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:h}),y&&ym("div",{className:"validation-hint",children:y})]}),ym(Im,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:a,onBack:l})]})}function Lm({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return ym(Tp,{children:[ym("div",{className:"question-container",children:ym(Mm,{question:t,forceDisableHtml:e})}),ym(Im,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function Nm({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var u;const c=t.scale,h=10===t.scale?0:1,[d,v]=sg(()=>Pe(o)?o:Se(o)&&o.length>0&&Pe(parseInt(o[0]))?parseInt(o[0]):Ee(o)&&Pe(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=om(),g=t=>p?r(t):s(t);return ym(Tp,{children:[ym("div",{className:"question-container",children:[ym(Mm,{question:t,forceDisableHtml:e}),ym("div",{className:"rating-section",children:[ym("div",{className:"rating-options",children:["emoji"===t.display&&ym("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=Hm[t.scale])||void 0===u?void 0:u.map((e,n)=>ym("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===d?"rating-active":""}`,value:n+1,type:"button",onClick(){const e=n+1;v(e),t.skipSubmitButton&&g(e)},children:e},n))}),"number"===t.display&&ym("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${c-h+1}, minmax(0, 1fr))`},children:Wm(t.scale).map((e,s)=>ym(qm,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&ym("div",{className:"rating-text",children:[ym("div",{children:t.lowerBoundLabel}),ym("div",{children:t.upperBoundLabel})]})]})]}),ym(Im,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Me(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:a,onBack:l})]})}function qm({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return ym("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function jm({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const u=og(null),c=ag(()=>(t=>{var e;if(!t.shuffleOptions)return t.choices;const i=[...t.choices],n=t.hasOpenChoice&&null!==(e=i.pop())&&void 0!==e?e:null,s=(r=i,(o=cu(i)).length>1&&r.every((t,e)=>t===o[e])?o.reverse():o);var r,o;return Me(n)||s.push(n),s})(t),[t]),[h,d]=sg(()=>((t,e)=>Ee(t)||Fm(t)?t:e===kg.SingleChoice?null:[])(o,t.type)),[v,f]=sg(()=>((t,e)=>{if(Ee(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Fm(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,c)),{isPreviewMode:p}=om(),g=t.type===kg.SingleChoice,m=t.type===kg.MultipleChoice,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>ue(ue({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&Se(h)&&(h.includes(t)?d(h.filter(e=>e!==t)):d([...h,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>ue(ue({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>ue(ue({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Me(h)&&(!Se(h)||v.isSelected||0!==h.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?Se(h)&&(p?r([...h,v.inputValue]):s([...h,v.inputValue])):p?r(h):s(h)};return ym(Tp,{children:[ym("div",{className:"question-container",children:[ym(Mm,{question:t,forceDisableHtml:e}),ym("fieldset",{className:"multiple-choice-options limit-height",children:[ym("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),c.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,a=s?v.isSelected:g?h===e:Se(h)&&h.includes(e);return ym("label",{className:s?"choice-option-open":"",children:[ym("div",{className:"response-choice",children:[ym("input",{type:g?"radio":"checkbox",name:r,checked:a,onChange:()=>b(e,s),id:r,"aria-controls":o}),ym("span",{children:s?`${e}:`:e})]}),s&&ym("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:_,onClick(t){v.isSelected||b(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),ym(Im,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:a,onBack:l})]})}const Bm=[1,2,3,4,5],zm=[1,2,3,4,5,6,7],Um=[0,1,2,3,4,5,6,7,8,9,10],Hm={2:[xm,$m],3:[wm,_m,bm],5:[km,wm,_m,bm,Sm]};function Wm(t){switch(t){case 5:default:return Bm;case 7:return zm;case 10:return Um}}const Vm=Or("[Surveys]");function Gm(t,e,i){var n;const s=t.questions[e],r=e+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return e===t.questions.length-1?Sg.End:r;if(s.branching.type===Sg.End)return Sg.End;if(s.branching.type===Sg.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===Sg.ResponseBased){if(s.type===kg.SingleChoice){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Sg.End?Sg.End:r}}else if(s.type===kg.Rating){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(a=s.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Sg.End?Sg.End:r}}return r}return Vm.warn("Falling back to next question index due to unexpected branching type"),r}const Qm=Or("[SurveyTranslations]");function Zm(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=Xl(t);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(t){return t&&"object"==typeof t&&"language"in t?Xl(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=Xl(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:xe(t.get_property)?t.get_property(w):void 0,locale:Tu()},Qm)}(e);if(!i)return Qm.info("No user language detected"),{survey:t,language:null};const n=nu(t,i,Qm);return{survey:n.survey,language:n.matchedKey}}const Jm=t,Km=n,Ym="ph:show_survey_widget",Xm="PHWidgetSurveyClickListener";function ty(t,e){try{const i=t.getBoundingClientRect(),n=Jm.innerHeight,s=Jm.innerWidth;let r=i.left+i.width/2-e/2;r+e>s-20&&(r=s-e-20),20>r&&(r=20);const o=n-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?n-i.top+12+"px":"auto",zIndex:Gg.zIndex}}catch(t){return Ig.warn("Failed to calculate trigger position:",t),null}}var ey=class{constructor(t){this.bi=new Map,this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Set,this.Ci=null,this.Ii=!1,this.Mi=null,this.Ti=null,this.Ri=null,this.Ei=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(ft);if(t)for(const e of t)vm(e)&&em(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,a,l;if(!Rg(this._posthog))return;const{survey:u,language:c}=this.Ai(t);this.Ci=c,this.Ri=null,this.$i=e;const h=this.Oi(u,e);this.Pi(h.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Li(h,v,d,c);if(f&&!(null===(n=h.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Di(h);let p={};if((null===(s=h.appearance)||void 0===s?void 0:s.position)===bg.NextToTrigger&&(null===(r=h.appearance)||void 0===r?void 0:r.widgetSelector)){const t=Km.querySelector(h.appearance.widgetSelector);var g;t&&(p=ty(t,parseInt((null===(g=h.appearance)||void 0===g?void 0:g.maxWidth)||Gg.maxWidth))||{})}const m=(null===(o=h.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=Kg(h,this._posthog);this.Si.set(y,y.host);const b={posthog:this._posthog,survey:h,removeSurveyFromFocus:this.Fi,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:c};if(this.Ri=b,0>=m)return this.Ii=!0,Gp(ym(oy,ue({},b)),y);const _=()=>{this.Ii=!0;const{survey:i,language:n}=this.Ai(t);this.Ci=n;const s=this.Oi(i,e),r=ue(ue({},b),{},{survey:s,surveyLanguage:n});this.Ri=r,Gp(ym(oy,ue(ue({},r),{},{survey:ue(ue({},s),{},{appearance:ue(ue({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Rg(this._posthog)||!this.Ni(h))return Ig.info(`Survey ${h.id} no longer eligible when its display delay elapsed; not displaying`),this.Fi(h);_()},k=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,h.id):void 0,S=Pe(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=Jm.setTimeout(()=>{this.bi.delete(h.id),w()},x);this.bi.set(h.id,C)},this.qi=t=>{var e;const{survey:i,language:n}=this.Ai(t),{shadow:s,isNewlyCreated:r}=Kg(i,this._posthog);this.Si.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===yg.Tab&&this.ki.set(t.id,t),r&&Gp(ym(ly,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.ji=t=>{const e=this.wi.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(Xm),this.wi.delete(t),Ig.info(`Removed click listener for survey ${t}`))},this.Bi=t=>{this.zi(t)||(this.Hi(t),this.ji(t.id))},this.Ui=t=>{this.zi(t)||(this.Hi(t),this.ki.delete(t.id))},this.zi=t=>{try{var e;const i=Km.querySelector(pm(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Wi=(t,e)=>{const i=Km.querySelector(e),n=this.wi.get(t.id);if(i){if(this.qi(t),n){if(i===n.element)return;Ig.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.ji(t.id)}if(!i.hasAttribute(Xm)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===bg.NextToTrigger?ty(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||Gg.maxWidth)):{};Jm.dispatchEvent(new CustomEvent(Ym,{detail:{surveyId:t.id,position:s}}))};Hr(i,"click",e),i.setAttribute(Xm,"true"),this.wi.set(t.id,{element:i,listener:e,survey:t}),Ig.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.Bi(t)},this.renderPopover=t=>{if(!Rg(this._posthog))return;const{survey:e,language:i}=this.Ai(t),{shadow:n}=Kg(e,this._posthog);this.Si.set(n,n.host),Gp(ym(oy,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.Fi,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Rg(this._posthog))return;const{survey:s,language:r}=this.Ai(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Vi(s,r,i)),Gp(ym(oy,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Fi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.Ni(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Rg(this._posthog),i=t.filter(t=>e&&(t.type===wg.Popover||t.type===wg.Widget)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.bi.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Gi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===wg.Widget){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===yg.Tab)return o.add(t.id),void this.qi(t);(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)===yg.Selector&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Wi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Me(this.Qi)&&t.type===wg.Popover&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.wi.forEach(({survey:t})=>{r.has(t.id)||this.Bi(t)}),this.ki.forEach((t,e)=>{o.has(e)||this.Ui(t)})},t)},this.Di=t=>{Me(this.Qi)||Ig.error(`Survey ${this.Qi} already in focus. Cannot add survey ${t.id}.`),this.Qi=t.id},this.Fi=t=>{this.Qi!==t.id&&Ig.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Pi(t.id),this.Qi=null,this.Ci=null,this.Ii=!1,this.Ri=null,this.$i=void 0,this.Hi(t)},this._posthog=t,this.Qi=null,this.Mi=()=>this.Zi(),Hr(Jm,"languagechange",this.Mi),this.Ti=t.onFeatureFlags(()=>this.Zi())}Zi(){if(Me(this.Qi))return;const t=this._posthog.get_property(ft),e=null==t?void 0:t.find(t=>t.id===this.Qi);if(!e)return;const{survey:i,language:n}=this.Ai(e);if(n===this.Ci)return;if(this.Ci=n,!this.Ii)return;const s=this.Oi(i,this.$i),{shadow:r}=Kg(s,this._posthog);Gp(ym(oy,ue(ue({},this.Ri),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.Fi,surveyLanguage:n})),r)}get Ji(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Oi(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?ue(ue({},t),{},{appearance:ue(ue(ue({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Pi(t){const e=this.bi.get(t);e&&(clearTimeout(e),this.bi.delete(t))}cancelSurvey(t){this.bi.has(t)&&(Ig.info(`Cancelled pending survey ${t}`),this.Pi(t),this.Qi===t&&(this.Qi=null,this.Ci=null,this.Ii=!1,this.Ri=null,this.$i=void 0))}clearInMemoryInProgressSurveyState(){(()=>{for(const t of Object.keys(cm))delete cm[t]})()}setAutomaticDisplayDispose(t){this.Ki=t}dispose(){var t;null===(t=this.Ki)||void 0===t||t.call(this),this.Ki=void 0,this.Mi&&(Jm.removeEventListener("languagechange",this.Mi),this.Mi=null),this.Ti&&(this.Ti(),this.Ti=null),this.bi.forEach((t,e)=>this.Pi(e)),this.wi.forEach((t,e)=>this.ji(e)),this.Si.forEach((t,e)=>{Gp(null,e),null==t||t.remove()}),this.Si.clear(),this.ki.clear(),this.Qi=null}Gi(t){return t.sort((t,e)=>{var i,n;const s=vm(t),r=vm(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===xg.Always,a=e.schedule===xg.Always;return o&&!a?1:!o&&a?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Ai(t){return Zm(t,this._posthog)}Vi(t,e,i){if(this.xi.has(t.id))return!1;const{params:n}=function(){const t={};let e=!1;const i=Jm.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:e};const n=i.split("&");for(const i of n){const n=i.indexOf("=");if(0>=n)continue;let s,r;try{s=decodeURIComponent(i.slice(0,n)),r=decodeURIComponent(i.slice(n+1))}catch(t){continue}if("auto_submit"===s&&"true"===r){e=!0;continue}const o=s.match(/^q(\d+)$/);if(o){const e=parseInt(o[1],10);t[e]||(t[e]=[]),t[e].push(r)}}return{params:t,autoSubmit:e}}();if(0===Object.keys(n).length)return!1;Ig.info("[Survey Prefill] Detected URL prefill parameters");const s=this.Xi(t,n,e);return!!s&&(this.Yi(t,s,i,e),this.xi.add(t.id),s.isSurveyCompleted)}Yi(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=e;(Object.keys(a).length>0&&t.enable_partial_responses||o)&&Yg({responses:o?s:a,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Li(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=Se(i)?i.map(String):[String(i)];Ig.info("[Survey] Processing initial responses");const r=this.Xi(t,s,n);return!!r&&(this.Yi(t,r,i,n),r.isSurveyCompleted)}Xi(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=Ql(t.id);try{switch(t.type){case kg.SingleChoice:{if(!t.choices||0===t.choices.length)return void Ar.warn(`[Survey Prefill] Question ${n} has no choices`);const e=parseInt(s[0],10);if(isNaN(e)||0>e||e>=t.choices.length)return void Ar.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case kg.MultipleChoice:{if(!t.choices||0===t.choices.length)return void Ar.warn(`[Survey Prefill] Question ${n} has no choices`);const e=s.map(t=>parseInt(t,10)).filter(e=>!isNaN(e)&&e>=0&&t.choices.length>e);if(0===e.length)return void Ar.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Ar.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case kg.Rating:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Ar.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Ar.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Ar.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Ig.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Sl(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let a=0;for(;t.questions.length>n&&o>a&&(a++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=Ql(e.id);Te(i[t])||(s[t]=i[t])}r.push(n);const o=Gm(t,n,e.id?i[Ql(e.id)]:null);if(o===Sg.End)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),l=r>=t.questions.length;return hm(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:im(t.questions),visitedIndices:a,surveyLanguage:i}),Ig.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(t){return Ig.error("[Survey Prefill] Error handling prefill:",t),null}}tr(t,e=void 0){if(!t)return!0;const i=this.Ji,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.er(t),r}er(t){var e;!this.Ei&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ei=!0,Ig.warn(`Survey feature flag "${t}" 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.`))}nr(e){return!e.conditions||lm(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const a=Ki(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return lu[null!=n?n:"icontains"](e,[a])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==Wg?void 0:Wg.querySelector(t.conditions.selector))}(e)}ir(t){var e;return sm(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Ji)||void 0===e?void 0:e.hasLoadedFlags)?(this.er(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.tr(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Pg(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!Lg.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.tr(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.tr(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.ir(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Ml.Ot("lastSeenSurveyDate"))?(t=>!!Ml.Ot(Fg(t))&&!sm(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.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",n)}checkSurveyCaptureEligibility(){return Rg(this._posthog)?{eligible:!0}:{eligible:!1,reason:Mg}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.rr(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}rr(t){var e;if(!su(t)&&!Ag(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}sr(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.tr(e))}Ni(t){return this.checkSurveyEligibility(t).eligible&&this.nr(t)&&this.rr(t)&&this.sr(t)}Hi(t){try{const e=Km.querySelector(pm(t,!0));(null==e?void 0:e.shadowRoot)&&(Gp(null,e.shadowRoot),this.Si.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Ig.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Di,removeSurveyFromFocus:this.Fi,surveyInFocus:this.Qi,surveyTimeouts:this.bi,handleWidget:this.qi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Wi,sortSurveysByAppearanceDelay:this.Gi,checkFlags:this.sr.bind(this),isSurveyFeatureFlagEnabled:this.tr.bind(this),onLanguageChange:this.Zi.bind(this),currentLanguage:this.Ci,surveyIsRendered:this.Ii}}};function iy(t,e){if(!Km||!Jm)return;const i=new ey(t);if(t.config.disable_surveys_automatic_display)return Ig.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Ig.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Te(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Te(n)||(clearInterval(n),n=void 0)};s();const o=()=>{Km.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return Hr(Km,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Km.removeEventListener("visibilitychange",o)}),i}function ny({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){rg(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===wg.Widget,o=lm(t,s),a=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===yg.Tab&&r;if(!o)return Ig.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);a&&(Ig.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};Hr(Jm,"popstate",o),Hr(Jm,"hashchange",o);const a=Jm.history.pushState,l=Jm.history.replaceState;return Jm.history.pushState=function(...t){a.apply(this,t),o()},Jm.history.replaceState=function(...t){l.apply(this,t),o()},()=>{Jm.removeEventListener("popstate",o),Jm.removeEventListener("hashchange",o),Jm.history.pushState=a,Jm.history.replaceState=l}},[n,t,e,i,s])}const sy=200;function ry(t=_g.Right){switch(t){case _g.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case _g.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case _g.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function oy({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:c=()=>{},properties:h,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,C,T;const E=og(null),I=Number.isInteger(s),{isPopupVisible:M,isSurveySent:R,hidePopupWithAnimation:P}=function(t,e,i,n,s,r,o,a,l){const[u,c]=sg(n||0===i||t.type===wg.ExternalSurvey),[h,d]=sg(!1),v=og(!1),f=()=>{const e=()=>{r&&s(t),c(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${sy}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return rg(()=>{if(!e)return void Ig.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(lm(t,e)){c(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}var i;Jm.dispatchEvent(new Event("PHSurveyShown")),a||e.capture($g.SHOWN,ue(ue({[Cg.SURVEY_NAME]:t.name,[Cg.SURVEY_ID]:t.id,[Cg.SURVEY_ITERATION]:t.current_iteration,[Cg.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date},l&&{[Cg.SURVEY_LANGUAGE]:l}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}))}};Hr(Jm,"PHSurveyClosed",p),Hr(Jm,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Te(u)&&o(),()=>{Te(u)||clearTimeout(u),Te(s)||clearTimeout(s),Jm.removeEventListener("PHSurveyClosed",p),Jm.removeEventListener("PHSurveySent",r)}},[]),ny({survey:t,removeSurveyFromFocus:s,setSurveyVisible:c,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:h,setIsPopupVisible:c,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,I,r,o,E,v,f),A=R||s===t.questions.length||!0===d,[O,F]=sg(!1),D=ag(()=>!!dm(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=I?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!O&&!D,q=ag(()=>{const e=dm(t),n=(null==e?void 0:e.surveySubmissionId)||Sl();return{isPreviewMode:I,previewPageIndex:s,onPopupSurveyDismissed(){f?tm(t,i,I,f):tm(t,i,I),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:h,surveyLanguage:f}},[I,s,o,i,t,u,a,l,h,f]);return M?ym(rm.Provider,{value:q,children:ym("div",{className:"ph-survey",style:ue(ue({},gm(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:E,children:A?ym(Am,{header:(null===(w=t.appearance)||void 0===w?void 0:w.thankYouMessageHeader)||"Thank you!",description:(null===(k=t.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!e,contentType:null===(S=t.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:t.appearance||Gg,onClose(){P(),c()}}):N?ym(Om,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||Gg,onStart:()=>F(!0)}):ym(ay,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function ay({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=ag(()=>{const e=dm(t);if(!e)return null;const i=Pe(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(fm(t),null)},[t]),[o,a]=sg(()=>((null==r?void 0:r.responses)&&Ig.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,u]=sg(!1),{previewPageIndex:c,onPopupSurveyDismissed:h,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=lg(rm),[b,_]=sg(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Pe(e)&&e>=0&&t.questions.length>e?e:0;return Pe(c)&&c>=0?c:i}),[w,k]=sg(()=>{var e;return(null!==(e=null==r?void 0:r.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&t.questions.length>e)}),[S,x]=sg(()=>{var e;const i=dm(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=ag(()=>im(nm(t,r)),[t.id,r]),T=ag(()=>{if(!C||new Set(C).size!==C.length)return nm(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);rg(()=>{!g||Te(c)||0>c||_(c)},[c,g]);const E=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=c?c:0)>0:w.length>0),I=T.at(b);return I?ym("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&ym(Rm,{onClick(){h()}}),ym("div",{className:"survey-box","data-question-index":b,children:[l&&ym("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),uy({question:I,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||Gg,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Ig.error("onNextButtonClick called without a PostHog instance.");if(!Rg(i))return void u(!0);if(u(!1),!s)return void Ig.error("onNextButtonClick called without a questionId.");const{responses:r,questionSnapshots:l}=function({responses:t,questionSnapshots:e={}},i,n,s){return{responses:ue(ue({},t),{},{[Ql(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?ue(ue({},e),{},{[s.id]:s.question}):e}}({responses:o,questionSnapshots:S},s,e,T[n]);a(r),x(l);const c=Gm(t,n,e),h=c===Sg.End,d=[...w,n];if(h||(k(d),_(c),hm(t,{surveySubmissionId:p,responses:r,lastQuestionIndex:c,questionOrder:im(T),visitedIndices:d,surveyLanguage:y,questionSnapshots:l})),t.enable_partial_responses||h){const e=new Set(d.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>Ql(t))),n=Object.fromEntries(Object.entries(r).filter(([t])=>e.has(t)));Yg({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:h,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:l})}})({res:e,displayQuestionIndex:b,questionId:I.id}),onPreviewSubmit:v,initialValue:I.id?o[Ql(I.id)]:void 0,canGoBack:E,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),_(e),hm(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:im(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function ly({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,a,l,u,c,h;const[d,v]=sg(!0),[f,p]=sg(!1),[g,m]=sg({}),y=og(void 0),b=()=>{(f||!i||n||Rg(i))&&p(!f)};if(rg(()=>{var e;if(!i)return void Ig.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Ig.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),b())};return Hr(Jm,Ym,s),()=>{Te(y.current)||(clearTimeout(y.current),y.current=void 0),Jm.removeEventListener(Ym,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=t.appearance)||void 0===a?void 0:a.borderColor]),ny({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const _=()=>{t.schedule!==xg.Always&&v(!1),Te(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return ym(Tp,{children:["tab"===(null===(l=t.appearance)||void 0===l?void 0:l.widgetType)&&ym("button",{className:"ph-survey-widget-tab "+((null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)===_g.Top?"widget-tab-top":""),onClick:b,disabled:n,style:ry(null===(c=t.appearance)||void 0===c?void 0:c.tabPosition),children:(null===(h=t.appearance)||void 0===h?void 0:h.widgetLabel)||""}),f&&ym(oy,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:_,onCloseConfirmationMessage:_,surveyLanguage:s})]})}const uy=({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const u={forceDisableHtml:e,appearance:n,onPreviewSubmit(t){r(t)},onSubmit(t){s(t)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(t.type){case kg.Open:return $p(Dm,ue(ue({},u),{},{question:t,key:t.id}));case kg.Link:return $p(Lm,ue(ue({},u),{},{question:t,key:t.id}));case kg.Rating:return $p(Nm,ue(ue({},u),{},{question:t,key:t.id}));case kg.SingleChoice:case kg.MultipleChoice:return $p(jm,ue(ue({},u),{},{question:t,key:t.id}));default:return Ig.error(`Unsupported question type: ${t.type}`),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=iy,h.extendPostHogWithSurveys=iy;const cy=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},hy=1e4,dy=(t,e,i)=>i.remaining>0?e.length>i.remaining?(t.push(e.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(t.push(e),i.remaining-=e.length,!0):(i.truncated=!0,!1),vy=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return dy(e,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(t.length,i.remaining-2);for(;r>s;){const e=Math.ceil((s+r)/2);JSON.stringify(t.slice(0,e)).length>i.remaining?r=e-1:s=e}return dy(e,JSON.stringify(t.slice(0,s)),i)},fy=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,py=(t,e,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(e).length+t.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[t]=e}},gy=(t,e,i)=>{if(!i.truncated)if($e(t)){if(i.seen.has(t))return void py(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(gy(t[n],e?`${e}.${n}`:n,i),i.truncated)break}catch(t){continue}}catch(t){}}else py(e,t,i)},my=(t,e,i,n,s=!1,r)=>{if(!fy(t))return!s||dy(e,"null",i);if(Me(t)||(t=>{try{return Pe(t)||Oe(t)}catch(t){return!1}})(t))return dy(e,JSON.stringify(t),i);if("string"==typeof t)return vy(t,e,i);if(!$e(t)&&!Se(t))return dy(e,JSON.stringify(t),i);if(n.has(t))return vy("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(xe(r))return my(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return vy(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return dy(e,JSON.stringify(t.valueOf()),i)}catch(t){}if(t instanceof Error){const o={};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(o[e]=t[e])}catch(t){}try{o.name=t.name}catch(t){}try{o.message=t.message}catch(t){}try{o.stack=t.stack}catch(t){}return my(o,e,i,n,s,r)}if(Se(t)){if(!dy(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!dy(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!my(r,e,i,n,!0))return!1}return dy(e,"]",i)}if(!dy(e,"{",i))return!1;let o=!0;try{for(const s in t){if(!{}.hasOwnProperty.call(t,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=t[s]}catch(t){continue}if(r)try{gy(a,s,r)}catch(t){}if(!fy(a))continue;const l=`${o?"":","}${JSON.stringify(s)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,c=i.remaining,h=i.truncated;if(!dy(e,l,i))return!1;const d=e.length,v=my(a,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=c,i.truncated=v?h:f,!v)return!1}}catch(t){}return dy(e,"}",i)},yy=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=$e(t[0])?{result:{},keysRemaining:50,sizeRemaining:hy,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||dy(i," ",n))&&my(t[e],i,n,new WeakSet,!1,0===e?s:void 0);e++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},by={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},_y=t=>"canCapture"in t,wy=t=>({console:h.console,hostname:h.location.host,getCapturingLogs(){let e;return e=_y(t)?t.canCapture?t.getExtension(Bg):void 0:(xe(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing())?t.logs:void 0,e?{captureConsoleLog:i=>((t,e,i)=>{if(_y(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;n?xe(s)&&s.call(e,i):xe(e.captureConsoleLog)&&e.captureConsoleLog(i)})(t,e,i),captureBufferedConsoleLog(t,i,n){var s;return null===(s=e.captureBufferedConsoleLog)||void 0===s?void 0:s.call(e,t,i,n)}}:void 0}});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs:t=>(t=>{const e=t.console;let i=t;const n=[],s={host:t.hostname};let r=!1;const o=()=>{i=void 0;for(const t of n)try{t()}catch(t){}};try{for(const t of Object.keys(by)){const o=n=>(...o)=>{let a=!1;try{if(o.length>0&&!r&&i){const e=i.getCapturingLogs();if(e){r=!0,a=!0;const{body:i,truncated:n,attributes:l}=yy(o,hy),u=ue(ue({},s),n?{body_truncated:"true"}:{}),c={level:by[t],body:i,attributes:ue(ue({"log.source":`console.${t}`},u),l)};e.captureConsoleLog(c)}}}catch(t){}finally{a&&(r=!1),n.apply(e,o)}},a=e[t];n.push(Sf(e,t,t=>{const e=o(t);return e.__rrweb_original__=cy(a),e}))}}catch(t){throw o(),t}return o})(wy(t)),replayConsoleBuffer:(t,e)=>((t,e)=>{const i=t.getCapturingLogs();if(i)for(const s of e)try{var n;const{body:e,truncated:r,attributes:o}=yy(s.args,hy);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:by[s.level],body:e,attributes:ue(ue({"log.source":`console.${s.level}`,host:t.hostname},r?{body_truncated:"true"}:{}),o)},s.context,s.occurredAtMs)}catch(t){}})(wy(t),e)};const ky=t=>je(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Sy=Or("[Error tracking]"),xy="webkit-masked-url:",$y=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Cy=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",xy],Ty=["__firefox__","__gCrWeb"];function Ey(){return new wn([new zn,new Yn,new Hn,new Un,new Jn,new Zn,new Vn,new Kn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),a=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=On.test(n)?n.replace(On,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=Dn(s);if(t){for(let e=a.length-1;e>=0;e--){const i=a[e];if(t.start>=i.start+i.length)break;a.pop()}a.push(t)}break}}if(jn(s,a)>=50)break}}const l=[...a].sort((t,e)=>e.start-t.start),u=l[l.length-1];if(u){const t=Nn(s,u);s.splice(u.start-t,t);for(const e of l)e.start-=t}for(const t of l)Ln(s,t);return a.some(t=>0===t.start&&s.length===t.length)&&function(t){const e=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let i=0;for(let t=1;e.length>t;t++)Bn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return ue(ue({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",Mn,An))}const Iy=Or("[ExceptionAutocapture]"),My=Ey(),Ry=(t,e)=>{try{return t()}catch(t){return e}},Py=(t,e)=>Ry(()=>t(e()),void 0),Ay=t=>Ry(()=>xe(t)&&xe(t.call),!1),Oy=(t,e)=>Ry(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),Fy=(t,e,i)=>{Ry(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Ry(()=>{t[e]=i},void 0)},Dy=e=>{const i=t;i||Iy.info("window not available, cannot wrap onerror");const n=Ry(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Py(e,()=>My.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if(Ee(t)&&Ee(e)&&e.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:e,lineno:i,colno:n})}catch(e){return t}return t})(t),{mechanism:{handled:!1}})),!!Ay(n)&&null!==(i=n(...t))&&void 0!==i&&i},Oy(i,"onerror"),()=>Fy(i,"onerror",n)},Ly=(e,i=!1)=>{const n=t;n||Iy.info("window not available, cannot wrap onUnhandledRejection");const s=Ry(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Py(e,()=>My.buildFromUnknown(t,{mechanism:{handled:!1}})),Ay(s)?null!==(n=s(t))&&void 0!==n&&n:i},Oy(n,"onunhandledrejection"),()=>Fy(n,"onunhandledrejection",s)},Ny={wrapOnError:Dy,wrapUnhandledRejection:Ly,wrapConsoleError(t){const e=console;e||Iy.info("console not available, cannot wrap console.error");const i=Ry(()=>e.error,void 0);return e.error=function(...e){Ry(()=>e.length>1&&Ee(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Py(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return My.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Ay(i)&&i(...e)},Oy(e,"error"),()=>Fy(e,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=Ny,h.posthogErrorWrappingFunctions=Ny;const qy=(t,e)=>{if(!xe(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Me(i)&&"object"==typeof i&&Se(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Iy.error("Ignoring invalid legacy exception exclusion rule",e,t)}return t},[]):[],s=e=>{try{var i;null===(i=t.capture)||void 0===i||i.call(t,"$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(t){Iy.error("Failed to capture exception for a legacy client",t)}};Dy(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),Ly(s,!0)};h.extendPostHogWithExceptionAutoCapture=qy,h.extendPostHogWithExceptionAutocapture=qy;const jy="X-POSTHOG-SESSION-ID",By="X-POSTHOG-WINDOW-ID",zy="X-POSTHOG-DISTINCT-ID",Uy=[jy,By,zy],Hy=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Wy=(t,e)=>({}.hasOwnProperty.call(t,e)),Vy=t=>"object"==typeof t&&!Me(t)||xe(t),Gy=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),Qy=e=>{try{var i;return Gy(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==t||null===(i=t.location)||void 0===i?void 0:i.href).toString()}catch(t){return}},Zy=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(Se(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(jy,t),s.set(By,e),o=!0}const a=(t=>xe(t)?t():t)(e);return a&&"$posthog_cookieless"!==a&&(s.set(zy,a),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const Jy={_patchFetch:(e,i,n)=>Sf(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let a=o;try{const t=Qy(s);if(t)if(Gy(s)){const t=new Request(s,r);Zy(e,i,n,t.url,t.headers),a=[t]}else{const o=new Headers(Vy(r)?r.headers:void 0);if(Zy(e,i,n,t,o)){const t=((t,e)=>{if(Te(t)||Me(t))return{headers:e};if(!Vy(t))return;const i=t;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const t=Object.create(i);return Object.defineProperty(t,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),t}return new Proxy({headers:e},{get:(t,e)=>Wy(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>Wy(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),Hy.forEach(t=>{t in i&&e.add(t)}),Array.from(e)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;if("string"==typeof e&&Hy.includes(e)&&e in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,e,i)}};const s=Reflect.getOwnPropertyDescriptor(i,e);return s?ue(ue({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(a=[s,t])}}}catch(t){a=o}return t.apply(this,a)}),_patchXHR:(e,i,n)=>Sf(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,a,l){const u=this,c=new Headers,h=Qy(r);h&&Zy(e,i,n,h,c);const d=t.call(u,s,r,o,a,l);return Uy.forEach(t=>{const e=c.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};h.__PosthogExtensions__.tracingHeadersPatchFns=Jy,h.postHogTracingHeadersPatchFns=Jy,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(t){const e=this.length;let i=Math.trunc(t)||0;return 0>i&&(i+=e),0>i||i>=e?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(t,e){for(let i=this.length-1;i>=0;i--){const n=this[i];if(t.call(e,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var Ky=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(t){var e;if(t.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Yy=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Xy=t=>{if("loading"===document.readyState)return"loading";const e=Yy();if(e){if(e.domInteractive>t)return"loading";if(0===e.domContentLoadedEventStart||e.domContentLoadedEventStart>t)return"dom-interactive";if(0===e.domComplete||e.domComplete>t)return"dom-content-loaded"}return"complete"},tb=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},eb=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[tb(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(e.length+s.length>99)return e||s;if(e=e?s+">"+e:s,n.id)break;t=n.parentNode}}catch(t){}return e},ib=new WeakMap;function nb(t,e){let i=ib.get(e);return i||(i=new WeakMap,ib.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let sb=-1;const rb=()=>sb,ob=t=>{addEventListener("pageshow",e=>{e.persisted&&(sb=e.timeStamp,t(e))},!0)},ab=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},lb=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},ub=()=>{var t,e;return null!==(t=null===(e=Yy())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let cb=-1;const hb=new Set,db=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,vb=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of hb)t();isFinite(cb)||(cb="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",vb,!0))}},fb=(t=!1)=>{if(t&&(cb=1/0),0>cb){var e;const t=ub(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;cb=null!=i?i:db(),addEventListener("visibilitychange",vb,!0),addEventListener("prerenderingchange",vb,!0),ob(()=>{setTimeout(()=>{cb=db()})})}return{get firstHiddenTime(){return cb},onHidden(t){hb.add(t)}}},pb=(t,e=-1,i,n=0,s,r,o)=>{const a=Yy(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>rb()?a&&(document.prerendering||ub()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},gb=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},mb=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},yb=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},bb=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var _b=class{constructor(){this.u=void 0}};const wb=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},kb=[1800,3e3],Sb=(t,e={})=>{const i=mb(e);wb(()=>{const n=nb(e,_b),s=fb();let r,o=pb("FCP");const a=gb(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-ub(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=ab(t,o,kb,e.reportAllChanges),ob(i=>{o=pb("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,rb()),r=ab(t,o,kb,e.reportAllChanges),lb(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&gb(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&yb(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=pb("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=ab(t,o,kb,e.reportAllChanges),r(!0)})},e)})},xb=[.1,.25],$b=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],Cb=(t,e={})=>{const i=nb(e=Object.assign({},e),Ky),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=$b(t.sources),o=null==i?void 0:i.node;if(o){var s,r;const t=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,o))&&void 0!==s?s:eb(o);n.set(i,t)}}},((t,e={})=>{const i=fb();Sb(bb(()=>{let n,s=pb("CLS",0);const r=nb(e,Ky),o=(i,o,a,l,u)=>{s=pb("CLS",0,i,o,a,l,u),r.o=0,n=ab(t,s,xb,e.reportAllChanges)},a=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):l(e);a()},c=["layout-shift"];mb(e)&&c.push("soft-navigation");const h=gb(c,u);h&&(n=ab(t,s,xb,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),ob(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,rb()),lb(n)}),setTimeout(n))}))})(e=>{t((t=>{let e={};if(t.entries.length){var i;const s=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const t=$b(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:Xy(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},Tb=(t,e={})=>{const i=nb(e=Object.assign({},e),_b);mb(e)&&(i.u=new Map),Sb(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:Xy(rb())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=Yy(),n=t.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));e={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:Xy(t.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(t.navigationId);s&&(e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:"complete",navigationEntry:s})}return Object.assign(t,{attribution:e})})(e))},e)};let Eb=0,Ib=1/0,Mb=0;const Rb=t=>{for(const e of t)e.interactionId&&(Ib=Math.min(Ib,e.interactionId),Mb=Math.max(Mb,e.interactionId),Eb=Mb?(Mb-Ib)/7+1:0)};let Pb;const Ab=()=>{var t;return Pb?Eb:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Ob=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Ab()-this.h}D(){this.h=Ab(),this.v.length=0,this.p.clear()}S(t){const e=this.T(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{k:8,id:-1,entries:[]}}l(t){var e;if(null===(e=this.m)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.p.get(t.interactionId);if(n||10>this.v.length||t.duration>i.k){var s;if(n?t.duration>n.k?(n.entries=[t],n.k=t.duration):t.duration===n.k&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],k:t.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.p.delete(e.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const Fb=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=bb(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},Db=[200,500],Lb=(t,e={})=>{const i=nb(e=Object.assign({},e),Ob);let n=[],s=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const u=()=>{l||(Fb(c),l=!0)},c=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const a=new Set;for(const t of s){const e=h(t.startTime,t.processingEnd);for(const t of e)a.add(t)}n=n.filter(t=>t.startTime>r||a.has(t)),l=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!a.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:eb(o);a.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&a.set(t,e)}}};const h=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};gb(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=fb();wb(()=>{var n;"interactionCount"in performance||Pb||(Pb=gb(["event"],Rb,{durationThreshold:0}));let s,r=pb("INP");const o=nb(e,Ob),a=(i,n,a,l,u)=>{o.D(),r=pb("INP",-1,i,n,a,l,u),s=ab(t,r,Db,e.reportAllChanges)},l=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},c=(t,e=!1)=>{Fb(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);l(),e&&s(!0)})},h=["event","first-input"];mb(e)&&h.push("soft-navigation");const d=gb(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=ab(t,r,Db,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),ob(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,rb())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:Xy(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),l=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),c=h(e.startTime,l),d=i.p.get(e.interactionId),v={interactionTarget:a.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:c,inputDelay:s-e.startTime,processingDuration:l-s,presentationDelay:r-l,loadState:Xy(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,a,l=0,u=0,c=0,h=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),c=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;l+=n-c,u+=c,n>h&&(a=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,h=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(c=n-v),o&&a&&(t.longestScript={entry:o,subpart:a,intersectingDuration:h}),t.totalScriptDuration=l,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=c,t.totalUnattributedDuration=n-i-l-u-c})(v),Object.assign(t,{attribution:v})})(e))},e)};var Nb=class{constructor(){this.m=void 0,this.u=void 0}l(t){var e;null===(e=this.m)||void 0===e||e.call(this,t)}};const $=[2500,4e3];let qb=50;const jb=[];gb(["resource"],t=>{for(const e of t)jb.push(e),jb.length>qb&&jb.shift()});const Bb=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(qb=e.resourceBufferSize);const i=nb(e,Nb),n=new WeakMap;mb(e)&&(i.u=new Map),i.m=t=>{const i=t.element;if(i){var s,r;const o=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,i))&&void 0!==s?s:eb(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=mb(e);wb(()=>{let s,r=fb(),o=pb("LCP");const a=nb(e,Nb),l=(n,a,l,u,c)=>{o=pb("LCP",-1,n,a,l,u,c),s=ab(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=fb(!0))},u=t=>{var e;a.u&&t.navigationId&&yb(a.u,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-ub(),0),a.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=gb(h,c);if(d){s=ab(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;Fb(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});ob(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,rb()),s=ab(t,o,$,e.reportAllChanges),lb(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var s,r,o;const a=t.entries.at(-1),l=a.url&&(jb.findLast(t=>t.name===a.url)||performance.getEntriesByType("resource").findLast(t=>t.name===a.url));let u;e.target=n.get(a),e.lcpEntry=a,a.url&&(e.url=a.url),l&&(e.lcpResourceEntry=l);let c=0,h=0;if("soft-navigation"!==t.navigationType?(u=Yy(),c=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,h=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(c=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,h-c),n=Math.max(i,l?(l.requestStart||l.startTime)-c:0),s=Math.min(t.value,Math.max(n,l?l.responseEnd-c:0));e=ue(ue({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let zb=-1;const Ub=()=>zb,Hb=t=>{addEventListener("pageshow",e=>{e.persisted&&(zb=e.timeStamp,t(e))},!0)},Wb=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},Vb=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Gb=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Qb=()=>{var t,e;return null!==(t=null===(e=Gb())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let Zb=-1;const Jb=new Set,Kb=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Yb=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Jb)t();isFinite(Zb)||(Zb="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Yb,!0))}},Xb=(t=!1)=>{if(t&&(Zb=1/0),0>Zb){var e;const t=Qb(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;Zb=null!=i?i:Kb(),addEventListener("visibilitychange",Yb,!0),addEventListener("prerenderingchange",Yb,!0),Hb(()=>{setTimeout(()=>{Zb=Kb()})})}return{get firstHiddenTime(){return Zb},onHidden(t){Jb.add(t)}}},t_=(t,e=-1,i,n=0,s,r,o)=>{const a=Gb(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>Ub()?a&&(document.prerendering||Qb()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},e_=new WeakMap;function i_(t,e){let i=e_.get(e);return i||(i=new WeakMap,e_.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var n_=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(t){var e;if(t.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const s_=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(ue({type:e,buffered:!0},i));return t}}catch(t){}},r_=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},o_=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},a_=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var l_=class{constructor(){this.l=void 0}};const u_=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},c_=[1800,3e3],h_=(t,e={})=>{const i=r_(e);u_(()=>{const n=i_(e,l_),s=Xb();let r,o=t_("FCP");const a=s_(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Qb(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=Wb(t,o,c_,e.reportAllChanges),Hb(i=>{o=t_("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ub()),r=Wb(t,o,c_,e.reportAllChanges),Vb(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&s_(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&o_(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=t_("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Wb(t,o,c_,e.reportAllChanges),r(!0)})},e)})},d_=[.1,.25],v_=(t,e={})=>{const i=Xb();h_(a_(()=>{let n,s=t_("CLS",0);const r=i_(e,n_),o=(i,o,a,l,u)=>{s=t_("CLS",0,i,o,a,l,u),r.i=0,n=Wb(t,s,d_,e.reportAllChanges)},a=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):l(e);a()},c=["layout-shift"];r_(e)&&c.push("soft-navigation");const h=s_(c,u);h&&(n=Wb(t,s,d_,e.reportAllChanges),i.onHidden(()=>{u(h.takeRecords()),n(!0)}),Hb(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Ub()),Vb(n)}),setTimeout(n))}))};let f_=0,p_=1/0,g_=0;const m_=t=>{for(const e of t)e.interactionId&&(p_=Math.min(p_,e.interactionId),g_=Math.max(g_,e.interactionId),f_=g_?(g_-p_)/7+1:0)};let y_;const b_=()=>{var t;return y_?f_:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var __=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return b_()-this.u}M(){this.u=b_(),this.v.length=0,this.m.clear()}L(t){const e=this._(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{P:8,id:-1,entries:[]}}h(t){var e;if(null===(e=this.p)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.m.get(t.interactionId);if(n||10>this.v.length||t.duration>i.P){var s;if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.P-t.P),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.m.delete(e.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const w_=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=a_(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},k_=[200,500],S_=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Xb();u_(()=>{var n;"interactionCount"in performance||y_||(y_=s_(["event"],m_,{durationThreshold:0}));let s,r=t_("INP");const o=i_(e,__),a=(i,n,a,l,u)=>{o.M(),r=t_("INP",-1,i,n,a,l,u),s=Wb(t,r,k_,e.reportAllChanges)},l=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},c=(t,e=!1)=>{w_(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);l(),e&&s(!0)})},h=["event","first-input"];r_(e)&&h.push("soft-navigation");const d=s_(h,c,ue(ue({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=Wb(t,r,k_,e.reportAllChanges),d&&(i.onHidden(()=>{c(d.takeRecords(),!0)}),Hb(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Ub())}))})};var x_=class{constructor(){this.p=void 0,this.l=void 0}h(t){var e;null===(e=this.p)||void 0===e||e.call(this,t)}};const $_=[2500,4e3],C_=(t,e={})=>{let i=!1;const n=r_(e);u_(()=>{let s,r=Xb(),o=t_("LCP");const a=i_(e,x_),l=(n,a,l,u,c)=>{o=t_("LCP",-1,n,a,l,u,c),s=Wb(t,o,$_,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Xb(!0))},u=t=>{var e;a.l&&t.navigationId&&o_(a.l,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&c([n])},c=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Qb(),0),a.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},h=["largest-contentful-paint"];n&&h.push("interaction-contentful-paint","soft-navigation");const d=s_(h,c);if(d){s=Wb(t,o,$_,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;w_(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});Hb(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Ub()),s=Wb(t,o,$_,e.reportAllChanges),Vb(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},T_={onLCP:Bb,onCLS:Cb,onFCP:Tb,onINP:Lb,withoutAttribution:{onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=T_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=T_,h.postHogWebVitalsCallbacks=T_;const E_={onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=E_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=E_,h.postHogWebVitalsCallbacks=E_,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>E_;const I_={onLCP:Bb,onCLS:Cb,onFCP:Tb,onINP:Lb,withoutAttribution:{onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=I_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=I_,h.postHogWebVitalsCallbacks=I_;const M_={onLCP:C_,onCLS:v_,onFCP:h_,onINP:S_};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=M_,h.__PosthogExtensions__.postHogWebVitalsCallbacks=M_,h.postHogWebVitalsCallbacks=M_,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>M_;var R_=class{constructor(t){this.disabled=!1===t;const e=$e(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const P_="$copy_autocapture",A_=Or("[AutoCapture]");function O_(t,e){return e.length>t?e.slice(0,t)+"...":e}function F_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!ro(e));return e}function D_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,u;if(!ro(e))return{props:{}};const c=[e],h=new Set([e]);let d=e;for(;d.parentNode&&!oo(d,"body")&&1e3>c.length;){if(lo(d.parentNode)){const t=d.parentNode.host;if(h.has(t))break;h.add(t),c.push(t),d=t;continue}if(!ro(d.parentNode))break;if(h.has(d.parentNode))break;h.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?c.findIndex(t=>oo(t,"button")||oo(t,"a")):-1;v>0&&(s=s||c.slice(0,v+1).some(t=>!Do(t)||Lo(t)));const f=[],p={};let g,m=!1,y=!1;if(Dr(c,t=>{const e=Do(t);if(oo(t,"a")&&!n&&!(null==r?void 0:r.includes("href"))){const i=t.getAttribute("href");m=!!(e&&i&&Wo(i))&&(a?cn(i):i)}ge(ho(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};go.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?O_(1024,Vo(t)):O_(1024,fo(t)));const a=ho(t);e||(null==n?void 0:n.includes("class"))||0>=a.length||(o.classes=a.filter(function(t){return""!==t})),Dr(t.attributes,function(i){var r;if((!Lo(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Wo(i.value)&&(!Ee(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=uo(t).join(" ")),o["attr__"+i.name]=O_(1024,"href"===i.name&&s?cn(t):t)}});let l=1,u=1,c=t;for(;c=F_(c);)l++,c.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,n,s,r,a)),Dr(function(t){if(!Do(t))return{};const e={};return Dr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&Wo(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=c[v],f.splice(0,v)),s||(f[0].$el_text=oo(e,"a")||oo(e,"button")?Vo(e):fo(e)),m){var b,_;f[0].attr__href=m;const e=null===(b=Kr(m))||void 0===b?void 0:b.host,i=null==t||null===(_=t.location)||void 0===_?void 0:_.host;e&&i&&e!==i&&(g=m)}return{props:Lr((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,Se(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=ue(ue(ue(ue({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Nr(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[Qo(t.toString())]=Qo(e.toString())),n+=":",n+=Nr(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Zo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Nr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(l=f[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var L_=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(t){var e;if(!Do(t))return!0;const i=null!==(e=this.mo().css_selector_ignorelist)&&void 0!==e?e:_o,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=ho(t);if(ge(e,"ph-no-capture")||ge(e,"ph-sensitive")||Lo(t)||i.some(e=>mo(t,e)))return!0;const r=s.parentNode;s=lo(r)?r.host:r&&ro(r)?r:null}return!1}yo(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.do();if("pointerdown"===t.type){this.do();const i=po(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&ro(i)&&(this.vo={target:i,excluded:this.po(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.bo)||void 0===e?void 0:e.distinctId}))}const i=this.vo;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.do():"pointerup"===t.type&&(i.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(t){var e;const i=this.vo;this.do();const s=po(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.bo)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(oo(s,"html")||oo(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.mo().css_selector_ignorelist)&&void 0!==r?r:_o;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=ho(e);return ge(i,"ph-no-capture")||ge(i,"ph-sensitive")||!Do(e)||Lo(e)||t.some(t=>mo(e,t))})?null:i.target}}constructor(t){this.wo=t,this.name=qg,this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new R_(this.Mr.rageclick),this.Io=null}setup(t){this.Mo(),this.bo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?e.dispose():(this.Eo=e,this.startIfEnabled())}dispose(){var t;this.To||(this.To=!0,this.bo=void 0,null===(t=this.Eo)||void 0===t||t.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var t,e;return this.mo(),this.Mr.url_allowlist=null===(t=this.Mr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Mr.url_ignorelist=null===(e=this.Mr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Mr}Ro(){if(!this.isBrowserSupported())return void A_.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Ao=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.do();if(0===e.type.indexOf("pointer"))return void this.yo(e);const t="click"===e.type?this._o(e):void 0;if(Me(t))return;this.Fo(e,"$autocapture",t)}catch(t){A_.error("Failed to capture event",t)}};if(Hr(t,"blur",e),Hr(n,"submit",e,{capture:!0}),Hr(n,"change",e,{capture:!0}),Hr(n,"click",e,{capture:!0}),Dr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Hr(n,t,e,{capture:!0})}),this.mo().capture_copied_text){const e=this.Oo=e=>{e=e||(null==t?void 0:t.event);try{this.Fo(e,P_)}catch(t){A_.error("Failed to capture clipboard event",t)}};Hr(n,"copy",e,{capture:!0}),Hr(n,"cut",e,{capture:!0}),Hr(n,"paste",e,{capture:!0})}}Po(){this.do(),this.Ao&&(null==t||t.removeEventListener("blur",this.Ao),Dr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Ao,!0)}),null==n||n.removeEventListener("submit",this.Ao,!0),null==n||n.removeEventListener("change",this.Ao,!0),null==n||n.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(null==n||n.removeEventListener("copy",this.Oo,!0),null==n||n.removeEventListener("cut",this.Oo,!0),null==n||n.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(t){if(this.To)return;if(this.xo=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.Co=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Oe(i)&&(null===(n=this.bo)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.So=i),this.startIfEnabled()}setElementSelectors(t,e=this){if(this.To)return;t.size?this.$o.set(e,new Set(t)):this.$o.delete(e);const i=new Set;this.$o.forEach(t=>{t.forEach(t=>i.add(t))}),this.Io=i}getElementSelectors(t,e){var i;const s=[];return null===(i=this.Io)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||ge(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.To)return!1;const i=null===(t=this.bo)||void 0===t?void 0:t.kv.get(j),n=this.So,s=this.mo();if(!s.remoteRequestsDisabled&&!this.xo)return!1;const r=s.remoteRequestsDisabled&&!this.xo;if(Me(n)&&!Oe(i)&&!r)return!1;const o=null!==(e=this.So)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Fo(e,i="$autocapture",n){if(!this.isEnabled)return void this.do();let s=n||po(e);ao(s)&&(s=s.parentNode||null);const r=this.Mo();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&Ao(s,r.rageclick)&&this.Fo(e,"$rageclick",n);const a=i===P_,l=a?ue(ue({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var a;if(!t||Oo(e))return!1;if((null==n?void 0:n.url_allowlist)&&!co(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&co(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:l,targetElementList:u}=Fo(e,s);if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Te(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,n))return!1;if(!yo(u,null==n?void 0:n.css_selector_allowlist))return!1;if(yo(u,null!==(a=null==n?void 0:n.css_selector_ignorelist)&&void 0!==a?a:_o))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const c=e.tagName.toLowerCase();switch(c){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&&(go.indexOf(c)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:a}=D_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(s,a);if(l&&l.length>0&&(n.$element_selectors=l),i===P_){const i=e.type||"clipboard";if("paste"!==i){var c,h;const e=null==t||null===(c=t.getSelection())||void 0===c?void 0:c.toString(),i=vo(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(h=null==e?void 0:e.length)&&void 0!==h?h:0}n.$copy_type=i}return null===(u=this.bo)||void 0===u||u.capture(i,n),!0}}isBrowserSupported(){return xe(null==n?void 0:n.querySelectorAll)}};const N_={};function q_(t,e){const i=po(t);return i?ue({node:i,originalEvent:t,timestamp:Date.now()},e):null}function j_(t){return!!hn(()=>ro(t))}function B_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function z_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const U_="canvas,video,audio,embed,object";function H_(t,e){return Pe(t)&&t>=e}function W_(t,e=1e3){return t>=0&&e>t?t:void 0}function V_(t,e,i=1e3){return Pe(e)?W_(t-e,i):void 0}var G_=class{ur(t){var e,i,n,s,r,o,a,l;const u=this.cr((null==t?void 0:t.__onCapture)||this.dr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==t?void 0:t.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.hr=new WeakSet,this.vr=!1,this.pr=[],this.mr=0,this.cr=t=>({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:t}),this.gr=()=>{clearTimeout(this.yr),this.yr=void 0,this.br=void 0},this.wr=t=>{if(this.kr(t),this.gr(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._r(i,e),this.br=e}},this.Sr=t=>{Me(t.relatedTarget)&&this.gr()},this.Cr=t=>{const e=this.br,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(j_(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.yr=h.setTimeout(this.gr,0)},this.Ir=t=>{this.kr(t);const e=t,i=q_(e,{type:"click"}),n=this.br;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Mr.selection_change_threshold_ms>0,this.gr()),Me(i)||this.Tr(i)||this.Rr(i),this.Er()},this.Ar=()=>{const t=Date.now();this.$r=t,t%50==0&&this.pr.forEach(e=>{Te(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Or=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.vr;this.vr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,a=o&&(ro(o)?o:o.parentElement),l=null==n?void 0:n.activeElement;let u=l;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const c=Po(po(t))||Po(null!=a?a:null)||Po(null!==(i=u)&&void 0!==i?i:null),h="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this.vr||c||h))return;const d=Date.now();this.Pr=d;const v=this.br;if(v&&(r||this.vr||c)){const e=po(t);let i;if(Po(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;Po(null!==(f=u)&&void 0!==f?f:null)||h?i=u:c&&(i=a)}const n=i?this.Lr(i,v):s&&(o||s.anchorNode)?this._r(s,v):r&&!this.vr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.pr.forEach(t=>{const e=d-t.timestamp;0>e||!Te(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.sn=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.gr();const t=Date.now();this.Dr=t,this.Fr("visibilityChangedDelayMs",t)},this.Nr=()=>{const t=Date.now();this.qr=t,this.Fr("focusChangedDelayMs",t)},this.jr=t=>{this.kr(t);const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.Br=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.zr=()=>{this.Br=void 0},this.Hr=t=>{var e;const i=this.Br;if(this.Br=void 0,Te(i)||this.mr>=this.Mr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,u=this.Mr.swipe_threshold_px;if(u*u>l)return;if([this.$r,this.Ur,this.Pr].some(t=>Pe(t)&&t>=i.timestamp))return;var c,h;if(this.Wr()&&(null!==(c=null==n||null===(h=n.elementsFromPoint)||void 0===h?void 0:h.call(n,i.x,i.y))&&void 0!==c?c:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,U_)}))return;const d=q_(s,{type:"swipe",swipeDirection:B_(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Me(d)||this.Tr(d)||this.Rr(d),this.Er()},this.Mr=this.ur(e),this._onCapture=this.Mr.__onCapture}start(t){this.Vr(),this.Gr(),this.Qr(),this.Zr(),this.Jr(),this.Kr(t),this.Mr.capture_dead_swipes&&this.Xr()}Kr(e){if(!this.Yr){const i=function(e){return function(e,i){const n=N_[e];if(n)return n;let s=i[e];if((t=>xe(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return N_[e]=s.bind(i);const r=i.document;if(r&&xe(r.createElement)){let t,n=!1;try{t=r.createElement("iframe"),t.hidden=!0,r.head.appendChild(t);const l=t.contentWindow;var o,a;l&&l[e]&&(s=l[e],"MutationObserver"===e&&function(t){return ge(t,"AppleWebKit")&&!ge(t,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){Ar.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}return s&&xe(s)?N_[e]=s.bind(i):s}("MutationObserver",e)}(h);this.Yr=new i(t=>{this.eo(t)}),this.no(e)}}no(t){t&&this.Yr&&(this.hr.has(t)||(this.Yr.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this.hr.add(t),this.io(t)))}io(t,e){var i,n;ro(t)&&t.shadowRoot&&this.no(t.shadowRoot);const s=null!==(i=null===(n=t.querySelectorAll)||void 0===n?void 0:n.call(t,"*"))&&void 0!==i?i:[];for(let t=0;s.length>t;t++)null==e||e.add(s[t]),this.no(s[t].shadowRoot)}kr(t){var e,i;const n=null!==(e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t))&&void 0!==e?e:[];for(let t=0;n.length>t;t++){const e=n[t];j_(e)&&this.no(e.shadowRoot)}}stop(){var t;null===(t=this.Yr)||void 0===t||t.disconnect(),this.Yr=void 0,this.hr=new WeakSet,h.removeEventListener("click",this.Ir,{capture:!0}),h.removeEventListener("mousedown",this.wr,{capture:!0}),h.removeEventListener("mouseup",this.Cr,{capture:!0}),h.removeEventListener("mouseout",this.Sr,{capture:!0}),h.removeEventListener("dragstart",this.gr,{capture:!0}),h.removeEventListener("pointercancel",this.gr,{capture:!0}),h.removeEventListener("blur",this.gr),this.gr(),h.removeEventListener("scroll",this.Ar,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Or),h.removeEventListener("touchstart",this.jr,{capture:!0}),h.removeEventListener("touchend",this.Hr,{capture:!0}),h.removeEventListener("touchcancel",this.zr,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.sn),h.removeEventListener("blur",this.Nr),h.removeEventListener("focus",this.Nr),this.Br=void 0}eo(t){const e=new Set;for(const n of t)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this.Ur=Date.now();const t=n.addedNodes;for(let i=0;t.length>i;i++){const n=t[i];j_(n)&&!e.has(n)&&this.io(n,e)}}catch(t){}}Vr(){Hr(h,"click",this.Ir,{capture:!0}),Hr(h,"mousedown",this.wr,{capture:!0}),Hr(h,"mouseup",this.Cr,{capture:!0}),Hr(h,"mouseout",this.Sr,{capture:!0}),Hr(h,"dragstart",this.gr,{capture:!0}),Hr(h,"pointercancel",this.gr,{capture:!0}),Hr(h,"blur",this.gr)}Rr(t){t.selectionChangedDelayMs=V_(t.timestamp,this.Pr,this.Mr.selection_change_threshold_ms),t.visibilityChangedDelayMs=V_(t.timestamp,this.Dr),t.focusChangedDelayMs=V_(t.timestamp,this.qr),this.pr.push(t)}Er(){this.pr.length&&Te(this.ro)&&(this.ro=h.setTimeout(()=>{this.oo()},1e3))}Gr(){Hr(h,"scroll",this.Ar,{capture:!0})}Qr(){var t;this.vr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),Hr(n,"selectionchange",this.Or)}Lr(t,e){const i=e.path[0];try{for(;t;){if(-1!==e.path.indexOf(t)||ro(i)&&i.contains(t))return!0;t=t.getRootNode().host}}catch(t){}return!1}_r(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0,s=!!n&&hn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&ro(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const t=ro(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this.Lr(t,e)}return this.Lr(t.focusNode,e)||this.Lr(t.anchorNode,e)}Zr(){Hr(n,"visibilitychange",this.sn)}Jr(){Hr(h,"blur",this.Nr),Hr(h,"focus",this.Nr)}Fr(t,e){this.pr.forEach(i=>{const n=W_(e-i.timestamp);Pe(n)&&(Te(i[t])||i[t]>n)&&(i[t]=n)})}Xr(){Hr(h,"touchstart",this.jr,{capture:!0,passive:!0}),Hr(h,"touchend",this.Hr,{capture:!0,passive:!0}),Hr(h,"touchcancel",this.zr,{capture:!0,passive:!0})}Wr(){const t=Te(this.so)||Pe(this.Ur)&&this.Ur>this.so;return(Te(this.ao)||t)&&(this.so=Date.now(),this.ao=!!(null==n?void 0:n.querySelector(U_))),!!this.ao}Tr(t){return!t||("swipe"===t.type?this.lo(t):this.uo(t))}lo(e){return!(!so(e.node)&&!this.pr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!oo(e.node,"html")&&ro(e.node)&&function(e,i){var n;if(!t||Oo(e))return!1;const s=Oe(i)?Io:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Io,{targetElementList:r}=Fo(e,!1);return!yo(r,s)}(e.node,{css_selector_ignorelist:this.Mr.css_selector_ignorelist}))}uo(e){return!(this.Mr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.lo(e)||function(e){if(!t||Oo(e))return!1;const{targetElementList:i}=Fo(e,!1);return i.some(t=>oo(t,"a"))}(e.node);var i}oo(){if(!this.pr.length)return;clearTimeout(this.ro),this.ro=void 0;const t=this.pr;this.pr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Ur&&this.Ur>=i.timestamp?this.Ur-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=H_(i.scrollDelayMs,this.Mr.scroll_threshold_ms),n=H_(i.selectionChangedDelayMs,this.Mr.selection_change_threshold_ms),s=H_(i.mutationDelayMs,this.Mr.mutation_threshold_ms),r=H_(i.absoluteDelayMs,1.1*this.Mr.mutation_threshold_ms),o=Pe(i.scrollDelayMs)&&this.Mr.scroll_threshold_ms>i.scrollDelayMs,a=Pe(i.mutationDelayMs)&&this.Mr.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Pe(i.selectionChangedDelayMs)&&this.Mr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Pe(i.visibilityChangedDelayMs),c=Pe(i.focusChangedDelayMs);if(!(o||a||l||u||c))if(t||s||r||n){const e=z_(i);if("$dead_swipe"===e){if(this.mr>=this.Mr.max_dead_swipes_per_page_load)continue;this.mr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Ur,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Mr.mutation_threshold_ms>i.absoluteDelayMs&&this.pr.push(i)}this.Er()}dr(t,e){const i=z_(t);this.instance.capture(i,ue(ue(ue({},e),D_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Mr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new G_(t,e);const Q_=Or("[ExternalScriptsLoader]"),Z_=t=>{const e=null==n?void 0:n.querySelectorAll("script");if(e)for(let i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},J_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Q_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=Z_(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(Z_(e))return J_(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},K_={},Y_=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void J_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=K_[s];if("fallback"===n&&r){if(Z_(r))return void J_(t,r,i);delete K_[s]}return void J_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=Y_(t,e);K_[s]=n;const r=Z_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),J_(t,n,i)}else i(void 0,r)}:i)}J_(t,Y_(t,e),i)},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);J_(t,n,i)};var X_=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.No.$t(this.qo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get Lo(){const t=this.No.Ot(this.qo);return He(t)?1:ge(We,t)?0:-1}get No(){const t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?Ml:El,i=e.At()?e:zl;if(!this.jo||this.jo!==i){this.jo=i;const e="localStorage"===t?El:Ml;e.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(He(e.Ot(this.qo))),e.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>He(t))}};const tw=Or("[Dead Clicks]"),ew=()=>!0,iw=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(V)),n=t.instance.config.capture_dead_clicks;return Oe(n)?n:!!$e(n)||i};var nw=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[V]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?tw.error("failed to load script",e):t()})}Ho(){var t;if(n){if(!this.Bo&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=$e(this.instance.config.capture_dead_clicks)?ue({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(n),tw.info("starting...")}}else tw.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,tw.info("stopping..."))}};const sw=Or("[SegmentIntegration]");function rw(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>xe(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||Sl();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ct,Kt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&xe(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||sw.warn("This browser does not have Promise support, and can not use the segment integration");const n=(n,s)=>{if(!s)return n;const r=!!e&&n.event.anonymousId===e&&!n.event.userId;r||n.event.userId||n.event.anonymousId===t.get_distinct_id()||(sw.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(sw.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Re(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))we.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=Se(t)?t:[t];let n=ue({},e);for(const t of i)try{if(n=t(n),Re(n))return null}catch(t){return sw.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Re(s))return n;o=s}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,te)},identify(t){return n(t,ie)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{sw.error("Failed to register the Segment integration",t),e()})},i)}const ow="posthog-js";function aw(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,u,c,h;if("*"!==s&&!s.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],f=v.map(t=>ue(ue({},t),{},{stacktrace:t.stacktrace?ue(ue({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>ue(ue({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(l=v[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(c=v[0])||void 0===c?void 0:c.value)||o.message,$sentry_exception_type:null===(h=v[0])||void 0===h?void 0:h.type,$sentry_tags:o.tags};var g;return e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var lw=class{constructor(t,e,i,n,s,r){this.name=ow,this.setupOnce=function(o){o(aw(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},uw=class{constructor(t){this.Uo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ar.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Vo()}Vo(){var t;this.Go=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Uo)}destroy(){var t;null===(t=this.Go)||void 0===t||t.call(this),this.Go=void 0}doPageView(e,i){var n;const s=this.Qo(e,i);return this.Wo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Qo(t,null===(e=this.Wo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Wo)||void 0===t?void 0:t.pageViewId}}Qo(t,e){const i=this.Wo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(Te(t)||Te(e)||Te(i)||Te(r)||Te(o)||Te(a))){t=Math.ceil(t),e=Math.ceil(e),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const s=t>1?Ze(e/t,0,1,Ar):1,l=t>1?Ze(i/t,0,1,Ar):1,u=r>1?Ze(o/r,0,1,Ar):1,c=r>1?Ze(a/r,0,1,Ar):1;n=Lr(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:c})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const cw=["flags","surveys"],hw={[I]:{exposure:"hidden"},[A]:{exposure:"hidden"},[O]:{exposure:"hidden"},[q]:{exposure:"hidden"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[j]:{exposure:"event"},[B]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[z]:{exposure:"event"},[U]:{exposure:"hidden"},[H]:{exposure:"event"},[W]:{exposure:"event"},[V]:{exposure:"event"},[G]:{exposure:"hidden"},[Z]:{exposure:"event"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[st]:{exposure:"event"},[Y]:{exposure:"event",shouldSkipFromEventProperties:t=>Me(t)},[rt]:{exposure:"event"},[ot]:{exposure:"event"},[at]:{exposure:"event"},[ht]:{exposure:"event"},[dt]:{exposure:"hidden"},[b]:{exposure:"hidden",storageGroup:"flags"},[v]:{exposure:"hidden",storageGroup:"flags"},[d]:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags"},[x]:{exposure:"hidden",storageGroup:"flags"},[m]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[y]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden"},[T]:{exposure:"hidden"},[w]:{exposure:"hidden"},[_]:{exposure:"hidden"},[ft]:{exposure:"hidden",storageGroup:"surveys"},[pt]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gt]:{exposure:"event"},[mt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[kt]:{exposure:"event"},[St]:{exposure:"event"},[xt]:{exposure:"event"},[$t]:{exposure:"event"},[k]:{exposure:"hidden"},[S]:{exposure:"hidden"},[vt]:{exposure:"event"},[p]:{exposure:"hidden"},[g]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ct]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[X]:{exposure:"event"},[tt]:{exposure:"event"},[et]:{exposure:"event"},[it]:{exposure:"event"},[Ft]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"hidden"},[Nt]:{exposure:"hidden"},[qt]:{exposure:"hidden"},[jt]:{exposure:"hidden"},[Bt]:{exposure:"hidden"},[zt]:{exposure:"hidden"},[Ut]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[Qt]:{exposure:"event"}},dw=[[lt,{exposure:"hidden"}],[ut,{exposure:"hidden"}],[ct,{exposure:"hidden"}]],vw=t=>{const e=hw[t];if(e)return e;for(const[e,i]of dw)if(0===t.indexOf(e))return i},fw={flags:g,surveys:pt},pw=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],gw=t=>`${t}_cookie_identity_change_pending`,mw=t=>{let e="",i=0;for(const n of t){const t=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+t>1e3)break;e+=n,i+=t}return e},yw="main",bw=[b,v,f,x,m,g,y,w],_w=t=>-1!==bw.indexOf(t),ww=[D,N],kw=t=>-1!==ww.indexOf(t),Sw=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},xw=t=>{if(!t)return{};const e=JSON.parse(t);return $e(e)?e:{}},$w=(t,e)=>{Dr(t,(i,n)=>{const s=vw(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var Cw=class{constructor(e,i,n=!0,s=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=n,this.props={},this.la=void 0,this.ua=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.hi=e.disable_persistence||!!i,this.No=this.ca(e),this.Xo=this.ha(e),this.load(s),this.da(),e.debug&&Ar.info("Persistence loaded",e.persistence,ue({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();Hr(t,"beforeunload",e,{capture:!1}),Hr(t,"pagehide",e,{capture:!1}),this.va=e=>{if(this.Jo&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.ua){if(this.Xo){const t=cw.find(t=>e.key===this.fa(t));t&&this.pa(e.key,t)}}else this.pa(e.key,yw)},Hr(t,"storage",this.va)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.ea.get(t);if(!_w(t)||!0===i)return;if(!0===e)return void this.ga(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.ga(t,n)})}onCrossTabFeatureFlagChange(t){return this.oa.add(t),()=>this.oa.delete(t)}destroy(){this.va&&t&&(t.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(t,e,i=!0){if(this.hi)return!1;let n,s;try{if(s=Ml.Ot(t),Me(s)){const t=this.ma(e);return t.storageValue=null,e!==yw&&(t.persisted=!1),!1}n=xw(s)}catch(t){return!1}const r=e===yw?n:Ml.Dt(this.ua);if(r&&this.ya(r))return!1;const o=this.ba(n,e,i);return e===yw&&this.Xo&&!Sw(this._a().main,n)||this.wa(n,e,!0,s),o}ya(t){const e=this.props[M],i=t[M];return!Te(e)&&!Te(i)&&e!==i}wa(t,e,i,n){const s=this.ma(e);s.storageValue=n,e!==yw&&(s.persisted=i);try{s.fingerprint=this.ka(t,e)}catch(t){s.fingerprint=void 0}}ba(t,e,i){let n=!1;return bw.forEach(i=>{var s;const r=null===(s=vw(i))||void 0===s?void 0:s.storageGroup;if(e===yw&&this.Xo&&r||e!==yw&&r!==e)return;const o=i in t,a=this.Sa(i,o?t[i]:void 0),l=this.ea.has(i)?i in this.props:o;l===i in this.props&&Sw(a,this.props[i])||(l?this.xa(i,a,!1):this.$a(i,!1),n=!0)}),n&&i&&this.oa.forEach(t=>t()),n}Ca(){if(!this.Jo)return!1;try{this.sa=!1;const t=Ml.Ot(this.ua),e=this.ma(yw);let i,n=!1,s=!1;if(t!==e.storageValue)if(Me(t))e.storageValue=null;else{if(i=xw(t),this.sa=!this.na&&this.ya(i),this.sa)return!1;s=this.ba(i,yw,!1),!this.Xo||Sw(this._a().main,i)?this.wa(i,yw,!0,t):e.storageValue=t,n=!0}return this.Xo&&cw.forEach(t=>{const e=Ml.Ot(this.fa(t)),r=this.ma(t),o=i||{},a=n&&bw.some(e=>{var i;return(null===(i=vw(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!a)return;if(Me(e))return r.storageValue=null,r.persisted=!1,void(a&&(s=this.ba(o,t,!1)||s));const l=xw(e);s=this.ba(l,t,!1)||s,this.wa(l,t,!0,e)}),s}catch(t){return!1}}ga(t,e){this.ea.set(t,e);const i=vw(t);(null==i?void 0:i.volatile)||(this.ma((this.Xo?null==i?void 0:i.storageGroup:void 0)||yw).fingerprint=void 0,this.Ta(t))}Ia(){bw.forEach(t=>this.ea.set(t,!0))}da(){if(this.Jo)try{const t=Ml.Ot(this.ua),e=xw(t);this.ma(yw).storageValue=t,bw.forEach(t=>{var i;const n=this.Xo?null===(i=vw(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Ml.Ot(this.fa(n)):null;if(n){const t=this.ma(n);t.storageValue=s,t.persisted=!Me(s)}const r=n&&!Me(s)?xw(s):e;t in this.props?this.Ma(t,r[t],this.props[t]):t in r&&this.ga(t,!0)})}catch(t){}}Sa(t,e){const i=this.ea.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(Se(e)?e:[]),s=new Set(Se(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=$e(e)?ue({},e):{},s=$e(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Ma(t,e,i){if(!_w(t))return;const n=this.ea.get(t);if(!0===n)return;let s=e;if(this.Jo)try{var r;const e=this.Xo?null===(r=vw(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.fa(e):this.ua;s=xw(Ml.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Te(e)&&!Se(e)||!Te(s)&&!Se(s)||!Se(i))return void this.ga(t,!0);const n=new Set(e||[]),r=new Set(s||[]),a=new Set(i);new Set([...n,...a]).forEach(t=>{n.has(t)!==a.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===a.has(t)&&o.delete(t)})}else{if(!$e(i))return void(Sw(s,i)?this.ea.delete(t):this.ga(t,!0));{if(!Te(e)&&!$e(e)||Te(e)&&Ce(i)&&Te(s))return void this.ga(t,!0);const n=$e(e)?e:{},r=$e(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&Sw(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&Sw(r[t],i[t])&&o.delete(t)})}}o.size?this.ga(t,o):this.ea.delete(t)}Ea(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Pe(e)&&e>0?e:0}Pa(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{const e=Dl(t,this.Mr.cookie_persisted_properties||[]),i=Nl(e,this.Mr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=El.Ot(this.ua)||void 0;s&&jl(this.ua,s)===n&&(this.Ra=n,this.Aa=s)}catch(t){}else try{const t=El.Ot(this.ua)||void 0;this.Ra=t?jl(this.ua,t):void 0,this.Aa=t}catch(t){}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(t,e=!1){if(this.hi&&!e||this.ta||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=El.Ot(this.ua)||void 0}catch(t){}if(!i||i===this.Aa)return!1;const n=jl(this.ua,i);let s;try{s=Fl(JSON.parse(i))}catch(t){return!1}if((El.Ot(this.ua)||void 0)!==i)return!1;this.Ra=n,this.Aa=i;const r=ql(this.ua,i),o=[...Pl,...r.properties],a={};if(Object.keys(s).forEach(t=>{const e=s[t];(Te(e)||Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete s[t])}),Ce(s))return!1;const l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,c=u[M],h=u[Ct],d=Lr({},u);[...Pl,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in s)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){const e=d[t];(r.isValid||-1===Pl.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Lr(d,s),bw.forEach(t=>{const e=t in this.props;t in u===e&&Sw(u[t],this.props[t])||(e?this.Ma(t,u[t],this.props[t]):this.ga(t,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this.xa(Ct,Jt);const y=this.props[M],S=this.props[Ct];return!l||y===c&&S===h||(this.na=!0,this.Yo=!0,Hl.$t(gw(this.ua),!0),this.$a(w),this.$a(v),this.$a(b),this.$a(f),this.$a(x),this.$a(m),this.$a(g),this.$a(p),this.$a(k),"anonymous"!==S||"identified"!==h&&"anonymous"!==s.$user_state&&(Te(c)||y===c)||($w(this.props,s),this.$a(_)),"identified"===S?this.props.$user_id=y:delete this.props.$user_id,this.$a(A)),!0}consumeCookieIdentityChange(){const t=gw(this.ua),e=this.Yo||!!Hl.Ot(t);return this.Yo=!1,e&&Hl.Pt(t),e}Oa(t=!1){return!(this.ta||this.hi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.ta=!0,0))}Da(){this.ta&&(Te(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[yw],this.Na(!0))}qa(t=!0){if(this.ta)try{t?this.Da():Te(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){-1===pw.indexOf(e.persistence.toLowerCase())&&(Ar.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1,n=()=>!1)=>{const s=[...Pl,...e];return ue(ue({},Ml),{},{Dt(t){try{let r,o={};try{r=El.Ot(t)||void 0,o=r?Fl(JSON.parse(r)):{}}catch(t){}const a=JSON.parse(Ml.Ot(t)||"{}");let l;if(i){const i=ql(t,r),n=[...Pl,...i.properties],u={};Object.keys(o).forEach(t=>{const e=o[t];Me(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const c="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=a[M],r=null!==(e=a.$user_state)&&void 0!==e?e:Jt;s.forEach(t=>{if(-1!==n.indexOf(t)&&!(t in o)&&(c||"distinct_id"!==t&&"$user_state"!==t)){const e=a[t];(i.isValid||-1===Pl.indexOf(t)||!1!==e&&0!==e)&&delete a[t]}}),!c||"$user_state"in o||"$user_state"in a||(a[Ct]=Jt),!c||("distinct_id"in u?u[M]:a[M])===t&&("$user_state"in u?u[Ct]:a[Ct])===r||(Rl.forEach(t=>delete a[t]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[M]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[vt],delete a[_]),delete a.__alias)}l=Lr(a,u)}else l=Lr(o,a);return n()||Ml.$t(t,l),l}catch(t){}return null},$t(t,n,s,r,o,a){const l=Ml.$t(t,n,void 0,void 0,a);try{const u=Dl(n,e);if(Object.keys(u).length){if(i){const i=Al(t),c=Nl(u,e);if(El.$t(i,c,s,r,o,a),El.Ot(i)!==JSON.stringify(c)){El.Pt(i,r);const e=Dl(n);return El.$t(t,e,s,r,o,a),l}}El.$t(t,u,s,r,o,a)}}catch(t){Ml.Lt(t)}return l},Pt(e,i){try{null==t||t.localStorage.removeItem(e),El.Pt(e,i),El.Pt(Al(e),i)}catch(t){Ml.Lt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Ml.At()?(n=Ml,r=!0):"localstorage+cookie"===o&&i.At()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Hl.At()?n=Hl:"memory"===o?n=zl:"cookie"===o&&El.At()?(n=El,s=!0):i.At()?(n=i,r=!0,s=!0):El.At()?(n=El,s=!0):n=zl,this.Jo=r,this.Ko=s,n}fa(t){return`${this.ua}__${t}`}ha(t){return this.Jo&&!!t.split_storage}properties(){const t={};return Dr(this.props,(e,i)=>{const n=vw(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.hi&&!t)return;const e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?Ml.Dt(this.ua):null;let n={};if(e)try{n=Fl(El.Dt(this.ua)),Dr(n,(t,e)=>{(Te(t)||Me(t)||""===t)&&delete n[e]})}catch(t){}const s=this.No.Dt(this.ua);if(s&&(this.props=Lr({},s)),this.Xo&&this.ja(),e&&s){var r,o;const t=null==i?void 0:i[M],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Jt,a=s[M],l=null!==(o=s.$user_state)&&void 0!==o?o:Jt;if(a!==t||l!==e){this.Yo=!0,this.hi||Hl.$t(gw(this.ua),!0);const i=Lr({},this.props);Rl.forEach(t=>delete i[t]),"anonymous"!==l||"identified"!==e&&"anonymous"!==n.$user_state&&(Te(t)||a===t)||($w(i,n),delete i[_]),this.props=i;const s=new Set;Rl.forEach(t=>{var e;const i=null===(e=vw(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{if(this.hi)return;const e={};Dr(this.props,(i,n)=>{var s;(null===(s=vw(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),Ce(e)?(Ml.Pt(this.fa(t)),this.Zo[t]={}):Ml.$t(this.fa(t),e)&&(this.Zo[t]={persisted:!0,fingerprint:this.ka(e,t)})})}}Hl.Ot(gw(this.ua))&&(this.Yo=!0)}ja(){for(const t of cw){const e=Ml.Dt(this.fa(t));if(e&&!Ce(e)){const i=this.ma(t);i.persisted=!0,this.Ba(t)||(i.fingerprint=this.ka(e,t)),this.za(t,e)||Lr(this.props,e)}}}Ba(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=vw(e))||void 0===i?void 0:i.storageGroup)===t})}za(t,e){const i=fw[t];if(!i)return!1;const n=e[i],s=this.props[i];return Pe(n)&&Pe(s)&&s>n}refreshKey(t){var e;if(this.hi)return;if(this.ra.has(t))return;const i=this.Xo?null===(e=vw(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Ml.Dt(this.fa(i)):this.No.Dt(this.ua);if(n&&t in n)this.xa(t,n[t],!1);else{if(i){const e=this.No.Dt(this.ua);if(e&&t in e)return void this.xa(t,e[t],!1)}this.$a(t,!1)}}save(){if(this.hi)return;const t=this.Ea();t>0?Te(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},t)):this.Na()}flush(){Te(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(t=!1){if(this.hi||this.ta&&!t)return;t||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||ww.forEach(t=>this.refreshKey(t)));const e=!t&&!this.ia;e||(this.sa=!1);const i=!!e&&this.Ca();if(this.sa)return void(this.Mr.debug&&Ar.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(i&&this.oa.forEach(t=>t()));const n=this.Ua(this.No,this.ua,this.props,yw);"written"===n&&this.Pa(this.props),"failed"!==n&&(this.ea.clear(),this.na=!1,this.ra.clear()),i&&this.oa.forEach(t=>t())}Ha(){const{main:t,groups:e}=this._a(),i=this.Ua(this.No,this.ua,t,yw);"written"===i&&this.Pa(t),"failed"!==i&&(this.na=!1,this.ra.clear(),bw.forEach(t=>{var e;(null===(e=vw(t))||void 0===e?void 0:e.storageGroup)||this.ea.delete(t)}));for(const t of cw){var n;const i=e[t];if(Ce(i)&&!(null===(n=this.Zo[t])||void 0===n?void 0:n.persisted)){bw.forEach(e=>{var i;(null===(i=vw(e))||void 0===i?void 0:i.storageGroup)===t&&this.ea.delete(e)});continue}const s=this.Ua(Ml,this.fa(t),i,t);"failed"!==s&&bw.forEach(e=>{const i=vw(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.ea.delete(e)})}}_a(){const t={},e={flags:{},surveys:{}};return Dr(this.props,(i,n)=>{var s;const r=null===(s=vw(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}ka(t,e){if(e===yw)return JSON.stringify(t)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const i={};return Dr(t,(t,e)=>{var n;i[e]=(null===(n=vw(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}Ua(t,e,i,n){const s=this.ma(n);if(n!==yw&&!s.dirty&&!Te(s.fingerprint))return"skipped";let r;try{if(r=this.ka(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(e,i,this.Wa,this.Va,this.Ga,this.Mr.debug)?(s.dirty=!1,n!==yw&&(s.persisted=!0),Te(r)||(s.fingerprint=r),this.Jo&&(s.storageValue=Ml.Ot(e)),"written"):(this.Mr.debug&&Ar.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Ia(),Te(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!t&&this.aa)for(const t of cw)Ml.Pt(this.fa(t));t?delete this.Zo[yw]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if($e(t)){this.syncCookieProperties(),Te(e)&&(e="None"),this.Wa=Te(i)?this.Qa:i;let n=!1;if(Dr(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.xa(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if($e(t)){this.syncCookieProperties(),this.Wa=Te(e)?this.Qa:e;let i=!1;if(Dr(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||$e(e)||Se(e))&&(this.xa(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.$a(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.la)return;const e=xu(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!Ce(jr(e));return i&&this.register(e),this.la=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Cu(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Mu(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=Kr(n.referrer))||void 0===t?void 0:t.host)||Iu},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Ru(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Rt]:this.Ko?{r:mw(t.r),u:t.u?mw(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Dr([Mt,It],e=>{const i=this.props[e];i&&Dr(i,function(e,i){t["$initial_"+ye(i)]=e})});const e=this.props[Rt];if(e){const i=function(t,e=!1){const i=Pu(t,e),n={};return Dr(i,function(t,e){n[`$initial_${ye(e)}`]=t}),n}(e,this.Mr.disable_capture_url_hashes);Lr(t,i)}return t}safe_merge(t){return Dr(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.hi&&!a;a||this.Fa(e,l),this.Mr=t,!a&&(n||s||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(ue(ue({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),l));const u=r||o?this.ca(t):this.No;this.Za();const c=this.ha(t),h=r||c!==this.Xo,d=!a&&(h||t.cross_subdomain_cookie!==this.Va||t.secure_cookie!==this.Ga)&&this.Oa(l);this.ia=h;try{if(this.Qa=this.Wa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),h){const t=this.props;this.clear(),this.No=u,this.Xo=c,this.props=t,this.save()}else o&&(this.No=u,a||(delete this.Zo[yw],this.Na()))}finally{this.ia=!1,d&&this.qa()}}Za(){const t=this.props[Rt];if(!this.Ko||!$e(t)||"string"!=typeof t.r)return;const e=mw(t.r),i="string"==typeof t.u?mw(t.u):t.u;e===t.r&&i===t.u||this.xa(Rt,ue(ue({},t),{},{r:e,u:i}))}set_disabled(t){this.hi=t,this.hi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Va&&(this.Va=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ga&&(this.Ga=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.xa(q,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Te(i)||(delete e[t],this.xa(q,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.xa(t,e),this.save()}xa(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.na=!0),kw(t)&&!Sw(s,e)&&this.ra.add(t),this.Ma(t,s,e),(null===(n=vw(t))||void 0===n?void 0:n.volatile)||this.Ta(t))}$a(t,e=!0){delete this.props[t],e&&(_w(t)&&this.ga(t,!0),kw(t)&&this.ra.add(t),this.Ta(t))}Ta(t){var e;const i=null===(e=vw(t))||void 0===e?void 0:e.storageGroup;i&&(this.ma(i).dirty=!0)}ma(t){return this.Zo[t]||(this.Zo[t]={})}};const Tw={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Ew={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Iw={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Mw=Or("[RateLimiter]");var Rw=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Mw.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Mw.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>s&&(a.tokens=s);const l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){const t=(Pe(a.dropped)?a.dropped:0)+1;a.dropped=t,!this.lastEventRateLimited&&this.Ja(t)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Ka(t){const e=this.instance.config.property_denylist;return!Se(e)||!e.includes(t)}Xa(){var t;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Ja(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Xa(),o=this.Ka("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,a=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const Pw=Or("[RemoteConfig]");var Aw=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ya(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}tl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return Pw.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void Pw.warn("Remote config is disabled. Falling back to local config.");this.Ya(t=>{if(!t)return Pw.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(t)})}catch(t){Pw.error("Error loading remote config",t),this.el()}}el(t,e){!t&&e&&(0===e.statusCode?e.error||Pw.warn("Failed to fetch remote config from PostHog."):Pw.error("Failed to fetch remote config from PostHog."));try{this._instance.el(t?{ok:!0,config:t}:{ok:!1})}catch(t){Pw.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(t){Pw.error("Error loading feature flags",t)}}};const Ow=["fatal","error","warning","log","info","debug"],Fw=!!o||!!r,Dw=new WeakMap,Lw="text/plain";let Nw=0,qw=!1;const jw=(t,e)=>{const[i,n]=t.split("#"),[s,r]=i.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==e).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},Bw=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=ue({},e),a=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],l=Yr(o);return l&&a.push(l),a.length>0?`${s}?${a.join("&")}`:s},zw=t=>{if(t.nl)return t.nl;const{data:e,compression:i}=t;if(!e)return;if(i===gg.GZipJS){const t=vl(fl(Jr(e)),{mtime:0});return{contentType:Lw,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===gg.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Jr(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:Jr(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=Jr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},Uw=t=>{const e=()=>"sendBeacon"===t.transport?{url:Bw(t.url,{compression:gg.Base64}),encodedBody:zw(ue(ue({},t),{},{compression:gg.Base64,nl:void 0}))}:{url:jw(t.url,"compression"),encodedBody:zw(ue(ue({},t),{},{compression:void 0,nl:void 0}))};let i;try{i=zw(t)}catch(i){if(ds(t.compression,Xr(t.url,"compression")))return Ar.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&ds(t.compression,Xr(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?hs(new Uint8Array(n)):ArrayBuffer.isView(n)&&hs(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(qw=!0,e()):{url:t.url,encodedBody:i};var n},Hw=t=>{try{return Uw(t)}catch(i){var e;return Ar.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},Ww=function(){var t=re(function*(t){const e=yield bs(Jr(t.data),Wl.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return ue(ue({},t),{},{nl:{contentType:Lw,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Vw=/Failed to fetch|NetworkError|Load failed/i,Gw=t=>"TypeError"===(null==t?void 0:t.name)&&Vw.test((null==t?void 0:t.message)||""),Qw=t=>{try{const e=function(t,e=Date.now()){if("string"!=typeof t||!t)return;const i=t.trim(),n=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const s=/^\w{3} \w{3} /.test(n)?n+" GMT":n,r=Date.parse(s)-e;return Number.isFinite(r)&&r>0?Math.min(r,rn):void 0}(t());return Te(e)?void 0:Math.min(e,3e4)}catch(t){return}},Zw=t=>{const e=Hw(t);if(!e)return;const i=new o;Dw.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:a}=null!=s?s:{};Dr(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n,Qw(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},Jw=t=>{const e=Hw(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:l}=null!=n?n:{},u=new Headers;Dr(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let c=null,h=!1;if(a){const e=new a;c={signal:e.signal,timeout:setTimeout(()=>{h=!0;try{e.abort(un("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))}catch(t){v(t)}var i},t.timeout)}}let d=!1;const v=e=>{var i;d||(d=!0,h&&"AbortError"===(null==e?void 0:e.name)||Gw(e)?Ar.warn(e):Ar.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))};let f=0;const p=()=>{Nw-=f,f=0,c&&clearTimeout(c.timeout)};try{const e=ue({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==c?void 0:c.signal},t.fetchOptions),n=null!=l?l:Te(o)?0:void 0;e.keepalive="POST"===e.method&&!t.sl&&!1!==e.keepalive&&e.body===o&&!Te(n)&&n>=0&&52428.8>Nw+n,e.keepalive&&(f=n,Nw+=f),r(i,e).then(e=>e.text().then(i=>{var n;if(d)return;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Ar.error(t)}d=!0,p(),null===(n=t.callback)||void 0===n||n.call(t,s,Qw(()=>e.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},Kw=t=>{try{var e;const{url:n,encodedBody:s}=Uw(t),{contentType:o,body:a,estimatedSize:l}=null!=s?s:{};if(!a)return;const u=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(n,u))return;const c=Se(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(Se(c)&&c.length>1&&(null!=l?l:0)>16384){const e=Math.ceil(c.length/2),i=e=>Se(t.data)?e:ue(ue({},t.data),{},{batch:e});return Kw(ue(ue({},t),{},{data:i(c.slice(0,e))})),void Kw(ue(ue({},t),{},{data:i(c.slice(e))}))}Ar.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?Jw(ue(ue({},t),{},{sl:!0})):Zw(t)}catch(t){Ar.warn("Beacon send failed",t)}},Yw=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return Bw(i===gg.GZipJS?jw(t,"compression"):t,ue(ue({},s?{[s]:Date.now().toString()}:{}),i===gg.GZipJS?{}:{compression:i}))},Xw=(()=>{const t=[];return r&&t.push({transport:"fetch",method:Jw}),o&&t.push({transport:"XHR",method:Zw}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:Kw}),t})();let tk=!Fw&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function ek(t,e,i){var n,s,r;i&&(e=ue(ue({},e),{},{callback:t=>i(t)})),t.__loaded?tk?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=ue(ue({},t.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(n=t.compression)&&void 0!==n?n:e.compressionFallback:e.compression,(Te(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var i,n,s;const r=ue(ue({},t),{},{callback:null!=e?e:e=>{var i;return null===(i=t.callback)||void 0===i?void 0:i.call(t,e)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Te(r.compression)&&r.data&&(r.compression=gg.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var e,i;const n=(Se(t)?t:[t]).map(t=>ue(ue({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(e=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==e?e:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,e=(new Date).toISOString())=>Se(t)?t.map(t=>ue(ue({},t),{},{sent_at:e})):ue(ue({},t),{},{sent_at:e}))(r.data))),r.url=Yw(r.url,r.method,r.compression,r.timestampMode);const a=Xw.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(n=null===(s=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(a,t=>t.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:a[0].method;if(!u)throw new Error("No available transport method");const c=t=>{try{u(t)}catch(t){var e;Gw(t)?Ar.warn(t):Ar.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===gg.GZipJS&&l&&"undefined"!=typeof Promise&&!qw?Ww(r).then(t=>{c(t)}).catch(e=>{if(vs(e))return qw=!0,void c(ue(ue({},r),{},{compression:void 0,url:Yw(t.url,t.method,void 0,t.timestampMode)}));fs(e)&&(qw=!0),c(r)}):c(r)})(e,(n,s)=>{var r,o,a;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(a=e.callback)||void 0===a||a.call(e,n)})):e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.call(e,{statusCode:0}))}var ik=class{constructor(t,e){this.rl=!0,this.ol=[],this.al=Ze((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Ar.createLogger("flush interval"),3e3),this.ll=t}enqueue(t){this.ol.push(t),this.ul||this.cl()}unload(){this.hl();const t=this.ol.length>0?this.dl():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.vl(ue(ue({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){const t=this.dl();for(const e in t)this.vl(t[e])}}vl(t,e){try{this.ll(t,e)}catch(t){Ar.error(t)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){const t={},e={};Dr(this.ol,i=>{var n;const s=i,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");Te(t[r])&&(t[r]=ue(ue({},s),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),e[r]=[]),null===(n=t[r].data)||void 0===n||n.push(s.data),s.callback&&e[r].push(s.callback)});for(const i in e){const n=e[i];n.length&&(t[i].callback=t=>{for(const e of n)e(t)})}return this.ol=[],t}};const nk=["retriesPerformedSoFar"];var sk=class{constructor(t){this._instance=t,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!Te(t)&&"onLine"in t.navigator){if(this.ml=t.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},Hr(t,"online",this.yl),Hr(t,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=ws(t,nk);Ae(i)&&(n.url=Bw(n.url,{retry_count:i})),ek(this._instance,e?ue(ue({},n),{},{transport:e}):n,(t,e)=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(ue({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Ar.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=i?i:0} retries.`)}null===(s=n.callback)||void 0===s||s.call(n,t)})}Ls(t,e){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const n=Math.max(function(t){const e=3e3*Math.pow(2,t),i=e/2,n=Math.min(18e5,e),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=e?e:0),s=Date.now()+n;this.ol.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Ar.warn(r),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),0===this.ol.length)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){const t=Date.now(),e=[],i=this.ol.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ol=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,Te(t)||(this.yl&&(t.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(t.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:t}of this.ol)try{this._instance._send_request(ue(ue({},t),{},{callback:Se(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Ar.error(t)}this.ol=[]}},rk=class{constructor(t){this._instance=t,this.kl=()=>{var t,e,i,n;this.Sl||(this.Sl={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=r+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(r),this.Sl.maxScrollY=Math.max(r,null!==(t=this.Sl.maxScrollY)&&void 0!==t?t:0),this.Sl.maxScrollHeight=Math.max(o,null!==(e=this.Sl.maxScrollHeight)&&void 0!==e?e:0),this.Sl.lastContentY=a,this.Sl.maxContentY=Math.max(a,null!==(i=this.Sl.maxContentY)&&void 0!==i?i:0),this.Sl.maxContentHeight=Math.max(l,null!==(n=this.Sl.maxContentHeight)&&void 0!==n?n:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const t=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),t}startMeasuringScrollPosition(){Hr(t,"scroll",this.kl,{capture:!0}),Hr(t,"scrollend",this.kl,{capture:!0}),Hr(t,"resize",this.kl)}scrollElement(){if(this.xl){const i=Se(this.xl)?this.xl:[this.xl];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}$l(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.xl){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const ok=t=>Ru(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var ak=class{constructor(t,e,i,n){this.qe=t=>{const e=this.Cl();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Tl(this._instance)};this.Il.register({[Tt]:i})},this._instance=t,this.Ml=e,this.Il=i,this.Tl=n||ok,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[Tt]}getSetOnceProps(){var t;const e=null===(t=this.Cl())||void 0===t?void 0:t.props;return e?"r"in e?Pu(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Dr(jr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${ye(i)}`]=e}),t}},lk=class{on(t,e){return this.El[t]||(this.El[t]=[]),this.El[t].push(e),()=>{this.El[t]=this.El[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.El[t]||[])i(e);for(const i of this.El["*"]||[])i(t,e)}constructor(){this.El={}}};const uk=Or("[SessionId]"),ck=864e5;var hk=class{on(t,e){return this.Pl.on(t,e)}constructor(t,e,i){var n;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new lk,this.Ll=(t,e)=>!(!Ae(t)||!Ae(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.Il=t.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=e||Sl,this.jl=i||Sl;const s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ze(this.Mr.session_idle_timeout_seconds||1800,60,36e3,uk.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+s+"_window_id",this.Hl="ph_"+s+"_primary_window_exists",this.Ul()){const t=Hl.Dt(this.zl),e=Hl.Dt(this.Hl);t&&!e?this.je=t:Hl.Pt(this.zl),Hl.$t(this.Hl,!0)}(null===(n=this.Mr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Te(this.Fl)&&(this.Fl=[]),this.Fl.push(t),this.Xt&&t(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(e=>e!==t)}}Ul(){return"memory"!==this.Mr.persistence&&!this.Il.hi&&Hl.At()}Vl(t){t!==this.je&&(this.je=t,this.Ul()&&Hl.$t(this.zl,t))}Gl(){return this.je?this.je:this.Ul()?Hl.Dt(this.zl):null}Ql(t){const e=this.Rl;return!Me(e)&&!Me(t)&&5e3>Math.abs(t-e)}Zl(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ql(e)||(this.Rl=e,this.Il.register({[nt]:[e,t,i]}))}Jl(){var t;const e=null===(t=this.Mr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ae(e)&&e>0}Kl(){this.Jl()?this.Il.refreshKey(nt):(this.Il.flush(),this.Il.load())}Xl(){var t;if(Me(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,e,i]=this.Yl();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[nt]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[t]=this.Yl(),e=Ae(t)?t:0,i=Ae(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}eu(t){return this.Kl(),this.Ll(t,this.tu())}Yl(){const t=this.Il.props[nt];return Se(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void uk.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void uk.error("Invalid sessionID in bootstrap",t)}})(t);return!Te(i)&&(e?this.Nl={sessionId:t,sessionStartTimestamp:i}:this.Zl(t,(new Date).getTime(),i),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&t&&(t.removeEventListener(Xt,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Hl.Pt(this.Hl)},Hr(t,Xt,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Al=n;else if(Me(this.Al)||this.Al>n||n-this.Al>=1e3){var r,o;null===(r=(o=this.Il).syncCookieProperties)||void 0===r||r.call(o),this.Al=n}let[,a,l]=this.Yl();const u=!Te(s)&&a!==s,c=this.tu();let h=this.Gl();const d=this.Nl,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>ck),f=d?v:Ae(l)&&Math.abs(n-l)>ck;let p=!1,g=u,m=!a||!!d;const y=a;let b=!m&&!t&&this.Ll(n,c);if(b&&(b=this.eu(n),b||uk.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Yl(),b||(m=!a||!!d)),m||b||f){g=!1;const t=d&&!v;a=t?d.sessionId:this.ql(),h=this.jl(),uk.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),l=t?d.sessionStartTimestamp:n,this.Nl=void 0,p=!0}else h||(h=this.jl(),p=!0),g=g||a!==y,g&&(uk.info("adopted cross-tab session id",{sessionId:a,windowId:h}),p=!0);const _=Ae(c)&&t&&!f?c:n,w=Ae(l)?l:(new Date).getTime();this.Vl(h),this.Zl(a,_,w),t||this.Bl();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Fl.forEach(t=>t(a,h,k)),{sessionId:a,windowId:h,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:c}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:t})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const dk=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Qe(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Qe(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function vk(){return vk=re(function*(){const t=null==i?void 0:i.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return Ee(i)&&i.length>0?i:void 0}catch(t){return void Ar.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),vk.apply(this,arguments)}const fk="custom",pk="i.posthog.com",gk=/^\/static\//,mk=["/s/","/e/","/i/"];var yk=class{constructor(t){this.nu={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${pk}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.nu[this.apiHost]||(this.nu[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":fk),this.nu[this.apiHost]}su(t){if(!gk.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}ru(t){const e=Kr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}ou(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=Kr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&mk.some(t=>0===e.indexOf(t))){const t=this.ru(n);if(t){const e=this.apiHost;let i=this.au;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.au=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.au,i=this.ru(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.ou(t,e,this.uiHost+e);if("flags"===t)return this.ou(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.su(e);if(i)return this.ou(t,e,`${i}${e}`)}if(this.region===fk)return this.ou(t,e,this.apiHost+e);const i=pk+e;switch(t){case"assets":return this.ou(t,e,`https://${this.region}-assets.${i}`);case"api":return this.ou(t,e,`https://${this.region}.${i}`)}}};const bk=Or("[PostHog ExternalIntegrations]"),_k={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var wk=class{constructor(t){this._instance=t}zo(t,e){var i,n;null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return bk.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.zo(_k[s],()=>{var t;null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=h.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}},kk=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);const i={};for(const n of t){const t=null==e?void 0:e.get_property(n);Te(t)||(i[n]=t)}return i}set(t,e){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null===(e=this._instance.persistence)||void 0===e||e.unregister(t)}},Sk=class{constructor(t){this.instance=t,this.A=Ar,this.kv=new kk(t),this.onEvent=t=>Eg(this.instance._addCaptureHook((e,i)=>{if(i)try{t({event:e,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const e=e=>{try{t(e)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},i=this.instance.lu.on("extensionsRemoteConfig",e);return this.instance.uu&&e(this.instance.uu),Eg(i)}}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(R);return"string"==typeof t?t:void 0}get library(){return{name:Wl.LIB_NAME,version:Wl.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n,s;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==r?void 0:r.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==r?void 0:r.sessionStartTimestamp)&&void 0!==n?n:0,lastActivityTimestamp:null!==(s=null==r?void 0:r.lastActivityTimestamp)&&void 0!==s?s:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return xe(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(t){let e;switch(t){case jg:case"featureFlagsCommon":e=this.instance.featureFlags;break;case Bg:e=this.instance.logs;break;case zg:e=this.instance.surveys;break;case qg:e=this.instance.autocapture}return e}capture(t,e,i){i?this.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Eg(this.instance.cu(t))}sendRequest(t){var e=this;return re(function*(t,i={}){var n;const s=null!==(n=i.target)&&void 0!==n?n:"api",r=e.instance.requestRouter.endpointFor(s,t),o="api"===s&&"/i/v1/logs"===t,a={method:i.method,url:i.query?Bw(r,i.query):r,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?he.Base64:void 0,timestampMode:i.sentAt};return o&&(a.batchKey="logs"),"sendBeacon"===i.transport?(e.instance._send_request(a),{statusCode:202}):new Promise(t=>{a.callback=t,e.instance._send_request(a)})}).apply(this,arguments)}};const xk={};let $k=0;const Ck=()=>{},Tk='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ek="Surveys module not available",Ik="sanitize_properties is deprecated. Use before_send instead",Mk="Invalid value for property_denylist config: ",Rk=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Pk=["$feature_flag_called","$$heatmap","$snapshot"],Ak=t=>"$"===t.charAt(0)&&!ge(Pk,t),Ok=/^[A-Za-z0-9_-]{1,400}$/,Fk=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Dk=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Lk=["token","distinct_id",Ot],Nk="posthog",qk=t=>{const e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},jk=e=>{var i;return ue({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ur(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ck,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Ee(null==s?void 0:s.search)&&-1!==s.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==t||null===(i=t.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Ar.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Yt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Ck},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:ko,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:qk(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},Bk=[["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"]],zk=t=>{const e={};for(const[i,n]of Bk)Te(t[i])||(e[n]=t[i]);const i=Lr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Te(n)||(Te(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Ee(n)&&Te(t.asset_host)&&(i.asset_host=n)),Se(t.property_blacklist)&&(Te(t.property_denylist)?i.property_denylist=t.property_blacklist:Se(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ar.error(Mk+t.property_denylist)),i};var Uk=class{constructor(){this.__forceAllowLocalhost=!1}get hu(){return this.__forceAllowLocalhost}set hu(t){Ar.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Hk=class e{du(t){if(!t)return;const e=this.vu.indexOf(t);-1!==e&&this.vu.splice(e,1)}fu(t,e){var i;return this.du(t),this.vu.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}pu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}gu(){if(this.mu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.pu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.yu)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.mu=!0,console.warn("[PostHog.js]",`${e} 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. ${n}`)}bu(){const t=this.persistence;if(!t||this._u)return;if(this.pu())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.wu(),this.ku()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.Su()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(Sl());this.register({distinct_id:e,$device_id:e}),t.set_property(Ct,Jt)}this.wu()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.xu=!1,this.$u=!1,this.webPerformance=new Uk,this.Cu=!1,this.version=Wl.LIB_VERSION,this.Tu=new Set,this.Iu="",this.lu=new lk,this.vu=[],this.Mu=[],this.Eu=!1,this.yu=!1,this.mu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jk(),this.SentryIntegration=lw,this.sentryIntegration=t=>function(t,e){const i=aw(t,e);return{name:ow,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Pu=!1,this.Ru=null,this.Au=null,this.Fu=null,this.scrollManager=new rk(this),this.pageViewManager=new uw(this),this.rateLimiter=new Rw(this),this.requestRouter=new yk(this),this.consent=new X_(this),this.externalIntegrations=new wk(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=Ee(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Ar.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Nk){var s;const r=null!==(s=xk[n])&&void 0!==s?s:new e;return r._init(t,i,n),xk[n]=r,xk[Nk][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const a=Ee(e)?e.trim():"";if(!a)return Ar.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=jk(i.defaults),i.debug=this.Ou(i.debug),this.Du=i,this.Lu=[],i.person_profiles?this.Au=i.person_profiles:i.process_person&&(this.Au=i.process_person);const u=jk(i.defaults),c=zk(i),h=Lr({},u,c,{name:n,token:a});$e(u.rageclick)&&$e(c.rageclick)&&(h.rageclick=Lr({},u.rageclick,c.rageclick)),$e(u.session_recording)&&$e(c.session_recording)&&(h.session_recording=Lr({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Ar.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:gg.GZipJS;const d=this.Su(),v=!this.pu();if(this.persistence=new Cw(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cw(ue(ue({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.Iu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Hl.At()){const t=Hl.Dt(this.Iu);Se(t)&&t.forEach(t=>{Ee(t)&&this.Tu.add(t)})}else Hl.Pt(this.Iu);const f=ue({},this.persistence.props),p=ue({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Nu=new ik((t,e)=>this.qu(t,e),this.config.request_queue_config),this.ju=new sk(this),this.__request_queue=[];const g=this.pu();g||(this.sessionManager=new hk(this),this.sessionPropsManager=new ak(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Bu()})),this.zu(),this.config.__preview_deferred_init_extensions?(Ar.info("Deferring extension initialization to improve startup performance"),this.Hu=setTimeout(()=>{this.Hu=void 0,this.Uu(g)},0)):(Ar.info("Initializing extensions synchronously"),this.Uu(g)),Wl.DEBUG=Wl.DEBUG||this.config.debug,Wl.DEBUG&&Ar.info("Starting in debug mode",{this:this,config:i,thisC:ue({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=ue(ue({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.yu=!!m&&!Ie(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property(Ct);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Ar.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(Sl()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(Ct,i.bootstrap.isIdentifiedID?Kt:Jt),this.register({distinct_id:t,$device_id:n})}}if(g)this.register_once({distinct_id:At,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Sl());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(Ct,Jt)}return Hr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Hr(t,"pageshow",()=>{var t;this.xu=!1,this.$u||null===(t=this.ju)||void 0===t||t.resume()}),i.segment?rw(this,()=>this.Wu()):this.Wu(),xe(this.config._onCapture)&&this.config._onCapture!==Ck&&(Ar.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ar.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 vk.apply(this,arguments)}().then(t=>{t&&this.register({[P]:t})}).catch(Ck),this}Vu(t){const e=t;return Ee(e.name)&&xe(e.setup)}Gu(t,e){var i=this;this.Vu(t)?e.push(re(function*(){try{yield t.setup(i.Qu())}catch(i){Ar.error(`Failed to set up extension "${t.name}"`,i);try{var e;yield null===(e=t.dispose)||void 0===e?void 0:e.call(t)}catch(e){Ar.error(`Failed to dispose extension "${t.name}"`,e)}}})):this.vu.push(t)}zu(){var t,i,n,s=this;const r=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var o,a,l;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Zu)||void 0===o||o.call(this),this.Zu=void 0,this.featureFlags=new r(this)),xe(this.featureFlags.onReloading)&&xe(this.featureFlags.setup)){if(!this.Zu){this.Zu=this.featureFlags.onReloading(()=>{this.lu.emit("featureFlagsReloading",!0)});const t=this.featureFlags;re(function*(){try{yield t.setup(s.Qu())}catch(e){Ar.error("Failed to set up feature flags",e);const i=s.Zu;s.Zu=void 0;try{null==i||i()}catch(t){Ar.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Ar.error("Failed to dispose feature flags",t)}}})()}}else null===(a=(l=this.featureFlags).initialize)||void 0===a||a.call(l)}Uu(t){const i=performance.now(),n=ue(ue({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,a,l,u,c,h,d;n.exceptions&&this.vu.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.vu.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.vu.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.vu.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.vu.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Gu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Gu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Gu(this.logs=null!==(a=this.logs)&&void 0!==a?a:new n.logs(this),s),n.metrics&&this.vu.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new n.metrics(this)),n.conversations&&this.vu.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.vu.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.vu.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.vu.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.vu.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.vu.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,iw)),n.toolbar&&this.vu.push(this.toolbar=null!==(c=this.toolbar)&&void 0!==c?c:new n.toolbar(this)),n.experiments&&this.vu.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new n.experiments(this)),n.webMCP&&this.vu.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new n.webMCP(this)),this.vu.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Ju){const t=this.Ju;this.Ju=void 0,this.vu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Ku(s,i)}Ku(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void(this.Hu=setTimeout(()=>{this.Hu=void 0,this.Ku(t,e)},0));const i=t.shift();if(i)try{i()}catch(t){Ar.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ft]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:i}),this.config.__preview_deferred_init_extensions&&Ar.info(`PostHog extensions initialized (${i}ms)`)}el(t){if(!n||!n.body)return Ar.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.uu=t,this.compression=void 0,t.ok){var e;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ge(i.supportedCompression,gg.GZipJS)?gg.GZipJS:ge(i.supportedCompression,gg.Base64)?gg.Base64:void 0),(null===(e=i.analytics)||void 0===e?void 0:e.endpoint)&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Au?this.Au:Yt}),this.lu.emit("extensionsRemoteConfig",t),this.vu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Wu(){try{this.config.loaded(this)}catch(t){Ar.critical("`loaded` function failed",t)}if(this.Xu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.pu())&&this.Yu()},1),this.tc=new Aw(this),this.tc.load()}Xu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Nu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Fr(this.__request_queue,t=>this.qu(t)),this.__request_queue=[],this.Xu()}_handle_unload(){var t,e,i,n,s,r;this.xu=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.ec()&&this.capture(ee),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.Nu)||void 0===s||s.unload(),null===(r=this.ju)||void 0===r||r.unload()):this.ec()&&this.capture(ee,null,{transport:"sendBeacon"})}_send_request(t){ek(this,t)}qu(t,e){this.ju?this.ju.retriableRequest(t,e):this._send_request(e?ue(ue({},t),{},{transport:e}):t)}_execute_array(t){$k++;try{let e;const i=[],n=[],s=[];Fr(t,t=>{if(t)if(e=t[0],Se(e))s.push(t);else if(xe(t))try{t.call(this)}catch(e){Ar.error("Error executing queued PostHog call",t,e)}else Se(t)&&"alias"===e?i.push(t):Se(t)&&-1!==e.indexOf("capture")&&xe(this[e])?s.push(t):n.push(t)});const r=function(t,e){Fr(t,function(t){try{if(Se(t[0])){let i=e;Dr(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Ar.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{$k--}}push(t){if($k>0&&Se(t)&&Ee(t[0])){const i=e.prototype[t[0]];return void(xe(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nc(){return{property:F,persistenceKey:D,cookieName:"_fbc",pattern:Fk,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[D]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(D)}}}get sc(){return{property:L,persistenceKey:N,cookieName:"_fbp",pattern:Dk,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[N]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(N)}}}rc(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Ee(i)&&t.pattern.test(i)?{value:i,delivered:!1}:$e(i)&&Ee(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}oc(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ac(t){if(!this.config.save_campaign_params||this.pu())return;const e=ml(t.cookieName);return Ee(e)&&t.pattern.test(e)?e:void 0}lc(t,e,i,n){if(!this.persistence)return;const s=this.nc;this.persistence.refreshKey(s.persistenceKey);const r=this.rc(s);if(n)return void s.unregister();if(i)return Ee(e)&&Fk.test(e)?this.oc(s,e,r):void s.unregister();const o=Ee(t)&&Ok.test(t)?t:void 0,a=this.ac(s);return a&&((t,e,i)=>{const n=t.split(".");if(e)return n[3]===e;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(a,o,r)?this.oc(s,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.oc(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}uc(t,e,i){if(!this.persistence)return;const n=this.sc;this.persistence.refreshKey(n.persistenceKey);const s=this.rc(n);if(i)return void n.unregister();if(e)return Ee(t)&&Dk.test(t)?this.oc(n,t,s):void n.unregister();const r=this.ac(n);return r?this.oc(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}cc(t,e){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.rc(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}capture(t,e,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Nu))return void Ar.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Te(t)||!Ee(t))return void Ar.error("No event name provided to posthog.capture");if(this.bu(),"$snapshot"===t&&this.pu())return;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 Ar.critical("This capture call is ignored due to client rate limiting.");let a;(null==e?void 0:e.$current_url)&&!Ee(null==e?void 0:e.$current_url)&&(Ar.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||(null==i?void 0:i.hc)||Ar.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,u=(null==i?void 0:i.timestamp)||l,c=ln(null==i?void 0:i.uuid,Sl);let h={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},u,c)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),o&&(h.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const d="$feature_flag_called"===t&&!1===h.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!d&&(h.$set=null==i?void 0:i.$set);const v=$e(null==e?void 0:e.$set)?e.$set:void 0,f=Se(null==e?void 0:e.$unset)?e.$unset:[],p=(null==i?void 0:i.$unset)||[],g=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!v&&t in v,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},m=g(F),y=g(L),b=[{channel:this.nc,hasProvided:m.hasProvided,update:this.lc(null==a?void 0:a.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.sc,hasProvided:y.hasProvided,update:this.uc(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:e,update:i}of b)i&&!0===h.properties.$process_person_profile&&i.pending&&!e&&!d&&(h.$set=ue({[t.property]:i.value},h.$set));const _=null==i?void 0:i.$unset;_&&(h.$unset=_);const w=d?void 0:this.dc(null==i?void 0:i.$set_once,t!==ne,t===ie);if(w&&(h.$set_once=w),(null==i?void 0:i._noTruncate)||(k=this.config.properties_string_max_length,h=function(t,e){const i=new Set;return function t(n,s){if(n!==Object(n))return e?e(n):n;if(i.has(n))return;let r;if(i.add(n),Se(n))r=[],Fr(n,e=>{r.push(t(e))});else{const e={};Dr(je(n)?Br(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(h,t=>Ee(t)?t.slice(0,k):t)),h.timestamp=u,Te(null==i?void 0:i.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=l),d&&(h.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return us.forEach(n),e.forEach(n),i})(h.properties,Lk)),t===$g.DISMISSED||t===$g.SENT){const i=null==e?void 0:e[Cg.SURVEY_ID],n=null==e?void 0:e[Cg.SURVEY_ITERATION];Dg({id:i,current_iteration:n}),h.$set=ue(ue({},h.$set),{},{[Yl({id:i,current_iteration:n},t===$g.SENT?"responded":"dismissed")]:!0})}else t===$g.SHOWN&&(h.$set=ue(ue({},h.$set),{},{[Cg.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var k;if(t===Ew.SHOWN){const t=null==e?void 0:e[Iw.TOUR_TYPE];t&&(h.$set=ue(ue({},h.$set),{},{[`${Iw.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const S=ue(ue({},h.properties.$set),h.$set);if(Ce(S)||this.setPersonPropertiesForFlags(S),!Re(this.config.before_send)){const t=this.Os(h);if(!t)return;h=t,h.uuid=ln(h.uuid,Sl)}this.sessionRecording&&!this.Eu&&Ak(t)&&(this.Eu=!0,setTimeout(()=>this.Eu=!1,3e4));const x=b.filter(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=h.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:$e(null===(s=h.properties)||void 0===s?void 0:s.$set)?h.properties.$set[t.property]:void 0;return(null==e?void 0:e.pending)&&r===e.value});this.lu.emit("eventCaptured",h);const C=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(C),E=ue(ue(ue({method:"POST",url:C,data:h,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:T?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},T&&(null===(s=h.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),x.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:e}of x)this.cc(t,e.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)){var I;let t;!E.transport&&!E.callback&&Ce(null!==(I=this.config.request_headers)&&void 0!==I?I:{})&&this.xu&&(t="sendBeacon"),this.qu(E,t)}else this.Nu.enqueue(E);return h}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.vc)||void 0===e?void 0:e.getExtension(t)}Qu(){var t;return null!==(t=this.vc)&&void 0!==t?t:this.vc=new Sk(this)}cu(t){this.Mu.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.Mu.indexOf(t);-1!==i&&this.Mu.splice(i,1)}}fc(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Fu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.Tu.clear(),this.gc()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.bu(),this.persistence.syncCookieProperties(),this.fc();const l=a?void 0:this.persistence.remove_event_timer(e);let c=ue({},i);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.pu()&&(c[Ot]=!0),"$snapshot"===e){const t=ue(ue({},this.persistence.properties()),this.sessionPersistence.properties());return c.distinct_id=t.distinct_id,(!Ee(c.distinct_id)&&!Pe(c.distinct_id)||Ie(c.distinct_id))&&Ar.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}const h=function(e,i,n,r=!1){var o,a,l,c;if(!u)return{};const h=e?[..._u,...i||[]]:[],[d,v]=Zi(u),[f,p]=function(t){for(let e=0;Xi.length>e;e++){const[i,n,s]=Xi[e],r=t.match(i);if(r){const e=s&&t.match(s)||r;return[n,(null==e?void 0:e[1])||""]}}return["",""]}(u),g=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};Te(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,_=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,w=null==t||null===(l=t.screen)||void 0===l?void 0:l.width,k=null==t||null===(c=t.screen)||void 0===c?void 0:c.height,S=null==t?void 0:t.devicePixelRatio;Te(b)||(y.userAgentDataPlatform=b),Te(_)||(y.maxTouchPoints=_),Te(w)||(y.screenWidth=w),Te(k)||(y.screenHeight=k),Te(S)||(y.devicePixelRatio=S);const x=Lr(jr({$os:d,$os_version:v,$browser:Wi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Ji(u),$device_type:Ki(u,y),$timezone:bu(),$timezone_offset:Au()}),{$current_url:to(r?cn(null==s?void 0:s.href):null==s?void 0:s.href,h,ku),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Gi(u,navigator.vendor,g,m),$browser_language:Tu(),$browser_language_prefix:Eu(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:Rr.LIB_NAME,$lib_version:Rr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Rr.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Rr.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:e}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);c.$session_id=t,c.$window_id=e}this.sessionPropsManager&&Lr(c,this.sessionPropsManager.getSessionProps());try{var d;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,i=!this.Eu&&Ak(e);for(const e in t)(i||ge(Rk,e))&&(c[e]=t[e])}c.$sdk_debug_retry_queue_size=null===(d=this.ju)||void 0===d?void 0:d.length}catch(t){c.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===fk&&(c.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||a?"$pageleave"!==e||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),c=Lr(c,v),"$pageview"===e&&n&&(c.title=n.title),!Te(l)){const t=r.getTime()-l;c.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=c.$groups,m=f.$groups;$e(g)&&!Ce(g)&&(c.$groups=ue(ue({},$e(m)?m:{}),g)),Dr(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.Mu.length>0)for(const t of this.Mu.slice())try{Lr(y,t())}catch(t){Ar.error("Failed to produce browser extension event properties",t)}c=Lr({},h,f,p,ue(ue({},y),c)),c.$is_identified=this._isIdentified(),Se(this.config.property_denylist)?Dr(this.config.property_denylist,function(t){delete c[t]}):Ar.error(Mk+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const b=this.config.sanitize_properties;b&&(Ar.error(Ik),c=b(c,e));const _=this.mc();return c.$process_person_profile=_,_&&!a&&this.yc("_calculate_event_properties"),c}dc(t,e=!0,i=!1){var n;if(!this.persistence||!this.mc())return t;if(this.Cu&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Lr({},s,r||{},t||{});const a=this.config.sanitize_properties;return a&&(Ar.error(Ik),o=a(o,"$set_once")),e&&(this.Cu=!0),Ce(o)?void 0:o}register(t,e){var i;null===(i=this.persistence)||void 0===i||i.register(t,e)}register_once(t,e,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(t,e,i)}register_for_session(t){var e,i;null===(e=this.persistence)||void 0===e||e.syncCookieProperties(),this.fc(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.Tu.add(t)),this.gc()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.Tu.delete(t),this.gc()}bc(t,e){this.register({[t]:e})}Bu(){this.Tu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.Tu.clear(),this.gc()}gc(){var t;if(!this.Iu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.hi)||!Hl.At())return void Hl.Pt(this.Iu);const e=[];this.Tu.forEach(t=>e.push(t)),e.length>0?Hl.$t(this.Iu,e):Hl.Pt(this.Iu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.lu.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ek}),()=>{})}onSessionId(t){var e,i;return null!==(e=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e=!1){this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Ek})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Ek})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Ek}),()=>{})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=Ng){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null===(e=this.surveys)||void 0===e||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Ek}}canRenderSurveyAsync(t,e=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Ek})}_c(t){return!t||Ie(t)?(Ar.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ar.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ar.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Ar.uninitializedWarning("posthog.identify");if(Pe(t)&&(t=t.toString(),Ar.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this._c(t))return;if(!this.yc("posthog.identify"))return;this.bu();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.fc(!1),o=this.persistence.Oa();let a=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(A),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Jt,u=t!==n,c=!u&&o;if(u&&o){var l;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property(Ct,Kt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.Fu=hu(t,e,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(c){this.persistence.set_property(Ct,Kt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:n,$set_once:s})&&(this.Fu=hu(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(k)):c&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.qa(a)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.yc("posthog.setPersonProperties"))return;const i=hu(this.get_distinct_id(),t,e);this.Fu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Fu=i)):Ar.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(Se(t)?t:[t]).filter(t=>Ee(t)&&t.length>0);0!==i.length&&this.yc("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Fu=null)}group(t,e,i){var n;if(!t||!e)return void Ar.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.fc();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ue(ue({},s),{},{[t]:e})}),(r||i)&&this.mc()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ne,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t=!0){var e;null===(e=this.featureFlags)||void 0===e||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e=!0){var i;this.yc("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Oe(t)?t:null==t?void 0:t.resetDeviceID,i=Oe(t)||null==t?void 0:t.bootstrap;this.wc(e,!1,i)}wc(t,e=!1,i){var n,s,r,o,a,l;if(Ar.info("reset"),!this.__loaded)return Ar.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Du)||void 0===n?void 0:n.bootstrap)||{},null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.il());const c=this.get_property(R),h=this.get_property(P),d=this.get_property(J);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();e||this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(a=this.persistence)||void 0===a||null===(l=a.Oa)||void 0===l?void 0:l.call(a),p=this._u;this._u=p||e;let g=!1;try{var m,y,b,_,w,k,S,x,C,T,E,I,M;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this.Tu.clear(),this.gc(),Te(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(b=this.surveys)||void 0===b||b.reset(),null===(_=this.featureFlags)||void 0===_||_.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(x=this.persistence)||void 0===x||x.set_property("$user_state","anonymous"),null===(C=this.sessionManager)||void 0===C||C.resetSessionId(),this.Fu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:At,$device_id:null},"");else{const e=this.config.get_device_id(Sl());this.register_once({distinct_id:e,$device_id:t?e:c},""),t||Te(h)||this.register({[P]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.pu()&&(null===(M=this.persistence)||void 0===M||M.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(E=this.featureFlags)||void 0===E||E.initialize(),!Re(u)&&!(null===(I=this.sessionManager)||void 0===I?void 0:I.setBootstrapSessionId(u,!0))){const t=ue({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var A,O;this._u=p,f&&(null===(A=this.persistence)||void 0===A||null===(O=A.qa)||void 0===O||O.call(A,g))}this.reloadFeatureFlags()}shutdown(t){var e=this;return re(function*(){if(!e.__loaded)return void Ar.uninitializedWarning("posthog.shutdown");e.$u=!0,clearTimeout(e.Hu),e.Hu=void 0;const t=e.Zu;e.Zu=void 0;for(const i of[()=>{var t;return null===(t=e.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=e.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=e.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=e.Nu)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.ju)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=e.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=e.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=i();t&&xe(t.then)&&t.then(void 0,t=>{Ar.error("Error during shutdown",t)})}catch(t){Ar.error("Error during shutdown",t)}})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.kc()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.Sc()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null===(e=this.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${e}`);if((null==t?void 0:t.withTimestamp)&&i){var s;const e=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-e,0)}`}return n}alias(t,e){return t===this.get_property("$people_distinct_id")?(Ar.critical("Attempting to create alias for existing People user - aborting."),-2):this.yc("posthog.alias")?(Te(e)&&(e=this.get_distinct_id()),t!==e?(this.bc(A,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ar.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=ue({},this.config);if($e(t)){var i,n,s,r,o,a,l,u,c,h,d,v,f,p;Lr(this.config,zk(t));const _=this.Su();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var g,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(g=this.sessionPersistence)||void 0===g||g.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,e,_),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Cw(ue(ue({},this.config),{},{persistence:"sessionStorage"}),_,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(ue(ue({},this.config),{},{persistence:"sessionStorage"}),ue(ue({},e),{},{persistence:"sessionStorage"}),_)}}const w=this.Ou(this.config.debug);var b;Oe(w)&&(this.config.debug=w),Oe(this.config.debug)&&(this.config.debug?(Wl.DEBUG=!0,Ml.At()&&Ml.$t("ph_debug",!0),Ar.info("set_config",{config:t,oldConfig:e,newConfig:ue({},this.config)})):(Wl.DEBUG=!1,Ml.At()&&Ml.Pt("ph_debug"))),null===(i=this.featureFlags)||void 0===i||null===(n=i.updateConfig)||void 0===n||n.call(i,this.config,this.il()),null===(s=this.exceptionObserver)||void 0===s||s.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(a=this.webMCP)||void 0===a||a.startIfEnabled(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(h=this.heatmaps)||void 0===h||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.wu(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&rw(this,Ck,!1)}}_overrideSDKInfo(t,e){Wl.LIB_NAME=t,Wl.LIB_VERSION=e}startSessionRecording(t){const e=!0===t,i={sampling:e||!!(null==t?void 0:t.sampling),linked_flag:e||!!(null==t?void 0:t.linked_flag),url_trigger:e||!!(null==t?void 0:t.url_trigger),event_trigger:e||!!(null==t?void 0:t.event_trigger)};var n,s,r,o,a;Object.values(i).some(Boolean)&&(null===(n=this.sessionManager)||void 0===n||n.checkAndGetSessionAndWindowId(),i.sampling&&(null===(s=this.sessionRecording)||void 0===s||s.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 t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,e){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(ue(ue({},i),e))}catch(t){return}}addExceptionStep(t,e){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(t,e)}captureLog(t){var e;null===(e=this.logs)||void 0===e||e.captureLog(t)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e.xc}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null===(e=this.persistence)||void 0===e?void 0:e.props[t]}getSessionProperty(t){var e;return null===(e=this.sessionPersistence)||void 0===e?void 0:e.props[t]}toString(){var t;let e=null!==(t=this.config.name)&&void 0!==t?t:Nk;return e!==Nk&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(e=this.sessionPersistence)||void 0===e?void 0:e.get_property("$user_state"))}mc(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Ce(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.$epp))}ec(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.mc()||this.yc("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.yc("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}yc(t){return"never"===this.config.person_profiles?(Ar.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gu(),this.bc(Pt,!0),!0)}Su(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}wu(){var t,e;const i=this.Su();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.$c(),(null===(t=this.persistence)||void 0===t?void 0:t.hi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.hi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),this.gc(),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.pu()){var n,s,r,o,a,l;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.wc(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new hk(this),this.pageViewManager=new uw(this),this.persistence&&(this.sessionPropsManager=new ak(this,this.sessionManager,this.persistence));const t=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=e.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var u,c;t&&(this.sessionRecording=this.fu(this.sessionRecording,new t(this)),this.uu&&(null===(u=this.sessionRecording)||void 0===u||null===(c=u.onRemoteConfig)||void 0===c||c.call(u,this.uu)))}var h,d;this.consent.optInOut(!0),this.wu(),this.Xu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(h=this.surveys)||void 0===h||h.loadIfEnabled()),(Te(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Yu()}else Ar.warn(Tk)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.wu(),"on_reject"===this.config.cookieless_mode&&this.ku()):Ar.warn(Tk)}ku(){var t,e;const i=this.sessionRecording;null==i||i.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.wc(!0,!0),this.register({distinct_id:At,$device_id:null}),this.du(i),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(e=this.pageViewManager)||void 0===e||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Yu(),this.Xu()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this._u&&("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.wu()}_is_bot(){return i?dk(i,this.config.custom_blocked_useragents):void 0}Yu(){n&&("visible"===n.visibilityState?this.Pu||(this.Pu=!0,this.capture(te,{title:n.title},{send_instantly:!0}),this.Ru&&(n.removeEventListener(E,this.Ru),this.Ru=null)):this.Ru||(this.Ru=this.Yu.bind(this),Hr(n,E,this.Ru)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}il(){const t=this.Du||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ar.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,e,i,n,s){const r=e in t&&!Re(t[e]),o=i in t&&!Re(t[i]);return r?t[e]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Ar)}Os(t){var e;if(Re(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Le),n=Se(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Re(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return De(t.event)?Ar.warn(`${e}. This can cause unexpected behavior.`):Ar.info(e),null}s.properties&&!Ce(s.properties)||Ar.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Ar.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Re(s.properties[e]))return Ar.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Wo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Ou(t){const e=Oe(t)&&!t,i=Ml.At()&&"true"===Ml.Ot("ph_debug");return!e&&(!!i||t)}};Hk.__defaultExtensionClasses={},Hk.xc=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=qr(t.prototype[e[i]])}(Hk,["identify"]);var Wk=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=$e(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.il(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const Vk=Or("[ExceptionAutocapture]"),Gk=Or("[TracingHeaders]"),Qk=Or("[Web Vitals]"),Zk=9e5,Jk=["CLS","FCP","INP","LCP"],Kk=["INP","LCP"],Yk=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Xk=Or("[SessionRecording]"),tS=[Lt,Nt,qt,jt,Bt,zt,Ut,Ht,Wt],eS=Or("[Heatmaps]");function iS(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Pe(t.clientX)&&Pe(t.clientY)}const nS=Or("[Product Tours]"),sS=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(G))},rS=["$set_once","$set"],oS=Or("[SiteApps]"),aS="Error while initializing PostHog app with config id ",lS=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),uS="SDK is not enabled or survey functionality is not yet loaded",cS="Disabled. Not loading surveys.";var hS=class{constructor(t,e){this.wo=t,this.Cc=e,this.name=zg,this._surveyEventReceiver=null,this._surveyManager=null,this.Tc=!1,this.Ic=!1,this.Mc=[],this.Ec=[],this.Pc=null,this.Rc=null,this.To=!1,this.Ac=new Set,this.onRemoteConfig=t=>{if(this.To)return;if(this.Mr.disableSurveys)return;if(!t.ok)return this.Ic=!0,this.Fc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Ig.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Ig.warn("Flags not loaded yet. Not loading surveys.");this.Oc=Oe(e)?e:e.length>0,Ig.info(`flags response received, isSurveysEnabled: ${this.Oc}`),this.loadIfEnabled()},this.Fc=t=>{this.Ec.slice().forEach(e=>this.Dc(e,t))}}setup(t){if(!this.To)return this.Lc=t,lS(t.kv.initialize(),()=>{if(this.Lc!==t||this.To)return;this.Lc=void 0,this.bo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.To?e.dispose():(this.Eo=e,this.loadIfEnabled())})}dispose(){var t,e,i,n,s;this.To||(this.To=!0,this.Lc=void 0,this.bo=void 0,null===(t=this.Eo)||void 0===t||t.dispose(),this.Eo=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.Mc=[],this.Ec.forEach(t=>{t.active=!1}),this.Ec=[],null===(s=this.Nc)||void 0===s||s.call(this),this.Nc=void 0,this.Pc=null,this.Ac.forEach(t=>clearTimeout(t)),this.Ac.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.clearInMemoryInProgressSurveyState)||void 0===e||e.call(t);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.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(t=>localStorage.removeItem(t))}catch(t){}this.Fc()}loadIfEnabled(){if(this.To||!this.bo)return;const t=this.Mr;if(this._surveyManager)return;if(this.Tc)return void Ig.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Ig.info(cS);if(t.cookielessMode&&this.wo.isOptedOut())return void Ig.info("Not loading surveys in cookieless mode without consent.");const e=this.wo.getExtensions();if(!e)return void this.qc("PostHog Extensions not found.");if(Te(this.Oc)&&!t.advancedEnableSurveys)return;const i=this.Oc||t.advancedEnableSurveys;this.Tc=!0,this.Ic=!1;try{const t=e.generateSurveys;if(t)return this.jc(t,i),void(this.Tc=!1);const n=e.loadExternalDependency;if(!n)return this.qc(Zt),void(this.Tc=!1);n(t=>{try{if(this.To)return;const e=this.wo.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.qc("Could not load surveys script",t):this.jc(e.generateSurveys,i)}finally{this.Tc=!1}})}catch(t){throw this.Tc=!1,this.qc("Error initializing surveys",t),t}}jc(t,e){var i,n;if(this.To)return;this._surveyManager=t(e),this._surveyEventReceiver=this.wo.createEventReceiver(this.Fc);const s=null===(i=null!==(n=this.bo)&&void 0!==n?n:this.Cc)||void 0===i?void 0:i.kv.get(ft);s&&this.Bc(s),Ig.info("Surveys loaded successfully"),this.zc(),this.Fc(),this.Hc({isLoaded:!0})}qc(t,e){this.Ic=!0,Ig.error(t,e),this.Fc({isLoaded:!1,error:t}),this.Hc({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Mc.push(t),this._surveyManager&&this.Hc({isLoaded:!0}),()=>{this.Mc=this.Mc.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.bo)&&void 0!==i?i:this.Cc;if(!n||this.To)return;if(this.Mr.disableSurveys)return Ig.info(cS),t([]);const s=n.kv.get(ft);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Uc()&&this.getSurveys(()=>{},!0));if(this.Pc)return void this.Pc.then(({surveys:e,context:i})=>{this.To||t(e,i)}).catch(t=>Ig.error("Error in survey callback",t));const r=this.Wc("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{try{return this.Vc(n,t)}catch(t){return Ig.error("Error processing surveys response",t),this.Vc(n,{statusCode:0,error:t})}},t=>this.Vc(n,{statusCode:0,error:t}));this.Pc=r;const o=()=>{this.Pc===r&&(this.Pc=null)};r.then(e=>{o(),this.To||(this.Fc(e.context),t(e.surveys,e.context))},o).catch(t=>Ig.error("Error in survey callback",t))}Wc(t,e){const i=this.bo;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(uS)}))}Vc(t,e){if(this.To)return{surveys:[],context:{isLoaded:!1,error:uS}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Ig.error(t):e.error||Ig.warn(t),this.Rc=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Rc=null;const n=e.json.surveys||[];return t.kv.set({[ft]:n,[pt]:Date.now()}),this.Bc(n),{surveys:n,context:{isLoaded:!0}}}Bc(t){var e;const i=t.filter(t=>Pg(t)&&(su(t)||Ag(t)));null===(e=this._surveyEventReceiver)||void 0===e||e.replace(i)}Uc(){return this.Gc()&&!this.Pc&&!this.Qc()}Gc(){var t,e;const i=null===(t=null!==(e=this.bo)&&void 0!==e?e:this.Cc)||void 0===t?void 0:t.kv.get(pt);return Pe(i)&&Date.now()-i>3e5}Qc(){return Pe(this.Rc)&&3e5>Date.now()-this.Rc}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};Dg(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.Fc()}Hc(t){for(const e of this.Mc)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ig.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ig.warn("init was not called")}onActiveMatchingSurveysChanged(t){var e,i;if(this.To)return()=>{};const n={callback:t,active:!0,revision:0};this.Ec.push(n),this.zc();const s=null===(e=null!==(i=this.bo)&&void 0!==i?i:this.Cc)||void 0===e?void 0:e.kv.get(ft);return this.Mr.disableSurveys||!this._surveyManager&&this.Ic&&!this.Tc||!s&&!Re(this.Rc)&&!this.Pc?this.Dc(n,{isLoaded:!1}):this._surveyManager&&this.Dc(n),()=>{var t;n.active=!1,this.Ec=this.Ec.filter(t=>t!==n),0===this.Ec.length&&(null===(t=this.Nc)||void 0===t||t.call(this),this.Nc=void 0)}}zc(){var t,e,i;this._surveyManager&&this.Ec.length>0&&(null!==(t=this.Nc)&&void 0!==t||(this.Nc=null===(e=(i=this.wo).onMatchingConditionsChanged)||void 0===e?void 0:e.call(i,this.Fc)))}Dc(t,e){if(this.To||!t.active)return;const i=++t.revision,n=n=>{if(!this.To&&t.active&&i===t.revision)try{const i=null!=e?e:{isLoaded:!0},s=JSON.stringify([n,i]);if(s===t.lastResult)return;t.lastResult=s,t.callback(n,i)}catch(t){Ig.error("Error in active matching surveys callback",t)}};try{e&&!e.isLoaded?n([]):this.getActiveMatchingSurveys(n)}catch(t){Ig.error("Error in active matching surveys callback",t)}}Zc(t){let e=null;return this.getSurveys(i=>{var n;e=null!==(n=i.find(e=>e.id===t))&&void 0!==n?n:null}),e}Jc(t){if(Re(this._surveyManager))return{eligible:!1,reason:uS};const e="string"==typeof t?this.Zc(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Kc(t){if(!this.wo.isCapturing())return{eligible:!1,reason:Mg};if(Re(this._surveyManager))return{eligible:!1,reason:uS};const e="string"==typeof t?this.Zc(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Ig.warn("init was not called"),{visible:!1,disabledReason:uS};const e=this.Kc(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Ig.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:uS})):new Promise(i=>{this.getSurveys(e=>{var n;const s=null!==(n=e.find(e=>e.id===t))&&void 0!==n?n:null;if(s){const t=this.Kc(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.wo.isCapturing())return;if(Re(this._surveyManager))return void Ig.warn("init was not called");const r="string"==typeof t?this.Zc(t):t;if(!(null==r?void 0:r.id))return void Ig.warn("Survey not found");if(!Lg.includes(r.type))return void Ig.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Ig.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.Ac.delete(t),!this.To&&this.wo.isCapturing()&&(Ig.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Ig.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Ac.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Ig.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.wo.isCapturing())return;if(Re(this._surveyManager))return void Ig.warn("init was not called");const n=this.Zc(t);if(!n)return void Ig.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=ue(ue({},n),{},{appearance:ue(ue({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Tg.Popover&&e.initialResponses&&Ig.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Jc(n);if(!t.eligible)return void Ig.warn("Survey is not eligible to be displayed: ",t.reason)}e.displayType!==Tg.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Ig.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function dS(t,e,i){if(Re(t))return!1;switch(i){case"exact":return t===e;case"contains":{const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}var vS=class{constructor(t){this._instance=t,this.Xc=new Set,this.Yc=new Set,this.th=new lk,this.eh=(t,e)=>this.ih(t,e)&&this.nh(t,e)&&this.sh(t,e)&&this.rh(t,e),this.ih=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Te(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.oh=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t,e;null===(t=this.oh)||void 0===t||t.call(this),this.oh=void 0,null===(e=this._instance)||void 0===e||null===(e=e.autocapture)||void 0===e||e.setElementSelectors(new Set,this),this.th=new lk}register(t){var e,i;if(!Te(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Xc.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Yc.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Xc.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t,this)}}replace(t){this.Xc.clear(),this.Yc.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Yc.has(t)||this.Yc.has(e.event))&&this.Xc.forEach(t=>{this.ah(e,t)&&this.th.emit("actionCaptured",t.name)})}uh(t){this.onAction("actionCaptured",e=>t(e))}ah(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.eh(t,i))return!0;return!1}onAction(t,e){return this.th.on(t,e)}nh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!dS(n,e.url,e.url_matching||"contains"))return!1}return!0}sh(t,e){return!!this.hh(t,e)&&!!this.dh(t,e)&&!!this.fh(t,e)}hh(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.ph(t);if(n.length>0)return n.some(t=>dS(t.href,e.href,e.href_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&dS(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}dh(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.ph(t);if(n.length>0)return n.some(t=>dS(t.text,e.text,e.text_matching||"exact")||dS(t.$el_text,e.text,e.text_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(t){const e=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Re(n=i.exec(t));)e.includes(n[1])||e.push(n[1]);return e}(s),o=e.text,a=e.text_matching||"exact",r.some(t=>dS(t,o,a)));var r,o,a}fh(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}ph(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}rh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||uu(e.properties.reduce((t,e)=>{const i=Se(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t},{}),null==t?void 0:t.properties)}},fS=class{constructor(t,e){var i,n;this.gh=[],this._instance=t,this.mh=e,this.yh=new Map,this.bh=new Map,this._h=new Map,this.wh=null===(i=this._instance)||void 0===i||null===(n=i.onSessionId)||void 0===n?void 0:n.call(i,t=>this.kh(t))}Sh(t){return!1}xh(){return null}$h(t){}Ch(){}Th(t,e){return!!t&&uu(t.propertyFilters,null==e?void 0:e.properties)}Ih(t,e){const i=new Map;return t.forEach(t=>{var n;null===(n=t.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(e=>{if(null==e?void 0:e.name){const n=i.get(e.name)||[];n.push(t.id),i.set(e.name,n)}})}),i}Mh(t,e,i){const n=(i===mg.Activation?this.yh:this.bh).get(t);let s=[];return this.Eh(t=>{s=t.filter(t=>null==n?void 0:n.includes(t.id))}),s.filter(n=>{var s;const r=null===(s=n.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s?void 0:s.find(e=>e.name===t);return this.Th(r,e)})}register(t){this.Ph(t,!1)}replace(t){this.Ph(t,!0)}Ph(t,e){var i;Te(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.Rh(t,e),this.Ah(t,e))}Ah(t,e){const i=t.filter(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length});var n;if(e&&this._h.clear(),0===i.length)return void(e&&(null===(n=this.Fh)||void 0===n||n.replace([])));this.Fh||(this.Fh=new vS(this._instance),this.Fh.init(),this.Fh.uh(t=>this.onAction(t)));const s=[];i.forEach(t=>{var e;null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||e.values.forEach(e=>{if(s.push(e),e.name){var i;const n=null!==(i=this._h.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this._h.set(e.name,n)}})}),e?this.Fh.replace(s):this.Fh.register(s)}Oh(t,e){e.forEach((e,i)=>{var n;const s=null!==(n=t.get(i))&&void 0!==n?n:[];e.forEach(t=>{s.includes(t)||s.push(t)}),t.set(i,s)})}Rh(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.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.Ih(t,mg.Activation),a=this.Ih(t,mg.Cancellation);e?(this.yh=o,this.bh=a):(this.Oh(this.yh,o),this.Oh(this.bh,a)),(0!==s.length||0!==r.length||t.some(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length}))&&(null!==(i=this.oh)&&void 0!==i||(this.oh=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Dh(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const i=this.Lh(t,r,e);if("consume"===i)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Nh([r]);if("persist"===i)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.qh(r),void this.jh([r])}if(this.bh.has(t)){const i=this.Mh(t,e,mg.Cancellation);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Nh(i.map(t=>t.id)),i.forEach(t=>this.Bh(t.id)))}if(!this.yh.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.yh.get(t)});const o=this.Mh(t,e,mg.Activation);this.zh(o.map(t=>t.id))}onAction(t){this._h.has(t)&&this.zh(this._h.get(t)||[])}zh(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.Sh(e)?this.qh(e)&&this.Hh(e):s.push(e);s.length>0&&(this.gh=[...new Set([...this.gh,...s])]),this.Dh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uh()}qh(t){this.gh=this.gh.filter(e=>e!==t);const e=this.Wh();return!e.includes(t)&&(this.Vh([...e,t]),this.Gh(),!0)}Nh(t){const e=new Set(t);this.gh=this.gh.filter(t=>!e.has(t));const i=this.Qh(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Vh(n),0===n.length&&this.Zh()),this.jh(t),this.Uh()}Uh(){try{var t;null===(t=this.mh)||void 0===t||t.call(this)}catch(t){this.Dh().error("Error while handling activated items change",t)}}Jh(){var t;const e=this.xh();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Hh(t){if(!this.xh())return;const e=this.Jh();this.$h(ue(ue({},e),{},{[t]:Date.now()}))}jh(t){if(!this.xh())return;const e=this.Jh(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(Ce(i)?this.Ch():this.$h(i))}Kh(){this.xh()&&this.Ch()}getActivationTimestamp(t){if(!this.Wh().includes(t))return;const e=this.Jh()[t];return Pe(e)?e:void 0}Qh(){var t;const e=this.Xh();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}Wh(){var t,e,i;const n=this.Qh();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Yh()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}Gh(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.td(i)}Zh(){this.ed()}kh(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Yh()];if(i&&i!==t){const t=this.Qh(),e=this.Jh();t.length>0&&(this.Vh([]),t.filter(t=>Pe(e[t])).forEach(t=>this.Bh(t))),this.Zh(),this.Kh(),t.length>0&&this.Uh()}}getActivatedIds(){return[...new Set([...this.Wh(),...this.gh])].filter(t=>!this.nd(t))}dispose(){var t,e,i;null===(t=this.wh)||void 0===t||t.call(this),this.wh=void 0,null===(e=this.oh)||void 0===e||e.call(this),this.oh=void 0,null===(i=this.Fh)||void 0===i||i.dispose(),this.Fh=void 0}reset(){this.gh=[],this.Qh().length>0&&this.Vh([]),this.Zh(),this.Kh(),this.Uh()}getEventToItemsMap(){return this.yh}sd(){return this.Fh}},pS=class extends fS{constructor(t,e){super(t,e)}Xh(){return gt}Yh(){return mt}xh(){return yt}$h(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}Ch(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}Sh(t){var e;let i;this.Eh(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Pe(n)&&n>0}rd(){return $g.SHOWN}Eh(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Bh(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}Dh(){return Ig}Vh(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}td(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}ed(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}nd(){return!1}Lh(t,e,i){var n;if(t===$g.SENT&&!1===(null==i||null===(n=i.properties)||void 0===n?void 0:n.$survey_completed))return"ignore";let s;return this.Eh(t=>{s=t.find(t=>t.id===e)}),!s||ru(s)?t===$g.SHOWN?"consume":"ignore":t===$g.SHOWN?"persist":t===$g.DISMISSED||t===$g.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},gS=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Te(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},mS=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==h?void 0:h.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(t){return new pS(this._instance,t)}onMatchingConditionsChanged(e){const i=this._instance._addCaptureHook(t=>{"$pageview"!==t&&t!==$g.SHOWN&&t!==$g.DISMISSED&&t!==$g.SENT||e()}),n=()=>e();Hr(t,"PHSurveyShown",n);let s=!1;const r=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,i(),r(),null==t||t.removeEventListener("PHSurveyShown",n)}}};const yS=(null==t?void 0:t.location)?eo(t.location.hash,"__posthog")||eo(location.hash,"state"):null,bS="_postHogToolbarParams",_S=Or("[Toolbar]"),wS=Or("[FeatureFlags]"),kS=Or("[FeatureFlags]",{debugEnabled:!0}),SS="\" failed. Feature flags didn't load in time.",xS=[502,504],$S=["click","keydown","wheel","touchstart","pointerdown"],CS="connection_error",TS=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},ES=t=>{const e={};for(const[i,n]of Nr(t||{}))n&&(e[i]=n);return e};var IS=class{constructor(t){this.name="featureFlags",this.od=!1,this.featureFlagEventHandlers=[],this.A=wS,this.ad={},this.ld={},this.ud=[],this.hd=new Set,this.dd=new Set,this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const t=this.kd();this._d=0,t&&this.reloadFeatureFlags()},this.Sd=()=>{var t,e;const i=this.xd,n=null!==(t=this.$d)&&void 0!==t?t:i;Te(i)||Te(n)||this.Mr.remoteRequestsDisabled||!this.Cd||"hidden"===this.Cd.visibilityState||Date.now()-(null!==(e=this.Td)&&void 0!==e?e:0)<n||(this.$d=this.wd||!this.Mr.idleRefreshBackoff?i:Math.min(2*n,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Id())},this.Md=()=>{this.wd&&this.$d===this.xd||this.Ed()},this.sn=()=>{var t;"visible"===(null===(t=this.Cd)||void 0===t?void 0:t.visibilityState)&&this.Ed()},this.wo=t}get Pd(){}Rd(){this.bo&&this.Ad()}setup(t){try{this.Fd=typeof window>"u"?void 0:window,this.Cd=typeof document>"u"?void 0:document}catch(t){this.Fd=void 0,this.Cd=void 0}return this.Lc=t,this.A=t.logger.createLogger("[FeatureFlags]"),lS(t.kv.initialize(),()=>{this.Lc===t&&(this.Lc=void 0,this.bo=t,this.Od(t))})}Od(t){var e;if(this.bo===t)return this.Fd&&Hr(this.Fd,"online",this.rn),this.Ad(),this.Dd=t.registerDynamicEventProperties(()=>this.Ld()?this.ad:this.ld),this.Nd=null===(e=this.Pd)||void 0===e?void 0:e.onCrossTabFeatureFlagChange(()=>{this.qd(),this.jd(),this.Bd()}),this.jd(),this.initialize()}Ed(){this.wd=!0,this.$d=this.xd,this.Sd()}Ad(){var t;const e=this.Mr.refreshIntervalMs,i=!this.Mr.remoteRequestsDisabled&&this.Cd&&!Te(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.$d=i),i!==this.xd&&(this.zd(),Te(i)||(this.xd=i,this.$d=i,this.Id(),(null===(t=this.Cd)||void 0===t?void 0:t.addEventListener)&&(Hr(this.Cd,E,this.sn),Fr($S,t=>{Hr(this.Cd,t,this.Md,{capture:!0})}))))}Id(){Te(this.xd)||(Te(this.Hd)||clearInterval(this.Hd),this.Td=Date.now(),this.Hd=setInterval(this.Sd,this.xd))}zd(){var t,e;Te(this.Hd)||(clearInterval(this.Hd),this.Hd=void 0,null===(t=this.Cd)||void 0===t||null===(e=t.removeEventListener)||void 0===e||e.call(t,"visibilitychange",this.sn),Fr($S,t=>{var e,i;null===(e=this.Cd)||void 0===e||null===(i=e.removeEventListener)||void 0===i||i.call(e,t,this.Md,{capture:!0})})),this.xd=void 0,this.$d=void 0,this.wd=!1,this.Td=void 0}destroy(){this.Ud()}dispose(){this.Ud()}Ud(){var t,e,i;this.zd(),this.pd++,this.md=!1,this.Lc=void 0,this.Wd(this.hd,"cancelled"),this.Wd(this.dd,"cancelled"),this.bo&&(this.Vd(),null===(t=this.Dd)||void 0===t||t.dispose(),this.Dd=void 0,null===(e=this.Nd)||void 0===e||e.call(this),this.Nd=void 0,this.ud=[],null===(i=this.Fd)||void 0===i||i.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Gd(t){var e;return this.Qd&&t in this.Qd?this.Qd[t]:null===(e=this.bo)||void 0===e?void 0:e.kv.get(t)}qd(){return!!this.Qd&&(this.Qd=void 0,!0)}Zd(){var t;return!Te(null===(t=this.bo)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.qd()}$t(t){this.Jd(()=>{var e;return null===(e=this.bo)||void 0===e?void 0:e.kv.set(t)})}Kd(t,e,i){if(!this.Pd||!t.$enabled_feature_flags)return;const n=this.Gd("$enabled_feature_flags")||{},s=t.$enabled_feature_flags||{},r=e.flags||e.featureFlags,o=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],a=!!e.errorsWhileComputingFlags&&!!e.flags,l=a?o:i&&!Se(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(n),...Object.keys(s)])),u=this.Gd("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},h=a||i?l:Array.from(new Set([...Object.keys(u),...Object.keys(c)])),d=!a&&!i,p=!!d||l,_=!!d||h,w={[v]:p,[b]:p,[x]:_};t.$feature_flag_details&&(w[f]=p);for(const e of[m,g,y])Te(t[e])||(w[e]=!0);this.Pd.markCrossTabFeatureFlagChanges(w)}Pt(t){this.Jd(()=>{var e;return null===(e=this.bo)||void 0===e?void 0:e.kv.remove(t)})}Jd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}jd(){const t={};for(const e of[v,x,m,C]){const i=this.Gd(e);Te(i)||(t[e]=i)}this.ad=t;const e=ue({},t),i=this.Gd(b);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.ld=e}Ld(){const t=this.Mr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Gd(g);return"number"!=typeof e||Date.now()-e>t}Xd(){return!!this.Ld()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Yd(){const t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}tv(){const t=this.Mr.flagKeys;if(!Te(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Mr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Te(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.ev({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.Gd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.Gd("$feature_flag_payloads"))&&void 0!==s?s:{},a=ue(ue({},r),t),l=ue(ue({},o),e),u={};for(const[t,e]of Object.entries(a))u[t]={key:t,enabled:as(e),variant:ls(e),reason:void 0,metadata:Te(null==l?void 0:l[t])?void 0:{id:0,version:void 0,description:void 0,payload:l[t]}};this.ev({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Gd(f),e=this.Gd(C),i=this.Gd(T);if(!i&&!e)return t||{};const n=Lr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r,o;const s=n[t],a=null==e?void 0:e[t],l=Te(a)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!a,u=Te(a)?null==s?void 0:s.variant:"string"==typeof a?a:void 0,c=null==i?void 0:i[t],h=ue(ue({},s),{},{enabled:l,variant:l?null!=u?u:null==s?void 0:s.variant:void 0});l!==(null==s?void 0:s.enabled)&&(h.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(h.original_variant=null==s?void 0:s.variant),c&&(h.metadata=ue(ue({},null==s?void 0:s.metadata),{},{payload:c,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=h}return this.od||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.od=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:as(n),variant:ls(n),payload:os(e[i])}})}getFlagVariants(){const t=this.Gd(b),e=this.Gd(C);if(!e)return t||{};const i=Lr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.od||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.od=!0),i}getFlagPayloads(){const t=this.Gd(x),e=this.Gd(T);if(!e)return t||{};const i=Lr({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.od||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.od=!0),i}reloadFeatureFlags(){this.gd||this.Mr.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.iv||(this.ud.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.iv=setTimeout(()=>{this.nv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.gd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.kd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.hd.add(t),this.reloadFeatureFlags()})}Wd(t,e){t.forEach(t=>t({status:e})),t.clear()}Vd(){clearTimeout(this.iv),this.iv=void 0}onReloading(t){return this.ud.push(t),()=>{this.ud=this.ud.filter(e=>e!==t)}}ensureFlagsLoaded(){this.vd||this.fd||this.iv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.Pt(k)}nv(t){var e;this.Vd();const i=this.bo;if(!i||this.Mr.remoteRequestsDisabled||this.kd())return void this.Wd(this.hd,"skipped");if(this.fd)return void(this.md=!0);const n={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ue(ue(ue({},i.initialPersonProperties),this.Gd("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Gd(_),timezone:bu()};Te(i.deviceId)||(n.$device_id=i.deviceId),((null==t?void 0:t.disableFlags)||this.Mr.featureFlagsDisabled)&&(n.disable_flags=!0);const s=this.Yd();s.length&&(n.evaluation_contexts=s);const r=this.tv();Te(r)||(n.flag_keys=r);const o=this.Mr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.pd,u=this.hd;this.hd=new Set,this.dd=u,this.fd=!0;const c=()=>{this.md&&(this.md=!1,this.nv())},h=t=>{var e,i;const s=null!==(e=t.json)&&void 0!==e?e:{},r=200!==t.statusCode;if(this.fd=!1,l!==this.pd)return void c();if(this.sv(t.statusCode),r||this.md||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.md)return void this.Wd(u,"skipped");this.yd=!r;const a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?CS:"unknown_error"):200!==t.statusCode&&a.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");const h=!!(null===(i=s.quotaLimited)||void 0===i?void 0:i.includes("feature_flags"));h&&a.push("quota_limited"),this.$t({[p]:a}),h?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.ev(s,r,{partialResponse:o}),this.Wd(u,n.disable_flags?"skipped":a.length||!s.flags&&!s.featureFlags?"error":"loaded"),c()},d=t=>{this.fd=!1,l===this.pd?(this.$t({[p]:[CS]}),this.A.error("Feature flag request failed",t),this.Zd()&&this.Bd(!0),this.Wd(u,"error"),c()):c()};let v=null!==(e=this.Mr.requestMaxRetries)&&void 0!==e?e:1;const f=()=>v>0&&l===this.pd,g=()=>{if(l!==this.pd||!this.bo||this.Mr.remoteRequestsDisabled)return this.fd=!1,this.Wd(u,"skipped"),void c();try{i.sendRequest(a,{target:"flags",method:"POST",body:n,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(t=>{if((t=>xS.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(g,500);h(t)}).catch(d)}catch(t){d(t)}};g()}kd(){return Gr(this._d,3)}sv(t){this._d=Qr(t,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var i;if(e.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+t+SS);if(this.Xd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+t+SS);if(this.Xd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),a=this.Gd("$feature_flag_request_id")||void 0,l=this.Gd("$feature_flag_evaluated_at")||void 0;let u,c=this.Gd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var h;const t=null===(h=this.bo)||void 0===h||null===(h=h.session)||void 0===h?void 0:h.sessionId,e=this.Gd(S);t&&t!==e&&(c={},u=t)}if(!e.send_event&&"send_event"in e)u&&this.$t({[k]:c,[S]:u});else if(t in c&&c[t].includes(o))u&&this.$t({[k]:c,[S]:u});else{var d,v,f,p,g,m,y,b,_,w,x,C,T;Se(c[t])?c[t].push(o):c[t]=[o],this.$t(ue({[k]:c},u?{[S]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.Gd("$feature_flag_errors"))&&void 0!==d?d:[]];Te(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Mr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Mr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.yd};Te(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Te(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const h=null!==(b=null==e||null===(_=e.reason)||void 0===_?void 0:_.description)&&void 0!==b?b:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;h&&(n.$feature_flag_reason=h),(null==e||null===(x=e.metadata)||void 0===x?void 0:x.id)&&(n.$feature_flag_id=e.metadata.id),Te(null==e?void 0:e.original_variant)&&Te(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Te(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(C=e.metadata)||void 0===C?void 0:C.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(T=e.metadata)||void 0===T?void 0:T.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.rv(n)}return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:os(r)}:void 0}rv(t){try{var e;null===(e=this.bo)||void 0===e||e.capture("$feature_flag_called",t)}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.ov(t,e)}ov(t,e){var i=this;return re(function*(){const n=i.bo;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.Yd();r.length&&(s.evaluation_contexts=r);const o=i.tv();let a;Te(o)||(s.flag_keys=o);try{var l;const e=null===(l=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==e?void 0:e[t])||void 0}catch(t){return void i.A.error("Remote config feature flag request failed",t)}try{e(a)}catch(t){i.A.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.yd)return e.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+SS),e.defaultValue;const i=this.getFeatureFlag(t,e);return Te(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){this.ev(t,e,i)}ev(t,e,i){if(!this.bo)return;this.vd=!0;const n=((t,e={},i={},n={},s,r=wS)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!Te(null===(e=i[t].metadata)||void 0===e?void 0:e.payload)}).map(t=>{var e;return[t,null===(e=i[t].metadata)||void 0===e?void 0:e.payload]}));return ue(ue({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(!l)return;const c=t.requestId,h=t.evaluatedAt;if(Se(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(l)for(let e=0;l.length>e;e++)t[l[e]]=!0;return{[v]:l,[b]:t,[y]:!1}}let d=l,p=u,_=a;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=p||{};d=ue(ue({},e),d),p=ue(ue({},i),s),t.forEach(t=>{t in s||null==p||delete p[t]}),_=ue(ue({},n),_)}else if(t.errorsWhileComputingFlags)if(a){const t=new Set(Object.keys(a).filter(t=>{var e;return!(null===(e=a[t])||void 0===e?void 0:e.failed)}));d=ue(ue({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(p||{}).filter(([e])=>t.has(e)));p=ue(ue({},i),s),t.forEach(t=>{t in s||null==p||delete p[t]}),_=ue(ue({},n),Object.fromEntries(Object.entries(_||{}).filter(([e])=>t.has(e))))}else d=ue(ue({},e),d),p=ue(ue({},i),p),_=ue(ue({},n),_);return ue(ue({[v]:Object.keys(ES(d)),[b]:d||{},[x]:p||{},[f]:_||{},[y]:!0===t.minimalFlagCalledEvents},c?{[m]:c}:{}),h?{[g]:h}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.A);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Te(this.bo.kv.get(b));this.Qd=n,t||this.$t(n)}else this.qd(),this.Kd(n,t,!!(null==i?void 0:i.partialResponse)),this.$t(n);else e&&this.Zd();e||(this.bd=!1),this.Bd(e)}override(t,e=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.av(t)}av(t){if(this.bo){if(!1===t)return this.Pt([C,T]),this.Bd(),void kS.info("All overrides cleared");if(Se(t))return this.$t({[C]:TS(t)}),this.Bd(),void kS.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.od=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[C]=Se(s)?TS(s):s),r&&(n[T]=r),Object.keys(n).length&&this.$t(n),!1===s&&!1===r?this.Pt([C,T]):!1===s?this.Pt(C):!1===r&&this.Pt(T),this.Bd(),!1===s?kS.info("Flag overrides cleared"):s&&kS.info("Flag overrides set",{flags:s}),void(!1===r?kS.info("Payload overrides cleared"):r&&kS.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[C]:t}),this.Bd(),void kS.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){const{flags:e,flagVariants:i}=this.lv();try{t(e,i)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.Gd("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const a=ue(ue({},this.getFlagVariants()),{},{[t]:e});null===(n=this.Pd)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.$t({[v]:Object.keys(ES(a)),[b]:a,[w]:ue(ue({},this.Gd("$stored_person_properties")||{}),r)}),this.Bd();try{var l;null===(l=this.bo)||void 0===l||l.capture("$feature_enrollment_update",o)}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.Gd(d);!n||e?this.uv(t,i):t(n)}uv(t,e){var i=this;return re(function*(){const n=i.bo;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.$t({[d]:r})}catch(t){return void i.A.error("Early access feature request failed",t)}try{t(r)}catch(t){i.A.error("Early access feature callback failed",t)}})()}lv(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}Bd(t){this.jd();const{flags:e,flagVariants:i}=this.lv();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.hv(t,e)}hv(t,e=!0){const i=this.Gd("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.$t({[w]:ue(ue(ue({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=ue({},this.Gd("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.$t({[w]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Pt(w),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.Gd("$stored_group_properties")||{},n=ue({},i);for(const e of Object.keys(t))n[e]=ue(ue({},i[e]),t[e]);this.$t({[_]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Gd("$stored_group_properties")||{};this.$t({[_]:ue(ue({},e),{},{[t]:{}})})}else this.Pt(_)}reset(){this.pd++,this.Wd(this.hd,"cancelled"),this.Wd(this.dd,"cancelled"),this.md=!1,this.ad={},this.ld={},this.Qd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Vd(),this.od=!1,this._d=0}};const MS=Or("[FeatureFlags]");var RS=class{constructor(t,e=!1){this.dv=!1,this.update(t,e)}update(t,e){this.vv=((t,e)=>{var i,n,s,r,o,a,l,u;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:Te(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(a=t.feature_flag_request_max_retries)&&void 0!==a?a:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:Se(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.dv||(MS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.dv=!0),Te(t.flag_keys)||Se(t.flag_keys)||MS.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.vv}};const PS="Refusing to render web experiment since the viewer is a likely bot",AS={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ou(e,t),not_regex:(t,e)=>!ou(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},OS=Or("[Conversations]"),FS="Conversations not available yet.";function DS(t,e){var i,n,s,r,o,a,l;const u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,c=null!==(n=null==t?void 0:t.maxBufferSize)&&void 0!==n?n:100,h=(null==e?void 0:e.consoleCapture)?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,d=Te(h)?Math.max(c,2048):Math.max(c,h),v=ue(ue({},function(){let t="",e="";try{var i;const n="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,s=null==n||null===(i=n.navigator)||void 0===i?void 0:i.userAgent;s&&([t,e]=Zi(s))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(fr,t)?fr[t]:t}(t);return ue(ue({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==v?void 0:v["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==v?void 0:v["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const LS=["debug","log","warn","error","info"],NS="console",qS="__posthogHandledLogsRequestError",jS=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[qS]=!0,i},BS=t=>!!t&&"object"==typeof t&&!0===t[qS];var zS=class{get fv(){return ue(ue({},this.A),{},{error:(...t)=>{t.some(BS)||this.A.error(...t)}})}constructor(t,e){var i;this.wo=t,this.pv=e,this.name="logs",this.gv=!1,this.mv=!1,this.yv=!1,this.A=Or("[logs]"),this.ol=[],this.bv=[],this._d=0,this._v=!1,this.To=!1,this.wv=[],this.Sv=[],this.xv=!1,this.$v=!1,this.Cv=!1,this.Tv=()=>{var t,e;this.To||(this._d=0,null===(t=this.Iv)||void 0===t||t.onReconnect(),null===(e=this.Mv)||void 0===e||e.onReconnect())},this.gv=!!(null===(i=t.get())||void 0===i?void 0:i.captureConsoleLogs)}get Ev(){return!0}Pv(){}Rv(){if(!this.Cv){try{this.Fd=typeof window>"u"?void 0:window}catch(t){this.Fd=void 0}this.Fd&&(Hr(this.Fd,"online",this.Tv),this.Cv=!0)}}Av(t,e,i,n){this.Rv();const s=DS(this.wo.get(),i);return[new xr(this.Fv(t,e),s,this.fv,()=>this.pv(),t=>t(),void 0,n),s]}Ov(){const t=this.wo.get();var e;return this.Iv&&this.Dv===t||(null===(e=this.Iv)||void 0===e||e.reset(),this.Dv=t,[this.Iv,this.Lv]=this.Av(()=>this.ol,t=>{this.ol=t})),this.Iv}Nv(){const t=this.wo.get();var e;return this.Mv&&this.qv===t||(null===(e=this.Mv)||void 0===e||e.reset(),this.qv=t,[this.Mv,this.jv]=this.Av(()=>this.bv,t=>{this.bv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},NS)),this.Mv}setup(t){if(!this.To&&!this._v)return this._v=!0,this.bo=t,this.A=t.logger.createLogger("[logs]"),lS(t.kv.initialize(),()=>{this.To||this.Od(t)})}Od(t){var e;this.Rv(),(null===(e=this.wo.get())||void 0===e?void 0:e.captureConsoleLogs)&&(this.gv=!0),(this.gv||this.wo.remoteConfigWillArrive&&t.kv.get(this.wo.captureHintKey))&&this.Bv();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.To?n.dispose():(this.Eo=n,i||this.loadIfEnabled())}dispose(){var t,e,i,n,s,r,o;this.To||(this.To=!0,this.zv(),null===(t=this.Eo)||void 0===t||t.dispose(),this.Eo=void 0,this.bo=void 0,this.yv=!1,null===(e=this.Fd)||void 0===e||e.removeEventListener("online",this.Tv),null===(i=this.Hv)||void 0===i||i.call(this),this.Hv=void 0,null===(n=this.Iv)||void 0===n||n.clearQueue(),null===(s=this.Mv)||void 0===s||s.clearQueue(),null===(r=this.Iv)||void 0===r||r.reset(),null===(o=this.Mv)||void 0===o||o.reset())}onRemoteConfig(t){var e,i;if(this.To)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.Uv():(null===(i=this.bo)||void 0===i||i.kv.set(this.wo.captureHintKey,!!n),n?(this.gv=!0,this.mv||this.Bv(),this.loadIfEnabled()):this.Uv())}reset(){var t,e,i,n;this.zv(),null===(t=this.Iv)||void 0===t||t.clearQueue(),this.ol=[],null===(e=this.Iv)||void 0===e||e.reset(),null===(i=this.Mv)||void 0===i||i.clearQueue(),this.bv=[],null===(n=this.Mv)||void 0===n||n.reset(),this._d=0}captureLog(t){!this.To&&this.bo&&this.Ov().captureLog(t)}captureConsoleLog(t){!this.To&&this.bo&&this.Nv().captureLog(t)}captureBufferedConsoleLog(t,e,i){!this.To&&this.bo&&this.Nv().captureLog(t,{context:e,occurredAtMs:i})}$c(){var t;this.zv(),null===(t=this.Mv)||void 0===t||t.clearQueue(),this.bv=[]}Uv(){this.gv||this.zv()}Bv(){var t;if(this.xv||!(null===(t=this.Fd)||void 0===t?void 0:t.console))return;const e=DS(this.wo.get()).maxBufferSize;let i=!0;this.Sv.push(()=>{i=!1});for(const t of LS){let n;try{n=cy(this.Fd.console[t])}catch(t){continue}n&&this.Sv.push(Sf(this.Fd.console,t,s=>{const r=(...n)=>{try{i&&this.Wv(t,n,e)}catch(t){}return s.apply(this.Fd.console,n)};return r.__rrweb_original__=n,r}))}this.xv=!0,this.Vv=setTimeout(()=>{this.zv()},3e4)}Wv(t,e,i){var n;if(this.xv&&!this.$v&&0!==e.length)if(null===(n=this.bo)||void 0===n?void 0:n.canCapture){if(i>this.wv.length){this.$v=!0;try{this.wv.push({level:t,args:e,occurredAtMs:Date.now(),context:this.pv()})}finally{this.$v=!1}}}else this.zv()}zv(){if(this.wv=[],this.xv){this.xv=!1,this.Vv&&(clearTimeout(this.Vv),this.Vv=void 0);for(const t of this.Sv)t();this.Sv=[]}}Gv(){const t=this.wv;return this.zv(),t}get logger(){return this.Qv||(this.Qv={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Qv}flushLogs(t){this.bo&&(t?this.Zv(t):(this.Iv&&this.Iv.flush().catch(t=>this.Jv(t)),this.Mv&&this.Mv.flush().catch(t=>this.Jv(t))))}flush(){var t=this;return re(function*(){var e,i;const n=null===(e=t.Iv)||void 0===e?void 0:e.flush().catch(e=>t.Jv(e)),s=null===(i=t.Mv)||void 0===i?void 0:i.flush().catch(e=>t.Jv(e));yield n,yield s})()}Jv(t){BS(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.To||!this.gv||this.mv||this.yv)return;const t=this.Pv();if(t){this.yv=!0;try{t((t,e)=>{if(this.yv=!1,!this.To&&this.gv)if(t||!e)this.A.error("Could not load logs script",t),this.zv();else{const t=this.Gv();this.Hv=e.initialize(this.bo),this.mv=!0,t.length>0&&e.replay(this.bo,t)}})}catch(t){throw this.yv=!1,t}}else this.zv()}Fv(t,e){const i=this.bo;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:e=>e===ce.LogsQueue?t():void 0,setPersistedProperty(t,i){t===ce.LogsQueue&&e(null!=i?i:[])},js:t=>this.js(t),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}js(t){return new Promise(e=>{if(Gr(this._d,3))return void e({kind:"fatal",error:jS(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:jS(void 0,"logs request timed out")})},9e4),r=this.Ev;this.bo.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.bo.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var e;const i=t.statusCode;this.Kv(i,r),i>=200&&300>i?n({kind:"ok"}):413===i?n({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?n({kind:"fatal",error:new Error(`logs request failed with status ${i}`)}):0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:jS(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`logs request failed with status ${i}`)})},t=>{n({kind:"retry-later",error:t})})})}Kv(t,e){(0!==t||e)&&(this._d=Qr(t,this._d,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Zv(t){this.ol.length>0&&this.Xv(t,this.ol,this.Lv,this.bo.library.name,t=>{this.ol=t}),this.bv.length>0&&this.Xv(t,this.bv,this.jv,NS,t=>{this.bv=t})}Xv(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=_r(r,br(i,this.bo.library.name,this.bo.library.version),n,this.bo.library.version);this.bo.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.bo.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.Jv(t))}};const US=Or("[NetworkMetrics]"),HS=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},WS={"http:":80,"https:":443},VS=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),GS=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=Kr(n))||void 0===i?void 0:i.href)||n}},QS=(t,e,i,n,s,r,o=!1)=>{try{var a,l;const u=s();if(!u)return;const c=i||void 0,h=HS()-n,d=Kr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=xe(u.name)?u.name(v):Ee(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!c?void 0:((t,e)=>t?400>t?void 0:String(t):(null==e?void 0:e.name)||"_OTHER")(c,r),g=ue(ue(ue(ue(ue({},(t=>{const e=VS.has(t)?t:"_OTHER";return ue({"http.request.method":e},"_OTHER"===e&&t!==e?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||WS[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(e=t.pathname,e.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var e})(d):{}),c?{"http.response.status_code":c}:{}),p?{"error.type":p}:{}),null===(a=u.attributes)||void 0===a?void 0:a.call(u,v,{status:c,durationMs:h}));null===(l=t.metrics)||void 0===l||l.histogram(f,h,{unit:"ms",attributes:g})}catch(t){US.error("Failed to record network metric",t)}},ZS=()=>{},JS=(e,i)=>xe(null==t?void 0:t.fetch)?Sf(t,"fetch",t=>function(...n){const s=HS(),r=t.apply(this,n);if(!i())return r;try{var o,a,l;const[t,u]=n,c=GS(null!==(o=null!==(a=null==u?void 0:u.method)&&void 0!==a?a:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(l=null==t?void 0:t.url)&&void 0!==l?l:t);return r.then(t=>(QS(e,c,null==t?void 0:t.status,s,i,void 0,!0),t),t=>{throw QS(e,c,void 0,s,i,t),t})}catch(t){return US.error("Failed to observe fetch",t),r}}):ZS,KS=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return ZS;const r=new WeakMap,o=Sf(s,"open",t=>function(...e){try{(()=>Dw.has(this))()||r.set(this,GS(e[0],e[1]))}catch(t){US.error("Failed to observe XHR open",t)}return t.apply(this,e)}),a=Sf(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=HS();s=()=>{this.removeEventListener("loadend",s),QS(e,t,this.status,n,i)},Hr(this,"loadend",s)}}catch(t){US.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),a()}},YS=new WeakMap,XS=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),tx={maxStringLength:2048,truncationSuffix:"..."},ex={maxStringLength:2048,truncationSuffix:"..."};function ix(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function nx(t,e){return{}.hasOwnProperty.call(t,e)}function sx(t,e){const i=Object.create(t);return e&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:e}),i}function rx(t,e,i=!1){if(!Ee(t))return;const n=t.trim();return n?(i?nr(n,tx):n).slice(0,e):void 0}function ox(t){try{return $e(t)&&!0===t.isError}catch(t){return!1}}function ax(t,e){try{return nr((e?function(t){try{if(!$e(t)||!Se(t.content))return;return t.content.filter(t=>$e(t)&&"text"===t.type&&Ee(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):$e(t)&&Ee(t.message)?t.message:Ee(t)?t:String(t))||"Unknown error",ex).slice(0,2048)}catch(t){return"Unknown error"}}function lx(t,e){if(e)return"Error";try{if(!$e(t))return"Error";let e=Ee(t.name)?t.name.trim():"";const i=t.constructor;return e&&"Error"!==e||!xe(i)||"Error"===i.name||(e=i.name),(e||"Error").slice(0,256)}catch(t){return"Error"}}function ux(t,e){return{message:ax(t,e),type:lx(t,e)}}const cx={featureFlags:class extends IS{constructor(t){const e=new RS(t.config,t.il());super(e),this.name=jg,this._instance=t,this.Yv=e}get Pd(){return this._instance.persistence}updateConfig(t,e){this.Yv.update(t,e),this.Rd()}}},hx={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.tf)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.ef||"missing_config"===this.ef?this.ef:null!==(t=null===(e=this.tf)||void 0===e?void 0:e.status)&&void 0!==t?t:this.ef}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.ef=aa,this.if=void 0,this.nf=!1,this.Je=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.sn=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Je=!0,null===(t=this.tf)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw Xk.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&Hr(n,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.nf=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.sn),t?this.sf(!0):this.stopRecording()}get rf(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.nf)return;if(this.rf&&(null===(e=this.tf)||void 0===e?void 0:e.isStarted))return;const i=!Te(Object.assign)&&!Te(Array.from);this.rf&&i?(this.af(t),Xk.info("starting")):(this.ef=aa,this.stopRecording())}af(t){var e,i;if(this.rf)if("awaiting_config"!==this.ef&&"missing_config"!==this.ef&&(this.ef=da),(null==h||null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.lf(t);else{var n,s;const e=this._instance.sessionManager;null===(n=h.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.uf,i=>{if(!this.nf&&this.rf&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Xk.error("could not load recorder",i)):void this.lf(t);this.ef="disabled"})}}stopRecording(){var t,e;null===(t=this.if)||void 0===t||t.call(this),this.if=void 0,null===(e=this.tf)||void 0===e||e.stop()}sf(t=!1){var e,i;null===(e=this.if)||void 0===e||e.call(this),this.if=void 0,null===(i=this.tf)||void 0===i||i.discard({discardProducerEvents:t})}cf(){var t,e;null===(t=this.Il)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.Il)||void 0===e||e.unregister("$replay_sample_rate")}hf(t,e){if(Re(t))return null;const i=Pe(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(Xk.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}df(t){if(this.Il){var e,i;const n=this.Il,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.hf(null===(e=this.Mr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.hf(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.cf();const a=null==i?void 0:i.minimumDurationMilliseconds;n.register({[J]:ue(ue({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ue({capturePerformance:t.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:Te(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})})};s(),null===(e=this.if)||void 0===e||e.call(this),this.if=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.df(e),void this.sf()):(this.df(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.ef&&(this.ef="missing_config",this._instance.register_for_session({[Nt]:!0}),Xk.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.tf)||void 0===i?void 0:i.log)?this.tf.log(t,e):Xk.warn("log called before recorder was ready")}get uf(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(J);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}vf(){const t=this._instance.get_property(J);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return Xk.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Re(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}lf(t){var e,i,n;if(!this.nf&&this.rf&&this._instance.sessionManager){if(!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return Xk.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lt]:!0});var s;if(this.tf||(this.tf=null===(s=h.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Je),this.tf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.vf()){if("missing_config"===this.ef||"awaiting_config"===this.ef)return;return this.ef="awaiting_config",Xk.info("persisted remote config is stale, requesting fresh config before starting"),void new Aw(this._instance).load()}this.ef=da,null===(i=(n=this.tf).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Je),this.tf.start(t)}else this.ef=aa}onRRwebEmit(t){var e,i;null===(e=this.tf)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.tf||null===(e=this.Il)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.tf)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.tf||null===(e=this.Il)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.tf)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.tf||null===(i=this.Il)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.tf)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;const e={};for(const t of tS){var i;const n=null===(i=this._instance.sessionPersistence)||void 0===i?void 0:i.get_property(t);Te(n)||(e[t]=n)}return ue(ue({},e),(null===(t=this.tf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.tf)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.tf)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},dx={autocapture:class extends L_{constructor(t){super(new Wk(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.ff=!1,this._instance=t,this.pf=this.gf()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.mf();return!!(t.path||t.search||this.yf(t))}startIfEnabled(){this.isEnabled&&(Ar.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.pf=this.gf(),this.startIfEnabled()}stop(){this.bf&&this.bf(),this.bf=void 0,this._f&&this._f(),this._f=void 0,Ar.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.wf("pushState"),this.wf("replaceState"),this.kf(),this.yf()&&this.Sf())}wf(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;Sf(t.history,e,i=>function(s,r,o){var a;n.xf(o)&&n.$f(),i.call(this,s,r,o),n.Cf(e,!n.ff&&"popstate"!==(null==t||null===(a=t.event)||void 0===a?void 0:a.type))})}gf(){const e=null==t?void 0:t.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}mf(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:$e(t)?t:{}}yf(t=this.mf()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Tf(t){const e=this.mf(),i=this.pf;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.yf(e)&&t.hash!==i.hash))}Cf(t,e=!1){try{e||this.$f();const i=this.gf();if(!i)return;if(this.Tf(i)){const i=()=>this._instance.capture(te,{navigation_type:t});e?(this.If=i,Promise.resolve().then(()=>this.$f())):i()}this.pf=i}catch(e){Ar.error(`Error capturing ${t} pageview`,e)}}xf(e){var i,n;return!(Re(e)||!t)&&(null===(i=Kr(String(e)))||void 0===i?void 0:i.href)!==(null===(n=t.location)||void 0===n?void 0:n.href)}$f(){const t=this.If;if(t){this.If=void 0,this.ff=!0;try{t()}catch(t){Ar.error("Error capturing deferred pageview",t)}finally{this.ff=!1}this.pf=this.gf()}}kf(){if(this.bf)return;const e=()=>{this.Cf("popstate")};Hr(t,"popstate",e),this.bf=()=>{t&&t.removeEventListener("popstate",e)}}Sf(){if(this._f)return;const e=()=>{this.Cf("hashchange")};Hr(t,"hashchange",e),this._f=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.Mf=!1,this.ko=!1,this.Ef=null,this.instance=t,this.Mf=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[B]),this.rageclicks=new R_(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return $e(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Mr.capture_heatmaps)?Re(this.Mr.enable_heatmaps)?this.Mf:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.ko)return;eS.info("starting..."),this.Pf(),this.sn()}else{var t;clearInterval(null!==(t=this.Ef)&&void 0!==t?t:void 0),this.Rf(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[B]:i}),this.Mf=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Af(t){iS(t.originalEvent)&&this.Ir(t.originalEvent,"deadclick")}sn(){this.Ef&&clearInterval(this.Ef),this.Ef="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Pf(){t&&n&&(this.Ff=this.fl.bind(this),Hr(t,Xt,this.Ff),this.Of=e=>this.Ir(e||(null==t?void 0:t.event)),Hr(n,"click",this.Of,{capture:!0}),this.Df=e=>this.Lf(e||(null==t?void 0:t.event)),Hr(n,"mousemove",this.Df,{capture:!0}),this.Nf=new nw(this.instance,ew,this.Af.bind(this)),this.Nf.startIfEnabledOrStop(),this.qf=this.sn.bind(this),Hr(n,E,this.qf),this.ko=!0)}Rf(){var e;t&&n&&(this.Ff&&t.removeEventListener(Xt,this.Ff),this.Of&&n.removeEventListener("click",this.Of,{capture:!0}),this.Df&&n.removeEventListener("mousemove",this.Df,{capture:!0}),this.qf&&n.removeEventListener(E,this.qf),clearTimeout(this.jf),null===(e=this.Nf)||void 0===e||e.stop(),this.ko=!1)}Bf(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&ro(s)&&!oo(s,"body");){if(s===n)return!1;let e;try{var r,o,a;e=null===(r=null!==(o=null===(a=s.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(s).position}catch(t){return!1}if(ge(i,e))return!0;s=bo(s)}return!1}(po(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Ir(t,e="click"){var i;if(so(t.target)||!iS(t))return;const n=this.Bf(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Ao(po(t),this.instance.config.rageclick)&&this.Qs(ue(ue({},n),{},{type:"rageclick"})),this.Qs(n)}Lf(t){!so(t.target)&&iS(t)&&(clearTimeout(this.jf),this.jf=setTimeout(()=>{this.Qs(this.Bf(t,"mousemove"))},500))}Qs(e){if(!t)return;const i=this.Mr.disable_capture_url_hashes?cn(t.location.href):t.location.href,n=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[..._u,...n||[]]:[],r=to(i,s,ku);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fl(){this.Rt&&!Ce(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:nw,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Mf=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.zf=()=>{clearTimeout(this.Hf),this.Hf=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ue({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>ue(ue({},t),{},{[`$web_vitals_${e.name}_event`]:ue({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uf=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Re(null==t?void 0:t.name)||Re(null==t?void 0:t.value))return void Qk.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.Wf(i);if(Te(n))return;const s=Pe(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Vf&&t.value>=this.Vf)return void Qk.error("Ignoring metric with value >= "+this.Vf,t);this.Rt.navigationKey!==s&&(this.zf(),this.Hf=setTimeout(this.zf,this.flushToCaptureTimeoutMs)),Te(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Te(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=ue(ue(ue({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,$e(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of Yk){const n="url"===i&&"string"==typeof t.attribution[i]?this.Wf(t.attribution[i]):t.attribution[i];Te(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Te(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.zf()},this.Gf=()=>{if(this.ko)return;let t,e,i,n,s=!1;const r=h.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Qf])||("web-vitals"===this.Qf&&Te(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Te(a)){const r=a.withoutAttribution,o=this.attributionMetrics;s=!Te(r),t=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,e=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,n=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(t&&e&&i&&n))return void Qk.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?ue(ue({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uf.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Uf.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uf.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&n(this.Uf.bind(this),u),this.ko=!0},this.Mf=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[W]),this.startIfEnabled()}get Zf(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=$e(this.Zf)?null===(t=this.Zf)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Re(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||Jk:i}get flushToCaptureTimeoutMs(){return($e(this.Zf)?this.Zf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=$e(this.Zf)?this.Zf.web_vitals_attribution:void 0;return Oe(t)?t?Jk:[]:Se(t)?t:Kk}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=$e(this.Zf)?this.Zf.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Vf(){const t=$e(this.Zf)&&Pe(this.Zf.__web_vitals_max_value)?this.Zf.__web_vitals_max_value:Zk;return t>0&&6e4>=t?Zk:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Qk.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=$e(this.Zf)?this.Zf.web_vitals:Oe(this.Zf)?this.Zf:void 0;return Oe(e)?e:this.Mf}startIfEnabled(){this.isEnabled&&!this.ko&&(Qk.info("enabled, starting..."),this.zo(this.Gf))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=$e(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$e(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[W]:i}),this._instance.persistence.register({[Z]:n})),this.Mf=i,this.startIfEnabled()}get Qf(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const i=h.__PosthogExtensions__,n=this.Qf,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Te(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?Qk.error("failed to load script",e):t()})}Wf(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void Qk.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?cn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[..._u,...s||[]]:[];return to(n,r,ku)}}},vx={exceptionObserver:class{constructor(e){var i;this.Gf=()=>{var e;if(!t||!this.isEnabled||!(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Jf&&this.Mr.capture_unhandled_errors&&(this.Jf=i(this.captureException.bind(this))),!this.Kf&&this.Mr.capture_unhandled_rejections&&(this.Kf=n(this.captureException.bind(this))),!this.Xf&&this.Mr.capture_console_errors&&(this.Xf=s(this.captureException.bind(this)))}catch(t){Vk.error("failed to start",t),this.Yf()}},this._instance=e,this.tp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[z]),this.wt=new Je(ue(ue({},function(t={}){var e,i,n,s;return{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(n=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Vk})),this.Mr=this.ep(),this.startIfEnabledOrStop()}ep(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $e(t)?e=ue(ue({},e),t):(Te(t)?this.tp:t)&&(e=ue(ue({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Vk.info("enabled"),this.Yf(),this.zo(this.Gf)):this.Yf()}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return Vk.error("failed to load script",e);t()})}Yf(){var t,e,i;null===(t=this.Jf)||void 0===t||t.call(this),this.Jf=void 0,null===(e=this.Kf)||void 0===e||e.call(this),this.Kf=void 0,null===(i=this.Xf)||void 0===i||i.call(this),this.Xf=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.tp=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[z]:this.tp}),this.Mr=this.ep(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.ep()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void Vk.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var e,i;this.np=[],this.sp=Ey(),this._instance=t,this.np=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.rp=ns(this.op()),this.ap=new ss(this.rp)}onConfigChange(){this.rp=ns(this.op()),this.ap.setConfig(this.rp)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.np=r,this._instance.persistence&&this._instance.persistence.register({[U]:this.np,[H]:o})}get lp(){var t;const e=!!this._instance.get_property(H),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.sp.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.rp.enabled)try{if(!Ee(t)||0===t.trim().length)return void Sy.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const e=[];return{sanitizedProperties:Object.keys(t).reduce((i,n)=>es.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.up(e));n.length>0&&Sy.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ap.add(ue({[Xn]:t,[ts]:(new Date).toISOString()},i))}catch(t){Sy.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.cp(e)){if(this.hp(e))return this.dp("Exception dropped: matched a suppression rule"),void Sy.info("Skipping exception capture because a suppression rule matched");if(!this.lp&&this.vp(e))return this.dp("Exception dropped: thrown by a browser extension"),void Sy.info("Skipping exception capture because it was thrown by an extension");if(!this.lp&&this.fp(e))return this.dp("Exception dropped: thrown by an injected browser script"),void Sy.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.pp(e))return this.dp("Exception dropped: thrown by the PostHog SDK"),void Sy.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.rp.enabled&&Re(t.$exception_steps)?this.gp(t):t,n=function(){if("u">typeof process){var t;const e=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(e)return e}const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",hc:!0});return t&&this.ap.clear(),t}catch(t){return ky(t)||Sy.error("Failed to capture exception event. Dropping this exception.",t),void this.ap.clear()}}catch(t){return void(ky(t)||Sy.error("Failed to process exception event. Ignoring this exception.",t))}}gp(t){try{const e=this.ap.getAttachable();return 0===e.length?t:ue(ue({},t),{},{$exception_steps:e})}catch(e){return Sy.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}dp(t){this.rp.enabled&&this.ap.add({[Xn]:t,[ts]:(new Date).toISOString()})}up(t){return $e(t)?ue({},t):{}}op(){var t,e;return null!==(t=null===(e=this._instance.config.error_tracking)||void 0===e?void 0:e.exception_steps)&&void 0!==t?t:{}}hp(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>(Ee(e)&&e.length>0&&t.$exception_types.push(e),Ee(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.np.some(t=>{const i=t.values.map(t=>{const i=lu[t.operator],n=e[t.key];if(!i||!n)return!1;const s=Se(t.value)?t.value:[t.value];return s.length>0&&i(s,n)});return"OR"===t.type?i.some(Boolean):i.every(Boolean)})}catch(t){return Sy.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}vp(t){const e=t.flatMap(t=>{var e,i;return null!==(e=null===(i=t.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[]}),i=e.filter(({filename:t})=>!!t&&Cy.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(xy))||t.some(({type:t,value:e})=>"NoResponse"===t||Ee(e)&&$y.some(({value:t,exact:i})=>i?e===t:e.includes(t)))&&!e.some(({in_app:t,filename:e})=>t&&!(null==e?void 0:e.startsWith(xy))))}fp(t){return t.some(({value:t})=>Ee(t)&&Ty.some(e=>t.includes(e)))}pp(t){if(t.length>0){var e,i,n,s;const r=null!==(e=null===(i=t[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}cp(t){return!Re(t)&&Se(t)}}},fx=ue({productTours:class{get Il(){return this._instance.persistence}constructor(t){this.mp=null,this.yp=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.Il&&this.Il.register({[G]:!!e.productTours}),!sS(this._instance))return!this.mp&&Re(null===(i=this.Il)||void 0===i?void 0:i.props.ph_product_tours)||nS.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.mp)||void 0===n||n.stop(),this.mp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.mp&&sS(this._instance)&&this.zo(()=>this.bp())}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?nS.error("Could not load product tours script",e):t()})}bp(){var t;!this.mp&&(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.mp=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(Se(this.yp)&&!e)return void t(this.yp,{isLoaded:!0});const i=this.Il;if(i){const n=i.props[bt];if(Se(n)&&!e)return this.yp=n,void t(n,{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:e=>{if(!sS(this._instance))return void t([],{isLoaded:!0});const n=e.statusCode;if(200!==n||!e.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?e.error||nS.warn(i):nS.error(i),void t([],{isLoaded:!1,error:i})}const s=Se(e.json.product_tours)?e.json.product_tours:[];this.yp=s,i&&i.register({[bt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.mp)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.mp.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.mp)||void 0===e||e.showTourById(t)}previewTour(t){this.mp?this.mp.previewTour(t):this.zo(()=>{var e;this.bp(),null===(e=this.mp)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.mp)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.mp)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.mp)||void 0===t||t.previousStep()}clearCache(){var t;this.yp=null,null===(t=this.Il)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.mp)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.mp)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.mp)||void 0===e||e.cancelPendingTour(t)}}},cx),px={siteApps:class{constructor(t){this._instance=t,this._p=0,this.wp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}kp(t,e){if(!e)return;const i=this.globalsForEvent(e);this.wp.push(i),this.wp.length>1e3&&(this.wp=this.wp.slice(10))}get siteAppLoaders(){var t;return null===(t=h._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.kp.bind(this));this.Sp=()=>{t(),this.wp=[],this.Sp=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,a;if(!t)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(c))l[t]={id:u[t],type:t,properties:e};const{$set_once:h,$set:d}=t;return{event:ue(ue({},ws(t,rS)),{},{properties:ue(ue(ue({},t.properties),d?{$set:ue(ue({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),h?{$set_once:ue(ue({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),h)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=t.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}xp(t){var e;const i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(oS.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(t)||(oS.error("prepare_external_dependency_script returned null"),null)}return t}$p(){var t,e,i,s,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,c=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!c)return()=>{};if(this._p++,this.Cp)return this.Tp();const h=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),h.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.xp(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Me(t));return f(c,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(c,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(c,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(a=u.DocumentType)||void 0===a?void 0:a.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(l=u.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.Cp=()=>{h.forEach(t=>t()),this.Cp=void 0},this.Tp()}Tp(){let t=!1;return()=>{var e;t||(t=!0,this._p--,0===this._p&&(null===(e=this.Cp)||void 0===e||e.call(this)))}}Ip(t,e=!0){const i=this.$p();try{const n=t(i);return e&&i(),n}catch(t){throw i(),t}}setupSiteApp(t){const e=this.apps[t.id],i=()=>{var i;!e.errored&&this.wp.length&&(oS.info(`Processing ${this.wp.length} events for site app with id ${t.id}`),this.wp.forEach(t=>this.Ip(()=>{var i;return null===(i=e.processEvent)||void 0===i?void 0:i.call(e,t)})),e.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(i=this.Sp)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,oS.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.Ip(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){oS.error(aS+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){oS.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}Mp(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Ep(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.Ip(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){oS.error(`Error while processing event ${t.event} for site app ${i.id}`,e)}}onRemoteConfig(t){var e,i,n;if(null===(e=this.siteAppLoaders)||void 0===e?void 0:e.length)return this.isEnabled?(this.Mp(),void this._instance.on("eventCaptured",t=>this.Ep(t))):void oS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.Sp)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;h[`__$$ph_site_app_${t}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return oS.error(aS+t,e)})}else oS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},gx={tracingHeaders:class{constructor(t){this._instance=t,this.Pp=void 0,this.Rp=void 0,this.Ap=void 0,this.Gf=()=>{const t=this.Fp();var e,i;t?(Te(this.Pp)&&(this.Pp=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Te(this.Rp)&&(this.Rp=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Yf()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,i,n;(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=h.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return Gk.error("failed to load script",e);t()})}Op(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Fp(){const t=this.Op();return Se(t)?(Se(this.Ap)?this.Ap.splice(0,this.Ap.length,...t):this.Ap=[...t],t.length>0?this.Ap:void 0):(Se(this.Ap)&&this.Ap.splice(0),this.Ap=t||void 0,this.Ap)}Yf(){var t,e;null===(t=this.Pp)||void 0===t||t.call(this),null===(e=this.Rp)||void 0===e||e.call(this),this.Pp=void 0,this.Rp=void 0}startIfEnabledOrStop(){this.Fp()?this.zo(this.Gf):this.Yf()}}},mx=ue({surveys:class extends hS{constructor(t){var e;super(new mS(t),(e=t,{get projectToken(){return e.config.token},kv:new gS(e)})),this._instance=t}Wc(t,e){const i=e.query?Bw(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},cx),yx={toolbar:class{constructor(t){this.instance=t}Dp(t){h.ph_toolbar_state=t}Lp(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(Wr(this.instance.config))return!1;if(!t||!n)return!1;e=null!==(r=e)&&void 0!==r?r:t.location,s=null!==(o=s)&&void 0!==o?o:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}const n=yS||eo(e.hash,"__posthog")||eo(e.hash,"state");let r;const o=n?hn(()=>JSON.parse(atob(decodeURIComponent(n))))||hn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(r=JSON.parse(i.getItem(bS)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Np(t){const e=h.ph_load_toolbar||h.ph_load_editor;!Re(e)&&xe(e)?e(t,this.instance):_S.warn("No toolbar load function found")}loadToolbar(e){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!t||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=ue(ue({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(bS,JSON.stringify(ue(ue({},r),{},{source:void 0}))),2===this.Lp())this.Np(r);else if(0===this.Lp()){var o,a;this.Dp(1),null===(o=h.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",t=>{if(t)return _S.error("[Toolbar] Failed to load",t),void this.Dp(0);this.Dp(2),this.Np(r)}),Hr(t,"turbolinks:load",()=>{this.Dp(0),this.loadToolbar(r)})}return!0}qp(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},bx=ue({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.jp("retrieved web experiments from the server"),this.Bp=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Bp&&(e.jp("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.Bp)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);Ee(n)&&t.variants[n]&&this.zp(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.Hp(n,this._instance)&&this.zp(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.jp(PS);else if(!this.Mr.disable_web_experiments){if(Re(this.Bp))return this.Bp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.jp("applying feature flags",t),t.forEach(t=>{var e;if(this.Bp&&(null===(e=this.Bp)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.Bp)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.zp(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=Xr(null==t?void 0:t.search,"__experiment_id"),n=Xr(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.jp(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.Up(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Up(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.jp(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.zp(s[0].name,i,s[0].variants[i].transforms))}static Hp(t,i){return!Re(t.conditions)&&e.Wp(t,i)&&e.Vp(t)}static Wp(t,i){var n;if(Re(t.conditions)||Re(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;const s=e.getWindowLocation();if(s){var r,o,a;const e=io(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||AS[null!==(o=null===(a=t.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Vp(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=xu();if(i.utm_source){var n,s,r,o,a,l,u,c;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.utm_campaign,h=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,d=!(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(c=t.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)==i.utm_term;return e&&d&&v&&h}return!1}static jp(t,...e){Ar.info(`[WebExperiments] ${t}`,e)}zp(t,i,n){this._is_bot()?e.jp(PS):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.jp(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.jp("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?dk(i,this.Mr.custom_blocked_useragents):void 0}}},cx),_x={conversations:class{constructor(t){this._instance=t,this.Gp=void 0,this._conversationsManager=null,this.Qp=!1,this.ne=null,this.Zp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Jp=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)||(Oe(e)?this.Gp=e:(this.Gp=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Gp=void 0,this.ne=null,this.Jp=void 0,this.Zp=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.Qp)return;if(this._instance.config.disable_conversations)return;if(Wr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==h?void 0:h.__PosthogExtensions__;if(t&&!Te(this.Gp)&&this.Gp)if(this.ne&&this.ne.token){this.Qp=!0;try{const e=t.initConversations;if(e)return this.Kp(e),void(this.Qp=!1);const i=t.loadExternalDependency;if(!i)return void this.Xp(Zt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Xp("Could not load conversations script",e):this.Kp(t.initConversations),this.Qp=!1})}catch(t){this.Xp("Error initializing conversations",t),this.Qp=!1}}else OS.error("Conversations enabled but missing token in remote config.")}Kp(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Zp=!1,OS.info("Conversations loaded successfully")}catch(t){this.Xp("Error completing conversations initialization",t)}else OS.error("Cannot complete initialization: remote config is null")}Xp(t,e){OS.error(t,e),this._conversationsManager=null,this.Qp=!1,this.Zp=!0}show(){this._conversationsManager?this._conversationsManager.show():OS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Gp&&!Me(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Wr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Jp?"remote_config_failed":Te(this.Gp)?this.Jp?"disabled_in_project":"remote_config_pending":this.Gp?Re(this.ne)||!this.ne.token?"missing_token":(null==h?void 0:h.__PosthogExtensions__)?this.Qp?"initializing":this.Zp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var n=this;return re(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(OS.warn(FS),null)})()}getMessages(t,e){var i=this;return re(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(OS.warn(FS),null)})()}markAsRead(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(OS.warn(FS),null)})()}getTickets(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(OS.warn(FS),null)})()}requestRestoreLink(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(OS.warn(FS),null)})()}restoreFromToken(t){var e=this;return re(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(OS.warn(FS),null)})()}restoreFromUrlToken(){var t=this;return re(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(OS.warn(FS),null)})()}getCurrentTicketId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}kc(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}Sc(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},wx={logs:class extends zS{constructor(t){super({get(){var e;return null==t||null===(e=t.config)||void 0===e?void 0:e.logs},captureHintKey:Q,get remoteConfigWillArrive(){var e,i;return!(null===(e=t.il)||void 0===e?void 0:e.call(t))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[t.config.token])||void 0===i?void 0:i.config)}},()=>function(t){var e;const i={};if(i.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:e,windowId:n,sessionStartTimestamp:s,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);i.sessionId=e,i.windowId=n,Re(s)||(i.sessionStartTimestamp=s),Re(r)||(i.lastActivityTimestamp=r)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(i.currentUrl=t.config.disable_capture_url_hashes?cn(h.location.href):h.location.href),t.featureFlags){const e=t.featureFlags.getFlags();e&&e.length>0&&(i.activeFeatureFlags=e)}return i}(t)),this._instance=t,this.name=Bg,this.Rv()}get Ev(){return this._instance.__loaded}Pv(){const t=Or("[logs]"),e=null==h?void 0:h.__PosthogExtensions__;if(!e)return void t.error("PostHog Extensions not found.");const i=e.loadExternalDependency;if(i)return t=>{i(this._instance,"logs",i=>{const n=e.logs;t(i,(null==n?void 0:n.initializeLogs)?{initialize:t=>n.initializeLogs(t),replay(t,e){var i;return null===(i=n.replayConsoleBuffer)||void 0===i?void 0:i.call(n,t,e)}}:void 0)})};t.error(Zt)}}},kx={metrics:class{constructor(t){this._instance=t,this.A=Or("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.To)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.Yp?this.Yp=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=JS(t,i),s=KS(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.Yp&&(this.Yp(),this.Yp=void 0)}Ov(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.Iv&&this.Dv===e||(null===(i=this.Iv)||void 0===i||i.reset(),this.Dv=e,this.Iv=new Er(this.Fv(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.A)),this.Iv}count(t,e=1,i){this.Ov().count(t,e,i)}gauge(t,e,i){this.Ov().gauge(t,e,i)}histogram(t,e,i){this.Ov().histogram(t,e,i)}flush(t){if(!this.Iv)return Promise.resolve();if(t){const e=this.Iv.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Iv.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Iv)||void 0===t||t.reset()}dispose(){var t,e;this.To=!0,null===(t=this.Yp)||void 0===t||t.call(this),this.Yp=void 0,null===(e=this.Iv)||void 0===e||e.reset()}Fv(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Wl.LIB_NAME,getLibraryVersion:()=>Wl.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(ue(ue({method:"POST",url:this.tg(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}tg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Sx={webMCP:class{constructor(t){this._instance=t,this.eg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.eg)return;const t=null==n?void 0:n.modelContext;if(!t||!xe(t.registerTool))return;const e=YS.get(t);if(e)return e.instances.add(this._instance),void(this.eg=!0);const i={instances:new Set([this._instance])},s=t.registerTool,r=this;Sf(t,"registerTool",t=>{const e=t;return function(t,...n){let s=t;try{s=r.ig(t,i)}catch(i){return e.call(this,t,...n)}return e.call(this,s,...n)}}),t.registerTool!==s&&(YS.set(t,i),this.eg=!0)}ig(t,e){if(!t||!xe(t.execute))return t;const i=t.execute,n=this,{tool:s,injected:r}=function(t,e){const i={intent:!1,model:!1},n=t.inputSchema;if(!function(t){return!!Te(t)||$e(t)&&Object.keys(t).every(t=>XS.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!$e(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||$e(t.properties))&&(!t.required||Se(t.required))}(n))return{tool:sx(t),injected:i};const s=(null==n?void 0:n.properties)||{},r=t=>nx(s,t)||Se(null==n?void 0:n.required)&&n.required.includes(t);if(i.intent=e.intent&&!r("context"),i.model=e.model&&!r("llm_model"),!i.intent&&!i.model)return{tool:sx(t),injected:i};const o=ue({},s),a=Se(null==n?void 0:n.required)?[...n.required]:[];return i.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},a.includes("context")||a.push("context")),i.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},a.includes("llm_model")||a.push("llm_model")),{tool:sx(t,ue(ue({},n),{},{type:(null==n?void 0:n.type)||"object",properties:o,required:a})),injected:i}}(t,function(t){const e={intent:!1,model:!1};for(const i of t.instances){const t=ix(i.config.capture_webmcp);e.intent||(e.intent=!0===(null==t?void 0:t.intent)),e.model||(e.model=!0===(null==t?void 0:t.model))}return e}(e));return Object.defineProperty(s,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const a=new Date,l=function(t,e){if(!$e(t))return{};try{const i=e.intent?rx(t.context,2048,!0):void 0,n=e.model?rx(t.llm_model,256):void 0;return ue(ue({},i&&"{}"!==i?{intent:i}:{}),n&&"unknown"!==n.toLowerCase()?{model:n}:{})}catch(t){return{}}}(o[0],r),u=function(t,e){const i=t[0];if(!$e(i))return t;try{const n=e.intent&&nx(i,"context"),s=e.model&&nx(i,"llm_model");if(!n&&!s)return t;const r=ue({},i);return n&&delete r.context,s&&delete r.llm_model,[r,...t.slice(1)]}catch(e){return t}}(o,r);let c;try{c=i.apply(this===s?t:this,u)}catch(t){throw n.ng(e,s,a,{error:t,errorResult:!1},l),t}if((h=c)&&"function"==typeof h.then)return Promise.resolve(c).then(t=>{const i=ox(t)?{error:t,errorResult:!0}:void 0;return n.ng(e,s,a,i,l),t},t=>{throw n.ng(e,s,a,{error:t,errorResult:!1},l),t});var h;const d=ox(c)?{error:c,errorResult:!0}:void 0;return n.ng(e,s,a,d,l),c}}),s}ng(t,e,i,n,r){const o=Date.now()-i.getTime();let a;for(const l of t.instances){const t=ix(l.config.capture_webmcp);if(t){n&&!a&&(a=ux(n.error,n.errorResult));try{l.capture("$mcp_tool_call",ue(ue(ue({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:null==s?void 0:s.hostname,$mcp_duration_ms:o,$mcp_is_error:!!n},a?{$mcp_error_type:a.type,$mcp_error_message:a.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch(t){continue}}}}}};Hk.__defaultExtensionClasses=ue({},ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue(ue({},cx),hx),dx),vx),fx),px),mx),gx),yx),bx),_x),wx),kx),Sx));const xx=function(){Wl.SDK_DIST_CHANNEL="npm";const e=xk[Nk]=new Hk;return function(){function e(){e.done||(e.done=!0,tk=!1,Dr(xk,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():Hr(n,"DOMContentLoaded",e,{capture:!1}):t&&Ar.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var $x=xx;export{gg as Compression,Tw as DEFAULT_PRODUCT_TOUR_APPEARANCE,Tg as DisplaySurveyType,Hk as PostHog,Ew as ProductTourEventName,Iw as ProductTourEventProperties,$g as SurveyEventName,Cg as SurveyEventProperties,mg as SurveyEventType,bg as SurveyPosition,Sg as SurveyQuestionBranchingType,kg as SurveyQuestionType,xg as SurveySchedule,_g as SurveyTabPosition,wg as SurveyType,yg as SurveyWidgetType,$x as default,xx as posthog,Ow as severityLevels};
2
2
  //# sourceMappingURL=module.full.js.map